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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-02-24 07:39:20 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-02-24 07:39:20 +0400
commitd120ec146d3c28b7243371b0de1edf4ba590470c (patch)
treea05f182978c6007bb9193f6ad0b4f2b210394ee8 /source/blender
parent3df023ae82eef0ea105dc61c9730af87b59a07d1 (diff)
parent93c3593d825aafe30aaf051182e50bde4c6084dd (diff)
Merged changes in the trunk up to revision 54802.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenfont/BLF_translation.h2
-rw-r--r--source/blender/blenfont/intern/blf.c6
-rw-r--r--source/blender/blenfont/intern/blf_internal_types.h2
-rw-r--r--source/blender/blenkernel/BKE_DerivedMesh.h2
-rw-r--r--source/blender/blenkernel/BKE_blender.h8
-rw-r--r--source/blender/blenkernel/BKE_bmesh.h3
-rw-r--r--source/blender/blenkernel/BKE_deform.h1
-rw-r--r--source/blender/blenkernel/BKE_depsgraph.h16
-rw-r--r--source/blender/blenkernel/BKE_image.h3
-rw-r--r--source/blender/blenkernel/BKE_node.h7
-rw-r--r--source/blender/blenkernel/BKE_object.h6
-rw-r--r--source/blender/blenkernel/BKE_particle.h5
-rw-r--r--source/blender/blenkernel/BKE_sequencer.h2
-rw-r--r--source/blender/blenkernel/BKE_text.h4
-rw-r--r--source/blender/blenkernel/BKE_tracking.h3
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c41
-rw-r--r--source/blender/blenkernel/intern/anim.c64
-rw-r--r--source/blender/blenkernel/intern/blender.c3
-rw-r--r--source/blender/blenkernel/intern/constraint.c2
-rw-r--r--source/blender/blenkernel/intern/context.c4
-rw-r--r--source/blender/blenkernel/intern/curve.c135
-rw-r--r--source/blender/blenkernel/intern/deform.c21
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c68
-rw-r--r--source/blender/blenkernel/intern/editderivedmesh.c152
-rw-r--r--source/blender/blenkernel/intern/idprop.c6
-rw-r--r--source/blender/blenkernel/intern/image.c14
-rw-r--r--source/blender/blenkernel/intern/key.c2
-rw-r--r--source/blender/blenkernel/intern/movieclip.c2
-rw-r--r--source/blender/blenkernel/intern/node.c20
-rw-r--r--source/blender/blenkernel/intern/object.c53
-rw-r--r--source/blender/blenkernel/intern/particle.c6
-rw-r--r--source/blender/blenkernel/intern/particle_system.c52
-rw-r--r--source/blender/blenkernel/intern/pointcache.c24
-rw-r--r--source/blender/blenkernel/intern/rigidbody.c19
-rw-r--r--source/blender/blenkernel/intern/sca.c6
-rw-r--r--source/blender/blenkernel/intern/scene.c29
-rw-r--r--source/blender/blenkernel/intern/sequencer.c18
-rw-r--r--source/blender/blenkernel/intern/text.c12
-rw-r--r--source/blender/blenkernel/intern/tracking.c149
-rw-r--r--source/blender/blenlib/BLI_listbase.h4
-rw-r--r--source/blender/blenlib/BLI_math_base.h23
-rw-r--r--source/blender/blenlib/BLI_math_rotation.h2
-rw-r--r--source/blender/blenlib/BLI_scanfill.h3
-rw-r--r--source/blender/blenlib/BLI_string_utf8.h1
-rw-r--r--source/blender/blenlib/intern/BLI_heap.c2
-rw-r--r--source/blender/blenlib/intern/BLI_mempool.c14
-rw-r--r--source/blender/blenlib/intern/listbase.c140
-rw-r--r--source/blender/blenlib/intern/math_color_inline.c3
-rw-r--r--source/blender/blenlib/intern/math_geom.c5
-rw-r--r--source/blender/blenlib/intern/math_rotation.c6
-rw-r--r--source/blender/blenlib/intern/math_vector.c19
-rw-r--r--source/blender/blenlib/intern/scanfill.c94
-rw-r--r--source/blender/blenlib/intern/string.c15
-rw-r--r--source/blender/blenlib/intern/string_utf8.c30
-rw-r--r--source/blender/blenloader/intern/readfile.c41
-rw-r--r--source/blender/blenloader/intern/writefile.c4
-rw-r--r--source/blender/bmesh/bmesh_class.h2
-rw-r--r--source/blender/bmesh/intern/bmesh_opdefines.c12
-rw-r--r--source/blender/bmesh/intern/bmesh_operators.c2
-rw-r--r--source/blender/bmesh/intern/bmesh_polygon.c5
-rw-r--r--source/blender/bmesh/operators/bmo_bevel.c2
-rw-r--r--source/blender/bmesh/tools/bmesh_bevel.c44
-rw-r--r--source/blender/bmesh/tools/bmesh_bevel.h6
-rw-r--r--source/blender/collada/AnimationImporter.cpp6
-rw-r--r--source/blender/collada/ArmatureExporter.h1
-rw-r--r--source/blender/collada/ArmatureImporter.cpp75
-rw-r--r--source/blender/collada/DocumentImporter.cpp57
-rw-r--r--source/blender/collada/SkinInfo.cpp5
-rw-r--r--source/blender/collada/collada_utils.cpp12
-rw-r--r--source/blender/compositor/intern/COM_CompositorContext.h3
-rw-r--r--source/blender/compositor/nodes/COM_GroupNode.cpp3
-rw-r--r--source/blender/compositor/operations/COM_MovieDistortionOperation.cpp32
-rw-r--r--source/blender/compositor/operations/COM_MovieDistortionOperation.h3
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c3
-rw-r--r--source/blender/editors/animation/anim_channels_edit.c233
-rw-r--r--source/blender/editors/animation/anim_draw.c17
-rw-r--r--source/blender/editors/animation/anim_filter.c4
-rw-r--r--source/blender/editors/animation/anim_ipo_utils.c8
-rw-r--r--source/blender/editors/animation/drivers.c4
-rw-r--r--source/blender/editors/animation/keyframing.c26
-rw-r--r--source/blender/editors/animation/keyingsets.c7
-rw-r--r--source/blender/editors/armature/editarmature.c4
-rw-r--r--source/blender/editors/armature/poseobject.c2
-rw-r--r--source/blender/editors/curve/editcurve.c20
-rw-r--r--source/blender/editors/curve/editfont.c15
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c19
-rw-r--r--source/blender/editors/include/ED_anim_api.h3
-rw-r--r--source/blender/editors/include/ED_object.h6
-rw-r--r--source/blender/editors/include/ED_view3d.h2
-rw-r--r--source/blender/editors/include/UI_interface.h7
-rw-r--r--source/blender/editors/include/UI_resources.h1
-rw-r--r--source/blender/editors/interface/interface.c20
-rw-r--r--source/blender/editors/interface/interface_handlers.c112
-rw-r--r--source/blender/editors/interface/interface_intern.h4
-rw-r--r--source/blender/editors/interface/interface_ops.c217
-rw-r--r--source/blender/editors/interface/interface_regions.c14
-rw-r--r--source/blender/editors/interface/interface_templates.c58
-rw-r--r--source/blender/editors/interface/interface_widgets.c2
-rw-r--r--source/blender/editors/interface/resources.c10
-rw-r--r--source/blender/editors/interface/view2d.c3
-rw-r--r--source/blender/editors/interface/view2d_ops.c9
-rw-r--r--source/blender/editors/mesh/editface.c4
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c17
-rw-r--r--source/blender/editors/mesh/editmesh_loopcut.c10
-rw-r--r--source/blender/editors/mesh/editmesh_select.c2
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c202
-rw-r--r--source/blender/editors/mesh/editmesh_utils.c4
-rw-r--r--source/blender/editors/mesh/meshtools.c2
-rw-r--r--source/blender/editors/object/object_add.c42
-rw-r--r--source/blender/editors/object/object_bake.c25
-rw-r--r--source/blender/editors/object/object_constraint.c19
-rw-r--r--source/blender/editors/object/object_edit.c26
-rw-r--r--source/blender/editors/object/object_group.c10
-rw-r--r--source/blender/editors/object/object_hook.c6
-rw-r--r--source/blender/editors/object/object_intern.h4
-rw-r--r--source/blender/editors/object/object_modifier.c30
-rw-r--r--source/blender/editors/object/object_ops.c4
-rw-r--r--source/blender/editors/object/object_relations.c74
-rw-r--r--source/blender/editors/object/object_select.c18
-rw-r--r--source/blender/editors/object/object_transform.c9
-rw-r--r--source/blender/editors/physics/dynamicpaint_ops.c2
-rw-r--r--source/blender/editors/physics/particle_boids.c14
-rw-r--r--source/blender/editors/physics/particle_object.c17
-rw-r--r--source/blender/editors/physics/rigidbody_constraint.c6
-rw-r--r--source/blender/editors/physics/rigidbody_object.c8
-rw-r--r--source/blender/editors/render/render_opengl.c2
-rw-r--r--source/blender/editors/screen/area.c10
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c2
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c60
-rw-r--r--source/blender/editors/space_buttons/buttons_context.c7
-rw-r--r--source/blender/editors/space_clip/CMakeLists.txt4
-rw-r--r--source/blender/editors/space_clip/SConscript3
-rw-r--r--source/blender/editors/space_clip/clip_buttons.c83
-rw-r--r--source/blender/editors/space_clip/clip_dopesheet_draw.c27
-rw-r--r--source/blender/editors/space_clip/clip_editor.c2
-rw-r--r--source/blender/editors/space_clip/clip_toolbar.c10
-rw-r--r--source/blender/editors/space_clip/tracking_ops.c4
-rw-r--r--source/blender/editors/space_console/console_draw.c5
-rw-r--r--source/blender/editors/space_graph/graph_buttons.c5
-rw-r--r--source/blender/editors/space_image/image_ops.c4
-rw-r--r--source/blender/editors/space_info/info_draw.c4
-rw-r--r--source/blender/editors/space_info/info_stats.c18
-rw-r--r--source/blender/editors/space_info/textview.c31
-rw-r--r--source/blender/editors/space_info/textview.h1
-rw-r--r--source/blender/editors/space_node/drawnode.c4
-rw-r--r--source/blender/editors/space_outliner/outliner_edit.c14
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c14
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c48
-rw-r--r--source/blender/editors/space_sequencer/sequencer_modifier.c4
-rw-r--r--source/blender/editors/space_text/text_autocomplete.c32
-rw-r--r--source/blender/editors/space_text/text_ops.c2
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c16
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c65
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c69
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c8
-rw-r--r--source/blender/editors/space_view3d/view3d_snap.c12
-rw-r--r--source/blender/editors/transform/transform.c259
-rw-r--r--source/blender/editors/transform/transform.h5
-rw-r--r--source/blender/editors/transform/transform_constraints.c28
-rw-r--r--source/blender/editors/transform/transform_conversions.c18
-rw-r--r--source/blender/editors/transform/transform_generics.c31
-rw-r--r--source/blender/editors/transform/transform_orientations.c10
-rw-r--r--source/blender/editors/transform/transform_snap.c3
-rw-r--r--source/blender/editors/uvedit/CMakeLists.txt5
-rw-r--r--source/blender/editors/uvedit/SConscript9
-rw-r--r--source/blender/editors/uvedit/uvedit_buttons.c10
-rw-r--r--source/blender/editors/uvedit/uvedit_intern.h2
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c2
-rw-r--r--source/blender/editors/uvedit/uvedit_parametrizer.c22
-rw-r--r--source/blender/editors/uvedit/uvedit_unwrap_ops.c2
-rw-r--r--source/blender/gpu/intern/gpu_draw.c7
-rw-r--r--source/blender/imbuf/intern/IMB_colormanagement_intern.h2
-rw-r--r--source/blender/imbuf/intern/dds/dds_api.cpp2
-rw-r--r--source/blender/imbuf/intern/iris.c2
-rw-r--r--source/blender/imbuf/intern/jp2.c219
-rw-r--r--source/blender/imbuf/intern/png.c94
-rw-r--r--source/blender/imbuf/intern/readimage.c9
-rw-r--r--source/blender/makesdna/DNA_genfile.h10
-rw-r--r--source/blender/makesdna/DNA_listBase.h7
-rw-r--r--source/blender/makesdna/DNA_node_types.h8
-rw-r--r--source/blender/makesdna/DNA_particle_types.h8
-rw-r--r--source/blender/makesdna/DNA_rigidbody_types.h44
-rw-r--r--source/blender/makesdna/DNA_scene_types.h28
-rw-r--r--source/blender/makesdna/DNA_tracking_types.h24
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h2
-rw-r--r--source/blender/makesdna/DNA_world_types.h3
-rw-r--r--source/blender/makesdna/SConscript2
-rw-r--r--source/blender/makesdna/intern/dna_genfile.c394
-rw-r--r--source/blender/makesrna/intern/makesrna.c2
-rw-r--r--source/blender/makesrna/intern/rna_action.c2
-rw-r--r--source/blender/makesrna/intern/rna_boid.c4
-rw-r--r--source/blender/makesrna/intern/rna_camera.c3
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c4
-rw-r--r--source/blender/makesrna/intern/rna_curve.c2
-rw-r--r--source/blender/makesrna/intern/rna_define.c3
-rw-r--r--source/blender/makesrna/intern/rna_dynamicpaint.c2
-rw-r--r--source/blender/makesrna/intern/rna_fcurve.c2
-rw-r--r--source/blender/makesrna/intern/rna_image.c4
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c34
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c9
-rw-r--r--source/blender/makesrna/intern/rna_object.c12
-rw-r--r--source/blender/makesrna/intern/rna_object_force.c12
-rw-r--r--source/blender/makesrna/intern/rna_particle.c23
-rw-r--r--source/blender/makesrna/intern/rna_pose.c4
-rw-r--r--source/blender/makesrna/intern/rna_rigidbody.c128
-rw-r--r--source/blender/makesrna/intern/rna_scene.c34
-rw-r--r--source/blender/makesrna/intern/rna_smoke.c2
-rw-r--r--source/blender/makesrna/intern/rna_space.c2
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c3
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c7
-rw-r--r--source/blender/makesrna/intern/rna_world.c12
-rw-r--r--source/blender/modifiers/intern/MOD_bevel.c58
-rw-r--r--source/blender/modifiers/intern/MOD_shrinkwrap.c11
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_alphaOver.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_bilateralblur.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_blur.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_bokehblur.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_bokehimage.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_boxmask.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_brightness.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_channelMatte.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_chromaMatte.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_colorMatte.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_colorSpill.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_colorcorrection.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_composite.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_crop.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_defocus.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_despeckle.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_diffMatte.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_dilate.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_directionalblur.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_displace.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_distanceMatte.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_ellipsemask.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_filter.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_flip.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_gamma.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_glare.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_hueSatVal.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_huecorrect.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_idMask.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_image.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_inpaint.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_invert.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_keying.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_keyingscreen.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_lensdist.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_levels.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_lummaMatte.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_mapRange.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_mapUV.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_mapValue.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_mask.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_math.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_mixrgb.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_movieclip.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_moviedistortion.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_normal.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_normalize.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_outputFile.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_pixelate.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_premulkey.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_rgb.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_rotate.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_scale.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_setalpha.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_splitViewer.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_stabilize2d.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_switch.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_texture.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_tonemap.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_trackpos.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_transform.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_translate.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_valToRgb.c4
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_value.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_vecBlur.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_viewer.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_zcombine.c1
-rw-r--r--source/blender/python/generic/bpy_internal_import.c2
-rw-r--r--source/blender/python/intern/bpy_interface.c17
-rw-r--r--source/blender/python/intern/bpy_props.c11
-rw-r--r--source/blender/render/intern/source/bake.c11
-rw-r--r--source/blender/render/intern/source/convertblender.c10
-rw-r--r--source/blender/render/intern/source/multires_bake.c4
-rw-r--r--source/blender/render/intern/source/pipeline.c174
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c2
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c45
294 files changed, 3620 insertions, 1995 deletions
diff --git a/source/blender/blenfont/BLF_translation.h b/source/blender/blenfont/BLF_translation.h
index 8a99f486783..197809426ae 100644
--- a/source/blender/blenfont/BLF_translation.h
+++ b/source/blender/blenfont/BLF_translation.h
@@ -112,7 +112,7 @@ const char *BLF_translate_do_tooltip(const char *msgctxt, const char *msgid);
/* Default, void context.
* WARNING! The "" context is not the same as no (NULL) context at mo/boost::locale level!
- * NOTE: We translate BLF_I18NCONTEXT_DEFAULT as BLF_I18NCONTEXT_DEFAULT_BPY in Python, as we can’t use "natural"
+ * NOTE: We translate BLF_I18NCONTEXT_DEFAULT as BLF_I18NCONTEXT_DEFAULT_BPY in Python, as we can't use "natural"
* None value in rna string properties... :/
* For perf reason, we only use the first char to detect this context, so other contexts should never start
* with the same char!
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index 16756769675..061e8e28607 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -43,6 +43,8 @@
#include "DNA_listBase.h"
#include "DNA_vec_types.h"
+#include "BLI_math.h"
+
#include "BIF_gl.h"
#include "BLF_api.h"
@@ -516,8 +518,8 @@ static void blf_draw__start(FontBLF *font, GLint *mode, GLint *param)
if (font->flags & BLF_ASPECT)
glScalef(font->aspect[0], font->aspect[1], font->aspect[2]);
- if (font->flags & BLF_ROTATION)
- glRotatef(font->angle, 0.0f, 0.0f, 1.0f);
+ if (font->flags & BLF_ROTATION) /* radians -> degrees */
+ glRotatef(font->angle * (float)(180.0 / M_PI), 0.0f, 0.0f, 1.0f);
if (font->shadow || font->blur)
glGetFloatv(GL_CURRENT_COLOR, font->orig_col);
diff --git a/source/blender/blenfont/intern/blf_internal_types.h b/source/blender/blenfont/intern/blf_internal_types.h
index 1acc3dad4cf..de6e70e4461 100644
--- a/source/blender/blenfont/intern/blf_internal_types.h
+++ b/source/blender/blenfont/intern/blf_internal_types.h
@@ -166,7 +166,7 @@ typedef struct FontBLF {
/* initial position for draw the text. */
float pos[3];
- /* angle in degrees. */
+ /* angle in radians. */
float angle;
/* blur: 3 or 5 large kernel */
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h
index 5f504df5628..486834f9540 100644
--- a/source/blender/blenkernel/BKE_DerivedMesh.h
+++ b/source/blender/blenkernel/BKE_DerivedMesh.h
@@ -95,7 +95,7 @@ struct BMEditMesh;
struct ListBase;
struct PBVH;
-#define DM_OMP_LIMIT 0 /* setting zero so we can catch bugs in OpenMP/BMesh */
+#define DM_OMP_LIMIT 10000 /* setting zero so we can catch bugs in OpenMP/BMesh */
/* number of sub-elements each mesh element has (for interpolation) */
#define SUB_ELEMS_VERT 0
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index 871e9918f6f..d66909449e4 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -41,8 +41,8 @@ extern "C" {
/* 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 265
-#define BLENDER_SUBVERSION 10
+#define BLENDER_VERSION 266
+#define BLENDER_SUBVERSION 0
/* 262 was the last editmesh release but it has compatibility code for bmesh data */
#define BLENDER_MINVERSION 262
@@ -50,9 +50,9 @@ extern "C" {
/* used by packaging tools */
/* can be left blank, otherwise a,b,c... etc with no quotes */
-#define BLENDER_VERSION_CHAR a
+#define BLENDER_VERSION_CHAR
/* alpha/beta/rc/release, docs use this */
-#define BLENDER_VERSION_CYCLE beta
+#define BLENDER_VERSION_CYCLE alpha
extern char versionstr[]; /* from blender.c */
diff --git a/source/blender/blenkernel/BKE_bmesh.h b/source/blender/blenkernel/BKE_bmesh.h
index 8bfee836c0d..4bc21625cf3 100644
--- a/source/blender/blenkernel/BKE_bmesh.h
+++ b/source/blender/blenkernel/BKE_bmesh.h
@@ -38,7 +38,7 @@
/*NOTE: this is the bmesh 1.0 code. it's completely outdated.*/
/* uncomment to use the new bevel operator as a modifier */
-// #define USE_BM_BEVEL_OP_AS_MOD
+#define USE_BM_BEVEL_OP_AS_MOD
/* bevel tool defines */
/* element flags */
@@ -53,6 +53,7 @@
#define BME_BEVEL_RADIUS (1 << 2)
#define BME_BEVEL_ANGLE (1 << 3)
#define BME_BEVEL_WEIGHT (1 << 4)
+#define BME_BEVEL_VGROUP (1 << 5)
//~ #define BME_BEVEL_EWEIGHT (1<<4)
//~ #define BME_BEVEL_VWEIGHT (1<<5)
#define BME_BEVEL_PERCENT (1 << 6)
diff --git a/source/blender/blenkernel/BKE_deform.h b/source/blender/blenkernel/BKE_deform.h
index 0fa7356b64e..b209e8bf667 100644
--- a/source/blender/blenkernel/BKE_deform.h
+++ b/source/blender/blenkernel/BKE_deform.h
@@ -55,6 +55,7 @@ void defvert_add_index_notest(struct MDeformVert *dv, int de
void defvert_remove_group(struct MDeformVert *dvert, struct MDeformWeight *dw);
void defvert_clear(struct MDeformVert *dvert);
int defvert_find_shared(const struct MDeformVert *dvert_a, const struct MDeformVert *dvert_b);
+bool defvert_is_weight_zero(const struct MDeformVert *dvert, const int defgroup_tot);
void BKE_defvert_array_free_elems(struct MDeformVert *dvert, int totvert);
void BKE_defvert_array_free(struct MDeformVert *dvert, int totvert);
diff --git a/source/blender/blenkernel/BKE_depsgraph.h b/source/blender/blenkernel/BKE_depsgraph.h
index 49dc1bfd732..4cdfc1cba95 100644
--- a/source/blender/blenkernel/BKE_depsgraph.h
+++ b/source/blender/blenkernel/BKE_depsgraph.h
@@ -99,8 +99,16 @@ int is_acyclic(struct DagForest *dag);
/* ********** API *************** */
/* Note that the DAG never executes changes in Objects, only sets flags in Objects */
-/* (re)-create dependency graph for scene */
-void DAG_scene_sort(struct Main *bmain, struct Scene *sce);
+/* clear all dependency graphs, call this when changing relations between objects.
+ * the dependency graphs will be rebuilt just before they are used to avoid them
+ * getting rebuild many times during operators */
+void DAG_relations_tag_update(struct Main *bmain);
+
+/* (re)-create the dependency graph before using it */
+void DAG_scene_relations_update(struct Main *bmain, struct Scene *sce);
+
+/* force an immediate rebuild of the dependency graph, only needed in rare cases */
+void DAG_scene_relations_rebuild(struct Main *bmain, struct Scene *scene);
/* flag all objects that need recalc because they're animated */
void DAG_scene_update_flags(struct Main *bmain, struct Scene *sce, unsigned int lay, const short do_time);
@@ -109,10 +117,8 @@ void DAG_scene_flush_update(struct Main *bmain, struct Scene *sce, unsigned i
/* tag objects for update on file load */
void DAG_on_visible_update(struct Main *bmain, const short do_time);
-/* when setting manual RECALC flags, call this afterwards */
-void DAG_ids_flush_update(struct Main *bmain, int time);
-
/* tag datablock to get updated for the next redraw */
+void DAG_id_tag_update_ex(struct Main *bmain, struct ID *id, short flag);
void DAG_id_tag_update(struct ID *id, short flag);
/* flush all tagged updates */
void DAG_ids_flush_tagged(struct Main *bmain);
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h
index d12b048bc96..dd7e06259bd 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -152,6 +152,9 @@ void BKE_image_pool_free(struct ImagePool *pool);
struct ImBuf *BKE_image_pool_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, struct ImagePool *pool);
void BKE_image_pool_release_ibuf(struct Image *ima, struct ImBuf *ibuf, struct ImagePool *pool);
+/* set an alpha mode based on file extension */
+void BKE_image_alpha_mode_from_extension(struct Image *image);
+
/* returns a new image or NULL if it can't load */
struct Image *BKE_image_load(struct Main *bmain, const char *filepath);
/* returns existing Image when filename/type is same (frame optional) */
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index 5024b3636c5..19fe621ade9 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -261,6 +261,12 @@ typedef struct bNodeType {
#define SOCK_IN 1
#define SOCK_OUT 2
+typedef enum eNodeSizePreset {
+ NODE_SIZE_DEFAULT,
+ NODE_SIZE_SMALL,
+ NODE_SIZE_LARGE
+} eNodeSizePreset;
+
struct bNodeTreeExec;
typedef void (*bNodeTreeCallback)(void *calldata, struct ID *owner_id, struct bNodeTree *ntree);
@@ -419,6 +425,7 @@ void node_type_base(struct bNodeTreeType *ttype, struct bNodeType *nt
const char *name, short nclass, short flag);
void node_type_socket_templates(struct bNodeType *ntype, struct bNodeSocketTemplate *inputs, struct bNodeSocketTemplate *outputs);
void node_type_size(struct bNodeType *ntype, int width, int minwidth, int maxwidth);
+void node_type_size_preset(struct bNodeType *ntype, eNodeSizePreset size);
void node_type_init(struct bNodeType *ntype, void (*initfunc)(struct bNodeTree *ntree, struct bNode *node, struct bNodeTemplate *ntemp));
void node_type_valid(struct bNodeType *ntype, int (*validfunc)(struct bNodeTree *ntree, struct bNodeTemplate *ntemp));
void node_type_storage(struct bNodeType *ntype,
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 19c04676548..89860cd0da9 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -103,7 +103,8 @@ struct Object *BKE_object_pose_armature_get(struct Object *ob);
void BKE_object_where_is_calc(struct Scene *scene, struct Object *ob);
void BKE_object_where_is_calc_ex(struct Scene *scene, struct RigidBodyWorld *rbw, struct Object *ob);
void BKE_object_where_is_calc_time(struct Scene *scene, struct Object *ob, float ctime);
-void BKE_object_where_is_calc_time_ex(struct Scene *scene, struct RigidBodyWorld *rbw, struct Object *ob, float ctime);
+void BKE_object_where_is_calc_time_ex(struct Scene *scene, struct Object *ob, float ctime,
+ struct RigidBodyWorld *rbw);
void BKE_object_where_is_calc_simul(struct Scene *scene, struct Object *ob);
void BKE_object_where_is_calc_mat4(struct Scene *scene, struct Object *ob, float obmat[4][4]);
@@ -149,7 +150,8 @@ void BKE_object_tfm_protected_restore(struct Object *ob,
const short protectflag);
void BKE_object_handle_update(struct Scene *scene, struct Object *ob);
-void BKE_object_handle_update_ex(struct Scene *scene, struct RigidBodyWorld *rbw, struct Object *ob);
+void BKE_object_handle_update_ex(struct Scene *scene, struct Object *ob,
+ struct RigidBodyWorld *rbw);
void BKE_object_sculpt_modifiers_changed(struct Object *ob);
int BKE_object_obdata_texspace_get(struct Object *ob, short **r_texflag, float **r_loc, float **r_size, float **r_rot);
diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h
index a9a8bc32064..6c207675cb1 100644
--- a/source/blender/blenkernel/BKE_particle.h
+++ b/source/blender/blenkernel/BKE_particle.h
@@ -220,7 +220,10 @@ typedef struct ParticleCollision {
ParticleCollisionElement pce;
- float total_time, inv_timestep;
+ /* total_time is the amount of time in this subframe
+ * inv_total_time is the opposite
+ * inv_timestep is the inverse of the amount of time in this frame */
+ float total_time, inv_total_time, inv_timestep;
float radius;
float co1[3], co2[3];
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h
index e3d9c513c5c..eef134a6872 100644
--- a/source/blender/blenkernel/BKE_sequencer.h
+++ b/source/blender/blenkernel/BKE_sequencer.h
@@ -356,6 +356,8 @@ typedef struct SeqLoadInfo {
typedef struct Sequence *(*SeqLoadFunc)(struct bContext *, ListBase *, struct SeqLoadInfo *);
struct Sequence *BKE_sequence_alloc(ListBase *lb, int cfra, int machine);
+
+void BKE_sequence_alpha_mode_from_extension(struct Sequence *seq);
void BKE_sequence_init_colorspace(struct Sequence *seq);
struct Sequence *BKE_sequencer_add_image_strip(struct bContext *C, ListBase *seqbasep, struct SeqLoadInfo *seq_load);
diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h
index 3e882a048eb..3d7b5d1c8e4 100644
--- a/source/blender/blenkernel/BKE_text.h
+++ b/source/blender/blenkernel/BKE_text.h
@@ -109,6 +109,10 @@ int text_check_identifier_nodigit(const char ch);
int text_check_whitespace(const char ch);
int text_find_identifier_start(const char *str, int i);
+/* defined in bpy_interface.c */
+extern int text_check_identifier_unicode(const unsigned int ch);
+extern int text_check_identifier_nodigit_unicode(const unsigned int ch);
+
enum {
TXT_MOVE_LINE_UP = -1,
TXT_MOVE_LINE_DOWN = 1
diff --git a/source/blender/blenkernel/BKE_tracking.h b/source/blender/blenkernel/BKE_tracking.h
index eb7004b1ced..9bdc96e187d 100644
--- a/source/blender/blenkernel/BKE_tracking.h
+++ b/source/blender/blenkernel/BKE_tracking.h
@@ -46,6 +46,7 @@ struct MovieDistortion;
struct Camera;
struct Object;
struct Scene;
+struct rcti;
/* **** Common functions **** */
@@ -156,6 +157,8 @@ struct ImBuf *BKE_tracking_undistort_frame(struct MovieTracking *tracking, struc
struct ImBuf *BKE_tracking_distort_frame(struct MovieTracking *tracking, struct ImBuf *ibuf,
int calibration_width, int calibration_height, float overscan);
+void BKE_tracking_max_undistortion_delta_across_bound(struct MovieTracking *tracking, struct rcti *rect, float delta[2]);
+
/* **** Image sampling **** */
struct ImBuf *BKE_tracking_sample_pattern(int frame_width, int frame_height,
struct ImBuf *struct_ibuf, struct MovieTrackingTrack *track,
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 8e740075bc6..6b3c95a5cd3 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -1017,8 +1017,12 @@ void weight_to_rgb(float r_rgb[3], const float weight)
/* draw_flag's for calc_weightpaint_vert_color */
enum {
- CALC_WP_MULTIPAINT = (1 << 0),
- CALC_WP_AUTO_NORMALIZE = (1 << 1)
+ /* only one of these should be set, keep first (for easy bit-shifting) */
+ CALC_WP_GROUP_USER_ACTIVE = (1 << 1),
+ CALC_WP_GROUP_USER_ALL = (1 << 2),
+
+ CALC_WP_MULTIPAINT = (1 << 3),
+ CALC_WP_AUTO_NORMALIZE = (1 << 4)
};
static void weightpaint_color(unsigned char r_col[4], ColorBand *coba, const float input)
@@ -1050,7 +1054,7 @@ static void calc_weightpaint_vert_color(
{
float input = 0.0f;
- int make_black = FALSE;
+ bool make_black = false;
if ((defbase_sel_tot > 1) && (draw_flag & CALC_WP_MULTIPAINT)) {
int was_a_nonzero = FALSE;
@@ -1072,7 +1076,7 @@ static void calc_weightpaint_vert_color(
/* make it black if the selected groups have no weight on a vertex */
if (was_a_nonzero == FALSE) {
- make_black = TRUE;
+ make_black = true;
}
else if ((draw_flag & CALC_WP_AUTO_NORMALIZE) == FALSE) {
input /= defbase_sel_tot; /* get the average */
@@ -1081,6 +1085,17 @@ static void calc_weightpaint_vert_color(
else {
/* default, non tricky behavior */
input = defvert_find_weight(dv, defbase_act);
+
+ if (draw_flag & CALC_WP_GROUP_USER_ACTIVE) {
+ if (input == 0.0f) {
+ make_black = true;
+ }
+ }
+ else if (draw_flag & CALC_WP_GROUP_USER_ALL) {
+ if (input == 0.0f) {
+ make_black = defvert_is_weight_zero(dv, defbase_tot);
+ }
+ }
}
if (make_black) { /* TODO, theme color */
@@ -1138,7 +1153,12 @@ static unsigned char *calc_weightpaint_vert_array(Object *ob, DerivedMesh *dm, i
}
else {
int col_i;
- weightpaint_color((unsigned char *)&col_i, coba, 0.0f);
+ if (draw_flag & (CALC_WP_GROUP_USER_ACTIVE | CALC_WP_GROUP_USER_ALL)) {
+ col_i = 0;
+ }
+ else {
+ weightpaint_color((unsigned char *)&col_i, coba, 0.0f);
+ }
fill_vn_i((int *)wtcol_v, numVerts, col_i);
}
@@ -1354,8 +1374,11 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
int sculpt_mode = ob->mode & OB_MODE_SCULPT && ob->sculpt;
int sculpt_dyntopo = (sculpt_mode && ob->sculpt->bm);
- const int draw_flag = ((scene->toolsettings->multipaint ? CALC_WP_MULTIPAINT : 0) |
+ const int draw_flag = ((scene->toolsettings->multipaint ? CALC_WP_MULTIPAINT :
+ /* CALC_WP_GROUP_USER_ACTIVE or CALC_WP_GROUP_USER_ALL*/
+ (1 << scene->toolsettings->weightuser)) |
(scene->toolsettings->auto_normalize ? CALC_WP_AUTO_NORMALIZE : 0));
+
/* Generic preview only in object mode! */
const int do_mod_mcol = (ob->mode == OB_MODE_OBJECT);
#if 0 /* XXX Will re-enable this when we have global mod stack options. */
@@ -2720,7 +2743,7 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
a = attribs->tottface++;
attribs->tface[a].array = tfdata->layers[layer].data;
- attribs->tface[a].em_offset = tfdata->layers[layer].offset;
+ attribs->tface[a].em_offset = ldata->layers[layer].offset;
attribs->tface[a].gl_index = gattribs->layer[b].glindex;
attribs->tface[a].gl_texco = gattribs->layer[b].gltexco;
}
@@ -2757,7 +2780,8 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
a = attribs->totmcol++;
attribs->mcol[a].array = tfdata->layers[layer].data;
- attribs->mcol[a].em_offset = tfdata->layers[layer].offset;
+ /* odd, store the offset for a different layer type here, but editmode draw code expects it */
+ attribs->mcol[a].em_offset = ldata->layers[layer].offset;
attribs->mcol[a].gl_index = gattribs->layer[b].glindex;
}
}
@@ -2773,6 +2797,7 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
a = attribs->totmcol++;
attribs->mcol[a].array = tfdata->layers[layer].data;
+ /* odd, store the offset for a different layer type here, but editmode draw code expects it */
attribs->mcol[a].em_offset = tfdata->layers[layer].offset;
attribs->mcol[a].gl_index = gattribs->layer[b].glindex;
}
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index a6b3008e00a..4eb26e81ae2 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -69,7 +69,6 @@
#include "BKE_depsgraph.h"
#include "BKE_anim.h"
#include "BKE_report.h"
-#include "BKE_rigidbody.h"
// XXX bad level call...
@@ -320,46 +319,45 @@ static void motionpaths_calc_optimise_depsgraph(Scene *scene, ListBase *targets)
}
/* "brew me a list that's sorted a bit faster now depsy" */
- DAG_scene_sort(G.main, scene);
+ DAG_scene_relations_rebuild(G.main, scene);
}
/* update scene for current frame */
static void motionpaths_calc_update_scene(Scene *scene)
{
#if 1 // 'production' optimizations always on
- Base *base, *last = NULL;
- float ctime = BKE_scene_frame_get(scene);
-
- /* only stuff that moves or needs display still */
- DAG_scene_update_flags(G.main, scene, scene->lay, TRUE);
-
- /* find the last object with the tag
- * - all those afterwards are assumed to not be relevant for our calculations
- */
- /* optimize further by moving out... */
- for (base = scene->base.first; base; base = base->next) {
- if (base->object->flag & BA_TEMP_TAG)
- last = base;
+
+ /* rigid body simulation needs complete update to work correctly for now */
+ /* RB_TODO investigate if we could avoid updating everything */
+ if (BKE_scene_check_rigidbody_active(scene)) {
+ BKE_scene_update_for_newframe(G.main, scene, scene->lay);
}
-
- /* run rigidbody sim
- * NOTE: keep in sync with BKE_scene_update_for_newframe() in scene.c
- */
- // XXX: this position may still change, objects not being updated correctly before simulation is run
- // NOTE: current position is so that rigidbody sim affects other objects
- if (BKE_scene_check_rigidbody_active(scene))
- BKE_rigidbody_do_simulation(scene, ctime);
-
- /* perform updates for tagged objects */
- /* XXX: this will break if rigs depend on scene or other data that
- * is animated but not attached to/updatable from objects */
- for (base = scene->base.first; base; base = base->next) {
- /* update this object */
- BKE_object_handle_update(scene, base->object);
+ else { /* otherwise we can optimize by restricting updates */
+ Base *base, *last = NULL;
+
+ /* only stuff that moves or needs display still */
+ DAG_scene_update_flags(G.main, scene, scene->lay, TRUE);
- /* if this is the last one we need to update, let's stop to save some time */
- if (base == last)
- break;
+ /* find the last object with the tag
+ * - all those afterwards are assumed to not be relevant for our calculations
+ */
+ /* optimize further by moving out... */
+ for (base = scene->base.first; base; base = base->next) {
+ if (base->object->flag & BA_TEMP_TAG)
+ last = base;
+ }
+
+ /* perform updates for tagged objects */
+ /* XXX: this will break if rigs depend on scene or other data that
+ * is animated but not attached to/updatable from objects */
+ for (base = scene->base.first; base; base = base->next) {
+ /* update this object */
+ BKE_object_handle_update(scene, base->object);
+
+ /* if this is the last one we need to update, let's stop to save some time */
+ if (base == last)
+ break;
+ }
}
#else // original, 'always correct' version
/* do all updates
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index fb2d1a3aaf7..be316197078 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -1000,8 +1000,7 @@ int BKE_copybuffer_paste(bContext *C, char *libname, ReportList *reports)
flag_all_listbases_ids(LIB_PRE_EXISTING, 0);
/* recreate dependency graph to include new objects */
- DAG_scene_sort(bmain, scene);
- DAG_ids_flush_update(bmain, 0);
+ DAG_relations_tag_update(bmain);
BLO_blendhandle_close(bh);
/* remove library... */
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 1a25def3829..48ad3f51389 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -4261,7 +4261,7 @@ static void con_unlink_refs_cb(bConstraint *UNUSED(con), ID **idpoin, short isRe
/* Free data of a specific constraint if it has any info.
* be sure to run BIK_clear_data() when freeing an IK constraint,
- * unless DAG_scene_sort is called.
+ * unless DAG_relations_tag_update is called.
*/
void BKE_free_constraint_data(bConstraint *con)
{
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index a45afa5e69a..a9e3d52f223 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -48,6 +48,8 @@
#include "BLI_threads.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "BKE_context.h"
#include "BKE_main.h"
#include "BKE_screen.h"
@@ -851,7 +853,7 @@ void CTX_wm_operator_poll_msg_set(bContext *C, const char *msg)
const char *CTX_wm_operator_poll_msg_get(bContext *C)
{
- return C->wm.operator_poll_msg;
+ return IFACE_(C->wm.operator_poll_msg);
}
/* data context */
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 7d6212f8760..2da75ec64be 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -2202,6 +2202,70 @@ static void make_bevel_list_segment_3D(BevList *bl)
copy_qt_qt(bevp2->quat, bevp1->quat);
}
+/* only for 2 points */
+static void make_bevel_list_segment_2D(BevList *bl)
+{
+ BevPoint *bevp2 = (BevPoint *)(bl + 1);
+ BevPoint *bevp1 = bevp2 + 1;
+
+ const float x1 = bevp1->vec[0] - bevp2->vec[0];
+ const float y1 = bevp1->vec[1] - bevp2->vec[1];
+
+ calc_bevel_sin_cos(x1, y1, -x1, -y1, &(bevp1->sina), &(bevp1->cosa));
+ bevp2->sina = bevp1->sina;
+ bevp2->cosa = bevp1->cosa;
+
+ /* fill in dir & quat */
+ make_bevel_list_segment_3D(bl);
+}
+
+static void make_bevel_list_2D(BevList *bl)
+{
+ /* note: bevp->dir and bevp->quat are not needed for beveling but are
+ * used when making a path from a 2D curve, therefor they need to be set - Campbell */
+
+ BevPoint *bevp2 = (BevPoint *)(bl + 1);
+ BevPoint *bevp1 = bevp2 + (bl->nr - 1);
+ BevPoint *bevp0 = bevp1 - 1;
+ int nr;
+
+ nr = bl->nr;
+ while (nr--) {
+ const float x1 = bevp1->vec[0] - bevp0->vec[0];
+ const float x2 = bevp1->vec[0] - bevp2->vec[0];
+ const float y1 = bevp1->vec[1] - bevp0->vec[1];
+ const float y2 = bevp1->vec[1] - bevp2->vec[1];
+
+ calc_bevel_sin_cos(x1, y1, x2, y2, &(bevp1->sina), &(bevp1->cosa));
+
+ /* from: make_bevel_list_3D_zup, could call but avoid a second loop.
+ * no need for tricky tilt calculation as with 3D curves */
+ bisect_v3_v3v3v3(bevp1->dir, bevp0->vec, bevp1->vec, bevp2->vec);
+ vec_to_quat(bevp1->quat, bevp1->dir, 5, 1);
+ /* done with inline make_bevel_list_3D_zup */
+
+ bevp0 = bevp1;
+ bevp1 = bevp2;
+ bevp2++;
+ }
+
+ /* correct non-cyclic cases */
+ if (bl->poly == -1) {
+ BevPoint *bevp = (BevPoint *)(bl + 1);
+ bevp1 = bevp + 1;
+ bevp->sina = bevp1->sina;
+ bevp->cosa = bevp1->cosa;
+ bevp = (BevPoint *)(bl + 1);
+ bevp += (bl->nr - 1);
+ bevp1 = bevp - 1;
+ bevp->sina = bevp1->sina;
+ bevp->cosa = bevp1->cosa;
+
+ /* correct for the dir/quat, see above why its needed */
+ bevel_list_cyclic_fix_3D(bl);
+ }
+}
+
void BKE_curve_bevelList_make(Object *ob)
{
/*
@@ -2216,7 +2280,7 @@ void BKE_curve_bevelList_make(Object *ob)
BPoint *bp;
BevList *bl, *blnew, *blnext;
BevPoint *bevp, *bevp2, *bevp1 = NULL, *bevp0;
- float min, inp, x1, x2, y1, y2;
+ float min, inp;
struct bevelsort *sortdata, *sd, *sd1;
int a, b, nr, poly, resolu = 0, len = 0;
int do_tilt, do_radius, do_weight;
@@ -2534,76 +2598,22 @@ void BKE_curve_bevelList_make(Object *ob)
/* STEP 4: 2D-COSINES or 3D ORIENTATION */
if ((cu->flag & CU_3D) == 0) {
- /* note: bevp->dir and bevp->quat are not needed for beveling but are
- * used when making a path from a 2D curve, therefor they need to be set - Campbell */
- bl = cu->bev.first;
- while (bl) {
-
+ /* 2D Curves */
+ for (bl = cu->bev.first; bl; bl = bl->next) {
if (bl->nr < 2) {
/* do nothing */
}
else if (bl->nr == 2) { /* 2 pnt, treat separate */
- bevp2 = (BevPoint *)(bl + 1);
- bevp1 = bevp2 + 1;
-
- x1 = bevp1->vec[0] - bevp2->vec[0];
- y1 = bevp1->vec[1] - bevp2->vec[1];
-
- calc_bevel_sin_cos(x1, y1, -x1, -y1, &(bevp1->sina), &(bevp1->cosa));
- bevp2->sina = bevp1->sina;
- bevp2->cosa = bevp1->cosa;
-
- /* fill in dir & quat */
- make_bevel_list_segment_3D(bl);
+ make_bevel_list_segment_2D(bl);
}
else {
- bevp2 = (BevPoint *)(bl + 1);
- bevp1 = bevp2 + (bl->nr - 1);
- bevp0 = bevp1 - 1;
-
- nr = bl->nr;
- while (nr--) {
- x1 = bevp1->vec[0] - bevp0->vec[0];
- x2 = bevp1->vec[0] - bevp2->vec[0];
- y1 = bevp1->vec[1] - bevp0->vec[1];
- y2 = bevp1->vec[1] - bevp2->vec[1];
-
- calc_bevel_sin_cos(x1, y1, x2, y2, &(bevp1->sina), &(bevp1->cosa));
-
- /* from: make_bevel_list_3D_zup, could call but avoid a second loop.
- * no need for tricky tilt calculation as with 3D curves */
- bisect_v3_v3v3v3(bevp1->dir, bevp0->vec, bevp1->vec, bevp2->vec);
- vec_to_quat(bevp1->quat, bevp1->dir, 5, 1);
- /* done with inline make_bevel_list_3D_zup */
-
- bevp0 = bevp1;
- bevp1 = bevp2;
- bevp2++;
- }
-
- /* correct non-cyclic cases */
- if (bl->poly == -1) {
- bevp = (BevPoint *)(bl + 1);
- bevp1 = bevp + 1;
- bevp->sina = bevp1->sina;
- bevp->cosa = bevp1->cosa;
- bevp = (BevPoint *)(bl + 1);
- bevp += (bl->nr - 1);
- bevp1 = bevp - 1;
- bevp->sina = bevp1->sina;
- bevp->cosa = bevp1->cosa;
-
- /* correct for the dir/quat, see above why its needed */
- bevel_list_cyclic_fix_3D(bl);
- }
+ make_bevel_list_2D(bl);
}
- bl = bl->next;
}
}
- else { /* 3D Curves */
- bl = cu->bev.first;
- while (bl) {
-
+ else {
+ /* 3D Curves */
+ for (bl = cu->bev.first; bl; bl = bl->next) {
if (bl->nr < 2) {
/* do nothing */
}
@@ -2613,7 +2623,6 @@ void BKE_curve_bevelList_make(Object *ob)
else {
make_bevel_list_3D(bl, (int)(resolu * cu->twist_smooth), cu->twist_mode);
}
- bl = bl->next;
}
}
}
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c
index de15100de0b..439180e8d76 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -41,14 +41,13 @@
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
-#include "BKE_deform.h"
-
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
+#include "BKE_deform.h" /* own include */
void defgroup_copy_list(ListBase *outbase, ListBase *inbase)
{
@@ -787,6 +786,24 @@ int defvert_find_shared(const MDeformVert *dvert_a, const MDeformVert *dvert_b)
return -1;
}
+/**
+ * return true if has no weights
+ */
+bool defvert_is_weight_zero(const struct MDeformVert *dvert, const int defgroup_tot)
+{
+ MDeformWeight *dw = dvert->dw;
+ unsigned int i;
+ for (i = dvert->totweight; i != 0; i--, dw++) {
+ if (dw->weight != 0.0f) {
+ /* check the group is in-range, happens on rare situations */
+ if (LIKELY(dw->def_nr < defgroup_tot)) {
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
/* -------------------------------------------------------------------- */
/* Defvert Array functions */
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index 99d0c5ed964..8c55ad02dc6 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -837,7 +837,6 @@ DagForest *build_dag(Main *bmain, Scene *sce, short mask)
DagAdjList *itA;
dag = sce->theDag;
- sce->dagisvalid = 1;
if (dag)
free_forest(dag);
else {
@@ -1846,8 +1845,18 @@ static void scene_sort_groups(Main *bmain, Scene *sce)
}
}
+/* free the depency graph */
+static void dag_scene_free(Scene *sce)
+{
+ if (sce->theDag) {
+ free_forest(sce->theDag);
+ MEM_freeN(sce->theDag);
+ sce->theDag = NULL;
+ }
+}
+
/* sort the base list on dependency order */
-void DAG_scene_sort(Main *bmain, Scene *sce)
+static void dag_scene_build(Main *bmain, Scene *sce)
{
DagNode *node, *rootnode;
DagNodeQueue *nqueue;
@@ -1856,7 +1865,7 @@ void DAG_scene_sort(Main *bmain, Scene *sce)
int skip = 0;
ListBase tempbase;
Base *base;
-
+
tempbase.first = tempbase.last = NULL;
build_dag(bmain, sce, DAG_RL_ALL_BUT_DATA);
@@ -1936,10 +1945,34 @@ void DAG_scene_sort(Main *bmain, Scene *sce)
printf(" %s\n", base->object->id.name);
}
}
+
/* temporal...? */
sce->recalc |= SCE_PRV_CHANGED; /* test for 3d preview */
}
+/* clear all dependency graphs */
+void DAG_relations_tag_update(Main *bmain)
+{
+ Scene *sce;
+
+ for (sce = bmain->scene.first; sce; sce = sce->id.next)
+ dag_scene_free(sce);
+}
+
+/* rebuild dependency graph only for a given scene */
+void DAG_scene_relations_rebuild(Main *bmain, Scene *sce)
+{
+ dag_scene_free(sce);
+ DAG_scene_relations_update(bmain, sce);
+}
+
+/* create dependency graph if it was cleared or didn't exist yet */
+void DAG_scene_relations_update(Main *bmain, Scene *sce)
+{
+ if (!sce->theDag)
+ dag_scene_build(bmain, sce);
+}
+
static void lib_id_recalc_tag(Main *bmain, ID *id)
{
id->flag |= LIB_ID_RECALC;
@@ -2177,7 +2210,7 @@ void DAG_scene_flush_update(Main *bmain, Scene *sce, unsigned int lay, const sho
if (sce->theDag == NULL) {
printf("DAG zero... not allowed to happen!\n");
- DAG_scene_sort(bmain, sce);
+ DAG_scene_relations_update(bmain, sce);
}
firstnode = sce->theDag->DagNode.first; /* always scene node */
@@ -2545,20 +2578,6 @@ static void dag_current_scene_layers(Main *bmain, ListBase *lb)
}
}
-void DAG_ids_flush_update(Main *bmain, int time)
-{
- ListBase listbase;
- DagSceneLayer *dsl;
-
- /* get list of visible scenes and layers */
- dag_current_scene_layers(bmain, &listbase);
-
- for (dsl = listbase.first; dsl; dsl = dsl->next)
- DAG_scene_flush_update(bmain, dsl->scene, dsl->layer, time);
-
- BLI_freelistN(&listbase);
-}
-
void DAG_on_visible_update(Main *bmain, const short do_time)
{
ListBase listbase;
@@ -2895,12 +2914,10 @@ void DAG_ids_clear_recalc(Main *bmain)
memset(bmain->id_tag_update, 0, sizeof(bmain->id_tag_update));
}
-void DAG_id_tag_update(ID *id, short flag)
+void DAG_id_tag_update_ex(Main *bmain, ID *id, short flag)
{
- Main *bmain = G.main;
-
if (id == NULL) return;
-
+
/* tag ID for update */
if (flag) {
if (flag & OB_RECALC_OB)
@@ -2955,6 +2972,11 @@ void DAG_id_tag_update(ID *id, short flag)
}
}
+void DAG_id_tag_update(ID *id, short flag)
+{
+ DAG_id_tag_update_ex(G.main, id, flag);
+}
+
void DAG_id_type_tag(Main *bmain, short idtype)
{
if (idtype == ID_NT) {
@@ -3169,7 +3191,7 @@ void DAG_print_dependencies(Main *bmain, Scene *scene, Object *ob)
}
else {
printf("\nDEPENDENCY RELATIONS for %s\n\n", scene->id.name + 2);
- DAG_scene_sort(bmain, scene);
+ DAG_scene_relations_rebuild(bmain, scene);
}
dag_print_dependencies = 0;
diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c
index d652b97e2fa..11c05772962 100644
--- a/source/blender/blenkernel/intern/editderivedmesh.c
+++ b/source/blender/blenkernel/intern/editderivedmesh.c
@@ -997,6 +997,43 @@ static void emDM_drawMappedFacesTex(DerivedMesh *dm,
emDM_drawFacesTex_common(dm, NULL, setDrawOptions, compareDrawOptions, userData);
}
+/**
+ * \note
+ *
+ * For UV's:
+ * const MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(loop, attribs->tface[i].em_offset);
+ *
+ * This is intentionally different to calling:
+ * CustomData_bmesh_get_n(&bm->ldata, loop->head.data, CD_MLOOPUV, i);
+ *
+ * ... because the material may use layer names to select different UV's
+ * see: [#34378]
+ */
+static void emdm_pass_attrib_vertex_glsl(DMVertexAttribs *attribs, BMLoop *loop, int index_in_face)
+{
+ BMVert *eve = loop->v;
+ int i;
+
+ if (attribs->totorco) {
+ const float *orco = attribs->orco.array[BM_elem_index_get(eve)];
+ glVertexAttrib3fvARB(attribs->orco.gl_index, orco);
+ }
+ for (i = 0; i < attribs->tottface; i++) {
+ const MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(loop, attribs->tface[i].em_offset);
+ glVertexAttrib2fvARB(attribs->tface[i].gl_index, luv->uv);
+ }
+ for (i = 0; i < attribs->totmcol; i++) {
+ const MLoopCol *cp = BM_ELEM_CD_GET_VOID_P(loop, attribs->mcol[i].em_offset);
+ GLubyte col[4];
+ col[0] = cp->b; col[1] = cp->g; col[2] = cp->r; col[3] = cp->a;
+ glVertexAttrib4ubvARB(attribs->mcol[i].gl_index, col);
+ }
+ if (attribs->tottang) {
+ const float *tang = attribs->tang.array[i * 4 + index_in_face];
+ glVertexAttrib3fvARB(attribs->tang.gl_index, tang);
+ }
+}
+
static void emDM_drawMappedFacesGLSL(DerivedMesh *dm,
DMSetMaterial setMaterial,
DMSetDrawOptions setDrawOptions,
@@ -1012,7 +1049,7 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm,
DMVertexAttribs attribs;
GPUVertexAttribs gattribs;
- int i, b, matnr, new_matnr, do_draw;
+ int i, matnr, new_matnr, do_draw;
do_draw = FALSE;
matnr = -1;
@@ -1023,30 +1060,6 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm,
glShadeModel(GL_SMOOTH);
BM_mesh_elem_index_ensure(bm, BM_VERT | BM_FACE);
-#define PASSATTRIB(loop, eve, vert) { \
- if (attribs.totorco) { \
- float *orco = attribs.orco.array[BM_elem_index_get(eve)]; \
- glVertexAttrib3fvARB(attribs.orco.gl_index, orco); \
- } \
- for (b = 0; b < attribs.tottface; b++) { \
- MLoopUV *_luv = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, \
- CD_MLOOPUV, b); \
- glVertexAttrib2fvARB(attribs.tface[b].gl_index, _luv->uv); \
- } \
- for (b = 0; b < attribs.totmcol; b++) { \
- MLoopCol *_cp = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, \
- CD_MLOOPCOL, b); \
- GLubyte _col[4]; \
- _col[0] = _cp->b; _col[1] = _cp->g; _col[2] = _cp->r; _col[3] = _cp->a; \
- glVertexAttrib4ubvARB(attribs.mcol[b].gl_index, _col); \
- } \
- if (attribs.tottang) { \
- float *tang = attribs.tang.array[i * 4 + vert]; \
- glVertexAttrib3fvARB(attribs.tang.gl_index, tang); \
- } \
- } (void)0
-
-
for (i = 0, ltri = em->looptris[0]; i < em->tottri; i++, ltri += 3) {
int drawSmooth;
@@ -1069,20 +1082,20 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm,
if (vertexCos) glNormal3fv(bmdm->polyNos[BM_elem_index_get(efa)]);
else glNormal3fv(efa->no);
- PASSATTRIB(ltri[0], ltri[0]->v, 0);
+ emdm_pass_attrib_vertex_glsl(&attribs, ltri[0], 0);
if (vertexCos) glVertex3fv(vertexCos[BM_elem_index_get(ltri[0]->v)]);
else glVertex3fv(ltri[0]->v->co);
- PASSATTRIB(ltri[1], ltri[1]->v, 1);
+ emdm_pass_attrib_vertex_glsl(&attribs, ltri[1], 1);
if (vertexCos) glVertex3fv(vertexCos[BM_elem_index_get(ltri[1]->v)]);
else glVertex3fv(ltri[1]->v->co);
- PASSATTRIB(ltri[2], ltri[2]->v, 2);
+ emdm_pass_attrib_vertex_glsl(&attribs, ltri[2], 2);
if (vertexCos) glVertex3fv(vertexCos[BM_elem_index_get(ltri[2]->v)]);
else glVertex3fv(ltri[2]->v->co);
}
else {
- PASSATTRIB(ltri[0], ltri[0]->v, 0);
+ emdm_pass_attrib_vertex_glsl(&attribs, ltri[0], 0);
if (vertexCos) {
glNormal3fv(vertexNos[BM_elem_index_get(ltri[0]->v)]);
glVertex3fv(vertexCos[BM_elem_index_get(ltri[0]->v)]);
@@ -1092,7 +1105,7 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm,
glVertex3fv(ltri[0]->v->co);
}
- PASSATTRIB(ltri[1], ltri[1]->v, 1);
+ emdm_pass_attrib_vertex_glsl(&attribs, ltri[1], 1);
if (vertexCos) {
glNormal3fv(vertexNos[BM_elem_index_get(ltri[1]->v)]);
glVertex3fv(vertexCos[BM_elem_index_get(ltri[1]->v)]);
@@ -1102,7 +1115,7 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm,
glVertex3fv(ltri[1]->v->co);
}
- PASSATTRIB(ltri[2], ltri[2]->v, 2);
+ emdm_pass_attrib_vertex_glsl(&attribs, ltri[2], 2);
if (vertexCos) {
glNormal3fv(vertexNos[BM_elem_index_get(ltri[2]->v)]);
glVertex3fv(vertexCos[BM_elem_index_get(ltri[2]->v)]);
@@ -1115,7 +1128,6 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm,
glEnd();
}
}
-#undef PASSATTRIB
}
static void emDM_drawFacesGLSL(DerivedMesh *dm,
@@ -1124,6 +1136,38 @@ static void emDM_drawFacesGLSL(DerivedMesh *dm,
dm->drawMappedFacesGLSL(dm, setMaterial, NULL, NULL);
}
+/* emdm_pass_attrib_vertex_glsl's note about em_offset use applies here */
+static void emdm_pass_attrib_vertex_mat(DMVertexAttribs *attribs, BMLoop *loop, int index_in_face)
+{
+ BMVert *eve = loop->v;
+ int i;
+
+ if (attribs->totorco) {
+ float *orco = attribs->orco.array[BM_elem_index_get(eve)];
+ if (attribs->orco.gl_texco)
+ glTexCoord3fv(orco);
+ else
+ glVertexAttrib3fvARB(attribs->orco.gl_index, orco);
+ }
+ for (i = 0; i < attribs->tottface; i++) {
+ const MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(loop, attribs->tface[i].em_offset);
+ if (attribs->tface[i].gl_texco)
+ glTexCoord2fv(luv->uv);
+ else
+ glVertexAttrib2fvARB(attribs->tface[i].gl_index, luv->uv);
+ }
+ for (i = 0; i < attribs->totmcol; i++) {
+ const MLoopCol *cp = BM_ELEM_CD_GET_VOID_P(loop, attribs->mcol[i].em_offset);
+ GLubyte col[4];
+ col[0] = cp->b; col[1] = cp->g; col[2] = cp->r; col[3] = cp->a;
+ glVertexAttrib4ubvARB(attribs->mcol[i].gl_index, col);
+ }
+ if (attribs->tottang) {
+ float *tang = attribs->tang.array[i * 4 + index_in_face];
+ glVertexAttrib4fvARB(attribs->tang.gl_index, tang);
+ }
+}
+
static void emDM_drawMappedFacesMat(DerivedMesh *dm,
void (*setMaterial)(void *userData, int, void *attribs),
int (*setFace)(void *userData, int index), void *userData)
@@ -1137,7 +1181,7 @@ static void emDM_drawMappedFacesMat(DerivedMesh *dm,
BMLoop **ltri;
DMVertexAttribs attribs = {{{0}}};
GPUVertexAttribs gattribs;
- int i, b, matnr, new_matnr;
+ int i, matnr, new_matnr;
matnr = -1;
@@ -1146,35 +1190,6 @@ static void emDM_drawMappedFacesMat(DerivedMesh *dm,
BM_mesh_elem_index_ensure(bm, BM_VERT | BM_FACE);
-#define PASSATTRIB(loop, eve, vert) { \
- if (attribs.totorco) { \
- float *orco = attribs.orco.array[BM_elem_index_get(eve)]; \
- if (attribs.orco.gl_texco) \
- glTexCoord3fv(orco); \
- else \
- glVertexAttrib3fvARB(attribs.orco.gl_index, orco); \
- } \
- for (b = 0; b < attribs.tottface; b++) { \
- MLoopUV *_luv = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, \
- CD_MLOOPUV, b); \
- if (attribs.tface[b].gl_texco) \
- glTexCoord2fv(_luv->uv); \
- else \
- glVertexAttrib2fvARB(attribs.tface[b].gl_index, _luv->uv); \
- } \
- for (b = 0; b < attribs.totmcol; b++) { \
- MLoopCol *_cp = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, \
- CD_MLOOPCOL, b); \
- GLubyte _col[4]; \
- _col[0] = _cp->b; _col[1] = _cp->g; _col[2] = _cp->r; _col[3] = _cp->a; \
- glVertexAttrib4ubvARB(attribs.mcol[b].gl_index, _col); \
- } \
- if (attribs.tottang) { \
- float *tang = attribs.tang.array[i * 4 + vert]; \
- glVertexAttrib4fvARB(attribs.tang.gl_index, tang); \
- } \
- } (void)0
-
for (i = 0, ltri = em->looptris[0]; i < em->tottri; i++, ltri += 3) {
int drawSmooth;
@@ -1198,21 +1213,21 @@ static void emDM_drawMappedFacesMat(DerivedMesh *dm,
if (vertexCos) glNormal3fv(bmdm->polyNos[BM_elem_index_get(efa)]);
else glNormal3fv(efa->no);
- PASSATTRIB(ltri[0], ltri[0]->v, 0);
+ emdm_pass_attrib_vertex_mat(&attribs, ltri[0], 0);
if (vertexCos) glVertex3fv(vertexCos[BM_elem_index_get(ltri[0]->v)]);
else glVertex3fv(ltri[0]->v->co);
- PASSATTRIB(ltri[1], ltri[1]->v, 1);
+ emdm_pass_attrib_vertex_mat(&attribs, ltri[1], 1);
if (vertexCos) glVertex3fv(vertexCos[BM_elem_index_get(ltri[1]->v)]);
else glVertex3fv(ltri[1]->v->co);
- PASSATTRIB(ltri[2], ltri[2]->v, 2);
+ emdm_pass_attrib_vertex_mat(&attribs, ltri[2], 2);
if (vertexCos) glVertex3fv(vertexCos[BM_elem_index_get(ltri[2]->v)]);
else glVertex3fv(ltri[2]->v->co);
}
else {
- PASSATTRIB(ltri[0], ltri[0]->v, 0);
+ emdm_pass_attrib_vertex_mat(&attribs, ltri[0], 0);
if (vertexCos) {
glNormal3fv(vertexNos[BM_elem_index_get(ltri[0]->v)]);
glVertex3fv(vertexCos[BM_elem_index_get(ltri[0]->v)]);
@@ -1222,7 +1237,7 @@ static void emDM_drawMappedFacesMat(DerivedMesh *dm,
glVertex3fv(ltri[0]->v->co);
}
- PASSATTRIB(ltri[1], ltri[1]->v, 1);
+ emdm_pass_attrib_vertex_mat(&attribs, ltri[1], 1);
if (vertexCos) {
glNormal3fv(vertexNos[BM_elem_index_get(ltri[1]->v)]);
glVertex3fv(vertexCos[BM_elem_index_get(ltri[1]->v)]);
@@ -1232,7 +1247,7 @@ static void emDM_drawMappedFacesMat(DerivedMesh *dm,
glVertex3fv(ltri[1]->v->co);
}
- PASSATTRIB(ltri[2], ltri[2]->v, 2);
+ emdm_pass_attrib_vertex_mat(&attribs, ltri[2], 2);
if (vertexCos) {
glNormal3fv(vertexNos[BM_elem_index_get(ltri[2]->v)]);
glVertex3fv(vertexCos[BM_elem_index_get(ltri[2]->v)]);
@@ -1244,7 +1259,6 @@ static void emDM_drawMappedFacesMat(DerivedMesh *dm,
}
glEnd();
}
-#undef PASSATTRIB
}
static void emDM_getMinMax(DerivedMesh *dm, float min_r[3], float max_r[3])
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index 9fdf51ceba9..19ef1e3971d 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -454,7 +454,7 @@ void IDP_ReplaceGroupInGroup(IDProperty *dest, IDProperty *src)
if (strcmp(loop->name, prop->name) == 0) {
IDProperty *copy = IDP_CopyProperty(prop);
- BLI_insertlink(&dest->data.group, loop, copy);
+ BLI_insertlinkafter(&dest->data.group, loop, copy);
BLI_remlink(&dest->data.group, loop);
IDP_FreeProperty(loop);
@@ -479,7 +479,7 @@ void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop)
{
IDProperty *loop;
if ((loop = IDP_GetPropertyFromGroup(group, prop->name))) {
- BLI_insertlink(&group->data.group, loop, prop);
+ BLI_insertlinkafter(&group->data.group, loop, prop);
BLI_remlink(&group->data.group, loop);
IDP_FreeProperty(loop);
@@ -532,7 +532,7 @@ int IDP_InsertToGroup(IDProperty *group, IDProperty *previous, IDProperty *pnew)
{
if (IDP_GetPropertyFromGroup(group, pnew->name) == NULL) {
group->len++;
- BLI_insertlink(&group->data.group, previous, pnew);
+ BLI_insertlinkafter(&group->data.group, previous, pnew);
return 1;
}
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index de85cb54cfd..3655afdf088 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -571,6 +571,20 @@ static void image_init_color_management(Image *ima)
}
}
+void BKE_image_alpha_mode_from_extension(Image *image)
+{
+ if (BLI_testextensie(image->name, ".exr") ||
+ BLI_testextensie(image->name, ".cin") ||
+ BLI_testextensie(image->name, ".dpx") ||
+ BLI_testextensie(image->name, ".hdr"))
+ {
+ image->alpha_mode = IMA_ALPHA_PREMUL;
+ }
+ else {
+ image->alpha_mode = IMA_ALPHA_STRAIGHT;
+ }
+}
+
Image *BKE_image_load(Main *bmain, const char *filepath)
{
Image *ima;
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index cb0a11a16e0..f3dc391738e 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -246,7 +246,7 @@ void BKE_key_sort(Key *key)
/* find the right location and insert before */
for (kb2 = key->block.first; kb2; kb2 = kb2->next) {
if (kb2->pos > kb->pos) {
- BLI_insertlink(&key->block, kb2->prev, kb);
+ BLI_insertlinkafter(&key->block, kb2->prev, kb);
break;
}
}
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c
index 943d9e9452a..eceac61ddb6 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -216,7 +216,7 @@ static ImBuf *movieclip_load_sequence_file(MovieClip *clip, MovieClipUser *user,
colorspace = clip->colorspace_settings.name;
}
- loadflag = IB_rect | IB_multilayer;
+ loadflag = IB_rect | IB_multilayer | IB_alphamode_detect;
/* read ibuf */
ibuf = IMB_loadiffname(name, loadflag, colorspace);
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 97bee320ecb..86fe47268d6 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -2028,9 +2028,8 @@ void node_type_base(bNodeTreeType *ttype, bNodeType *ntype, int type, const char
ntype->update_internal_links = ttype->update_internal_links;
/* default size values */
- ntype->width = 140;
- ntype->minwidth = 100;
- ntype->maxwidth = 320;
+ node_type_size_preset(ntype, NODE_SIZE_DEFAULT);
+
ntype->height = 100;
ntype->minheight = 30;
ntype->maxheight = FLT_MAX;
@@ -2062,6 +2061,21 @@ void node_type_size(struct bNodeType *ntype, int width, int minwidth, int maxwid
ntype->maxwidth = maxwidth;
}
+void node_type_size_preset(struct bNodeType *ntype, eNodeSizePreset size)
+{
+ switch (size) {
+ case NODE_SIZE_DEFAULT:
+ node_type_size(ntype, 140, 100, 320);
+ break;
+ case NODE_SIZE_SMALL:
+ node_type_size(ntype, 100, 80, 320);
+ break;
+ case NODE_SIZE_LARGE:
+ node_type_size(ntype, 140, 120, 500);
+ break;
+ }
+}
+
void node_type_storage(bNodeType *ntype, const char *storagename, void (*freestoragefunc)(struct bNode *), void (*copystoragefunc)(struct bNode *, struct bNode *))
{
if (storagename)
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 119dc8c7d11..5cea2c9fe0e 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -74,6 +74,7 @@
#include "BKE_bullet.h"
#include "BKE_colortools.h"
#include "BKE_deform.h"
+#include "BKE_depsgraph.h"
#include "BKE_DerivedMesh.h"
#include "BKE_animsys.h"
#include "BKE_anim.h"
@@ -410,7 +411,8 @@ static void unlink_object__unlinkModifierLinks(void *userData, Object *ob, Objec
if (*obpoin == unlinkOb) {
*obpoin = NULL;
- ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME; // XXX: should this just be OB_RECALC_DATA?
+ // XXX: should this just be OB_RECALC_DATA?
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
}
}
@@ -444,14 +446,14 @@ void BKE_object_unlink(Object *ob)
obt->proxy = NULL;
if (obt->proxy_from == ob) {
obt->proxy_from = NULL;
- obt->recalc |= OB_RECALC_OB;
+ DAG_id_tag_update(&obt->id, OB_RECALC_OB);
}
if (obt->proxy_group == ob)
obt->proxy_group = NULL;
if (obt->parent == ob) {
obt->parent = NULL;
- obt->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+ DAG_id_tag_update(&obt->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
}
modifiers_foreachObjectLink(obt, unlink_object__unlinkModifierLinks, ob);
@@ -461,15 +463,15 @@ void BKE_object_unlink(Object *ob)
if (cu->bevobj == ob) {
cu->bevobj = NULL;
- obt->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+ DAG_id_tag_update(&obt->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
}
if (cu->taperobj == ob) {
cu->taperobj = NULL;
- obt->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+ DAG_id_tag_update(&obt->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
}
if (cu->textoncurve == ob) {
cu->textoncurve = NULL;
- obt->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+ DAG_id_tag_update(&obt->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
}
}
else if (obt->type == OB_ARMATURE && obt->pose) {
@@ -487,7 +489,7 @@ void BKE_object_unlink(Object *ob)
if (ct->tar == ob) {
ct->tar = NULL;
ct->subtarget[0] = '\0';
- obt->recalc |= OB_RECALC_DATA;
+ DAG_id_tag_update(&obt->id, OB_RECALC_DATA);
}
}
@@ -501,7 +503,7 @@ void BKE_object_unlink(Object *ob)
}
else if (ELEM(OB_MBALL, ob->type, obt->type)) {
if (BKE_mball_is_basis_for(obt, ob))
- obt->recalc |= OB_RECALC_DATA;
+ DAG_id_tag_update(&obt->id, OB_RECALC_DATA);
}
sca_remove_ob_poin(obt, ob);
@@ -518,7 +520,7 @@ void BKE_object_unlink(Object *ob)
if (ct->tar == ob) {
ct->tar = NULL;
ct->subtarget[0] = '\0';
- obt->recalc |= OB_RECALC_DATA;
+ DAG_id_tag_update(&obt->id, OB_RECALC_DATA);
}
}
@@ -530,12 +532,12 @@ void BKE_object_unlink(Object *ob)
/* object is deflector or field */
if (ob->pd) {
if (obt->soft)
- obt->recalc |= OB_RECALC_DATA;
+ DAG_id_tag_update(&obt->id, OB_RECALC_DATA);
/* cloth */
for (md = obt->modifiers.first; md; md = md->next)
if (md->type == eModifierType_Cloth)
- obt->recalc |= OB_RECALC_DATA;
+ DAG_id_tag_update(&obt->id, OB_RECALC_DATA);
}
/* strips */
@@ -564,14 +566,14 @@ void BKE_object_unlink(Object *ob)
for (; pt; pt = pt->next) {
if (pt->ob == ob) {
pt->ob = NULL;
- obt->recalc |= OB_RECALC_DATA;
+ DAG_id_tag_update(&obt->id, OB_RECALC_DATA);
break;
}
}
if (tpsys->target_ob == ob) {
tpsys->target_ob = NULL;
- obt->recalc |= OB_RECALC_DATA;
+ DAG_id_tag_update(&obt->id, OB_RECALC_DATA);
}
if (tpsys->part->dup_ob == ob)
@@ -606,7 +608,7 @@ void BKE_object_unlink(Object *ob)
}
}
if (ob->pd)
- obt->recalc |= OB_RECALC_DATA;
+ DAG_id_tag_update(&obt->id, OB_RECALC_DATA);
}
obt = obt->id.next;
@@ -984,7 +986,7 @@ Object *BKE_object_add(struct Scene *scene, int type)
base = BKE_scene_base_add(scene, ob);
BKE_scene_base_deselect_all(scene);
BKE_scene_base_select(scene, base);
- ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
return ob;
}
@@ -1494,7 +1496,8 @@ void BKE_object_make_proxy(Object *ob, Object *target, Object *gob)
ob->proxy_group = gob;
id_lib_extern(&target->id);
- ob->recalc = target->recalc = OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
+ DAG_id_tag_update(&target->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
/* copy transform
* - gob means this proxy comes from a group, just apply the matrix
@@ -2132,7 +2135,8 @@ static int where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[
}
/* note, scene is the active scene while actual_scene is the scene the object resides in */
-void BKE_object_where_is_calc_time_ex(Scene *scene, RigidBodyWorld *rbw, Object *ob, float ctime)
+void BKE_object_where_is_calc_time_ex(Scene *scene, Object *ob, float ctime,
+ RigidBodyWorld *rbw)
{
if (ob == NULL) return;
@@ -2158,6 +2162,8 @@ void BKE_object_where_is_calc_time_ex(Scene *scene, RigidBodyWorld *rbw, Object
BKE_object_to_mat4(ob, ob->obmat);
}
+ /* try to fall back to the scene rigid body world if none given */
+ rbw = rbw ? rbw : scene->rigidbody_world;
/* read values pushed into RBO from sim/cache... */
BKE_rigidbody_sync_transforms(rbw, ob, ctime);
@@ -2177,7 +2183,7 @@ void BKE_object_where_is_calc_time_ex(Scene *scene, RigidBodyWorld *rbw, Object
void BKE_object_where_is_calc_time(Scene *scene, Object *ob, float ctime)
{
- BKE_object_where_is_calc_time_ex(scene, NULL, ob, ctime);
+ BKE_object_where_is_calc_time_ex(scene, ob, ctime, NULL);
}
/* get object transformation matrix without recalculating dependencies and
@@ -2203,17 +2209,17 @@ void BKE_object_where_is_calc_mat4(Scene *scene, Object *ob, float obmat[4][4])
void BKE_object_where_is_calc_ex(Scene *scene, RigidBodyWorld *rbw, Object *ob)
{
- BKE_object_where_is_calc_time_ex(scene, rbw, ob, BKE_scene_frame_get(scene));
+ BKE_object_where_is_calc_time_ex(scene, ob, BKE_scene_frame_get(scene), rbw);
}
void BKE_object_where_is_calc(Scene *scene, Object *ob)
{
- BKE_object_where_is_calc_time_ex(scene, NULL, ob, BKE_scene_frame_get(scene));
+ BKE_object_where_is_calc_time_ex(scene, ob, BKE_scene_frame_get(scene), NULL);
}
-void BKE_object_where_is_calc_simul(Scene *scene, Object *ob)
/* was written for the old game engine (until 2.04) */
/* It seems that this function is only called
* for a lamp that is the child of another object */
+void BKE_object_where_is_calc_simul(Scene *scene, Object *ob)
{
Object *par;
float *fp1, *fp2;
@@ -2644,7 +2650,8 @@ int BKE_object_parent_loop_check(const Object *par, const Object *ob)
/* the main object update call, for object matrix, constraints, keys and displist (modifiers) */
/* requires flags to be set! */
/* Ideally we shouldn't have to pass the rigid body world, but need bigger restructuring to avoid id */
-void BKE_object_handle_update_ex(Scene *scene, RigidBodyWorld *rbw, Object *ob)
+void BKE_object_handle_update_ex(Scene *scene, Object *ob,
+ RigidBodyWorld *rbw)
{
if (ob->recalc & OB_RECALC_ALL) {
/* speed optimization for animation lookups */
@@ -2846,7 +2853,7 @@ void BKE_object_handle_update_ex(Scene *scene, RigidBodyWorld *rbw, Object *ob)
*/
void BKE_object_handle_update(Scene *scene, Object *ob)
{
- BKE_object_handle_update_ex(scene, NULL, ob);
+ BKE_object_handle_update_ex(scene, ob, NULL);
}
void BKE_object_sculpt_modifiers_changed(Object *ob)
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index c01ea4e518d..f90fde983aa 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -3509,12 +3509,12 @@ ModifierData *object_add_particle_system(Scene *scene, Object *ob, const char *n
psys->flag = PSYS_ENABLED | PSYS_CURRENT;
psys->cfra = BKE_scene_frame_get_from_ctime(scene, CFRA + 1);
- DAG_scene_sort(G.main, scene);
+ DAG_relations_tag_update(G.main);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
return md;
}
-void object_remove_particle_system(Scene *scene, Object *ob)
+void object_remove_particle_system(Scene *UNUSED(scene), Object *ob)
{
ParticleSystem *psys = psys_get_current(ob);
ParticleSystemModifierData *psmd;
@@ -3552,7 +3552,7 @@ void object_remove_particle_system(Scene *scene, Object *ob)
else
ob->mode &= ~OB_MODE_PARTICLE_EDIT;
- DAG_scene_sort(G.main, scene);
+ DAG_relations_tag_update(G.main);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
static void default_particle_settings(ParticleSettings *part)
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 6e4937d11ec..3efe25794e1 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -3028,13 +3028,20 @@ static void basic_rotate(ParticleSettings *part, ParticleData *pa, float dfra, f
normalize_qt(pa->state.rot);
}
-/************************************************/
-/* Collisions */
-/************************************************/
+/************************************************
+ * Collisions
+ *
+ * The algorithm is roughly:
+ * 1. Use a BVH tree to search for faces that a particle may collide with.
+ * 2. Use Newton's method to find the exact time at which the collision occurs.
+ * http://en.wikipedia.org/wiki/Newton's_method
+ *
+ ************************************************/
#define COLLISION_MAX_COLLISIONS 10
#define COLLISION_MIN_RADIUS 0.001f
#define COLLISION_MIN_DISTANCE 0.0001f
#define COLLISION_ZERO 0.00001f
+#define COLLISION_INIT_STEP 0.00008f
typedef float (*NRDistanceFunc)(float *p, float radius, ParticleCollisionElement *pce, float *nor);
static float nr_signed_distance_to_plane(float *p, float radius, ParticleCollisionElement *pce, float *nor)
{
@@ -3189,16 +3196,20 @@ static void collision_point_on_surface(float p[3], ParticleCollisionElement *pce
/* find first root in range [0-1] starting from 0 */
static float collision_newton_rhapson(ParticleCollision *col, float radius, ParticleCollisionElement *pce, NRDistanceFunc distance_func)
{
- float t0, t1, d0, d1, dd, n[3];
+ float t0, t1, dt_init, d0, d1, dd, n[3];
int iter;
pce->inv_nor = -1;
+ /* Initial step size should be small, but not too small or floating point
+ * precision errors will appear. - z0r */
+ dt_init = COLLISION_INIT_STEP * col->inv_total_time;
+
/* start from the beginning */
t0 = 0.f;
collision_interpolate_element(pce, t0, col->f, col);
d0 = distance_func(col->co1, radius, pce, n);
- t1 = 0.001f;
+ t1 = dt_init;
d1 = 0.f;
for (iter=0; iter<10; iter++) {//, itersum++) {
@@ -3208,11 +3219,6 @@ static float collision_newton_rhapson(ParticleCollision *col, float radius, Part
d1 = distance_func(pce->p, radius, pce, n);
- /* no movement, so no collision */
- if (d1 == d0) {
- return -1.f;
- }
-
/* particle already inside face, so report collision */
if (iter == 0 && d0 < 0.f && d0 > -radius) {
copy_v3_v3(pce->p, col->co1);
@@ -3220,7 +3226,24 @@ static float collision_newton_rhapson(ParticleCollision *col, float radius, Part
pce->inside = 1;
return 0.f;
}
-
+
+ /* Zero gradient (no movement relative to element). Can't step from
+ * here. */
+ if (d1 == d0) {
+ /* If first iteration, try from other end where the gradient may be
+ * greater. Note: code duplicated below. */
+ if (iter == 0) {
+ t0 = 1.f;
+ collision_interpolate_element(pce, t0, col->f, col);
+ d0 = distance_func(col->co2, radius, pce, n);
+ t1 = 1.0f - dt_init;
+ d1 = 0.f;
+ continue;
+ }
+ else
+ return -1.f;
+ }
+
dd = (t1-t0)/(d1-d0);
t0 = t1;
@@ -3228,14 +3251,14 @@ static float collision_newton_rhapson(ParticleCollision *col, float radius, Part
t1 -= d1*dd;
- /* particle movin away from plane could also mean a strangely rotating face, so check from end */
+ /* Particle moving away from plane could also mean a strangely rotating
+ * face, so check from end. Note: code duplicated above. */
if (iter == 0 && t1 < 0.f) {
t0 = 1.f;
collision_interpolate_element(pce, t0, col->f, col);
d0 = distance_func(col->co2, radius, pce, n);
- t1 = 0.999f;
+ t1 = 1.0f - dt_init;
d1 = 0.f;
-
continue;
}
else if (iter == 1 && (t1 < -COLLISION_ZERO || t1 > 1.f))
@@ -3683,6 +3706,7 @@ static void collision_check(ParticleSimulationData *sim, int p, float dfra, floa
memset(&col, 0, sizeof(ParticleCollision));
col.total_time = timestep * dfra;
+ col.inv_total_time = 1.0f/col.total_time;
col.inv_timestep = 1.0f/timestep;
col.cfra = cfra;
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 4302032ade1..27c5e03132e 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -52,6 +52,8 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "PIL_time.h"
#include "WM_api.h"
@@ -3505,11 +3507,11 @@ void BKE_ptcache_update_info(PTCacheID *pid)
/* smoke doesn't use frame 0 as info frame so can't check based on totpoint */
if (pid->type == PTCACHE_TYPE_SMOKE_DOMAIN && totframes)
- BLI_snprintf(cache->info, sizeof(cache->info), "%i frames found!", totframes);
+ BLI_snprintf(cache->info, sizeof(cache->info), IFACE_("%i frames found!"), totframes);
else if (totframes && cache->totpoint)
- BLI_snprintf(cache->info, sizeof(cache->info), "%i points found!", cache->totpoint);
+ BLI_snprintf(cache->info, sizeof(cache->info), IFACE_("%i points found!"), cache->totpoint);
else
- BLI_snprintf(cache->info, sizeof(cache->info), "No valid data to read!");
+ BLI_snprintf(cache->info, sizeof(cache->info), IFACE_("No valid data to read!"));
return;
}
@@ -3518,9 +3520,9 @@ void BKE_ptcache_update_info(PTCacheID *pid)
int totpoint = pid->totpoint(pid->calldata, 0);
if (cache->totpoint > totpoint)
- BLI_snprintf(mem_info, sizeof(mem_info), "%i cells + High Resolution cached", totpoint);
+ BLI_snprintf(mem_info, sizeof(mem_info), IFACE_("%i cells + High Resolution cached"), totpoint);
else
- BLI_snprintf(mem_info, sizeof(mem_info), "%i cells cached", totpoint);
+ BLI_snprintf(mem_info, sizeof(mem_info), IFACE_("%i cells cached"), totpoint);
}
else {
int cfra = cache->startframe;
@@ -3530,7 +3532,7 @@ void BKE_ptcache_update_info(PTCacheID *pid)
totframes++;
}
- BLI_snprintf(mem_info, sizeof(mem_info), "%i frames on disk", totframes);
+ BLI_snprintf(mem_info, sizeof(mem_info), IFACE_("%i frames on disk"), totframes);
}
}
else {
@@ -3554,17 +3556,18 @@ void BKE_ptcache_update_info(PTCacheID *pid)
mb = (bytes > 1024.0f * 1024.0f);
- BLI_snprintf(mem_info, sizeof(mem_info), "%i frames in memory (%.1f %s)",
+ BLI_snprintf(mem_info, sizeof(mem_info), IFACE_("%i frames in memory (%.1f %s)"),
totframes,
bytes / (mb ? 1024.0f * 1024.0f : 1024.0f),
- mb ? "Mb" : "kb");
+ mb ? IFACE_("Mb") : IFACE_("kb"));
}
if (cache->flag & PTCACHE_OUTDATED) {
- BLI_snprintf(cache->info, sizeof(cache->info), "%s, cache is outdated!", mem_info);
+ BLI_snprintf(cache->info, sizeof(cache->info), IFACE_("%s, cache is outdated!"), mem_info);
}
else if (cache->flag & PTCACHE_FRAMES_SKIPPED) {
- BLI_snprintf(cache->info, sizeof(cache->info), "%s, not exact since frame %i.", mem_info, cache->last_exact);
+ BLI_snprintf(cache->info, sizeof(cache->info), IFACE_("%s, not exact since frame %i."),
+ mem_info, cache->last_exact);
}
else {
BLI_snprintf(cache->info, sizeof(cache->info), "%s.", mem_info);
@@ -3586,4 +3589,3 @@ void BKE_ptcache_invalidate(PointCache *cache)
cache->last_exact = MIN2(cache->startframe, 0);
}
}
-
diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index 26f0c25617f..4c6bae122cd 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -633,8 +633,18 @@ void BKE_rigidbody_validate_sim_constraint(RigidBodyWorld *rbw, Object *ob, shor
else
RB_constraint_set_limits_6dof(rbc->physics_constraint, RB_LIMIT_ANG_Z, 0.0f, -1.0f);
break;
+ case RBC_TYPE_MOTOR:
+ rbc->physics_constraint = RB_constraint_new_motor(loc, rot, rb1, rb2);
+
+ RB_constraint_set_enable_motor(rbc->physics_constraint, rbc->flag & RBC_FLAG_USE_MOTOR_LIN, rbc->flag & RBC_FLAG_USE_MOTOR_ANG);
+ RB_constraint_set_max_impulse_motor(rbc->physics_constraint, rbc->motor_lin_max_impulse, rbc->motor_ang_max_impulse);
+ RB_constraint_set_target_velocity_motor(rbc->physics_constraint, rbc->motor_lin_target_velocity, rbc->motor_ang_target_velocity);
+ break;
}
}
+ else { /* can't create constraint without both rigid bodies */
+ return;
+ }
RB_constraint_set_enabled(rbc->physics_constraint, rbc->flag & RBC_FLAG_ENABLED);
@@ -813,6 +823,11 @@ RigidBodyCon *BKE_rigidbody_create_constraint(Scene *scene, Object *ob, short ty
rbc->spring_stiffness_y = 10.0f;
rbc->spring_stiffness_z = 10.0f;
+ rbc->motor_lin_max_impulse = 1.0f;
+ rbc->motor_lin_target_velocity = 1.0f;
+ rbc->motor_ang_max_impulse = 1.0f;
+ rbc->motor_ang_target_velocity = 1.0f;
+
/* flag cache as outdated */
BKE_rigidbody_cache_reset(rbw);
@@ -1259,7 +1274,7 @@ void BKE_rigidbody_do_simulation(Scene *scene, float ctime)
}
/* advance simulation, we can only step one frame forward */
- if (ctime == rbw->ltime + 1) {
+ if (ctime == rbw->ltime + 1 && !(cache->flag & PTCACHE_BAKED)) {
/* write cache for first frame when on second frame */
if (rbw->ltime == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact == 0)) {
BKE_ptcache_write(&pid, startframe);
@@ -1308,7 +1323,7 @@ struct RigidBodyCon *BKE_rigidbody_create_constraint(Scene *scene, Object *ob, s
struct RigidBodyWorld *BKE_rigidbody_get_world(Scene *scene) { return NULL; }
void BKE_rigidbody_remove_object(Scene *scene, Object *ob) {}
void BKE_rigidbody_remove_constraint(Scene *scene, Object *ob) {}
-void BKE_rigidbody_sync_transforms(Scene *scene, Object *ob, float ctime) {}
+void BKE_rigidbody_sync_transforms(RigidBodyWorld *rbw, Object *ob, float ctime) {}
void BKE_rigidbody_aftertrans_update(Object *ob, float loc[3], float rot[3], float quat[4], float rotAxis[3], float rotAngle) {}
void BKE_rigidbody_cache_reset(RigidBodyWorld *rbw) {}
void BKE_rigidbody_do_simulation(Scene *scene, float ctime) {}
diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c
index eb4e0d9c679..6433b73fda0 100644
--- a/source/blender/blenkernel/intern/sca.c
+++ b/source/blender/blenkernel/intern/sca.c
@@ -734,7 +734,7 @@ void sca_move_sensor(bSensor *sens_to_move, Object *ob, int move_up)
}
if (tmp) {
BLI_remlink(&ob->sensors, sens);
- BLI_insertlink(&ob->sensors, tmp, sens);
+ BLI_insertlinkafter(&ob->sensors, tmp, sens);
}
}
}
@@ -778,7 +778,7 @@ void sca_move_controller(bController *cont_to_move, Object *ob, int move_up)
tmp = tmp->next;
}
BLI_remlink(&ob->controllers, cont);
- BLI_insertlink(&ob->controllers, tmp, cont);
+ BLI_insertlinkafter(&ob->controllers, tmp, cont);
}
}
@@ -818,7 +818,7 @@ void sca_move_actuator(bActuator *act_to_move, Object *ob, int move_up)
}
if (tmp) {
BLI_remlink(&ob->actuators, act);
- BLI_insertlink(&ob->actuators, tmp, act);
+ BLI_insertlinkafter(&ob->actuators, tmp, act);
}
}
}
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 9934d9b6e9a..e1e4563e89f 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -177,6 +177,7 @@ Scene *BKE_scene_copy(Scene *sce, int type)
scen->obedit = NULL;
scen->stats = NULL;
scen->fps_info = NULL;
+ scen->rigidbody_world = NULL; /* RB_TODO figure out a way of copying the rigid body world */
BLI_duplicatelist(&(scen->markers), &(sce->markers));
BLI_duplicatelist(&(scen->transform_spaces), &(sce->transform_spaces));
@@ -404,7 +405,7 @@ void BKE_scene_free(Scene *sce)
BKE_color_managed_view_settings_free(&sce->view_settings);
}
-static Scene *scene_add(Main *bmain, const char *name)
+Scene *BKE_scene_add(Main *bmain, const char *name)
{
Scene *sce;
ParticleEditSettings *pset;
@@ -639,11 +640,6 @@ static Scene *scene_add(Main *bmain, const char *name)
return sce;
}
-Scene *BKE_scene_add(Main *bmain, const char *name)
-{
- return scene_add(bmain, name);
-}
-
Base *BKE_scene_base_find(Scene *scene, Object *ob)
{
return BLI_findptr(&scene->base, ob, offsetof(Base, object));
@@ -679,12 +675,11 @@ void BKE_scene_set_background(Main *bmain, Scene *scene)
}
/* sort baselist */
- DAG_scene_sort(bmain, scene);
+ DAG_scene_relations_rebuild(bmain, scene);
/* ensure dags are built for sets */
- for (sce = scene->set; sce; sce = sce->set)
- if (sce->theDag == NULL)
- DAG_scene_sort(bmain, sce);
+ for (sce = scene; sce; sce = sce->set)
+ DAG_scene_relations_update(bmain, sce);
/* copy layers and flags from bases to objects */
for (base = scene->base.first; base; base = base->next) {
@@ -1155,7 +1150,7 @@ static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scen
for (base = scene->base.first; base; base = base->next) {
Object *ob = base->object;
- BKE_object_handle_update_ex(scene_parent, scene->rigidbody_world, ob);
+ BKE_object_handle_update_ex(scene_parent, ob, scene->rigidbody_world);
if (ob->dup_group && (ob->transflag & OB_DUPLIGROUP))
group_handle_recalc_and_update(scene_parent, ob, ob->dup_group);
@@ -1180,9 +1175,15 @@ static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scen
/* this is called in main loop, doing tagged updates before redraw */
void BKE_scene_update_tagged(Main *bmain, Scene *scene)
{
+ Scene *sce_iter;
+
/* keep this first */
BLI_callback_exec(bmain, &scene->id, BLI_CB_EVT_SCENE_UPDATE_PRE);
+ /* (re-)build dependency graph if needed */
+ for (sce_iter = scene; sce_iter; sce_iter = sce_iter->set)
+ DAG_scene_relations_update(bmain, sce_iter);
+
/* flush recalc flags to dependencies */
DAG_ids_flush_tagged(bmain);
@@ -1233,10 +1234,8 @@ void BKE_scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay)
/* clear animation overrides */
/* XXX TODO... */
- for (sce_iter = sce; sce_iter; sce_iter = sce_iter->set) {
- if (sce_iter->theDag == NULL)
- DAG_scene_sort(bmain, sce_iter);
- }
+ for (sce_iter = sce; sce_iter; sce_iter = sce_iter->set)
+ DAG_scene_relations_update(bmain, sce_iter);
/* flush recalc flags to dependencies, if we were only changing a frame
* this would not be necessary, but if a user or a script has modified
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 45393726add..68618287546 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -3955,6 +3955,24 @@ Sequence *BKE_sequence_alloc(ListBase *lb, int cfra, int machine)
return seq;
}
+void BKE_sequence_alpha_mode_from_extension(Sequence *seq)
+{
+ if (seq->strip && seq->strip->stripdata) {
+ char *name = seq->strip->stripdata->name;
+
+ if (BLI_testextensie(name, ".exr") ||
+ BLI_testextensie(name, ".cin") ||
+ BLI_testextensie(name, ".dpx") ||
+ BLI_testextensie(name, ".hdr"))
+ {
+ seq->alpha_mode = IMA_ALPHA_PREMUL;
+ }
+ else {
+ seq->alpha_mode = IMA_ALPHA_STRAIGHT;
+ }
+ }
+}
+
void BKE_sequence_init_colorspace(Sequence *seq)
{
if (seq->strip && seq->strip->stripdata) {
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index 86e7a152a4a..74c0a76f82d 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -2938,6 +2938,18 @@ int text_check_identifier_nodigit(const char ch)
return 0;
}
+#ifndef WITH_PYTHON
+int text_check_identifier_unicode(const unsigned int ch)
+{
+ return (ch < 255 && text_check_identifier((char)ch));
+}
+
+int text_check_identifier_nodigit_unicode(const unsigned int ch)
+{
+ return (ch < 255 && text_check_identifier_nodigit((char)ch));
+}
+#endif /* WITH_PYTHON */
+
int text_check_whitespace(const char ch)
{
if (ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n')
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index 8b81e474e76..1a7458f531c 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -141,8 +141,10 @@ static void tracking_dopesheet_free(MovieTrackingDopesheet *dopesheet)
}
BLI_freelistN(&dopesheet->channels);
+ BLI_freelistN(&dopesheet->coverage_segments);
dopesheet->channels.first = dopesheet->channels.last = NULL;
+ dopesheet->coverage_segments.first = dopesheet->coverage_segments.last = NULL;
dopesheet->tot_channel = 0;
}
@@ -1605,6 +1607,67 @@ ImBuf *BKE_tracking_distort_frame(MovieTracking *tracking, ImBuf *ibuf, int cali
calibration_height, overscan, FALSE);
}
+void BKE_tracking_max_undistortion_delta_across_bound(MovieTracking *tracking, rcti *rect, float delta[2])
+{
+ int a;
+ float pos[2], warped_pos[2];
+ const int coord_delta = 5;
+
+ delta[0] = delta[1] = -FLT_MAX;
+
+ for (a = rect->xmin; a <= rect->xmax + coord_delta; a += coord_delta) {
+ if (a > rect->xmax)
+ a = rect->xmax;
+
+ /* bottom edge */
+ pos[0] = a;
+ pos[1] = rect->ymin;
+
+ BKE_tracking_undistort_v2(tracking, pos, warped_pos);
+
+ delta[0] = max_ff(delta[0], fabs(pos[0] - warped_pos[0]));
+ delta[1] = max_ff(delta[1], fabs(pos[1] - warped_pos[1]));
+
+ /* top edge */
+ pos[0] = a;
+ pos[1] = rect->ymax;
+
+ BKE_tracking_undistort_v2(tracking, pos, warped_pos);
+
+ delta[0] = max_ff(delta[0], fabs(pos[0] - warped_pos[0]));
+ delta[1] = max_ff(delta[1], fabs(pos[1] - warped_pos[1]));
+
+ if (a >= rect->xmax)
+ break;
+ }
+
+ for (a = rect->ymin; a <= rect->ymax + coord_delta; a += coord_delta) {
+ if (a > rect->ymax)
+ a = rect->ymax;
+
+ /* left edge */
+ pos[0] = rect->xmin;
+ pos[1] = a;
+
+ BKE_tracking_undistort_v2(tracking, pos, warped_pos);
+
+ delta[0] = max_ff(delta[0], fabs(pos[0] - warped_pos[0]));
+ delta[1] = max_ff(delta[1], fabs(pos[1] - warped_pos[1]));
+
+ /* right edge */
+ pos[0] = rect->xmax;
+ pos[1] = a;
+
+ BKE_tracking_undistort_v2(tracking, pos, warped_pos);
+
+ delta[0] = max_ff(delta[0], fabs(pos[0] - warped_pos[0]));
+ delta[1] = max_ff(delta[1], fabs(pos[1] - warped_pos[1]));
+
+ if (a >= rect->ymax)
+ break;
+ }
+}
+
/*********************** Image sampling *************************/
static void disable_imbuf_channels(ImBuf *ibuf, MovieTrackingTrack *track, int grayscale)
@@ -3723,6 +3786,88 @@ static void tracking_dopesheet_sort(MovieTracking *tracking, int sort_method, in
}
}
+static int coverage_from_count(int count)
+{
+ if (count < 8)
+ return TRACKING_COVERAGE_BAD;
+ else if (count < 16)
+ return TRACKING_COVERAGE_ACCEPTABLE;
+ return TRACKING_COVERAGE_OK;
+}
+
+static void tracking_dopesheet_calc_coverage(MovieTracking *tracking)
+{
+ MovieTrackingDopesheet *dopesheet = &tracking->dopesheet;
+ MovieTrackingObject *object = BKE_tracking_object_get_active(tracking);
+ ListBase *tracksbase = BKE_tracking_object_get_tracks(tracking, object);
+ MovieTrackingTrack *track;
+ int frames, start_frame = INT_MAX, end_frame = -INT_MAX;
+ int *per_frame_counter;
+ int prev_coverage, last_segment_frame;
+ int i;
+
+ /* find frame boundaries */
+ for (track = tracksbase->first; track; track = track->next) {
+ start_frame = min_ii(start_frame, track->markers[0].framenr);
+ end_frame = max_ii(end_frame, track->markers[track->markersnr - 1].framenr);
+ }
+
+ frames = end_frame - start_frame + 1;
+
+ /* this is a per-frame counter of markers (how many markers belongs to the same frame) */
+ per_frame_counter = MEM_callocN(sizeof(int) * frames, "per frame track counter");
+
+ /* find per-frame markers count */
+ for (track = tracksbase->first; track; track = track->next) {
+ int i;
+
+ for (i = 0; i < track->markersnr; i++) {
+ MovieTrackingMarker *marker = &track->markers[i];
+
+ /* TODO: perhaps we need to add check for non-single-frame track here */
+ if ((marker->flag & MARKER_DISABLED) == 0)
+ per_frame_counter[marker->framenr - start_frame]++;
+ }
+ }
+
+ /* convert markers count to coverage and detect segments with the same coverage */
+ prev_coverage = coverage_from_count(per_frame_counter[0]);
+ last_segment_frame = start_frame;
+
+ /* means only disabled tracks in the beginning, could be ignored */
+ if (!per_frame_counter[0])
+ prev_coverage = TRACKING_COVERAGE_OK;
+
+ for (i = 1; i < frames; i++) {
+ int coverage = coverage_from_count(per_frame_counter[i]);
+
+ /* means only disabled tracks in the end, could be ignored */
+ if (i == frames - 1 && !per_frame_counter[i])
+ coverage = TRACKING_COVERAGE_OK;
+
+ if (coverage != prev_coverage || i == frames - 1) {
+ MovieTrackingDopesheetCoverageSegment *coverage_segment;
+ int end_segment_frame = i - 1 + start_frame;
+
+ if (end_segment_frame == last_segment_frame)
+ end_segment_frame++;
+
+ coverage_segment = MEM_callocN(sizeof(MovieTrackingDopesheetCoverageSegment), "tracking coverage segment");
+ coverage_segment->coverage = prev_coverage;
+ coverage_segment->start_frame = last_segment_frame;
+ coverage_segment->end_frame = end_segment_frame;
+
+ BLI_addtail(&dopesheet->coverage_segments, coverage_segment);
+
+ last_segment_frame = end_segment_frame;
+ }
+
+ prev_coverage = coverage;
+ }
+
+ MEM_freeN(per_frame_counter);
+}
+
void BKE_tracking_dopesheet_tag_update(MovieTracking *tracking)
{
MovieTrackingDopesheet *dopesheet = &tracking->dopesheet;
@@ -3750,6 +3895,7 @@ void BKE_tracking_dopesheet_update(MovieTracking *tracking)
reconstruction = BKE_tracking_object_get_reconstruction(tracking, object);
+ /* channels */
for (track = tracksbase->first; track; track = track->next) {
MovieTrackingDopesheetChannel *channel;
@@ -3777,5 +3923,8 @@ void BKE_tracking_dopesheet_update(MovieTracking *tracking)
tracking_dopesheet_sort(tracking, sort_method, inverse);
+ /* frame coverage */
+ tracking_dopesheet_calc_coverage(tracking);
+
dopesheet->ok = TRUE;
}
diff --git a/source/blender/blenlib/BLI_listbase.h b/source/blender/blenlib/BLI_listbase.h
index d06956e39de..54cd687eeac 100644
--- a/source/blender/blenlib/BLI_listbase.h
+++ b/source/blender/blenlib/BLI_listbase.h
@@ -32,6 +32,7 @@
* \ingroup bli
*/
+#include "BLI_utildefines.h"
#include "DNA_listBase.h"
//struct ListBase;
//struct LinkData;
@@ -40,7 +41,6 @@
extern "C" {
#endif
-void BLI_insertlink(struct ListBase *listbase, void *vprevlink, void *vnewlink);
int BLI_findindex(const struct ListBase *listbase, const void *vlink);
int BLI_findstringindex(const struct ListBase *listbase, const char *id, const int offset);
@@ -59,7 +59,7 @@ void *BLI_rfindptr(const struct ListBase *listbase, const void *ptr, const int o
void BLI_freelistN(struct ListBase *listbase);
void BLI_addtail(struct ListBase *listbase, void *vlink);
void BLI_remlink(struct ListBase *listbase, void *vlink);
-int BLI_remlink_safe(struct ListBase *listbase, void *vlink);
+bool BLI_remlink_safe(struct ListBase *listbase, void *vlink);
void BLI_addhead(struct ListBase *listbase, void *vlink);
void BLI_insertlinkbefore(struct ListBase *listbase, void *vnextlink, void *vnewlink);
diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h
index 94063c9a40a..aa4e697b48b 100644
--- a/source/blender/blenlib/BLI_math_base.h
+++ b/source/blender/blenlib/BLI_math_base.h
@@ -217,5 +217,26 @@ extern double round(double x);
double double_round(double x, int ndigits);
-#endif /* __BLI_MATH_BASE_H__ */
+/* asserts, some math functions expect normalized inputs
+ * check the vector is unit length, or zero length (which can't be helped in some cases).
+ */
+#ifdef DEBUG
+/* note: 0.0001 is too small becaues normals may be converted from short's: see [#34322] */
+# define BLI_ASSERT_UNIT_EPSILON 0.0002f
+# define BLI_ASSERT_UNIT_V3(v) { \
+ const float _test_unit = len_squared_v3(v); \
+ BLI_assert((fabsf(_test_unit - 1.0f) < BLI_ASSERT_UNIT_EPSILON) || \
+ (fabsf(_test_unit) < BLI_ASSERT_UNIT_EPSILON)); \
+} (void)0
+
+# define BLI_ASSERT_UNIT_V2(v) { \
+ const float _test_unit = len_squared_v2(v); \
+ BLI_assert((fabsf(_test_unit - 1.0f) < BLI_ASSERT_UNIT_EPSILON) || \
+ (fabsf(_test_unit) < BLI_ASSERT_UNIT_EPSILON)); \
+} (void)0
+#else
+# define BLI_ASSERT_UNIT_V2(v) (void)0
+# define BLI_ASSERT_UNIT_V3(v) (void)0
+#endif
+#endif /* __BLI_MATH_BASE_H__ */
diff --git a/source/blender/blenlib/BLI_math_rotation.h b/source/blender/blenlib/BLI_math_rotation.h
index e349a05ac23..5ba37d70ca5 100644
--- a/source/blender/blenlib/BLI_math_rotation.h
+++ b/source/blender/blenlib/BLI_math_rotation.h
@@ -186,6 +186,8 @@ float fov_to_focallength(float fov, float sensor);
float angle_wrap_rad(float angle);
float angle_wrap_deg(float angle);
+float angle_compat_rad(float angle, float angle_compat);
+
int mat3_from_axis_conversion(int from_forward, int from_up, int to_forward, int to_up,
float r_mat[3][3]);
diff --git a/source/blender/blenlib/BLI_scanfill.h b/source/blender/blenlib/BLI_scanfill.h
index 7830c0675b4..ce2c6a4252f 100644
--- a/source/blender/blenlib/BLI_scanfill.h
+++ b/source/blender/blenlib/BLI_scanfill.h
@@ -72,7 +72,8 @@ typedef struct ScanFillVert {
float xy[2]; /* 2D copy of vertex location (using dominant axis) */
unsigned int keyindex; /* original index #, for restoring key information */
short poly_nr;
- unsigned char f, h;
+ unsigned char edge_tot; /* number of edges using this vertex */
+ unsigned char f;
} ScanFillVert;
typedef struct ScanFillEdge {
diff --git a/source/blender/blenlib/BLI_string_utf8.h b/source/blender/blenlib/BLI_string_utf8.h
index ecbc4cb1cd4..30d5c28bf98 100644
--- a/source/blender/blenlib/BLI_string_utf8.h
+++ b/source/blender/blenlib/BLI_string_utf8.h
@@ -41,6 +41,7 @@ int BLI_str_utf8_size_safe(const char *p);
/* copied from glib */
unsigned int BLI_str_utf8_as_unicode(const char *p);
unsigned int BLI_str_utf8_as_unicode_and_size(const char *__restrict p, size_t *__restrict index);
+unsigned int BLI_str_utf8_as_unicode_and_size_safe(const char *__restrict p, size_t *__restrict index);
unsigned int BLI_str_utf8_as_unicode_step(const char *__restrict p, size_t *__restrict index);
size_t BLI_str_utf8_from_unicode(unsigned int c, char *outbuf);
diff --git a/source/blender/blenlib/intern/BLI_heap.c b/source/blender/blenlib/intern/BLI_heap.c
index dcc028630e2..aa54969b6f8 100644
--- a/source/blender/blenlib/intern/BLI_heap.c
+++ b/source/blender/blenlib/intern/BLI_heap.c
@@ -167,7 +167,7 @@ HeapNode *BLI_heap_insert(Heap *heap, float value, void *ptr)
heap->freenodes = (HeapNode *)(((HeapNode *)heap->freenodes)->ptr);
}
else {
- node = (HeapNode *)BLI_memarena_alloc(heap->arena, sizeof *node);
+ node = (HeapNode *)BLI_memarena_alloc(heap->arena, sizeof(*node));
}
node->value = value;
diff --git a/source/blender/blenlib/intern/BLI_mempool.c b/source/blender/blenlib/intern/BLI_mempool.c
index 7670b057a7f..5f0c90f234d 100644
--- a/source/blender/blenlib/intern/BLI_mempool.c
+++ b/source/blender/blenlib/intern/BLI_mempool.c
@@ -54,6 +54,9 @@
#define FREEWORD MAKE_ID('f', 'r', 'e', 'e')
+/* currently totalloc isnt used */
+// #define USE_TOTALLOC
+
typedef struct BLI_freenode {
struct BLI_freenode *next;
int freeword; /* used to identify this as a freed node */
@@ -110,6 +113,7 @@ BLI_mempool *BLI_mempool_create(int esize, int totelem, int pchunk, int flag)
pool->pchunk = pchunk;
pool->csize = esize * pchunk;
pool->chunks.first = pool->chunks.last = NULL;
+ pool->totalloc = 0;
pool->totused = 0;
maxchunks = totelem / pchunk + 1;
@@ -159,10 +163,11 @@ BLI_mempool *BLI_mempool_create(int esize, int totelem, int pchunk, int flag)
}
}
- /* set the end of this chunks memoryy to the new tail for next iteration */
+ /* set the end of this chunks memory to the new tail for next iteration */
lasttail = curnode;
-
+#ifdef USE_TOTALLOC
pool->totalloc += pool->pchunk;
+#endif
}
/* terminate the list */
curnode->next = NULL;
@@ -213,8 +218,9 @@ void *BLI_mempool_alloc(BLI_mempool *pool)
}
}
curnode->next = NULL; /* terminate the list */
-
+#ifdef USE_TOTALLOC
pool->totalloc += pool->pchunk;
+#endif
}
retval = pool->free;
@@ -282,7 +288,9 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr)
}
BLI_addtail(&pool->chunks, first);
+#ifdef USE_TOTALLOC
pool->totalloc = pool->pchunk;
+#endif
pool->free = first->data; /* start of the list */
for (tmpaddr = first->data, i = 0; i < pool->pchunk; i++) {
diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c
index c60a9ae6bfc..348efaf40a9 100644
--- a/source/blender/blenlib/intern/listbase.c
+++ b/source/blender/blenlib/intern/listbase.c
@@ -28,9 +28,10 @@
/** \file blender/blenlib/intern/listbase.c
* \ingroup bli
+ *
+ * Manipulations on ListBase structs
*/
-
#include <string.h>
#include <stdlib.h>
@@ -41,10 +42,11 @@
#include "BLI_listbase.h"
-
/* implementation */
-/* Ripped this from blender.c */
+/**
+ * moves the entire contents of \a src onto the end of \a dst.
+ */
void BLI_movelisttolist(ListBase *dst, ListBase *src)
{
if (src->first == NULL) return;
@@ -61,6 +63,9 @@ void BLI_movelisttolist(ListBase *dst, ListBase *src)
src->first = src->last = NULL;
}
+/**
+ * Prepends \a vlink (assumed to begin with a Link) onto listbase.
+ */
void BLI_addhead(ListBase *listbase, void *vlink)
{
Link *link = vlink;
@@ -77,6 +82,9 @@ void BLI_addhead(ListBase *listbase, void *vlink)
}
+/**
+ * Appends \a vlink (assumed to begin with a Link) onto listbase.
+ */
void BLI_addtail(ListBase *listbase, void *vlink)
{
Link *link = vlink;
@@ -93,6 +101,9 @@ void BLI_addtail(ListBase *listbase, void *vlink)
}
+/**
+ * Removes \a vlink from \a listbase. Assumes it is linked into there!
+ */
void BLI_remlink(ListBase *listbase, void *vlink)
{
Link *link = vlink;
@@ -107,18 +118,24 @@ void BLI_remlink(ListBase *listbase, void *vlink)
if (listbase->first == link) listbase->first = link->next;
}
-int BLI_remlink_safe(ListBase *listbase, void *vlink)
+/**
+ * Checks that \a vlink is linked into listbase, removing it from there if so.
+ */
+bool BLI_remlink_safe(ListBase *listbase, void *vlink)
{
if (BLI_findindex(listbase, vlink) != -1) {
BLI_remlink(listbase, vlink);
- return 1;
+ return true;
}
else {
- return 0;
+ return false;
}
}
+/**
+ * Removes \a vlink from listbase and disposes of it. Assumes it is linked into there!
+ */
void BLI_freelinkN(ListBase *listbase, void *vlink)
{
Link *link = vlink;
@@ -131,43 +148,11 @@ void BLI_freelinkN(ListBase *listbase, void *vlink)
}
-void BLI_insertlink(ListBase *listbase, void *vprevlink, void *vnewlink)
-{
- Link *prevlink = vprevlink;
- Link *newlink = vnewlink;
-
- /* newlink comes after prevlink */
- if (newlink == NULL) return;
- if (listbase == NULL) return;
-
- /* empty list */
- if (listbase->first == NULL) {
-
- listbase->first = newlink;
- listbase->last = newlink;
- return;
- }
-
- /* insert before first element */
- if (prevlink == NULL) {
- newlink->next = listbase->first;
- newlink->prev = NULL;
- newlink->next->prev = newlink;
- listbase->first = newlink;
- return;
- }
-
- /* at end of list */
- if (listbase->last == prevlink)
- listbase->last = newlink;
-
- newlink->next = prevlink->next;
- prevlink->next = newlink;
- if (newlink->next) newlink->next->prev = newlink;
- newlink->prev = prevlink;
-}
-
-/* This uses insertion sort, so NOT ok for large list */
+/**
+ * Sorts the elements of listbase into the order defined by cmp
+ * (which should return 1 iff its first arg should come after its second arg).
+ * This uses insertion sort, so NOT ok for large list.
+ */
void BLI_sortlist(ListBase *listbase, int (*cmp)(void *, void *))
{
Link *current = NULL;
@@ -193,6 +178,10 @@ void BLI_sortlist(ListBase *listbase, int (*cmp)(void *, void *))
}
}
+/**
+ * Inserts \a vnewlink immediately following \a vprevlink in \a listbase.
+ * Or, if \a vprevlink is NULL, puts \a vnewlink at the front of the list.
+ */
void BLI_insertlinkafter(ListBase *listbase, void *vprevlink, void *vnewlink)
{
Link *prevlink = vprevlink;
@@ -213,21 +202,28 @@ void BLI_insertlinkafter(ListBase *listbase, void *vprevlink, void *vnewlink)
if (prevlink == NULL) {
newlink->prev = NULL;
newlink->next = listbase->first;
- ((Link *)listbase->first)->prev = newlink;
+ newlink->next->prev = newlink;
listbase->first = newlink;
return;
}
/* at end of list */
- if (listbase->last == prevlink)
+ if (listbase->last == prevlink) {
listbase->last = newlink;
+ }
newlink->next = prevlink->next;
newlink->prev = prevlink;
prevlink->next = newlink;
- if (newlink->next) newlink->next->prev = newlink;
+ if (newlink->next) {
+ newlink->next->prev = newlink;
+ }
}
+/**
+ * Inserts \a vnewlink immediately preceding \a vnextlink in listbase.
+ * Or, if \a vnextlink is NULL, puts \a vnewlink at the end of the list.
+ */
void BLI_insertlinkbefore(ListBase *listbase, void *vnextlink, void *vnewlink)
{
Link *nextlink = vnextlink;
@@ -254,16 +250,22 @@ void BLI_insertlinkbefore(ListBase *listbase, void *vnextlink, void *vnewlink)
}
/* at beginning of list */
- if (listbase->first == nextlink)
+ if (listbase->first == nextlink) {
listbase->first = newlink;
+ }
newlink->next = nextlink;
newlink->prev = nextlink->prev;
nextlink->prev = newlink;
- if (newlink->prev) newlink->prev->next = newlink;
+ if (newlink->prev) {
+ newlink->prev->next = newlink;
+ }
}
+/**
+ * Removes and disposes of the entire contents of listbase using direct free(3).
+ */
void BLI_freelist(ListBase *listbase)
{
Link *link, *next;
@@ -282,6 +284,9 @@ void BLI_freelist(ListBase *listbase)
listbase->last = NULL;
}
+/**
+ * Removes and disposes of the entire contents of \a listbase using guardedalloc.
+ */
void BLI_freelistN(ListBase *listbase)
{
Link *link, *next;
@@ -300,6 +305,9 @@ void BLI_freelistN(ListBase *listbase)
}
+/**
+ * Returns the number of elements in \a listbase.
+ */
int BLI_countlist(const ListBase *listbase)
{
Link *link;
@@ -315,6 +323,9 @@ int BLI_countlist(const ListBase *listbase)
return count;
}
+/**
+ * Returns the nth element of \a listbase, numbering from 1.
+ */
void *BLI_findlink(const ListBase *listbase, int number)
{
Link *link = NULL;
@@ -330,6 +341,9 @@ void *BLI_findlink(const ListBase *listbase, int number)
return link;
}
+/**
+ * Returns the nth-last element of \a listbase, numbering from 1.
+ */
void *BLI_rfindlink(const ListBase *listbase, int number)
{
Link *link = NULL;
@@ -345,6 +359,9 @@ void *BLI_rfindlink(const ListBase *listbase, int number)
return link;
}
+/**
+ * Returns the position of \a vlink within \a listbase, numbering from 1, or -1 if not found.
+ */
int BLI_findindex(const ListBase *listbase, const void *vlink)
{
Link *link = NULL;
@@ -365,6 +382,10 @@ int BLI_findindex(const ListBase *listbase, const void *vlink)
return -1;
}
+/**
+ * Finds the first element of \a listbase which contains the null-terminated
+ * string \a id at the specified offset, returning NULL if not found.
+ */
void *BLI_findstring(const ListBase *listbase, const char *id, const int offset)
{
Link *link = NULL;
@@ -383,6 +404,10 @@ void *BLI_findstring(const ListBase *listbase, const char *id, const int offset)
return NULL;
}
/* same as above but find reverse */
+/**
+ * Finds the last element of \a listbase which contains the
+ * null-terminated string \a id at the specified offset, returning NULL if not found.
+ */
void *BLI_rfindstring(const ListBase *listbase, const char *id, const int offset)
{
Link *link = NULL;
@@ -401,6 +426,10 @@ void *BLI_rfindstring(const ListBase *listbase, const char *id, const int offset
return NULL;
}
+/**
+ * Finds the first element of \a listbase which contains a pointer to the
+ * null-terminated string \a id at the specified offset, returning NULL if not found.
+ */
void *BLI_findstring_ptr(const ListBase *listbase, const char *id, const int offset)
{
Link *link = NULL;
@@ -420,6 +449,10 @@ void *BLI_findstring_ptr(const ListBase *listbase, const char *id, const int off
return NULL;
}
/* same as above but find reverse */
+/**
+ * Finds the last element of \a listbase which contains a pointer to the
+ * null-terminated string \a id at the specified offset, returning NULL if not found.
+ */
void *BLI_rfindstring_ptr(const ListBase *listbase, const char *id, const int offset)
{
Link *link = NULL;
@@ -440,6 +473,8 @@ void *BLI_rfindstring_ptr(const ListBase *listbase, const char *id, const int of
}
void *BLI_findptr(const ListBase *listbase, const void *ptr, const int offset)
+/* finds the first element of listbase which contains the specified pointer value
+at the specified offset, returning NULL if not found. */
{
Link *link = NULL;
const void *ptr_iter;
@@ -448,7 +483,7 @@ void *BLI_findptr(const ListBase *listbase, const void *ptr, const int offset)
for (link = listbase->first; link; link = link->next) {
/* exact copy of BLI_findstring(), except for this line */
- ptr_iter = *((const char **)(((const char *)link) + offset));
+ ptr_iter = *((const void **)(((const char *)link) + offset));
if (ptr == ptr_iter) {
return link;
@@ -459,6 +494,8 @@ void *BLI_findptr(const ListBase *listbase, const void *ptr, const int offset)
}
/* same as above but find reverse */
void *BLI_rfindptr(const ListBase *listbase, const void *ptr, const int offset)
+/* finds the last element of listbase which contains the specified pointer value
+at the specified offset, returning NULL if not found. */
{
Link *link = NULL;
const void *ptr_iter;
@@ -467,7 +504,7 @@ void *BLI_rfindptr(const ListBase *listbase, const void *ptr, const int offset)
for (link = listbase->last; link; link = link->prev) {
/* exact copy of BLI_rfindstring(), except for this line */
- ptr_iter = *((const char **)(((const char *)link) + offset));
+ ptr_iter = *((const void **)(((const char *)link) + offset));
if (ptr == ptr_iter) {
return link;
@@ -478,6 +515,8 @@ void *BLI_rfindptr(const ListBase *listbase, const void *ptr, const int offset)
}
int BLI_findstringindex(const ListBase *listbase, const char *id, const int offset)
+/* returns the 1-based index of the first element of listbase which contains the specified
+null-terminated string at the specified offset, or -1 if not found. */
{
Link *link = NULL;
const char *id_iter;
@@ -499,6 +538,7 @@ int BLI_findstringindex(const ListBase *listbase, const char *id, const int offs
}
void BLI_duplicatelist(ListBase *dst, const ListBase *src)
+/* sets dst to a duplicate of the entire contents of src. dst may be the same as src. */
{
struct Link *dst_link, *src_link;
diff --git a/source/blender/blenlib/intern/math_color_inline.c b/source/blender/blenlib/intern/math_color_inline.c
index c24da9fcf80..e9a1c0abc38 100644
--- a/source/blender/blenlib/intern/math_color_inline.c
+++ b/source/blender/blenlib/intern/math_color_inline.c
@@ -174,7 +174,8 @@ MINLINE void srgb_to_linearrgb_uchar4_predivide(float linear[4], const unsigned
}
/* color macros for themes */
-#define rgba_char_args_set_fl(col, r, g, b, a) rgba_char_args_set(col, r * 255, g * 255, b * 255, a * 255)
+#define rgba_char_args_set_fl(col, r, g, b, a) \
+ rgba_char_args_set(col, (r) * 255, (g) * 255, (b) * 255, (a) * 255)
MINLINE void rgba_char_args_set(char col[4], const char r, const char g, const char b, const char a)
{
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index 810c15437dc..baca7bb8f8a 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -2001,10 +2001,7 @@ bool axis_dominant_v3_to_m3(float r_mat[3][3], const float normal[3])
float angle;
/* double check they are normalized */
-#ifdef DEBUG
- float test;
- BLI_assert(fabsf((test = len_squared_v3(normal)) - 1.0f) < 0.0001f || fabsf(test) < 0.0001f);
-#endif
+ BLI_ASSERT_UNIT_V3(normal);
cross_v3_v3v3(axis, normal, up);
angle = saacos(dot_v3v3(normal, up));
diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c
index c0ea817ae4a..26576b2dcb2 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -1740,6 +1740,12 @@ float angle_wrap_deg(float angle)
return mod_inline(angle + 180.0f, 360.0f) - 180.0f;
}
+/* returns an angle compatible with angle_compat */
+float angle_compat_rad(float angle, float angle_compat)
+{
+ return angle + (floorf(((angle_compat - angle) / (float)M_PI) + 0.5f)) * (float)M_PI;
+}
+
/* axis conversion */
static float _axis_convert_matrix[23][3][3] = {
{{-1.0, 0.0, 0.0}, {0.0, -1.0, 0.0}, {0.0, 0.0, 1.0}},
diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c
index 490ed2a99fb..58d444f5794 100644
--- a/source/blender/blenlib/intern/math_vector.c
+++ b/source/blender/blenlib/intern/math_vector.c
@@ -235,11 +235,8 @@ float angle_signed_v2v2(const float v1[2], const float v2[2])
float angle_normalized_v3v3(const float v1[3], const float v2[3])
{
/* double check they are normalized */
-#ifdef DEBUG
- float test;
- BLI_assert(fabsf((test = len_squared_v3(v1)) - 1.0f) < 0.0001f || fabsf(test) < 0.0001f);
- BLI_assert(fabsf((test = len_squared_v3(v2)) - 1.0f) < 0.0001f || fabsf(test) < 0.0001f);
-#endif
+ BLI_ASSERT_UNIT_V3(v1);
+ BLI_ASSERT_UNIT_V3(v2);
/* this is the same as acos(dot_v3v3(v1, v2)), but more accurate */
if (dot_v3v3(v1, v2) < 0.0f) {
@@ -258,11 +255,8 @@ float angle_normalized_v3v3(const float v1[3], const float v2[3])
float angle_normalized_v2v2(const float v1[2], const float v2[2])
{
/* double check they are normalized */
-#ifdef DEBUG
- float test;
- BLI_assert(fabsf((test = len_squared_v2(v1)) - 1.0f) < 0.0001f || fabsf(test) < 0.0001f);
- BLI_assert(fabsf((test = len_squared_v2(v2)) - 1.0f) < 0.0001f || fabsf(test) < 0.0001f);
-#endif
+ BLI_ASSERT_UNIT_V2(v1);
+ BLI_ASSERT_UNIT_V2(v2);
/* this is the same as acos(dot_v3v3(v1, v2)), but more accurate */
if (dot_v2v2(v1, v2) < 0.0f) {
@@ -449,10 +443,7 @@ void rotate_normalized_v3_v3v3fl(float r[3], const float p[3], const float axis[
const float sintheta = sin(angle);
/* double check they are normalized */
-#ifdef DEBUG
- float test;
- BLI_assert(fabsf((test = len_squared_v3(axis)) - 1.0f) < 0.0001f || fabsf(test) < 0.0001f);
-#endif
+ BLI_ASSERT_UNIT_V3(axis);
r[0] = ((costheta + (1 - costheta) * axis[0] * axis[0]) * p[0]) +
(((1 - costheta) * axis[0] * axis[1] - axis[2] * sintheta) * p[1]) +
diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c
index 298e37137ce..4d42d71f490 100644
--- a/source/blender/blenlib/intern/scanfill.c
+++ b/source/blender/blenlib/intern/scanfill.c
@@ -95,7 +95,7 @@ typedef struct ScanFillVertLink {
#define SF_EPSILON 0.00003f
-#define SF_VERT_UNKNOWN 1 /* TODO, what is this for exactly? - need to document it! */
+#define SF_VERT_AVAILABLE 1 /* available - in an edge */
#define SF_VERT_ZERO_LEN 255
/* Optionally set ScanFillEdge f to this to mark original boundary edges.
@@ -424,7 +424,7 @@ static void testvertexnearedge(ScanFillContext *sf_ctx)
ScanFillEdge *eed, *ed1;
for (eve = sf_ctx->fillvertbase.first; eve; eve = eve->next) {
- if (eve->h == 1) {
+ if (eve->edge_tot == 1) {
/* find the edge which has vertex eve,
* note: we _know_ this will crash if 'ed1' becomes NULL
* but this will never happen. */
@@ -444,14 +444,14 @@ static void testvertexnearedge(ScanFillContext *sf_ctx)
if (eve != eed->v1 && eve != eed->v2 && eve->poly_nr == eed->poly_nr) {
if (compare_v3v3(eve->co, eed->v1->co, SF_EPSILON)) {
ed1->v2 = eed->v1;
- eed->v1->h++;
- eve->h = 0;
+ eed->v1->edge_tot++;
+ eve->edge_tot = 0;
break;
}
else if (compare_v3v3(eve->co, eed->v2->co, SF_EPSILON)) {
ed1->v2 = eed->v2;
- eed->v2->h++;
- eve->h = 0;
+ eed->v2->edge_tot++;
+ eve->edge_tot = 0;
break;
}
else {
@@ -465,7 +465,7 @@ static void testvertexnearedge(ScanFillContext *sf_ctx)
ed1->f = 0;
ed1->poly_nr = eed->poly_nr;
eed->v1 = eve;
- eve->h = 3;
+ eve->edge_tot = 3;
break;
}
}
@@ -646,14 +646,14 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag)
ed1 = sc->edge_first;
while (ed1) { /* set connectflags */
nexted = ed1->next;
- if (ed1->v1->h == 1 || ed1->v2->h == 1) {
+ if (ed1->v1->edge_tot == 1 || ed1->v2->edge_tot == 1) {
BLI_remlink((ListBase *)&(sc->edge_first), ed1);
BLI_addtail(&sf_ctx->filledgebase, ed1);
- if (ed1->v1->h > 1) ed1->v1->h--;
- if (ed1->v2->h > 1) ed1->v2->h--;
+ if (ed1->v1->edge_tot > 1) ed1->v1->edge_tot--;
+ if (ed1->v2->edge_tot > 1) ed1->v2->edge_tot--;
}
else {
- ed1->v2->f = SF_VERT_UNKNOWN;
+ ed1->v2->f = SF_VERT_AVAILABLE;
}
ed1 = nexted;
@@ -674,8 +674,8 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag)
/* printf("just 1 edge to vert\n"); */
BLI_addtail(&sf_ctx->filledgebase, ed1);
ed1->v2->f = 0;
- ed1->v1->h--;
- ed1->v2->h--;
+ ed1->v1->edge_tot--;
+ ed1->v2->edge_tot--;
}
else {
/* test rest of vertices */
@@ -742,10 +742,10 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag)
ed3 = BLI_scanfill_edge_add(sf_ctx, v2, best_sc->vert);
BLI_remlink(&sf_ctx->filledgebase, ed3);
BLI_insertlinkbefore((ListBase *)&(sc->edge_first), ed2, ed3);
- ed3->v2->f = SF_VERT_UNKNOWN;
+ ed3->v2->f = SF_VERT_AVAILABLE;
ed3->f = SF_EDGE_UNKNOWN;
- ed3->v1->h++;
- ed3->v2->h++;
+ ed3->v1->edge_tot++;
+ ed3->v2->edge_tot++;
}
else {
/* new triangle */
@@ -755,31 +755,31 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag)
BLI_remlink((ListBase *)&(sc->edge_first), ed1);
BLI_addtail(&sf_ctx->filledgebase, ed1);
ed1->v2->f = 0;
- ed1->v1->h--;
- ed1->v2->h--;
+ ed1->v1->edge_tot--;
+ ed1->v2->edge_tot--;
/* ed2 can be removed when it's a boundary edge */
if ((ed2->f == 0 && twoconnected) || (ed2->f == SF_EDGE_BOUNDARY)) {
BLI_remlink((ListBase *)&(sc->edge_first), ed2);
BLI_addtail(&sf_ctx->filledgebase, ed2);
ed2->v2->f = 0;
- ed2->v1->h--;
- ed2->v2->h--;
+ ed2->v1->edge_tot--;
+ ed2->v2->edge_tot--;
}
/* new edge */
ed3 = BLI_scanfill_edge_add(sf_ctx, v1, v3);
BLI_remlink(&sf_ctx->filledgebase, ed3);
ed3->f = SF_EDGE_UNKNOWN;
- ed3->v1->h++;
- ed3->v2->h++;
+ ed3->v1->edge_tot++;
+ ed3->v2->edge_tot++;
/* printf("add new edge %x %x\n", v1, v3); */
sc1 = addedgetoscanlist(sf_ctx, ed3, verts);
if (sc1) { /* ed3 already exists: remove if a boundary */
/* printf("Edge exists\n"); */
- ed3->v1->h--;
- ed3->v2->h--;
+ ed3->v1->edge_tot--;
+ ed3->v2->edge_tot--;
ed3 = sc1->edge_first;
while (ed3) {
@@ -787,8 +787,8 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag)
if (twoconnected || ed3->f == SF_EDGE_BOUNDARY) {
BLI_remlink((ListBase *)&(sc1->edge_first), ed3);
BLI_addtail(&sf_ctx->filledgebase, ed3);
- ed3->v1->h--;
- ed3->v2->h--;
+ ed3->v1->edge_tot--;
+ ed3->v2->edge_tot--;
}
break;
}
@@ -797,19 +797,21 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag)
}
}
}
+
/* test for loose edges */
ed1 = sc->edge_first;
while (ed1) {
nexted = ed1->next;
- if (ed1->v1->h < 2 || ed1->v2->h < 2) {
+ if (ed1->v1->edge_tot < 2 || ed1->v2->edge_tot < 2) {
BLI_remlink((ListBase *)&(sc->edge_first), ed1);
BLI_addtail(&sf_ctx->filledgebase, ed1);
- if (ed1->v1->h > 1) ed1->v1->h--;
- if (ed1->v2->h > 1) ed1->v2->h--;
+ if (ed1->v1->edge_tot > 1) ed1->v1->edge_tot--;
+ if (ed1->v2->edge_tot > 1) ed1->v2->edge_tot--;
}
ed1 = nexted;
}
+ /* done with loose edges */
}
sc++;
@@ -861,7 +863,7 @@ int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const float no
while (eve) {
eve->f = 0;
eve->poly_nr = 0;
- eve->h = 0;
+ eve->edge_tot = 0;
eve = eve->next;
a += 1;
}
@@ -899,15 +901,15 @@ int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const float no
eed = sf_ctx->filledgebase.first;
while (eed) {
eed->poly_nr = 0;
- eed->v1->f = SF_VERT_UNKNOWN;
- eed->v2->f = SF_VERT_UNKNOWN;
+ eed->v1->f = SF_VERT_AVAILABLE;
+ eed->v2->f = SF_VERT_AVAILABLE;
eed = eed->next;
}
eve = sf_ctx->fillvertbase.first;
while (eve) {
- if (eve->f & SF_VERT_UNKNOWN) {
+ if (eve->f & SF_VERT_AVAILABLE) {
ok = 1;
break;
}
@@ -1017,8 +1019,8 @@ int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const float no
/* STEP 2: remove loose edges and strings of edges */
eed = sf_ctx->filledgebase.first;
while (eed) {
- if (eed->v1->h++ > 250) break;
- if (eed->v2->h++ > 250) break;
+ if (eed->v1->edge_tot++ > 250) break;
+ if (eed->v2->edge_tot++ > 250) break;
eed = eed->next;
}
if (eed) {
@@ -1039,14 +1041,14 @@ int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const float no
while (eed) {
if (toggle & 1) nexted = eed->next;
else nexted = eed->prev;
- if (eed->v1->h == 1) {
- eed->v2->h--;
+ if (eed->v1->edge_tot == 1) {
+ eed->v2->edge_tot--;
BLI_remlink(&sf_ctx->fillvertbase, eed->v1);
BLI_remlink(&sf_ctx->filledgebase, eed);
ok = 1;
}
- else if (eed->v2->h == 1) {
- eed->v1->h--;
+ else if (eed->v2->edge_tot == 1) {
+ eed->v1->edge_tot--;
BLI_remlink(&sf_ctx->fillvertbase, eed->v2);
BLI_remlink(&sf_ctx->filledgebase, eed);
ok = 1;
@@ -1061,13 +1063,13 @@ int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const float no
/* CURRENT STATUS:
- * - eve->f :1 = available in edges
- * - eve->xs :polynumber
- * - eve->h :amount of edges connected to vertex
- * - eve->tmp.v :store! original vertex number
+ * - eve->f :1 = available in edges
+ * - eve->poly_nr :polynumber
+ * - eve->edge_tot :amount of edges connected to vertex
+ * - eve->tmp.v :store! original vertex number
*
- * - eed->f :1 = boundary edge (optionally set by caller)
- * - eed->poly_nr :poly number
+ * - eed->f :1 = boundary edge (optionally set by caller)
+ * - eed->poly_nr :poly number
*/
@@ -1096,7 +1098,7 @@ int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const float no
min_xy_p[1] = (min_xy_p[1]) < (eve->xy[1]) ? (min_xy_p[1]) : (eve->xy[1]);
max_xy_p[0] = (max_xy_p[0]) > (eve->xy[0]) ? (max_xy_p[0]) : (eve->xy[0]);
max_xy_p[1] = (max_xy_p[1]) > (eve->xy[1]) ? (max_xy_p[1]) : (eve->xy[1]);
- if (eve->h > 2) pflist[eve->poly_nr - 1].f = 1;
+ if (eve->edge_tot > 2) pflist[eve->poly_nr - 1].f = 1;
eve = eve->next;
}
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c
index 28fdf7b61db..3500f3f1805 100644
--- a/source/blender/blenlib/intern/string.c
+++ b/source/blender/blenlib/intern/string.c
@@ -199,12 +199,15 @@ char *BLI_str_quoted_substrN(const char *__restrict str, const char *__restrict
/* 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) + prefixLen + 1;
-
- /* get the end point (i.e. where the next occurance of " is after the starting point) */
- endMatch = strchr(startMatch, '"'); /* " NOTE: this comment here is just so that my text editor still shows the functions ok... */
-
- /* return the slice indicated */
- return BLI_strdupn(startMatch, (size_t)(endMatch - startMatch));
+ if (startMatch) {
+ /* get the end point (i.e. where the next occurance of " is after the starting point) */
+ endMatch = strchr(startMatch, '"'); /* " NOTE: this comment here is just so that my text editor still shows the functions ok... */
+
+ if (endMatch)
+ /* return the slice indicated */
+ return BLI_strdupn(startMatch, (size_t)(endMatch - startMatch));
+ }
+ return BLI_strdupn("", 0);
}
/* Replaces all occurrences of oldText with newText in str, returning a new string that doesn't
diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c
index 9e0f9197ca3..26235de4dd2 100644
--- a/source/blender/blenlib/intern/string_utf8.c
+++ b/source/blender/blenlib/intern/string_utf8.c
@@ -369,7 +369,7 @@ size_t BLI_strncpy_wchar_from_utf8(wchar_t *__restrict dst_w, const char *__rest
int BLI_str_utf8_size(const char *p)
{
int mask = 0, len;
- unsigned char c = (unsigned char) *p;
+ const unsigned char c = (unsigned char) *p;
UTF8_COMPUTE (c, mask, len, -1);
@@ -382,7 +382,7 @@ int BLI_str_utf8_size(const char *p)
int BLI_str_utf8_size_safe(const char *p)
{
int mask = 0, len;
- unsigned char c = (unsigned char) *p;
+ const unsigned char c = (unsigned char) *p;
UTF8_COMPUTE (c, mask, len, 1);
@@ -408,10 +408,10 @@ unsigned int BLI_str_utf8_as_unicode(const char *p)
{
int i, mask = 0, len;
unsigned int result;
- unsigned char c = (unsigned char) *p;
+ const unsigned char c = (unsigned char) *p;
UTF8_COMPUTE (c, mask, len, -1);
- if (len == -1)
+ if (UNLIKELY(len == -1))
return BLI_UTF8_ERR;
UTF8_GET (result, p, i, mask, len, BLI_UTF8_ERR);
@@ -423,16 +423,32 @@ unsigned int BLI_str_utf8_as_unicode_and_size(const char *__restrict p, size_t *
{
int i, mask = 0, len;
unsigned int result;
- unsigned char c = (unsigned char) *p;
+ const unsigned char c = (unsigned char) *p;
UTF8_COMPUTE (c, mask, len, -1);
- if (len == -1)
+ if (UNLIKELY(len == -1))
return BLI_UTF8_ERR;
UTF8_GET (result, p, i, mask, len, BLI_UTF8_ERR);
*index += len;
return result;
}
+unsigned int BLI_str_utf8_as_unicode_and_size_safe(const char *__restrict p, size_t *__restrict index)
+{
+ int i, mask = 0, len;
+ unsigned int result;
+ const unsigned char c = (unsigned char) *p;
+
+ UTF8_COMPUTE (c, mask, len, -1);
+ if (UNLIKELY(len == -1)) {
+ *index += 1;
+ return c;
+ }
+ UTF8_GET (result, p, i, mask, len, BLI_UTF8_ERR);
+ *index += len;
+ return result;
+}
+
/* another variant that steps over the index,
* note, currently this also falls back to latin1 for text drawing. */
unsigned int BLI_str_utf8_as_unicode_step(const char *__restrict p, size_t *__restrict index)
@@ -445,7 +461,7 @@ unsigned int BLI_str_utf8_as_unicode_step(const char *__restrict p, size_t *__re
c = (unsigned char) *p;
UTF8_COMPUTE (c, mask, len, -1);
- if (len == -1) {
+ if (UNLIKELY(len == -1)) {
/* when called with NULL end, result will never be NULL,
* checks for a NULL character */
char *p_next = BLI_str_find_next_char_utf8(p, NULL);
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 7d6ea1be77d..44a73fa14a0 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -41,6 +41,7 @@
#include <math.h> // for fabs
#include <stdarg.h> /* for va_start/end */
+#include "BLI_utildefines.h"
#ifndef WIN32
# include <unistd.h> // for read close
#else
@@ -120,6 +121,7 @@
#include "BKE_context.h"
#include "BKE_curve.h"
#include "BKE_deform.h"
+#include "BKE_depsgraph.h"
#include "BKE_effect.h"
#include "BKE_fcurve.h"
#include "BKE_global.h" // for G
@@ -831,7 +833,7 @@ static int read_file_dna(FileData *fd)
for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) {
if (bhead->code == DNA1) {
- int do_endian_swap = (fd->flags & FD_FLAGS_SWITCH_ENDIAN) ? 1 : 0;
+ 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);
if (fd->filesdna) {
@@ -954,11 +956,11 @@ static FileData *filedata_new(void)
fd->filedes = -1;
fd->gzfiledes = NULL;
- /* XXX, this doesn't need to be done all the time,
- * but it keeps us re-entrant, remove once we have
- * a lib that provides a nice lock. - zr
- */
- fd->memsdna = DNA_sdna_from_data(DNAstr, DNAlen, 0);
+ /* XXX, this doesn't need to be done all the time,
+ * but it keeps us re-entrant, remove once we have
+ * a lib that provides a nice lock. - zr
+ */
+ fd->memsdna = DNA_sdna_from_data(DNAstr, DNAlen, false);
fd->datamap = oldnewmap_new();
fd->globmap = oldnewmap_new();
@@ -2713,7 +2715,7 @@ static void direct_link_constraints(FileData *fd, ListBase *lb)
}
}
-static void lib_link_pose(FileData *fd, Object *ob, bPose *pose)
+static void lib_link_pose(FileData *fd, Main *bmain, Object *ob, bPose *pose)
{
bPoseChannel *pchan;
bArmature *arm = ob->data;
@@ -2757,7 +2759,7 @@ static void lib_link_pose(FileData *fd, Object *ob, bPose *pose)
}
if (rebuild) {
- ob->recalc = (OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
+ DAG_id_tag_update_ex(bmain, &ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
pose->flag |= POSE_RECALC;
}
}
@@ -4222,7 +4224,7 @@ static void lib_link_object(FileData *fd, Main *main)
/* if id.us==0 a new base will be created later on */
/* WARNING! Also check expand_object(), should reflect the stuff below. */
- lib_link_pose(fd, ob, ob->pose);
+ lib_link_pose(fd, main, ob, ob->pose);
lib_link_constraints(fd, &ob->id, &ob->constraints);
// XXX deprecated - old animation system <<<
@@ -5128,7 +5130,6 @@ static void direct_link_scene(FileData *fd, Scene *sce)
RigidBodyWorld *rbw;
sce->theDag = NULL;
- sce->dagisvalid = 0;
sce->obedit = NULL;
sce->stats = NULL;
sce->fps_info = NULL;
@@ -6476,6 +6477,7 @@ static void direct_link_movieclip(FileData *fd, MovieClip *clip)
clip->tracking.dopesheet.ok = 0;
clip->tracking.dopesheet.channels.first = clip->tracking.dopesheet.channels.last = NULL;
+ clip->tracking.dopesheet.coverage_segments.first = clip->tracking.dopesheet.coverage_segments.last = NULL;
link_list(fd, &tracking->objects);
@@ -8862,8 +8864,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
SEQ_BEGIN (scene->ed, seq)
{
- if (seq->flag & SEQ_MAKE_PREMUL)
+ if (seq->flag & SEQ_MAKE_PREMUL) {
seq->alpha_mode = SEQ_ALPHA_STRAIGHT;
+ }
+ else {
+ BKE_sequence_alpha_mode_from_extension(seq);
+ }
}
SEQ_END
@@ -8889,8 +8895,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
for (image = main->image.first; image; image = image->id.next) {
- if (image->flag & IMA_DO_PREMUL)
+ if (image->flag & IMA_DO_PREMUL) {
image->alpha_mode = IMA_ALPHA_STRAIGHT;
+ }
+ else {
+ BKE_image_alpha_mode_from_extension(image);
+ }
image->flag &= ~IMA_DONE_TAG;
}
@@ -8913,7 +8923,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if (image == blo_do_versions_newlibadr(fd, otex->id.lib, otex->ima))
break;
- if (otex) {
+ /* no duplication if the texture and image datablock are not
+ * from the same .blend file, the image datablock may not have
+ * been loaded from a library file otherwise */
+ if (otex && (tex->id.lib == image->id.lib)) {
/* copy image datablock */
nimage = BKE_image_copy(main, image);
nimage->flag |= IMA_IGNORE_ALPHA|IMA_DONE_TAG;
@@ -10398,7 +10411,7 @@ static void give_base_to_groups(Main *mainvar, Scene *scene)
base = BKE_scene_base_add(scene, ob);
base->flag |= SELECT;
base->object->flag= base->flag;
- ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
scene->basact = base;
/* assign the group */
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 475d96fd709..50e1e229eba 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -89,6 +89,8 @@
# include "BLI_winstuff.h"
#endif
+#include "BLI_utildefines.h"
+
/* allow writefile to use deprecated functionality (for forward compatibility code) */
#define DNA_DEPRECATED_ALLOW
@@ -201,7 +203,7 @@ static WriteData *writedata_new(int file)
if (wd == NULL) return NULL;
- wd->sdna = DNA_sdna_from_data(DNAstr, DNAlen, 0);
+ wd->sdna = DNA_sdna_from_data(DNAstr, DNAlen, false);
wd->file= file;
diff --git a/source/blender/bmesh/bmesh_class.h b/source/blender/bmesh/bmesh_class.h
index 3dd2e7a6131..384ff341dff 100644
--- a/source/blender/bmesh/bmesh_class.h
+++ b/source/blender/bmesh/bmesh_class.h
@@ -291,6 +291,6 @@ enum {
* but should not error on valid cases */
#define BM_LOOP_RADIAL_MAX 10000
#define BM_NGON_MAX 100000
-#define BM_OMP_LIMIT 0 /* setting zero so we can catch bugs in OpenMP/BMesh */
+#define BM_OMP_LIMIT 10000 /* setting zero so we can catch bugs in OpenMP/BMesh */
#endif /* __BMESH_CLASS_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c
index c5eeceb43a3..7e3ee9d249e 100644
--- a/source/blender/bmesh/intern/bmesh_opdefines.c
+++ b/source/blender/bmesh/intern/bmesh_opdefines.c
@@ -1410,18 +1410,6 @@ static BMOpDefine bmo_bevel_def = {
{{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */
{{'\0'}},
},
-/* old bevel*/
-// {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input edges and vertices */
-// {"face_spans", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* new geometry */
-// {"face_holes", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* new geometry */
-// {"use_lengths", BMO_OP_SLOT_BOOL}, /* grab edge lengths from a PROP_FLT customdata layer */
-// {"use_even", BMO_OP_SLOT_BOOL}, /* corner vert placement: use shell/angle calculations */
-// {"use_dist", BMO_OP_SLOT_BOOL}, /* corner vert placement: evaluate percent as a distance,
-// * modifier uses this. We could do this as another float setting */
-// {"lengthlayer", BMO_OP_SLOT_INT}, /* which PROP_FLT layer to us */
-// {"percent", BMO_OP_SLOT_FLT}, /* percentage to expand beveled edge */
-// {{'\0'}},
-// },
bmo_bevel_exec,
BMO_OP_FLAG_UNTAN_MULTIRES
diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c
index 98958596324..00f8dbe06bf 100644
--- a/source/blender/bmesh/intern/bmesh_operators.c
+++ b/source/blender/bmesh/intern/bmesh_operators.c
@@ -595,13 +595,13 @@ void BMO_mesh_flag_disable_all(BMesh *bm, BMOperator *UNUSED(op), const char hty
const char flag_types[3] = {BM_VERT, BM_EDGE, BM_FACE};
- BMIter iter;
BMElemF *ele;
int i;
#pragma omp parallel for schedule(dynamic) if (bm->totvert + bm->totedge + bm->totface >= BM_OMP_LIMIT)
for (i = 0; i < 3; i++) {
if (htype & flag_types[i]) {
+ BMIter iter;
BM_ITER_MESH (ele, &iter, bm, iter_types[i]) {
BMO_elem_flag_disable(bm, ele, oflag);
}
diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c
index 1aa4d7c5e00..9592c34fc75 100644
--- a/source/blender/bmesh/intern/bmesh_polygon.c
+++ b/source/blender/bmesh/intern/bmesh_polygon.c
@@ -674,7 +674,7 @@ static BMLoop *poly_find_ear(BMFace *f, float (*projectverts)[2], const bool use
i = (((len_squared_v3v3(larr[0]->v->co, larr[2]->v->co) >
len_squared_v3v3(larr[1]->v->co, larr[3]->v->co) * bias)) != use_beauty);
i4 = (i + 3) % 4;
- /* Check produced tris aren’t too flat/narrow...
+ /* Check produced tris aren't too flat/narrow...
* Probably not the best test, but is quite efficient and should at least avoid null-area faces! */
cos1 = fabsf(cos_v3v3v3(larr[i4]->v->co, larr[i]->v->co, larr[i + 1]->v->co));
cos2 = fabsf(cos_v3v3v3(larr[i4]->v->co, larr[i + 2]->v->co, larr[i + 1]->v->co));
@@ -741,7 +741,8 @@ static BMLoop *poly_find_ear(BMFace *f, float (*projectverts)[2], const bool use
/* Compare to prev best (i.e. lowest) cos. */
if (cos < bestcos) {
/* We must check this tri would not leave a (too much) degenerated remaining face! */
- /* For now just assume if the average of cos of all "remaining face"'s corners is below a given threshold, it’s OK. */
+ /* For now just assume if the average of cos of all
+ * "remaining face"'s corners is below a given threshold, it's OK. */
float avgcos = fabsf(cos_v3v3v3(v1->co, v3->co, l_iter->next->next->v->co));
const int i_limit = (i - 1 + len) % len;
avgcos += fabsf(cos_v3v3v3(l_iter->prev->prev->v->co, v1->co, v3->co));
diff --git a/source/blender/bmesh/operators/bmo_bevel.c b/source/blender/bmesh/operators/bmo_bevel.c
index c56af821a93..795531d6776 100644
--- a/source/blender/bmesh/operators/bmo_bevel.c
+++ b/source/blender/bmesh/operators/bmo_bevel.c
@@ -55,7 +55,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op)
}
}
- BM_mesh_bevel(bm, offset, seg, vonly);
+ BM_mesh_bevel(bm, offset, seg, vonly, false, NULL, -1);
BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_out, "faces.out", BM_FACE, BM_ELEM_TAG);
}
diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c
index 1e74354603b..5adef16de14 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -30,11 +30,15 @@
#include "MEM_guardedalloc.h"
+#include "DNA_object_types.h"
+#include "DNA_meshdata_types.h"
+
#include "BLI_array.h"
#include "BLI_math.h"
#include "BLI_memarena.h"
#include "BKE_customdata.h"
+#include "BKE_deform.h"
#include "bmesh.h"
#include "./intern/bmesh_private.h"
@@ -104,6 +108,7 @@ typedef struct BevVert {
BMVert *v; /* original mesh vertex */
int edgecount; /* total number of edges around the vertex */
int selcount; /* number of selected edges around the vertex */
+ float offset; /* offset for this vertex, if vertex_only bevel */
EdgeHalf *edges; /* array of size edgecount; CCW order from vertex normal side */
VMesh *vmesh; /* mesh structure for replacing vertex */
} BevVert;
@@ -117,7 +122,10 @@ typedef struct BevelParams {
float offset; /* blender units to offset each side of a beveled edge */
int seg; /* number of segments in beveled edge profile */
- int vertex_only; /* bevel vertices only */
+ bool vertex_only; /* bevel vertices only */
+ bool use_weights; /* bevel amount affected by weights on edges or verts */
+ const struct MDeformVert *dvert; /* vertex group array, maybe set if vertex_only */
+ int vertex_group; /* vertex group index, maybe set if vertex_only */
} BevelParams;
// #pragma GCC diagnostic ignored "-Wpadded"
@@ -665,7 +673,7 @@ static void build_boundary(BevelParams *bp, BevVert *bv)
return;
}
- lastd = bp->vertex_only ? bp->offset : e->offset;
+ lastd = bp->vertex_only? bv->offset : e->offset;
vm->boundstart = NULL;
do {
if (e->is_bev) {
@@ -1722,6 +1730,7 @@ static void bevel_vert_construct(BMesh *bm, BevelParams *bp, BMVert *v)
BMFace *f;
BMIter iter, iter2;
EdgeHalf *e;
+ float weight;
int i, found_shared_face, ccw_test_sum;
int nsel = 0;
int ntot = 0;
@@ -1760,11 +1769,24 @@ static void bevel_vert_construct(BMesh *bm, BevelParams *bp, BMVert *v)
bv->v = v;
bv->edgecount = ntot;
bv->selcount = nsel;
+ bv->offset = bp->offset;
bv->edges = (EdgeHalf *)BLI_memarena_alloc(bp->mem_arena, ntot * sizeof(EdgeHalf));
bv->vmesh = (VMesh *)BLI_memarena_alloc(bp->mem_arena, sizeof(VMesh));
bv->vmesh->seg = bp->seg;
BLI_ghash_insert(bp->vert_hash, v, bv);
+ if (bp->vertex_only) {
+ /* if weighted, modify offset by weight */
+ if (bp->dvert != NULL && bp->vertex_group != -1) {
+ weight = defvert_find_weight(bp->dvert + BM_elem_index_get(v), bp->vertex_group);
+ if (weight <= 0.0f) {
+ BM_elem_flag_disable(v, BM_ELEM_TAG);
+ return;
+ }
+ bv->offset *= weight;
+ }
+ }
+
/* add edges to bv->edges in order that keeps adjacent edges sharing
* a face, if possible */
i = 0;
@@ -1815,7 +1837,16 @@ static void bevel_vert_construct(BMesh *bm, BevelParams *bp, BMVert *v)
e->seg = 0;
}
e->is_rev = (bme->v2 == v);
- e->offset = e->is_bev ? bp->offset : 0.0f;
+ if (e->is_bev) {
+ e->offset = bp->offset;
+ if (bp->use_weights) {
+ weight = BM_elem_float_data_get(&bm->edata, bme, CD_BWEIGHT);
+ e->offset *= weight;
+ }
+ }
+ else {
+ e->offset = 0.0f;
+ }
}
/* find wrap-around shared face */
BM_ITER_ELEM (f, &iter2, bme, BM_FACES_OF_EDGE) {
@@ -2034,7 +2065,9 @@ static void bevel_build_edge_polygons(BMesh *bm, BevelParams *bp, BMEdge *bme)
*
* \warning all tagged edges _must_ be manifold.
*/
-void BM_mesh_bevel(BMesh *bm, const float offset, const float segments, const int vertex_only)
+void BM_mesh_bevel(BMesh *bm, const float offset, const float segments,
+ const bool vertex_only, const bool use_weights,
+ const struct MDeformVert *dvert, const int vertex_group)
{
BMIter iter;
BMVert *v;
@@ -2044,6 +2077,9 @@ void BM_mesh_bevel(BMesh *bm, const float offset, const float segments, const in
bp.offset = offset;
bp.seg = segments;
bp.vertex_only = vertex_only;
+ bp.use_weights = use_weights;
+ bp.dvert = dvert;
+ bp.vertex_group = vertex_group;
if (bp.offset > 0) {
/* primary alloc */
diff --git a/source/blender/bmesh/tools/bmesh_bevel.h b/source/blender/bmesh/tools/bmesh_bevel.h
index d56aa13c984..f214125fa1c 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.h
+++ b/source/blender/bmesh/tools/bmesh_bevel.h
@@ -27,6 +27,10 @@
* \ingroup bmesh
*/
-void BM_mesh_bevel(BMesh *bm, const float offset, const float segments, const int vertex_only);
+struct MDeformVert;
+
+void BM_mesh_bevel(BMesh *bm, const float offset, const float segments,
+ const bool vertex_only, const bool use_weights,
+ const struct MDeformVert *dvert, const int vertex_group);
#endif /* __BMESH_BEVEL_H__ */
diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp
index 943c4fb574d..60188071832 100644
--- a/source/blender/collada/AnimationImporter.cpp
+++ b/source/blender/collada/AnimationImporter.cpp
@@ -1888,7 +1888,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);
- job->recalc |= OB_RECALC_OB;
+ DAG_id_tag_update(&job->id, OB_RECALC_OB);
verify_adt_action((ID *)&job->id, 1);
@@ -1909,14 +1909,14 @@ Object *AnimationImporter::get_joint_object(COLLADAFW::Node *root, COLLADAFW::No
if (par_job) {
job->parent = par_job;
- par_job->recalc |= OB_RECALC_OB;
+ DAG_id_tag_update(&par_job->id, OB_RECALC_OB);
job->parsubstr[0] = 0;
}
BKE_object_where_is_calc(scene, job);
// after parenting and layer change
- DAG_scene_sort(CTX_data_main(C), scene);
+ DAG_relations_tag_update(CTX_data_main(C));
joint_objects[node->getUniqueId()] = job;
}
diff --git a/source/blender/collada/ArmatureExporter.h b/source/blender/collada/ArmatureExporter.h
index 6222496a9f7..931cc5d2988 100644
--- a/source/blender/collada/ArmatureExporter.h
+++ b/source/blender/collada/ArmatureExporter.h
@@ -70,7 +70,6 @@ public:
//void operator()(Object *ob);
private:
- Scene *scene;
UnitConverter converter;
const ExportSettings *export_settings;
diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp
index fefad7dd8ec..c270a1e6b20 100644
--- a/source/blender/collada/ArmatureImporter.cpp
+++ b/source/blender/collada/ArmatureImporter.cpp
@@ -415,10 +415,23 @@ void ArmatureImporter::create_armature_bones(SkinInfo& skin)
break;
}
- if (shared)
+ if (!shared && this->joint_parent_map.size() > 0) {
+ // All armatures have been created while creating the Node tree.
+ // The Collada exporter currently does not create a
+ // strict relationship between geometries and armatures
+ // So when we reimport a Blender collada file, then we have
+ // to guess what is meant.
+ // XXX This is not safe when we have more than one armatures
+ // in the import.
+ shared = this->joint_parent_map.begin()->second;
+ }
+
+ if (shared) {
ob_arm = skin.set_armature(shared);
- else
+ }
+ else {
ob_arm = skin.create_armature(scene); //once for every armature
+ }
// enter armature edit mode
ED_armature_to_edit(ob_arm);
@@ -659,38 +672,44 @@ void ArmatureImporter::make_shape_keys()
//Prereq: all the geometries must be imported and mesh objects must be made
Object *source_ob = this->mesh_importer->get_object_by_geom_uid((*mc)->getSource());
- Mesh *source_me = (Mesh*) source_ob->data;
- //insert key to source mesh
- Key *key = source_me->key = BKE_key_add((ID *)source_me);
- key->type = KEY_RELATIVE;
- KeyBlock *kb;
-
- //insert basis key
- kb = BKE_keyblock_add_ctime(key, "Basis", FALSE);
- BKE_key_convert_from_mesh(source_me, kb);
+ if (source_ob) {
- //insert other shape keys
- for (int i = 0 ; i < morphTargetIds.getCount() ; i++ ) {
- //better to have a seperate map of morph objects,
- //This'll do for now since only mesh morphing is imported
-
- Mesh *me = this->mesh_importer->get_mesh_by_geom_uid(morphTargetIds[i]);
+ Mesh *source_me = (Mesh*) source_ob->data;
+ //insert key to source mesh
+ Key *key = source_me->key = BKE_key_add((ID *)source_me);
+ key->type = KEY_RELATIVE;
+ KeyBlock *kb;
- if (me) {
- me->key = key;
- std::string morph_name = *this->mesh_importer->get_geometry_name(me->id.name);
+ //insert basis key
+ kb = BKE_keyblock_add_ctime(key, "Basis", FALSE);
+ BKE_key_convert_from_mesh(source_me, kb);
+
+ //insert other shape keys
+ for (int i = 0 ; i < morphTargetIds.getCount() ; i++ ) {
+ //better to have a seperate map of morph objects,
+ //This'll do for now since only mesh morphing is imported
- kb = BKE_keyblock_add_ctime(key, morph_name.c_str(), FALSE);
- BKE_key_convert_from_mesh(me, kb);
+ Mesh *me = this->mesh_importer->get_mesh_by_geom_uid(morphTargetIds[i]);
- //apply weights
- weight = morphWeights.getFloatValues()->getData()[i];
- kb->curval = weight;
- }
- else {
- fprintf(stderr, "Morph target geometry not found.\n");
+ if (me) {
+ me->key = key;
+ std::string morph_name = *this->mesh_importer->get_geometry_name(me->id.name);
+
+ kb = BKE_keyblock_add_ctime(key, morph_name.c_str(), FALSE);
+ BKE_key_convert_from_mesh(me, kb);
+
+ //apply weights
+ weight = morphWeights.getFloatValues()->getData()[i];
+ kb->curval = weight;
+ }
+ else {
+ fprintf(stderr, "Morph target geometry not found.\n");
+ }
}
}
+ else {
+ fprintf(stderr, "Morph target object not found.\n");
+ }
}
}
diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp
index 8af4d0652d9..2b906fa9ac2 100644
--- a/source/blender/collada/DocumentImporter.cpp
+++ b/source/blender/collada/DocumentImporter.cpp
@@ -180,14 +180,16 @@ void DocumentImporter::finish()
{
if (mImportStage != General)
return;
-
+
+ Main *bmain = CTX_data_main(mContext);
+ // TODO: create a new scene except the selected <visual_scene> - use current blender scene for it
+ Scene *sce = CTX_data_scene(mContext);
+
/** TODO Break up and put into 2-pass parsing of DAE */
std::vector<const COLLADAFW::VisualScene *>::iterator it;
for (it = vscenes.begin(); it != vscenes.end(); it++) {
PointerRNA sceneptr, unit_settings;
PropertyRNA *system, *scale;
- // TODO: create a new scene except the selected <visual_scene> - use current blender scene for it
- Scene *sce = CTX_data_scene(mContext);
// for scene unit settings: system, scale_length
@@ -228,9 +230,7 @@ void DocumentImporter::finish()
}
// update scene
- Main *bmain = CTX_data_main(mContext);
- DAG_scene_sort(bmain, sce);
- DAG_ids_flush_update(bmain, 0);
+ DAG_relations_tag_update(bmain);
WM_event_add_notifier(mContext, NC_OBJECT | ND_TRANSFORM, NULL);
}
@@ -241,6 +241,7 @@ void DocumentImporter::finish()
armature_importer.set_tags_map(this->uid_tags_map);
armature_importer.make_armatures(mContext);
armature_importer.make_shape_keys();
+ DAG_relations_tag_update(bmain);
#if 0
armature_importer.fix_animation();
@@ -249,8 +250,9 @@ void DocumentImporter::finish()
for (std::vector<const COLLADAFW::VisualScene *>::iterator it = vscenes.begin(); it != vscenes.end(); it++) {
const COLLADAFW::NodePointerArray& roots = (*it)->getRootNodes();
- for (unsigned int i = 0; i < roots.getCount(); i++)
+ for (unsigned int i = 0; i < roots.getCount(); i++) {
translate_anim_recursive(roots[i], NULL, NULL);
+ }
}
if (libnode_ob.size()) {
@@ -273,8 +275,7 @@ void DocumentImporter::finish()
}
libnode_ob.clear();
- DAG_scene_sort(CTX_data_main(mContext), sce);
- DAG_ids_flush_update(CTX_data_main(mContext), 0);
+ DAG_relations_tag_update(bmain);
}
}
@@ -309,13 +310,22 @@ void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node, COLLADAFW
#endif
unsigned int i;
+
//for (i = 0; i < 4; i++)
// ob =
anim_importer.translate_Animations(node, root_map, object_map, FW_object_map);
- COLLADAFW::NodePointerArray &children = node->getChildNodes();
- for (i = 0; i < children.getCount(); i++) {
- translate_anim_recursive(children[i], node, NULL);
+ if (node->getType() == COLLADAFW::Node::JOINT && par == NULL) {
+ // For Skeletons without root node we have to simulate the
+ // root node here and recursively enter the same function
+ // XXX: maybe this can be made more elegant.
+ translate_anim_recursive(node, node, parob);
+ }
+ else {
+ COLLADAFW::NodePointerArray &children = node->getChildNodes();
+ for (i = 0; i < children.getCount(); i++) {
+ translate_anim_recursive(children[i], node, NULL);
+ }
}
}
@@ -376,7 +386,7 @@ Object *DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::Nod
fprintf(stderr, "create <instance_node> under node id=%s from node id=%s\n", instance_node ? instance_node->getOriginalId().c_str() : NULL, source_node ? source_node->getOriginalId().c_str() : NULL);
Object *obn = BKE_object_copy(source_ob);
- obn->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+ DAG_id_tag_update(&obn->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
BKE_scene_base_add(sce, obn);
if (instance_node) {
@@ -403,8 +413,7 @@ Object *DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::Nod
anim_importer.read_node_transform(source_node, obn);
}
- /*DAG_scene_sort(CTX_data_main(mContext), sce);
- DAG_ids_flush_update(CTX_data_main(mContext), 0);*/
+ /*DAG_relations_tag_update(CTX_data_main(mContext));*/
COLLADAFW::NodePointerArray &children = source_node->getChildNodes();
if (children.getCount()) {
@@ -462,7 +471,21 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, COLLA
name.c_str());
if (is_joint) {
+ if (parent_node == NULL) {
+ // A Joint on root level is a skeleton without root node.
+ // Here we add the armature "on the fly":
+ par = bc_add_object(sce, OB_ARMATURE, std::string("Armature").c_str());
+ objects_done->push_back(par);
+ object_map.insert(std::make_pair<COLLADAFW::UniqueId, Object *>(node->getUniqueId(), par));
+ node_map[node->getUniqueId()] = node;
+ }
armature_importer.add_joint(node, parent_node == NULL || parent_node->getType() != COLLADAFW::Node::JOINT, par, sce);
+
+ if (parent_node == NULL) {
+ // for skeletons without root node all has been done above.
+ // Skeletons with root node are handled further down.
+ return objects_done;
+ }
}
else {
COLLADAFW::InstanceGeometryPointerArray &geom = node->getInstanceGeometries();
@@ -541,13 +564,13 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, COLLA
if ( (geom_done + camera_done + lamp_done + controller_done + inst_done) < 1) {
//Check if Object is armature, by checking if immediate child is a JOINT node.
if (is_armature(node)) {
- ob = bc_add_object(sce, OB_ARMATURE, NULL);
+ ob = bc_add_object(sce, OB_ARMATURE, name.c_str());
}
else {
ob = bc_add_object(sce, OB_EMPTY, NULL);
}
-
objects_done->push_back(ob);
+
}
// XXX: if there're multiple instances, only one is stored
diff --git a/source/blender/collada/SkinInfo.cpp b/source/blender/collada/SkinInfo.cpp
index 470f663f716..15320a8f221 100644
--- a/source/blender/collada/SkinInfo.cpp
+++ b/source/blender/collada/SkinInfo.cpp
@@ -237,10 +237,9 @@ void SkinInfo::link_armature(bContext *C, Object *ob, std::map<COLLADAFW::Unique
BKE_object_workob_calc_parent(scene, ob, &workob);
invert_m4_m4(ob->parentinv, workob.obmat);
- ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA;
+ DAG_id_tag_update(&obn->id, OB_RECALC_OB | OB_RECALC_DATA);
- DAG_scene_sort(bmain, scene);
- DAG_ids_flush_update(bmain, 0);
+ DAG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
#endif
diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp
index 45db8510cbb..f43878943c1 100644
--- a/source/blender/collada/collada_utils.cpp
+++ b/source/blender/collada/collada_utils.cpp
@@ -85,7 +85,6 @@ int bc_test_parent_loop(Object *par, Object *ob)
int bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space)
{
Object workob;
- Main *bmain = CTX_data_main(C);
Scene *sce = CTX_data_scene(C);
if (!par || bc_test_parent_loop(par, ob))
@@ -113,12 +112,11 @@ int bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space)
BKE_object_workob_calc_parent(sce, ob, &workob);
invert_m4_m4(ob->parentinv, workob.obmat);
- ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA;
- par->recalc |= OB_RECALC_OB;
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA);
+ DAG_id_tag_update(&par->id, OB_RECALC_OB);
/** done once after import
- DAG_scene_sort(bmain, sce);
- DAG_ids_flush_update(bmain, 0);
+ DAG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
*/
@@ -132,7 +130,7 @@ Object *bc_add_object(Scene *scene, int type, const char *name)
ob->data = BKE_object_obdata_add_from_type(type);
ob->lay = scene->lay;
- ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
BKE_scene_base_select(scene, BKE_scene_base_add(scene, ob));
@@ -367,4 +365,4 @@ void bc_match_scale(std::vector<Object *> *objects_done,
BKE_object_apply_mat4(ob, ob->obmat, 0, 0);
}
-} \ No newline at end of file
+}
diff --git a/source/blender/compositor/intern/COM_CompositorContext.h b/source/blender/compositor/intern/COM_CompositorContext.h
index 2f5e8c0648d..840a9e59584 100644
--- a/source/blender/compositor/intern/COM_CompositorContext.h
+++ b/source/blender/compositor/intern/COM_CompositorContext.h
@@ -74,7 +74,7 @@ private:
* @brief does this system have active opencl devices?
*/
bool m_hasActiveOpenCLDevices;
-
+
/**
* @brief Skip slow nodes
*/
@@ -178,6 +178,7 @@ public:
void setFastCalculation(bool fastCalculation) {this->m_fastCalculation = fastCalculation;}
bool isFastCalculation() {return this->m_fastCalculation;}
+ inline bool isGroupnodeBufferEnabled() {return this->getbNodeTree()->flag & NTREE_COM_GROUPNODE_BUFFER;}
};
diff --git a/source/blender/compositor/nodes/COM_GroupNode.cpp b/source/blender/compositor/nodes/COM_GroupNode.cpp
index 4cef337d994..05c749345d5 100644
--- a/source/blender/compositor/nodes/COM_GroupNode.cpp
+++ b/source/blender/compositor/nodes/COM_GroupNode.cpp
@@ -64,11 +64,12 @@ void GroupNode::ungroup(ExecutionSystem &system)
}
}
+ const bool groupnodeBuffering = system.getContext().isGroupnodeBufferEnabled();
for (index = 0; index < outputsockets.size(); index++) {
OutputSocket *outputSocket = outputsockets[index];
bNodeSocket *editorOutput = outputSocket->getbNodeSocket();
if (editorOutput->groupsock) {
- SocketProxyNode *proxy = new SocketProxyNode(bnode, editorOutput->groupsock, editorOutput, true);
+ SocketProxyNode *proxy = new SocketProxyNode(bnode, editorOutput->groupsock, editorOutput, groupnodeBuffering);
outputSocket->relinkConnections(proxy->getOutputSocket(0));
ExecutionSystemHelper::addNode(system.getNodes(), proxy);
}
diff --git a/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp b/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp
index 68a61dff801..863a404ba67 100644
--- a/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp
+++ b/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp
@@ -75,9 +75,31 @@ void MovieDistortionOperation::initExecution()
calibration_width, calibration_height, this->m_distortion);
s_cache.push_back(newC);
this->m_cache = newC;
+
+ if (this->m_distortion) {
+ float delta[2];
+ rcti full_frame;
+ full_frame.xmin = full_frame.ymin = 0;
+ full_frame.xmax = this->m_width;
+ full_frame.ymax = this->m_height;
+ BKE_tracking_max_undistortion_delta_across_bound(&this->m_movieClip->tracking, &full_frame, delta);
+
+ /* 5 is just in case we didn't hit real max of distortion in
+ * BKE_tracking_max_undistortion_delta_across_bound
+ */
+ m_margin[0] = delta[0] + 5;
+ m_margin[1] = delta[1] + 5;
+ }
+ else {
+ /* undistortion with sane distortion coefficients would be mapped inside
+ * of each tile, should be no need in margin in this case
+ */
+ m_margin[0] = m_margin[1] = 0;
+ }
}
else {
this->m_cache = NULL;
+ m_margin[0] = m_margin[1] = 0;
}
}
@@ -112,3 +134,13 @@ void MovieDistortionOperation::executePixel(float output[4], float x, float y, P
this->m_inputOperation->read(output, x, y, COM_PS_BILINEAR);
}
}
+
+bool MovieDistortionOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
+{
+ rcti newInput;
+ newInput.xmin = input->xmin - m_margin[0];
+ newInput.ymin = input->ymin - m_margin[1];
+ newInput.xmax = input->xmax + m_margin[0];
+ newInput.ymax = input->ymax + m_margin[1];
+ return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
+}
diff --git a/source/blender/compositor/operations/COM_MovieDistortionOperation.h b/source/blender/compositor/operations/COM_MovieDistortionOperation.h
index 9f8aa065e3e..c9629451992 100644
--- a/source/blender/compositor/operations/COM_MovieDistortionOperation.h
+++ b/source/blender/compositor/operations/COM_MovieDistortionOperation.h
@@ -148,6 +148,7 @@ private:
DistortionCache *m_cache;
SocketReader *m_inputOperation;
MovieClip *m_movieClip;
+ int m_margin[2];
protected:
bool m_distortion;
@@ -162,6 +163,8 @@ public:
void setMovieClip(MovieClip *clip) { this->m_movieClip = clip; }
void setFramenumber(int framenumber) { this->m_framenumber = framenumber; }
+ bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
+
};
void deintializeDistortionCache(void);
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 7362935b4cc..bc7b62df185 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -3021,8 +3021,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
else
offset = 0;
- /* calculate appropriate y-coordinates for icon buttons
- */
+ /* calculate appropriate y-coordinates for icon buttons */
y = (ymaxc - yminc) / 2 + yminc;
ymid = y - 0.5f * ICON_WIDTH;
/* y-coordinates for text is only 4 down from middle */
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index 275cf723dcd..15a8222dec2 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -1159,6 +1159,218 @@ static void ANIM_OT_channels_move(wmOperatorType *ot)
ot->prop = RNA_def_enum(ot->srna, "direction", prop_animchannel_rearrange_types, REARRANGE_ANIMCHAN_DOWN, "Direction", "");
}
+/* ******************** Group Channel Operator ************************ */
+
+static int animchannels_grouping_poll(bContext *C)
+{
+ ScrArea *sa = CTX_wm_area(C);
+ SpaceLink *sl;
+
+ /* channels region test */
+ /* TODO: could enhance with actually testing if channels region? */
+ if (ELEM(NULL, sa, CTX_wm_region(C)))
+ return 0;
+
+ /* animation editor test - must be suitable modes only */
+ sl = CTX_wm_space_data(C);
+
+ switch (sa->spacetype) {
+ /* supported... */
+ case SPACE_ACTION:
+ {
+ SpaceAction *saction = (SpaceAction *)sl;
+
+ /* dopesheet and action only - all others are for other datatypes or have no groups */
+ if (ELEM(saction->mode, SACTCONT_ACTION, SACTCONT_DOPESHEET) == 0)
+ return 0;
+ }
+ break;
+
+ case SPACE_IPO:
+ {
+ SpaceIpo *sipo = (SpaceIpo *)sl;
+
+ /* drivers can't have groups... */
+ if (sipo->mode != SIPO_MODE_ANIMATION)
+ return 0;
+ }
+ break;
+
+ /* unsupported... */
+ default:
+ return 0;
+ }
+
+ return 1;
+}
+
+/* ----------------------------------------------------------- */
+
+static void animchannels_group_channels(bAnimContext *ac, bAnimListElem *adt_ref, const char name[])
+{
+ AnimData *adt = adt_ref->adt;
+ bAction *act = adt->action;
+
+ if (act) {
+ ListBase anim_data = {NULL, NULL};
+ int filter;
+
+ /* find selected F-Curves to re-group */
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL);
+ ANIM_animdata_filter(ac, &anim_data, filter, adt_ref, ANIMCONT_CHANNEL);
+
+ if (anim_data.first) {
+ bActionGroup *agrp;
+ bAnimListElem *ale;
+
+ /* create new group, which should now be part of the action */
+ agrp = action_groups_add_new(act, name);
+ BLI_assert(agrp != NULL);
+
+ /* transfer selected F-Curves across to new group */
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ FCurve *fcu = (FCurve *)ale->data;
+ bActionGroup *grp = fcu->grp;
+
+ /* remove F-Curve from group, then group too if it is now empty */
+ action_groups_remove_channel(act, fcu);
+
+ if ((grp) && (grp->channels.first == NULL)) {
+ BLI_freelinkN(&act->groups, grp);
+ }
+
+ /* add F-Curve to group */
+ action_groups_add_channel(act, agrp, fcu);
+ }
+ }
+
+ /* cleanup */
+ BLI_freelistN(&anim_data);
+ }
+}
+
+static int animchannels_group_exec(bContext *C, wmOperator *op)
+{
+ bAnimContext ac;
+ char name[MAX_NAME];
+
+ /* get editor data */
+ if (ANIM_animdata_get_context(C, &ac) == 0)
+ return OPERATOR_CANCELLED;
+
+ /* get name for new group */
+ RNA_string_get(op->ptr, "name", name);
+
+ /* XXX: name for group should never be empty... */
+ if (name[0]) {
+ ListBase anim_data = {NULL, NULL};
+ bAnimListElem *ale;
+ int filter;
+
+ /* handle each animdata block separately, so that the regrouping doesn't flow into blocks */
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_ANIMDATA | ANIMFILTER_NODUPLIS);
+ ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
+
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ animchannels_group_channels(&ac, ale, name);
+ }
+
+ /* free temp data */
+ BLI_freelistN(&anim_data);
+
+ /* updatss */
+ WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+ }
+
+ return OPERATOR_FINISHED;
+}
+
+static void ANIM_OT_channels_group(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Group Channels";
+ ot->idname = "ANIM_OT_channels_group";
+ ot->description = "Add selected F-Curves to a new group";
+
+ /* callbacks */
+ ot->invoke = WM_operator_props_popup;
+ ot->exec = animchannels_group_exec;
+ ot->poll = animchannels_grouping_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* props */
+ 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... */
+}
+
+/* ----------------------------------------------------------- */
+
+static int animchannels_ungroup_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ bAnimContext ac;
+
+ ListBase anim_data = {NULL, NULL};
+ bAnimListElem *ale;
+ int filter;
+
+ /* get editor data */
+ if (ANIM_animdata_get_context(C, &ac) == 0)
+ return OPERATOR_CANCELLED;
+
+ /* just selected F-Curves... */
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_NODUPLIS);
+ ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
+
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ /* find action for this F-Curve... */
+ if (ale->adt && ale->adt->action) {
+ FCurve *fcu = (FCurve *)ale->data;
+ bAction *act = ale->adt->action;
+
+ /* only proceed to remove if F-Curve is in a group... */
+ if (fcu->grp) {
+ bActionGroup *agrp = fcu->grp;
+
+ /* remove F-Curve from group and add at tail (ungrouped) */
+ action_groups_remove_channel(act, fcu);
+ BLI_addtail(&act->curves, fcu);
+
+ /* delete group if it is now empty */
+ if (agrp->channels.first == NULL) {
+ BLI_freelinkN(&act->groups, agrp);
+ }
+ }
+ }
+ }
+
+ /* cleanup */
+ BLI_freelistN(&anim_data);
+
+ /* updates */
+ WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ return OPERATOR_FINISHED;
+}
+
+static void ANIM_OT_channels_ungroup(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Ungroup Channels";
+ ot->idname = "ANIM_OT_channels_ungroup";
+ ot->description = "Remove selected F-Curves from their current groups";
+
+ /* callbacks */
+ ot->exec = animchannels_ungroup_exec;
+ ot->poll = animchannels_grouping_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
/* ******************** Delete Channel Operator *********************** */
static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op))
@@ -1245,13 +1457,13 @@ static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op))
BLI_freelinkN(&gpd->layers, gpl);
}
break;
-
+
case ANIMTYPE_MASKLAYER:
{
/* Mask layer */
Mask *mask = (Mask *)ale->id;
MaskLayer *masklay = (MaskLayer *)ale->data;
-
+
/* try to delete the layer's data and the layer itself */
BKE_mask_layer_remove(mask, masklay);
}
@@ -1342,10 +1554,10 @@ static int animchannels_visibility_set_exec(bContext *C, wmOperator *UNUSED(op))
/* TODO: find out why this is the case, and fix that */
if (ale->type == ANIMTYPE_OBJECT)
continue;
-
+
/* enable the setting */
ANIM_channel_setting_set(&ac, ale, ACHANNEL_SETTING_VISIBLE, ACHANNEL_SETFLAG_ADD);
-
+
/* now, also flush selection status up/down as appropriate */
ANIM_flush_setting_anim_channels(&ac, &all_data, ale, ACHANNEL_SETTING_VISIBLE, 1);
}
@@ -1419,10 +1631,10 @@ static int animchannels_visibility_toggle_exec(bContext *C, wmOperator *UNUSED(o
/* TODO: find out why this is the case, and fix that */
if (ale->type == ANIMTYPE_OBJECT)
continue;
-
+
/* change the setting */
ANIM_channel_setting_set(&ac, ale, ACHANNEL_SETTING_VISIBLE, vis);
-
+
/* now, also flush selection status up/down as appropriate */
ANIM_flush_setting_anim_channels(&ac, &all_data, ale, ACHANNEL_SETTING_VISIBLE, (vis == ACHANNEL_SETFLAG_ADD));
}
@@ -2243,7 +2455,7 @@ static int mouse_anim_channels(bAnimContext *ac, float UNUSED(x), int channel_in
}
notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
- }
+ }
break;
case ANIMTYPE_GROUP:
@@ -2495,6 +2707,9 @@ void ED_operatortypes_animchannels(void)
WM_operatortype_append(ANIM_OT_channels_visibility_set);
WM_operatortype_append(ANIM_OT_channels_fcurves_enable);
+
+ WM_operatortype_append(ANIM_OT_channels_group);
+ WM_operatortype_append(ANIM_OT_channels_ungroup);
}
// TODO: check on a poll callback for this, to get hotkeys into menus
@@ -2548,6 +2763,10 @@ void ED_keymap_animchannels(wmKeyConfig *keyconf)
RNA_enum_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_move", PAGEUPKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "direction", REARRANGE_ANIMCHAN_TOP);
RNA_enum_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_move", PAGEDOWNKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "direction", REARRANGE_ANIMCHAN_BOTTOM);
+ /* grouping */
+ WM_keymap_add_item(keymap, "ANIM_OT_channels_group", GKEY, KM_PRESS, KM_CTRL, 0);
+ WM_keymap_add_item(keymap, "ANIM_OT_channels_ungroup", GKEY, KM_PRESS, KM_ALT, 0);
+
/* Graph Editor only */
WM_keymap_add_item(keymap, "ANIM_OT_channels_visibility_set", VKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "ANIM_OT_channels_visibility_toggle", VKEY, KM_PRESS, KM_SHIFT, 0);
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index d83d1805f0e..eb1f5ef1043 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -399,20 +399,23 @@ float ANIM_unit_mapping_get_factor(Scene *scene, ID *id, FCurve *fcu, short rest
static short bezt_unit_mapping_apply(KeyframeEditData *ked, BezTriple *bezt)
{
/* mapping factor is stored in f1, flags are stored in i1 */
- short only_keys = (ked->i1 & ANIM_UNITCONV_ONLYKEYS);
- short sel_vs = (ked->i1 & ANIM_UNITCONV_SELVERTS);
+ const bool only_keys = (ked->i1 & ANIM_UNITCONV_ONLYKEYS);
+ const bool sel_vs = (ked->i1 & ANIM_UNITCONV_SELVERTS);
+ const bool skip_knot = (ked->i1 & ANIM_UNITCONV_SKIPKNOTS);
float fac = ked->f1;
/* adjust BezTriple handles only if allowed to */
- if (only_keys == 0) {
- if ((sel_vs == 0) || (bezt->f1 & SELECT))
+ if (only_keys == false) {
+ if ((sel_vs == false) || (bezt->f1 & SELECT))
bezt->vec[0][1] *= fac;
- if ((sel_vs == 0) || (bezt->f3 & SELECT))
+ if ((sel_vs == false) || (bezt->f3 & SELECT))
bezt->vec[2][1] *= fac;
}
- if ((sel_vs == 0) || (bezt->f2 & SELECT))
- bezt->vec[1][1] *= fac;
+ if (skip_knot == false) {
+ if ((sel_vs == false) || (bezt->f2 & SELECT))
+ bezt->vec[1][1] *= fac;
+ }
return 0;
}
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 37fd05f75a5..3480db2c5d8 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -2391,6 +2391,10 @@ static size_t animdata_filter_animchan(bAnimContext *ac, ListBase *anim_data, bD
items += animdata_filter_dopesheet_ob(ac, anim_data, ads, channel->data, filter_mode);
break;
+ case ANIMTYPE_ANIMDATA:
+ items += animfilter_block_data(ac, anim_data, ads, channel->id, filter_mode);
+ break;
+
default:
printf("ERROR: Unsupported channel type (%d) in animdata_filter_animchan()\n", channel->type);
break;
diff --git a/source/blender/editors/animation/anim_ipo_utils.c b/source/blender/editors/animation/anim_ipo_utils.c
index d8e3349e998..b6d24e21057 100644
--- a/source/blender/editors/animation/anim_ipo_utils.c
+++ b/source/blender/editors/animation/anim_ipo_utils.c
@@ -143,7 +143,7 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
/* no array index */
arrayname = "";
}
-
+
/* putting this all together into the buffer */
/* XXX we need to check for invalid names...
* XXX the name length limit needs to be passed in or as some define */
@@ -151,7 +151,7 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
BLI_snprintf(name, 256, "%s%s (%s)", arrayname, propname, structname);
else
BLI_snprintf(name, 256, "%s%s", arrayname, propname);
-
+
/* free temp name if nameprop is set */
if (free_structname)
MEM_freeN((void *)structname);
@@ -170,11 +170,11 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
else {
/* invalid path */
BLI_snprintf(name, 256, "\"%s[%d]\"", fcu->rna_path, fcu->array_index);
-
+
/* icon for this should be the icon for the base ID */
/* TODO: or should we just use the error icon? */
icon = RNA_struct_ui_icon(id_ptr.type);
-
+
/* tag F-Curve as disabled - as not usable path */
fcu->flag |= FCURVE_DISABLED;
}
diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c
index 25833c13925..cd5e873f40d 100644
--- a/source/blender/editors/animation/drivers.c
+++ b/source/blender/editors/animation/drivers.c
@@ -489,8 +489,6 @@ static int add_driver_button_exec(bContext *C, wmOperator *op)
/* send updates */
uiContextAnimUpdate(C);
- DAG_ids_flush_update(CTX_data_main(C), 0);
-
WM_event_add_notifier(C, NC_ANIMATION | ND_FCURVES_ORDER, NULL); // XXX
}
@@ -541,8 +539,6 @@ static int remove_driver_button_exec(bContext *C, wmOperator *op)
/* send updates */
uiContextAnimUpdate(C);
- DAG_ids_flush_update(CTX_data_main(C), 0);
-
WM_event_add_notifier(C, NC_ANIMATION | ND_FCURVES_ORDER, NULL); // XXX
}
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index c99f939300e..6d1e6eab26b 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -1215,7 +1215,6 @@ static int modify_key_op_poll(bContext *C)
static int insert_key_exec(bContext *C, wmOperator *op)
{
- Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
KeyingSet *ks = NULL;
int type = RNA_enum_get(op->ptr, "type");
@@ -1261,9 +1260,6 @@ static int insert_key_exec(bContext *C, wmOperator *op)
else
BKE_report(op->reports, RPT_WARNING, "Keying set failed to insert any keyframes");
- /* send updates */
- DAG_ids_flush_update(bmain, 0);
-
return OPERATOR_FINISHED;
}
@@ -1371,7 +1367,6 @@ void ANIM_OT_keyframe_insert_menu(wmOperatorType *ot)
static int delete_key_exec(bContext *C, wmOperator *op)
{
- Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
KeyingSet *ks = NULL;
int type = RNA_enum_get(op->ptr, "type");
@@ -1417,9 +1412,6 @@ static int delete_key_exec(bContext *C, wmOperator *op)
else
BKE_report(op->reports, RPT_WARNING, "Keying set failed to remove any keyframes");
- /* send updates */
- DAG_ids_flush_update(bmain, 0);
-
return OPERATOR_FINISHED;
}
@@ -1459,8 +1451,6 @@ void ANIM_OT_keyframe_delete(wmOperatorType *ot)
static int clear_anim_v3d_exec(bContext *C, wmOperator *UNUSED(op))
{
- Main *bmain = CTX_data_main(C);
-
CTX_DATA_BEGIN (C, Object *, ob, selected_objects)
{
/* just those in active action... */
@@ -1505,12 +1495,11 @@ static int clear_anim_v3d_exec(bContext *C, wmOperator *UNUSED(op))
}
/* update... */
- ob->recalc |= OB_RECALC_OB;
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB);
}
CTX_DATA_END;
/* send updates */
- DAG_ids_flush_update(bmain, 0);
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, NULL);
return OPERATOR_FINISHED;
@@ -1536,7 +1525,6 @@ void ANIM_OT_keyframe_clear_v3d(wmOperatorType *ot)
static int delete_key_v3d_exec(bContext *C, wmOperator *op)
{
- Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
float cfra = (float)CFRA;
@@ -1563,12 +1551,11 @@ static int delete_key_v3d_exec(bContext *C, wmOperator *op)
/* report success (or failure) */
BKE_reportf(op->reports, RPT_INFO, "Object '%s' successfully had %d keyframes removed", id->name + 2, success);
- ob->recalc |= OB_RECALC_OB;
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB);
}
CTX_DATA_END;
/* send updates */
- DAG_ids_flush_update(bmain, 0);
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, NULL);
return OPERATOR_FINISHED;
@@ -1596,7 +1583,6 @@ void ANIM_OT_keyframe_delete_v3d(wmOperatorType *ot)
static int insert_key_button_exec(bContext *C, wmOperator *op)
{
- Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
PointerRNA ptr = {{NULL}};
PropertyRNA *prop = NULL;
@@ -1655,8 +1641,6 @@ static int insert_key_button_exec(bContext *C, wmOperator *op)
/* send updates */
uiContextAnimUpdate(C);
- DAG_ids_flush_update(bmain, 0);
-
/* send notifiers that keyframes have been changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
}
@@ -1686,7 +1670,6 @@ void ANIM_OT_keyframe_insert_button(wmOperatorType *ot)
static int delete_key_button_exec(bContext *C, wmOperator *op)
{
- Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
PointerRNA ptr = {{NULL}};
PropertyRNA *prop = NULL;
@@ -1728,8 +1711,6 @@ static int delete_key_button_exec(bContext *C, wmOperator *op)
/* send updates */
uiContextAnimUpdate(C);
- DAG_ids_flush_update(bmain, 0);
-
/* send notifiers that keyframes have been changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
}
@@ -1760,7 +1741,6 @@ void ANIM_OT_keyframe_delete_button(wmOperatorType *ot)
static int clear_key_button_exec(bContext *C, wmOperator *op)
{
- Main *bmain = CTX_data_main(C);
PointerRNA ptr = {{NULL}};
PropertyRNA *prop = NULL;
char *path;
@@ -1800,8 +1780,6 @@ static int clear_key_button_exec(bContext *C, wmOperator *op)
/* send updates */
uiContextAnimUpdate(C);
- DAG_ids_flush_update(bmain, 0);
-
/* send notifiers that keyframes have been changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
}
diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c
index 28db7bf572d..4e8d7bdafe5 100644
--- a/source/blender/editors/animation/keyingsets.c
+++ b/source/blender/editors/animation/keyingsets.c
@@ -289,7 +289,6 @@ void ANIM_OT_keying_set_path_remove(wmOperatorType *ot)
static int add_keyingset_button_exec(bContext *C, wmOperator *op)
{
- Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
KeyingSet *ks = NULL;
PropertyRNA *prop = NULL;
@@ -360,7 +359,6 @@ static int add_keyingset_button_exec(bContext *C, wmOperator *op)
if (success) {
/* send updates */
- DAG_ids_flush_update(bmain, 0);
WM_event_add_notifier(C, NC_SCENE | ND_KEYINGSET, NULL);
/* show notification/report header, so that users notice that something changed */
@@ -392,7 +390,6 @@ void ANIM_OT_keyingset_button_add(wmOperatorType *ot)
static int remove_keyingset_button_exec(bContext *C, wmOperator *op)
{
- Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
KeyingSet *ks = NULL;
PropertyRNA *prop = NULL;
@@ -442,7 +439,6 @@ static int remove_keyingset_button_exec(bContext *C, wmOperator *op)
if (success) {
/* send updates */
- DAG_ids_flush_update(bmain, 0);
WM_event_add_notifier(C, NC_SCENE | ND_KEYINGSET, NULL);
/* show warning */
@@ -1006,7 +1002,8 @@ int ANIM_apply_keyingset(bContext *C, ListBase *dsources, bAction *act, KeyingSe
{
Object *ob = (Object *)ksp->id;
- ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME; // XXX: only object transforms only?
+ // XXX: only object transforms?
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
}
break;
}
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index 06e00cd02c1..2eac6ba87ee 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -1004,7 +1004,7 @@ int join_armature_exec(bContext *C, wmOperator *UNUSED(op))
}
CTX_DATA_END;
- DAG_scene_sort(bmain, scene); /* because we removed object(s) */
+ DAG_relations_tag_update(bmain); /* because we removed object(s) */
ED_armature_from_edit(ob);
ED_armature_edit_free(ob);
@@ -1217,7 +1217,7 @@ static int separate_armature_exec(bContext *C, wmOperator *UNUSED(op))
/* 2) duplicate base */
newbase = ED_object_add_duplicate(bmain, scene, oldbase, USER_DUP_ARM); /* only duplicate linked armature */
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
newob = newbase->object;
newbase->flag &= ~SELECT;
diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c
index 38924105316..c7d1e428355 100644
--- a/source/blender/editors/armature/poseobject.c
+++ b/source/blender/editors/armature/poseobject.c
@@ -238,7 +238,7 @@ static int pose_calculate_paths_invoke(bContext *C, wmOperator *op, wmEvent *UNU
/* show popup dialog to allow editing of range... */
// FIXME: hardcoded dimensions here are just arbitrary
- return WM_operator_props_dialog_popup(C, op, 200, 200);
+ return WM_operator_props_dialog_popup(C, op, 10 * UI_UNIT_X, 10 * UI_UNIT_Y);
}
/* For the object with pose/action: create path curves for selected bones
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index a67bf00a559..b5aa55dbda9 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -1395,7 +1395,7 @@ static int separate_exec(bContext *C, wmOperator *op)
/* 1. duplicate the object and data */
newbase = ED_object_add_duplicate(bmain, scene, oldbase, 0); /* 0 = fully linked */
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
ED_base_object_select(newbase, BA_DESELECT);
newob = newbase->object;
@@ -2034,11 +2034,12 @@ static int switch_direction_exec(bContext *C, wmOperator *UNUSED(op))
EditNurb *editnurb = cu->editnurb;
Nurb *nu;
- for (nu = editnurb->nurbs.first; nu; nu = nu->next)
+ for (nu = editnurb->nurbs.first; nu; nu = nu->next) {
if (isNurbsel(nu)) {
BKE_nurb_direction_switch(nu);
keyData_switchDirectionNurb(cu, nu);
}
+ }
if (ED_curve_updateAnimPaths(obedit->data))
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit);
@@ -2481,10 +2482,11 @@ static void select_adjacent_cp(ListBase *editnurb, short next, short cont, short
/**************** select start/end operators **************/
-/* (de)selects first or last of visible part of each Nurb depending on selFirst */
-/* selFirst: defines the end of which to select */
-/* doswap: defines if selection state of each first/last control point is swapped */
-/* selstatus: selection status in case doswap is false */
+/* (de)selects first or last of visible part of each Nurb depending on selFirst
+ * selFirst: defines the end of which to select
+ * doswap: defines if selection state of each first/last control point is swapped
+ * selstatus: selection status in case doswap is false
+ */
void selectend_nurb(Object *obedit, short selfirst, short doswap, short selstatus)
{
ListBase *editnurb = object_editcurve_get(obedit);
@@ -2558,7 +2560,7 @@ void CURVE_OT_de_select_first(wmOperatorType *ot)
/* identifiers */
ot->name = "(De)select First";
ot->idname = "CURVE_OT_de_select_first";
- ot->description = "(De)select first of visible part of each Nurb";
+ ot->description = "(De)select first of visible part of each NURBS";
/* api cfirstbacks */
ot->exec = de_select_first_exec;
@@ -2583,7 +2585,7 @@ void CURVE_OT_de_select_last(wmOperatorType *ot)
/* identifiers */
ot->name = "(De)select Last";
ot->idname = "CURVE_OT_de_select_last";
- ot->description = "(De)select last of visible part of each Nurb";
+ ot->description = "(De)select last of visible part of each NURBS";
/* api clastbacks */
ot->exec = de_select_last_exec;
@@ -6216,7 +6218,7 @@ int join_curve_exec(bContext *C, wmOperator *UNUSED(op))
cu = ob->data;
BLI_movelisttolist(&cu->nurb, &tempbase);
- DAG_scene_sort(bmain, scene); // because we removed object(s), call before editmode!
+ DAG_relations_tag_update(bmain); // because we removed object(s), call before editmode!
ED_object_enter_editmode(C, EM_WAITCURSOR);
ED_object_exit_editmode(C, EM_FREEDATA | EM_WAITCURSOR | EM_DO_UNDO);
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index 257dfca051f..af6b90a9958 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -1070,21 +1070,13 @@ void FONT_OT_change_character(wmOperatorType *ot)
/******************* line break operator ********************/
-static int line_break_exec(bContext *C, wmOperator *op)
+static int line_break_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
Object *obedit = CTX_data_edit_object(C);
Curve *cu = obedit->data;
- EditFont *ef = cu->editfont;
- const int ctrl = RNA_boolean_get(op->ptr, "ctrl");
- if (ctrl) {
- insert_into_textbuf(obedit, 1);
- if (ef->textbuf[cu->pos] != '\n')
- insert_into_textbuf(obedit, '\n');
- }
- else
- insert_into_textbuf(obedit, '\n');
+ insert_into_textbuf(obedit, '\n');
cu->selstart = cu->selend = 0;
@@ -1106,9 +1098,6 @@ void FONT_OT_line_break(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
- /* properties */
- RNA_def_boolean(ot->srna, "ctrl", 0, "Ctrl", ""); // XXX what is this?
}
/******************* delete operator **********************/
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 41ef4bd0b95..8cd2bd861bc 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -39,6 +39,8 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "PIL_time.h"
#include "BKE_gpencil.h"
@@ -1457,28 +1459,27 @@ static void gpencil_draw_status_indicators(tGPsdata *p)
case GP_STATUS_PAINTING:
/* only print this for paint-sessions, otherwise it gets annoying */
if (GPENCIL_SKETCH_SESSIONS_ON(p->scene))
- ED_area_headerprint(p->sa, "Grease Pencil: Drawing/erasing stroke... Release to end stroke");
+ ED_area_headerprint(p->sa, IFACE_("Grease Pencil: Drawing/erasing stroke... Release to end stroke"));
break;
case GP_STATUS_IDLING:
/* print status info */
switch (p->paintmode) {
case GP_PAINTMODE_ERASER:
- ED_area_headerprint(p->sa,
- "Grease Pencil Erase Session: Hold and drag LMB or RMB to erase |"
- " ESC/Enter to end");
+ ED_area_headerprint(p->sa, IFACE_("Grease Pencil Erase Session: Hold and drag LMB or RMB to erase |"
+ " ESC/Enter to end"));
break;
case GP_PAINTMODE_DRAW_STRAIGHT:
- ED_area_headerprint(p->sa, "Grease Pencil Line Session: Hold and drag LMB to draw | "
- "ESC/Enter to end");
+ ED_area_headerprint(p->sa, IFACE_("Grease Pencil Line Session: Hold and drag LMB to draw | "
+ "ESC/Enter to end"));
break;
case GP_PAINTMODE_DRAW:
- ED_area_headerprint(p->sa, "Grease Pencil Freehand Session: Hold and drag LMB to draw | "
- "ESC/Enter to end");
+ ED_area_headerprint(p->sa, IFACE_("Grease Pencil Freehand Session: Hold and drag LMB to draw | "
+ "ESC/Enter to end"));
break;
default: /* unhandled future cases */
- ED_area_headerprint(p->sa, "Grease Pencil Session: ESC/Enter to end");
+ ED_area_headerprint(p->sa, IFACE_("Grease Pencil Session: ESC/Enter to end"));
break;
}
break;
diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h
index 7ce25b11f93..414d2075bf6 100644
--- a/source/blender/editors/include/ED_anim_api.h
+++ b/source/blender/editors/include/ED_anim_api.h
@@ -558,7 +558,8 @@ typedef enum eAnimUnitConv_Flags {
/* only touch selected BezTriples */
ANIM_UNITCONV_ONLYSEL = (1 << 2),
/* only touch selected vertices */
- ANIM_UNITCONV_SELVERTS = (1 << 3)
+ ANIM_UNITCONV_SELVERTS = (1 << 3),
+ ANIM_UNITCONV_SKIPKNOTS = (1 << 4),
} eAnimUnitConv_Flags;
/* Get unit conversion factor for given ID + F-Curve */
diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h
index e212f2cc17d..2c43f6e4f25 100644
--- a/source/blender/editors/include/ED_object.h
+++ b/source/blender/editors/include/ED_object.h
@@ -161,7 +161,7 @@ void object_test_constraints(struct Object *ob);
void ED_object_constraint_set_active(struct Object *ob, struct bConstraint *con);
void ED_object_constraint_update(struct Object *ob);
-void ED_object_constraint_dependency_update(struct Main *bmain, struct Scene *scene, struct Object *ob);
+void ED_object_constraint_dependency_update(struct Main *bmain, struct Object *ob);
/* object_lattice.c */
int mouse_lattice(struct bContext *C, const int mval[2], int extend, int deselect, int toggle);
@@ -179,9 +179,9 @@ enum {
struct ModifierData *ED_object_modifier_add(struct ReportList *reports, struct Main *bmain, struct Scene *scene,
struct Object *ob, const char *name, int type);
-int ED_object_modifier_remove(struct ReportList *reports, struct Main *bmain, struct Scene *scene,
+int ED_object_modifier_remove(struct ReportList *reports, struct Main *bmain,
struct Object *ob, struct ModifierData *md);
-void ED_object_modifier_clear(struct Main *bmain, struct Scene *scene, struct Object *ob);
+void ED_object_modifier_clear(struct Main *bmain, struct Object *ob);
int ED_object_modifier_move_down(struct ReportList *reports, struct Object *ob, struct ModifierData *md);
int ED_object_modifier_move_up(struct ReportList *reports, struct Object *ob, struct ModifierData *md);
int ED_object_modifier_convert(struct ReportList *reports, struct Main *bmain, struct Scene *scene,
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index ac2c47216a6..46f4515e0ca 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -85,7 +85,7 @@ typedef struct ViewDepths {
} ViewDepths;
float *give_cursor(struct Scene *scene, struct View3D *v3d);
-void ED_view3d_cursor3d_position(struct bContext *C, float *fp, int mx, int my);
+void ED_view3d_cursor3d_position(struct bContext *C, float fp[3], const int mval[2]);
void ED_view3d_to_m4(float mat[4][4], const float ofs[3], const float quat[4], const float dist);
void ED_view3d_from_m4(float mat[4][4], float ofs[3], float quat[4], float *dist);
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 434fb58184f..78689c078c6 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -361,7 +361,7 @@ void uiPupMenuInvoke(struct bContext *C, const char *idname); /* popup registere
* but allow using all button types and creating an own layout. */
typedef uiBlock * (*uiBlockCreateFunc)(struct bContext *C, struct ARegion *ar, void *arg1);
-typedef void (*uiBlockCancelFunc)(void *arg1);
+typedef void (*uiBlockCancelFunc)(struct bContext *C, void *arg1);
void uiPupBlock(struct bContext *C, uiBlockCreateFunc func, void *arg);
void uiPupBlockO(struct bContext *C, uiBlockCreateFunc func, void *arg, const char *opname, int opcontext);
@@ -437,6 +437,7 @@ void uiButSetDragValue(uiBut *but);
void uiButSetDragImage(uiBut *but, const char *path, int icon, struct ImBuf *ima, float scale);
int UI_but_active_drop_name(struct bContext *C);
+struct uiBut *ui_but_find_mouse_over(struct ARegion *ar, int x, int y);
void uiButSetFlag(uiBut *but, int flag);
void uiButClearFlag(uiBut *but, int flag);
@@ -447,6 +448,8 @@ void uiButClearDrawFlag(uiBut *but, int flag);
/* special button case, only draw it when used actively, for outliner etc */
int uiButActiveOnly(const struct bContext *C, uiBlock *block, uiBut *but);
+void uiButExecute(const struct bContext *C, uiBut *but);
+
/* Buttons
*
@@ -832,6 +835,8 @@ void uiTemplateTextureImage(uiLayout *layout, struct bContext *C, struct Tex *te
void uiTemplateReportsBanner(uiLayout *layout, struct bContext *C);
void uiTemplateKeymapItemProperties(uiLayout *layout, struct PointerRNA *ptr);
+/* Default UIList class name, keep in sync with its declaration in bl_ui/__init__.py */
+#define UI_UL_DEFAULT_CLASS_NAME "UI_UL_list"
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, int rows, int maxrows, int layout_type);
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index df07e05ec06..450d97eb20e 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -155,6 +155,7 @@ enum {
TH_CONSOLE_INFO,
TH_CONSOLE_ERROR,
TH_CONSOLE_CURSOR,
+ TH_CONSOLE_SELECT,
TH_SEQ_MOVIE,
TH_SEQ_MOVIECLIP,
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index d245349f2c4..37249896e34 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -636,7 +636,7 @@ static int ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBut
/* move button over from oldblock to new block */
BLI_remlink(&oldblock->buttons, oldbut);
- BLI_insertlink(&block->buttons, but, oldbut);
+ BLI_insertlinkafter(&block->buttons, but, oldbut);
oldbut->block = block;
*butpp = oldbut;
@@ -713,6 +713,12 @@ int uiButActiveOnly(const bContext *C, uiBlock *block, uiBut *but)
return 1;
}
+/* simulate button click */
+void uiButExecute(const bContext *C, uiBut *but)
+{
+ ui_button_execute_do((bContext *)C, CTX_wm_region(C), but);
+}
+
/* use to check if we need to disable undo, but don't make any changes
* returns FALSE if undo needs to be disabled. */
static int ui_but_is_rna_undo(uiBut *but)
@@ -1394,6 +1400,18 @@ int ui_is_but_float(uiBut *but)
return 0;
}
+int ui_is_but_bool(uiBut *but)
+{
+ if (ELEM5(but->type, TOG, TOGN, TOGR, ICONTOG, ICONTOGN))
+ return 1;
+
+ if (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_BOOLEAN)
+ return 1;
+
+ return 0;
+}
+
+
int ui_is_but_unit(uiBut *but)
{
UnitSettings *unit = but->block->unit;
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index b166e532f84..5cff61f4239 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -85,6 +85,7 @@
/* proto */
static void ui_add_smart_controller(bContext *C, uiBut *from, uiBut *to);
static void ui_add_link(bContext *C, uiBut *from, uiBut *to);
+static int ui_do_but_EXIT(bContext *C, uiBut *but, struct uiHandleButtonData *data, const wmEvent *event);
/***************** structs and defines ****************/
@@ -761,14 +762,27 @@ static int ui_but_start_drag(bContext *C, uiBut *but, uiHandleButtonData *data,
WM_gestures_remove(C);
if (ABS(data->dragstartx - event->x) + ABS(data->dragstarty - event->y) > U.dragthreshold) {
- wmDrag *drag;
-
+
button_activate_state(C, but, BUTTON_STATE_EXIT);
data->cancel = TRUE;
- drag = WM_event_start_drag(C, but->icon, but->dragtype, but->dragpoin, ui_get_but_val(but));
- if (but->imb)
- WM_event_drag_image(drag, but->imb, but->imb_scale, BLI_rctf_size_x(&but->rect), BLI_rctf_size_y(&but->rect));
+ if (ui_is_but_bool(but)) {
+ const bool is_set = (ui_get_but_val(but) != 0.0);
+ PointerRNA ptr;
+ WM_operator_properties_create(&ptr, "UI_OT_drag_toggle");
+ RNA_boolean_set(&ptr, "state", !is_set);
+ RNA_int_set(&ptr, "last_x", data->dragstartx);
+ RNA_int_set(&ptr, "last_y", data->dragstarty);
+ WM_operator_name_call(C, "UI_OT_drag_toggle", WM_OP_INVOKE_DEFAULT, &ptr);
+ WM_operator_properties_free(&ptr);
+ }
+ else {
+ wmDrag *drag;
+
+ drag = WM_event_start_drag(C, but->icon, but->dragtype, but->dragpoin, ui_get_but_val(but));
+ if (but->imb)
+ WM_event_drag_image(drag, but->imb, but->imb_scale, BLI_rctf_size_x(&but->rect), BLI_rctf_size_y(&but->rect));
+ }
return 1;
}
@@ -2472,13 +2486,24 @@ static int ui_do_but_SEARCH_UNLINK(bContext *C, uiBlock *block, uiBut *but, uiHa
static int ui_do_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
{
if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (event->type == LEFTMOUSE && event->val == KM_PRESS && ui_is_but_bool(but)) {
+ button_activate_state(C, but, BUTTON_STATE_WAIT_DRAG);
+ data->dragstartx = event->x;
+ data->dragstarty = event->y;
+ return WM_UI_HANDLER_CONTINUE;
+ }
+
if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) {
data->togdual = event->ctrl;
data->togonly = !event->shift;
button_activate_state(C, but, BUTTON_STATE_EXIT);
- return WM_UI_HANDLER_BREAK;
+ return WM_UI_HANDLER_CONTINUE;
}
}
+ 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 */
+ return ui_do_but_EXIT(C, but, data, event);
+ }
return WM_UI_HANDLER_CONTINUE;
}
@@ -2499,6 +2524,12 @@ static int ui_do_but_EXIT(bContext *C, uiBut *but, uiHandleButtonData *data, con
return WM_UI_HANDLER_CONTINUE;
}
}
+ if (event->type == LEFTMOUSE && ui_is_but_bool(but)) {
+ button_activate_state(C, but, BUTTON_STATE_WAIT_DRAG);
+ data->dragstartx = event->x;
+ data->dragstarty = event->y;
+ return WM_UI_HANDLER_CONTINUE;
+ }
if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) {
int ret = WM_UI_HANDLER_BREAK;
@@ -3215,6 +3246,12 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, co
return WM_UI_HANDLER_BREAK;
}
}
+ if (event->type == LEFTMOUSE && ui_is_but_bool(but)) {
+ button_activate_state(C, but, BUTTON_STATE_WAIT_DRAG);
+ data->dragstartx = event->x;
+ data->dragstarty = event->y;
+ return WM_UI_HANDLER_BREAK;
+ }
/* regular open menu */
if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) {
@@ -3404,6 +3441,19 @@ static int ui_do_but_NORMAL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
return WM_UI_HANDLER_CONTINUE;
}
+/* scales a vector so no axis exceeds max
+ * (could become BLI_math func) */
+static void clamp_axis_max_v3(float v[3], const float max)
+{
+ const float v_max = max_fff(v[0], v[1], v[2]);
+ if (v_max > max) {
+ mul_v3_fl(v, max / v_max);
+ if (v[0] > max) v[0] = max;
+ if (v[1] > max) v[1] = max;
+ if (v[2] > max) v[2] = max;
+ }
+}
+
static int ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, int mx, int my, const short shift)
{
float rgb[3];
@@ -3480,6 +3530,11 @@ static int ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, int mx,
if (color_profile && ((int)but->a1 != UI_GRAD_SV))
ui_block_to_scene_linear_v3(but->block, rgb);
+ /* clamp because with color conversion we can exceed range [#34295] */
+ if ((int)but->a1 == UI_GRAD_V_ALT) {
+ clamp_axis_max_v3(rgb, but->softmax);
+ }
+
copy_v3_v3(data->vec, rgb);
data->draglastx = mx;
@@ -4198,7 +4253,7 @@ static int ui_numedit_but_HISTOGRAM(uiBut *but, uiHandleButtonData *data, int mx
if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) {
/* resize histogram widget itself */
- hist->height = BLI_rctf_size_y(&but->rect) + (data->dragstarty - my);
+ hist->height = (BLI_rctf_size_y(&but->rect) + (data->dragstarty - my))/UI_DPI_FAC;
}
else {
/* scale histogram values (dy / 10 for better control) */
@@ -4282,7 +4337,7 @@ static int ui_numedit_but_WAVEFORM(uiBut *but, uiHandleButtonData *data, int mx,
if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) {
/* resize waveform widget itself */
- scopes->wavefrm_height = BLI_rctf_size_y(&but->rect) + (data->dragstarty - my);
+ scopes->wavefrm_height = (BLI_rctf_size_y(&but->rect) + (data->dragstarty - my))/UI_DPI_FAC;
}
else {
/* scale waveform values */
@@ -4364,7 +4419,7 @@ static int ui_numedit_but_VECTORSCOPE(uiBut *but, uiHandleButtonData *data, int
if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) {
/* resize vectorscope widget itself */
- scopes->vecscope_height = BLI_rctf_size_y(&but->rect) + (data->dragstarty - my);
+ scopes->vecscope_height = (BLI_rctf_size_y(&but->rect) + (data->dragstarty - my))/UI_DPI_FAC;
}
data->draglastx = mx;
@@ -4567,7 +4622,7 @@ static int ui_numedit_but_TRACKPREVIEW(bContext *C, uiBut *but, uiHandleButtonDa
if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) {
/* resize preview widget itself */
- scopes->track_preview_height = BLI_rctf_size_y(&but->rect) + (data->dragstarty - my);
+ scopes->track_preview_height = (BLI_rctf_size_y(&but->rect) + (data->dragstarty - my))/UI_DPI_FAC;
}
else {
if (!scopes->track_locked) {
@@ -5397,7 +5452,7 @@ static int ui_mouse_inside_button(ARegion *ar, uiBut *but, int x, int y)
return 1;
}
-static uiBut *ui_but_find_mouse_over(ARegion *ar, int x, int y)
+uiBut *ui_but_find_mouse_over(ARegion *ar, int x, int y)
{
uiBlock *block;
uiBut *but, *butover = NULL;
@@ -5711,7 +5766,8 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA
button_activate_state(C, but, BUTTON_STATE_WAIT_FLASH);
}
-static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *but, int mousemove, int onfree)
+static void button_activate_exit(bContext *C, uiBut *but, uiHandleButtonData *data,
+ const bool mousemove, const bool onfree)
{
uiBlock *block = but->block;
uiBut *bt;
@@ -5766,8 +5822,10 @@ static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *b
ED_region_tag_redraw(data->region);
/* clean up button */
- MEM_freeN(but->active);
- but->active = NULL;
+ if (but->active) {
+ MEM_freeN(but->active);
+ but->active = NULL;
+ }
but->flag &= ~(UI_ACTIVE | UI_SELECT);
but->flag |= UI_BUT_LAST_ACTIVE;
if (!onfree)
@@ -5790,7 +5848,7 @@ void ui_button_active_free(const bContext *C, uiBut *but)
if (but->active) {
data = but->active;
data->cancel = TRUE;
- button_activate_exit((bContext *)C, data, but, 0, 1);
+ button_activate_exit((bContext *)C, but, data, false, true);
}
}
@@ -6016,6 +6074,20 @@ void ui_button_activate_do(bContext *C, ARegion *ar, uiBut *but)
ui_do_button(C, but->block, but, &event);
}
+void ui_button_execute_do(struct bContext *C, struct ARegion *ar, uiBut *but)
+{
+ /* note: ideally we would not have to change 'but->active' howevwer
+ * some functions we call don't use data (as they should be doing) */
+ void *active_back = but->active;
+ uiHandleButtonData *data = MEM_callocN(sizeof(uiHandleButtonData), "uiHandleButtonData_Fake");
+ but->active = data;
+ data->region = ar;
+ ui_apply_button(C, but->block, but, data, true);
+ /* use onfree event so undo is handled by caller and apply is already done above */
+ button_activate_exit((bContext *)C, but, data, false, true);
+ but->active = active_back;
+}
+
static void ui_handle_button_activate(bContext *C, ARegion *ar, uiBut *but, uiButtonActivateType type)
{
uiBut *oldbut;
@@ -6025,7 +6097,7 @@ static void ui_handle_button_activate(bContext *C, ARegion *ar, uiBut *but, uiBu
if (oldbut) {
data = oldbut->active;
data->cancel = TRUE;
- button_activate_exit(C, data, oldbut, 0, 0);
+ button_activate_exit(C, oldbut, data, false, false);
}
button_activate_init(C, ar, but, type);
@@ -6197,7 +6269,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
postbut = data->postbut;
posttype = data->posttype;
- button_activate_exit(C, data, but, (postbut == NULL), 0);
+ button_activate_exit(C, but, data, (postbut == NULL), false);
/* for jumping to the next button with tab while text editing */
if (postbut)
@@ -6326,7 +6398,7 @@ static void ui_handle_button_return_submenu(bContext *C, const wmEvent *event, u
if (menu->menuretval != UI_RETURN_OK)
data->cancel = TRUE;
- button_activate_exit(C, data, but, 1, 0);
+ button_activate_exit(C, but, data, true, false);
}
else if (menu->menuretval & UI_RETURN_OUT) {
if (event->type == MOUSEMOVE && ui_mouse_inside_button(data->region, but, event->x, event->y)) {
@@ -6340,7 +6412,7 @@ static void ui_handle_button_return_submenu(bContext *C, const wmEvent *event, u
}
else {
data->cancel = TRUE;
- button_activate_exit(C, data, but, 1, 0);
+ button_activate_exit(C, but, data, true, false);
}
}
}
@@ -7141,7 +7213,7 @@ static int ui_handler_popup(bContext *C, const wmEvent *event, void *userdata)
WM_operator_name_call(C, temp.optype->idname, temp.opcontext, NULL);
}
else if (temp.cancel_func)
- temp.cancel_func(temp.popup_arg);
+ temp.cancel_func(C, temp.popup_arg);
}
else {
/* re-enable tooltips */
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index eb7f09c7b34..f0e59f1f935 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -406,6 +406,7 @@ extern void ui_set_but_soft_range(uiBut *but, double value);
extern void ui_check_but(uiBut *but);
extern int ui_is_but_float(uiBut *but);
+extern int ui_is_but_bool(uiBut *but);
extern int ui_is_but_unit(uiBut *but);
extern int ui_is_but_rna_valid(uiBut *but);
extern int ui_is_but_utf8(uiBut *but);
@@ -429,7 +430,7 @@ struct uiPopupBlockHandle {
int popup;
void (*popup_func)(struct bContext *C, void *arg, int event);
- void (*cancel_func)(void *arg);
+ void (*cancel_func)(struct bContext *C, void *arg);
void *popup_arg;
struct wmTimer *scrolltimer;
@@ -509,6 +510,7 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, struct uiWidgetColors *wc
/* interface_handlers.c */
extern void ui_pan_to_scroll(const struct wmEvent *event, int *type, int *val);
extern void ui_button_activate_do(struct bContext *C, struct ARegion *ar, uiBut *but);
+extern void ui_button_execute_do(struct bContext *C, struct ARegion *ar, uiBut *but);
extern void ui_button_active_free(const struct bContext *C, uiBut *but);
extern int ui_button_is_active(struct ARegion *ar);
extern int ui_button_open_menu_direction(uiBut *but);
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index e03a171da18..d48d699d881 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -1071,6 +1071,222 @@ static void UI_OT_reloadtranslation(wmOperatorType *ot)
ot->exec = reloadtranslation_exec;
}
+
+/* -------------------------------------------------------------------- */
+/* Toggle Drag Operator */
+
+typedef struct DragOpInfo {
+ bool xy_lock[2];
+ float but_cent_start[2];
+ eButType but_type_start;
+} DragOpInfo;
+
+typedef struct DragOpPlotData {
+ bContext *C;
+ ARegion *ar;
+ bool is_set;
+ eButType but_type_start;
+ bool do_draw;
+ const uiBut *but_prev;
+} DragOpPlotData;
+
+static const uiBut *ui_but_set_xy(bContext *C, ARegion *ar, const bool is_set, const eButType but_type_start,
+ const int xy[2], const uiBut *but_prev)
+{
+ uiBut *but = ui_but_find_mouse_over(ar, xy[0], xy[1]);
+
+ if (but_prev == but) {
+ return but_prev;
+ }
+
+ if (but && ui_is_but_bool(but) && but->type == but_type_start) {
+ /* is it pressed? */
+ bool is_set_but = (ui_get_but_val(but) != 0.0);
+ BLI_assert(ui_is_but_bool(but) == true);
+ if (is_set_but != is_set) {
+ uiButExecute(C, but);
+ return but;
+ }
+ }
+
+ return but_prev;
+}
+
+static int ui_but_set_cb(int x, int y, void *data_v)
+{
+ DragOpPlotData *data = data_v;
+ int xy[2] = {x, y};
+ data->but_prev = ui_but_set_xy(data->C, data->ar, data->is_set, data->but_type_start, xy, data->but_prev);
+ return 1; /* keep going */
+}
+
+/* operates on buttons between 2 mouse-points */
+static bool ui_but_set_xy_xy(bContext *C, ARegion *ar, const bool is_set, const eButType but_type_start,
+ const int xy_src[2], const int xy_dst[2])
+{
+ DragOpPlotData data;
+ data.C = C;
+ data.ar = ar;
+ data.is_set = is_set;
+ data.but_type_start = but_type_start;
+ data.do_draw = false;
+ data.but_prev = NULL;
+
+
+ /* prevent dragging too fast loosing buttons */
+ plot_line_v2v2i(xy_src, xy_dst, ui_but_set_cb, &data);
+
+ return data.do_draw;
+}
+
+static void ui_drag_but_set(bContext *C, wmOperator *op, const int xy_input[2])
+{
+ ARegion *ar = CTX_wm_region(C);
+ DragOpInfo *drag_info = op->customdata;
+ bool do_draw = false;
+
+ const bool is_set = RNA_boolean_get(op->ptr, "state");
+ const int xy_last[2] = {RNA_int_get(op->ptr, "last_x"),
+ RNA_int_get(op->ptr, "last_y")};
+
+ int xy[2];
+
+ /**
+ * Initialize Locking:
+ *
+ * Check if we need to initialize the lock axis by finding if the first
+ * button we mouse over is X or Y aligned, then lock the mouse to that axis after.
+ */
+ if (drag_info->xy_lock[0] == false && drag_info->xy_lock[1] == false) {
+ ARegion *ar = CTX_wm_region(C);
+
+ /* first store the buttons original coords */
+ uiBut *but = ui_but_find_mouse_over(ar, xy_input[0], xy_input[1]);
+ if (but) {
+ const float but_cent_new[2] = {BLI_rctf_cent_x(&but->rect),
+ BLI_rctf_cent_y(&but->rect)};
+
+ /* 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]))
+ {
+ drag_info->xy_lock[0] = true;
+ }
+ else {
+ drag_info->xy_lock[1] = true;
+ }
+ }
+ }
+ }
+ /* done with axis locking */
+
+
+ xy[0] = (drag_info->xy_lock[0] == false) ? xy_input[0] : xy_last[0];
+ xy[1] = (drag_info->xy_lock[1] == false) ? xy_input[1] : xy_last[1];
+
+
+ /* touch all buttons between last mouse coord and this one */
+ do_draw = ui_but_set_xy_xy(C, ar, is_set, drag_info->but_type_start, xy_last, xy);
+
+ if (do_draw) {
+ ED_region_tag_redraw(ar);
+ }
+
+ RNA_int_set(op->ptr, "last_x", xy[0]);
+ RNA_int_set(op->ptr, "last_y", xy[1]);
+}
+
+static int ui_drag_toggle_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+ int xy_last[2] = {RNA_int_get(op->ptr, "last_x"),
+ RNA_int_get(op->ptr, "last_y")};
+
+ float but_cent_start[2];
+ eButType but_type_start;
+ DragOpInfo *drag_info;
+
+ {
+ /* find the button where we started dragging */
+ ARegion *ar = CTX_wm_region(C);
+ uiBut *but = ui_but_find_mouse_over(ar, xy_last[0], xy_last[1]);
+ if (but) {
+ but_cent_start[0] = BLI_rctf_cent_x(&but->rect);
+ but_cent_start[1] = BLI_rctf_cent_y(&but->rect);
+ but_type_start = but->type;
+ }
+ else {
+ return OPERATOR_CANCELLED;
+ }
+ }
+
+ drag_info = op->customdata = MEM_callocN(sizeof(DragOpInfo), __func__);
+ copy_v2_v2(drag_info->but_cent_start, but_cent_start);
+ drag_info->but_type_start = but_type_start;
+
+ /* set the initial button */
+ ui_drag_but_set(C, op, xy_last);
+ ui_drag_but_set(C, op, &event->x);
+
+ WM_event_add_modal_handler(C, op);
+ return OPERATOR_RUNNING_MODAL;
+}
+
+static int ui_drag_toggle_modal(bContext *C, wmOperator *op, wmEvent *event)
+{
+ bool done = false;
+
+ switch (event->type) {
+ case LEFTMOUSE:
+ {
+ if (event->val != KM_PRESS) {
+ done = true;
+ }
+ break;
+ }
+ case MOUSEMOVE:
+ {
+ ui_drag_but_set(C, op, &event->x);
+ break;
+ }
+ }
+
+ if (done) {
+ MEM_freeN(op->customdata);
+ return OPERATOR_FINISHED;
+ }
+ else {
+ return OPERATOR_RUNNING_MODAL;
+ }
+}
+
+static int ui_drag_toggle_cancel(bContext *UNUSED(C), wmOperator *op)
+{
+ MEM_freeN(op->customdata);
+ return OPERATOR_CANCELLED;
+}
+
+static void UI_OT_drag_toggle(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Button Drag Toggle";
+ ot->description = "";
+ ot->idname = "UI_OT_drag_toggle";
+
+ /* api callbacks */
+ ot->invoke = ui_drag_toggle_invoke;
+ ot->modal = ui_drag_toggle_modal;
+ ot->cancel = ui_drag_toggle_cancel;
+
+ /* flags */
+ ot->flag = OPTYPE_UNDO | OPTYPE_INTERNAL;
+
+ /* properties */
+ RNA_def_boolean(ot->srna, "state", true, "State", "");
+ RNA_def_int(ot->srna, "last_x", 0, 0, INT_MAX, "X", "", 0, INT_MAX);
+ RNA_def_int(ot->srna, "last_y", 0, 0, INT_MAX, "Y", "", 0, INT_MAX);
+}
+
/* ********************************************************* */
/* Registration */
@@ -1088,5 +1304,6 @@ void UI_buttons_operatortypes(void)
WM_operatortype_append(UI_OT_edittranslation_init);
#endif
WM_operatortype_append(UI_OT_reloadtranslation);
+ WM_operatortype_append(UI_OT_drag_toggle);
}
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 9b2ed9f0984..03c127f33c8 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -2574,7 +2574,7 @@ static void operator_cb(bContext *C, void *arg, int retval)
WM_operator_free(op);
}
-static void confirm_cancel_operator(void *opv)
+static void confirm_cancel_operator(bContext *UNUSED(C), void *opv)
{
WM_operator_free(opv);
}
@@ -2621,7 +2621,7 @@ void uiPupMenuOkee(bContext *C, const char *opname, const char *str, ...)
va_list ap;
char titlestr[256];
- BLI_snprintf(titlestr, sizeof(titlestr), "OK? %%i%d", ICON_QUESTION);
+ BLI_snprintf(titlestr, sizeof(titlestr), IFACE_("OK? %%i%d"), ICON_QUESTION);
va_start(ap, str);
vconfirm_opname(C, opname, titlestr, str, ap);
@@ -2635,7 +2635,7 @@ void uiPupMenuOkee(bContext *C, const char *opname, const char *str, ...)
* The operator state for this is implicitly OPERATOR_RUNNING_MODAL */
void uiPupMenuSaveOver(bContext *C, wmOperator *op, const char *filename)
{
- confirm_operator(C, op, "Save Over?", filename);
+ confirm_operator(C, op, IFACE_("Save Over?"), filename);
}
void uiPupMenuNotice(bContext *C, const char *str, ...)
@@ -2653,7 +2653,7 @@ void uiPupMenuError(bContext *C, const char *str, ...)
char nfmt[256];
char titlestr[256];
- BLI_snprintf(titlestr, sizeof(titlestr), "Error %%i%d", ICON_ERROR);
+ BLI_snprintf(titlestr, sizeof(titlestr), IFACE_("Error %%i%d"), ICON_ERROR);
BLI_strncpy(nfmt, str, sizeof(nfmt));
@@ -2680,13 +2680,13 @@ void uiPupMenuReports(bContext *C, ReportList *reports)
/* pass */
}
else if (report->type >= RPT_ERROR) {
- BLI_dynstr_appendf(ds, "Error %%i%d%%t|%s", ICON_ERROR, report->message);
+ BLI_dynstr_appendf(ds, IFACE_("Error %%i%d%%t|%s"), ICON_ERROR, report->message);
}
else if (report->type >= RPT_WARNING) {
- BLI_dynstr_appendf(ds, "Warning %%i%d%%t|%s", ICON_ERROR, report->message);
+ BLI_dynstr_appendf(ds, IFACE_("Warning %%i%d%%t|%s"), ICON_ERROR, report->message);
}
else if (report->type >= RPT_INFO) {
- BLI_dynstr_appendf(ds, "Info %%i%d%%t|%s", ICON_INFO, report->message);
+ BLI_dynstr_appendf(ds, IFACE_("Info %%i%d%%t|%s"), ICON_INFO, report->message);
}
}
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 5e9a70ea895..900ba7de559 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -551,8 +551,8 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
/* Due to space limit in UI - skip the "open" icon for packed data, and allow to unpack.
Only for images, sound and fonts */
if (id && BKE_pack_check(id)) {
-
- but = uiDefIconButO(block, BUT, "FILE_OT_unpack_item", WM_OP_INVOKE_REGION_WIN, ICON_PACKAGE, 0, 0, UI_UNIT_X, UI_UNIT_Y, "Packed File");
+ but = uiDefIconButO(block, BUT, "FILE_OT_unpack_item", WM_OP_INVOKE_REGION_WIN, ICON_PACKAGE, 0, 0,
+ UI_UNIT_X, UI_UNIT_Y, TIP_("Packed File, click to unpack"));
uiButGetOperatorPtrRNA(but);
RNA_string_set(but->opptr, "id_name", id->name + 2);
@@ -700,7 +700,7 @@ void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, const char *propname, co
uiItemL(row, text, ICON_NONE);
}
else
- uiItemL(row, "ID-Block:", ICON_NONE);
+ uiItemL(row, IFACE_("ID-Block:"), ICON_NONE);
/* ID-Type Selector - just have a menu of icons */
/* FIXME: the icon-only setting doesn't work when we supply a blank name */
@@ -744,7 +744,7 @@ void uiTemplatePathBuilder(uiLayout *layout, PointerRNA *ptr, const char *propna
/************************ Modifier Template *************************/
-#define ERROR_LIBDATA_MESSAGE "Can't edit external libdata"
+#define ERROR_LIBDATA_MESSAGE IFACE_("Can't edit external libdata")
static void modifiers_setOnCage(bContext *C, void *ob_v, void *md_v)
{
@@ -844,8 +844,8 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
block = uiLayoutGetBlock(row);
/* VIRTUAL MODIFIER */
/* XXX this is not used now, since these cannot be accessed via RNA */
- BLI_snprintf(str, sizeof(str), "%s parent deform", md->name);
- uiDefBut(block, LABEL, 0, str, 0, 0, 185, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Modifier name");
+ BLI_snprintf(str, sizeof(str), IFACE_("%s parent deform"), md->name);
+ uiDefBut(block, LABEL, 0, str, 0, 0, 185, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Modifier name"));
but = uiDefBut(block, BUT, 0, IFACE_("Make Real"), 0, 0, 80, 16, NULL, 0.0, 0.0, 0.0, 0.0,
TIP_("Convert virtual modifier to a real modifier"));
@@ -952,18 +952,22 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
if (!(ob->mode & OB_MODE_PARTICLE_EDIT) && psys->pathcache) {
if (ELEM(psys->part->ren_as, PART_DRAW_GR, PART_DRAW_OB))
- uiItemO(row, "Convert", ICON_NONE, "OBJECT_OT_duplicates_make_real");
+ uiItemO(row, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Convert"), ICON_NONE,
+ "OBJECT_OT_duplicates_make_real");
else if (psys->part->ren_as == PART_DRAW_PATH)
- uiItemO(row, "Convert", ICON_NONE, "OBJECT_OT_modifier_convert");
+ uiItemO(row, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Convert"), ICON_NONE,
+ "OBJECT_OT_modifier_convert");
}
}
else {
uiLayoutSetOperatorContext(row, WM_OP_INVOKE_DEFAULT);
- uiItemEnumO(row, "OBJECT_OT_modifier_apply", IFACE_("Apply"), 0, "apply_as", MODIFIER_APPLY_DATA);
+ uiItemEnumO(row, "OBJECT_OT_modifier_apply", CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"),
+ 0, "apply_as", MODIFIER_APPLY_DATA);
if (modifier_isSameTopology(md) && !modifier_isNonGeometrical(md)) {
- uiItemEnumO(row, "OBJECT_OT_modifier_apply", IFACE_("Apply as Shape Key"), 0,
- "apply_as", MODIFIER_APPLY_SHAPE);
+ uiItemEnumO(row, "OBJECT_OT_modifier_apply",
+ CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Apply as Shape Key"),
+ 0, "apply_as", MODIFIER_APPLY_SHAPE);
}
}
@@ -973,7 +977,8 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
if (!ELEM5(md->type, eModifierType_Fluidsim, eModifierType_Softbody, eModifierType_ParticleSystem,
eModifierType_Cloth, eModifierType_Smoke))
{
- uiItemO(row, IFACE_("Copy"), ICON_NONE, "OBJECT_OT_modifier_copy");
+ uiItemO(row, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Copy"), ICON_NONE,
+ "OBJECT_OT_modifier_copy");
}
}
@@ -1052,9 +1057,8 @@ static void do_constraint_panels(bContext *C, void *ob_pt, int event)
case B_CONSTRAINT_CHANGETARGET:
{
Main *bmain = CTX_data_main(C);
- Scene *scene = CTX_data_scene(C);
if (ob->pose) ob->pose->flag |= POSE_RECALC; /* checks & sorts pose channels */
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
break;
}
#endif
@@ -1095,10 +1099,10 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
cti = BKE_constraint_get_typeinfo(con);
if (cti == NULL) {
/* exception for 'Null' constraint - it doesn't have constraint typeinfo! */
- BLI_strncpy(typestr, (con->type == CONSTRAINT_TYPE_NULL) ? "Null" : "Unknown", sizeof(typestr));
+ BLI_strncpy(typestr, (con->type == CONSTRAINT_TYPE_NULL) ? IFACE_("Null") : IFACE_("Unknown"), sizeof(typestr));
}
else
- BLI_strncpy(typestr, cti->name, sizeof(typestr));
+ BLI_strncpy(typestr, IFACE_(cti->name), sizeof(typestr));
/* determine whether constraint is proxy protected or not */
if (BKE_proxylocked_constraints_owner(ob, pchan))
@@ -1203,7 +1207,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
/* Set but-locks for protected settings (magic numbers are used here!) */
if (proxy_protected)
- uiBlockSetButLock(block, 1, "Cannot edit Proxy-Protected Constraint");
+ uiBlockSetButLock(block, 1, IFACE_("Cannot edit Proxy-Protected Constraint"));
/* Draw constraint data */
if ((con->flag & CONSTRAINT_EXPAND) == 0) {
@@ -1487,7 +1491,7 @@ static void colorband_buttons_large(uiLayout *layout, uiBlock *block, ColorBand
RNA_pointer_create(cb->ptr.id.data, &RNA_ColorRampElement, cbd, &ptr);
row = uiLayoutRow(layout, FALSE);
- uiItemR(row, &ptr, "position", 0, "Pos", ICON_NONE);
+ uiItemR(row, &ptr, "position", 0, IFACE_("Pos"), ICON_NONE);
bt = block->buttons.last;
uiButSetFunc(bt, colorband_update_cb, bt, coba);
@@ -1585,7 +1589,8 @@ static uiBlock *icon_view_menu(bContext *C, ARegion *ar, void *arg_litem)
/* arg_litem is malloced, can be freed by parent button */
cb = *((RNAUpdateCb *)arg_litem);
- icon = RNA_property_enum_get(&cb.ptr, cb.prop);
+ /* unused */
+ // icon = RNA_property_enum_get(&cb.ptr, cb.prop);
block = uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW);
@@ -1683,7 +1688,7 @@ void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, const char *propname
hist = (Histogram *)cptr.data;
- hist->height = (hist->height <= UI_UNIT_Y) ? UI_UNIT_Y : hist->height;
+ hist->height = (hist->height <= 20) ? 20 : hist->height;
bt = uiDefBut(block, HISTOGRAM, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), UI_DPI_FAC * hist->height,
hist, 0, 0, 0, 0, "");
@@ -1722,7 +1727,7 @@ void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, const char *propname)
block = uiLayoutAbsoluteBlock(layout);
- scopes->wavefrm_height = (scopes->wavefrm_height <= UI_UNIT_Y) ? UI_UNIT_Y : scopes->wavefrm_height;
+ scopes->wavefrm_height = (scopes->wavefrm_height <= 20) ? 20 : scopes->wavefrm_height;
bt = uiDefBut(block, WAVEFORM, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), UI_DPI_FAC * scopes->wavefrm_height,
scopes, 0, 0, 0, 0, "");
@@ -1760,7 +1765,7 @@ void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, const char *propna
block = uiLayoutAbsoluteBlock(layout);
- scopes->vecscope_height = (scopes->vecscope_height <= UI_UNIT_Y) ? UI_UNIT_Y : scopes->vecscope_height;
+ scopes->vecscope_height = (scopes->vecscope_height <= 20) ? 20 : scopes->vecscope_height;
bt = uiDefBut(block, VECTORSCOPE, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect),
UI_DPI_FAC * scopes->vecscope_height, scopes, 0, 0, 0, 0, "");
@@ -2487,6 +2492,13 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co
int min, max;
/* validate arguments */
+ /* Forbid default UI_UL_DEFAULT_CLASS_NAME list class without a custom list_id! */
+ if (!strcmp(UI_UL_DEFAULT_CLASS_NAME, listtype_name) && !(list_id && list_id[0])) {
+ RNA_warning("template_list using default '%s' UIList class must provide a custom list_id",
+ UI_UL_DEFAULT_CLASS_NAME);
+ return;
+ }
+
block = uiLayoutGetBlock(layout);
if (!active_dataptr->data) {
@@ -3010,7 +3022,7 @@ void uiTemplateColorspaceSettings(uiLayout *layout, PointerRNA *ptr, const char
colorspace_settings_ptr = RNA_property_pointer_get(ptr, prop);
- uiItemL(layout, "Input Color Space:", ICON_NONE);
+ uiItemL(layout, IFACE_("Input Color Space:"), ICON_NONE);
uiItemR(layout, &colorspace_settings_ptr, "name", 0, "", ICON_NONE);
}
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 6735c8b173c..68df8e29957 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -1804,7 +1804,7 @@ static void widget_state_menu_item(uiWidgetType *wt, int state)
}
/* regular disabled */
else if (state & (UI_BUT_DISABLED | UI_BUT_INACTIVE)) {
- widget_state_blend(wt->wcol.text, wt->wcol.text_sel, 0.5f);
+ widget_state_blend(wt->wcol.text, wt->wcol.inner, 0.5f);
}
/* regular active */
else if (state & UI_ACTIVE) {
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 009d52ea283..acea6e133f4 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -433,6 +433,8 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
cp = ts->console_error; break;
case TH_CONSOLE_CURSOR:
cp = ts->console_cursor; break;
+ case TH_CONSOLE_SELECT:
+ cp = ts->console_select; break;
case TH_HANDLE_VERTEX:
cp = ts->handle_vertex;
@@ -947,6 +949,7 @@ void ui_theme_init_default(void)
rgba_char_args_set(btheme->tconsole.console_info, 0, 170, 0, 255);
rgba_char_args_set(btheme->tconsole.console_error, 220, 96, 96, 255);
rgba_char_args_set(btheme->tconsole.console_cursor, 220, 96, 96, 255);
+ rgba_char_args_set(btheme->tconsole.console_select, 255, 255, 255, 48);
/* space time */
btheme->ttime = btheme->tv3d;
@@ -2160,6 +2163,13 @@ void init_userdef_do_versions(void)
}
}
+ if (U.versionfile < 265 || (U.versionfile == 265 && U.subversionfile < 11)) {
+ bTheme *btheme;
+ for (btheme = U.themes.first; btheme; btheme = btheme->next) {
+ rgba_char_args_test_set(btheme->tconsole.console_select, 255, 255, 255, 48);
+ }
+ }
+
/* NOTE!! from now on use U.versionfile and U.subversionfile */
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index ae89b25d5ea..ad6428c7e80 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -39,6 +39,7 @@
#include "DNA_userdef_types.h"
#include "BLI_blenlib.h"
+#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BKE_context.h"
@@ -1805,7 +1806,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
/* draw vertical steps */
if (dfac > 0.0f) {
- BLF_rotation_default(90.0f);
+ BLF_rotation_default(M_PI / 2);
BLF_enable_default(BLF_ROTATION);
for (; fac < vert.ymax - 10; fac += dfac, val += grid->dy) {
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index fbbcb650e68..7f1140501b5 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -1034,14 +1034,17 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event)
}
else {
/* 'continuous' or 'dolly' */
- float fac;
+ float fac, zoomfac = 0.001f * v2d->maxzoom;
+
+ /* some view2d's (graph) don't have min/max zoom, or extreme ones */
+ CLAMP (zoomfac, 0.001f, 0.01f);
/* x-axis transform */
- fac = 0.01f * (event->x - vzd->lastx);
+ fac = zoomfac * (event->x - vzd->lastx);
dx = fac * BLI_rctf_size_x(&v2d->cur);
/* y-axis transform */
- fac = 0.01f * (event->y - vzd->lasty);
+ fac = zoomfac * (event->y - vzd->lasty);
dy = fac * BLI_rctf_size_y(&v2d->cur);
}
diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c
index 3fbfaabbc0d..7ac27e038a4 100644
--- a/source/blender/editors/mesh/editface.c
+++ b/source/blender/editors/mesh/editface.c
@@ -34,6 +34,8 @@
#include "BLI_math.h"
#include "BLI_edgehash.h"
+#include "BLF_translation.h"
+
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
@@ -429,7 +431,7 @@ void seam_mark_clear_tface(Scene *scene, short mode)
if (me == 0 || me->totpoly == 0) return;
if (mode == 0)
- mode = pupmenu("Seams %t|Mark Border Seam %x1|Clear Seam %x2");
+ mode = pupmenu(IFACE_("Seams %t|Mark Border Seam %x1|Clear Seam %x2"));
if (mode != 1 && mode != 2)
return;
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index bc7fe783e78..d7dbe3506b1 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -41,6 +41,8 @@
#include "BLI_smallhash.h"
#include "BLI_memarena.h"
+#include "BLF_translation.h"
+
#include "BKE_DerivedMesh.h"
#include "BKE_context.h"
@@ -212,15 +214,16 @@ static void knife_input_ray_segment(KnifeTool_OpData *kcd, const float mval[2],
static void knife_update_header(bContext *C, KnifeTool_OpData *kcd)
{
- #define HEADER_LENGTH 190
+ #define HEADER_LENGTH 256
char header[HEADER_LENGTH];
- BLI_snprintf(header, HEADER_LENGTH, "LMB: define cut lines, Return/Spacebar: confirm, Esc or RMB: cancel, E: new cut, Ctrl: midpoint snap (%s), "
- "Shift: ignore snap (%s), C: angle constrain (%s), Z: cut through (%s)",
- kcd->snap_midpoints ? "On" : "Off",
- kcd->ignore_edge_snapping ? "On" : "Off",
- kcd->angle_snapping ? "On" : "Off",
- kcd->cut_through ? "On" : "Off");
+ BLI_snprintf(header, HEADER_LENGTH, IFACE_("LMB: define cut lines, Return/Spacebar: confirm, Esc or RMB: cancel, "
+ "E: new cut, Ctrl: midpoint snap (%s), Shift: ignore snap (%s), "
+ "C: angle constrain (%s), Z: cut through (%s)"),
+ kcd->snap_midpoints ? IFACE_("On") : IFACE_("Off"),
+ kcd->ignore_edge_snapping ? IFACE_("On") : IFACE_("Off"),
+ kcd->angle_snapping ? IFACE_("On") : IFACE_("Off"),
+ kcd->cut_through ? IFACE_("On") : IFACE_("Off"));
ED_area_headerprint(CTX_wm_area(C), header);
}
diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c
index d1373363992..83542915ec2 100644
--- a/source/blender/editors/mesh/editmesh_loopcut.c
+++ b/source/blender/editors/mesh/editmesh_loopcut.c
@@ -37,6 +37,8 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BLF_translation.h"
+
#include "BKE_context.h"
#include "BKE_modifier.h"
#include "BKE_report.h"
@@ -411,10 +413,8 @@ static int ringcut_invoke(bContext *C, wmOperator *op, wmEvent *evt)
lcd->eed = edge;
ringsel_find_edge(lcd, 1);
}
- ED_area_headerprint(sa,
- "Select a ring to be cut, "
- "use mouse-wheel or page-up/down for number of cuts, "
- "Hold Alt for smooth");
+ ED_area_headerprint(sa, IFACE_("Select a ring to be cut, use mouse-wheel or page-up/down for number of cuts, "
+ "hold Alt for smooth"));
return OPERATOR_RUNNING_MODAL;
}
@@ -543,7 +543,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, wmEvent *event)
if (show_cuts) {
char buf[64];
- BLI_snprintf(buf, sizeof(buf), "Number of Cuts: %d, Smooth: %.2f (Alt)", cuts, smoothness);
+ BLI_snprintf(buf, sizeof(buf), IFACE_("Number of Cuts: %d, Smooth: %.2f (Alt)"), cuts, smoothness);
ED_area_headerprint(CTX_wm_area(C), buf);
}
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c
index 88d826c2f98..57f116693f8 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -2678,7 +2678,7 @@ void MESH_OT_select_nth(wmOperatorType *ot)
/* identifiers */
ot->name = "Checker Deselect";
ot->idname = "MESH_OT_select_nth";
- ot->description = "Deselect every Nth element starting from a selected vertex, edge or face";
+ ot->description = "Deselect every Nth element starting from the active vertex, edge or face";
/* api callbacks */
ot->exec = edbm_select_nth_exec;
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index b58e393811d..dcb25423b80 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -47,6 +47,8 @@
#include "BLI_math.h"
#include "BLI_rand.h"
+#include "BLF_translation.h"
+
#include "BKE_material.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
@@ -2387,7 +2389,7 @@ static void shape_propagate(BMEditMesh *em, wmOperator *op)
//TAG Mesh Objects that share this data
for (base = scene->base.first; base; base = base->next) {
if (base->object && base->object->data == me) {
- base->object->recalc = OB_RECALC_DATA;
+ DAG_id_tag_update(&base->object->id, OB_RECALC_DATA);
}
}
#endif
@@ -3040,7 +3042,7 @@ static int mesh_separate_tagged(Main *bmain, Scene *scene, Base *base_old, BMesh
CustomData_bmesh_init_pool(&bm_new->pdata, bm_mesh_allocsize_default.totface, BM_FACE);
base_new = ED_object_add_duplicate(bmain, scene, base_old, USER_DUP_MESH);
- /* DAG_scene_sort(bmain, scene); */ /* normally would call directly after but in this case delay recalc */
+ /* DAG_relations_tag_update(bmain); */ /* normally would call directly after but in this case delay recalc */
assign_matarar(base_new->object, give_matarar(obedit), *give_totcolp(obedit)); /* new in 2.5 */
ED_base_object_select(base_new, BA_SELECT);
@@ -3274,7 +3276,7 @@ static int edbm_separate_exec(bContext *C, wmOperator *op)
if (retval) {
/* delay depsgraph recalc until all objects are duplicated */
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
return OPERATOR_FINISHED;
}
@@ -4651,15 +4653,9 @@ void MESH_OT_noise(wmOperatorType *ot)
RNA_def_float(ot->srna, "factor", 0.1f, -FLT_MAX, FLT_MAX, "Factor", "", 0.0f, 1.0f);
}
-#define NEW_BEVEL 1
-
typedef struct {
BMEditMesh *em;
BMBackup mesh_backup;
-#ifndef NEW_BEVEL
- float *weights;
- int li;
-#endif
int mcenter[2];
float initial_length;
float pixel_size; /* use when mouse input is interpreted as spatial distance */
@@ -4672,104 +4668,34 @@ typedef struct {
static void edbm_bevel_update_header(wmOperator *op, bContext *C)
{
-#ifdef NEW_BEVEL
- static char str[] = "Confirm: Enter/LClick, Cancel: (Esc/RMB), offset: %s, segments: %d";
-#else
- static char str[] = "Confirm: Enter/LClick, Cancel: (Esc/RMB), factor: %s, Use Dist (D): %s: Use Even (E): %s";
- BevelData *opdata = op->customdata;
-#endif
+ const char *str = IFACE_("Confirm: Enter/LClick, Cancel: (Esc/RMB), Offset: %s, Segments: %d");
char msg[HEADER_LENGTH];
ScrArea *sa = CTX_wm_area(C);
if (sa) {
-#ifdef NEW_BEVEL
char offset_str[NUM_STR_REP_LEN];
BLI_snprintf(offset_str, NUM_STR_REP_LEN, "%f", RNA_float_get(op->ptr, "offset"));
BLI_snprintf(msg, HEADER_LENGTH, str,
offset_str,
RNA_int_get(op->ptr, "segments")
);
-#else
- char factor_str[NUM_STR_REP_LEN];
- if (hasNumInput(&opdata->num_input))
- outputNumInput(&opdata->num_input, factor_str);
- else
- BLI_snprintf(factor_str, NUM_STR_REP_LEN, "%f", RNA_float_get(op->ptr, "percent"));
- BLI_snprintf(msg, HEADER_LENGTH, str,
- factor_str,
- RNA_boolean_get(op->ptr, "use_dist") ? "On" : "Off",
- RNA_boolean_get(op->ptr, "use_even") ? "On" : "Off"
- );
-#endif
ED_area_headerprint(sa, msg);
}
}
-#ifndef NEW_BEVEL
-static void edbm_bevel_recalc_weights(wmOperator *op)
-{
- float df, s, ftot;
- int i;
- int recursion = 1; /* RNA_int_get(op->ptr, "recursion"); */ /* temp removed, see comment below */
- BevelData *opdata = op->customdata;
-
- if (opdata->weights) {
- /* TODO should change to free only when new recursion is greater than old */
- MEM_freeN(opdata->weights);
- }
- opdata->weights = MEM_mallocN(sizeof(float) * recursion, "bevel weights");
-
- /* ugh, stupid math depends somewhat on angles!*/
- /* dfac = 1.0/(float)(recursion + 1); */ /* UNUSED */
- df = 1.0;
- for (i = 0, ftot = 0.0f; i < recursion; i++) {
- s = powf(df, 1.25f);
-
- opdata->weights[i] = s;
- ftot += s;
-
- df *= 2.0f;
- }
-
- mul_vn_fl(opdata->weights, recursion, 1.0f / (float)ftot);
-}
-#endif
-
static int edbm_bevel_init(bContext *C, wmOperator *op, int is_modal)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
-#ifdef NEW_BEVEL
- BevelData *opdata;
-#else
- BMIter iter;
- BMEdge *eed;
BevelData *opdata;
- int li;
-#endif
if (em == NULL) {
return 0;
}
op->customdata = opdata = MEM_mallocN(sizeof(BevelData), "beveldata_mesh_operator");
-
-#ifndef NEW_BEVEL
- BM_data_layer_add(em->bm, &em->bm->edata, CD_PROP_FLT);
- li = CustomData_number_of_layers(&em->bm->edata, CD_PROP_FLT) - 1;
-
- BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
- float d = len_v3v3(eed->v1->co, eed->v2->co);
- float *dv = CustomData_bmesh_get_n(&em->bm->edata, eed->head.data, CD_PROP_FLT, li);
-
- *dv = d;
- }
-
- opdata->li = li;
- opdata->weights = NULL;
-#endif
opdata->em = em;
opdata->is_modal = is_modal;
@@ -4781,9 +4707,6 @@ static int edbm_bevel_init(bContext *C, wmOperator *op, int is_modal)
/* avoid the cost of allocating a bm copy */
if (is_modal)
opdata->mesh_backup = EDBM_redo_state_store(em);
-#ifndef NEW_BEVEL
- edbm_bevel_recalc_weights(op);
-#endif
return 1;
}
@@ -4793,7 +4716,6 @@ static int edbm_bevel_calc(wmOperator *op)
BevelData *opdata = op->customdata;
BMEditMesh *em = opdata->em;
BMOperator bmop;
-#ifdef NEW_BEVEL
float offset = RNA_float_get(op->ptr, "offset");
int segments = RNA_int_get(op->ptr, "segments");
int vertex_only = RNA_boolean_get(op->ptr, "vertex_only");
@@ -4822,35 +4744,6 @@ static int edbm_bevel_calc(wmOperator *op)
/* no need to de-select existing geometry */
if (!EDBM_op_finish(em, &bmop, op, TRUE))
return 0;
-#else
- int i;
-
- float factor = RNA_float_get(op->ptr, "percent") /*, dfac */ /* UNUSED */;
- int recursion = 1; /* RNA_int_get(op->ptr, "recursion"); */ /* temp removed, see comment below */
- const int use_even = RNA_boolean_get(op->ptr, "use_even");
- const int use_dist = RNA_boolean_get(op->ptr, "use_dist");
-
- /* revert to original mesh */
- if (opdata->is_modal) {
- EDBM_redo_state_restore(opdata->mesh_backup, em, FALSE);
- }
-
- for (i = 0; i < recursion; i++) {
- float fac = opdata->weights[recursion - i - 1] * factor;
-
-
- if (!EDBM_op_init(em, &bmop, op,
- "bevel geom=%hev percent=%f lengthlayer=%i use_lengths=%b use_even=%b use_dist=%b",
- BM_ELEM_SELECT, fac, opdata->li, TRUE, use_even, use_dist))
- {
- return 0;
- }
-
- BMO_op_exec(em->bm, &bmop);
- if (!EDBM_op_finish(em, &bmop, op, TRUE))
- return 0;
- }
-#endif
EDBM_mesh_normals_update(opdata->em);
@@ -4868,12 +4761,7 @@ static void edbm_bevel_exit(bContext *C, wmOperator *op)
if (sa) {
ED_area_headerprint(sa, NULL);
}
-#ifndef NEW_BEVEL
- BM_data_layer_free_n(opdata->em->bm, &opdata->em->bm->edata, CD_PROP_FLT, opdata->li);
- if (opdata->weights)
- MEM_freeN(opdata->weights);
-#endif
if (opdata->is_modal) {
EDBM_redo_state_free(&opdata->mesh_backup, NULL, FALSE);
}
@@ -4954,11 +4842,7 @@ static int edbm_bevel_invoke(bContext *C, wmOperator *op, wmEvent *event)
static float edbm_bevel_mval_factor(wmOperator *op, wmEvent *event)
{
BevelData *opdata = op->customdata;
-#ifdef NEW_BEVEL
int use_dist = TRUE;
-#else
- int use_dist = RNA_boolean_get(op->ptr, "use_dist");
-#endif
float mdiff[2];
float factor;
@@ -4976,11 +4860,7 @@ static float edbm_bevel_mval_factor(wmOperator *op, wmEvent *event)
/* Fake shift-transform... */
if (event->shift) {
if (opdata->shift_factor < 0.0f) {
-#ifdef NEW_BEVEL
opdata->shift_factor = RNA_float_get(op->ptr, "offset");
-#else
- opdata->shift_factor = RNA_float_get(op->ptr, "factor");
-#endif
}
factor = (factor - opdata->shift_factor) * 0.1f + opdata->shift_factor;
}
@@ -5005,7 +4885,6 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, wmEvent *event)
if (event->val == KM_PRESS) {
/* Try to handle numeric inputs... */
-#ifdef NEW_BEVEL
if (handleNumInput(&opdata->num_input, event)) {
float value = RNA_float_get(op->ptr, "offset");
@@ -5015,18 +4894,6 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, wmEvent *event)
edbm_bevel_update_header(op, C);
return OPERATOR_RUNNING_MODAL;
}
-#else
- if (handleNumInput(&opdata->num_input, event)) {
- float factor = RNA_float_get(op->ptr, "percent");
- applyNumInput(&opdata->num_input, &factor);
- CLAMP(factor, 0.0f, 1.0f);
- RNA_float_set(op->ptr, "percent", factor);
-
- edbm_bevel_calc(C, op);
- edbm_bevel_update_header(op, C);
- return OPERATOR_RUNNING_MODAL;
- }
-#endif
}
switch (event->type) {
@@ -5038,11 +4905,7 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, wmEvent *event)
case MOUSEMOVE:
if (!hasNumInput(&opdata->num_input)) {
const float factor = edbm_bevel_mval_factor(op, event);
-#ifdef NEW_BEVEL
RNA_float_set(op->ptr, "offset", factor);
-#else
- RNA_float_set(op->ptr, "percent", factor);
-#endif
edbm_bevel_calc(op);
edbm_bevel_update_header(op, C);
@@ -5056,7 +4919,6 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, wmEvent *event)
edbm_bevel_exit(C, op);
return OPERATOR_FINISHED;
-#ifdef NEW_BEVEL
case WHEELUPMOUSE: /* change number of segments */
case PAGEUPKEY:
if (event->val == KM_RELEASE)
@@ -5078,33 +4940,6 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, wmEvent *event)
edbm_bevel_calc(op);
edbm_bevel_update_header(op, C);
break;
-
-#else
- case EKEY:
- if (event->val == KM_PRESS) {
- int use_even = RNA_boolean_get(op->ptr, "use_even");
- RNA_boolean_set(op->ptr, "use_even", !use_even);
-
- edbm_bevel_calc(C, op);
- edbm_bevel_update_header(op, C);
- }
- break;
-
- case DKEY:
- if (event->val == KM_PRESS) {
- int use_dist = RNA_boolean_get(op->ptr, "use_dist");
- RNA_boolean_set(op->ptr, "use_dist", !use_dist);
-
- {
- const float factor = edbm_bevel_mval_factor(op, event);
- RNA_float_set(op->ptr, "percent", factor);
- }
-
- edbm_bevel_calc(C, op);
- edbm_bevel_update_header(op, C);
- }
- break;
-#endif
}
return OPERATOR_RUNNING_MODAL;
@@ -5127,20 +4962,9 @@ void MESH_OT_bevel(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_GRAB_POINTER | OPTYPE_BLOCKING;
-#ifdef NEW_BEVEL
RNA_def_float(ot->srna, "offset", 0.0f, -FLT_MAX, FLT_MAX, "Offset", "", 0.0f, 1.0f);
RNA_def_int(ot->srna, "segments", 1, 1, 50, "Segments", "Segments for curved edge", 1, 8);
RNA_def_boolean(ot->srna, "vertex_only", FALSE, "Vertex only", "Bevel only vertices");
-#else
- /* take note, used as a factor _and_ a distance depending on 'use_dist' */
- RNA_def_float(ot->srna, "percent", 0.0f, -FLT_MAX, FLT_MAX, "Percentage", "", 0.0f, 1.0f);
- /* XXX, disabled for 2.63 release, needs to work much better without overlap before we can give to users. */
-/* RNA_def_int(ot->srna, "recursion", 1, 1, 50, "Recursion Level", "Recursion Level", 1, 8); */
-
- RNA_def_boolean(ot->srna, "use_even", FALSE, "Even", "Calculate evenly spaced bevel");
- RNA_def_boolean(ot->srna, "use_dist", FALSE, "Distance", "Interpret the percent in blender units");
-#endif
-
}
static int edbm_bridge_edge_loops_exec(bContext *C, wmOperator *op)
@@ -5212,12 +5036,8 @@ static void edbm_inset_update_header(wmOperator *op, bContext *C)
{
InsetData *opdata = op->customdata;
- static const char str[] = "Confirm: Enter/LClick, "
- "Cancel: (Esc/RClick), "
- "thickness: %s, "
- "depth (Ctrl to tweak): %s (%s), "
- "Outset (O): (%s), "
- "Boundary (B): (%s)";
+ const char *str = IFACE_("Confirm: Enter/LClick, Cancel: (Esc/RClick), Thickness: %s, "
+ "Depth (Ctrl to tweak): %s (%s), Outset (O): (%s), Boundary (B): (%s)");
char msg[HEADER_LENGTH];
ScrArea *sa = CTX_wm_area(C);
@@ -5233,9 +5053,9 @@ static void edbm_inset_update_header(wmOperator *op, bContext *C)
BLI_snprintf(msg, HEADER_LENGTH, str,
flts_str,
flts_str + NUM_STR_REP_LEN,
- opdata->modify_depth ? "On" : "Off",
- RNA_boolean_get(op->ptr, "use_outset") ? "On" : "Off",
- RNA_boolean_get(op->ptr, "use_boundary") ? "On" : "Off"
+ opdata->modify_depth ? IFACE_("On") : IFACE_("Off"),
+ RNA_boolean_get(op->ptr, "use_outset") ? IFACE_("On") : IFACE_("Off"),
+ RNA_boolean_get(op->ptr, "use_boundary") ? IFACE_("On") : IFACE_("Off")
);
ED_area_headerprint(sa, msg);
diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c
index d62eba9728c..fd90246f791 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -136,8 +136,10 @@ void EDBM_mesh_clear(BMEditMesh *em)
/* free tessellation data */
em->tottri = 0;
- if (em->looptris)
+ if (em->looptris) {
MEM_freeN(em->looptris);
+ em->looptris = NULL;
+ }
}
void EDBM_stats_update(BMEditMesh *em)
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index cb69faa5b51..f983a43f573 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -559,7 +559,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
}
- DAG_scene_sort(bmain, scene); // removed objects, need to rebuild dag before editmode call
+ DAG_relations_tag_update(bmain); // removed objects, need to rebuild dag
#if 0
ED_object_enter_editmode(C, EM_WAITCURSOR);
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index ffaa6f61cae..bc577f6ee29 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -381,7 +381,7 @@ Object *ED_object_add_type(bContext *C, int type, const float loc[3], const floa
ED_object_base_init_transform(C, BASACT, loc, rot);
DAG_id_type_tag(bmain, ID_OB);
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
if (ob->data) {
ED_render_id_flush_update(bmain, ob->data);
}
@@ -469,7 +469,7 @@ static int effector_add_exec(bContext *C, wmOperator *op)
ob->pd = object_add_collision_fields(type);
- DAG_scene_sort(CTX_data_main(C), CTX_data_scene(C));
+ DAG_relations_tag_update(CTX_data_main(C));
return OPERATOR_FINISHED;
}
@@ -815,7 +815,7 @@ static int group_instance_add_exec(bContext *C, wmOperator *op)
if (0 == RNA_struct_property_is_set(op->ptr, "location")) {
wmEvent *event = CTX_wm_window(C)->eventstate;
ED_object_location_from_view(C, loc);
- ED_view3d_cursor3d_position(C, loc, event->x, event->y);
+ ED_view3d_cursor3d_position(C, loc, event->mval);
RNA_float_set_array(op->ptr, "location", loc);
}
}
@@ -835,9 +835,9 @@ static int group_instance_add_exec(bContext *C, wmOperator *op)
id_lib_extern(&group->id);
/* works without this except if you try render right after, see: 22027 */
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
- WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, CTX_data_scene(C));
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
return OPERATOR_FINISHED;
}
@@ -993,13 +993,12 @@ static int object_delete_exec(bContext *C, wmOperator *op)
if (scene->id.flag & LIB_DOIT) {
scene->id.flag &= ~LIB_DOIT;
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene);
}
}
- DAG_ids_flush_update(bmain, 0);
return OPERATOR_FINISHED;
}
@@ -1260,8 +1259,7 @@ static int object_duplicates_make_real_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
- DAG_scene_sort(bmain, scene);
- DAG_ids_flush_update(bmain, 0);
+ DAG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_SCENE, scene);
WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
@@ -1325,7 +1323,7 @@ static Base *duplibase_for_convert(Scene *scene, Base *base, Object *ob)
}
obn = BKE_object_copy(ob);
- obn->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
basen = MEM_mallocN(sizeof(Base), "duplibase");
*basen = *base;
@@ -1427,7 +1425,7 @@ static int convert_exec(bContext *C, wmOperator *op)
}
else {
newob = ob;
- ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
}
/* make new mesh data from the original copy */
@@ -1492,7 +1490,7 @@ static int convert_exec(bContext *C, wmOperator *op)
for (ob1 = bmain->object.first; ob1; ob1 = ob1->id.next) {
if (ob1->data == ob->data) {
ob1->type = OB_CURVE;
- ob1->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+ DAG_id_tag_update(&ob1->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
}
}
}
@@ -1623,7 +1621,7 @@ static int convert_exec(bContext *C, wmOperator *op)
}
/* delete object should renew depsgraph */
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
}
// XXX ED_object_enter_editmode(C, 0);
@@ -1639,7 +1637,7 @@ static int convert_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_OBJECT | ND_DATA, BASACT->object);
}
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, scene);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
@@ -1691,7 +1689,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
}
else {
obn = BKE_object_copy(ob);
- obn->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+ DAG_id_tag_update(&obn->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
basen = MEM_mallocN(sizeof(Base), "duplibase");
*basen = *base;
@@ -1816,7 +1814,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
}
break;
case OB_ARMATURE:
- obn->recalc |= OB_RECALC_DATA;
+ DAG_id_tag_update(&obn->id, OB_RECALC_DATA);
if (obn->pose)
obn->pose->flag |= POSE_RECALC;
if (dupflag & USER_DUP_ARM) {
@@ -1906,7 +1904,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
/* single object duplicate, if dupflag==0, fully linked, else it uses the flags given */
/* leaves selection of base/object unaltered.
* note: don't call this within a loop since clear_* funcs loop over the entire database.
- * note: caller must do DAG_scene_sort(bmain, scene);
+ * note: caller must do DAG_relations_tag_update(bmain);
* this is not done automatic since we may duplicate many objects in a batch */
Base *ED_object_add_duplicate(Main *bmain, Scene *scene, Base *base, int dupflag)
{
@@ -1927,7 +1925,7 @@ Base *ED_object_add_duplicate(Main *bmain, Scene *scene, Base *base, int dupflag
BKE_object_relink(ob);
set_sca_new_poins_ob(ob);
- /* DAG_scene_sort(bmain, scene); */ /* caller must do */
+ /* DAG_relations_tag_update(bmain); */ /* caller must do */
if (ob->data) {
ED_render_id_flush_update(bmain, ob->data);
@@ -1971,8 +1969,7 @@ static int duplicate_exec(bContext *C, wmOperator *op)
copy_object_set_idnew(C, dupflag);
- DAG_scene_sort(bmain, scene);
- DAG_ids_flush_update(bmain, 0);
+ DAG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
@@ -2040,15 +2037,14 @@ static int add_named_exec(bContext *C, wmOperator *op)
if (event) {
ED_object_location_from_view(C, basen->object->loc);
- ED_view3d_cursor3d_position(C, basen->object->loc, event->x, event->y);
+ ED_view3d_cursor3d_position(C, basen->object->loc, event->mval);
}
ED_base_object_activate(C, basen);
copy_object_set_idnew(C, dupflag);
- DAG_scene_sort(bmain, scene);
- DAG_ids_flush_update(bmain, 0);
+ DAG_relations_tag_update(bmain);
MEM_freeN(base);
diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c
index 322ba99593e..a680230fb32 100644
--- a/source/blender/editors/object/object_bake.c
+++ b/source/blender/editors/object/object_bake.c
@@ -257,11 +257,18 @@ static DerivedMesh *multiresbake_create_hiresdm(Scene *scene, Object *ob, int *l
return dm;
}
-static void clear_images(MTFace *mtface, int totface)
+typedef enum ClearFlag {
+ CLEAR_NORMAL = 1
+} ClearFlag;
+
+
+static void clear_images(MTFace *mtface, int totface, ClearFlag flag)
{
int a;
const float vec_alpha[4] = {0.0f, 0.0f, 0.0f, 0.0f};
const float vec_solid[4] = {0.0f, 0.0f, 0.0f, 1.0f};
+ const float nor_alpha[4] = {0.5f, 0.5f, 1.0f, 0.0f};
+ const float nor_solid[4] = {0.5f, 0.5f, 1.0f, 1.0f};
for (a = 0; a < totface; a++)
mtface[a].tpage->id.flag &= ~LIB_DOIT;
@@ -272,7 +279,11 @@ static void clear_images(MTFace *mtface, int totface)
if ((ima->id.flag & LIB_DOIT) == 0) {
ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL);
- IMB_rectfill(ibuf, (ibuf->planes == R_IMF_PLANES_RGBA) ? vec_alpha : vec_solid);
+ if (flag == CLEAR_NORMAL)
+ IMB_rectfill(ibuf, (ibuf->planes == R_IMF_PLANES_RGBA) ? nor_alpha : nor_solid);
+ else
+ IMB_rectfill(ibuf, (ibuf->planes == R_IMF_PLANES_RGBA) ? vec_alpha : vec_solid);
+
ima->id.flag |= LIB_DOIT;
BKE_image_release_ibuf(ima, ibuf, NULL);
@@ -300,7 +311,10 @@ static int multiresbake_image_exec_locked(bContext *C, wmOperator *op)
ob = base->object;
me = (Mesh *)ob->data;
- clear_images(me->mtface, me->totface);
+ if (scene->r.bake_mode == RE_BAKE_NORMALS && scene->r.bake_normal_space == R_BAKE_SPACE_TANGENT)
+ clear_images(me->mtface, me->totface, CLEAR_NORMAL);
+ else
+ clear_images(me->mtface, me->totface, 0);
}
CTX_DATA_END;
}
@@ -395,7 +409,10 @@ static void multiresbake_startjob(void *bkv, short *stop, short *do_update, floa
DerivedMesh *dm = data->lores_dm;
MTFace *mtface = CustomData_get_layer(&dm->faceData, CD_MTFACE);
- clear_images(mtface, dm->getNumTessFaces(dm));
+ if (bkj->mode == RE_BAKE_NORMALS)
+ clear_images(mtface, dm->getNumTessFaces(dm), CLEAR_NORMAL);
+ else
+ clear_images(mtface, dm->getNumTessFaces(dm), 0);
}
}
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index 7746329c17f..84b989e2f59 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -1146,12 +1146,12 @@ void ED_object_constraint_update(Object *ob)
DAG_id_tag_update(&ob->id, OB_RECALC_OB);
}
-void ED_object_constraint_dependency_update(Main *bmain, Scene *scene, Object *ob)
+void ED_object_constraint_dependency_update(Main *bmain, Object *ob)
{
ED_object_constraint_update(ob);
if (ob->pose) ob->pose->flag |= POSE_RECALC; // checks & sorts pose channels
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
}
static int constraint_poll(bContext *C)
@@ -1310,7 +1310,6 @@ void CONSTRAINT_OT_move_up(wmOperatorType *ot)
static int pose_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain = CTX_data_main(C);
- Scene *scene = CTX_data_scene(C);
Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
/* free constraints for all selected bones */
@@ -1322,7 +1321,7 @@ static int pose_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op))
CTX_DATA_END;
/* force depsgraph to get recalculated since relationships removed */
- DAG_scene_sort(bmain, scene); /* sort order of objects */
+ DAG_relations_tag_update(bmain);
/* note, calling BIK_clear_data() isn't needed here */
@@ -1349,7 +1348,6 @@ void POSE_OT_constraints_clear(wmOperatorType *ot)
static int object_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain = CTX_data_main(C);
- Scene *scene = CTX_data_scene(C);
/* do freeing */
CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
@@ -1360,7 +1358,7 @@ static int object_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op))
CTX_DATA_END;
/* force depsgraph to get recalculated since relationships removed */
- DAG_scene_sort(bmain, scene); /* sort order of objects */
+ DAG_relations_tag_update(bmain);
/* do updates */
WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, NULL);
@@ -1385,7 +1383,6 @@ void OBJECT_OT_constraints_clear(wmOperatorType *ot)
static int pose_constraint_copy_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
- Scene *scene = CTX_data_scene(C);
bPoseChannel *pchan = CTX_data_active_pose_bone(C);
/* don't do anything if bone doesn't exist or doesn't have any constraints */
@@ -1407,7 +1404,7 @@ static int pose_constraint_copy_exec(bContext *C, wmOperator *op)
CTX_DATA_END;
/* force depsgraph to get recalculated since new relationships added */
- DAG_scene_sort(bmain, scene); /* sort order of objects/bones */
+ DAG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, NULL);
@@ -1432,7 +1429,6 @@ void POSE_OT_constraints_copy(wmOperatorType *ot)
static int object_constraint_copy_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain = CTX_data_main(C);
- Scene *scene = CTX_data_scene(C);
Object *obact = ED_object_active_context(C);
/* copy all constraints from active object to all selected objects */
@@ -1447,7 +1443,7 @@ static int object_constraint_copy_exec(bContext *C, wmOperator *UNUSED(op))
CTX_DATA_END;
/* force depsgraph to get recalculated since new relationships added */
- DAG_scene_sort(bmain, scene); /* sort order of objects */
+ DAG_relations_tag_update(bmain);
/* notifiers for updates */
WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT | NA_ADDED, NULL);
@@ -1615,7 +1611,6 @@ static short get_new_constraint_target(bContext *C, int con_type, Object **tar_o
static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase *list, int type, short setTarget)
{
Main *bmain = CTX_data_main(C);
- Scene *scene = CTX_data_scene(C);
bPoseChannel *pchan;
bConstraint *con;
@@ -1709,7 +1704,7 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase
/* force depsgraph to get recalculated since new relationships added */
- DAG_scene_sort(bmain, scene); /* sort order of objects */
+ DAG_relations_tag_update(bmain);
if ((ob->type == OB_ARMATURE) && (pchan)) {
ob->pose->flag |= POSE_RECALC; /* sort pose channels */
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 4807e7364ea..b94c9e940dc 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -150,7 +150,7 @@ static int object_hide_view_clear_exec(bContext *C, wmOperator *UNUSED(op))
}
if (changed) {
DAG_id_type_tag(bmain, ID_OB);
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
}
@@ -207,7 +207,7 @@ static int object_hide_view_set_exec(bContext *C, wmOperator *op)
if (changed) {
DAG_id_type_tag(bmain, ID_OB);
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
@@ -771,7 +771,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
Base *base;
Curve *cu, *cu1;
Nurb *nu;
- int do_scene_sort = FALSE;
+ bool do_depgraph_update = false;
if (scene->id.lib) return;
@@ -798,7 +798,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
for (base = FIRSTBASE; base; base = base->next) {
if (base != BASACT) {
if (TESTBASELIB(v3d, base)) {
- base->object->recalc |= OB_RECALC_OB;
+ DAG_id_tag_update(&base->object->id, OB_RECALC_DATA);
if (event == 1) { /* loc */
copy_v3_v3(base->object->loc, ob->loc);
@@ -897,7 +897,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
BLI_strncpy(cu1->family, cu->family, sizeof(cu1->family));
- base->object->recalc |= OB_RECALC_DATA;
+ DAG_id_tag_update(&base->object->id, OB_RECALC_DATA);
}
}
else if (event == 19) { /* bevel settings */
@@ -913,7 +913,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
cu1->ext1 = cu->ext1;
cu1->ext2 = cu->ext2;
- base->object->recalc |= OB_RECALC_DATA;
+ DAG_id_tag_update(&base->object->id, OB_RECALC_DATA);
}
}
else if (event == 25) { /* curve resolution */
@@ -932,7 +932,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
nu = nu->next;
}
- base->object->recalc |= OB_RECALC_DATA;
+ DAG_id_tag_update(&base->object->id, OB_RECALC_DATA);
}
}
else if (event == 21) {
@@ -948,7 +948,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
}
modifier_copyData(md, tmd);
- base->object->recalc |= OB_RECALC_DATA;
+ DAG_id_tag_update(&base->object->id, OB_RECALC_DATA);
}
}
}
@@ -956,7 +956,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
/* Copy the constraint channels over */
BKE_copy_constraints(&base->object->constraints, &ob->constraints, TRUE);
- do_scene_sort = TRUE;
+ do_depgraph_update = true;
}
else if (event == 23) {
base->object->softflag = ob->softflag;
@@ -1008,10 +1008,8 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
}
}
- if (do_scene_sort)
- DAG_scene_sort(bmain, scene);
-
- DAG_ids_flush_update(bmain, 0);
+ if (do_depgraph_update)
+ DAG_relations_tag_update(bmain);
}
static void UNUSED_FUNCTION(copy_attr_menu) (Main * bmain, Scene * scene, View3D * v3d)
@@ -1151,7 +1149,7 @@ static int object_calculate_paths_invoke(bContext *C, wmOperator *op, wmEvent *U
/* show popup dialog to allow editing of range... */
/* FIXME: hardcoded dimensions here are just arbitrary */
- return WM_operator_props_dialog_popup(C, op, 200, 200);
+ return WM_operator_props_dialog_popup(C, op, 10 * UI_UNIT_X, 10 * UI_UNIT_Y);
}
/* Calculate/recalculate whole paths (avs.path_sf to avs.path_ef) */
diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c
index 9b683a1ba98..3112bb21091 100644
--- a/source/blender/editors/object/object_group.c
+++ b/source/blender/editors/object/object_group.c
@@ -137,7 +137,7 @@ static int objects_add_active_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_WARNING, "Skipped some groups because of cycle detected");
}
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
return OPERATOR_FINISHED;
@@ -197,7 +197,7 @@ static int objects_remove_active_exec(bContext *C, wmOperator *op)
if (!ok) BKE_report(op->reports, RPT_ERROR, "Active object contains no groups");
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
return OPERATOR_FINISHED;
@@ -229,7 +229,7 @@ static int group_objects_remove_all_exec(bContext *C, wmOperator *UNUSED(op))
}
CTX_DATA_END;
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
return OPERATOR_FINISHED;
@@ -269,7 +269,7 @@ static int group_objects_remove_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
return OPERATOR_FINISHED;
@@ -319,7 +319,7 @@ static int group_create_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c
index 1387ef94091..43736909c40 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -516,7 +516,7 @@ static int add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *ob
mul_serie_m4(hmd->parentinv, ob->imat, obedit->obmat, NULL,
NULL, NULL, NULL, NULL, NULL);
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
return TRUE;
}
@@ -558,7 +558,7 @@ static int object_add_hook_selob_exec(bContext *C, wmOperator *op)
}
}
-void OBJECT_OT_hook_add_selobj(wmOperatorType *ot)
+void OBJECT_OT_hook_add_selob(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Hook to Selected Object";
@@ -592,7 +592,7 @@ static int object_add_hook_newob_exec(bContext *C, wmOperator *op)
}
}
-void OBJECT_OT_hook_add_newobj(wmOperatorType *ot)
+void OBJECT_OT_hook_add_newob(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Hook to New Object";
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h
index 0be9c92897e..4523ac098d6 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -127,8 +127,8 @@ void OBJECT_OT_join_shapes(struct wmOperatorType *ot);
void OBJECT_OT_convert(struct wmOperatorType *ot);
/* object_hook.c */
-void OBJECT_OT_hook_add_selobj(struct wmOperatorType *ot);
-void OBJECT_OT_hook_add_newobj(struct wmOperatorType *ot);
+void OBJECT_OT_hook_add_selob(struct wmOperatorType *ot);
+void OBJECT_OT_hook_add_newob(struct wmOperatorType *ot);
void OBJECT_OT_hook_remove(struct wmOperatorType *ot);
void OBJECT_OT_hook_select(struct wmOperatorType *ot);
void OBJECT_OT_hook_assign(struct wmOperatorType *ot);
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 00082b03781..8d29813e2ac 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -151,10 +151,10 @@ ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *sc
ob->pd = object_add_collision_fields(0);
ob->pd->deflect = 1;
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
}
else if (type == eModifierType_Surface)
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
else if (type == eModifierType_Multires) {
/* set totlvl from existing MDISPS layer if object already had it */
multiresModifier_set_levels_from_disps((MultiresModifierData *)new_md, ob);
@@ -330,7 +330,7 @@ static int object_modifier_remove(Main *bmain, Object *ob, ModifierData *md,
return 1;
}
-int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Object *ob, ModifierData *md)
+int ED_object_modifier_remove(ReportList *reports, Main *bmain, Object *ob, ModifierData *md)
{
int sort_depsgraph = 0;
int ok;
@@ -343,15 +343,12 @@ int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Ob
}
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
-
- /* sorting has to be done after the update so that dynamic systems can react properly */
- if (sort_depsgraph)
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
return 1;
}
-void ED_object_modifier_clear(Main *bmain, Scene *scene, Object *ob)
+void ED_object_modifier_clear(Main *bmain, Object *ob)
{
ModifierData *md = ob->modifiers.first;
int sort_depsgraph = 0;
@@ -370,10 +367,7 @@ void ED_object_modifier_clear(Main *bmain, Scene *scene, Object *ob)
}
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
-
- /* sorting has to be done after the update so that dynamic systems can react properly */
- if (sort_depsgraph)
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
}
int ED_object_modifier_move_up(ReportList *reports, Object *ob, ModifierData *md)
@@ -391,7 +385,7 @@ int ED_object_modifier_move_up(ReportList *reports, Object *ob, ModifierData *md
}
BLI_remlink(&ob->modifiers, md);
- BLI_insertlink(&ob->modifiers, md->prev->prev, md);
+ BLI_insertlinkbefore(&ob->modifiers, md->prev, md);
}
return 1;
@@ -412,7 +406,7 @@ int ED_object_modifier_move_down(ReportList *reports, Object *ob, ModifierData *
}
BLI_remlink(&ob->modifiers, md);
- BLI_insertlink(&ob->modifiers, md->next, md);
+ BLI_insertlinkafter(&ob->modifiers, md->next, md);
}
return 1;
@@ -522,7 +516,7 @@ int ED_object_modifier_convert(ReportList *UNUSED(reports), Main *bmain, Scene *
}
}
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
return 1;
}
@@ -728,7 +722,7 @@ int ED_object_modifier_copy(ReportList *UNUSED(reports), Object *ob, ModifierDat
nmd = modifier_new(md->type);
modifier_copyData(md, nmd);
- BLI_insertlink(&ob->modifiers, md, nmd);
+ BLI_insertlinkafter(&ob->modifiers, md, nmd);
modifier_unique_name(&ob->modifiers, nmd);
return 1;
@@ -884,7 +878,7 @@ static int modifier_remove_exec(bContext *C, wmOperator *op)
ModifierData *md = edit_modifier_property_get(op, ob, 0);
int mode_orig = ob ? ob->mode : 0;
- if (!ob || !md || !ED_object_modifier_remove(op->reports, bmain, scene, ob, md))
+ if (!ob || !md || !ED_object_modifier_remove(op->reports, bmain, ob, md))
return OPERATOR_CANCELLED;
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
@@ -1831,7 +1825,7 @@ static int skin_armature_create_exec(bContext *C, wmOperator *op)
arm_md->object = arm_ob;
arm_md->deformflag = ARM_DEF_VGROUP | ARM_DEF_QUATERNION;
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index d26ea89bd1e..bf408d6dbe4 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -217,8 +217,8 @@ void ED_operatortypes_object(void)
WM_operatortype_append(OBJECT_OT_group_link);
WM_operatortype_append(OBJECT_OT_group_remove);
- WM_operatortype_append(OBJECT_OT_hook_add_selobj);
- WM_operatortype_append(OBJECT_OT_hook_add_newobj);
+ WM_operatortype_append(OBJECT_OT_hook_add_selob);
+ WM_operatortype_append(OBJECT_OT_hook_add_newob);
WM_operatortype_append(OBJECT_OT_hook_remove);
WM_operatortype_append(OBJECT_OT_hook_select);
WM_operatortype_append(OBJECT_OT_hook_assign);
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 629dba465bc..c5e8310e9fb 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -223,7 +223,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
{
if (ob != obedit) {
- ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
par = obedit->parent;
while (par) {
@@ -260,7 +260,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_OBJECT, NULL);
@@ -364,7 +364,7 @@ static int make_proxy_exec(bContext *C, wmOperator *op)
BKE_object_make_proxy(newob, ob, gob);
/* depsgraph flushes are needed for the new data */
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
DAG_id_tag_update(&newob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, newob);
}
@@ -512,14 +512,13 @@ void ED_object_parent_clear(Object *ob, int type)
break;
}
- ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
}
/* note, poll should check for editable scene */
static int parent_clear_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
- Scene *scene = CTX_data_scene(C);
int type = RNA_enum_get(op->ptr, "type");
CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
@@ -528,8 +527,7 @@ static int parent_clear_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
- DAG_scene_sort(bmain, scene);
- DAG_ids_flush_update(bmain, 0);
+ DAG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_PARENT, NULL);
return OPERATOR_FINISHED;
@@ -597,7 +595,7 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
bPoseChannel *pchan = NULL;
int pararm = ELEM4(partype, PAR_ARMATURE, PAR_ARMATURE_NAME, PAR_ARMATURE_ENVELOPE, PAR_ARMATURE_AUTO);
- par->recalc |= OB_RECALC_OB;
+ DAG_id_tag_update(&par->id, OB_RECALC_OB);
/* preconditions */
if (partype == PAR_FOLLOW || partype == PAR_PATH_CONST) {
@@ -762,7 +760,7 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
invert_m4_m4(ob->parentinv, workob.obmat);
}
- ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA;
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA);
}
}
@@ -791,8 +789,7 @@ static int parent_set_exec(bContext *C, wmOperator *op)
if (!ok)
return OPERATOR_CANCELLED;
- DAG_scene_sort(bmain, scene);
- DAG_ids_flush_update(bmain, 0);
+ DAG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_PARENT, NULL);
@@ -903,7 +900,7 @@ static int parent_noinv_set_exec(bContext *C, wmOperator *op)
Main *bmain = CTX_data_main(C);
Object *par = ED_object_active_context(C);
- par->recalc |= OB_RECALC_OB;
+ DAG_id_tag_update(&par->id, OB_RECALC_OB);
/* context iterator */
CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
@@ -918,7 +915,7 @@ static int parent_noinv_set_exec(bContext *C, wmOperator *op)
memset(ob->loc, 0, 3 * sizeof(float));
/* set recalc flags */
- ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA;
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA);
/* set parenting type for object - object only... */
ob->parent = par;
@@ -928,8 +925,7 @@ static int parent_noinv_set_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
- DAG_scene_sort(bmain, CTX_data_scene(C));
- DAG_ids_flush_update(bmain, 0);
+ DAG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
return OPERATOR_FINISHED;
@@ -955,7 +951,6 @@ void OBJECT_OT_parent_no_inverse_set(wmOperatorType *ot)
static int object_slow_parent_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
- Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
@@ -965,13 +960,12 @@ static int object_slow_parent_clear_exec(bContext *C, wmOperator *UNUSED(op))
ob->partype -= PARSLOW;
BKE_object_where_is_calc(scene, ob);
ob->partype |= PARSLOW;
- ob->recalc |= OB_RECALC_OB;
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB);
}
}
}
CTX_DATA_END;
- DAG_ids_flush_update(bmain, 0);
WM_event_add_notifier(C, NC_SCENE, scene);
return OPERATOR_FINISHED;
@@ -998,7 +992,6 @@ void OBJECT_OT_slow_parent_clear(wmOperatorType *ot)
static int object_slow_parent_set_exec(bContext *C, wmOperator *UNUSED(op))
{
- Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
@@ -1006,12 +999,11 @@ static int object_slow_parent_set_exec(bContext *C, wmOperator *UNUSED(op))
if (ob->parent)
ob->partype |= PARSLOW;
- ob->recalc |= OB_RECALC_OB;
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB);
}
CTX_DATA_END;
- DAG_ids_flush_update(bmain, 0);
WM_event_add_notifier(C, NC_SCENE, scene);
return OPERATOR_FINISHED;
@@ -1046,7 +1038,6 @@ static EnumPropertyItem prop_clear_track_types[] = {
static int object_track_clear_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
- Scene *scene = CTX_data_scene(C);
int type = RNA_enum_get(op->ptr, "type");
if (CTX_data_edit_object(C)) {
@@ -1059,7 +1050,7 @@ static int object_track_clear_exec(bContext *C, wmOperator *op)
/* remove track-object for old track */
ob->track = NULL;
- ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
/* also remove all tracking constraints */
for (con = ob->constraints.last; con; con = pcon) {
@@ -1073,8 +1064,7 @@ static int object_track_clear_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
- DAG_ids_flush_update(bmain, 0);
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
return OPERATOR_FINISHED;
@@ -1111,7 +1101,6 @@ static EnumPropertyItem prop_make_track_types[] = {
static int track_set_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
- Scene *scene = CTX_data_scene(C);
Object *obact = ED_object_active_context(C);
int type = RNA_enum_get(op->ptr, "type");
@@ -1127,7 +1116,7 @@ static int track_set_exec(bContext *C, wmOperator *op)
data = con->data;
data->tar = obact;
- ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
/* Lamp, Camera and Speaker track differently by default */
if (ob->type == OB_LAMP || ob->type == OB_CAMERA || ob->type == OB_SPEAKER)
@@ -1147,7 +1136,7 @@ static int track_set_exec(bContext *C, wmOperator *op)
data = con->data;
data->tar = obact;
- ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
/* Lamp, Camera and Speaker track differently by default */
if (ob->type == OB_LAMP || ob->type == OB_CAMERA || ob->type == OB_SPEAKER) {
@@ -1169,7 +1158,7 @@ static int track_set_exec(bContext *C, wmOperator *op)
data = con->data;
data->tar = obact;
- ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
/* Lamp, Camera and Speaker track differently by default */
if (ob->type == OB_LAMP || ob->type == OB_CAMERA || ob->type == OB_SPEAKER) {
@@ -1181,8 +1170,7 @@ static int track_set_exec(bContext *C, wmOperator *op)
CTX_DATA_END;
}
- DAG_scene_sort(bmain, scene);
- DAG_ids_flush_update(bmain, 0);
+ DAG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
return OPERATOR_FINISHED;
@@ -1297,7 +1285,7 @@ static int move_to_layer_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, scene);
WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene);
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
return OPERATOR_FINISHED;
}
@@ -1360,7 +1348,6 @@ Base *ED_object_scene_link(Scene *scene, Object *ob)
static int make_links_scene_exec(bContext *C, wmOperator *op)
{
- Main *bmain = CTX_data_main(C);
Scene *scene_to = BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "scene"));
if (scene_to == NULL) {
@@ -1384,8 +1371,6 @@ static int make_links_scene_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
- DAG_ids_flush_update(bmain, 0);
-
/* redraw the 3D view because the object center points are colored differently */
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, NULL);
@@ -1476,7 +1461,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
/* if amount of material indices changed: */
test_object_materials(ob_dst->data);
- ob_dst->recalc |= OB_RECALC_DATA;
+ DAG_id_tag_update(&ob_dst->id, OB_RECALC_DATA);
break;
case MAKE_LINKS_MATERIALS:
/* new approach, using functions from kernel */
@@ -1515,7 +1500,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
break;
case MAKE_LINKS_MODIFIERS:
BKE_object_link_modifiers(ob_dst, ob_src);
- ob_dst->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+ DAG_id_tag_update(&ob_dst->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
break;
case MAKE_LINKS_FONTS:
{
@@ -1535,7 +1520,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
cu_dst->vfontbi = cu_src->vfontbi;
id_us_plus((ID *)cu_dst->vfontbi);
- ob_dst->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+ DAG_id_tag_update(&ob_dst->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
break;
}
}
@@ -1554,10 +1539,9 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
}
}
- DAG_scene_sort(bmain, scene);
-
- DAG_ids_flush_update(bmain, 0);
+ DAG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C));
+
return OPERATOR_FINISHED;
}
@@ -1706,7 +1690,7 @@ static void single_obdata_users(Main *bmain, Scene *scene, int flag)
id = ob->data;
if (id && id->us > 1 && id->lib == NULL) {
- ob->recalc = OB_RECALC_DATA;
+ DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
BKE_copy_animdata_id_action(id);
@@ -1742,7 +1726,7 @@ static void single_obdata_users(Main *bmain, Scene *scene, int flag)
ob->data = BKE_lattice_copy(ob->data);
break;
case OB_ARMATURE:
- ob->recalc |= OB_RECALC_DATA;
+ DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
ob->data = BKE_armature_copy(ob->data);
BKE_pose_rebuild(ob, ob->data);
break;
@@ -1778,7 +1762,7 @@ static void single_object_action_users(Scene *scene, int flag)
for (base = FIRSTBASE; base; base = base->next) {
ob = base->object;
if (ob->id.lib == NULL && (flag == 0 || (base->flag & SELECT)) ) {
- ob->recalc = OB_RECALC_DATA;
+ DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
BKE_copy_animdata_id_action(&ob->id);
}
}
@@ -2148,7 +2132,6 @@ void OBJECT_OT_make_single_user(wmOperatorType *ot)
static int drop_named_material_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- Main *bmain = CTX_data_main(C);
Base *base = ED_view3d_give_base_under_cursor(C, event->mval);
Material *ma;
char name[MAX_ID_NAME - 2];
@@ -2160,7 +2143,6 @@ static int drop_named_material_invoke(bContext *C, wmOperator *op, wmEvent *even
assign_material(base->object, ma, 1, BKE_MAT_ASSIGN_USERPREF);
- DAG_ids_flush_update(bmain, 0);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C));
WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_LINKS, ma);
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c
index 07eca749a74..775a2897513 100644
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@ -527,6 +527,7 @@ static EnumPropertyItem prop_select_grouped_types[] = {
{11, "PROPERTIES", 0, "Properties", "Game Properties"},
{12, "KEYINGSET", 0, "Keying Set", "Objects included in active Keying Set"},
{13, "LAMP_TYPE", 0, "Lamp Type", "Matching lamp types"},
+ {14, "PASS_INDEX", 0, "Pass Index", "Matching object pass index"},
{0, NULL, 0, NULL, NULL}
};
@@ -677,6 +678,20 @@ static short select_similar_lamps(bContext *C, Object *ob)
CTX_DATA_END;
return changed;
}
+static short select_similar_pass_index(bContext *C, Object *ob)
+{
+ char changed = 0;
+
+ CTX_DATA_BEGIN (C, Base *, base, selectable_bases)
+ {
+ if ((base->object->index == ob->index) && !(base->flag & SELECT)) {
+ ED_base_object_select(base, BA_SELECT);
+ changed = 1;
+ }
+ }
+ CTX_DATA_END;
+ return changed;
+}
static short select_grouped_type(bContext *C, Object *ob)
{
short changed = 0;
@@ -842,7 +857,8 @@ static int object_select_grouped_exec(bContext *C, wmOperator *op)
else if (nr == 11) changed |= select_grouped_gameprops(C, ob);
else if (nr == 12) changed |= select_grouped_keyingset(C, ob);
else if (nr == 13) changed |= select_similar_lamps(C, ob);
-
+ else if (nr == 14) changed |= select_similar_pass_index(C, ob);
+
if (changed) {
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index 9dd34623739..01dcac2d1b4 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -213,7 +213,6 @@ static void object_clear_scale(Object *ob)
static int object_clear_transform_generic_exec(bContext *C, wmOperator *op,
void (*clear_func)(Object *), const char default_ksName[])
{
- Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
KeyingSet *ks;
@@ -244,8 +243,6 @@ static int object_clear_transform_generic_exec(bContext *C, wmOperator *op,
CTX_DATA_END;
/* this is needed so children are also updated */
- DAG_ids_flush_update(bmain, 0);
-
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
return OPERATOR_FINISHED;
@@ -318,7 +315,6 @@ void OBJECT_OT_scale_clear(wmOperatorType *ot)
static int object_origin_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
- Main *bmain = CTX_data_main(C);
float *v1, *v3;
float mat[3][3];
@@ -338,8 +334,6 @@ static int object_origin_clear_exec(bContext *C, wmOperator *UNUSED(op))
}
CTX_DATA_END;
- DAG_ids_flush_update(bmain, 0);
-
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
return OPERATOR_FINISHED;
@@ -424,7 +418,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
cu = ob->data;
- if (!(cu->flag & CU_3D) && (apply_rot || apply_loc)) {
+ if (((ob->type == OB_CURVE) && !(cu->flag & CU_3D)) && (apply_rot || apply_loc)) {
BKE_report(reports, RPT_ERROR,
"Neither rotation nor location could be applied to a 2D curve, doing nothing");
change = 0;
@@ -991,7 +985,6 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
DAG_id_tag_update(&tob->id, OB_RECALC_OB | OB_RECALC_DATA);
if (tot_change) {
- DAG_ids_flush_update(bmain, 0);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
}
diff --git a/source/blender/editors/physics/dynamicpaint_ops.c b/source/blender/editors/physics/dynamicpaint_ops.c
index ecc7ea4ae00..48316cfccb7 100644
--- a/source/blender/editors/physics/dynamicpaint_ops.c
+++ b/source/blender/editors/physics/dynamicpaint_ops.c
@@ -172,8 +172,8 @@ static int type_toggle_exec(bContext *C, wmOperator *op)
/* update dependency */
DAG_id_tag_update(&cObject->id, OB_RECALC_DATA);
+ DAG_relations_tag_update(CTX_data_main(C));
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, cObject);
- DAG_scene_sort(CTX_data_main(C), scene);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/physics/particle_boids.c b/source/blender/editors/physics/particle_boids.c
index dc309ec3c31..8a5f623c533 100644
--- a/source/blender/editors/physics/particle_boids.c
+++ b/source/blender/editors/physics/particle_boids.c
@@ -100,7 +100,6 @@ void BOID_OT_rule_add(wmOperatorType *ot)
static int rule_del_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain = CTX_data_main(C);
- Scene *scene = CTX_data_scene(C);
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_settings", &RNA_ParticleSettings);
ParticleSettings *part = ptr.data;
BoidRule *rule;
@@ -123,7 +122,7 @@ static int rule_del_exec(bContext *C, wmOperator *UNUSED(op))
if (rule)
rule->flag |= BOIDRULE_CURRENT;
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
DAG_id_tag_update(&part->id, OB_RECALC_DATA|PSYS_RECALC_RESET);
return OPERATOR_FINISHED;
@@ -158,7 +157,7 @@ static int rule_move_up_exec(bContext *C, wmOperator *UNUSED(op))
for (rule = state->rules.first; rule; rule=rule->next) {
if (rule->flag & BOIDRULE_CURRENT && rule->prev) {
BLI_remlink(&state->rules, rule);
- BLI_insertlink(&state->rules, rule->prev->prev, rule);
+ BLI_insertlinkbefore(&state->rules, rule->prev, rule);
DAG_id_tag_update(&part->id, OB_RECALC_DATA|PSYS_RECALC_RESET);
break;
@@ -194,7 +193,7 @@ static int rule_move_down_exec(bContext *C, wmOperator *UNUSED(op))
for (rule = state->rules.first; rule; rule=rule->next) {
if (rule->flag & BOIDRULE_CURRENT && rule->next) {
BLI_remlink(&state->rules, rule);
- BLI_insertlink(&state->rules, rule->next, rule);
+ BLI_insertlinkafter(&state->rules, rule->next, rule);
DAG_id_tag_update(&part->id, OB_RECALC_DATA|PSYS_RECALC_RESET);
break;
@@ -254,7 +253,6 @@ void BOID_OT_state_add(wmOperatorType *ot)
static int state_del_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain = CTX_data_main(C);
- Scene *scene = CTX_data_scene(C);
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_settings", &RNA_ParticleSettings);
ParticleSettings *part = ptr.data;
BoidState *state;
@@ -280,7 +278,7 @@ static int state_del_exec(bContext *C, wmOperator *UNUSED(op))
state->flag |= BOIDSTATE_CURRENT;
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
DAG_id_tag_update(&part->id, OB_RECALC_DATA|PSYS_RECALC_RESET);
return OPERATOR_FINISHED;
@@ -316,7 +314,7 @@ static int state_move_up_exec(bContext *C, wmOperator *UNUSED(op))
for (state = boids->states.first; state; state=state->next) {
if (state->flag & BOIDSTATE_CURRENT && state->prev) {
BLI_remlink(&boids->states, state);
- BLI_insertlink(&boids->states, state->prev->prev, state);
+ BLI_insertlinkbefore(&boids->states, state->prev, state);
break;
}
}
@@ -351,7 +349,7 @@ static int state_move_down_exec(bContext *C, wmOperator *UNUSED(op))
for (state = boids->states.first; state; state=state->next) {
if (state->flag & BOIDSTATE_CURRENT && state->next) {
BLI_remlink(&boids->states, state);
- BLI_insertlink(&boids->states, state->next, state);
+ BLI_insertlinkafter(&boids->states, state->next, state);
DAG_id_tag_update(&part->id, OB_RECALC_DATA|PSYS_RECALC_RESET);
break;
}
diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c
index 23069ab8a08..5fd2a0806e9 100644
--- a/source/blender/editors/physics/particle_object.c
+++ b/source/blender/editors/physics/particle_object.c
@@ -151,7 +151,6 @@ static int psys_poll(bContext *C)
static int new_particle_settings_exec(bContext *C, wmOperator *UNUSED(op))
{
- Scene *scene = CTX_data_scene(C);
Main *bmain= CTX_data_main(C);
ParticleSystem *psys;
ParticleSettings *part = NULL;
@@ -177,7 +176,7 @@ static int new_particle_settings_exec(bContext *C, wmOperator *UNUSED(op))
psys_check_boid_data(psys);
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
@@ -205,7 +204,6 @@ void PARTICLE_OT_new(wmOperatorType *ot)
static int new_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain = CTX_data_main(C);
- Scene *scene = CTX_data_scene(C);
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
ParticleSystem *psys= ptr.data;
Object *ob = ptr.id.data;
@@ -226,7 +224,7 @@ static int new_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
BLI_addtail(&psys->targets, pt);
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
@@ -251,7 +249,6 @@ void PARTICLE_OT_new_target(wmOperatorType *ot)
static int remove_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain = CTX_data_main(C);
- Scene *scene = CTX_data_scene(C);
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
ParticleSystem *psys= ptr.data;
Object *ob = ptr.id.data;
@@ -275,7 +272,7 @@ static int remove_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
if (pt)
pt->flag |= PTARGET_CURRENT;
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
@@ -313,7 +310,7 @@ static int target_move_up_exec(bContext *C, wmOperator *UNUSED(op))
for (; pt; pt=pt->next) {
if (pt->flag & PTARGET_CURRENT && pt->prev) {
BLI_remlink(&psys->targets, pt);
- BLI_insertlink(&psys->targets, pt->prev->prev, pt);
+ BLI_insertlinkbefore(&psys->targets, pt->prev, pt);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
@@ -351,7 +348,7 @@ static int target_move_down_exec(bContext *C, wmOperator *UNUSED(op))
for (; pt; pt=pt->next) {
if (pt->flag & PTARGET_CURRENT && pt->next) {
BLI_remlink(&psys->targets, pt);
- BLI_insertlink(&psys->targets, pt->next, pt);
+ BLI_insertlinkafter(&psys->targets, pt->next, pt);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
@@ -390,7 +387,7 @@ static int dupliob_move_up_exec(bContext *C, wmOperator *UNUSED(op))
for (dw=part->dupliweights.first; dw; dw=dw->next) {
if (dw->flag & PART_DUPLIW_CURRENT && dw->prev) {
BLI_remlink(&part->dupliweights, dw);
- BLI_insertlink(&part->dupliweights, dw->prev->prev, dw);
+ BLI_insertlinkbefore(&part->dupliweights, dw->prev, dw);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, NULL);
break;
@@ -512,7 +509,7 @@ static int dupliob_move_down_exec(bContext *C, wmOperator *UNUSED(op))
for (dw=part->dupliweights.first; dw; dw=dw->next) {
if (dw->flag & PART_DUPLIW_CURRENT && dw->next) {
BLI_remlink(&part->dupliweights, dw);
- BLI_insertlink(&part->dupliweights, dw->next, dw);
+ BLI_insertlinkafter(&part->dupliweights, dw->next, dw);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, NULL);
break;
diff --git a/source/blender/editors/physics/rigidbody_constraint.c b/source/blender/editors/physics/rigidbody_constraint.c
index a72a409f277..b3f92d3de46 100644
--- a/source/blender/editors/physics/rigidbody_constraint.c
+++ b/source/blender/editors/physics/rigidbody_constraint.c
@@ -96,6 +96,8 @@ void ED_rigidbody_con_add(wmOperator *op, Scene *scene, Object *ob, int type)
/* add constraint to rigid body constraint group */
add_to_group(rbw->constraints, ob, scene, NULL);
+
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB);
}
void ED_rigidbody_con_remove(Scene *scene, Object *ob)
@@ -130,8 +132,6 @@ static int rigidbody_con_add_exec(bContext *C, wmOperator *op)
ED_rigidbody_con_add(op, scene, ob, type);
/* send updates */
- DAG_ids_flush_update(CTX_data_main(C), 0);
-
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
/* done */
@@ -177,8 +177,6 @@ static int rigidbody_con_remove_exec(bContext *C, wmOperator *op)
}
/* send updates */
- DAG_ids_flush_update(CTX_data_main(C), 0);
-
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
/* done */
diff --git a/source/blender/editors/physics/rigidbody_object.c b/source/blender/editors/physics/rigidbody_object.c
index 2bf962f4f4a..6bcdf6e07aa 100644
--- a/source/blender/editors/physics/rigidbody_object.c
+++ b/source/blender/editors/physics/rigidbody_object.c
@@ -151,8 +151,6 @@ static int rigidbody_ob_add_exec(bContext *C, wmOperator *op)
ED_rigidbody_ob_add(op, scene, ob, type);
/* send updates */
- DAG_ids_flush_update(CTX_data_main(C), 0);
-
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
/* done */
@@ -197,8 +195,6 @@ static int rigidbody_ob_remove_exec(bContext *C, wmOperator *op)
ED_rigidbody_ob_remove(scene, ob);
/* send updates */
- DAG_ids_flush_update(CTX_data_main(C), 0);
-
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
/* done */
@@ -242,8 +238,6 @@ static int rigidbody_obs_add_exec(bContext *C, wmOperator *op)
CTX_DATA_END;
/* send updates */
- DAG_ids_flush_update(CTX_data_main(C), 0);
-
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_POINTCACHE, NULL);
@@ -289,8 +283,6 @@ static int rigidbody_obs_remove_exec(bContext *C, wmOperator *UNUSED(op))
CTX_DATA_END;
/* send updates */
- DAG_ids_flush_update(CTX_data_main(C), 0);
-
WM_event_add_notifier(C, NC_OBJECT | ND_POINTCACHE, NULL);
/* done */
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index 7ba6a92e4be..ea18f2c8fbb 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -264,7 +264,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
/* sequencer has got tricker ocnversion happened above */
IMB_buffer_float_from_float(rr->rectf, rr->rectf,
- 4, IB_PROFILE_LINEAR_RGB, IB_PROFILE_SRGB, FALSE,
+ 4, IB_PROFILE_LINEAR_RGB, IB_PROFILE_SRGB, TRUE,
oglrender->sizex, oglrender->sizey, oglrender->sizex, oglrender->sizex);
}
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 8afe07b4689..46f726e45c6 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -446,7 +446,7 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
glClear(GL_COLOR_BUFFER_BIT);
UI_ThemeColor(TH_TEXT);
- BLF_draw_default(20, 8, 0.0f, ar->headerstr, BLF_DRAW_STR_DUMMY_MAX);
+ BLF_draw_default(UI_UNIT_X, 0.4f * UI_UNIT_Y, 0.0f, ar->headerstr, BLF_DRAW_STR_DUMMY_MAX);
}
else if (at->draw) {
at->draw(C, ar);
@@ -1965,11 +1965,13 @@ void ED_region_visible_rect(ARegion *ar, rcti *rect)
for (; arn; arn = arn->next) {
if (ar != arn && arn->overlap) {
if (BLI_rcti_isect(rect, &arn->winrct, NULL)) {
- /* overlap left */
- if (rect->xmin == arn->winrct.xmin)
+
+ /* overlap left, also check 1 pixel offset (2 regions on one side) */
+ if ( ABS(rect->xmin - arn->winrct.xmin) < 2)
rect->xmin = arn->winrct.xmax;
+
/* overlap right */
- if (rect->xmax == arn->winrct.xmax)
+ if ( ABS(rect->xmax - arn->winrct.xmax) < 2)
rect->xmax = arn->winrct.xmin;
}
}
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 1f8c06f6bf7..edeb66d9281 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -5035,7 +5035,7 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps)
ps->is_texbrush = false;
}
- /* sizeof ProjPixel, since we alloc this a _lot_ */
+ /* sizeof(ProjPixel), since we alloc this a _lot_ */
ps->pixel_sizeof = project_paint_pixel_sizeof(ps->tool);
BLI_assert(ps->pixel_sizeof >= sizeof(ProjPixel));
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 10f4dc2aebc..342671698d2 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -441,7 +441,12 @@ static void paint_mesh_restore_co(Sculpt *sd, Object *ob)
SculptUndoType type = (brush->sculpt_tool == SCULPT_TOOL_MASK ?
SCULPT_UNDO_MASK : SCULPT_UNDO_COORDS);
- unode = sculpt_undo_push_node(ob, nodes[n], type);
+ if (ss->bm) {
+ unode = sculpt_undo_push_node(ob, nodes[n], type);
+ }
+ else {
+ unode = sculpt_undo_get_node(nodes[n]);
+ }
if (unode) {
PBVHVertexIter vd;
SculptOrigVertData orig_data;
@@ -878,7 +883,7 @@ static float brush_strength(Sculpt *sd, StrokeCache *cache, float feather)
/* Return a multiplier for brush strength on a particular vertex. */
static float tex_strength(SculptSession *ss, Brush *br,
- const float point[3],
+ const float point[3],
const float len,
const float sculpt_normal[3],
const short vno[3],
@@ -1406,8 +1411,8 @@ static float bmesh_neighbor_average_mask(BMesh *bm, BMVert *v)
for (i = 0; i < 3; i++) {
BMVert *v2 = adj_v[i];
float *vmask = CustomData_bmesh_get(&bm->vdata,
- v2->head.data,
- CD_PAINT_MASK);
+ v2->head.data,
+ CD_PAINT_MASK);
avg += (*vmask);
total++;
}
@@ -1418,8 +1423,8 @@ static float bmesh_neighbor_average_mask(BMesh *bm, BMVert *v)
}
else {
float *vmask = CustomData_bmesh_get(&bm->vdata,
- v->head.data,
- CD_PAINT_MASK);
+ v->head.data,
+ CD_PAINT_MASK);
return (*vmask);
}
}
@@ -1933,11 +1938,11 @@ static void do_grab_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
if (sculpt_brush_test(&test, orig_data.co)) {
const float fade = bstrength * tex_strength(ss, brush,
- orig_data.co,
- test.dist,
+ orig_data.co,
+ test.dist,
ss->cache->sculpt_normal_symm,
- orig_data.no,
- NULL, vd.mask ? *vd.mask : 0.0f);
+ orig_data.no,
+ NULL, vd.mask ? *vd.mask : 0.0f);
mul_v3_v3fl(proxy[vd.i], grab_delta, fade);
@@ -2072,11 +2077,11 @@ static void do_thumb_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
if (sculpt_brush_test(&test, orig_data.co)) {
const float fade = bstrength * tex_strength(ss, brush,
- orig_data.co,
- test.dist,
+ orig_data.co,
+ test.dist,
ss->cache->sculpt_normal_symm,
orig_data.no,
- NULL, vd.mask ? *vd.mask : 0.0f);
+ NULL, vd.mask ? *vd.mask : 0.0f);
mul_v3_v3fl(proxy[vd.i], cono, fade);
@@ -2130,7 +2135,7 @@ static void do_rotate_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
test.dist,
ss->cache->sculpt_normal_symm,
orig_data.no,
- NULL, vd.mask ? *vd.mask : 0.0f);
+ NULL, vd.mask ? *vd.mask : 0.0f);
mul_v3_m4v3(proxy[vd.i], m, orig_data.co);
sub_v3_v3(proxy[vd.i], orig_data.co);
@@ -3000,7 +3005,7 @@ static void sculpt_topology_update(Sculpt *sd, Object *ob, Brush *brush)
if (BKE_pbvh_type(ss->pbvh) == PBVH_BMESH) {
BKE_pbvh_bmesh_update_topology(ss->pbvh, mode,
- ss->cache->location,
+ ss->cache->location,
ss->cache->radius);
}
@@ -3153,7 +3158,7 @@ static void sculpt_combine_proxies(Sculpt *sd, Object *ob)
PBVHVertexIter vd;
PBVHProxyNode *proxies;
int proxy_count;
- float (*orco)[3];
+ float (*orco)[3] = NULL;
if (use_orco && !ss->bm)
orco = sculpt_undo_push_node(ob, nodes[n], SCULPT_UNDO_COORDS)->co;
@@ -3308,7 +3313,7 @@ static void calc_brushdata_symm(Sculpt *sd, StrokeCache *cache, const char symm,
typedef void (*BrushActionFunc)(Sculpt *sd, Object *ob, Brush *brush);
static void do_radial_symmetry(Sculpt *sd, Object *ob, Brush *brush,
- BrushActionFunc action,
+ BrushActionFunc action,
const char symm, const int axis,
const float feather)
{
@@ -4072,7 +4077,7 @@ static void sculpt_raycast_cb(PBVHNode *node, void *data_v, float *tmin)
}
if (BKE_pbvh_node_raycast(srd->ss->pbvh, node, origco, use_origco,
- srd->ray_start, srd->ray_normal, &srd->dist))
+ srd->ray_start, srd->ray_normal, &srd->dist))
{
srd->hit = 1;
*tmin = srd->dist;
@@ -4660,24 +4665,25 @@ static int sculpt_dynamic_topology_toggle_exec(bContext *C, wmOperator *UNUSED(o
}
static int sculpt_dynamic_topology_toggle_invoke(bContext *C, wmOperator *op,
- wmEvent *UNUSED(event))
+ wmEvent *UNUSED(event))
{
Object *ob = CTX_data_active_object(C);
Mesh *me = ob->data;
SculptSession *ss = ob->sculpt;
const char *msg = "Dynamic-topology sculpting will not preserve"
- "vertex colors, UVs, or other customdata";
+ "vertex colors, UVs, or other customdata";
if (!ss->bm) {
int i;
for (i = 0; i < CD_NUMTYPES; i++) {
if (!ELEM7(i, CD_MVERT, CD_MEDGE, CD_MFACE,
- CD_MLOOP, CD_MPOLY, CD_PAINT_MASK,
- CD_ORIGINDEX) &&
- (CustomData_has_layer(&me->vdata, i) ||
- CustomData_has_layer(&me->edata, i) ||
- CustomData_has_layer(&me->fdata, i))) {
+ CD_MLOOP, CD_MPOLY, CD_PAINT_MASK,
+ CD_ORIGINDEX) &&
+ (CustomData_has_layer(&me->vdata, i) ||
+ CustomData_has_layer(&me->edata, i) ||
+ CustomData_has_layer(&me->fdata, i)))
+ {
/* The mesh has customdata that will be lost, let the
* user confirm this is OK */
return WM_operator_confirm_message(C, op, msg);
@@ -4758,8 +4764,8 @@ static int sculpt_symmetrize_exec(bContext *C, wmOperator *UNUSED(op))
/* Symmetrize and re-triangulate */
BMO_op_callf(ss->bm, BMO_FLAG_DEFAULTS,
- "symmetrize input=%avef direction=%i",
- sd->symmetrize_direction);
+ "symmetrize input=%avef direction=%i",
+ sd->symmetrize_direction);
sculpt_dynamic_topology_triangulate(ss->bm);
/* Finish undo */
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index 91f069d16de..95d43fd334e 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -36,6 +36,8 @@
#include "BLI_listbase.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "DNA_armature_types.h"
#include "DNA_lamp_types.h"
#include "DNA_material_types.h"
@@ -1029,7 +1031,8 @@ void buttons_context_draw(const bContext *C, uiLayout *layout)
block = uiLayoutGetBlock(row);
uiBlockSetEmboss(block, UI_EMBOSSN);
- but = uiDefIconButBitC(block, ICONTOG, SB_PIN_CONTEXT, 0, ICON_UNPINNED, 0, 0, UI_UNIT_X, UI_UNIT_Y, &sbuts->flag, 0, 0, 0, 0, "Follow context or keep fixed datablock displayed");
+ but = uiDefIconButBitC(block, ICONTOG, SB_PIN_CONTEXT, 0, ICON_UNPINNED, 0, 0, UI_UNIT_X, UI_UNIT_Y, &sbuts->flag,
+ 0, 0, 0, 0, IFACE_("Follow context or keep fixed datablock displayed"));
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
uiButSetFunc(but, pin_cb, NULL, NULL);
@@ -1069,7 +1072,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, "Context");
+ strcpy(pt->label, N_("Context")); /* XXX C panels are not available through RNA (bpy.types)! */
pt->draw = buttons_panel_context;
pt->flag = PNL_NO_HEADER;
BLI_addtail(&art->paneltypes, pt);
diff --git a/source/blender/editors/space_clip/CMakeLists.txt b/source/blender/editors/space_clip/CMakeLists.txt
index 75e3d8d5685..e09a8b41262 100644
--- a/source/blender/editors/space_clip/CMakeLists.txt
+++ b/source/blender/editors/space_clip/CMakeLists.txt
@@ -57,4 +57,8 @@ set(SRC
clip_intern.h
)
+if(WITH_INTERNATIONAL)
+ add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
blender_add_lib(bf_editor_space_clip "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_clip/SConscript b/source/blender/editors/space_clip/SConscript
index 2cbefee0170..c65a076186f 100644
--- a/source/blender/editors/space_clip/SConscript
+++ b/source/blender/editors/space_clip/SConscript
@@ -32,4 +32,7 @@ defs = []
incs = '../include ../../blenkernel ../../blenloader ../../blenfont ../../blenlib ../../imbuf ../../makesdna'
incs += ' ../../makesrna ../../windowmanager #/intern/guardedalloc #/extern/glew/include ../../gpu'
+if env['WITH_BF_INTERNATIONAL']:
+ defs.append('WITH_INTERNATIONAL')
+
env.BlenderLib ( 'bf_editors_space_clip', sources, Split(incs), defs, libtype=['core'], priority=[95] )
diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c
index 2cb6d8c9234..b2d31ececa5 100644
--- a/source/blender/editors/space_clip/clip_buttons.c
+++ b/source/blender/editors/space_clip/clip_buttons.c
@@ -43,6 +43,8 @@
#include "BLI_listbase.h"
#include "BLI_rect.h"
+#include "BLF_translation.h"
+
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_screen.h"
@@ -124,7 +126,7 @@ void uiTemplateMovieClip(uiLayout *layout, bContext *C, PointerRNA *ptr, const c
row = uiLayoutRow(layout, FALSE);
block = uiLayoutGetBlock(row);
- uiDefBut(block, LABEL, 0, "File Path:", 0, 19, 145, 19, NULL, 0, 0, 0, 0, "");
+ uiDefBut(block, LABEL, 0, IFACE_("File Path:"), 0, 19, 145, 19, NULL, 0, 0, 0, 0, "");
row = uiLayoutRow(layout, FALSE);
split = uiLayoutSplit(row, 0.0f, FALSE);
@@ -167,16 +169,16 @@ void uiTemplateTrack(uiLayout *layout, PointerRNA *ptr, const char *propname)
scopesptr = RNA_property_pointer_get(ptr, prop);
scopes = (MovieClipScopes *)scopesptr.data;
- rect.xmin = 0; rect.xmax = 200;
- rect.ymin = 0; rect.ymax = 120;
+ rect.xmin = 0; rect.xmax = 10.0f * UI_UNIT_X;
+ rect.ymin = 0; rect.ymax = 6.0f * UI_UNIT_Y;
block = uiLayoutAbsoluteBlock(layout);
scopes->track_preview_height =
- (scopes->track_preview_height <= UI_UNIT_Y) ? UI_UNIT_Y : scopes->track_preview_height;
+ (scopes->track_preview_height <= 20) ? 20 : scopes->track_preview_height;
uiDefBut(block, TRACKPREVIEW, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect),
- scopes->track_preview_height, scopes, 0, 0, 0, 0, "");
+ scopes->track_preview_height * UI_DPI_FAC, scopes, 0, 0, 0, 0, "");
}
/********************* Marker Template ************************/
@@ -387,11 +389,11 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P
block = uiLayoutGetBlock(layout);
if (cb->marker_flag & MARKER_DISABLED)
- tip = "Marker is disabled at current frame";
+ tip = TIP_("Marker is disabled at current frame");
else
- tip = "Marker is enabled at current frame";
+ tip = TIP_("Marker is enabled at current frame");
- bt = uiDefIconButBitI(block, TOGN, MARKER_DISABLED, 0, ICON_RESTRICT_VIEW_OFF, 0, 0, 20, 20,
+ bt = uiDefIconButBitI(block, TOGN, MARKER_DISABLED, 0, ICON_RESTRICT_VIEW_OFF, 0, 0, UI_UNIT_X, UI_UNIT_Y,
&cb->marker_flag, 0, 0, 1, 0, tip);
uiButSetNFunc(bt, marker_update_cb, cb, NULL);
}
@@ -405,7 +407,7 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P
if (track->flag & TRACK_LOCKED) {
uiLayoutSetActive(layout, FALSE);
block = uiLayoutAbsoluteBlock(layout);
- uiDefBut(block, LABEL, 0, "Track is locked", 0, 0, 300, 19, NULL, 0, 0, 0, 0, "");
+ uiDefBut(block, LABEL, 0, IFACE_("Track is locked"), 0, 0, UI_UNIT_X*15.0f, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
return;
}
@@ -434,12 +436,12 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P
uiBlockSetNFunc(block, marker_update_cb, cb, NULL);
if (cb->marker_flag & MARKER_DISABLED)
- tip = "Marker is disabled at current frame";
+ tip = TIP_("Marker is disabled at current frame");
else
- tip = "Marker is enabled at current frame";
+ tip = TIP_("Marker is enabled at current frame");
- uiDefButBitI(block, OPTIONN, MARKER_DISABLED, B_MARKER_FLAG, "Enabled", 10, 190, 145, 19, &cb->marker_flag,
- 0, 0, 0, 0, tip);
+ uiDefButBitI(block, OPTIONN, MARKER_DISABLED, B_MARKER_FLAG, IFACE_("Enabled"), 10, 190, 145, 19,
+ &cb->marker_flag, 0, 0, 0, 0, tip);
col = uiLayoutColumn(layout, TRUE);
uiLayoutSetActive(col, (cb->marker_flag & MARKER_DISABLED) == 0);
@@ -447,33 +449,34 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P
block = uiLayoutAbsoluteBlock(col);
uiBlockBeginAlign(block);
- uiDefBut(block, LABEL, 0, "Position:", 0, 190, 300, 19, NULL, 0, 0, 0, 0, "");
- uiDefButF(block, NUM, B_MARKER_POS, "X:", 10, 171, 145, 19, &cb->marker_pos[0],
- -10 * width, 10.0 * width, step, digits, "X-position of marker at frame in screen coordinates");
- uiDefButF(block, NUM, B_MARKER_POS, "Y:", 165, 171, 145, 19, &cb->marker_pos[1],
- -10 * height, 10.0 * height, step, digits, "Y-position of marker at frame in screen coordinates");
-
- uiDefBut(block, LABEL, 0, "Offset:", 0, 152, 300, 19, NULL, 0, 0, 0, 0, "");
- uiDefButF(block, NUM, B_MARKER_OFFSET, "X:", 10, 133, 145, 19, &cb->track_offset[0],
- -10 * width, 10.0 * width, step, digits, "X-offset to parenting point");
- uiDefButF(block, NUM, B_MARKER_OFFSET, "Y:", 165, 133, 145, 19, &cb->track_offset[1],
- -10 * height, 10.0 * height, step, digits, "Y-offset to parenting point");
-
- uiDefBut(block, LABEL, 0, "Pattern Area:", 0, 114, 300, 19, NULL, 0, 0, 0, 0, "");
- uiDefButF(block, NUM, B_MARKER_PAT_DIM, "Width:", 10, 95, 300, 19, &cb->marker_pat[0], 3.0f,
- 10.0 * width, step, digits, "Width of marker's pattern in screen coordinates");
- uiDefButF(block, NUM, B_MARKER_PAT_DIM, "Height:", 10, 76, 300, 19, &cb->marker_pat[1], 3.0f,
- 10.0 * height, step, digits, "Height of marker's pattern in screen coordinates");
-
- uiDefBut(block, LABEL, 0, "Search Area:", 0, 57, 300, 19, NULL, 0, 0, 0, 0, "");
- uiDefButF(block, NUM, B_MARKER_SEARCH_POS, "X:", 10, 38, 145, 19, &cb->marker_search_pos[0],
- -width, width, step, digits, "X-position of search at frame relative to marker's position");
- uiDefButF(block, NUM, B_MARKER_SEARCH_POS, "Y:", 165, 38, 145, 19, &cb->marker_search_pos[1],
- -height, height, step, digits, "X-position of search at frame relative to marker's position");
- uiDefButF(block, NUM, B_MARKER_SEARCH_DIM, "Width:", 10, 19, 300, 19, &cb->marker_search[0], 3.0f,
- 10.0 * width, step, digits, "Width of marker's search in screen soordinates");
- uiDefButF(block, NUM, B_MARKER_SEARCH_DIM, "Height:", 10, 0, 300, 19, &cb->marker_search[1], 3.0f,
- 10.0 * height, step, digits, "Height of marker's search in screen soordinates");
+ uiDefBut(block, LABEL, 0, IFACE_("Position:"), 0, 190, 300, 19, NULL, 0, 0, 0, 0, "");
+ uiDefButF(block, NUM, B_MARKER_POS, IFACE_("X:"), 10, 171, 145, 19, &cb->marker_pos[0],
+ -10 * width, 10.0 * width, step, digits, TIP_("X-position of marker at frame in screen coordinates"));
+ uiDefButF(block, NUM, B_MARKER_POS, IFACE_("Y:"), 165, 171, 145, 19, &cb->marker_pos[1],
+ -10 * height, 10.0 * height, step, digits,
+ TIP_("Y-position of marker at frame in screen coordinates"));
+
+ uiDefBut(block, LABEL, 0, IFACE_("Offset:"), 0, 152, 300, 19, NULL, 0, 0, 0, 0, "");
+ uiDefButF(block, NUM, B_MARKER_OFFSET, IFACE_("X:"), 10, 133, 145, 19, &cb->track_offset[0],
+ -10 * width, 10.0 * width, step, digits, TIP_("X-offset to parenting point"));
+ uiDefButF(block, NUM, B_MARKER_OFFSET, IFACE_("Y:"), 165, 133, 145, 19, &cb->track_offset[1],
+ -10 * height, 10.0 * height, step, digits, TIP_("Y-offset to parenting point"));
+
+ uiDefBut(block, LABEL, 0, IFACE_("Pattern Area:"), 0, 114, 300, 19, NULL, 0, 0, 0, 0, "");
+ uiDefButF(block, NUM, B_MARKER_PAT_DIM, IFACE_("Width:"), 10, 95, 300, 19, &cb->marker_pat[0], 3.0f,
+ 10.0 * width, step, digits, TIP_("Width of marker's pattern in screen coordinates"));
+ uiDefButF(block, NUM, B_MARKER_PAT_DIM, IFACE_("Height:"), 10, 76, 300, 19, &cb->marker_pat[1], 3.0f,
+ 10.0 * height, step, digits, TIP_("Height of marker's pattern in screen coordinates"));
+
+ uiDefBut(block, LABEL, 0, IFACE_("Search Area:"), 0, 57, 300, 19, NULL, 0, 0, 0, 0, "");
+ uiDefButF(block, NUM, B_MARKER_SEARCH_POS, IFACE_("X:"), 10, 38, 145, 19, &cb->marker_search_pos[0],
+ -width, width, step, digits, TIP_("X-position of search at frame relative to marker's position"));
+ uiDefButF(block, NUM, B_MARKER_SEARCH_POS, IFACE_("Y:"), 165, 38, 145, 19, &cb->marker_search_pos[1],
+ -height, height, step, digits, TIP_("Y-position of search at frame relative to marker's position"));
+ uiDefButF(block, NUM, B_MARKER_SEARCH_DIM, IFACE_("Width:"), 10, 19, 300, 19, &cb->marker_search[0], 3.0f,
+ 10.0 * width, step, digits, TIP_("Width of marker's search in screen coordinates"));
+ uiDefButF(block, NUM, B_MARKER_SEARCH_DIM, IFACE_("Height:"), 10, 0, 300, 19, &cb->marker_search[1], 3.0f,
+ 10.0 * height, step, digits, TIP_("Height of marker's search in screen coordinates"));
uiBlockEndAlign(block);
}
diff --git a/source/blender/editors/space_clip/clip_dopesheet_draw.c b/source/blender/editors/space_clip/clip_dopesheet_draw.c
index 09d97c36436..b1be9217819 100644
--- a/source/blender/editors/space_clip/clip_dopesheet_draw.c
+++ b/source/blender/editors/space_clip/clip_dopesheet_draw.c
@@ -145,6 +145,31 @@ static void draw_keyframe_shape(float x, float y, float xscale, float yscale, sh
glPopMatrix();
}
+static void clip_draw_dopesheet_background(ARegion *ar, MovieClip *clip)
+{
+ View2D *v2d = &ar->v2d;
+ MovieTracking *tracking = &clip->tracking;
+ MovieTrackingDopesheet *dopesheet = &tracking->dopesheet;
+ MovieTrackingDopesheetCoverageSegment *coverage_segment;
+
+ for (coverage_segment = dopesheet->coverage_segments.first;
+ coverage_segment;
+ coverage_segment = coverage_segment->next)
+ {
+ if (coverage_segment->coverage < TRACKING_COVERAGE_OK) {
+ int start_frame = BKE_movieclip_remap_clip_to_scene_frame(clip, coverage_segment->start_frame);
+ int end_frame = BKE_movieclip_remap_clip_to_scene_frame(clip, coverage_segment->end_frame);
+
+ if (coverage_segment->coverage == TRACKING_COVERAGE_BAD)
+ glColor4f(1.0f, 0.0f, 0.0f, 0.07f);
+ else
+ glColor4f(1.0f, 1.0f, 0.0f, 0.07f);
+
+ glRectf(start_frame, v2d->cur.ymin, end_frame, v2d->cur.ymax);
+ }
+ }
+}
+
void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene)
{
MovieClip *clip = ED_space_clip_get_clip(sc);
@@ -179,6 +204,8 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene)
glEnable(GL_BLEND);
+ clip_draw_dopesheet_background(ar, clip);
+
for (channel = dopesheet->channels.first; channel; channel = channel->next) {
float yminc = (float) (y - CHANNEL_HEIGHT_HALF);
float ymaxc = (float) (y + CHANNEL_HEIGHT_HALF);
diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c
index 927834a8924..728110dfeee 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -618,7 +618,7 @@ int ED_space_clip_load_movieclip_buffer(SpaceClip *sc, ImBuf *ibuf, const unsign
context->last_texture = glaGetOneInteger(GL_TEXTURE_2D);
/* image texture need to be rebinded if displaying another image buffer
- * assuming displaying happens of footage frames only on which painting doesn't heppen.
+ * assuming displaying happens of footage frames only on which painting doesn't happen.
* so not changed image buffer pointer means unchanged image content */
need_rebind |= context->texture_ibuf != ibuf;
need_rebind |= context->display_buffer != display_buffer;
diff --git a/source/blender/editors/space_clip/clip_toolbar.c b/source/blender/editors/space_clip/clip_toolbar.c
index ad70abf5732..7543988b5aa 100644
--- a/source/blender/editors/space_clip/clip_toolbar.c
+++ b/source/blender/editors/space_clip/clip_toolbar.c
@@ -33,11 +33,15 @@
#include "DNA_windowmanager_types.h"
+#include "RNA_access.h"
+
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "BKE_context.h"
#include "BKE_screen.h"
@@ -197,16 +201,16 @@ static void clip_panel_operator_redo_header(const bContext *C, Panel *pa)
wmOperator *op = WM_operator_last_redo(C);
if (op)
- BLI_strncpy(pa->drawname, op->type->name, sizeof(pa->drawname));
+ BLI_strncpy(pa->drawname, RNA_struct_ui_name(op->type->srna), sizeof(pa->drawname));
else
- BLI_strncpy(pa->drawname, "Operator", sizeof(pa->drawname));
+ BLI_strncpy(pa->drawname, IFACE_("Operator"), sizeof(pa->drawname));
}
static void clip_panel_operator_redo_operator(const bContext *C, Panel *pa, wmOperator *op)
{
if (op->type->flag & OPTYPE_MACRO) {
for (op = op->macro.first; op; op = op->next) {
- uiItemL(pa->layout, op->type->name, ICON_NONE);
+ uiItemL(pa->layout, RNA_struct_ui_name(op->type->srna), ICON_NONE);
clip_panel_operator_redo_operator(C, pa, op);
}
}
diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c
index 56a890c714a..77ed197c1d7 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -1105,7 +1105,7 @@ static void track_markers_startjob(void *tmv, short *stop, short *do_update, flo
{
TrackMarkersJob *tmj = (TrackMarkersJob *)tmv;
int framenr = tmj->sfra;
- //double t = PIL_check_seconds_timer();
+ // double t = PIL_check_seconds_timer();
while (framenr != tmj->efra) {
if (tmj->delay > 0) {
@@ -1141,7 +1141,7 @@ static void track_markers_startjob(void *tmv, short *stop, short *do_update, flo
break;
}
- //printf("Tracking time: %lf\n", PIL_check_seconds_timer()-t);
+ // printf("Tracking time: %lf\n", PIL_check_seconds_timer()-t);
}
static void track_markers_updatejob(void *tmv)
diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c
index c195cb39157..73747239255 100644
--- a/source/blender/editors/space_console/console_draw.c
+++ b/source/blender/editors/space_console/console_draw.c
@@ -193,6 +193,10 @@ static int console_textview_line_color(struct TextViewContext *tvc, unsigned cha
return TVC_LINE_FG;
}
+static void console_textview_const_colors(TextViewContext *UNUSED(tvc), unsigned char bg_sel[4])
+{
+ UI_GetThemeColor4ubv(TH_CONSOLE_SELECT, bg_sel);
+}
static int console_textview_main__internal(struct SpaceConsole *sc, ARegion *ar, int draw,
int mval[2], void **mouse_pick, int *pos_pick)
@@ -210,6 +214,7 @@ static int console_textview_main__internal(struct SpaceConsole *sc, ARegion *ar,
tvc.step = console_textview_step;
tvc.line_get = console_textview_line_get;
tvc.line_color = console_textview_line_color;
+ tvc.const_colors = console_textview_const_colors;
tvc.arg1 = sc;
tvc.arg2 = NULL;
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index 483348db18e..ab16a9d55e6 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -383,10 +383,7 @@ static void do_graph_region_driver_buttons(bContext *C, void *UNUSED(arg), int e
case B_IPO_DEPCHANGE:
{
/* rebuild depsgraph for the new deps */
- DAG_scene_sort(bmain, scene);
-
- /* force an update of depsgraph */
- DAG_ids_flush_update(bmain, 0);
+ DAG_relations_tag_update(bmain);
}
break;
}
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 2d2d29d9eaa..dc834d88323 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -1084,7 +1084,7 @@ void IMAGE_OT_match_movie_length(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Match Movie Length";
- ot->description = "Set image's users length to the one of this video";
+ ot->description = "Set image's user's length to the one of this video";
ot->idname = "IMAGE_OT_match_movie_length";
/* api callbacks */
@@ -1777,7 +1777,7 @@ static int image_new_exec(bContext *C, wmOperator *op)
/* XXX Note: the WM_operator_props_dialog_popup() doesn't work for uiIDContextProperty(), image is not being that way */
static int image_new_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
- return WM_operator_props_dialog_popup(C, op, 300, 100);
+ return WM_operator_props_dialog_popup(C, op, 15 * UI_UNIT_X, 5 * UI_UNIT_Y);
}
diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c
index 54afc9a0849..a748c303b5d 100644
--- a/source/blender/editors/space_info/info_draw.c
+++ b/source/blender/editors/space_info/info_draw.c
@@ -251,7 +251,8 @@ static int report_textview_line_color(struct TextViewContext *tvc, unsigned char
#undef USE_INFO_NEWLINE
-static int info_textview_main__internal(struct SpaceInfo *sinfo, ARegion *ar, ReportList *reports, int draw, int mval[2], void **mouse_pick, int *pos_pick)
+static int info_textview_main__internal(struct SpaceInfo *sinfo, ARegion *ar, ReportList *reports,
+ int draw, int mval[2], void **mouse_pick, int *pos_pick)
{
int ret = 0;
@@ -264,6 +265,7 @@ static int info_textview_main__internal(struct SpaceInfo *sinfo, ARegion *ar, Re
tvc.step = report_textview_step;
tvc.line_get = report_textview_line_get;
tvc.line_color = report_textview_line_color;
+ tvc.const_colors = NULL;
tvc.arg1 = sinfo;
tvc.arg2 = reports;
diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c
index 976769752f9..5a8a77f7350 100644
--- a/source/blender/editors/space_info/info_stats.c
+++ b/source/blender/editors/space_info/info_stats.c
@@ -367,9 +367,9 @@ static void stats_string(Scene *scene)
mmap_in_use = MEM_get_mapped_memory_in_use();
/* get memory statistics */
- s = memstr + sprintf(memstr, IFACE_(" | Mem:%.2fM"), (double)((mem_in_use - mmap_in_use) >> 10) / 1024.0);
+ s = memstr + sprintf(memstr, " | Mem:%.2fM", (double)((mem_in_use - mmap_in_use) >> 10) / 1024.0);
if (mmap_in_use)
- sprintf(s, IFACE_(" (%.2fM)"), (double)((mmap_in_use) >> 10) / 1024.0);
+ sprintf(s, " (%.2fM)", (double)((mmap_in_use) >> 10) / 1024.0);
s = stats->infostr;
@@ -377,32 +377,32 @@ static void stats_string(Scene *scene)
if (scene->obedit) {
if (BKE_keyblock_from_object(scene->obedit))
- s += sprintf(s, IFACE_("(Key) "));
+ s += sprintf(s, "(Key) ");
if (scene->obedit->type == OB_MESH) {
- s += sprintf(s, IFACE_("Verts:%d/%d | Edges:%d/%d | Faces:%d/%d | Tris:%d"),
+ s += sprintf(s, "Verts:%d/%d | Edges:%d/%d | Faces:%d/%d | Tris:%d",
stats->totvertsel, stats->totvert, stats->totedgesel, stats->totedge, stats->totfacesel,
stats->totface, stats->tottri);
}
else if (scene->obedit->type == OB_ARMATURE) {
- s += sprintf(s, IFACE_("Verts:%d/%d | Bones:%d/%d"), stats->totvertsel, stats->totvert, stats->totbonesel,
+ s += sprintf(s, "Verts:%d/%d | Bones:%d/%d", stats->totvertsel, stats->totvert, stats->totbonesel,
stats->totbone);
}
else {
- s += sprintf(s, IFACE_("Verts:%d/%d"), stats->totvertsel, stats->totvert);
+ s += sprintf(s, "Verts:%d/%d", stats->totvertsel, stats->totvert);
}
strcat(s, memstr);
}
else if (ob && (ob->mode & OB_MODE_POSE)) {
- s += sprintf(s, IFACE_("Bones:%d/%d %s"),
+ s += sprintf(s, "Bones:%d/%d %s",
stats->totbonesel, stats->totbone, memstr);
}
else if (stats_is_object_dynamic_topology_sculpt(ob)) {
- s += sprintf(s, IFACE_("Verts:%d | Tris:%d"), stats->totvert, stats->tottri);
+ s += sprintf(s, "Verts:%d | Tris:%d", stats->totvert, stats->tottri);
}
else {
- s += sprintf(s, IFACE_("Verts:%d | Faces:%d | Tris:%d | Objects:%d/%d | Lamps:%d/%d%s"),
+ s += sprintf(s, "Verts:%d | Faces:%d | Tris:%d | Objects:%d/%d | Lamps:%d/%d%s",
stats->totvert, stats->totface, stats->tottri, stats->totobjsel, stats->totobj, stats->totlampsel,
stats->totlamp, memstr);
}
diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c
index fc0a7b3b883..66f4904c340 100644
--- a/source/blender/editors/space_info/textview.c
+++ b/source/blender/editors/space_info/textview.c
@@ -68,31 +68,28 @@ BLI_INLINE void console_step_sel(ConsoleDrawContext *cdc, const int step)
cdc->sel[1] += step;
}
-static void console_draw_sel(const int sel[2], const int xy[2], const int str_len_draw, int cwidth, int lheight)
+static void console_draw_sel(const int sel[2], const int xy[2], const int str_len_draw, int cwidth, int lheight,
+ const unsigned char bg_sel[4])
{
if (sel[0] <= str_len_draw && sel[1] >= 0) {
const int sta = max_ii(sel[0], 0);
const int end = min_ii(sel[1], str_len_draw);
- glEnable(GL_POLYGON_STIPPLE);
- glPolygonStipple(stipple_halftone);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glColor4ub(255, 255, 255, 48);
+ glColor4ubv(bg_sel);
glRecti(xy[0] + (cwidth * sta), xy[1] - 2 + lheight, xy[0] + (cwidth * end), xy[1] - 2);
- glDisable(GL_POLYGON_STIPPLE);
glDisable(GL_BLEND);
}
}
-
/* return 0 if the last line is off the screen
* should be able to use this for any string type */
static int console_draw_string(ConsoleDrawContext *cdc, const char *str, const int str_len,
- const unsigned char *fg, const unsigned char *bg)
+ const unsigned char fg[3], const unsigned char bg[3], const unsigned char bg_sel[4])
{
int rct_ofs = cdc->lheight / 4;
int tot_lines = (str_len / cdc->console_width) + 1; /* total number of lines for wrapping */
@@ -108,7 +105,8 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, const i
/* wrap */
if (str_len > cdc->console_width)
- ofs += (cdc->console_width * ((int)((((float)(y_next - cdc->mval[1]) / (float)(y_next - cdc->xy[1])) * tot_lines))));
+ ofs += cdc->console_width * ((int)((((float)(y_next - cdc->mval[1]) /
+ (float)(y_next - cdc->xy[1])) * tot_lines)));
CLAMP(ofs, 0, str_len);
*cdc->pos_pick += str_len - ofs;
@@ -158,7 +156,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, const i
if (cdc->sel[0] != cdc->sel[1]) {
console_step_sel(cdc, -initial_offset);
// glColor4ub(255, 0, 0, 96); // debug
- console_draw_sel(cdc->sel, cdc->xy, str_len % cdc->console_width, cdc->cwidth, cdc->lheight);
+ console_draw_sel(cdc->sel, cdc->xy, str_len % cdc->console_width, cdc->cwidth, cdc->lheight, bg_sel);
console_step_sel(cdc, cdc->console_width);
glColor3ubv(fg);
}
@@ -173,7 +171,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, const i
if (cdc->sel[0] != cdc->sel[1]) {
// glColor4ub(0, 255, 0, 96); // debug
- console_draw_sel(cdc->sel, cdc->xy, cdc->console_width, cdc->cwidth, cdc->lheight);
+ console_draw_sel(cdc->sel, cdc->xy, cdc->console_width, cdc->cwidth, cdc->lheight, bg_sel);
console_step_sel(cdc, cdc->console_width);
glColor3ubv(fg);
}
@@ -207,7 +205,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, const i
isel[1] = str_len - cdc->sel[0];
// glColor4ub(255, 255, 0, 96); // debug
- console_draw_sel(isel, cdc->xy, str_len, cdc->cwidth, cdc->lheight);
+ console_draw_sel(isel, cdc->xy, str_len, cdc->cwidth, cdc->lheight, bg_sel);
console_step_sel(cdc, -(str_len + 1));
}
@@ -269,6 +267,11 @@ int textview_draw(TextViewContext *tvc, const int draw, int mval[2], void **mous
}
if (tvc->begin(tvc)) {
+ unsigned char bg_sel[4] = {0};
+
+ if (draw && tvc->const_colors) {
+ tvc->const_colors(tvc, bg_sel);
+ }
do {
const char *ext_line;
@@ -282,7 +285,11 @@ int textview_draw(TextViewContext *tvc, const int draw, int mval[2], void **mous
tvc->line_get(tvc, &ext_line, &ext_len);
- if (!console_draw_string(&cdc, ext_line, ext_len, (color_flag & TVC_LINE_FG) ? fg : NULL, (color_flag & TVC_LINE_BG) ? bg : NULL)) {
+ if (!console_draw_string(&cdc, ext_line, ext_len,
+ (color_flag & TVC_LINE_FG) ? fg : NULL,
+ (color_flag & TVC_LINE_BG) ? bg : NULL,
+ bg_sel))
+ {
/* when drawing, if we pass v2d->cur.ymax, then quit */
if (draw) {
break; /* past the y limits */
diff --git a/source/blender/editors/space_info/textview.h b/source/blender/editors/space_info/textview.h
index d0fab880dc3..653c9b83a50 100644
--- a/source/blender/editors/space_info/textview.h
+++ b/source/blender/editors/space_info/textview.h
@@ -46,6 +46,7 @@ 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 */
void *iter;
int iter_index;
int iter_char; /* char intex, used for multi-line report display */
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index f303bba9886..b211bca4c0a 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -2163,12 +2163,12 @@ static void node_composit_buts_file_output_details(uiLayout *layout, bContext *C
active_index = RNA_int_get(ptr, "active_input_index");
/* using different collection properties if multilayer format is enabled */
if (multilayer) {
- uiTemplateList(col, C, "UI_UL_list", "", ptr, "layer_slots", ptr, "active_input_index", 0, 0, 0);
+ uiTemplateList(col, C, "UI_UL_list", "file_output_node", ptr, "layer_slots", ptr, "active_input_index", 0, 0, 0);
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", "", ptr, "file_slots", ptr, "active_input_index", 0, 0, 0);
+ uiTemplateList(col, C, "UI_UL_list", "file_output_node", ptr, "file_slots", ptr, "active_input_index", 0, 0, 0);
RNA_property_collection_lookup_int(ptr, RNA_struct_find_property(ptr, "file_slots"),
active_index, &active_input_ptr);
}
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index ab660b9cd4a..9a1b3628196 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -1432,8 +1432,7 @@ static int parent_drop_exec(bContext *C, wmOperator *op)
ED_object_parent_set(op->reports, bmain, scene, ob, par, partype, FALSE, FALSE);
- DAG_scene_sort(bmain, scene);
- DAG_ids_flush_update(bmain, 0);
+ DAG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_PARENT, NULL);
@@ -1522,8 +1521,7 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, wmEvent *event)
if ((par->type != OB_ARMATURE) && (par->type != OB_CURVE) && (par->type != OB_LATTICE)) {
if (ED_object_parent_set(op->reports, bmain, scene, ob, par, partype, FALSE, FALSE)) {
- DAG_scene_sort(bmain, scene);
- DAG_ids_flush_update(bmain, 0);
+ DAG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_PARENT, NULL);
}
@@ -1706,8 +1704,7 @@ static int parent_clear_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
ED_object_parent_clear(ob, RNA_enum_get(op->ptr, "type"));
- DAG_scene_sort(bmain, scene);
- DAG_ids_flush_update(bmain, 0);
+ DAG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_PARENT, NULL);
return OPERATOR_FINISHED;
@@ -1795,8 +1792,7 @@ static int scene_drop_invoke(bContext *C, wmOperator *op, wmEvent *event)
ED_base_object_select(base, BA_SELECT);
}
- DAG_scene_sort(bmain, scene);
- DAG_ids_flush_update(bmain, 0);
+ DAG_relations_tag_update(bmain);
WM_main_add_notifier(NC_SCENE | ND_OB_SELECT, scene);
@@ -1828,7 +1824,6 @@ void OUTLINER_OT_scene_drop(wmOperatorType *ot)
static int material_drop_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- Main *bmain = CTX_data_main(C);
Material *ma = NULL;
Object *ob = NULL;
SpaceOops *soops = CTX_wm_space_outliner(C);
@@ -1860,7 +1855,6 @@ static int material_drop_invoke(bContext *C, wmOperator *op, wmEvent *event)
assign_material(ob, ma, ob->totcol + 1, BKE_MAT_ASSIGN_USERPREF);
- DAG_ids_flush_update(bmain, 0);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C));
WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_LINKS, ma);
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index b2070cc2f1c..303782f3fbd 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -619,7 +619,7 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
* cleanup tree here to prevent such cases. */
outliner_cleanup_tree(soops);
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
str = "Delete Objects";
WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
}
@@ -712,10 +712,8 @@ static int outliner_group_operation_exec(bContext *C, wmOperator *op)
if (event == 3) { /* instance */
- Main *bmain = CTX_data_main(C);
-
/* works without this except if you try render right after, see: 22027 */
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(CTX_data_main(C));
}
ED_undo_push(C, prop_group_op_types[event].name);
@@ -1110,14 +1108,8 @@ static int outliner_animdata_operation_exec(bContext *C, wmOperator *op)
/* update dependencies */
if (updateDeps) {
- Main *bmain = CTX_data_main(C);
- Scene *scene = CTX_data_scene(C);
-
/* rebuild depsgraph for the new deps */
- DAG_scene_sort(bmain, scene);
-
- /* force an update of depsgraph */
- DAG_ids_flush_update(bmain, 0);
+ DAG_relations_tag_update(CTX_data_main(C));
}
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 97943f7e6ac..7be2d51a3c0 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -817,18 +817,23 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe)
/* like duplicate, but only duplicate and cut overlapping strips,
- * strips to the left of the cutframe are ignored and strips to the right are moved into the new list */
-static int cut_seq_list(Scene *scene, ListBase *old, ListBase *new, int cutframe,
+ * strips to the left of the cutframe are ignored and strips to the right
+ * are moved to the end of slist
+ * we have to work on the same slist (not using a seperate list), since
+ * otherwise dupli_seq can't check for duplicate names properly and
+ * may generate strips with the same name (which will mess up animdata)
+ */
+
+static int cut_seq_list(Scene *scene, ListBase *slist, int cutframe,
Sequence * (*cut_seq)(Scene *, Sequence *, int))
{
- int did_something = FALSE;
Sequence *seq, *seq_next_iter;
+ Sequence *seq_first_new = NULL;
- seq = old->first;
-
- while (seq) {
+ seq = slist->first;
+
+ while (seq && seq != seq_first_new) {
seq_next_iter = seq->next; /* we need this because we may remove seq */
-
seq->tmp = NULL;
if (seq->flag & SELECT) {
if (cutframe > seq->startdisp &&
@@ -836,22 +841,29 @@ static int cut_seq_list(Scene *scene, ListBase *old, ListBase *new, int cutframe
{
Sequence *seqn = cut_seq(scene, seq, cutframe);
if (seqn) {
- BLI_addtail(new, seqn);
+ BLI_addtail(slist, seqn);
+ if (seq_first_new == NULL) {
+ seq_first_new = seqn;
+ }
}
- did_something = TRUE;
}
else if (seq->enddisp <= cutframe) {
/* do nothing */
}
else if (seq->startdisp >= cutframe) {
- /* move into new list */
- BLI_remlink(old, seq);
- BLI_addtail(new, seq);
+ /* move to tail */
+ BLI_remlink(slist, seq);
+ BLI_addtail(slist, seq);
+
+ if (seq_first_new == NULL) {
+ seq_first_new = seq;
+ }
}
}
seq = seq_next_iter;
}
- return did_something;
+
+ return (seq_first_new != NULL);
}
static int insert_gap(Scene *scene, int gap, int cfra)
@@ -1488,25 +1500,21 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op)
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
int cut_side, cut_hard, cut_frame;
- ListBase newlist;
int changed;
cut_frame = RNA_int_get(op->ptr, "frame");
cut_hard = RNA_enum_get(op->ptr, "type");
cut_side = RNA_enum_get(op->ptr, "side");
- newlist.first = newlist.last = NULL;
-
if (cut_hard == SEQ_CUT_HARD) {
- changed = cut_seq_list(scene, ed->seqbasep, &newlist, cut_frame, cut_seq_hard);
+ changed = cut_seq_list(scene, ed->seqbasep, cut_frame, cut_seq_hard);
}
else {
- changed = cut_seq_list(scene, ed->seqbasep, &newlist, cut_frame, cut_seq_soft);
+ changed = cut_seq_list(scene, ed->seqbasep, cut_frame, cut_seq_soft);
}
- if (newlist.first) { /* got new strips ? */
+ if (changed) { /* got new strips ? */
Sequence *seq;
- BLI_movelisttolist(ed->seqbasep, &newlist);
if (cut_side != SEQ_SIDE_BOTH) {
SEQP_BEGIN (ed, seq)
diff --git a/source/blender/editors/space_sequencer/sequencer_modifier.c b/source/blender/editors/space_sequencer/sequencer_modifier.c
index a4a485b34c6..51df21e509a 100644
--- a/source/blender/editors/space_sequencer/sequencer_modifier.c
+++ b/source/blender/editors/space_sequencer/sequencer_modifier.c
@@ -180,13 +180,13 @@ static int strip_modifier_move_exec(bContext *C, wmOperator *op)
if (direction == SEQ_MODIFIER_MOVE_UP) {
if (smd->prev) {
BLI_remlink(&seq->modifiers, smd);
- BLI_insertlink(&seq->modifiers, smd->prev->prev, smd);
+ BLI_insertlinkbefore(&seq->modifiers, smd->prev, smd);
}
}
else if (direction == SEQ_MODIFIER_MOVE_DOWN) {
if (smd->next) {
BLI_remlink(&seq->modifiers, smd);
- BLI_insertlink(&seq->modifiers, smd->next, smd);
+ BLI_insertlinkafter(&seq->modifiers, smd->next, smd);
}
}
diff --git a/source/blender/editors/space_text/text_autocomplete.c b/source/blender/editors/space_text/text_autocomplete.c
index 94977fc5f0f..7c18b5c283a 100644
--- a/source/blender/editors/space_text/text_autocomplete.c
+++ b/source/blender/editors/space_text/text_autocomplete.c
@@ -162,23 +162,29 @@ static GHash *text_autocomplete_build(Text *text)
gh = BLI_ghash_str_new(__func__);
for (linep = text->lines.first; linep; linep = linep->next) {
- int i_start = 0;
- int i_end = 0;
+ size_t i_start = 0;
+ size_t i_end = 0;
+ size_t i_pos = 0;
while (i_start < linep->len) {
/* seek identifier beginning */
- while (i_start < linep->len && !text_check_identifier_nodigit(linep->line[i_start])) {
- i_start++;
+ i_pos = i_start;
+ while ((i_start < linep->len) &&
+ (!text_check_identifier_nodigit_unicode(BLI_str_utf8_as_unicode_and_size_safe(&linep->line[i_start], &i_pos))))
+ {
+ i_start = i_pos;
}
- i_end = i_start;
- while (i_end < linep->len && text_check_identifier(linep->line[i_end])) {
- i_end++;
+ i_pos = i_end = i_start;
+ while ((i_end < linep->len) &&
+ (text_check_identifier_unicode(BLI_str_utf8_as_unicode_and_size_safe(&linep->line[i_end], &i_pos))))
+ {
+ i_end = i_pos;
}
if ((i_start != i_end) &&
/* check we're at the beginning of a line or that the previous char is not an identifier
- * this prevents digits from being added */
- ((i_start < 1) || !text_check_identifier(linep->line[i_start - 1])))
+ * this prevents digits from being added */
+ ((i_start < 1) || !text_check_identifier_unicode(BLI_str_utf8_as_unicode(&linep->line[i_start - 1]))))
{
char *str_sub = &linep->line[i_start];
const int choice_len = i_end - i_start;
@@ -197,7 +203,13 @@ static GHash *text_autocomplete_build(Text *text)
str_sub[choice_len] = str_sub_last;
}
}
- i_start = i_end;
+ if (i_end != i_start) {
+ i_start = i_end;
+ }
+ else {
+ /* highly unlikely, but prevent eternal loop */
+ i_start++;
+ }
}
}
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index b60528bcee8..9b5d453d8a3 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -1929,7 +1929,7 @@ static int text_jump_exec(bContext *C, wmOperator *op)
static int text_jump_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
- return WM_operator_props_dialog_popup(C, op, 200, 100);
+ return WM_operator_props_dialog_popup(C, op, 10 * UI_UNIT_X, 5 * UI_UNIT_Y);
}
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index 35a0111e575..2cef10e1981 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -236,8 +236,9 @@ static struct TextureDrawState {
Object *ob;
int is_lit, is_tex;
int color_profile;
+ bool use_backface_culling;
unsigned char obcol[4];
-} Gtexdraw = {NULL, 0, 0, 0, {0, 0, 0, 0}};
+} Gtexdraw = {NULL, 0, 0, 0, false, {0, 0, 0, 0}};
static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *ma, struct TextureDrawState gtexdraw)
{
@@ -250,7 +251,7 @@ static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *m
static int c_has_texface;
Object *litob = NULL; /* to get mode to turn off mipmap in painting mode */
- int backculled = GEMAT_BACKCULL;
+ int backculled = GEMAT_BACKCULL || gtexdraw.use_backface_culling;
int alphablend = 0;
int textured = 0;
int lit = 0;
@@ -274,7 +275,7 @@ static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *m
if (ma) {
alphablend = ma->game.alpha_blend;
if (ma->mode & MA_SHLESS) lit = 0;
- backculled = ma->game.flag & GEMAT_BACKCULL;
+ backculled = (ma->game.flag & GEMAT_BACKCULL) || gtexdraw.use_backface_culling;
}
if (texface) {
@@ -375,17 +376,12 @@ static void draw_textured_begin(Scene *scene, View3D *v3d, RegionView3D *rv3d, O
Gtexdraw.is_tex = is_tex;
Gtexdraw.color_profile = BKE_scene_check_color_management_enabled(scene);
+ Gtexdraw.use_backface_culling = (v3d->flag2 & V3D_BACKFACE_CULLING) != 0;
memcpy(Gtexdraw.obcol, obcol, sizeof(obcol));
set_draw_settings_cached(1, NULL, NULL, Gtexdraw);
glShadeModel(GL_SMOOTH);
- if (v3d->flag2 & V3D_BACKFACE_CULLING) {
- glEnable(GL_CULL_FACE);
- glCullFace(GL_BACK);
- }
- else {
- glDisable(GL_CULL_FACE);
- }
+ glCullFace(GL_BACK);
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, (me->flag & ME_TWOSIDED) ? GL_TRUE : GL_FALSE);
}
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index ec716284bf3..bb286194992 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -222,6 +222,9 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
}
}
}
+ else {
+ totedgedata = bm->totedgesel;
+ }
/* check for defgroups */
if (evedef)
@@ -400,53 +403,43 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
uiBlockBeginAlign(block);
/* Should be no need to translate these. */
- but = uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "X:", 0, yi -= buth, 200, buth,
+ but = uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, IFACE_("X:"), 0, yi -= buth, 200, buth,
&(tfp->ve_median[LOC_X]), -lim, lim, 10, RNA_TRANSLATION_PREC_DEFAULT, "");
uiButSetUnitType(but, PROP_UNIT_LENGTH);
- but = uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Y:", 0, yi -= buth, 200, buth,
+ but = uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, IFACE_("Y:"), 0, yi -= buth, 200, buth,
&(tfp->ve_median[LOC_Y]), -lim, lim, 10, RNA_TRANSLATION_PREC_DEFAULT, "");
uiButSetUnitType(but, PROP_UNIT_LENGTH);
- but = uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Z:", 0, yi -= buth, 200, buth,
+ but = uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, IFACE_("Z:"), 0, yi -= buth, 200, buth,
&(tfp->ve_median[LOC_Z]), -lim, lim, 10, RNA_TRANSLATION_PREC_DEFAULT, "");
uiButSetUnitType(but, PROP_UNIT_LENGTH);
if (totcurvebweight == tot) {
- uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "W:", 0, yi -= buth, 200, buth,
+ uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, IFACE_("W:"), 0, yi -= buth, 200, buth,
&(tfp->ve_median[C_BWEIGHT]), 0.01, 100.0, 1, 3, "");
}
uiBlockBeginAlign(block);
uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, B_REDR, IFACE_("Global"),
0, yi -= buth + but_margin, 100, buth,
- &v3d->flag, 0, 0, 0, 0, "Displays global values");
+ &v3d->flag, 0, 0, 0, 0, TIP_("Displays global values"));
uiDefButBitS(block, TOGN, V3D_GLOBAL_STATS, B_REDR, IFACE_("Local"),
100, yi, 100, buth,
- &v3d->flag, 0, 0, 0, 0, "Displays local values");
+ &v3d->flag, 0, 0, 0, 0, TIP_("Displays local values"));
uiBlockEndAlign(block);
/* Meshes... */
if (meshdata) {
if (totedgedata) {
- Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
- BMesh *bm = em->bm;
-
- const int cd_edge_bweight_offset = CustomData_get_offset(&bm->edata, CD_BWEIGHT);
- const int cd_edge_crease_offset = CustomData_get_offset(&bm->edata, CD_CREASE);
-
- if (cd_edge_crease_offset != -1) {
- uiDefButF(block, NUM, B_OBJECTPANELMEDIAN,
- totedgedata == 1 ? IFACE_("Crease:") : IFACE_("Mean Crease:"),
- 0, yi -= buth + but_margin, 200, buth,
- &(tfp->ve_median[M_CREASE]), 0.0, 1.0, 1, 3, TIP_("Weight used by SubSurf modifier"));
- }
-
- if (cd_edge_bweight_offset != -1) {
- uiDefButF(block, NUM, B_OBJECTPANELMEDIAN,
- totedgedata == 1 ? IFACE_("Bevel Weight:") : IFACE_("Mean Bevel Weight:"),
- 0, yi -= buth + but_margin, 200, buth,
- &(tfp->ve_median[M_WEIGHT]), 0.0, 1.0, 1, 3, TIP_("Weight used by Bevel modifier"));
- }
+ /* customdata layer added on demand */
+ uiDefButF(block, NUM, B_OBJECTPANELMEDIAN,
+ totedgedata == 1 ? IFACE_("Crease:") : IFACE_("Mean Crease:"),
+ 0, yi -= buth + but_margin, 200, buth,
+ &(tfp->ve_median[M_CREASE]), 0.0, 1.0, 1, 3, TIP_("Weight used by SubSurf modifier"));
+ /* customdata layer added on demand */
+ uiDefButF(block, NUM, B_OBJECTPANELMEDIAN,
+ totedgedata == 1 ? IFACE_("Bevel Weight:") : IFACE_("Mean Bevel Weight:"),
+ 0, yi -= buth + but_margin, 200, buth,
+ &(tfp->ve_median[M_WEIGHT]), 0.0, 1.0, 1, 3, TIP_("Weight used by Bevel modifier"));
}
if (totskinradius) {
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN,
@@ -461,11 +454,11 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
}
/* Curve... */
else if (totcurvedata == 1) {
- uiDefButR(block, NUM, 0, "Weight", 0, yi -= buth + but_margin, 200, buth,
+ uiDefButR(block, 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, NUM, 0, "Radius", 0, yi -= buth + but_margin, 200, buth,
+ uiDefButR(block, NUM, 0, IFACE_("Radius"), 0, yi -= buth + but_margin, 200, buth,
&data_ptr, "radius", 0, 0.0, 100.0, 1, 3, NULL);
- uiDefButR(block, NUM, 0, "Tilt", 0, yi -= buth + but_margin, 200, buth,
+ uiDefButR(block, NUM, 0, IFACE_("Tilt"), 0, yi -= buth + but_margin, 200, buth,
&data_ptr, "tilt", 0, -FLT_MAX, FLT_MAX, 1, 3, NULL);
}
else if (totcurvedata > 1) {
@@ -483,7 +476,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
}
/* Lattice... */
else if (totlattdata == 1) {
- uiDefButR(block, NUM, 0, "Weight", 0, yi -= buth + but_margin, 200, buth,
+ uiDefButR(block, 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) {
@@ -529,7 +522,8 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
}
if (median[M_CREASE] != 0.0f) {
- const int cd_edge_crease_offset = CustomData_get_offset(&bm->edata, CD_CREASE);
+ const int cd_edge_crease_offset = (BM_mesh_cd_flag_ensure(bm, me, ME_CDFLAG_EDGE_CREASE),
+ CustomData_get_offset(&bm->edata, CD_CREASE));
const float sca = compute_scale_factor(ve_median[M_CREASE], median[M_CREASE]);
BMEdge *eed;
@@ -561,7 +555,8 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
}
if (median[M_WEIGHT] != 0.0f) {
- const int cd_edge_bweight_offset = CustomData_get_offset(&bm->edata, CD_BWEIGHT);
+ const int cd_edge_bweight_offset = (BM_mesh_cd_flag_ensure(bm, me, ME_CDFLAG_EDGE_BWEIGHT),
+ CustomData_get_offset(&bm->edata, CD_BWEIGHT));
const float sca = compute_scale_factor(ve_median[M_WEIGHT], median[M_WEIGHT]);
BMEdge *eed;
@@ -1274,20 +1269,20 @@ void view3d_buttons_register(ARegionType *art)
pt = MEM_callocN(sizeof(PanelType), "spacetype view3d panel object");
strcpy(pt->idname, "VIEW3D_PT_object");
- strcpy(pt->label, "Transform");
+ strcpy(pt->label, N_("Transform")); /* XXX C panels not available through RNA (bpy.types)! */
pt->draw = view3d_panel_object;
BLI_addtail(&art->paneltypes, pt);
pt = MEM_callocN(sizeof(PanelType), "spacetype view3d panel gpencil");
strcpy(pt->idname, "VIEW3D_PT_gpencil");
- strcpy(pt->label, "Grease Pencil");
+ strcpy(pt->label, N_("Grease Pencil")); /* XXX C panels are not available through RNA (bpy.types)! */
pt->draw_header = gpencil_panel_standard_header;
pt->draw = gpencil_panel_standard;
BLI_addtail(&art->paneltypes, pt);
pt = MEM_callocN(sizeof(PanelType), "spacetype view3d panel vgroup");
strcpy(pt->idname, "VIEW3D_PT_vgroup");
- strcpy(pt->label, "Vertex Groups");
+ strcpy(pt->label, N_("Vertex Groups")); /* XXX C panels are not available through RNA (bpy.types)! */
pt->draw = view3d_panel_vgroup;
pt->poll = view3d_panel_vgroup_poll;
BLI_addtail(&art->paneltypes, pt);
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 2b28b958248..4aaa3332252 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -75,7 +75,9 @@
#include "BIF_glutil.h"
#include "WM_api.h"
+
#include "BLF_api.h"
+#include "BLF_translation.h"
#include "ED_armature.h"
#include "ED_keyframing.h"
@@ -345,7 +347,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
CLAMP(blend_fac, 0.3f, 1.0f);
- UI_ThemeColorBlend(TH_BACK, TH_GRID, blend_fac);
+ UI_ThemeColorBlend(TH_HIGH_GRAD, TH_GRID, blend_fac);
drawgrid_draw(ar, wx, wy, x, y, dx_scalar);
}
@@ -374,7 +376,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
}
}
else { /* start blending out */
- UI_ThemeColorBlend(TH_BACK, TH_GRID, dx / (GRID_MIN_PX_D * 6.0));
+ UI_ThemeColorBlend(TH_HIGH_GRAD, TH_GRID, dx / (GRID_MIN_PX_D * 6.0));
drawgrid_draw(ar, wx, wy, x, y, dx);
UI_ThemeColor(TH_GRID);
@@ -382,7 +384,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
}
}
else { /* start blending out (GRID_MIN_PX < dx < (GRID_MIN_PX * 10)) */
- UI_ThemeColorBlend(TH_BACK, TH_GRID, dx / (GRID_MIN_PX_D * 6.0));
+ UI_ThemeColorBlend(TH_HIGH_GRAD, TH_GRID, dx / (GRID_MIN_PX_D * 6.0));
drawgrid_draw(ar, wx, wy, x, y, dx);
UI_ThemeColor(TH_GRID);
@@ -401,21 +403,21 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
drawgrid_draw(ar, wx, wy, x, y, dx);
}
else {
- UI_ThemeColorBlend(TH_BACK, TH_GRID, dx / (GRID_MIN_PX_D * 6.0));
+ UI_ThemeColorBlend(TH_HIGH_GRAD, TH_GRID, dx / (GRID_MIN_PX_D * 6.0));
drawgrid_draw(ar, wx, wy, x, y, dx);
UI_ThemeColor(TH_GRID);
drawgrid_draw(ar, wx, wy, x, y, dx * sublines);
}
}
else {
- UI_ThemeColorBlend(TH_BACK, TH_GRID, dx / (GRID_MIN_PX_D * 6.0));
+ UI_ThemeColorBlend(TH_HIGH_GRAD, TH_GRID, dx / (GRID_MIN_PX_D * 6.0));
drawgrid_draw(ar, wx, wy, x, y, dx);
UI_ThemeColor(TH_GRID);
drawgrid_draw(ar, wx, wy, x, y, dx * sublines);
}
}
else {
- UI_ThemeColorBlend(TH_BACK, TH_GRID, dx / (GRID_MIN_PX_D * 6.0));
+ UI_ThemeColorBlend(TH_HIGH_GRAD, TH_GRID, dx / (GRID_MIN_PX_D * 6.0));
drawgrid_draw(ar, wx, wy, x, y, dx);
UI_ThemeColor(TH_GRID);
drawgrid_draw(ar, wx, wy, x, y, dx * sublines);
@@ -804,28 +806,28 @@ static const char *view3d_get_name(View3D *v3d, RegionView3D *rv3d)
switch (rv3d->view) {
case RV3D_VIEW_FRONT:
- if (rv3d->persp == RV3D_ORTHO) name = "Front Ortho";
- else name = "Front Persp";
+ if (rv3d->persp == RV3D_ORTHO) name = IFACE_("Front Ortho");
+ else name = IFACE_("Front Persp");
break;
case RV3D_VIEW_BACK:
- if (rv3d->persp == RV3D_ORTHO) name = "Back Ortho";
- else name = "Back Persp";
+ if (rv3d->persp == RV3D_ORTHO) name = IFACE_("Back Ortho");
+ else name = IFACE_("Back Persp");
break;
case RV3D_VIEW_TOP:
- if (rv3d->persp == RV3D_ORTHO) name = "Top Ortho";
- else name = "Top Persp";
+ if (rv3d->persp == RV3D_ORTHO) name = IFACE_("Top Ortho");
+ else name = IFACE_("Top Persp");
break;
case RV3D_VIEW_BOTTOM:
- if (rv3d->persp == RV3D_ORTHO) name = "Bottom Ortho";
- else name = "Bottom Persp";
+ if (rv3d->persp == RV3D_ORTHO) name = IFACE_("Bottom Ortho");
+ else name = IFACE_("Bottom Persp");
break;
case RV3D_VIEW_RIGHT:
- if (rv3d->persp == RV3D_ORTHO) name = "Right Ortho";
- else name = "Right Persp";
+ if (rv3d->persp == RV3D_ORTHO) name = IFACE_("Right Ortho");
+ else name = IFACE_("Right Persp");
break;
case RV3D_VIEW_LEFT:
- if (rv3d->persp == RV3D_ORTHO) name = "Left Ortho";
- else name = "Left Persp";
+ if (rv3d->persp == RV3D_ORTHO) name = IFACE_("Left Ortho");
+ else name = IFACE_("Left Persp");
break;
default:
@@ -833,14 +835,14 @@ static const char *view3d_get_name(View3D *v3d, RegionView3D *rv3d)
if ((v3d->camera) && (v3d->camera->type == OB_CAMERA)) {
Camera *cam;
cam = v3d->camera->data;
- name = (cam->type != CAM_ORTHO) ? "Camera Persp" : "Camera Ortho";
+ name = (cam->type != CAM_ORTHO) ? IFACE_("Camera Persp") : IFACE_("Camera Ortho");
}
else {
- name = "Object as Camera";
+ name = IFACE_("Object as Camera");
}
}
else {
- name = (rv3d->persp == RV3D_ORTHO) ? "User Ortho" : "User Persp";
+ name = (rv3d->persp == RV3D_ORTHO) ? IFACE_("User Ortho") : IFACE_("User Persp");
}
break;
}
@@ -852,16 +854,25 @@ static void draw_viewport_name(ARegion *ar, View3D *v3d, rcti *rect)
{
RegionView3D *rv3d = ar->regiondata;
const char *name = view3d_get_name(v3d, rv3d);
+ /* XXX 24 may be a bit small for unicode languages (Chinese in utf-8...) */
+#ifdef WITH_INTERNATIONAL
+ char tmpstr[32];
+#else
char tmpstr[24];
-
+#endif
+
if (v3d->localvd) {
- BLI_snprintf(tmpstr, sizeof(tmpstr), "%s (Local)", name);
+ BLI_snprintf(tmpstr, sizeof(tmpstr), IFACE_("%s (Local)"), name);
name = tmpstr;
}
if (name) {
UI_ThemeColor(TH_TEXT_HI);
+#ifdef WITH_INTERNATIONAL
+ BLF_draw_default(U.widget_unit + rect->xmin, rect->ymax - U.widget_unit, 0.0f, name, sizeof(tmpstr));
+#else
BLF_draw_default_ascii(U.widget_unit + rect->xmin, rect->ymax - U.widget_unit, 0.0f, name, sizeof(tmpstr));
+#endif
}
}
@@ -918,7 +929,7 @@ static void draw_selected_name(Scene *scene, Object *ob, rcti *rect)
if (kb) {
BLI_snprintf(shapes, sizeof(shapes), ": %s ", kb->name);
if (ob->shapeflag == OB_SHAPE_LOCK) {
- strcat(shapes, " (Pinned)");
+ strcat(shapes, IFACE_(" (Pinned)"));
}
}
}
@@ -2846,14 +2857,18 @@ static void draw_viewport_fps(Scene *scene, rcti *rect)
/* is this more then half a frame behind? */
if (fps + 0.5f < (float)(FPS)) {
UI_ThemeColor(TH_REDALERT);
- BLI_snprintf(printable, sizeof(printable), "fps: %.2f", fps);
+ BLI_snprintf(printable, sizeof(printable), IFACE_("fps: %.2f"), fps);
}
else {
UI_ThemeColor(TH_TEXT_HI);
- BLI_snprintf(printable, sizeof(printable), "fps: %i", (int)(fps + 0.5f));
+ BLI_snprintf(printable, sizeof(printable), IFACE_("fps: %i"), (int)(fps + 0.5f));
}
-
+
+#ifdef WITH_INTERNATIONAL
+ BLF_draw_default(rect->xmin + U.widget_unit, rect->ymax - U.widget_unit, 0.0f, printable, sizeof(printable));
+#else
BLF_draw_default_ascii(rect->xmin + U.widget_unit, rect->ymax - U.widget_unit, 0.0f, printable, sizeof(printable));
+#endif
}
static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const char **grid_unit);
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 8c0a2dc4b65..30ed7a57f9d 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -3858,18 +3858,14 @@ void VIEW3D_OT_clip_border(wmOperatorType *ot)
/* cursor position in vec, result in vec, mval in region coords */
/* note: cannot use event->mval here (called by object_add() */
-void ED_view3d_cursor3d_position(bContext *C, float *fp, int mx, int my)
+void ED_view3d_cursor3d_position(bContext *C, float fp[3], const int mval[2])
{
Scene *scene = CTX_data_scene(C);
ARegion *ar = CTX_wm_region(C);
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d = CTX_wm_region_view3d(C);
float mval_fl[2];
- int mval[2];
int flip;
-
- mval[0] = mx - ar->winrct.xmin;
- mval[1] = my - ar->winrct.ymin;
flip = initgrabz(rv3d, fp[0], fp[1], fp[2]);
@@ -3917,7 +3913,7 @@ static int view3d_cursor3d_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *
View3D *v3d = CTX_wm_view3d(C);
float *fp = give_cursor(scene, v3d);
- ED_view3d_cursor3d_position(C, fp, event->x, event->y);
+ ED_view3d_cursor3d_position(C, fp, event->mval);
if (v3d && v3d->localvd)
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d);
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c
index f570ec38ae3..6edcf980d58 100644
--- a/source/blender/editors/space_view3d/view3d_snap.c
+++ b/source/blender/editors/space_view3d/view3d_snap.c
@@ -532,7 +532,6 @@ static void make_trans_verts(Object *obedit, float min[3], float max[3], int mod
static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
{
- Main *bmain = CTX_data_main(C);
Object *obedit = CTX_data_edit_object(C);
Scene *scene = CTX_data_scene(C);
RegionView3D *rv3d = CTX_wm_region_data(C);
@@ -623,8 +622,6 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
else {
- ob->recalc |= OB_RECALC_OB;
-
vec[0] = -ob->obmat[3][0] + gridf * floorf(0.5f + ob->obmat[3][0] / gridf);
vec[1] = -ob->obmat[3][1] + gridf * floorf(0.5f + ob->obmat[3][1] / gridf);
vec[2] = -ob->obmat[3][2] + gridf * floorf(0.5f + ob->obmat[3][2] / gridf);
@@ -644,12 +641,13 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
/* auto-keyframing */
ED_autokeyframe_object(C, scene, ob, ks);
+
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB);
}
}
CTX_DATA_END;
}
- DAG_ids_flush_update(bmain, 0);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
return OPERATOR_FINISHED;
@@ -674,7 +672,6 @@ void VIEW3D_OT_snap_selected_to_grid(wmOperatorType *ot)
static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op))
{
- Main *bmain = CTX_data_main(C);
Object *obedit = CTX_data_edit_object(C);
Scene *scene = CTX_data_scene(C);
View3D *v3d = CTX_wm_view3d(C);
@@ -748,8 +745,6 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op))
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
else {
- ob->recalc |= OB_RECALC_OB;
-
vec[0] = -ob->obmat[3][0] + curs[0];
vec[1] = -ob->obmat[3][1] + curs[1];
vec[2] = -ob->obmat[3][2] + curs[2];
@@ -769,12 +764,13 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op))
/* auto-keyframing */
ED_autokeyframe_object(C, scene, ob, ks);
+
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB);
}
}
CTX_DATA_END;
}
- DAG_ids_flush_update(bmain, 0);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 8ffa04050a2..ea82ebb9234 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -94,6 +94,7 @@
#include "RNA_access.h"
#include "BLF_api.h"
+#include "BLF_translation.h"
#include "transform.h"
@@ -104,6 +105,16 @@ static int doVertSlide(TransInfo *t, float perc);
static void drawEdgeSlide(const struct bContext *C, TransInfo *t);
static void drawVertSlide(const struct bContext *C, TransInfo *t);
+static bool transdata_check_local_center(TransInfo *t)
+{
+ return ((t->around == V3D_LOCAL) && (
+ (t->flag & (T_OBJECT | T_POSE)) ||
+ (t->obedit && t->obedit->type == OB_MESH && (t->settings->selectmode & (SCE_SELECT_EDGE | SCE_SELECT_FACE))) ||
+ (t->obedit && t->obedit->type == OB_ARMATURE) ||
+ (t->spacetype == SPACE_IPO))
+ );
+}
+
/* ************************** SPACE DEPENDANT CODE **************************** */
void setTransformViewMatrices(TransInfo *t)
@@ -780,22 +791,29 @@ static void transform_event_xyz_constraint(TransInfo *t, short key_type, char cm
if (!(t->flag & T_NO_CONSTRAINT)) {
int constraint_axis, constraint_plane;
int edit_2d = (t->flag & T_2D_EDIT);
- char msg1[] = "along _";
- char msg2[] = "along %s _";
- char msg3[] = "locking %s _";
+ const char *msg1 = "", *msg2 = "", *msg3 = "";
char axis;
/* Initialize */
switch (key_type) {
case XKEY:
+ msg1 = IFACE_("along X");
+ msg2 = IFACE_("along %s X");
+ msg3 = IFACE_("locking %s X");
axis = 'X';
constraint_axis = CON_AXIS0;
break;
case YKEY:
+ msg1 = IFACE_("along Y");
+ msg2 = IFACE_("along %s Y");
+ msg3 = IFACE_("locking %s Y");
axis = 'Y';
constraint_axis = CON_AXIS1;
break;
case ZKEY:
+ msg1 = IFACE_("along Z");
+ msg2 = IFACE_("along %s Z");
+ msg3 = IFACE_("locking %s Z");
axis = 'Z';
constraint_axis = CON_AXIS2;
break;
@@ -803,9 +821,6 @@ static void transform_event_xyz_constraint(TransInfo *t, short key_type, char cm
/* Invalid key */
return;
}
- msg1[sizeof(msg1) - 2] = axis;
- msg2[sizeof(msg2) - 2] = axis;
- msg3[sizeof(msg3) - 2] = axis;
constraint_plane = ((CON_AXIS0 | CON_AXIS1 | CON_AXIS2) & (~constraint_axis));
if (edit_2d && (key_type != ZKEY)) {
@@ -995,10 +1010,10 @@ int transformEvent(TransInfo *t, wmEvent *event)
}
else {
if (t->flag & T_2D_EDIT) {
- setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS0), "along X");
+ setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS0), IFACE_("along X"));
}
else {
- setUserConstraint(t, t->current_orientation, (CON_AXIS0), "along %s X");
+ setUserConstraint(t, t->current_orientation, (CON_AXIS0), IFACE_("along %s X"));
}
}
t->redraw |= TREDRAW_HARD;
@@ -1011,10 +1026,10 @@ int transformEvent(TransInfo *t, wmEvent *event)
}
else {
if (t->flag & T_2D_EDIT) {
- setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS1), "along Y");
+ setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS1), IFACE_("along Y"));
}
else {
- setUserConstraint(t, t->current_orientation, (CON_AXIS1), "along %s Y");
+ setUserConstraint(t, t->current_orientation, (CON_AXIS1), IFACE_("along %s Y"));
}
}
t->redraw |= TREDRAW_HARD;
@@ -1026,7 +1041,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
stopConstraint(t);
}
else {
- setUserConstraint(t, t->current_orientation, (CON_AXIS2), "along %s Z");
+ setUserConstraint(t, t->current_orientation, (CON_AXIS2), IFACE_("along %s Z"));
}
t->redraw |= TREDRAW_HARD;
}
@@ -1037,7 +1052,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
stopConstraint(t);
}
else {
- setUserConstraint(t, t->current_orientation, (CON_AXIS1 | CON_AXIS2), "locking %s X");
+ setUserConstraint(t, t->current_orientation, (CON_AXIS1 | CON_AXIS2), IFACE_("locking %s X"));
}
t->redraw |= TREDRAW_HARD;
}
@@ -1048,7 +1063,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
stopConstraint(t);
}
else {
- setUserConstraint(t, t->current_orientation, (CON_AXIS0 | CON_AXIS2), "locking %s Y");
+ setUserConstraint(t, t->current_orientation, (CON_AXIS0 | CON_AXIS2), IFACE_("locking %s Y"));
}
t->redraw |= TREDRAW_HARD;
}
@@ -1059,7 +1074,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
stopConstraint(t);
}
else {
- setUserConstraint(t, t->current_orientation, (CON_AXIS0 | CON_AXIS1), "locking %s Z");
+ setUserConstraint(t, t->current_orientation, (CON_AXIS0 | CON_AXIS1), IFACE_("locking %s Z"));
}
t->redraw |= TREDRAW_HARD;
}
@@ -1164,7 +1179,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
/* exception for switching to dolly, or trackball, in camera view */
if (t->flag & T_CAMERA) {
if (t->mode == TFM_TRANSLATION)
- setLocalConstraint(t, (CON_AXIS2), "along local Z");
+ setLocalConstraint(t, (CON_AXIS2), IFACE_("along local Z"));
else if (t->mode == TFM_ROTATION) {
restoreTransObjects(t);
initTrackball(t);
@@ -1656,7 +1671,7 @@ static void drawTransformView(const struct bContext *C, ARegion *UNUSED(ar), voi
static void drawAutoKeyWarning(TransInfo *UNUSED(t), ARegion *ar)
{
rcti rect;
- const char printable[] = "Auto Keying On";
+ const char *printable = IFACE_("Auto Keying On");
float printable_size[2];
int xco, yco;
@@ -1671,7 +1686,11 @@ static void drawAutoKeyWarning(TransInfo *UNUSED(t), ARegion *ar)
* - original color was red to match the icon, but that clashes badly with a less nasty border
*/
UI_ThemeColorShade(TH_TEXT_HI, -50);
+#ifdef WITH_INTERNATIONAL
+ BLF_draw_default(xco, ar->winy - 17, 0.0f, printable, sizeof(printable));
+#else
BLF_draw_default_ascii(xco, ar->winy - 17, 0.0f, printable, sizeof(printable));
+#endif
/* autokey recording icon... */
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -2689,13 +2708,13 @@ int Warp(TransInfo *t, const int UNUSED(mval[2]))
outputNumInput(&(t->num), c);
- sprintf(str, "Warp: %s", c);
+ sprintf(str, IFACE_("Warp: %s"), c);
circumfac = DEG2RADF(circumfac);
}
else {
/* default header print */
- sprintf(str, "Warp: %.3f", RAD2DEGF(circumfac));
+ sprintf(str, IFACE_("Warp: %.3f"), RAD2DEGF(circumfac));
}
t->values[0] = circumfac;
@@ -2830,11 +2849,11 @@ int Shear(TransInfo *t, const int UNUSED(mval[2]))
outputNumInput(&(t->num), c);
- sprintf(str, "Shear: %s %s", c, t->proptext);
+ sprintf(str, IFACE_("Shear: %s %s"), c, t->proptext);
}
else {
/* default header print */
- sprintf(str, "Shear: %.3f %s (Press X or Y to set shear axis)", value, t->proptext);
+ sprintf(str, IFACE_("Shear: %.3f %s (Press X or Y to set shear axis)"), value, t->proptext);
}
t->values[0] = value;
@@ -2926,30 +2945,30 @@ static void headerResize(TransInfo *t, float vec[3], char *str)
if (t->con.mode & CON_APPLY) {
switch (t->num.idx_max) {
case 0:
- spos += sprintf(spos, "Scale: %s%s %s", &tvec[0], t->con.text, t->proptext);
+ spos += sprintf(spos, IFACE_("Scale: %s%s %s"), &tvec[0], t->con.text, t->proptext);
break;
case 1:
- spos += sprintf(spos, "Scale: %s : %s%s %s", &tvec[0], &tvec[NUM_STR_REP_LEN],
+ spos += sprintf(spos, IFACE_("Scale: %s : %s%s %s"), &tvec[0], &tvec[NUM_STR_REP_LEN],
t->con.text, t->proptext);
break;
case 2:
- spos += sprintf(spos, "Scale: %s : %s : %s%s %s", &tvec[0], &tvec[NUM_STR_REP_LEN],
+ spos += sprintf(spos, IFACE_("Scale: %s : %s : %s%s %s"), &tvec[0], &tvec[NUM_STR_REP_LEN],
&tvec[NUM_STR_REP_LEN * 2], t->con.text, t->proptext);
}
}
else {
if (t->flag & T_2D_EDIT) {
- spos += sprintf(spos, "Scale X: %s Y: %s%s %s", &tvec[0], &tvec[NUM_STR_REP_LEN],
+ spos += sprintf(spos, IFACE_("Scale X: %s Y: %s%s %s"), &tvec[0], &tvec[NUM_STR_REP_LEN],
t->con.text, t->proptext);
}
else {
- spos += sprintf(spos, "Scale X: %s Y: %s Z: %s%s %s", &tvec[0], &tvec[NUM_STR_REP_LEN],
+ spos += sprintf(spos, IFACE_("Scale X: %s Y: %s Z: %s%s %s"), &tvec[0], &tvec[NUM_STR_REP_LEN],
&tvec[NUM_STR_REP_LEN * 2], t->con.text, t->proptext);
}
}
if (t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) {
- spos += sprintf(spos, " Proportional size: %.2f", t->prop_size);
+ spos += sprintf(spos, IFACE_(" Proportional size: %.2f"), t->prop_size);
}
(void)spos;
@@ -3005,12 +3024,7 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3])
}
/* local constraint shouldn't alter center */
- if ((t->around == V3D_LOCAL) &&
- ( (t->flag & (T_OBJECT | T_POSE)) ||
- ((t->flag & T_EDIT) && (t->settings->selectmode & (SCE_SELECT_EDGE | SCE_SELECT_FACE))) ||
- (t->obedit && t->obedit->type == OB_ARMATURE))
- )
- {
+ if (transdata_check_local_center(t)) {
copy_v3_v3(center, td->center);
}
else if (t->options & CTX_MOVIECLIP) {
@@ -3313,11 +3327,11 @@ int ToSphere(TransInfo *t, const int UNUSED(mval[2]))
outputNumInput(&(t->num), c);
- sprintf(str, "To Sphere: %s %s", c, t->proptext);
+ sprintf(str, IFACE_("To Sphere: %s %s"), c, t->proptext);
}
else {
/* default header print */
- sprintf(str, "To Sphere: %.4f %s", ratio, t->proptext);
+ sprintf(str, IFACE_("To Sphere: %.4f %s"), ratio, t->proptext);
}
@@ -3387,20 +3401,16 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
{
float vec[3], totmat[3][3], smat[3][3];
float eul[3], fmat[3][3], quat[4];
- float *center = t->center;
+ const float *center;
/* local constraint shouldn't alter center */
- if (around == V3D_LOCAL) {
- if ( (t->flag & (T_OBJECT | T_POSE)) ||
- (t->settings->selectmode & (SCE_SELECT_EDGE | SCE_SELECT_FACE)) ||
- (t->obedit && t->obedit->type == OB_ARMATURE))
- {
- center = td->center;
- }
-
- if (t->options & CTX_MOVIECLIP) {
- center = td->center;
- }
+ if (transdata_check_local_center(t) ||
+ ((around == V3D_LOCAL) && (t->options & CTX_MOVIECLIP)))
+ {
+ center = td->center;
+ }
+ else {
+ center = t->center;
}
if (t->flag & T_POINTS) {
@@ -3661,17 +3671,17 @@ int Rotation(TransInfo *t, const int UNUSED(mval[2]))
outputNumInput(&(t->num), c);
- spos += sprintf(spos, "Rot: %s %s %s", &c[0], t->con.text, t->proptext);
+ spos += sprintf(spos, IFACE_("Rot: %s %s %s"), &c[0], t->con.text, t->proptext);
/* Clamp between -180 and 180 */
final = angle_wrap_rad(DEG2RADF(final));
}
else {
- spos += sprintf(spos, "Rot: %.2f%s %s", RAD2DEGF(final), t->con.text, t->proptext);
+ spos += sprintf(spos, IFACE_("Rot: %.2f%s %s"), RAD2DEGF(final), t->con.text, t->proptext);
}
if (t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) {
- spos += sprintf(spos, " Proportional size: %.2f", t->prop_size);
+ spos += sprintf(spos, IFACE_(" Proportional size: %.2f"), t->prop_size);
}
(void)spos;
@@ -3760,17 +3770,17 @@ int Trackball(TransInfo *t, const int UNUSED(mval[2]))
outputNumInput(&(t->num), c);
- spos += sprintf(spos, "Trackball: %s %s %s", &c[0], &c[NUM_STR_REP_LEN], t->proptext);
+ spos += sprintf(spos, IFACE_("Trackball: %s %s %s"), &c[0], &c[NUM_STR_REP_LEN], t->proptext);
phi[0] = DEG2RADF(phi[0]);
phi[1] = DEG2RADF(phi[1]);
}
else {
- spos += sprintf(spos, "Trackball: %.2f %.2f %s", RAD2DEGF(phi[0]), RAD2DEGF(phi[1]), t->proptext);
+ spos += sprintf(spos, IFACE_("Trackball: %.2f %.2f %s"), RAD2DEGF(phi[0]), RAD2DEGF(phi[1]), t->proptext);
}
if (t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) {
- spos += sprintf(spos, " Proportional size: %.2f", t->prop_size);
+ spos += sprintf(spos, IFACE_(" Proportional size: %.2f"), t->prop_size);
}
(void)spos;
@@ -3881,7 +3891,7 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str)
short chainlen = t->settings->autoik_chainlen;
if (chainlen)
- sprintf(autoik, "AutoIK-Len: %d", chainlen);
+ sprintf(autoik, IFACE_("AutoIK-Len: %d"), chainlen);
else
autoik[0] = '\0';
}
@@ -3914,7 +3924,7 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str)
}
if (t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) {
- spos += sprintf(spos, " Proportional size: %.2f", t->prop_size);
+ spos += sprintf(spos, IFACE_(" Proportional size: %.2f"), t->prop_size);
}
(void)spos;
}
@@ -4076,7 +4086,7 @@ int ShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
/* header print for NumInput */
str_p = str;
- str_p += BLI_snprintf(str_p, sizeof(str), "Shrink/Fatten:");
+ str_p += BLI_snprintf(str_p, sizeof(str), IFACE_("Shrink/Fatten:"));
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
outputNumInput(&(t->num), c);
@@ -4098,8 +4108,8 @@ int ShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
str_p += WM_keymap_item_to_string(kmi, str_p, sizeof(str) - (str_p - str));
}
}
- str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), " or Alt) Even Thickness %s",
- (t->flag & T_ALT_TRANSFORM) ? "ON" : "OFF");
+ str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), IFACE_(" or Alt) Even Thickness %s"),
+ (t->flag & T_ALT_TRANSFORM) ? IFACE_("ON") : IFACE_("OFF"));
/* done with header string */
@@ -4170,7 +4180,7 @@ int Tilt(TransInfo *t, const int UNUSED(mval[2]))
outputNumInput(&(t->num), c);
- sprintf(str, "Tilt: %s° %s", &c[0], t->proptext);
+ sprintf(str, IFACE_("Tilt: %s° %s"), &c[0], t->proptext);
final = DEG2RADF(final);
@@ -4178,7 +4188,7 @@ int Tilt(TransInfo *t, const int UNUSED(mval[2]))
t->values[0] = final;
}
else {
- sprintf(str, "Tilt: %.2f° %s", RAD2DEGF(final), t->proptext);
+ sprintf(str, IFACE_("Tilt: %.2f° %s"), RAD2DEGF(final), t->proptext);
}
for (i = 0; i < t->total; i++, td++) {
@@ -4242,10 +4252,10 @@ int CurveShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
char c[NUM_STR_REP_LEN];
outputNumInput(&(t->num), c);
- sprintf(str, "Shrink/Fatten: %s", c);
+ sprintf(str, IFACE_("Shrink/Fatten: %s"), c);
}
else {
- sprintf(str, "Shrink/Fatten: %3f", ratio);
+ sprintf(str, IFACE_("Shrink/Fatten: %3f"), ratio);
}
for (i = 0; i < t->total; i++, td++) {
@@ -4310,10 +4320,10 @@ int MaskShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
char c[NUM_STR_REP_LEN];
outputNumInput(&(t->num), c);
- sprintf(str, "Feather Shrink/Fatten: %s", c);
+ sprintf(str, IFACE_("Feather Shrink/Fatten: %s"), c);
}
else {
- sprintf(str, "Feather Shrink/Fatten: %3f", ratio);
+ sprintf(str, IFACE_("Feather Shrink/Fatten: %3f"), ratio);
}
/* detect if no points have feather yet */
@@ -4398,11 +4408,11 @@ int PushPull(TransInfo *t, const int UNUSED(mval[2]))
outputNumInput(&(t->num), c);
- sprintf(str, "Push/Pull: %s%s %s", c, t->con.text, t->proptext);
+ sprintf(str, IFACE_("Push/Pull: %s%s %s"), c, t->con.text, t->proptext);
}
else {
/* default header print */
- sprintf(str, "Push/Pull: %.4f%s %s", distance, t->con.text, t->proptext);
+ sprintf(str, IFACE_("Push/Pull: %.4f%s %s"), distance, t->con.text, t->proptext);
}
t->values[0] = distance;
@@ -4519,7 +4529,7 @@ int Bevel(TransInfo *t, const int UNUSED(mval[2]))
const char *mode;
TransData *td = t->data;
- mode = (G.editBMesh->options & BME_BEVEL_VERT) ? "verts only" : "normal";
+ mode = (G.editBMesh->options & BME_BEVEL_VERT) ? IFACE_("verts only") : IFACE_("normal");
distance = t->values[0] / 4; /* 4 just seemed a nice value to me, nothing special */
distance = fabs(distance);
@@ -4534,11 +4544,11 @@ int Bevel(TransInfo *t, const int UNUSED(mval[2]))
outputNumInput(&(t->num), c);
- sprintf(str, "Bevel - Dist: %s, Mode: %s (MMB to toggle))", c, mode);
+ sprintf(str, IFACE_("Bevel - Dist: %s, Mode: %s (MMB to toggle))"), c, mode);
}
else {
/* default header print */
- sprintf(str, "Bevel - Dist: %.4f, Mode: %s (MMB to toggle))", distance, mode);
+ sprintf(str, IFACE_("Bevel - Dist: %.4f, Mode: %s (MMB to toggle))"), distance, mode);
}
if (distance < 0) distance = -distance;
@@ -4602,16 +4612,16 @@ int BevelWeight(TransInfo *t, const int UNUSED(mval[2]))
outputNumInput(&(t->num), c);
if (weight >= 0.0f)
- sprintf(str, "Bevel Weight: +%s %s", c, t->proptext);
+ sprintf(str, IFACE_("Bevel Weight: +%s %s"), c, t->proptext);
else
- sprintf(str, "Bevel Weight: %s %s", c, t->proptext);
+ sprintf(str, IFACE_("Bevel Weight: %s %s"), c, t->proptext);
}
else {
/* default header print */
if (weight >= 0.0f)
- sprintf(str, "Bevel Weight: +%.3f %s", weight, t->proptext);
+ sprintf(str, IFACE_("Bevel Weight: +%.3f %s"), weight, t->proptext);
else
- sprintf(str, "Bevel Weight: %.3f %s", weight, t->proptext);
+ sprintf(str, IFACE_("Bevel Weight: %.3f %s"), weight, t->proptext);
}
for (i = 0; i < t->total; i++, td++) {
@@ -4675,16 +4685,16 @@ int Crease(TransInfo *t, const int UNUSED(mval[2]))
outputNumInput(&(t->num), c);
if (crease >= 0.0f)
- sprintf(str, "Crease: +%s %s", c, t->proptext);
+ sprintf(str, IFACE_("Crease: +%s %s"), c, t->proptext);
else
- sprintf(str, "Crease: %s %s", c, t->proptext);
+ sprintf(str, IFACE_("Crease: %s %s"), c, t->proptext);
}
else {
/* default header print */
if (crease >= 0.0f)
- sprintf(str, "Crease: +%.3f %s", crease, t->proptext);
+ sprintf(str, IFACE_("Crease: +%.3f %s"), crease, t->proptext);
else
- sprintf(str, "Crease: %.3f %s", crease, t->proptext);
+ sprintf(str, IFACE_("Crease: %.3f %s"), crease, t->proptext);
}
for (i = 0; i < t->total; i++, td++) {
@@ -4743,14 +4753,14 @@ static void headerBoneSize(TransInfo *t, float vec[3], char *str)
/* hmm... perhaps the y-axis values don't need to be shown? */
if (t->con.mode & CON_APPLY) {
if (t->num.idx_max == 0)
- sprintf(str, "ScaleB: %s%s %s", &tvec[0], t->con.text, t->proptext);
+ sprintf(str, IFACE_("ScaleB: %s%s %s"), &tvec[0], t->con.text, t->proptext);
else
- sprintf(str, "ScaleB: %s : %s : %s%s %s", &tvec[0], &tvec[NUM_STR_REP_LEN], &tvec[NUM_STR_REP_LEN * 2],
- t->con.text, t->proptext);
+ sprintf(str, IFACE_("ScaleB: %s : %s : %s%s %s"), &tvec[0], &tvec[NUM_STR_REP_LEN],
+ &tvec[NUM_STR_REP_LEN * 2], t->con.text, t->proptext);
}
else {
- sprintf(str, "ScaleB X: %s Y: %s Z: %s%s %s", &tvec[0], &tvec[NUM_STR_REP_LEN], &tvec[NUM_STR_REP_LEN * 2],
- t->con.text, t->proptext);
+ sprintf(str, IFACE_("ScaleB X: %s Y: %s Z: %s%s %s"), &tvec[0], &tvec[NUM_STR_REP_LEN],
+ &tvec[NUM_STR_REP_LEN * 2], t->con.text, t->proptext);
}
}
@@ -4866,10 +4876,10 @@ int BoneEnvelope(TransInfo *t, const int UNUSED(mval[2]))
char c[NUM_STR_REP_LEN];
outputNumInput(&(t->num), c);
- sprintf(str, "Envelope: %s", c);
+ sprintf(str, IFACE_("Envelope: %s"), c);
}
else {
- sprintf(str, "Envelope: %3f", ratio);
+ sprintf(str, IFACE_("Envelope: %3f"), ratio);
}
for (i = 0; i < t->total; i++, td++) {
@@ -5922,12 +5932,12 @@ int EdgeSlide(TransInfo *t, const int UNUSED(mval[2]))
outputNumInput(&(t->num), c);
- BLI_snprintf(str, sizeof(str), "Edge Slide: %s (E)ven: %s, (F)lipped: %s",
- &c[0], !is_proportional ? "ON" : "OFF", flipped ? "ON" : "OFF");
+ BLI_snprintf(str, sizeof(str), IFACE_("Edge Slide: %s (E)ven: %s, (F)lipped: %s"),
+ &c[0], !is_proportional ? IFACE_("ON") : IFACE_("OFF"), flipped ? IFACE_("ON") : IFACE_("OFF"));
}
else {
- BLI_snprintf(str, sizeof(str), "Edge Slide: %.4f (E)ven: %s, (F)lipped: %s",
- final, !is_proportional ? "ON" : "OFF", flipped ? "ON" : "OFF");
+ BLI_snprintf(str, sizeof(str), IFACE_("Edge Slide: %.4f (E)ven: %s, (F)lipped: %s"),
+ final, !is_proportional ? IFACE_("ON") : IFACE_("OFF"), flipped ? IFACE_("ON") : IFACE_("OFF"));
}
CLAMP(final, -1.0f, 1.0f);
@@ -5938,7 +5948,7 @@ int EdgeSlide(TransInfo *t, const int UNUSED(mval[2]))
if (t->customData)
doEdgeSlide(t, final);
else {
- strcpy(str, "Invalid Edge Selection");
+ strcpy(str, IFACE_("Invalid Edge Selection"));
t->state = TRANS_CANCEL;
}
@@ -6054,7 +6064,6 @@ static int createVertSlideVerts(TransInfo *t)
}
sld->is_proportional = true;
- sld->is_clamp = true;
sld->curr_sv_index = 0;
sld->flipped_vtx = false;
@@ -6252,7 +6261,7 @@ int handleEventVertSlide(struct TransInfo *t, struct wmEvent *event)
{
/* use like a modifier key */
if (event->val == KM_PRESS) {
- sld->is_clamp = !sld->is_clamp;
+ t->flag ^= T_ALT_TRANSFORM;
calcVertSlideCustomPoints(t);
return 1;
}
@@ -6278,7 +6287,8 @@ int handleEventVertSlide(struct TransInfo *t, struct wmEvent *event)
case MOUSEMOVE:
{
/* don't recalculat the best edge */
- if (sld->is_clamp) {
+ const bool is_clamp = !(t->flag & T_ALT_TRANSFORM);
+ if (is_clamp) {
calcVertSlideMouseActiveEdges(t, event->mval);
}
calcVertSlideCustomPoints(t);
@@ -6303,6 +6313,7 @@ static void drawVertSlide(const struct bContext *C, TransInfo *t)
const float ctrl_size = UI_GetThemeValuef(TH_FACEDOT_SIZE) + 1.5f;
const float line_size = UI_GetThemeValuef(TH_OUTLINE_WIDTH) + 0.5f;
const int alpha_shade = -30;
+ const bool is_clamp = !(t->flag & T_ALT_TRANSFORM);
int i;
if (v3d && v3d->zbuf)
@@ -6319,7 +6330,7 @@ static void drawVertSlide(const struct bContext *C, TransInfo *t)
glLineWidth(line_size);
UI_ThemeColorShadeAlpha(TH_EDGE_SELECT, 80, alpha_shade);
glBegin(GL_LINES);
- if (sld->is_clamp) {
+ if (is_clamp) {
sv = sld->sv;
for (i = 0; i < sld->totsv; i++, sv++) {
glVertex3fv(sv->co_orig_3d);
@@ -6412,7 +6423,8 @@ int VertSlide(TransInfo *t, const int UNUSED(mval[2]))
VertSlideData *sld = t->customData;
const bool flipped = sld->flipped_vtx;
const bool is_proportional = sld->is_proportional;
- const bool is_constrained = !(sld->is_clamp == false || hasNumInput(&t->num));
+ const bool is_clamp = !(t->flag & T_ALT_TRANSFORM);
+ const bool is_constrained = !(is_clamp == false || hasNumInput(&t->num));
final = t->values[0];
@@ -6425,7 +6437,7 @@ int VertSlide(TransInfo *t, const int UNUSED(mval[2]))
/* header string */
str_p = str;
- str_p += BLI_snprintf(str_p, sizeof(str), "Vert Slide: ");
+ str_p += BLI_snprintf(str_p, sizeof(str), IFACE_("Vert Slide: "));
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
applyNumInput(&t->num, &final);
@@ -6435,24 +6447,22 @@ int VertSlide(TransInfo *t, const int UNUSED(mval[2]))
else {
str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), "%.4f ", final);
}
- str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), "(E)ven: %s, ", !is_proportional ? "ON" : "OFF");
+ str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), IFACE_("(E)ven: %s, "),
+ !is_proportional ? IFACE_("ON") : IFACE_("OFF"));
if (!is_proportional) {
- str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), "(F)lipped: %s, ", flipped ? "ON" : "OFF");
+ str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), IFACE_("(F)lipped: %s, "),
+ flipped ? IFACE_("ON") : IFACE_("OFF"));
}
- str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), "(C)lamp: %s", sld->is_clamp ? "ON" : "OFF");
+ str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), IFACE_("Alt or (C)lamp: %s"),
+ is_clamp ? IFACE_("ON") : IFACE_("OFF"));
/* done with header string */
- if (is_constrained) {
- CLAMP(final, 0.0f, 1.0f);
- }
-
- t->values[0] = final;
-
/*do stuff here*/
- if (t->customData)
+ if (t->customData) {
doVertSlide(t, final);
+ }
else {
- strcpy(str, "Invalid Vert Selection");
+ strcpy(str, IFACE_("Invalid Vert Selection"));
t->state = TRANS_CANCEL;
}
@@ -6503,12 +6513,12 @@ int BoneRoll(TransInfo *t, const int UNUSED(mval[2]))
outputNumInput(&(t->num), c);
- sprintf(str, "Roll: %s", &c[0]);
+ sprintf(str, IFACE_("Roll: %s"), &c[0]);
final = DEG2RADF(final);
}
else {
- sprintf(str, "Roll: %.2f", RAD2DEGF(final));
+ sprintf(str, IFACE_("Roll: %.2f"), RAD2DEGF(final));
}
/* set roll values */
@@ -6574,16 +6584,16 @@ int BakeTime(TransInfo *t, const int mval[2])
outputNumInput(&(t->num), c);
if (time >= 0.0f)
- sprintf(str, "Time: +%s %s", c, t->proptext);
+ sprintf(str, IFACE_("Time: +%s %s"), c, t->proptext);
else
- sprintf(str, "Time: %s %s", c, t->proptext);
+ sprintf(str, IFACE_("Time: %s %s"), c, t->proptext);
}
else {
/* default header print */
if (time >= 0.0f)
- sprintf(str, "Time: +%.3f %s", time, t->proptext);
+ sprintf(str, IFACE_("Time: +%.3f %s"), time, t->proptext);
else
- sprintf(str, "Time: %.3f %s", time, t->proptext);
+ sprintf(str, IFACE_("Time: %.3f %s"), time, t->proptext);
}
for (i = 0; i < t->total; i++, td++) {
@@ -6643,7 +6653,7 @@ int Mirror(TransInfo *t, const int UNUSED(mval[2]))
t->con.applySize(t, NULL, mat);
}
- sprintf(str, "Mirror%s", t->con.text);
+ sprintf(str, IFACE_("Mirror%s"), t->con.text);
for (i = 0, td = t->data; i < t->total; i++, td++) {
if (td->flag & TD_NOACTION)
@@ -6677,9 +6687,9 @@ int Mirror(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
if (t->flag & T_2D_EDIT)
- ED_area_headerprint(t->sa, "Select a mirror axis (X, Y)");
+ ED_area_headerprint(t->sa, IFACE_("Select a mirror axis (X, Y)"));
else
- ED_area_headerprint(t->sa, "Select a mirror axis (X, Y, Z)");
+ ED_area_headerprint(t->sa, IFACE_("Select a mirror axis (X, Y, Z)"));
}
return 1;
@@ -6736,7 +6746,7 @@ int Align(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, "Align");
+ ED_area_headerprint(t->sa, IFACE_("Align"));
return 1;
}
@@ -6773,7 +6783,7 @@ static void headerSeqSlide(TransInfo *t, float val[2], char *str, size_t str_len
}
str_p = str;
- str_p += BLI_snprintf(str, str_len, "Sequence Slide: %s%s, (", &tvec[0], t->con.text);
+ str_p += BLI_snprintf(str, str_len, IFACE_("Sequence Slide: %s%s, ("), &tvec[0], t->con.text);
{
wmKeyMapItem *kmi = WM_modalkeymap_find_propvalue(t->keymap, TFM_MODAL_TRANSLATE);
@@ -6781,8 +6791,8 @@ static void headerSeqSlide(TransInfo *t, float val[2], char *str, size_t str_len
str_p += WM_keymap_item_to_string(kmi, str_p, str_len - (str_p - str));
}
}
- str_p += BLI_snprintf(str_p, str_len - (str_p - str), " or Alt) Expand to fit %s",
- (t->flag & T_ALT_TRANSFORM) ? "ON" : "OFF");
+ str_p += BLI_snprintf(str_p, str_len - (str_p - str), IFACE_(" or Alt) Expand to fit %s"),
+ (t->flag & T_ALT_TRANSFORM) ? IFACE_("ON") : IFACE_("OFF"));
}
static void applySeqSlide(TransInfo *t, float val[2])
@@ -7047,7 +7057,7 @@ static void headerTimeTranslate(TransInfo *t, char *str)
sprintf(&tvec[0], "%.4f", val);
}
- sprintf(str, "DeltaX: %s", &tvec[0]);
+ sprintf(str, IFACE_("DeltaX: %s"), &tvec[0]);
}
static void applyTimeTranslate(TransInfo *t, float UNUSED(sval))
@@ -7188,7 +7198,7 @@ static void headerTimeSlide(TransInfo *t, float sval, char *str)
sprintf(&tvec[0], "%.4f", val);
}
- sprintf(str, "TimeSlide: %s", &tvec[0]);
+ sprintf(str, IFACE_("TimeSlide: %s"), &tvec[0]);
}
static void applyTimeSlide(TransInfo *t, float sval)
@@ -7320,7 +7330,7 @@ static void headerTimeScale(TransInfo *t, char *str)
else
sprintf(&tvec[0], "%.4f", t->values[0]);
- sprintf(str, "ScaleX: %s", &tvec[0]);
+ sprintf(str, IFACE_("ScaleX: %s"), &tvec[0]);
}
static void applyTimeScale(TransInfo *t)
@@ -7389,3 +7399,10 @@ void BIF_TransformSetUndo(const char *UNUSED(str))
// TRANSFORM_FIX_ME
//Trans.undostr = str;
}
+
+
+/* TODO, move to: transform_queries.c */
+bool checkUseLocalCenter_GraphEdit(TransInfo *t)
+{
+ return ((t->around == V3D_LOCAL) && !ELEM3(t->mode, TFM_TRANSLATION, TFM_TIME_TRANSLATE, TFM_TIME_SLIDE));
+}
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index 78f346be2aa..9c57c74a26d 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -239,7 +239,6 @@ typedef struct VertSlideData {
float perc;
bool is_proportional;
- bool is_clamp;
bool flipped_vtx;
int curr_sv_index;
@@ -746,4 +745,8 @@ void projectEdgeSlideData(TransInfo *t, bool is_final);
void freeVertSlideVerts(TransInfo *t);
+
+/* TODO. transform_queries.c */
+bool checkUseLocalCenter_GraphEdit(TransInfo *t);
+
#endif
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index 097e4592933..c4d61472f18 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -60,6 +60,8 @@
#include "BLI_utildefines.h"
#include "BLI_string.h"
+#include "BLF_translation.h"
+
#include "UI_resources.h"
#include "transform.h"
@@ -598,24 +600,24 @@ void setUserConstraint(TransInfo *t, short orientation, int mode, const char fte
case V3D_MANIP_GLOBAL:
{
float mtx[3][3] = MAT3_UNITY;
- BLI_snprintf(text, sizeof(text), ftext, "global");
+ BLI_snprintf(text, sizeof(text), ftext, IFACE_("global"));
setConstraint(t, mtx, mode, text);
}
break;
case V3D_MANIP_LOCAL:
- BLI_snprintf(text, sizeof(text), ftext, "local");
+ BLI_snprintf(text, sizeof(text), ftext, IFACE_("local"));
setLocalConstraint(t, mode, text);
break;
case V3D_MANIP_NORMAL:
- BLI_snprintf(text, sizeof(text), ftext, "normal");
+ BLI_snprintf(text, sizeof(text), ftext, IFACE_("normal"));
setConstraint(t, t->spacemtx, mode, text);
break;
case V3D_MANIP_VIEW:
- BLI_snprintf(text, sizeof(text), ftext, "view");
+ BLI_snprintf(text, sizeof(text), ftext, IFACE_("view"));
setConstraint(t, t->spacemtx, mode, text);
break;
case V3D_MANIP_GIMBAL:
- BLI_snprintf(text, sizeof(text), ftext, "gimbal");
+ BLI_snprintf(text, sizeof(text), ftext, IFACE_("gimbal"));
setConstraint(t, t->spacemtx, mode, text);
break;
default: /* V3D_MANIP_CUSTOM */
@@ -865,11 +867,11 @@ static void setNearestAxis2d(TransInfo *t)
/* no correction needed... just use whichever one is lower */
if (abs(t->mval[0] - t->con.imval[0]) < abs(t->mval[1] - t->con.imval[1]) ) {
t->con.mode |= CON_AXIS1;
- BLI_snprintf(t->con.text, sizeof(t->con.text), " along Y axis");
+ BLI_snprintf(t->con.text, sizeof(t->con.text), IFACE_(" along Y axis"));
}
else {
t->con.mode |= CON_AXIS0;
- BLI_snprintf(t->con.text, sizeof(t->con.text), " along X axis");
+ BLI_snprintf(t->con.text, sizeof(t->con.text), IFACE_(" along X axis"));
}
}
@@ -920,31 +922,31 @@ static void setNearestAxis3d(TransInfo *t)
if (len[0] <= len[1] && len[0] <= len[2]) {
if (t->modifiers & MOD_CONSTRAINT_PLANE) {
t->con.mode |= (CON_AXIS1 | CON_AXIS2);
- BLI_snprintf(t->con.text, sizeof(t->con.text), " locking %s X axis", t->spacename);
+ BLI_snprintf(t->con.text, sizeof(t->con.text), IFACE_(" locking %s X axis"), t->spacename);
}
else {
t->con.mode |= CON_AXIS0;
- BLI_snprintf(t->con.text, sizeof(t->con.text), " along %s X axis", t->spacename);
+ BLI_snprintf(t->con.text, sizeof(t->con.text), IFACE_(" along %s X axis"), t->spacename);
}
}
else if (len[1] <= len[0] && len[1] <= len[2]) {
if (t->modifiers & MOD_CONSTRAINT_PLANE) {
t->con.mode |= (CON_AXIS0 | CON_AXIS2);
- BLI_snprintf(t->con.text, sizeof(t->con.text), " locking %s Y axis", t->spacename);
+ BLI_snprintf(t->con.text, sizeof(t->con.text), IFACE_(" locking %s Y axis"), t->spacename);
}
else {
t->con.mode |= CON_AXIS1;
- BLI_snprintf(t->con.text, sizeof(t->con.text), " along %s Y axis", t->spacename);
+ BLI_snprintf(t->con.text, sizeof(t->con.text), IFACE_(" along %s Y axis"), t->spacename);
}
}
else if (len[2] <= len[1] && len[2] <= len[0]) {
if (t->modifiers & MOD_CONSTRAINT_PLANE) {
t->con.mode |= (CON_AXIS0 | CON_AXIS1);
- BLI_snprintf(t->con.text, sizeof(t->con.text), " locking %s Z axis", t->spacename);
+ BLI_snprintf(t->con.text, sizeof(t->con.text), IFACE_(" locking %s Z axis"), t->spacename);
}
else {
t->con.mode |= CON_AXIS2;
- BLI_snprintf(t->con.text, sizeof(t->con.text), " along %s Z axis", t->spacename);
+ BLI_snprintf(t->con.text, sizeof(t->con.text), IFACE_(" along %s Z axis"), t->spacename);
}
}
}
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 7d62775ae58..5be06188e4e 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -123,6 +123,7 @@
#include "BLO_sys_types.h" // for intptr_t support
+
/* local function prototype - for Object/Bone Constraints */
static short constraints_list_needinv(TransInfo *t, ListBase *list);
@@ -3530,7 +3531,9 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
int count = 0, i;
float cfra;
float mtx[3][3], smtx[3][3];
- const short use_handle = !(sipo->flag & SIPO_NOHANDLES);
+ const bool use_handle = !(sipo->flag & SIPO_NOHANDLES);
+ const bool use_local_center = checkUseLocalCenter_GraphEdit(t);
+ const short anim_map_flag = ANIM_UNITCONV_ONLYSEL | ANIM_UNITCONV_SELVERTS;
/* determine what type of data we are operating on */
if (ANIM_animdata_get_context(C, &ac) == 0)
@@ -3662,7 +3665,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
if (fcu->bezt == NULL)
continue;
- ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, ANIM_UNITCONV_ONLYSEL | ANIM_UNITCONV_SELVERTS);
+ ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, anim_map_flag);
/* 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++) {
@@ -3697,7 +3700,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
}
/* only include main vert if selected */
- if (sel2 && (sipo->around != V3D_LOCAL || ELEM3(t->mode, TFM_TRANSLATION, TFM_TIME_TRANSLATE, TFM_TIME_SLIDE))) {
+ if (sel2 && (use_local_center == false)) {
/* move handles relative to center */
if (ELEM3(t->mode, TFM_TRANSLATION, TFM_TIME_TRANSLATE, TFM_TIME_SLIDE)) {
@@ -3733,6 +3736,13 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
/* Sets handles based on the selection */
testhandles_fcurve(fcu, use_handle);
+
+ /* even though transform values are written back right after during transform,
+ * using individual center's with rotation means the center point wont
+ * be touched again see: [#34303] */
+ if (use_local_center) {
+ ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, anim_map_flag | ANIM_UNITCONV_RESTORE);
+ }
}
/* cleanup temp list */
@@ -4733,6 +4743,7 @@ static void set_trans_object_base_flags(TransInfo *t)
}
/* all recalc flags get flushed to all layers, so a layer flip later on works fine */
+ DAG_scene_relations_update(G.main, t->scene);
DAG_scene_flush_update(G.main, t->scene, -1, 0);
/* and we store them temporal in base (only used for transform code) */
@@ -4810,6 +4821,7 @@ static int count_proportional_objects(TransInfo *t)
/* all recalc flags get flushed to all layers, so a layer flip later on works fine */
+ DAG_scene_relations_update(G.main, t->scene);
DAG_scene_flush_update(G.main, t->scene, -1, 0);
/* and we store them temporal in base (only used for transform code) */
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index ef775ae3128..c2a331f5249 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -56,6 +56,8 @@
#include "BLI_rand.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "RNA_access.h"
#include "BIF_gl.h"
@@ -130,6 +132,7 @@ void getViewVector(TransInfo *t, float coord[3], float vec[3])
/* ************************** GENERICS **************************** */
+
static void clipMirrorModifier(TransInfo *t, Object *ob)
{
ModifierData *md = ob->modifiers.first;
@@ -377,6 +380,8 @@ static void recalcData_graphedit(TransInfo *t)
bAnimListElem *ale;
int dosort = 0;
+
+ const bool use_local_center = checkUseLocalCenter_GraphEdit(t);
/* initialize relevant anim-context 'context' data from TransInfo data */
@@ -405,9 +410,10 @@ static void recalcData_graphedit(TransInfo *t)
/* ignore unselected fcurves */
if (!fcu_test_selected(fcu))
continue;
-
- // fixme: only do this for selected verts...
- ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, ANIM_UNITCONV_ONLYSEL | ANIM_UNITCONV_SELVERTS | ANIM_UNITCONV_RESTORE);
+
+ ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data,
+ ANIM_UNITCONV_ONLYSEL | ANIM_UNITCONV_SELVERTS | ANIM_UNITCONV_RESTORE |
+ (use_local_center ? ANIM_UNITCONV_SKIPKNOTS : 0));
/* watch it: if the time is wrong: do not correct handles yet */
@@ -805,6 +811,7 @@ static void recalcData_view3d(TransInfo *t)
if (td->extra) {
float vec[3], up_axis[3];
float qrot[4];
+ float roll;
ebo = td->extra;
copy_v3_v3(up_axis, td->axismtx[2]);
@@ -819,7 +826,9 @@ static void recalcData_view3d(TransInfo *t)
mul_m3_v3(t->mat, up_axis);
}
- ebo->roll = ED_rollBoneToVector(ebo, up_axis, TRUE);
+ /* roll has a tendency to flip in certain orientations - [#34283], [#33974] */
+ roll = ED_rollBoneToVector(ebo, up_axis, false);
+ ebo->roll = angle_compat_rad(roll, ebo->roll);
}
}
}
@@ -1761,25 +1770,25 @@ void calculatePropRatio(TransInfo *t)
}
switch (t->prop_mode) {
case PROP_SHARP:
- strcpy(t->proptext, "(Sharp)");
+ strcpy(t->proptext, IFACE_("(Sharp)"));
break;
case PROP_SMOOTH:
- strcpy(t->proptext, "(Smooth)");
+ strcpy(t->proptext, IFACE_("(Smooth)"));
break;
case PROP_ROOT:
- strcpy(t->proptext, "(Root)");
+ strcpy(t->proptext, IFACE_("(Root)"));
break;
case PROP_LIN:
- strcpy(t->proptext, "(Linear)");
+ strcpy(t->proptext, IFACE_("(Linear)"));
break;
case PROP_CONST:
- strcpy(t->proptext, "(Constant)");
+ strcpy(t->proptext, IFACE_("(Constant)"));
break;
case PROP_SPHERE:
- strcpy(t->proptext, "(Sphere)");
+ strcpy(t->proptext, IFACE_("(Sphere)"));
break;
case PROP_RANDOM:
- strcpy(t->proptext, "(Random)");
+ strcpy(t->proptext, IFACE_("(Random)"));
break;
default:
t->proptext[0] = '\0';
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index 4bd6496e083..e507d062b0e 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -493,25 +493,25 @@ void initTransformOrientation(bContext *C, TransInfo *t)
switch (t->current_orientation) {
case V3D_MANIP_GLOBAL:
unit_m3(t->spacemtx);
- strcpy(t->spacename, "global");
+ strcpy(t->spacename, IFACE_("global"));
break;
case V3D_MANIP_GIMBAL:
unit_m3(t->spacemtx);
if (gimbal_axis(ob, t->spacemtx)) {
- strcpy(t->spacename, "gimbal");
+ strcpy(t->spacename, IFACE_("gimbal"));
break;
}
/* no gimbal fallthrough to normal */
case V3D_MANIP_NORMAL:
if (obedit || (ob && ob->mode & OB_MODE_POSE)) {
- strcpy(t->spacename, "normal");
+ strcpy(t->spacename, IFACE_("normal"));
ED_getTransformOrientationMatrix(C, t->spacemtx, (v3d->around == V3D_ACTIVE));
break;
}
/* no break we define 'normal' as 'local' in Object mode */
case V3D_MANIP_LOCAL:
- strcpy(t->spacename, "local");
+ strcpy(t->spacename, IFACE_("local"));
if (ob) {
copy_m3_m4(t->spacemtx, ob->obmat);
@@ -528,7 +528,7 @@ void initTransformOrientation(bContext *C, TransInfo *t)
RegionView3D *rv3d = t->ar->regiondata;
float mat[3][3];
- strcpy(t->spacename, "view");
+ strcpy(t->spacename, IFACE_("view"));
copy_m3_m4(mat, rv3d->viewinv);
normalize_m3(mat);
copy_m3_m3(t->spacemtx, mat);
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 5577619901a..2efd35327c7 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -303,6 +303,9 @@ void applyProject(TransInfo *t)
if (td->flag & TD_SKIP)
continue;
+
+ if ((t->flag & T_PROP_EDIT) && (td->factor == 0.0f))
+ continue;
copy_v3_v3(iloc, td->loc);
if (t->flag & (T_EDIT | T_POSE)) {
diff --git a/source/blender/editors/uvedit/CMakeLists.txt b/source/blender/editors/uvedit/CMakeLists.txt
index 1c69e569aa6..695a7cdd0f6 100644
--- a/source/blender/editors/uvedit/CMakeLists.txt
+++ b/source/blender/editors/uvedit/CMakeLists.txt
@@ -22,6 +22,7 @@ set(INC
../include
../../blenkernel
../../blenlib
+ ../../blenfont
../../blenloader
../../bmesh
../../makesdna
@@ -47,4 +48,8 @@ set(SRC
uvedit_parametrizer.h
)
+if(WITH_INTERNATIONAL)
+ add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
blender_add_lib(bf_editor_uvedit "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/uvedit/SConscript b/source/blender/editors/uvedit/SConscript
index 01316680d5d..dfa15d2de4f 100644
--- a/source/blender/editors/uvedit/SConscript
+++ b/source/blender/editors/uvedit/SConscript
@@ -27,10 +27,15 @@
Import ('env')
+defs = []
+
sources = env.Glob('*.c')
-incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
+incs = '../include ../../blenlib ../../blenfont ../../blenkernel ../../makesdna ../../imbuf'
incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
incs += ' ../../bmesh ../../makesrna #/intern/opennl/extern ../../gpu ../../blenloader'
-env.BlenderLib ( 'bf_editors_uvedit', sources, Split(incs), [], libtype=['core'], priority=[45] )
+if env['WITH_BF_INTERNATIONAL']:
+ defs.append('WITH_INTERNATIONAL')
+
+env.BlenderLib ( 'bf_editors_uvedit', sources, Split(incs), defs, libtype=['core'], priority=[45] )
diff --git a/source/blender/editors/uvedit/uvedit_buttons.c b/source/blender/editors/uvedit/uvedit_buttons.c
index 1c32c01b8f0..5c188628978 100644
--- a/source/blender/editors/uvedit/uvedit_buttons.c
+++ b/source/blender/editors/uvedit/uvedit_buttons.c
@@ -43,6 +43,8 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "BKE_context.h"
#include "BKE_customdata.h"
#include "BKE_mesh.h"
@@ -152,8 +154,10 @@ static void uvedit_vertex_buttons(const bContext *C, uiBlock *block)
}
uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_UVEDIT_VERTEX, "X:", 10, 10, 145, 19, &uvedit_old_center[0], -10 * imx, 10.0 * imx, step, digits, "");
- uiDefButF(block, NUM, B_UVEDIT_VERTEX, "Y:", 165, 10, 145, 19, &uvedit_old_center[1], -10 * imy, 10.0 * imy, step, digits, "");
+ uiDefButF(block, NUM, B_UVEDIT_VERTEX, IFACE_("X:"), 10, 10, 145, 19, &uvedit_old_center[0],
+ -10 * imx, 10.0 * imx, step, digits, "");
+ uiDefButF(block, NUM, B_UVEDIT_VERTEX, IFACE_("Y:"), 165, 10, 145, 19, &uvedit_old_center[1],
+ -10 * imy, 10.0 * imy, step, digits, "");
uiBlockEndAlign(block);
}
}
@@ -214,7 +218,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, "UV Vertex");
+ strcpy(pt->label, N_("UV Vertex")); /* XXX C panels are not available 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_intern.h b/source/blender/editors/uvedit/uvedit_intern.h
index 7faec33ca98..d1893d639bb 100644
--- a/source/blender/editors/uvedit/uvedit_intern.h
+++ b/source/blender/editors/uvedit/uvedit_intern.h
@@ -79,7 +79,7 @@ void uvedit_get_aspect(struct Scene *scene, struct Object *ob, struct BMEditMesh
void UV_OT_average_islands_scale(struct wmOperatorType *ot);
void UV_OT_cube_project(struct wmOperatorType *ot);
void UV_OT_cylinder_project(struct wmOperatorType *ot);
-void UV_OT_from_view(struct wmOperatorType *ot);
+void UV_OT_project_from_view(struct wmOperatorType *ot);
void UV_OT_minimize_stretch(struct wmOperatorType *ot);
void UV_OT_pack_islands(struct wmOperatorType *ot);
void UV_OT_reset(struct wmOperatorType *ot);
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index e158f8843b7..a17d3c20c1c 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -4053,7 +4053,7 @@ void ED_operatortypes_uvedit(void)
WM_operatortype_append(UV_OT_average_islands_scale);
WM_operatortype_append(UV_OT_cube_project);
WM_operatortype_append(UV_OT_cylinder_project);
- WM_operatortype_append(UV_OT_from_view);
+ WM_operatortype_append(UV_OT_project_from_view);
WM_operatortype_append(UV_OT_minimize_stretch);
WM_operatortype_append(UV_OT_pack_islands);
WM_operatortype_append(UV_OT_reset);
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 767003bdd84..bf5fc9a3021 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -709,7 +709,7 @@ static void p_face_restore_uvs(PFace *f)
static PVert *p_vert_add(PHandle *handle, PHashKey key, const float co[3], PEdge *e)
{
- PVert *v = (PVert *)BLI_memarena_alloc(handle->arena, sizeof *v);
+ PVert *v = (PVert *)BLI_memarena_alloc(handle->arena, sizeof(*v));
copy_v3_v3(v->co, co);
v->u.key = key;
v->edge = e;
@@ -732,7 +732,7 @@ static PVert *p_vert_lookup(PHandle *handle, PHashKey key, const float co[3], PE
static PVert *p_vert_copy(PChart *chart, PVert *v)
{
- PVert *nv = (PVert *)BLI_memarena_alloc(chart->handle->arena, sizeof *nv);
+ PVert *nv = (PVert *)BLI_memarena_alloc(chart->handle->arena, sizeof(*nv));
copy_v3_v3(nv->co, v->co);
nv->uv[0] = v->uv[0];
@@ -786,7 +786,7 @@ static int p_face_exists(ParamHandle *phandle, ParamKey *pvkeys, int i1, int i2,
static PChart *p_chart_new(PHandle *handle)
{
- PChart *chart = (PChart *)MEM_callocN(sizeof *chart, "PChart");
+ PChart *chart = (PChart *)MEM_callocN(sizeof(*chart), "PChart");
chart->handle = handle;
return chart;
@@ -904,7 +904,7 @@ static PBool p_edge_connect_pair(PHandle *handle, PEdge *e, PEdge ***stack, PBoo
static int p_connect_pairs(PHandle *handle, PBool impl)
{
- PEdge **stackbase = MEM_mallocN(sizeof *stackbase * phash_size(handle->hash_faces), "Pstackbase");
+ PEdge **stackbase = MEM_mallocN(sizeof(*stackbase) * phash_size(handle->hash_faces), "Pstackbase");
PEdge **stack = stackbase;
PFace *f, *first;
PEdge *e, *e1, *e2;
@@ -999,7 +999,7 @@ static void p_split_vert(PChart *chart, PEdge *e)
static PChart **p_split_charts(PHandle *handle, PChart *chart, int ncharts)
{
- PChart **charts = MEM_mallocN(sizeof *charts * ncharts, "PCharts"), *nchart;
+ PChart **charts = MEM_mallocN(sizeof(*charts) * ncharts, "PCharts"), *nchart;
PFace *f, *nextf;
int i;
@@ -1041,12 +1041,12 @@ static PFace *p_face_add(PHandle *handle)
PEdge *e1, *e2, *e3;
/* allocate */
- f = (PFace *)BLI_memarena_alloc(handle->arena, sizeof *f);
+ f = (PFace *)BLI_memarena_alloc(handle->arena, sizeof(*f));
f->flag = 0; /* init ! */
- e1 = (PEdge *)BLI_memarena_alloc(handle->arena, sizeof *e1);
- e2 = (PEdge *)BLI_memarena_alloc(handle->arena, sizeof *e2);
- e3 = (PEdge *)BLI_memarena_alloc(handle->arena, sizeof *e3);
+ e1 = (PEdge *)BLI_memarena_alloc(handle->arena, sizeof(*e1));
+ e2 = (PEdge *)BLI_memarena_alloc(handle->arena, sizeof(*e2));
+ e3 = (PEdge *)BLI_memarena_alloc(handle->arena, sizeof(*e3));
/* set up edges */
f->edge = e1;
@@ -3674,7 +3674,7 @@ static PBool p_triangle_inside(SmoothTriangle *t, float co[2])
static SmoothNode *p_node_new(MemArena *arena, SmoothTriangle **tri, int ntri, float *bmin, float *bmax, int depth)
{
- SmoothNode *node = BLI_memarena_alloc(arena, sizeof *node);
+ SmoothNode *node = BLI_memarena_alloc(arena, sizeof(*node));
int axis, i, t1size = 0, t2size = 0;
float split, /* mi, */ /* UNUSED */ mx;
SmoothTriangle **t1, **t2, *t;
@@ -4114,7 +4114,7 @@ static void p_smooth(PChart *chart)
ParamHandle *param_construct_begin(void)
{
- PHandle *handle = MEM_callocN(sizeof *handle, "PHandle");
+ PHandle *handle = MEM_callocN(sizeof(*handle), "PHandle");
handle->construction_chart = p_chart_new(handle);
handle->state = PHANDLE_STATE_ALLOCATED;
handle->arena = BLI_memarena_new((1 << 16), "param construct arena");
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index 00b82e26a05..4ddf4bd6a5c 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -1387,7 +1387,7 @@ static int uv_from_view_poll(bContext *C)
return (rv3d != NULL);
}
-void UV_OT_from_view(wmOperatorType *ot)
+void UV_OT_project_from_view(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Project From View";
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 80f35d531cd..c631f7efbe9 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -395,7 +395,12 @@ static void gpu_set_alpha_blend(GPUBlendMode alphablend)
}
else if (ELEM(alphablend, GPU_BLEND_ALPHA, GPU_BLEND_ALPHA_SORT)) {
glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ /* for OpenGL render we use the alpha channel, this makes alpha blend correct */
+ if (GLEW_VERSION_1_4)
+ glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ else
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
/* if U.glalphaclip == 1.0, some cards go bonkers...
* turn off alpha test in this case */
diff --git a/source/blender/imbuf/intern/IMB_colormanagement_intern.h b/source/blender/imbuf/intern/IMB_colormanagement_intern.h
index ba9e20ac411..e2a8e1e3442 100644
--- a/source/blender/imbuf/intern/IMB_colormanagement_intern.h
+++ b/source/blender/imbuf/intern/IMB_colormanagement_intern.h
@@ -33,8 +33,6 @@
#include "DNA_listBase.h"
-#define BCM_CONFIG_FILE "config.ocio"
-
struct OCIO_ConstProcessorRcPtr;
struct ImBuf;
diff --git a/source/blender/imbuf/intern/dds/dds_api.cpp b/source/blender/imbuf/intern/dds/dds_api.cpp
index 4098b466377..0c240f16227 100644
--- a/source/blender/imbuf/intern/dds/dds_api.cpp
+++ b/source/blender/imbuf/intern/dds/dds_api.cpp
@@ -96,7 +96,7 @@ struct ImBuf *imb_load_dds(unsigned char *mem, size_t size, int flags, char colo
Color32 pixel;
Color32 *pixels = 0;
- /* OCIO_TODO: never was able to save DDS, so can'ttest loading
+ /* OCIO_TODO: never was able to save DDS, so can't test loading
* but profile used to be set to sRGB and can't see rect_float here, so
* default byte space should work fine
*/
diff --git a/source/blender/imbuf/intern/iris.c b/source/blender/imbuf/intern/iris.c
index dec5f6fb39e..47bd3e54a6f 100644
--- a/source/blender/imbuf/intern/iris.c
+++ b/source/blender/imbuf/intern/iris.c
@@ -672,7 +672,7 @@ static void expandrow(unsigned char *optr, unsigned char *iptr, int z)
* represents one pixel. xsize and ysize specify the dimensions of
* the pixel array. zsize specifies what kind of image file to
* write out. if zsize is 1, the luminance of the pixels are
- * calculated, and a sinlge channel black and white image is saved.
+ * calculated, and a single channel black and white image is saved.
* If zsize is 3, an RGB image file is saved. If zsize is 4, an
* RGBA image file is saved.
*
diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c
index ff0aeb068e2..3d04b8ee184 100644
--- a/source/blender/imbuf/intern/jp2.c
+++ b/source/blender/imbuf/intern/jp2.c
@@ -108,6 +108,13 @@ static void info_callback(const char *msg, void *client_data)
i++, _rect += 4) \
{ \
+# define PIXEL_LOOPER_BEGIN_CHANNELS(_rect, _channels) \
+ for (y = h - 1; y != (unsigned int)(-1); y--) { \
+ for (i = y * w, i_next = (y + 1) * w; \
+ i < i_next; \
+ i++, _rect += _channels) \
+ { \
+
# define PIXEL_LOOPER_END \
} \
} (void)0 \
@@ -663,76 +670,198 @@ static opj_image_t *ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters)
}
if (rect_float) {
+ int channels_in_float = ibuf->channels ? ibuf->channels : 4;
+
switch (prec) {
case 8: /* Convert blenders float color channels to 8, 12 or 16bit ints */
if (numcomps == 4) {
- PIXEL_LOOPER_BEGIN(rect_float)
- {
- premul_to_straight_v4_v4(from_straight, rect_float);
- r[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(from_straight[0]));
- g[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(from_straight[1]));
- b[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(from_straight[2]));
- a[i] = DOWNSAMPLE_FLOAT_TO_8BIT(from_straight[3]);
+ if (channels_in_float == 4) {
+ PIXEL_LOOPER_BEGIN(rect_float)
+ {
+ premul_to_straight_v4_v4(from_straight, rect_float);
+ r[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(from_straight[0]));
+ g[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(from_straight[1]));
+ b[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(from_straight[2]));
+ a[i] = DOWNSAMPLE_FLOAT_TO_8BIT(from_straight[3]);
+ }
+ PIXEL_LOOPER_END;
+ }
+ else if (channels_in_float == 3) {
+ PIXEL_LOOPER_BEGIN_CHANNELS(rect_float, 3)
+ {
+ r[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(rect_float[0]));
+ g[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(rect_float[1]));
+ b[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(rect_float[2]));
+ a[i] = 255;
+ }
+ PIXEL_LOOPER_END;
+ }
+ else {
+ PIXEL_LOOPER_BEGIN_CHANNELS(rect_float, 1)
+ {
+ r[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(rect_float[0]));
+ g[i] = b[i] = r[i];
+ a[i] = 255;
+ }
+ PIXEL_LOOPER_END;
}
- PIXEL_LOOPER_END;
}
else {
- PIXEL_LOOPER_BEGIN(rect_float)
- {
- premul_to_straight_v4_v4(from_straight, rect_float);
- r[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(from_straight[0]));
- g[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(from_straight[1]));
- b[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(from_straight[2]));
+ if (channels_in_float == 4) {
+ PIXEL_LOOPER_BEGIN(rect_float)
+ {
+ premul_to_straight_v4_v4(from_straight, rect_float);
+ r[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(from_straight[0]));
+ g[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(from_straight[1]));
+ b[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(from_straight[2]));
+ }
+ PIXEL_LOOPER_END;
+ }
+ else if (channels_in_float == 3) {
+ PIXEL_LOOPER_BEGIN_CHANNELS(rect_float, 3)
+ {
+ r[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(rect_float[0]));
+ g[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(rect_float[1]));
+ b[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(rect_float[2]));
+ }
+ PIXEL_LOOPER_END;
+ }
+ else {
+ PIXEL_LOOPER_BEGIN_CHANNELS(rect_float, 1)
+ {
+ r[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(rect_float[0]));
+ g[i] = b[i] = r[i];
+ }
+ PIXEL_LOOPER_END;
}
- PIXEL_LOOPER_END;
}
break;
case 12:
if (numcomps == 4) {
- PIXEL_LOOPER_BEGIN(rect_float)
- {
- premul_to_straight_v4_v4(from_straight, rect_float);
- r[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(from_straight[0]));
- g[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(from_straight[1]));
- b[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(from_straight[2]));
- a[i] = DOWNSAMPLE_FLOAT_TO_12BIT(from_straight[3]);
+ if (channels_in_float == 4) {
+ PIXEL_LOOPER_BEGIN(rect_float)
+ {
+ premul_to_straight_v4_v4(from_straight, rect_float);
+ r[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(from_straight[0]));
+ g[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(from_straight[1]));
+ b[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(from_straight[2]));
+ a[i] = DOWNSAMPLE_FLOAT_TO_12BIT(from_straight[3]);
+ }
+ PIXEL_LOOPER_END;
+ }
+ else if (channels_in_float == 3) {
+ PIXEL_LOOPER_BEGIN_CHANNELS(rect_float, 3)
+ {
+ r[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(rect_float[0]));
+ g[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(rect_float[1]));
+ b[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(rect_float[2]));
+ a[i] = 4095;
+ }
+ PIXEL_LOOPER_END;
+ }
+ else {
+ PIXEL_LOOPER_BEGIN_CHANNELS(rect_float, 1)
+ {
+ r[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(rect_float[0]));
+ g[i] = b[i] = r[i];
+ a[i] = 4095;
+ }
+ PIXEL_LOOPER_END;
}
- PIXEL_LOOPER_END;
}
else {
- PIXEL_LOOPER_BEGIN(rect_float)
- {
- premul_to_straight_v4_v4(from_straight, rect_float);
- r[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(from_straight[0]));
- g[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(from_straight[1]));
- b[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(from_straight[2]));
+ if (channels_in_float == 4) {
+ PIXEL_LOOPER_BEGIN(rect_float)
+ {
+ premul_to_straight_v4_v4(from_straight, rect_float);
+ r[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(from_straight[0]));
+ g[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(from_straight[1]));
+ b[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(from_straight[2]));
+ }
+ PIXEL_LOOPER_END;
+ }
+ else if (channels_in_float == 3) {
+ PIXEL_LOOPER_BEGIN_CHANNELS(rect_float, 3)
+ {
+ r[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(rect_float[0]));
+ g[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(rect_float[1]));
+ b[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(rect_float[2]));
+ }
+ PIXEL_LOOPER_END;
+ }
+ else {
+ PIXEL_LOOPER_BEGIN_CHANNELS(rect_float, 1)
+ {
+ r[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(rect_float[0]));
+ g[i] = b[i] = r[i];
+ }
+ PIXEL_LOOPER_END;
}
- PIXEL_LOOPER_END;
}
break;
case 16:
if (numcomps == 4) {
- PIXEL_LOOPER_BEGIN(rect_float)
- {
- premul_to_straight_v4_v4(from_straight, rect_float);
- r[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(from_straight[0]));
- g[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(from_straight[1]));
- b[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(from_straight[2]));
- a[i] = DOWNSAMPLE_FLOAT_TO_16BIT(from_straight[3]);
+ if (channels_in_float == 4){
+ PIXEL_LOOPER_BEGIN(rect_float)
+ {
+ premul_to_straight_v4_v4(from_straight, rect_float);
+ r[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(from_straight[0]));
+ g[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(from_straight[1]));
+ b[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(from_straight[2]));
+ a[i] = DOWNSAMPLE_FLOAT_TO_16BIT(from_straight[3]);
+ }
+ PIXEL_LOOPER_END;
+ }
+ else if (channels_in_float == 3) {
+ PIXEL_LOOPER_BEGIN_CHANNELS(rect_float, 3)
+ {
+ r[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(rect_float[0]));
+ g[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(rect_float[1]));
+ b[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(rect_float[2]));
+ a[i] = 65535;
+ }
+ PIXEL_LOOPER_END;
+ }
+ else {
+ PIXEL_LOOPER_BEGIN_CHANNELS(rect_float, 1)
+ {
+ r[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(rect_float[0]));
+ g[i] = b[i] = r[i];
+ a[i] = 65535;
+ }
+ PIXEL_LOOPER_END;
}
- PIXEL_LOOPER_END;
}
else {
- PIXEL_LOOPER_BEGIN(rect_float)
- {
- premul_to_straight_v4_v4(from_straight, rect_float);
- r[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(from_straight[0]));
- g[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(from_straight[1]));
- b[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(from_straight[2]));
+ if (channels_in_float == 4) {
+ PIXEL_LOOPER_BEGIN(rect_float)
+ {
+ premul_to_straight_v4_v4(from_straight, rect_float);
+ r[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(from_straight[0]));
+ g[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(from_straight[1]));
+ b[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(from_straight[2]));
+ }
+ PIXEL_LOOPER_END;
+ }
+ else if (channels_in_float == 3) {
+ PIXEL_LOOPER_BEGIN_CHANNELS(rect_float, 3)
+ {
+ r[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(rect_float[0]));
+ g[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(rect_float[1]));
+ b[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(rect_float[2]));
+ }
+ PIXEL_LOOPER_END;
+ }
+ else {
+ PIXEL_LOOPER_BEGIN_CHANNELS(rect_float, 1)
+ {
+ r[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(rect_float[0]));
+ g[i] = b[i] = r[i];
+ }
+ PIXEL_LOOPER_END;
}
- PIXEL_LOOPER_END;
}
break;
}
diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c
index cc73f688e70..68385f22a7a 100644
--- a/source/blender/imbuf/intern/png.c
+++ b/source/blender/imbuf/intern/png.c
@@ -133,6 +133,7 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags)
bool is_16bit = (ibuf->ftype & PNG_16BIT);
bool has_float = (ibuf->rect_float != NULL);
+ int channels_in_float = ibuf->channels ? ibuf->channels : 4;
float (*chanel_colormanage_cb)(float);
@@ -156,7 +157,7 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags)
bytesperpixel = (ibuf->planes + 7) >> 3;
if ((bytesperpixel > 4) || (bytesperpixel == 2)) {
- printf("imb_savepng: Cunsupported bytes per pixel: %d for file: '%s'\n", bytesperpixel, name);
+ printf("imb_savepng: Unsupported bytes per pixel: %d for file: '%s'\n", bytesperpixel, name);
return (0);
}
@@ -203,13 +204,32 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags)
color_type = PNG_COLOR_TYPE_RGBA;
if (is_16bit) {
if (has_float) {
- for (i = ibuf->x * ibuf->y; i > 0; i--) {
- premul_to_straight_v4_v4(from_straight, from_float);
- to16[0] = ftoshort(chanel_colormanage_cb(from_straight[0]));
- to16[1] = ftoshort(chanel_colormanage_cb(from_straight[1]));
- to16[2] = ftoshort(chanel_colormanage_cb(from_straight[2]));
- to16[3] = ftoshort(chanel_colormanage_cb(from_straight[3]));
- to16 += 4; from_float += 4;
+ if (channels_in_float == 4) {
+ for (i = ibuf->x * ibuf->y; i > 0; i--) {
+ premul_to_straight_v4_v4(from_straight, from_float);
+ to16[0] = ftoshort(chanel_colormanage_cb(from_straight[0]));
+ to16[1] = ftoshort(chanel_colormanage_cb(from_straight[1]));
+ to16[2] = ftoshort(chanel_colormanage_cb(from_straight[2]));
+ to16[3] = ftoshort(chanel_colormanage_cb(from_straight[3]));
+ to16 += 4; from_float += 4;
+ }
+ }
+ else if (channels_in_float == 3) {
+ for (i = ibuf->x * ibuf->y; i > 0; i--) {
+ to16[0] = ftoshort(chanel_colormanage_cb(from_float[0]));
+ to16[1] = ftoshort(chanel_colormanage_cb(from_float[1]));
+ to16[2] = ftoshort(chanel_colormanage_cb(from_float[2]));
+ to16[3] = 65535;
+ to16 += 4; from_float += 3;
+ }
+ }
+ else {
+ for (i = ibuf->x * ibuf->y; i > 0; i--) {
+ to16[0] = ftoshort(chanel_colormanage_cb(from_float[0]));
+ to16[2] = to16[1] = to16[0];
+ to16[3] = 65535;
+ to16 += 4; from_float++;
+ }
}
}
else {
@@ -236,12 +256,29 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags)
color_type = PNG_COLOR_TYPE_RGB;
if (is_16bit) {
if (has_float) {
- for (i = ibuf->x * ibuf->y; i > 0; i--) {
- premul_to_straight_v4_v4(from_straight, from_float);
- to16[0] = ftoshort(chanel_colormanage_cb(from_straight[0]));
- to16[1] = ftoshort(chanel_colormanage_cb(from_straight[1]));
- to16[2] = ftoshort(chanel_colormanage_cb(from_straight[2]));
- to16 += 3; from_float += 4;
+ if (channels_in_float == 4) {
+ for (i = ibuf->x * ibuf->y; i > 0; i--) {
+ premul_to_straight_v4_v4(from_straight, from_float);
+ to16[0] = ftoshort(chanel_colormanage_cb(from_straight[0]));
+ to16[1] = ftoshort(chanel_colormanage_cb(from_straight[1]));
+ to16[2] = ftoshort(chanel_colormanage_cb(from_straight[2]));
+ to16 += 3; from_float += 4;
+ }
+ }
+ else if (channels_in_float == 3) {
+ for (i = ibuf->x * ibuf->y; i > 0; i--) {
+ to16[0] = ftoshort(chanel_colormanage_cb(from_float[0]));
+ to16[1] = ftoshort(chanel_colormanage_cb(from_float[1]));
+ to16[2] = ftoshort(chanel_colormanage_cb(from_float[2]));
+ to16 += 3; from_float += 3;
+ }
+ }
+ else {
+ for (i = ibuf->x * ibuf->y; i > 0; i--) {
+ to16[0] = ftoshort(chanel_colormanage_cb(from_float[0]));
+ to16[2] = to16[1] = to16[0];
+ to16 += 3; from_float++;
+ }
}
}
else {
@@ -266,10 +303,31 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags)
color_type = PNG_COLOR_TYPE_GRAY;
if (is_16bit) {
if (has_float) {
- for (i = ibuf->x * ibuf->y; i > 0; i--) {
- premul_to_straight_v4_v4(from_straight, from_float);
- to16[0] = ftoshort(chanel_colormanage_cb(from_straight[0]));
- to16++; from_float += 4;
+ float rgb[3];
+ if (channels_in_float == 4) {
+ for (i = ibuf->x * ibuf->y; i > 0; i--) {
+ premul_to_straight_v4_v4(from_straight, from_float);
+ rgb[0] = chanel_colormanage_cb(from_straight[0]);
+ rgb[1] = chanel_colormanage_cb(from_straight[1]);
+ rgb[2] = chanel_colormanage_cb(from_straight[2]);
+ to16[0] = ftoshort(rgb_to_bw(rgb));
+ to16++; from_float += 4;
+ }
+ }
+ else if (channels_in_float == 3) {
+ for (i = ibuf->x * ibuf->y; i > 0; i--) {
+ rgb[0] = chanel_colormanage_cb(from_float[0]);
+ rgb[1] = chanel_colormanage_cb(from_float[1]);
+ rgb[2] = chanel_colormanage_cb(from_float[2]);
+ to16[0] = ftoshort(rgb_to_bw(rgb));
+ to16++; from_float += 3;
+ }
+ }
+ else {
+ for (i = ibuf->x * ibuf->y; i > 0; i--) {
+ to16[0] = ftoshort(chanel_colormanage_cb(from_float[0]));
+ to16++; from_float++;
+ }
}
}
else {
diff --git a/source/blender/imbuf/intern/readimage.c b/source/blender/imbuf/intern/readimage.c
index 00bc78ee488..4d47d883444 100644
--- a/source/blender/imbuf/intern/readimage.c
+++ b/source/blender/imbuf/intern/readimage.c
@@ -75,6 +75,8 @@ ImBuf *IMB_ibImageFromMemory(unsigned char *mem, size_t size, int flags, char co
if (type->load) {
ibuf = type->load(mem, size, flags, effective_colorspace);
if (ibuf) {
+ int alpha_flags;
+
if (colorspace) {
if (ibuf->rect) {
/* byte buffer is never internally converted to some standard space,
@@ -86,11 +88,16 @@ ImBuf *IMB_ibImageFromMemory(unsigned char *mem, size_t size, int flags, char co
BLI_strncpy(colorspace, effective_colorspace, IM_MAX_SPACE);
}
+ if (flags & IB_alphamode_detect)
+ alpha_flags = ibuf->flags & IB_alphamode_premul;
+ else
+ alpha_flags = flags & IB_alphamode_premul;
+
if (flags & IB_ignore_alpha) {
IMB_rectfill_alpha(ibuf, 1.0f);
}
else {
- if (flags & IB_alphamode_premul) {
+ if (alpha_flags & IB_alphamode_premul) {
if (ibuf->rect) {
IMB_unpremultiply_alpha(ibuf);
}
diff --git a/source/blender/makesdna/DNA_genfile.h b/source/blender/makesdna/DNA_genfile.h
index 2d1549ff487..ac75b03c742 100644
--- a/source/blender/makesdna/DNA_genfile.h
+++ b/source/blender/makesdna/DNA_genfile.h
@@ -35,9 +35,13 @@
struct SDNA;
-extern const unsigned char DNAstr[]; /* DNA.c */
-extern const int DNAlen;
+/* 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). */
+extern const unsigned char DNAstr[];
+extern const int DNAlen; /* length of DNAstr */
+/* primitive (non-struct, non-pointer/function/array) types--do not change ordering! */
typedef enum eSDNA_Type {
SDNA_TYPE_CHAR = 0,
SDNA_TYPE_UCHAR = 1,
@@ -56,7 +60,7 @@ typedef enum eSDNA_Type {
/* define so switch statements don't complain */
#define SDNA_TYPE_VOID 9
-struct SDNA *DNA_sdna_from_data(const void *data, const int datalen, int do_endian_swap);
+struct SDNA *DNA_sdna_from_data(const void *data, const int datalen, bool do_endian_swap);
void DNA_sdna_free(struct SDNA *sdna);
int DNA_struct_find_nr(struct SDNA *sdna, const char *str);
diff --git a/source/blender/makesdna/DNA_listBase.h b/source/blender/makesdna/DNA_listBase.h
index 333e414278d..f6035cd6653 100644
--- a/source/blender/makesdna/DNA_listBase.h
+++ b/source/blender/makesdna/DNA_listBase.h
@@ -31,6 +31,9 @@
* \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.
*/
#ifndef __DNA_LISTBASE_H__
@@ -40,13 +43,13 @@
extern "C" {
#endif
-/* generic - all structs which are used in linked-lists used this */
+/* generic - all structs which are put into linked lists begin with this */
typedef struct Link {
struct Link *next, *prev;
} 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;
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index 7f2e388cd69..5aaf46a541f 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -309,9 +309,11 @@ typedef struct bNodeTree {
#define NTREE_TYPE_INIT 1
/* ntree->flag */
-#define NTREE_DS_EXPAND 1 /* for animation editors */
-#define NTREE_COM_OPENCL 2 /* use opencl */
-#define NTREE_TWO_PASS 4 /* two pass */
+#define NTREE_DS_EXPAND 1 /* for animation editors */
+#define NTREE_COM_OPENCL 2 /* use opencl */
+#define NTREE_TWO_PASS 4 /* two pass */
+#define NTREE_COM_GROUPNODE_BUFFER 8 /* use groupnode buffers */
+
/* XXX not nice, but needed as a temporary flags
* for group updates after library linking.
*/
diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h
index 1cf16fb52b3..ec2a724ac82 100644
--- a/source/blender/makesdna/DNA_particle_types.h
+++ b/source/blender/makesdna/DNA_particle_types.h
@@ -173,7 +173,8 @@ typedef struct ParticleSettings {
/* adaptive path rendering */
short adapt_angle, adapt_pix;
- short disp, omat, interpolation, rotfrom, integrator;
+ short disp, omat, interpolation, integrator;
+ short rotfrom DNA_DEPRECATED;
short kink, kink_axis;
/* billboards */
@@ -359,11 +360,6 @@ typedef struct ParticleSystem {
#define PART_SELF_EFFECT (1<<22)
-/* part->rotfrom */
-#define PART_ROT_KEYS 0 /* interpolate directly from keys */
-#define PART_ROT_ZINCR 1 /* same as zdir but done incrementally from previous position */
-#define PART_ROT_IINCR 2 /* same as idir but done incrementally from previous position */
-
/* part->from */
#define PART_FROM_VERT 0
#define PART_FROM_FACE 1
diff --git a/source/blender/makesdna/DNA_rigidbody_types.h b/source/blender/makesdna/DNA_rigidbody_types.h
index 1636f2f4e4b..c144bc4e588 100644
--- a/source/blender/makesdna/DNA_rigidbody_types.h
+++ b/source/blender/makesdna/DNA_rigidbody_types.h
@@ -196,28 +196,37 @@ typedef struct RigidBodyCon {
float pad;
/* limits */
- float limit_lin_x_lower; /* lower limit for x axis translation */
- float limit_lin_x_upper; /* upper limit for x axis translation */
- float limit_lin_y_lower; /* lower limit for y axis translation */
- float limit_lin_y_upper; /* upper limit for y axis translation */
- float limit_lin_z_lower; /* lower limit for z axis translation */
- float limit_lin_z_upper; /* upper limit for z axis translation */
- float limit_ang_x_lower; /* lower limit for x axis rotation */
- float limit_ang_x_upper; /* upper limit for x axis rotation */
- float limit_ang_y_lower; /* lower limit for y axis rotation */
- float limit_ang_y_upper; /* upper limit for y axis rotation */
- float limit_ang_z_lower; /* lower limit for z axis rotation */
- float limit_ang_z_upper; /* upper limit for z axis rotation */
+ /* translation limits */
+ float limit_lin_x_lower;
+ float limit_lin_x_upper;
+ float limit_lin_y_lower;
+ float limit_lin_y_upper;
+ float limit_lin_z_lower;
+ float limit_lin_z_upper;
+ /* rotation limits */
+ float limit_ang_x_lower;
+ float limit_ang_x_upper;
+ float limit_ang_y_lower;
+ float limit_ang_y_upper;
+ float limit_ang_z_lower;
+ float limit_ang_z_upper;
/* spring settings */
- /* RB_TODO document spring properties */
+ /* resistance to deformation */
float spring_stiffness_x;
float spring_stiffness_y;
float spring_stiffness_z;
+ /* amount of velocity lost over time */
float spring_damping_x;
float spring_damping_y;
float spring_damping_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 */
+
/* References to Physics Sim object. Exist at runtime only */
void *physics_constraint; /* Physics object representation (i.e. btTypedConstraint) */
} RigidBodyCon;
@@ -246,7 +255,9 @@ typedef enum eRigidBodyCon_Type {
/* 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 */
- RBC_TYPE_SPRING
+ RBC_TYPE_SPRING,
+ /* dirves bodies by applying linear and angular forces */
+ RBC_TYPE_MOTOR
} eRigidBodyCon_Type;
/* Flags for RigidBodyCon */
@@ -271,7 +282,10 @@ typedef enum eRigidBodyCon_Flag {
/* springs */
RBC_FLAG_USE_SPRING_X = (1 << 11),
RBC_FLAG_USE_SPRING_Y = (1 << 12),
- RBC_FLAG_USE_SPRING_Z = (1 << 13)
+ RBC_FLAG_USE_SPRING_Z = (1 << 13),
+ /* motors */
+ RBC_FLAG_USE_MOTOR_LIN = (1 << 14),
+ RBC_FLAG_USE_MOTOR_ANG = (1 << 15)
} eRigidBodyCon_Flag;
/* ******************************** */
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index dc36e88bc16..aa395dd0493 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -399,15 +399,19 @@ typedef struct RenderData {
short filtertype; /* filter is box, tent, gauss, mitch, etc */
short size, maximsize; /* size in %, max in Kb */
+
+ short pad6;
+
/* from buttons: */
/**
* The desired number of pixels in the x direction
*/
- short xsch;
+ int xsch;
/**
* The desired number of pixels in the y direction
*/
- short ysch;
+ int ysch;
+
/**
* The number of part to use in the x direction
*/
@@ -420,7 +424,7 @@ typedef struct RenderData {
/**
* render tile dimensions
*/
- short tilex, tiley;
+ int tilex, tiley;
short planes DNA_DEPRECATED, imtype DNA_DEPRECATED, subimtype DNA_DEPRECATED, quality DNA_DEPRECATED; /*deprecated!*/
@@ -428,6 +432,7 @@ typedef struct RenderData {
* Render to image editor, fullscreen or to new window.
*/
short displaymode;
+ short pad7;
/**
* Flags for render settings. Use bit-masking to access the settings.
@@ -468,8 +473,6 @@ typedef struct RenderData {
short frs_sec, edgeint;
- int pad;
-
/* safety, border and display rect */
rctf safety, border;
@@ -1049,10 +1052,11 @@ typedef struct ToolSettings {
short proportional, prop_mode;
char proportional_objects; /* proportional edit, object mode */
char proportional_mask; /* proportional edit, object mode */
- char pad4[2];
+ char pad4[1];
char auto_normalize; /*auto normalizing mode in wpaint*/
char multipaint; /* paint multiple bones in wpaint */
+ char weightuser;
/* UV painting */
int use_uv_sculpt;
@@ -1153,12 +1157,9 @@ typedef struct Scene {
/* none of the dependency graph vars is mean to be saved */
struct DagForest *theDag;
- short dagisvalid, dagflags;
+ short dagflags;
short recalc; /* recalc = counterpart of ob->recalc */
- short pad6;
- int pad5;
-
/* 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 */
@@ -1467,6 +1468,13 @@ typedef struct Scene {
#define PROP_EDIT_ON 1
#define PROP_EDIT_CONNECTED 2
+/* toolsettings->weightuser */
+enum {
+ OB_DRAW_GROUPUSER_NONE = 0,
+ OB_DRAW_GROUPUSER_ACTIVE = 1,
+ OB_DRAW_GROUPUSER_ALL = 2
+};
+
/* sce->flag */
#define SCE_DS_SELECTED (1<<0)
#define SCE_DS_COLLAPSED (1<<1)
diff --git a/source/blender/makesdna/DNA_tracking_types.h b/source/blender/makesdna/DNA_tracking_types.h
index b258fbaa668..8789a17a7f7 100644
--- a/source/blender/makesdna/DNA_tracking_types.h
+++ b/source/blender/makesdna/DNA_tracking_types.h
@@ -248,13 +248,28 @@ typedef struct MovieTrackingDopesheetChannel {
int max_segment, total_frames; /* longest segment length and total number of tracked frames */
} MovieTrackingDopesheetChannel;
+typedef struct MovieTrackingDopesheetCoverageSegment {
+ struct MovieTrackingDopesheetCoverageSegment *next, *prev;
+
+ int coverage;
+ int start_frame;
+ int end_frame;
+
+ int pad;
+} MovieTrackingDopesheetCoverageSegment;
+
typedef struct MovieTrackingDopesheet {
int ok; /* flag if dopesheet information is still relevant */
short sort_method; /* method to be used to sort tracks */
short flag; /* dopesheet building flag such as inverted order of sort */
- /* runtime stuff */
+ /* ** runtime stuff ** */
+
+ /* summary */
+ ListBase coverage_segments;
+
+ /* detailed */
ListBase channels;
int tot_channel;
@@ -409,4 +424,11 @@ enum {
TRACKING_DOPE_SHOW_HIDDEN = (1 << 2)
};
+/* MovieTrackingDopesheetCoverageSegment->trackness */
+enum {
+ TRACKING_COVERAGE_BAD = 0,
+ TRACKING_COVERAGE_ACCEPTABLE = 1,
+ TRACKING_COVERAGE_OK = 2
+};
+
#endif
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 418f33cca8a..0e5f0aea401 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -253,7 +253,7 @@ typedef struct ThemeSpace {
char ds_channel[4], ds_subchannel[4]; /* dopesheet */
char console_output[4], console_input[4], console_info[4], console_error[4];
- char console_cursor[4];
+ char console_cursor[4], console_select[4], pad1[4];
char vertex_size, outline_width, facedot_size;
char noodle_curving;
diff --git a/source/blender/makesdna/DNA_world_types.h b/source/blender/makesdna/DNA_world_types.h
index 8a14564f8a4..02dc81ccd4d 100644
--- a/source/blender/makesdna/DNA_world_types.h
+++ b/source/blender/makesdna/DNA_world_types.h
@@ -59,10 +59,7 @@ typedef struct World {
float horr, horg, horb;
float zenr, zeng, zenb;
float ambr, ambg, ambb;
- float pad2;
- unsigned int fastcol;
-
/**
* Exposure= mult factor. unused now, but maybe back later. Kept in to be upward compat.
* New is exp/range control. linfac & logfac are constants... don't belong in
diff --git a/source/blender/makesdna/SConscript b/source/blender/makesdna/SConscript
index d4eabb03b13..dba0f84170e 100644
--- a/source/blender/makesdna/SConscript
+++ b/source/blender/makesdna/SConscript
@@ -33,7 +33,7 @@ defs = []
o = SConscript('intern/SConscript')
objs += o
-incs = '#/intern/guardedalloc .'
+incs = '#/intern/guardedalloc . ../blenlib'
if env['WITH_BF_FREESTYLE']:
defs.append('WITH_FREESTYLE')
diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c
index 10c3b0bbee4..86014c4e80e 100644
--- a/source/blender/makesdna/intern/dna_genfile.c
+++ b/source/blender/makesdna/intern/dna_genfile.c
@@ -29,7 +29,10 @@
/** \file blender/makesdna/intern/dna_genfile.c
* \ingroup DNA
*
- * Functions for struct-dna, the genetic file dot c!
+ * Lowest-level functions for decoding the parts of a saved .blend
+ * file, including interpretation of its SDNA block and conversion of
+ * contents of other parts according to the differences between that
+ * SDNA and the SDNA of the current (running) version of Blender.
*/
@@ -39,8 +42,9 @@
#include "MEM_guardedalloc.h" // for MEM_freeN MEM_mallocN MEM_callocN
+#include "BLI_utildefines.h"
+
#ifdef WITH_DNA_GHASH
-# include "BLI_utildefines.h"
# include "BLI_ghash.h"
#endif
@@ -134,12 +138,11 @@ typedef long long __int64;
*
*/
-/* local */
-static int le_int(int temp);
-static short le_short(short temp);
-
/* ************************* ENDIAN STUFF ********************** */
+/**
+ * converts a short between big/little endian.
+ */
static short le_short(short temp)
{
short new;
@@ -151,7 +154,9 @@ static short le_short(short temp)
return new;
}
-
+/**
+ * converts an int between big/little endian.
+ */
static int le_int(int temp)
{
int new;
@@ -169,6 +174,10 @@ static int le_int(int temp)
/* ************************* MAKE DNA ********************** */
/* allowed duplicate code from makesdna.c */
+
+/**
+ * parses the "[n]" on the end of an array name and returns the number of array elements n.
+ */
int DNA_elem_array_size(const char *astr, int len)
{
int a, mul = 1;
@@ -207,14 +216,23 @@ void DNA_sdna_free(SDNA *sdna)
MEM_freeN(sdna);
}
-static int ispointer(const char *name)
+/**
+ * Return true if the name indicates a pointer of some kind.
+ */
+static bool ispointer(const char *name)
{
/* check if pointer or function pointer */
return (name[0] == '*' || (name[0] == '(' && name[1] == '*'));
}
-static int elementsize(SDNA *sdna, short type, short name)
-/* call with numbers from struct-array */
+/**
+ * Returns the size of struct fields of the specified type and name.
+ *
+ * \param type Index into sdna->types/typelens
+ * \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;
@@ -225,16 +243,20 @@ static int elementsize(SDNA *sdna, short type, short name)
namelen = strlen(cp);
/* is it a pointer or function pointer? */
if (ispointer(cp)) {
- /* has the naam an extra length? (array) */
+ /* has the name an extra length? (array) */
mul = 1;
- if (cp[namelen - 1] == ']') mul = DNA_elem_array_size(cp, namelen);
+ if (cp[namelen - 1] == ']') {
+ mul = DNA_elem_array_size(cp, namelen);
+ }
len = sdna->pointerlen * mul;
}
else if (sdna->typelens[type]) {
- /* has the naam an extra length? (array) */
+ /* has the name an extra length? (array) */
mul = 1;
- if (cp[namelen - 1] == ']') mul = DNA_elem_array_size(cp, namelen);
+ if (cp[namelen - 1] == ']') {
+ mul = DNA_elem_array_size(cp, namelen);
+ }
len = mul * sdna->typelens[type];
@@ -262,6 +284,9 @@ static void printstruct(SDNA *sdna, short strnr)
}
#endif
+/**
+ * Returns a pointer to the start of the struct info for the struct with the specified name.
+ */
static short *findstruct_name(SDNA *sdna, const char *str)
{
int a;
@@ -272,19 +297,26 @@ static short *findstruct_name(SDNA *sdna, const char *str)
sp = sdna->structs[a];
- if (strcmp(sdna->types[sp[0]], str) == 0) return sp;
+ if (strcmp(sdna->types[sp[0]], str) == 0) {
+ return sp;
+ }
}
return NULL;
}
+/**
+ * Returns the index of the struct info for the struct with the specified name.
+ */
int DNA_struct_find_nr(SDNA *sdna, const char *str)
{
short *sp = NULL;
if (sdna->lastfind < sdna->nr_structs) {
sp = sdna->structs[sdna->lastfind];
- if (strcmp(sdna->types[sp[0]], str) == 0) return sdna->lastfind;
+ if (strcmp(sdna->types[sp[0]], str) == 0) {
+ return sdna->lastfind;
+ }
}
#ifdef WITH_DNA_GHASH
@@ -311,8 +343,10 @@ int DNA_struct_find_nr(SDNA *sdna, const char *str)
/* ************************* READ DNA ********************** */
-static void init_structDNA(SDNA *sdna, int do_endian_swap)
-/* in sdna->data the data, now we convert that to something understandable */
+/**
+ * In sdna->data the data, now we convert that to something understandable
+ */
+static void init_structDNA(SDNA *sdna, bool do_endian_swap)
{
int *data, *verg, gravity_fix = -1;
intptr_t nr;
@@ -481,7 +515,7 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
if (sp[1] != 2 || (sdna->pointerlen != 4 && sdna->pointerlen != 8)) {
printf("ListBase struct error! Needs it to calculate pointerize.\n");
- exit(0);
+ exit(1);
/* well, at least sizeof(ListBase) is error proof! (ton) */
}
@@ -506,7 +540,10 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
}
}
-SDNA *DNA_sdna_from_data(const void *data, const int datalen, int do_endian_swap)
+/**
+ * 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, bool do_endian_swap)
{
SDNA *sdna = MEM_mallocN(sizeof(*sdna), "sdna");
@@ -525,7 +562,11 @@ SDNA *DNA_sdna_from_data(const void *data, const int datalen, int do_endian_swap
/* ******************* HANDLE DNA ***************** */
-static void recurs_test_compflags(SDNA *sdna, char *compflags, int structnr)
+/**
+ * Used by #DNA_struct_get_compareflags (below) to recursively mark all structs
+ * containing a field of type structnr as changed between old and current SDNAs.
+ */
+static void recurs_test_compflags(const SDNA *sdna, char *compflags, int structnr)
{
int a, b, typenr, elems;
short *sp;
@@ -554,75 +595,70 @@ static void recurs_test_compflags(SDNA *sdna, char *compflags, int structnr)
}
-/* Unsure of exact function - compares the sdna argument to
- * newsdna and sets up the information necessary to convert
- * data written with a dna of oldsdna to in-memory data with a
- * structure defined by the newsdna sdna (I think). -zr
- */
-/* well, the function below is just a lookup table to speed
- * up reading files. doh! -ton
+/**
+ * Constructs and returns an array of byte flags with one element for each struct in oldsdna,
+ * indicating how it compares to newsdna:
+ *
+ * flag value:
+ * - 0 Struct has disappeared (values of this struct type will not be loaded by the current Blender)
+ * - 1 Struct is the same (can be loaded with straight memory copy after any necessary endian conversion)
+ * - 2 Struct is different in some way (needs to be copied/converted field by field)
*/
-
-
-char *DNA_struct_get_compareflags(SDNA *sdna, SDNA *newsdna)
+char *DNA_struct_get_compareflags(SDNA *oldsdna, SDNA *newsdna)
{
- /* flag: 0: doesn't exist anymore (or not yet)
- * 1: is equal
- * 2: is different
- */
int a, b;
- short *spold, *spcur;
+ const short *sp_old, *sp_new;
const char *str1, *str2;
char *compflags;
- if (sdna->nr_structs == 0) {
+ if (oldsdna->nr_structs == 0) {
printf("error: file without SDNA\n");
return NULL;
}
-
- compflags = MEM_callocN(sdna->nr_structs, "compflags");
- /* we check all structs in 'sdna' and compare them with
+ compflags = MEM_callocN(oldsdna->nr_structs, "compflags");
+
+ /* we check all structs in 'oldsdna' and compare them with
* the structs in 'newsdna'
*/
- for (a = 0; a < sdna->nr_structs; a++) {
- spold = sdna->structs[a];
+ for (a = 0; a < oldsdna->nr_structs; a++) {
+ sp_old = oldsdna->structs[a];
/* search for type in cur */
- spcur = findstruct_name(newsdna, sdna->types[spold[0]]);
+ sp_new = findstruct_name(newsdna, oldsdna->types[sp_old[0]]);
- if (spcur) {
- compflags[a] = 2;
+ if (sp_new) {
+ compflags[a] = 2; /* initial assumption */
/* compare length and amount of elems */
- if (spcur[1] == spold[1]) {
- if (newsdna->typelens[spcur[0]] == sdna->typelens[spold[0]]) {
+ if (sp_new[1] == sp_old[1]) {
+ if (newsdna->typelens[sp_new[0]] == oldsdna->typelens[sp_old[0]]) {
/* same length, same amount of elems, now per type and name */
- b = spold[1];
- spold += 2;
- spcur += 2;
+ b = sp_old[1];
+ sp_old += 2;
+ sp_new += 2;
while (b > 0) {
- str1 = newsdna->types[spcur[0]];
- str2 = sdna->types[spold[0]];
+ str1 = newsdna->types[sp_new[0]];
+ str2 = oldsdna->types[sp_old[0]];
if (strcmp(str1, str2) != 0) break;
- str1 = newsdna->names[spcur[1]];
- str2 = sdna->names[spold[1]];
+ str1 = newsdna->names[sp_new[1]];
+ str2 = oldsdna->names[sp_old[1]];
if (strcmp(str1, str2) != 0) break;
/* same type and same name, now pointersize */
if (ispointer(str1)) {
- if (sdna->pointerlen != newsdna->pointerlen) break;
+ if (oldsdna->pointerlen != newsdna->pointerlen) break;
}
b--;
- spold += 2;
- spcur += 2;
+ sp_old += 2;
+ sp_new += 2;
}
- if (b == 0) compflags[a] = 1;
+ if (b == 0) compflags[a] = 1; /* no differences found */
}
}
@@ -638,15 +674,15 @@ char *DNA_struct_get_compareflags(SDNA *sdna, SDNA *newsdna)
/* Because structs can be inside structs, we recursively
* set flags when a struct is altered
*/
- for (a = 0; a < sdna->nr_structs; a++) {
- if (compflags[a] == 2) recurs_test_compflags(sdna, compflags, a);
+ for (a = 0; a < oldsdna->nr_structs; a++) {
+ if (compflags[a] == 2) recurs_test_compflags(oldsdna, compflags, a);
}
#if 0
- for (a = 0; a < sdna->nr_structs; a++) {
+ for (a = 0; a < oldsdna->nr_structs; a++) {
if (compflags[a] == 2) {
- spold = sdna->structs[a];
- printf("changed: %s\n", sdna->types[spold[0]]);
+ spold = oldsdna->structs[a];
+ printf("changed: %s\n", oldsdna->types[spold[0]]);
}
}
#endif
@@ -654,6 +690,9 @@ char *DNA_struct_get_compareflags(SDNA *sdna, SDNA *newsdna)
return compflags;
}
+/**
+ * Converts the name of a primitive type to its enumeration code.
+ */
static eSDNA_Type sdna_type_nr(const char *dna_type)
{
if ((strcmp(dna_type, "char") == 0) || (strcmp(dna_type, "const char") == 0)) return SDNA_TYPE_CHAR;
@@ -670,7 +709,20 @@ static eSDNA_Type sdna_type_nr(const char *dna_type)
else return -1; /* invalid! */
}
-static void cast_elem(const char *ctype, const char *otype, const char *name, char *curdata, char *olddata)
+/**
+ * Converts a value of one primitive type to another.
+ * Note there is no optimization for the case where otype and ctype are the same:
+ * assumption is that caller will handle this case.
+ *
+ * \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 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,
+ char *curdata, const char *olddata)
{
double val = 0.0;
int arrlen, curlen = 1, oldlen = 1;
@@ -748,7 +800,18 @@ static void cast_elem(const char *ctype, const char *otype, const char *name, ch
}
}
-static void cast_pointer(int curlen, int oldlen, const char *name, char *curdata, char *olddata)
+/**
+ * Converts pointer values between different sizes. These are only used
+ * as lookup keys to identify data blocks in the saved .blend file, not
+ * as actual in-memory pointers.
+ *
+ * \param curlen Pointer length to conver to
+ * \param oldlen Length of pointers in olddata
+ * \param name Field name to extract array-size information
+ * \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)
{
#ifdef WIN32
__int64 lval;
@@ -770,7 +833,10 @@ static void cast_pointer(int curlen, int oldlen, const char *name, char *curdata
#else
lval = *( (long long *)olddata);
#endif
- *((int *)curdata) = lval >> 3; /* is of course gambling! */
+ /* WARNING: 32-bit Blender trying to load file saved by 64-bit Blender,
+ * pointers may lose uniqueness on truncation! (Hopefully this wont
+ * happen unless/until we ever get to multi-gigabyte .blend files...) */
+ *((int *)curdata) = lval >> 3;
}
else if (curlen == 8 && oldlen == 4) {
#ifdef WIN32
@@ -791,22 +857,42 @@ static void cast_pointer(int curlen, int oldlen, const char *name, char *curdata
}
}
+/**
+ * Equality test on name and oname excluding any array-size suffix.
+ */
static int elem_strcmp(const char *name, const char *oname)
{
int a = 0;
- /* strcmp without array part */
-
while (1) {
if (name[a] != oname[a]) return 1;
- if (name[a] == '[') break;
- if (name[a] == 0) break;
+ if (name[a] == '[' || oname[a] == '[') break;
+ if (name[a] == 0 || oname[a] == 0) break;
a++;
}
return 0;
}
-static char *find_elem(SDNA *sdna, const char *type, const char *name, short *old, char *olddata, short **sppo)
+/**
+ * Returns the address of the data for the specified field within olddata
+ * according to the struct format pointed to by old, or NULL if no such
+ * field can be found.
+ *
+ * \param sdna Old SDNA
+ * \param type Current field type name
+ * \param name Current field name
+ * \param old Pointer to struct information in sdna
+ * \param olddata Struct data
+ * \param sppo Optional place to return pointer to field info in sdna
+ * \return Data address.
+ */
+static char *find_elem(
+ const SDNA *sdna,
+ const char *type,
+ const char *name,
+ const short *old,
+ char *olddata,
+ const short **sppo)
{
int a, elemcount, len;
const char *otype, *oname;
@@ -823,8 +909,8 @@ static char *find_elem(SDNA *sdna, const char *type, const char *name, short *ol
len = elementsize(sdna, old[0], old[1]);
- if (elem_strcmp(name, oname) == 0) { /* naam equal */
- if (strcmp(type, otype) == 0) { /* type equal */
+ if (elem_strcmp(name, oname) == 0) { /* name equal */
+ if (strcmp(type, otype) == 0) { /* type equal */
if (sppo) *sppo = old;
return olddata;
}
@@ -837,8 +923,26 @@ static char *find_elem(SDNA *sdna, const char *type, const char *name, short *ol
return NULL;
}
-static void reconstruct_elem(SDNA *newsdna, SDNA *oldsdna,
- char *type, const char *name, char *curdata, short *old, char *olddata)
+/**
+ * Converts the contents of a single field of a struct, of a non-struct type,
+ * from oldsdna to newsdna format.
+ *
+ * \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 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
+ */
+static void reconstruct_elem(
+ const SDNA *newsdna,
+ const SDNA *oldsdna,
+ const char *type,
+ const char *name,
+ char *curdata,
+ const short *old,
+ const char *olddata)
{
/* rules: test for NAME:
* - name equal:
@@ -849,17 +953,16 @@ static void reconstruct_elem(SDNA *newsdna, SDNA *oldsdna,
* (nzc 2-4-2001 I want the 'unsigned' bit to be parsed as well. Where
* can I force this?)
*/
- int a, elemcount, len, array, oldsize, cursize, mul;
- char *otype;
- const char *oname, *cp;
+ int a, elemcount, len, countpos, oldsize, cursize, mul;
+ const char *otype, *oname, *cp;
/* is 'name' an array? */
cp = name;
- array = 0;
+ countpos = 0;
while (*cp && *cp != '[') {
- cp++; array++;
+ cp++; countpos++;
}
- if (*cp != '[') array = 0;
+ if (*cp != '[') countpos = 0;
/* in old is the old struct */
elemcount = old[1];
@@ -877,33 +980,38 @@ static void reconstruct_elem(SDNA *newsdna, SDNA *oldsdna,
else if (strcmp(type, otype) == 0) { /* type equal */
memcpy(curdata, olddata, len);
}
- else cast_elem(type, otype, name, curdata, olddata);
+ else {
+ cast_elem(type, otype, name, curdata, olddata);
+ }
return;
}
- else if (array) { /* name is an array */
+ else if (countpos != 0) { /* name is an array */
- if (oname[array] == '[' && strncmp(name, oname, array) == 0) { /* basis equal */
+ if (oname[countpos] == '[' && strncmp(name, oname, countpos) == 0) { /* basis equal */
cursize = DNA_elem_array_size(name, strlen(name));
oldsize = DNA_elem_array_size(oname, strlen(oname));
- if (ispointer(name)) { /* handle pointer or functionpointer */
- if (cursize > oldsize) cast_pointer(newsdna->pointerlen, oldsdna->pointerlen, oname, curdata, olddata);
- else cast_pointer(newsdna->pointerlen, oldsdna->pointerlen, name, curdata, olddata);
+ if (ispointer(name)) { /* handle pointer or functionpointer */
+ cast_pointer(newsdna->pointerlen, oldsdna->pointerlen,
+ cursize > oldsize ? oname : name,
+ curdata, olddata);
}
- else if (name[0] == '*' || strcmp(type, otype) == 0) { /* type equal */
- mul = len / oldsize;
- mul *= (cursize < oldsize) ? cursize : oldsize;
+ 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 */
memcpy(curdata, olddata, mul);
- /* terminate strings */
- if (oldsize > cursize && strcmp(type, "char") == 0)
- curdata[mul - 1] = 0;
+ if (oldsize > cursize && strcmp(type, "char") == 0) {
+ /* string had to be truncated, ensure it's still null-terminated */
+ curdata[mul - 1] = '\0';
+ }
}
else {
- if (cursize > oldsize) cast_elem(type, otype, oname, curdata, olddata);
- else cast_elem(type, otype, name, curdata, olddata);
+ cast_elem(type, otype,
+ cursize > oldsize ? oname : name,
+ curdata, olddata);
}
return;
}
@@ -912,16 +1020,37 @@ static void reconstruct_elem(SDNA *newsdna, SDNA *oldsdna,
}
}
-static void reconstruct_struct(SDNA *newsdna, SDNA *oldsdna,
- char *compflags, int oldSDNAnr, char *data, int curSDNAnr, char *cur)
+/**
+ * Converts the contents of an entire struct from oldsdna to newsdna format.
+ *
+ * \param newsdna SDNA of current Blender
+ * \param oldsdna SDNA of Blender that saved file
+ * \param compflags
+ *
+ * Result from DNA_struct_get_compareflags to avoid needless conversions.
+ * \param oldSDNAnr Index of old struct definition in oldsdna
+ * \param data Struct contents laid out according to oldsdna
+ * \param curSDNAnr Index of current struct definition in newsdna
+ * \param cur Where to put converted struct contents
+ */
+static void reconstruct_struct(
+ SDNA *newsdna,
+ SDNA *oldsdna,
+ const char *compflags,
+
+ int oldSDNAnr,
+ char *data,
+ int curSDNAnr,
+ char *cur)
{
/* Recursive!
* Per element from cur_struct, read data from old_struct.
* If element is a struct, call recursive.
*/
int a, elemcount, elen, eleno, mul, mulo, firststructtypenr;
- short *spo, *spc, *sppo;
- char *type, *cpo, *cpc;
+ const short *spo, *spc, *sppo;
+ const char *type;
+ char *cpo, *cpc;
const char *name, *nameo;
if (oldSDNAnr == -1) return;
@@ -945,7 +1074,7 @@ static void reconstruct_struct(SDNA *newsdna, SDNA *oldsdna,
spc += 2;
cpc = cur;
- for (a = 0; a < elemcount; a++, spc += 2) {
+ for (a = 0; a < elemcount; a++, spc += 2) { /* convert each field */
type = newsdna->types[spc[0]];
name = newsdna->names[spc[1]];
@@ -953,7 +1082,7 @@ static void reconstruct_struct(SDNA *newsdna, SDNA *oldsdna,
/* test: is type a struct? */
if (spc[0] >= firststructtypenr && !ispointer(name)) {
-
+ /* struct field type */
/* where does the old struct data start (and is there an old one?) */
cpo = find_elem(oldsdna, type, name, spo, data, &sppo);
@@ -981,26 +1110,34 @@ static void reconstruct_struct(SDNA *newsdna, SDNA *oldsdna,
if (mulo <= 0) break;
}
}
- else cpc += elen;
+ else {
+ cpc += elen; /* skip field no longer present */
+ }
}
else {
-
+ /* non-struct field type */
reconstruct_elem(newsdna, oldsdna, type, name, cpc, spo, data);
cpc += elen;
-
}
}
}
+/**
+ * Does endian swapping on the fields of a struct value.
+ *
+ * \param oldsdna SDNA of Blender that saved file
+ * \param oldSDNAnr Index of struct info within oldsdna
+ * \param data Struct data
+ */
void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
{
/* Recursive!
* If element is a struct, call recursive.
*/
int a, mul, elemcount, elen, elena, firststructtypenr;
- short *spo, *spc, skip;
- char *type, *cpo, *cur, cval;
- const char *name;
+ const short *spo, *spc;
+ char *cpo, *cur, cval;
+ const char *type, *name;
if (oldSDNAnr == -1) return;
firststructtypenr = *(oldsdna->structs[0]);
@@ -1021,6 +1158,7 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
/* test: is type a struct? */
if (spc[0] >= firststructtypenr && !ispointer(name)) {
+ /* struct field type */
/* where does the old data start (is there one?) */
cpo = find_elem(oldsdna, type, name, spo, data, NULL);
if (cpo) {
@@ -1036,7 +1174,7 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
}
}
else {
-
+ /* non-struct field type */
if (ispointer(name)) {
if (oldsdna->pointerlen == 8) {
@@ -1060,15 +1198,15 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
{
/* exception: variable called blocktype/ipowin: derived from ID_ */
- skip = 0;
+ bool skip = false;
if (name[0] == 'b' && name[1] == 'l') {
- if (strcmp(name, "blocktype") == 0) skip = 1;
+ if (strcmp(name, "blocktype") == 0) skip = true;
}
else if (name[0] == 'i' && name[1] == 'p') {
- if (strcmp(name, "ipowin") == 0) skip = 1;
+ if (strcmp(name, "ipowin") == 0) skip = true;
}
- if (skip == 0) {
+ if (skip == false) {
mul = DNA_elem_array_size(name, strlen(name));
cpo = cur;
while (mul--) {
@@ -1111,17 +1249,30 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
cpo += 8;
}
}
+ /* FIXME: no conversion for SDNA_TYPE_DOUBLE? */
}
}
cur += elen;
}
}
+/**
+ * \param newsdna SDNA of current Blender
+ * \param oldsdna SDNA of Blender that saved file
+ * \param compflags
+ *
+ * Result from DNA_struct_get_compareflags to avoid needless conversions
+ * \param oldSDNAnr Index of struct info within oldsdna
+ * \param blocks The number of array elements
+ * \param data Array of struct data
+ * \return An allocated reconstructed struct
+ */
void *DNA_struct_reconstruct(SDNA *newsdna, SDNA *oldsdna, char *compflags, int oldSDNAnr, int blocks, void *data)
{
int a, curSDNAnr, curlen = 0, oldlen;
- short *spo, *spc;
- char *cur, *type, *cpc, *cpo;
+ const short *spo, *spc;
+ char *cur, *cpc, *cpo;
+ const char *type;
/* oldSDNAnr == structnr, we're looking for the corresponding 'cur' number */
spo = oldsdna->structs[oldSDNAnr];
@@ -1150,18 +1301,25 @@ void *DNA_struct_reconstruct(SDNA *newsdna, SDNA *oldsdna, char *compflags, int
return cur;
}
+/**
+ * Returns the offset of the field with the specified name and type within the specified
+ * struct type in sdna.
+ */
int DNA_elem_offset(SDNA *sdna, const char *stype, const char *vartype, const char *name)
{
- int SDNAnr = DNA_struct_find_nr(sdna, stype);
- short *spo = sdna->structs[SDNAnr];
- char *cp = find_elem(sdna, vartype, name, spo, NULL, NULL);
+ const int SDNAnr = DNA_struct_find_nr(sdna, stype);
+ const short * const spo = sdna->structs[SDNAnr];
+ char * const cp = find_elem(sdna, vartype, name, spo, NULL, NULL);
return (int)((intptr_t)cp);
}
+/**
+ * Returns the size in bytes of a primitive type.
+ */
int DNA_elem_type_size(const eSDNA_Type elem_nr)
{
- /* should containt all enum types */
+ /* should contain all enum types */
switch (elem_nr) {
case SDNA_TYPE_CHAR:
case SDNA_TYPE_UCHAR:
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index 5c6a414718b..3cd75ab10f0 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -1798,7 +1798,7 @@ static const char *rna_parameter_type_cpp_name(PropertyRNA *prop)
}
}
-static void rna_def_struct_function_prototype_cpp(FILE *f, StructRNA *srna, FunctionDefRNA *dfunc,
+static void rna_def_struct_function_prototype_cpp(FILE *f, StructRNA *UNUSED(srna), FunctionDefRNA *dfunc,
const char *namespace, int close_prototype)
{
PropertyDefRNA *dp;
diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c
index da8aa15cf2e..457066aed7c 100644
--- a/source/blender/makesrna/intern/rna_action.c
+++ b/source/blender/makesrna/intern/rna_action.c
@@ -159,7 +159,7 @@ static TimeMarker *rna_Action_pose_markers_new(bAction *act, const char name[])
static void rna_Action_pose_markers_remove(bAction *act, ReportList *reports, PointerRNA *marker_ptr)
{
TimeMarker *marker = marker_ptr->data;
- if (BLI_remlink_safe(&act->markers, marker) == FALSE) {
+ if (!BLI_remlink_safe(&act->markers, marker)) {
BKE_reportf(reports, RPT_ERROR, "Timeline marker '%s' not found in action '%s'", marker->name, act->id.name + 2);
return;
}
diff --git a/source/blender/makesrna/intern/rna_boid.c b/source/blender/makesrna/intern/rna_boid.c
index 3da718afd1c..63f4e480468 100644
--- a/source/blender/makesrna/intern/rna_boid.c
+++ b/source/blender/makesrna/intern/rna_boid.c
@@ -100,7 +100,7 @@ static void rna_Boids_reset(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRN
WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
}
-static void rna_Boids_reset_deps(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Boids_reset_deps(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
if (ptr->type == &RNA_ParticleSystem) {
ParticleSystem *psys = (ParticleSystem *)ptr->data;
@@ -112,7 +112,7 @@ static void rna_Boids_reset_deps(Main *bmain, Scene *scene, PointerRNA *ptr)
else
DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA | PSYS_RECALC_RESET);
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
}
diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c
index 0b1e1c215c4..5f11663c057 100644
--- a/source/blender/makesrna/intern/rna_camera.c
+++ b/source/blender/makesrna/intern/rna_camera.c
@@ -208,7 +208,8 @@ void RNA_def_camera(BlenderRNA *brna)
prop = RNA_def_property(srna, "ortho_scale", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "ortho_scale");
- RNA_def_property_range(prop, 0.01f, 4000.0f);
+ RNA_def_property_range(prop, FLT_MIN, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.001f, 10000.0f, 10, 3);
RNA_def_property_ui_text(prop, "Orthographic Scale", "Orthographic Camera scale (similar to zoom)");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index 0c8fb3d6a36..956483890f5 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -244,9 +244,9 @@ static void rna_Constraint_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Poi
ED_object_constraint_update(ptr->id.data);
}
-static void rna_Constraint_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Constraint_dependency_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- ED_object_constraint_dependency_update(bmain, scene, ptr->id.data);
+ ED_object_constraint_dependency_update(bmain, ptr->id.data);
}
static void rna_Constraint_influence_update(Main *bmain, Scene *scene, PointerRNA *ptr)
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c
index 8f8136b0a28..b7ef76eeaf3 100644
--- a/source/blender/makesrna/intern/rna_curve.c
+++ b/source/blender/makesrna/intern/rna_curve.c
@@ -304,7 +304,7 @@ static void rna_Curve_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
static void rna_Curve_update_deps(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
rna_Curve_update_data(bmain, scene, ptr);
}
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index 97ef4dfd0a8..c92777af8fd 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -33,6 +33,7 @@
#include <string.h>
#include <ctype.h>
+#include "BLI_utildefines.h"
#include "MEM_guardedalloc.h"
#include "DNA_genfile.h"
@@ -465,7 +466,7 @@ BlenderRNA *RNA_create(void)
brna = MEM_callocN(sizeof(BlenderRNA), "BlenderRNA");
- DefRNA.sdna = DNA_sdna_from_data(DNAstr, DNAlen, 0);
+ DefRNA.sdna = DNA_sdna_from_data(DNAstr, DNAlen, false);
DefRNA.structs.first = DefRNA.structs.last = NULL;
DefRNA.error = 0;
DefRNA.preprocess = 1;
diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c
index 99d2f6dbbda..a505ae0dec2 100644
--- a/source/blender/makesrna/intern/rna_dynamicpaint.c
+++ b/source/blender/makesrna/intern/rna_dynamicpaint.c
@@ -152,7 +152,7 @@ static void rna_DynamicPaintSurfaces_changeFormat(Main *bmain, Scene *scene, Poi
static void rna_DynamicPaint_resetDependancy(Main *bmain, Scene *scene, PointerRNA *ptr)
{
rna_DynamicPaintSurface_reset(bmain, scene, ptr);
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
}
static PointerRNA rna_PaintSurface_active_get(PointerRNA *ptr)
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index 82e2cb3b0ea..a91832268e2 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -116,7 +116,7 @@ static void rna_ChannelDriver_update_data(Main *bmain, Scene *scene, PointerRNA
driver->flag &= ~DRIVER_FLAG_INVALID;
/* TODO: this really needs an update guard... */
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
DAG_id_tag_update(id, OB_RECALC_OB | OB_RECALC_DATA);
WM_main_add_notifier(NC_SCENE | ND_FRAME, scene);
diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c
index 72e27ba9240..be462e20ee7 100644
--- a/source/blender/makesrna/intern/rna_image.c
+++ b/source/blender/makesrna/intern/rna_image.c
@@ -584,14 +584,14 @@ static void rna_def_image(BlenderRNA *brna)
prop = RNA_def_property(srna, "generated_width", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "gen_x");
- RNA_def_property_range(prop, 1, 16384);
+ RNA_def_property_range(prop, 1, 65536);
RNA_def_property_ui_text(prop, "Generated Width", "Generated image width");
RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
prop = RNA_def_property(srna, "generated_height", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "gen_y");
- RNA_def_property_range(prop, 1, 16384);
+ RNA_def_property_range(prop, 1, 65536);
RNA_def_property_ui_text(prop, "Generated Height", "Generated image height");
RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 21ab11271c4..810999033a4 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -267,7 +267,7 @@ static void rna_Modifier_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Point
static void rna_Modifier_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
rna_Modifier_update(bmain, scene, ptr);
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
}
static void rna_Smoke_set_type(Main *bmain, Scene *scene, PointerRNA *ptr)
@@ -749,6 +749,12 @@ static void rna_BevelModifier_angle_limit_set(PointerRNA *ptr, float value)
md->bevel_angle = (int)value;
}
+static void rna_BevelModifier_defgrp_name_set(PointerRNA *ptr, const char *value)
+{
+ BevelModifierData *md = (BevelModifierData *)ptr->data;
+ rna_object_vgroup_name_set(ptr, value, md->defgrp_name, sizeof(md->defgrp_name));
+}
+
static void rna_UVWarpModifier_vgroup_set(PointerRNA *ptr, const char *value)
{
UVWarpModifierData *umd = (UVWarpModifierData *)ptr->data;
@@ -2291,11 +2297,13 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
{0, "NONE", 0, "None", "Bevel the entire mesh by a constant amount"},
{BME_BEVEL_ANGLE, "ANGLE", 0, "Angle", "Only bevel edges with sharp enough angles between faces"},
{BME_BEVEL_WEIGHT, "WEIGHT", 0, "Weight",
- "Use bevel weights to determine how much bevel is applied; "
- "apply them separately in vert/edge select mode"},
+ "Use bevel weights to determine how much bevel is applied in edge mode"},
+ {BME_BEVEL_VGROUP, "VGROUP", 0, "Vertex Group",
+ "Use vertex group weights to determine how much bevel is applied in vertex mode"},
{0, NULL, 0, NULL, NULL}
};
+ /* TO BE DEPRECATED */
static EnumPropertyItem prop_edge_weight_method_items[] = {
{0, "AVERAGE", 0, "Average", ""},
{BME_BEVEL_EMIN, "SHARPEST", 0, "Sharpest", ""},
@@ -2315,6 +2323,12 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Width", "Bevel value/amount");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ prop = RNA_def_property(srna, "segments", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "res");
+ RNA_def_property_range(prop, 1, 100);
+ RNA_def_property_ui_text(prop, "Segments", "Number of segments for round edges/verts");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
prop = RNA_def_property(srna, "use_only_vertices", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", BME_BEVEL_VERT);
RNA_def_property_ui_text(prop, "Only Vertices", "Bevel verts/corners, not edges");
@@ -2326,6 +2340,7 @@ 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);
@@ -2348,15 +2363,10 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Modifier_update");
#ifdef USE_BM_BEVEL_OP_AS_MOD
- prop = RNA_def_property(srna, "use_even_offset", PROP_BOOLEAN, PROP_NONE); /* name matches solidify */
- RNA_def_property_boolean_sdna(prop, NULL, "flags", BME_BEVEL_EVEN);
- RNA_def_property_ui_text(prop, "Even", "Use even bevel distance correction");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_distance_offset", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", BME_BEVEL_DIST);
- RNA_def_property_ui_text(prop, "Distance",
- "Use the width as a distance in rather then a factor of the face size");
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
+ RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_BevelModifier_defgrp_name_set");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
#endif
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 397e05b6a97..1fff567f25c 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -1308,7 +1308,7 @@ static void reg_node(int ID, int category, const char *enum_name, const char *st
static void init(void)
{
- memset(nodes, 0, sizeof nodes);
+ memset(nodes, 0, sizeof(nodes));
#define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
reg_node(ID, Category_##Category, EnumName, STRINGIFY_ARG(Category##StructName), #Category, UIName, UIDesc);
@@ -3800,7 +3800,8 @@ static void def_cmp_bokehblur(StructRNA *srna)
/* duplicated in def_cmp_blur */
prop = RNA_def_property(srna, "use_variable_size", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_NODEFLAG_BLUR_VARIABLE_SIZE);
- RNA_def_property_ui_text(prop, "Variable Size", "Support variable blue per-pixel when using an image for size input");
+ RNA_def_property_ui_text(prop, "Variable Size",
+ "Support variable blur per-pixel when using an image for size input");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
#if 0
@@ -4971,6 +4972,10 @@ static void rna_def_composite_nodetree(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", NTREE_COM_OPENCL);
RNA_def_property_ui_text(prop, "OpenCL", "Enable GPU calculations");
+ prop = RNA_def_property(srna, "use_groupnode_buffer", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", NTREE_COM_GROUPNODE_BUFFER);
+ RNA_def_property_ui_text(prop, "Buffer Groups", "Enable buffering of group nodes");
+
prop = RNA_def_property(srna, "two_pass", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", NTREE_TWO_PASS);
RNA_def_property_ui_text(prop, "Two Pass", "Use two pass execution during editing: first calculate fast nodes, "
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 47b775801f6..2c736df1ed2 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -293,12 +293,10 @@ static void rna_Object_active_shape_update(Main *bmain, Scene *scene, PointerRNA
rna_Object_internal_update_data(bmain, scene, ptr);
}
-static void rna_Object_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Object_dependency_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
DAG_id_tag_update(ptr->id.data, OB_RECALC_OB);
- if (scene) {
- DAG_scene_sort(bmain, scene);
- }
+ DAG_relations_tag_update(bmain);
WM_main_add_notifier(NC_OBJECT | ND_PARENT, ptr->id.data);
}
@@ -332,7 +330,7 @@ static void rna_Object_layer_update__internal(Main *bmain, Scene *scene, Base *b
/* pass */
}
else {
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
}
DAG_id_type_tag(bmain, ID_OB);
@@ -1313,7 +1311,7 @@ static ModifierData *rna_Object_modifier_new(Object *object, bContext *C, Report
static void rna_Object_modifier_remove(Object *object, bContext *C, ReportList *reports, PointerRNA *md_ptr)
{
ModifierData *md = md_ptr->data;
- if (ED_object_modifier_remove(reports, CTX_data_main(C), CTX_data_scene(C), object, md) == FALSE) {
+ if (ED_object_modifier_remove(reports, CTX_data_main(C), object, md) == FALSE) {
/* error is already set */
return;
}
@@ -1325,7 +1323,7 @@ static void rna_Object_modifier_remove(Object *object, bContext *C, ReportList *
static void rna_Object_modifier_clear(Object *object, bContext *C)
{
- ED_object_modifier_clear(CTX_data_main(C), CTX_data_scene(C), object);
+ ED_object_modifier_clear(CTX_data_main(C), object);
WM_main_add_notifier(NC_OBJECT | ND_MODIFIER | NA_REMOVED, object);
}
diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c
index 873ea49824c..ec974df54d5 100644
--- a/source/blender/makesrna/intern/rna_object_force.c
+++ b/source/blender/makesrna/intern/rna_object_force.c
@@ -521,7 +521,7 @@ static void rna_FieldSettings_shape_update(Main *bmain, Scene *scene, PointerRNA
}
else {
if (!pd || pd->shape != PFIELD_SHAPE_SURFACE)
- ED_object_modifier_remove(NULL, bmain, scene, ob, md);
+ ED_object_modifier_remove(NULL, bmain, ob, md);
}
WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
@@ -547,7 +547,7 @@ static void rna_FieldSettings_dependency_update(Main *bmain, Scene *scene, Point
rna_FieldSettings_shape_update(bmain, scene, ptr);
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
if (ob->type == OB_CURVE && ob->pd->forcefield == PFIELD_GUIDE)
DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
@@ -590,9 +590,9 @@ static void rna_EffectorWeight_update(Main *UNUSED(bmain), Scene *UNUSED(scene),
WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
}
-static void rna_EffectorWeight_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_EffectorWeight_dependency_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
DAG_id_tag_update((ID *)ptr->id.data, OB_RECALC_DATA | PSYS_RECALC_RESET);
@@ -669,7 +669,7 @@ static void rna_CollisionSettings_dependency_update(Main *bmain, Scene *scene, P
if (ob->pd->deflect && !md)
ED_object_modifier_add(NULL, bmain, scene, ob, NULL, eModifierType_Collision);
else if (!ob->pd->deflect && md)
- ED_object_modifier_remove(NULL, bmain, scene, ob, md);
+ ED_object_modifier_remove(NULL, bmain, ob, md);
WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
}
@@ -764,7 +764,7 @@ static void rna_def_pointcache(BlenderRNA *brna)
prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "startframe");
RNA_def_property_range(prop, -MAXFRAME, MAXFRAME);
- RNA_def_property_ui_range(prop, -1000, MAXFRAME, 1, 1);
+ RNA_def_property_ui_range(prop, 1, MAXFRAME, 1, 1);
RNA_def_property_ui_text(prop, "Start", "Frame on which the simulation starts");
prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index dbf80f01335..d6f3f594395 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -622,7 +622,7 @@ static void rna_Particle_redo(Main *bmain, Scene *scene, PointerRNA *ptr)
static void rna_Particle_redo_dependency(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
rna_Particle_redo(bmain, scene, ptr);
}
@@ -659,7 +659,7 @@ static ParticleSystem *rna_particle_system_for_target(Object *ob, ParticleTarget
return NULL;
}
-static void rna_Particle_target_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Particle_target_reset(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
if (ptr->type == &RNA_ParticleTarget) {
Object *ob = (Object *)ptr->id.data;
@@ -687,7 +687,7 @@ static void rna_Particle_target_reset(Main *bmain, Scene *scene, PointerRNA *ptr
psys->recalc = PSYS_RECALC_RESET;
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
}
WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
@@ -1937,14 +1937,6 @@ static void rna_def_particle_settings(BlenderRNA *brna)
};
/*TODO: names, tooltips */
-#if 0
- static EnumPropertyItem rot_from_items[] = {
- {PART_ROT_KEYS, "KEYS", 0, "keys", ""},
- {PART_ROT_ZINCR, "ZINCR", 0, "zincr", ""},
- {PART_ROT_IINCR, "IINCR", 0, "iincr", ""},
- {0, NULL, 0, NULL, NULL}
- };
-#endif
static EnumPropertyItem integrator_type_items[] = {
{PART_INT_EULER, "EULER", 0, "Euler", ""},
{PART_INT_VERLET, "VERLET", 0, "Verlet", ""},
@@ -2346,15 +2338,6 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Material", "Material used for the particles");
RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- /* not used anywhere, why is this in DNA??? */
-#if 0
- prop = RNA_def_property(srna, "rotate_from", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "rotfrom");
- RNA_def_property_enum_items(prop, rot_from_items);
- RNA_def_property_ui_text(prop, "Rotate From", "");
-#endif
-
prop = RNA_def_property(srna, "integrator", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, integrator_type_items);
RNA_def_property_ui_text(prop, "Integration",
diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c
index 23f61282b78..1ed675962f3 100644
--- a/source/blender/makesrna/intern/rna_pose.c
+++ b/source/blender/makesrna/intern/rna_pose.c
@@ -187,13 +187,13 @@ static void rna_Pose_ik_solver_set(struct PointerRNA *ptr, int value)
}
}
-static void rna_Pose_ik_solver_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Pose_ik_solver_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
Object *ob = ptr->id.data;
bPose *pose = ptr->data;
pose->flag |= POSE_RECALC; /* checks & sorts pose channels */
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
BKE_pose_update_constraint_flags(pose);
diff --git a/source/blender/makesrna/intern/rna_rigidbody.c b/source/blender/makesrna/intern/rna_rigidbody.c
index 7270ccadb81..f5cf247b5a1 100644
--- a/source/blender/makesrna/intern/rna_rigidbody.c
+++ b/source/blender/makesrna/intern/rna_rigidbody.c
@@ -72,6 +72,7 @@ EnumPropertyItem rigidbody_con_type_items[] = {
{RBC_TYPE_6DOF, "GENERIC", ICON_NONE, "Generic", "Restrict translation and rotation to specified axes"},
{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}};
@@ -501,6 +502,85 @@ static void rna_RigidBodyCon_spring_damping_z_set(PointerRNA *ptr, float value)
#endif
}
+static void rna_RigidBodyCon_motor_lin_max_impulse_set(PointerRNA *ptr, float value)
+{
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+
+ rbc->motor_lin_max_impulse = value;
+
+#ifdef WITH_BULLET
+ if (rbc->physics_constraint && rbc->type == RBC_TYPE_MOTOR) {
+ RB_constraint_set_max_impulse_motor(rbc->physics_constraint, value, rbc->motor_ang_max_impulse);
+ }
+#endif
+}
+
+static void rna_RigidBodyCon_use_motor_lin_set(PointerRNA *ptr, int value)
+{
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+
+ RB_FLAG_SET(rbc->flag, value, RBC_FLAG_USE_MOTOR_LIN);
+
+#ifdef WITH_BULLET
+ if (rbc->physics_constraint) {
+ RB_constraint_set_enable_motor(rbc->physics_constraint, rbc->flag & RBC_FLAG_USE_MOTOR_LIN, rbc->flag & RBC_FLAG_USE_MOTOR_ANG);
+ }
+#endif
+}
+
+static void rna_RigidBodyCon_use_motor_ang_set(PointerRNA *ptr, int value)
+{
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+
+ RB_FLAG_SET(rbc->flag, value, RBC_FLAG_USE_MOTOR_ANG);
+
+#ifdef WITH_BULLET
+ if (rbc->physics_constraint) {
+ RB_constraint_set_enable_motor(rbc->physics_constraint, rbc->flag & RBC_FLAG_USE_MOTOR_LIN, rbc->flag & RBC_FLAG_USE_MOTOR_ANG);
+ }
+#endif
+}
+
+static void rna_RigidBodyCon_motor_lin_target_velocity_set(PointerRNA *ptr, float value)
+{
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+
+ rbc->motor_lin_target_velocity = value;
+
+#ifdef WITH_BULLET
+ if (rbc->physics_constraint && rbc->type == RBC_TYPE_MOTOR) {
+ RB_constraint_set_target_velocity_motor(rbc->physics_constraint, value, rbc->motor_ang_target_velocity);
+ }
+#endif
+}
+
+static void rna_RigidBodyCon_motor_ang_max_impulse_set(PointerRNA *ptr, float value)
+{
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+
+ rbc->motor_ang_max_impulse = value;
+
+#ifdef WITH_BULLET
+ if (rbc->physics_constraint && rbc->type == RBC_TYPE_MOTOR) {
+ RB_constraint_set_max_impulse_motor(rbc->physics_constraint, rbc->motor_lin_max_impulse, value);
+ }
+#endif
+}
+
+static void rna_RigidBodyCon_motor_ang_target_velocity_set(PointerRNA *ptr, float value)
+{
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+
+ rbc->motor_ang_target_velocity = value;
+
+#ifdef WITH_BULLET
+ if (rbc->physics_constraint && rbc->type == RBC_TYPE_MOTOR) {
+ RB_constraint_set_target_velocity_motor(rbc->physics_constraint, rbc->motor_lin_target_velocity, value);
+ }
+#endif
+}
+
+
#else
static void rna_def_rigidbody_world(BlenderRNA *brna)
@@ -866,6 +946,18 @@ static void rna_def_rigidbody_constraint(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Z Spring", "Enable spring on Z axis");
RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+ prop = RNA_def_property(srna, "use_motor_lin", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_MOTOR_LIN);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_use_motor_lin_set");
+ RNA_def_property_ui_text(prop, "Linear Motor", "Enables linear motor");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "use_motor_ang", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_MOTOR_ANG);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_use_motor_ang_set");
+ RNA_def_property_ui_text(prop, "Angular Motor", "Enables angular motor");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
prop = RNA_def_property(srna, "limit_lin_x_lower", PROP_FLOAT, PROP_UNIT_LENGTH);
RNA_def_property_float_sdna(prop, NULL, "limit_lin_x_lower");
RNA_def_property_float_default(prop, -1.0f);
@@ -994,6 +1086,42 @@ static void rna_def_rigidbody_constraint(BlenderRNA *brna)
RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_damping_z_set", NULL);
RNA_def_property_ui_text(prop, "Damping Z", "Damping on the Z axis");
RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "motor_lin_target_velocity", PROP_FLOAT, PROP_UNIT_VELOCITY);
+ RNA_def_property_float_sdna(prop, NULL, "motor_lin_target_velocity");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, -100.0f, 100.0f, 1, 3);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_motor_lin_target_velocity_set", NULL);
+ RNA_def_property_ui_text(prop, "Target Velocity", "Target linear motor velocity");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "motor_lin_max_impulse", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "motor_lin_max_impulse");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_motor_lin_max_impulse_set", NULL);
+ RNA_def_property_ui_text(prop, "Max Impulse", "Maximum linear motor impulse");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "motor_ang_target_velocity", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "motor_ang_target_velocity");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, -100.0f, 100.0f, 1, 3);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_motor_ang_target_velocity_set", NULL);
+ RNA_def_property_ui_text(prop, "Target Velocity", "Target angular motor velocity");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "motor_ang_max_impulse", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "motor_ang_max_impulse");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_motor_ang_max_impulse_set", NULL);
+ RNA_def_property_ui_text(prop, "Max Impulse", "Maximum angular motor impulse");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
}
void RNA_def_rigidbody(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index db9250ab2fc..b9f0632497f 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -388,10 +388,10 @@ static Base *rna_Scene_object_link(Scene *scene, bContext *C, ReportList *report
if (scene == scene_act)
ob->lay = base->lay;
- ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
/* slows down importers too much, run scene.update() */
- /* DAG_scene_sort(G.main, scene); */
+ /* DAG_srelations_tag_update(G.main); */
WM_main_add_notifier(NC_SCENE | ND_OB_ACTIVE, scene);
@@ -419,8 +419,7 @@ static void rna_Scene_object_unlink(Scene *scene, ReportList *reports, Object *o
ob->id.us--;
/* needed otherwise the depgraph will contain freed objects which can crash, see [#20958] */
- DAG_scene_sort(G.main, scene);
- DAG_ids_flush_update(G.main, 0);
+ DAG_relations_tag_update(G.main);
WM_main_add_notifier(NC_SCENE | ND_OB_ACTIVE, scene);
}
@@ -1267,7 +1266,6 @@ static void rna_Scene_use_simplify_update(Main *bmain, Scene *UNUSED(scene), Poi
for (SETLOOPER(sce, sce_iter, base))
object_simplify_update(base->object);
- DAG_ids_flush_update(bmain, 0);
WM_main_add_notifier(NC_GEOM | ND_DATA, NULL);
}
@@ -1586,6 +1584,13 @@ static void rna_def_tool_settings(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}
};
+ static EnumPropertyItem draw_groupuser_items[] = {
+ {OB_DRAW_GROUPUSER_NONE, "NONE", 0, "None", ""},
+ {OB_DRAW_GROUPUSER_ACTIVE, "ACTIVE", 0, "Active", "Show vertices with no weights in the actuve group"},
+ {OB_DRAW_GROUPUSER_ALL, "ALL", 0, "All", "Show vertices with no weights in the any group"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
srna = RNA_def_struct(brna, "ToolSettings", NULL);
RNA_def_struct_path_func(srna, "rna_ToolSettings_path");
RNA_def_struct_ui_text(srna, "Tool Settings", "");
@@ -1608,6 +1613,13 @@ static void rna_def_tool_settings(BlenderRNA *brna)
"weight painting");
RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
+ prop = RNA_def_property(srna, "vertex_group_user", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "weightuser");
+ RNA_def_property_enum_items(prop, draw_groupuser_items);
+ RNA_def_property_ui_text(prop, "Mask Non-Group Vertices", "Display unweighted vertices (multi-paint overrides)");
+ RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
+
+
prop = RNA_def_property(srna, "vertex_paint", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "vpaint");
RNA_def_property_ui_text(prop, "Vertex Paint", "");
@@ -2917,10 +2929,6 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
static EnumPropertyItem physics_engine_items[] = {
{WOPHY_NONE, "NONE", 0, "None", "Don't use a physics engine"},
- /*{WOPHY_ENJI, "ENJI", 0, "Enji", ""}, */
- /*{WOPHY_SUMO, "SUMO", 0, "Sumo (Deprecated)", ""}, */
- /*{WOPHY_DYNAMO, "DYNAMO", 0, "Dynamo", ""}, */
- /*{WOPHY_ODE, "ODE", 0, "ODE", ""}, */
{WOPHY_BULLET, "BULLET", 0, "Bullet", "Use the Bullet physics engine"},
{0, NULL, 0, NULL, NULL}
};
@@ -3956,14 +3964,14 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
prop = RNA_def_property(srna, "resolution_x", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "xsch");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 4, 10000);
+ RNA_def_property_range(prop, 4, 65536);
RNA_def_property_ui_text(prop, "Resolution X", "Number of horizontal pixels in the rendered image");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneCamera_update");
prop = RNA_def_property(srna, "resolution_y", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "ysch");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 4, 10000);
+ RNA_def_property_range(prop, 4, 65536);
RNA_def_property_ui_text(prop, "Resolution Y", "Number of vertical pixels in the rendered image");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneCamera_update");
@@ -3977,13 +3985,13 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
prop = RNA_def_property(srna, "tile_x", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "tilex");
- RNA_def_property_range(prop, 8, 10000);
+ RNA_def_property_range(prop, 8, 65536);
RNA_def_property_ui_text(prop, "Tile X", "Horizontal tile size to use while rendering");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
prop = RNA_def_property(srna, "tile_y", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "tiley");
- RNA_def_property_range(prop, 8, 10000);
+ RNA_def_property_range(prop, 8, 65536);
RNA_def_property_ui_text(prop, "Tile Y", "Vertical tile size to use while rendering");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c
index bdcda79583e..86b97b93437 100644
--- a/source/blender/makesrna/intern/rna_smoke.c
+++ b/source/blender/makesrna/intern/rna_smoke.c
@@ -62,7 +62,7 @@ static void rna_Smoke_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerR
static void rna_Smoke_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
rna_Smoke_update(bmain, scene, ptr);
- DAG_scene_sort(bmain, scene);
+ DAG_relations_tag_update(bmain);
}
static void rna_Smoke_resetCache(Main *bmain, Scene *scene, PointerRNA *ptr)
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index f58c9456386..7dc2dbf3d03 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -2549,7 +2549,7 @@ static void rna_def_space_graph(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}
};
- /* this is basically the same as the one for the 3D-View, but with some entries ommitted */
+ /* this is basically the same as the one for the 3D-View, but with some entries omitted */
static EnumPropertyItem gpivot_items[] = {
{V3D_CENTER, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center", ""},
{V3D_CURSOR, "CURSOR", ICON_CURSOR, "2D Cursor", ""},
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index 2043832a3f8..0ce98e0b364 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -771,7 +771,8 @@ void RNA_api_ui_layout(StructRNA *srna)
parm = RNA_def_string(func, "listtype_name", "", 0, "", "Identifier of the list type to use");
RNA_def_property_flag(parm, PROP_REQUIRED);
parm = RNA_def_string(func, "list_id", "", 0, "",
- "Identifier of this list widget. "
+ "Identifier of this list widget (mandatory when using default \"" UI_UL_DEFAULT_CLASS_NAME
+ "\" class). "
"If this is set, the uilist gets a custom ID, otherwise it takes the "
"name of the class used to define the uilist (for example, if the "
"class name is \"OBJECT_UL_vgroups\", and list_id is not set by the "
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 34c244bf6f2..6c6bb560192 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -1703,6 +1703,13 @@ static void rna_def_userdef_theme_space_console(BlenderRNA *brna)
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Cursor", "");
RNA_def_property_update(prop, 0, "rna_userdef_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");
+
}
static void rna_def_userdef_theme_space_info(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c
index 7a94566c6ee..02a04d36c23 100644
--- a/source/blender/makesrna/intern/rna_world.c
+++ b/source/blender/makesrna/intern/rna_world.c
@@ -494,18 +494,6 @@ void RNA_def_world(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
-#if 0
- static EnumPropertyItem physics_engine_items[] = {
- {WOPHY_NONE, "NONE", 0, "None", ""},
- /*{WOPHY_ENJI, "ENJI", 0, "Enji", ""}, */
- /*{WOPHY_SUMO, "SUMO", 0, "Sumo (Deprecated)", ""}, */
- /*{WOPHY_DYNAMO, "DYNAMO", 0, "Dynamo", ""}, */
- /*{WOPHY_ODE, "ODE", 0, "ODE", ""}, */
- {WOPHY_BULLET, "BULLET", 0, "Bullet", ""},
- {0, NULL, 0, NULL, NULL}
- };
-#endif
-
srna = RNA_def_struct(brna, "World", "ID");
RNA_def_struct_ui_text(srna, "World",
"World datablock describing the environment and ambient lighting of a scene");
diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c
index 776adb57c13..1942fe12a54 100644
--- a/source/blender/modifiers/intern/MOD_bevel.c
+++ b/source/blender/modifiers/intern/MOD_bevel.c
@@ -31,19 +31,22 @@
/** \file blender/modifiers/intern/MOD_bevel.c
* \ingroup modifiers
*/
+
+#include "DNA_object_types.h"
#include "BLI_utildefines.h"
#include "BLI_math.h"
#include "BLI_string.h"
#include "BKE_cdderivedmesh.h"
+#include "BKE_deform.h"
#include "BKE_modifier.h"
#include "BKE_mesh.h"
#include "BKE_bmesh.h" /* only for defines */
-#include "bmesh.h"
+#include "MOD_util.h"
-#include "DNA_object_types.h"
+#include "bmesh.h"
#include "MEM_guardedalloc.h"
@@ -88,21 +91,12 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
return dataMask;
}
-// #define USE_BM_BEVEL_OP_AS_MOD
-
#ifdef USE_BM_BEVEL_OP_AS_MOD
-/* BMESH_TODO
- *
- * this bevel calls the new bevel code (added since 2.64)
- * which is missing many of the options which the bevel modifier from 2.4x has.
- * - no vertex bevel
- * - no weight bevel
- *
- * These will need to be added to the bmesh operator.
- * - campbell
+/*
+ * This calls the new bevel code (added since 2.64)
*/
-static DerivedMesh *applyModifier(ModifierData *md, struct Object *UNUSED(ob),
+static DerivedMesh *applyModifier(ModifierData *md, struct Object *ob,
DerivedMesh *dm,
ModifierApplyFlag UNUSED(flag))
{
@@ -110,13 +104,33 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *UNUSED(ob),
BMesh *bm;
BMIter iter;
BMEdge *e;
+ BMVert *v;
+ float weight;
+ int vgroup = -1;
+ MDeformVert *dvert = NULL;
BevelModifierData *bmd = (BevelModifierData *) md;
const float threshold = cosf((bmd->bevel_angle + 0.00001f) * (float)M_PI / 180.0f);
- const int segments = 16; /* XXX */
+ const bool vertex_only = bmd->flags & BME_BEVEL_VERT;
bm = DM_to_bmesh(dm);
- if (bmd->lim_flags & BME_BEVEL_ANGLE) {
+ if (vertex_only) {
+ if ((bmd->lim_flags & BME_BEVEL_VGROUP) && bmd->defgrp_name[0]) {
+ modifier_get_vgroup(ob, dm, bmd->defgrp_name, &dvert, &vgroup);
+ }
+ BM_ITER_MESH(v, &iter, bm, BM_VERTS_OF_MESH) {
+ if (!BM_vert_is_manifold(v))
+ continue;
+ if (vgroup != -1) {
+ /* Is it safe to assume bmesh indices and dvert array line up?? */
+ weight = defvert_array_find_weight_safe(dvert, BM_elem_index_get(v), vgroup);
+ if (weight <= 0.0f)
+ continue;
+ }
+ BM_elem_flag_enable(v, BM_ELEM_TAG);
+ }
+ }
+ else if (bmd->lim_flags & BME_BEVEL_ANGLE) {
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
/* check for 1 edge having 2 face users */
BMLoop *l_a, *l_b;
@@ -133,6 +147,11 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *UNUSED(ob),
/* crummy, is there a way just to operator on all? - campbell */
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
if (BM_edge_is_manifold(e)) {
+ if (bmd->lim_flags & BME_BEVEL_WEIGHT) {
+ weight = BM_elem_float_data_get(&bm->edata, e, CD_BWEIGHT);
+ if (weight == 0.0f)
+ continue;
+ }
BM_elem_flag_enable(e, BM_ELEM_TAG);
BM_elem_flag_enable(e->v1, BM_ELEM_TAG);
BM_elem_flag_enable(e->v2, BM_ELEM_TAG);
@@ -140,11 +159,14 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *UNUSED(ob),
}
}
- BM_mesh_bevel(bm, bmd->value, segments, bmd->flags & BME_BEVEL_VERT);
+ BM_mesh_bevel(bm, bmd->value, bmd->res,
+ vertex_only, bmd->lim_flags & BME_BEVEL_WEIGHT, dvert, vgroup);
result = CDDM_from_bmesh(bm, TRUE);
- BLI_assert(bm->toolflagpool == NULL); /* make sure we never alloc'd this */
+ BLI_assert(bm->vtoolflagpool == NULL &&
+ bm->etoolflagpool == NULL &&
+ bm->ftoolflagpool == NULL); /* make sure we never alloc'd these */
BM_mesh_free(bm);
CDDM_calc_normals(result);
diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c
index d3a03614d7c..7a55f9a5b48 100644
--- a/source/blender/modifiers/intern/MOD_shrinkwrap.c
+++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c
@@ -161,6 +161,15 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
DAG_RL_OB_DATA | DAG_RL_DATA_DATA, "Shrinkwrap Modifier");
}
+static int dependsOnNormals(ModifierData *md)
+{
+ ShrinkwrapModifierData *smd = (ShrinkwrapModifierData *)md;
+
+ if (smd->target && smd->shrinkType == MOD_SHRINKWRAP_PROJECT)
+ return (smd->projAxis == MOD_SHRINKWRAP_PROJECT_OVER_NORMAL);
+
+ return false;
+}
ModifierTypeInfo modifierType_Shrinkwrap = {
/* name */ "Shrinkwrap",
@@ -185,7 +194,7 @@ ModifierTypeInfo modifierType_Shrinkwrap = {
/* isDisabled */ isDisabled,
/* updateDepgraph */ updateDepgraph,
/* dependsOnTime */ NULL,
- /* dependsOnNormals */ NULL,
+ /* dependsOnNormals */ dependsOnNormals,
/* foreachObjectLink */ foreachObjectLink,
/* foreachIDLink */ NULL,
/* foreachTexLink */ NULL,
diff --git a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
index 3722ad179d0..217670621a8 100644
--- a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
+++ b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
@@ -54,7 +54,6 @@ void register_node_type_cmp_alphaover(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_ALPHAOVER, "Alpha Over", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_alphaover_in, cmp_node_alphaover_out);
- node_type_size(&ntype, 80, 40, 160);
node_type_init(&ntype, node_alphaover_init);
node_type_storage(&ntype, "NodeTwoFloats", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c
index 34cc9a90615..b8bf379b14b 100644
--- a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c
+++ b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c
@@ -57,7 +57,6 @@ void register_node_type_cmp_bilateralblur(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_BILATERALBLUR, "Bilateral Blur", NODE_CLASS_OP_FILTER, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_bilateralblur_in, cmp_node_bilateralblur_out);
- node_type_size(&ntype, 150, 120, 200);
node_type_init(&ntype, node_composit_init_bilateralblur);
node_type_storage(&ntype, "NodeBilateralBlurData", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_blur.c b/source/blender/nodes/composite/nodes/node_composite_blur.c
index 9d19f9667bc..20fce05a40e 100644
--- a/source/blender/nodes/composite/nodes/node_composite_blur.c
+++ b/source/blender/nodes/composite/nodes/node_composite_blur.c
@@ -57,7 +57,6 @@ void register_node_type_cmp_blur(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_BLUR, "Blur", NODE_CLASS_OP_FILTER, NODE_PREVIEW | NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_blur_in, cmp_node_blur_out);
- node_type_size(&ntype, 120, 80, 200);
node_type_init(&ntype, node_composit_init_blur);
node_type_storage(&ntype, "NodeBlurData", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_bokehblur.c b/source/blender/nodes/composite/nodes/node_composite_bokehblur.c
index 222ac7a5cdf..ea3162a9e55 100644
--- a/source/blender/nodes/composite/nodes/node_composite_bokehblur.c
+++ b/source/blender/nodes/composite/nodes/node_composite_bokehblur.c
@@ -61,7 +61,6 @@ void register_node_type_cmp_bokehblur(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_BOKEHBLUR, "Bokeh Blur", NODE_CLASS_OP_FILTER, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_bokehblur_in, cmp_node_bokehblur_out);
- node_type_size(&ntype, 120, 80, 200);
node_type_init(&ntype, node_composit_init_bokehblur);
nodeRegisterType(ttype, &ntype);
diff --git a/source/blender/nodes/composite/nodes/node_composite_bokehimage.c b/source/blender/nodes/composite/nodes/node_composite_bokehimage.c
index fa21e122ebf..b006280ca8a 100644
--- a/source/blender/nodes/composite/nodes/node_composite_bokehimage.c
+++ b/source/blender/nodes/composite/nodes/node_composite_bokehimage.c
@@ -58,7 +58,6 @@ void register_node_type_cmp_bokehimage(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_BOKEHIMAGE, "Bokeh Image", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS);
node_type_socket_templates(&ntype, NULL, cmp_node_bokehimage_out);
- node_type_size(&ntype, 140, 100, 320);
node_type_init(&ntype, node_composit_init_bokehimage);
node_type_storage(&ntype, "NodeBokehImage", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_boxmask.c b/source/blender/nodes/composite/nodes/node_composite_boxmask.c
index d3c6b2ccef0..eb2c58894f3 100644
--- a/source/blender/nodes/composite/nodes/node_composite_boxmask.c
+++ b/source/blender/nodes/composite/nodes/node_composite_boxmask.c
@@ -61,7 +61,6 @@ void register_node_type_cmp_boxmask(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_MASK_BOX, "Box Mask", NODE_CLASS_MATTE, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_boxmask_in, cmp_node_boxmask_out);
- node_type_size(&ntype, 260, 110, 300);
node_type_init(&ntype, node_composit_init_boxmask);
node_type_storage(&ntype, "NodeBoxMask", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_brightness.c b/source/blender/nodes/composite/nodes/node_composite_brightness.c
index 719423edcf8..025f5c03c7c 100644
--- a/source/blender/nodes/composite/nodes/node_composite_brightness.c
+++ b/source/blender/nodes/composite/nodes/node_composite_brightness.c
@@ -54,7 +54,6 @@ void register_node_type_cmp_brightcontrast(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_BRIGHTCONTRAST, "Bright/Contrast", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_brightcontrast_in, cmp_node_brightcontrast_out);
- node_type_size(&ntype, 140, 100, 320);
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c
index bfeeb7ddc99..acb0566be7c 100644
--- a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c
@@ -66,7 +66,6 @@ void register_node_type_cmp_channel_matte(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_CHANNEL_MATTE, "Channel Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_channel_matte_in, cmp_node_channel_matte_out);
- node_type_size(&ntype, 200, 80, 250);
node_type_init(&ntype, node_composit_init_channel_matte);
node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c
index 83c8bbc9a1e..29782c3bc51 100644
--- a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c
@@ -62,7 +62,6 @@ void register_node_type_cmp_chroma_matte(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_CHROMA_MATTE, "Chroma Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_chroma_in, cmp_node_chroma_out);
- node_type_size(&ntype, 200, 80, 300);
node_type_init(&ntype, node_composit_init_chroma_matte);
node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c
index 1642d9283c3..9905a2446b8 100644
--- a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c
@@ -62,7 +62,6 @@ void register_node_type_cmp_color_matte(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_COLOR_MATTE, "Color Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_color_in, cmp_node_color_out);
- node_type_size(&ntype, 200, 80, 300);
node_type_init(&ntype, node_composit_init_color_matte);
node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_colorSpill.c b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c
index 3679a65b238..32fa446790e 100644
--- a/source/blender/nodes/composite/nodes/node_composite_colorSpill.c
+++ b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c
@@ -60,7 +60,6 @@ void register_node_type_cmp_color_spill(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_COLOR_SPILL, "Color Spill", NODE_CLASS_MATTE, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_color_spill_in, cmp_node_color_spill_out);
- node_type_size(&ntype, 140, 80, 200);
node_type_init(&ntype, node_composit_init_color_spill);
node_type_storage(&ntype, "NodeColorspill", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c b/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c
index 526f8472992..19f2fad2e42 100644
--- a/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c
+++ b/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c
@@ -81,7 +81,7 @@ void register_node_type_cmp_colorcorrection(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_COLORCORRECTION, "Color Correction", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_colorcorrection_in, cmp_node_colorcorrection_out);
- node_type_size(&ntype, 400, 200, 500);
+ node_type_size(&ntype, 400, 200, 600);
node_type_init(&ntype, node_composit_init_colorcorrection);
node_type_storage(&ntype, "NodeColorCorrection", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_composite.c b/source/blender/nodes/composite/nodes/node_composite_composite.c
index 6cff4039767..ea281a3f556 100644
--- a/source/blender/nodes/composite/nodes/node_composite_composite.c
+++ b/source/blender/nodes/composite/nodes/node_composite_composite.c
@@ -45,7 +45,6 @@ void register_node_type_cmp_composite(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_COMPOSITE, "Composite", NODE_CLASS_OUTPUT, NODE_OPTIONS | NODE_PREVIEW);
node_type_socket_templates(&ntype, cmp_node_composite_in, NULL);
- node_type_size(&ntype, 80, 60, 200);
/* Do not allow muting for this node. */
node_type_internal_links(&ntype, NULL);
diff --git a/source/blender/nodes/composite/nodes/node_composite_crop.c b/source/blender/nodes/composite/nodes/node_composite_crop.c
index 90d48a543ad..10af55480cd 100644
--- a/source/blender/nodes/composite/nodes/node_composite_crop.c
+++ b/source/blender/nodes/composite/nodes/node_composite_crop.c
@@ -59,7 +59,6 @@ void register_node_type_cmp_crop(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_CROP, "Crop", NODE_CLASS_DISTORT, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_crop_in, cmp_node_crop_out);
- node_type_size(&ntype, 140, 100, 320);
node_type_init(&ntype, node_composit_init_crop);
node_type_storage(&ntype, "NodeTwoXYs", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_defocus.c b/source/blender/nodes/composite/nodes/node_composite_defocus.c
index 88787cc869e..c05f1d6fcff 100644
--- a/source/blender/nodes/composite/nodes/node_composite_defocus.c
+++ b/source/blender/nodes/composite/nodes/node_composite_defocus.c
@@ -67,7 +67,6 @@ void register_node_type_cmp_defocus(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_DEFOCUS, "Defocus", NODE_CLASS_OP_FILTER, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_defocus_in, cmp_node_defocus_out);
- node_type_size(&ntype, 150, 120, 200);
node_type_init(&ntype, node_composit_init_defocus);
node_type_storage(&ntype, "NodeDefocus", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_despeckle.c b/source/blender/nodes/composite/nodes/node_composite_despeckle.c
index 8fc97ef6a86..816a1803e47 100644
--- a/source/blender/nodes/composite/nodes/node_composite_despeckle.c
+++ b/source/blender/nodes/composite/nodes/node_composite_despeckle.c
@@ -54,7 +54,6 @@ void register_node_type_cmp_despeckle(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_DESPECKLE, "Despeckle", NODE_CLASS_OP_FILTER, NODE_PREVIEW|NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_despeckle_in, cmp_node_despeckle_out);
- node_type_size(&ntype, 80, 40, 120);
node_type_init(&ntype, node_composit_init_despeckle);
nodeRegisterType(ttype, &ntype);
diff --git a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c
index bcfd9dd768b..29712d54e32 100644
--- a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c
@@ -59,7 +59,6 @@ void register_node_type_cmp_diff_matte(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_DIFF_MATTE, "Difference Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_diff_matte_in, cmp_node_diff_matte_out);
- node_type_size(&ntype, 200, 80, 250);
node_type_init(&ntype, node_composit_init_diff_matte);
node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_dilate.c b/source/blender/nodes/composite/nodes/node_composite_dilate.c
index 0238914a9d1..fabc54f61b3 100644
--- a/source/blender/nodes/composite/nodes/node_composite_dilate.c
+++ b/source/blender/nodes/composite/nodes/node_composite_dilate.c
@@ -57,7 +57,6 @@ void register_node_type_cmp_dilateerode(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_DILATEERODE, "Dilate/Erode", NODE_CLASS_OP_FILTER, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_dilateerode_in, cmp_node_dilateerode_out);
- node_type_size(&ntype, 130, 100, 320);
node_type_init(&ntype, node_composit_init_dilateerode);
node_type_storage(&ntype, "NodeDilateErode", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c
index ca32f37a32e..6197d78563c 100644
--- a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c
+++ b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c
@@ -56,7 +56,6 @@ void register_node_type_cmp_dblur(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_DBLUR, "Directional Blur", NODE_CLASS_OP_FILTER, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_dblur_in, cmp_node_dblur_out);
- node_type_size(&ntype, 150, 120, 200);
node_type_init(&ntype, node_composit_init_dblur);
node_type_storage(&ntype, "NodeDBlurData", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_displace.c b/source/blender/nodes/composite/nodes/node_composite_displace.c
index 595596765a9..251345d8a28 100644
--- a/source/blender/nodes/composite/nodes/node_composite_displace.c
+++ b/source/blender/nodes/composite/nodes/node_composite_displace.c
@@ -53,7 +53,6 @@ void register_node_type_cmp_displace(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_DISPLACE, "Displace", NODE_CLASS_DISTORT, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_displace_in, cmp_node_displace_out);
- node_type_size(&ntype, 140, 100, 320);
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c
index fffb85cca8e..26f8055e7f2 100644
--- a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c
@@ -60,7 +60,6 @@ void register_node_type_cmp_distance_matte(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_DIST_MATTE, "Distance Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_distance_matte_in, cmp_node_distance_matte_out);
- node_type_size(&ntype, 200, 80, 250);
node_type_init(&ntype, node_composit_init_distance_matte);
node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c
index 4f42c40ee13..d5dd63a4042 100644
--- a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c
+++ b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c
@@ -48,7 +48,6 @@ void register_node_type_cmp_doubleedgemask(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_DOUBLEEDGEMASK, "Double Edge Mask", NODE_CLASS_MATTE, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_doubleedgemask_in, cmp_node_doubleedgemask_out);
- node_type_size(&ntype, 210, 210, 210);
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c
index 761b0b13f11..c2e34dc07a0 100644
--- a/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c
+++ b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c
@@ -61,7 +61,7 @@ void register_node_type_cmp_ellipsemask(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_MASK_ELLIPSE, "Ellipse Mask", NODE_CLASS_MATTE, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_ellipsemask_in, cmp_node_ellipsemask_out);
- node_type_size(&ntype, 260, 110, 300);
+ node_type_size(&ntype, 260, 110, 320);
node_type_init(&ntype, node_composit_init_ellipsemask);
node_type_storage(&ntype, "NodeEllipseMask", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_filter.c b/source/blender/nodes/composite/nodes/node_composite_filter.c
index 338bfc0326d..3ecc7282632 100644
--- a/source/blender/nodes/composite/nodes/node_composite_filter.c
+++ b/source/blender/nodes/composite/nodes/node_composite_filter.c
@@ -49,7 +49,6 @@ void register_node_type_cmp_filter(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_FILTER, "Filter", NODE_CLASS_OP_FILTER, NODE_PREVIEW|NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_filter_in, cmp_node_filter_out);
- node_type_size(&ntype, 80, 40, 120);
node_type_label(&ntype, node_filter_label);
nodeRegisterType(ttype, &ntype);
diff --git a/source/blender/nodes/composite/nodes/node_composite_flip.c b/source/blender/nodes/composite/nodes/node_composite_flip.c
index de41c7274fe..f56805809c5 100644
--- a/source/blender/nodes/composite/nodes/node_composite_flip.c
+++ b/source/blender/nodes/composite/nodes/node_composite_flip.c
@@ -49,7 +49,6 @@ void register_node_type_cmp_flip(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_FLIP, "Flip", NODE_CLASS_DISTORT, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_flip_in, cmp_node_flip_out);
- node_type_size(&ntype, 140, 100, 320);
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_gamma.c b/source/blender/nodes/composite/nodes/node_composite_gamma.c
index 8a9966a2420..6da56165979 100644
--- a/source/blender/nodes/composite/nodes/node_composite_gamma.c
+++ b/source/blender/nodes/composite/nodes/node_composite_gamma.c
@@ -51,7 +51,6 @@ void register_node_type_cmp_gamma(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_GAMMA, "Gamma", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_gamma_in, cmp_node_gamma_out);
- node_type_size(&ntype, 140, 100, 320);
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_glare.c b/source/blender/nodes/composite/nodes/node_composite_glare.c
index 5fdb262de97..dde056de807 100644
--- a/source/blender/nodes/composite/nodes/node_composite_glare.c
+++ b/source/blender/nodes/composite/nodes/node_composite_glare.c
@@ -63,7 +63,6 @@ void register_node_type_cmp_glare(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_GLARE, "Glare", NODE_CLASS_OP_FILTER, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_glare_in, cmp_node_glare_out);
- node_type_size(&ntype, 150, 120, 200);
node_type_init(&ntype, node_composit_init_glare);
node_type_storage(&ntype, "NodeGlare", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c
index be748199bc5..64ba24e082d 100644
--- a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c
+++ b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c
@@ -59,7 +59,6 @@ void register_node_type_cmp_hue_sat(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_hue_sat_in, cmp_node_hue_sat_out);
- node_type_size(&ntype, 150, 80, 250);
node_type_init(&ntype, node_composit_init_hue_sat);
node_type_storage(&ntype, "NodeHueSat", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_huecorrect.c b/source/blender/nodes/composite/nodes/node_composite_huecorrect.c
index 45002b0aa0b..738f2f511f7 100644
--- a/source/blender/nodes/composite/nodes/node_composite_huecorrect.c
+++ b/source/blender/nodes/composite/nodes/node_composite_huecorrect.c
@@ -65,7 +65,7 @@ void register_node_type_cmp_huecorrect(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_HUECORRECT, "Hue Correct", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_huecorrect_in, cmp_node_huecorrect_out);
- node_type_size(&ntype, 320, 140, 400);
+ node_type_size(&ntype, 320, 140, 500);
node_type_init(&ntype, node_composit_init_huecorrect);
node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
diff --git a/source/blender/nodes/composite/nodes/node_composite_idMask.c b/source/blender/nodes/composite/nodes/node_composite_idMask.c
index 8aa08386ae9..89ef4ad3d01 100644
--- a/source/blender/nodes/composite/nodes/node_composite_idMask.c
+++ b/source/blender/nodes/composite/nodes/node_composite_idMask.c
@@ -50,7 +50,6 @@ void register_node_type_cmp_idmask(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_ID_MASK, "ID Mask", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_idmask_in, cmp_node_idmask_out);
- node_type_size(&ntype, 140, 100, 320);
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c
index 66a141b8b6e..563ad2b74b2 100644
--- a/source/blender/nodes/composite/nodes/node_composite_image.c
+++ b/source/blender/nodes/composite/nodes/node_composite_image.c
@@ -324,7 +324,6 @@ void register_node_type_cmp_image(bNodeTreeType *ttype)
static bNodeType ntype;
node_type_base(ttype, &ntype, CMP_NODE_IMAGE, "Image", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS);
- node_type_size(&ntype, 120, 80, 300);
node_type_init(&ntype, node_composit_init_image);
node_type_storage(&ntype, "ImageUser", node_composit_free_image, node_composit_copy_image);
node_type_update(&ntype, cmp_node_image_update, NULL);
@@ -341,7 +340,6 @@ void register_node_type_cmp_rlayers(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_R_LAYERS, "Render Layers", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS);
node_type_socket_templates(&ntype, NULL, cmp_node_rlayers_out);
- node_type_size(&ntype, 150, 100, 300);
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_inpaint.c b/source/blender/nodes/composite/nodes/node_composite_inpaint.c
index 95e5834456c..4844b35fb62 100644
--- a/source/blender/nodes/composite/nodes/node_composite_inpaint.c
+++ b/source/blender/nodes/composite/nodes/node_composite_inpaint.c
@@ -50,7 +50,6 @@ void register_node_type_cmp_inpaint(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_INPAINT, "Inpaint", NODE_CLASS_OP_FILTER, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_inpaint_in, cmp_node_inpaint_out);
- node_type_size(&ntype, 130, 100, 320);
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_invert.c b/source/blender/nodes/composite/nodes/node_composite_invert.c
index 05bccf84d58..0bfbe42868b 100644
--- a/source/blender/nodes/composite/nodes/node_composite_invert.c
+++ b/source/blender/nodes/composite/nodes/node_composite_invert.c
@@ -55,7 +55,6 @@ void register_node_type_cmp_invert(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_invert_in, cmp_node_invert_out);
- node_type_size(&ntype, 120, 120, 140);
node_type_init(&ntype, node_composit_init_invert);
nodeRegisterType(ttype, &ntype);
diff --git a/source/blender/nodes/composite/nodes/node_composite_keying.c b/source/blender/nodes/composite/nodes/node_composite_keying.c
index 5e285095a4e..51e0e9a8e39 100644
--- a/source/blender/nodes/composite/nodes/node_composite_keying.c
+++ b/source/blender/nodes/composite/nodes/node_composite_keying.c
@@ -84,7 +84,6 @@ void register_node_type_cmp_keying(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_KEYING, "Keying", NODE_CLASS_MATTE, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_keying_in, cmp_node_keying_out);
- node_type_size(&ntype, 140, 100, 320);
node_type_init(&ntype, node_composit_init_keying);
node_type_storage(&ntype, "NodeKeyingData", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_keyingscreen.c b/source/blender/nodes/composite/nodes/node_composite_keyingscreen.c
index 5db7f8fc991..1974087e8e7 100644
--- a/source/blender/nodes/composite/nodes/node_composite_keyingscreen.c
+++ b/source/blender/nodes/composite/nodes/node_composite_keyingscreen.c
@@ -65,7 +65,6 @@ void register_node_type_cmp_keyingscreen(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_KEYINGSCREEN, "Keying Screen", NODE_CLASS_MATTE, NODE_OPTIONS);
node_type_socket_templates(&ntype, NULL, cmp_node_keyingscreen_out);
- node_type_size(&ntype, 140, 100, 320);
node_type_init(&ntype, node_composit_init_keyingscreen);
node_type_storage(&ntype, "NodeKeyingScreenData", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_lensdist.c b/source/blender/nodes/composite/nodes/node_composite_lensdist.c
index e454022de3d..15d10e07946 100644
--- a/source/blender/nodes/composite/nodes/node_composite_lensdist.c
+++ b/source/blender/nodes/composite/nodes/node_composite_lensdist.c
@@ -57,7 +57,6 @@ void register_node_type_cmp_lensdist(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_LENSDIST, "Lens Distortion", NODE_CLASS_DISTORT, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_lensdist_in, cmp_node_lensdist_out);
- node_type_size(&ntype, 150, 120, 200);
node_type_init(&ntype, node_composit_init_lensdist);
node_type_storage(&ntype, "NodeLensDist", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_levels.c b/source/blender/nodes/composite/nodes/node_composite_levels.c
index 5f9797d9123..f50a8838d74 100644
--- a/source/blender/nodes/composite/nodes/node_composite_levels.c
+++ b/source/blender/nodes/composite/nodes/node_composite_levels.c
@@ -56,7 +56,6 @@ void register_node_type_cmp_view_levels(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_VIEW_LEVELS, "Levels", NODE_CLASS_OUTPUT, NODE_OPTIONS|NODE_PREVIEW);
node_type_socket_templates(&ntype, cmp_node_view_levels_in, cmp_node_view_levels_out);
- node_type_size(&ntype, 140, 100, 320);
node_type_init(&ntype, node_composit_init_view_levels);
node_type_storage(&ntype, "ImageUser", NULL, NULL);
diff --git a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c
index 6e0c877fe1c..60a7f3014de 100644
--- a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c
@@ -59,7 +59,6 @@ void register_node_type_cmp_luma_matte(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_LUMA_MATTE, "Luminance Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_luma_matte_in, cmp_node_luma_matte_out);
- node_type_size(&ntype, 200, 80, 250);
node_type_init(&ntype, node_composit_init_luma_matte);
node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_mapRange.c b/source/blender/nodes/composite/nodes/node_composite_mapRange.c
index f96e133b19f..07f34e79bd1 100644
--- a/source/blender/nodes/composite/nodes/node_composite_mapRange.c
+++ b/source/blender/nodes/composite/nodes/node_composite_mapRange.c
@@ -52,7 +52,6 @@ void register_node_type_cmp_map_range(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_MAP_RANGE, "Map Range", NODE_CLASS_OP_VECTOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_map_range_in, cmp_node_map_range_out);
- node_type_size(&ntype, 120, 60, 150);
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_mapUV.c b/source/blender/nodes/composite/nodes/node_composite_mapUV.c
index 8fd49cd206b..fa4c8d7022c 100644
--- a/source/blender/nodes/composite/nodes/node_composite_mapUV.c
+++ b/source/blender/nodes/composite/nodes/node_composite_mapUV.c
@@ -50,7 +50,6 @@ void register_node_type_cmp_mapuv(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_MAP_UV, "Map UV", NODE_CLASS_DISTORT, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_mapuv_in, cmp_node_mapuv_out);
- node_type_size(&ntype, 140, 100, 320);
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_mapValue.c b/source/blender/nodes/composite/nodes/node_composite_mapValue.c
index 62db0be5411..046eeaf4fc8 100644
--- a/source/blender/nodes/composite/nodes/node_composite_mapValue.c
+++ b/source/blender/nodes/composite/nodes/node_composite_mapValue.c
@@ -53,7 +53,6 @@ void register_node_type_cmp_map_value(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_MAP_VALUE, "Map Value", NODE_CLASS_OP_VECTOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_map_value_in, cmp_node_map_value_out);
- node_type_size(&ntype, 100, 60, 150);
node_type_init(&ntype, node_composit_init_map_value);
node_type_storage(&ntype, "TexMapping", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_mask.c b/source/blender/nodes/composite/nodes/node_composite_mask.c
index 8be6ecd27fd..27534698422 100644
--- a/source/blender/nodes/composite/nodes/node_composite_mask.c
+++ b/source/blender/nodes/composite/nodes/node_composite_mask.c
@@ -61,7 +61,6 @@ void register_node_type_cmp_mask(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_MASK, "Mask", NODE_CLASS_INPUT, NODE_OPTIONS);
node_type_socket_templates(&ntype, NULL, cmp_node_mask_out);
- node_type_size(&ntype, 140, 100, 320);
node_type_init(&ntype, node_composit_init_mask);
node_type_storage(&ntype, "NodeMask", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_math.c b/source/blender/nodes/composite/nodes/node_composite_math.c
index 5bf555cd605..5f5369ce03a 100644
--- a/source/blender/nodes/composite/nodes/node_composite_math.c
+++ b/source/blender/nodes/composite/nodes/node_composite_math.c
@@ -51,7 +51,6 @@ void register_node_type_cmp_math(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_MATH, "Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_math_in, cmp_node_math_out);
- node_type_size(&ntype, 120, 110, 160);
node_type_label(&ntype, node_math_label);
nodeRegisterType(ttype, &ntype);
diff --git a/source/blender/nodes/composite/nodes/node_composite_mixrgb.c b/source/blender/nodes/composite/nodes/node_composite_mixrgb.c
index fed73e13c92..23e4fc90457 100644
--- a/source/blender/nodes/composite/nodes/node_composite_mixrgb.c
+++ b/source/blender/nodes/composite/nodes/node_composite_mixrgb.c
@@ -50,7 +50,6 @@ void register_node_type_cmp_mix_rgb(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_PREVIEW|NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_mix_rgb_in, cmp_node_mix_rgb_out);
- node_type_size(&ntype, 110, 60, 120);
node_type_label(&ntype, node_blend_label);
nodeRegisterType(ttype, &ntype);
diff --git a/source/blender/nodes/composite/nodes/node_composite_movieclip.c b/source/blender/nodes/composite/nodes/node_composite_movieclip.c
index 85745d2ff40..39d46e053bf 100644
--- a/source/blender/nodes/composite/nodes/node_composite_movieclip.c
+++ b/source/blender/nodes/composite/nodes/node_composite_movieclip.c
@@ -56,7 +56,6 @@ void register_node_type_cmp_movieclip(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_MOVIECLIP, "Movie Clip", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS);
node_type_socket_templates(&ntype, NULL, cmp_node_movieclip_out);
- node_type_size(&ntype, 120, 80, 300);
node_type_init(&ntype, init);
node_type_storage(&ntype, "MovieClipUser", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c
index 4817c59bbbd..198ffbb2857 100644
--- a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c
+++ b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c
@@ -72,7 +72,6 @@ void register_node_type_cmp_moviedistortion(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_MOVIEDISTORTION, "Movie Distortion", NODE_CLASS_DISTORT, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_moviedistortion_in, cmp_node_moviedistortion_out);
- node_type_size(&ntype, 140, 100, 320);
node_type_label(&ntype, label);
node_type_storage(&ntype, NULL, storage_free, storage_copy);
diff --git a/source/blender/nodes/composite/nodes/node_composite_normal.c b/source/blender/nodes/composite/nodes/node_composite_normal.c
index 1497757bbf4..88db5d36810 100644
--- a/source/blender/nodes/composite/nodes/node_composite_normal.c
+++ b/source/blender/nodes/composite/nodes/node_composite_normal.c
@@ -62,7 +62,6 @@ void register_node_type_cmp_normal(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_NORMAL, "Normal", NODE_CLASS_OP_VECTOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_normal_in, cmp_node_normal_out);
node_type_init(&ntype, init);
- node_type_size(&ntype, 100, 60, 200);
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_normalize.c b/source/blender/nodes/composite/nodes/node_composite_normalize.c
index f90a5cdba74..db811666900 100644
--- a/source/blender/nodes/composite/nodes/node_composite_normalize.c
+++ b/source/blender/nodes/composite/nodes/node_composite_normalize.c
@@ -49,7 +49,6 @@ void register_node_type_cmp_normalize(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_NORMALIZE, "Normalize", NODE_CLASS_OP_VECTOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_normalize_in, cmp_node_normalize_out);
- node_type_size(&ntype, 100, 60, 150);
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_outputFile.c b/source/blender/nodes/composite/nodes/node_composite_outputFile.c
index e8a650682c2..dff09b93845 100644
--- a/source/blender/nodes/composite/nodes/node_composite_outputFile.c
+++ b/source/blender/nodes/composite/nodes/node_composite_outputFile.c
@@ -231,7 +231,6 @@ void register_node_type_cmp_output_file(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_OUTPUT_FILE, "File Output", NODE_CLASS_OUTPUT, NODE_OPTIONS|NODE_PREVIEW);
node_type_socket_templates(&ntype, NULL, NULL);
- node_type_size(&ntype, 140, 80, 300);
node_type_init(&ntype, init_output_file);
node_type_storage(&ntype, "NodeImageMultiFile", free_output_file, copy_output_file);
node_type_update(&ntype, update_output_file, NULL);
diff --git a/source/blender/nodes/composite/nodes/node_composite_pixelate.c b/source/blender/nodes/composite/nodes/node_composite_pixelate.c
index 5eac4867a23..3b65a2cdbd5 100644
--- a/source/blender/nodes/composite/nodes/node_composite_pixelate.c
+++ b/source/blender/nodes/composite/nodes/node_composite_pixelate.c
@@ -51,7 +51,6 @@ void register_node_type_cmp_pixelate(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_PIXELATE, "Pixelate", NODE_CLASS_OP_FILTER, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_pixelate_in, cmp_node_pixelate_out);
- node_type_size(&ntype, 130, 100, 130);
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_premulkey.c b/source/blender/nodes/composite/nodes/node_composite_premulkey.c
index 88f583b402e..01eb3607760 100644
--- a/source/blender/nodes/composite/nodes/node_composite_premulkey.c
+++ b/source/blender/nodes/composite/nodes/node_composite_premulkey.c
@@ -50,7 +50,6 @@ void register_node_type_cmp_premulkey(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_PREMULKEY, "Alpha Convert", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_premulkey_in, cmp_node_premulkey_out);
- node_type_size(&ntype, 140, 100, 320);
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_rgb.c b/source/blender/nodes/composite/nodes/node_composite_rgb.c
index ad06d7a9a7e..30b23a4c146 100644
--- a/source/blender/nodes/composite/nodes/node_composite_rgb.c
+++ b/source/blender/nodes/composite/nodes/node_composite_rgb.c
@@ -57,7 +57,7 @@ void register_node_type_cmp_rgb(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_RGB, "RGB", NODE_CLASS_INPUT, NODE_OPTIONS);
node_type_socket_templates(&ntype, NULL, cmp_node_rgb_out);
node_type_init(&ntype, node_composit_init_rgb);
- node_type_size(&ntype, 140, 80, 140);
+ node_type_size_preset(&ntype, NODE_SIZE_SMALL);
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_rotate.c b/source/blender/nodes/composite/nodes/node_composite_rotate.c
index 4eb869e5444..6b5521ea4d2 100644
--- a/source/blender/nodes/composite/nodes/node_composite_rotate.c
+++ b/source/blender/nodes/composite/nodes/node_composite_rotate.c
@@ -55,7 +55,6 @@ void register_node_type_cmp_rotate(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_ROTATE, "Rotate", NODE_CLASS_DISTORT, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_rotate_in, cmp_node_rotate_out);
- node_type_size(&ntype, 140, 100, 320);
node_type_init(&ntype, node_composit_init_rotate);
nodeRegisterType(ttype, &ntype);
diff --git a/source/blender/nodes/composite/nodes/node_composite_scale.c b/source/blender/nodes/composite/nodes/node_composite_scale.c
index 5136aec112d..6c2c6c37cb7 100644
--- a/source/blender/nodes/composite/nodes/node_composite_scale.c
+++ b/source/blender/nodes/composite/nodes/node_composite_scale.c
@@ -51,7 +51,6 @@ void register_node_type_cmp_scale(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_SCALE, "Scale", NODE_CLASS_DISTORT, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_scale_in, cmp_node_scale_out);
- node_type_size(&ntype, 140, 100, 320);
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c
index 83b9d5d3fcd..d463f35a07a 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c
@@ -52,7 +52,6 @@ void register_node_type_cmp_sephsva(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_SEPHSVA, "Separate HSVA", NODE_CLASS_CONVERTOR, 0);
node_type_socket_templates(&ntype, cmp_node_sephsva_in, cmp_node_sephsva_out);
- node_type_size(&ntype, 80, 40, 140);
nodeRegisterType(ttype, &ntype);
}
@@ -77,7 +76,6 @@ void register_node_type_cmp_combhsva(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_COMBHSVA, "Combine HSVA", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_combhsva_in, cmp_node_combhsva_out);
- node_type_size(&ntype, 80, 40, 140);
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c
index 8508087da0f..03b43f5073f 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c
@@ -51,7 +51,6 @@ void register_node_type_cmp_seprgba(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_SEPRGBA, "Separate RGBA", NODE_CLASS_CONVERTOR, 0);
node_type_socket_templates(&ntype, cmp_node_seprgba_in, cmp_node_seprgba_out);
- node_type_size(&ntype, 80, 40, 140);
nodeRegisterType(ttype, &ntype);
}
@@ -77,7 +76,6 @@ void register_node_type_cmp_combrgba(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_COMBRGBA, "Combine RGBA", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_combrgba_in, cmp_node_combrgba_out);
- node_type_size(&ntype, 80, 40, 140);
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c
index a7cc7367c67..16aba1ba408 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c
@@ -53,7 +53,6 @@ void register_node_type_cmp_sepycca(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_SEPYCCA, "Separate YCbCrA", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_sepycca_in, cmp_node_sepycca_out);
- node_type_size(&ntype, 80, 40, 140);
nodeRegisterType(ttype, &ntype);
}
@@ -79,7 +78,6 @@ void register_node_type_cmp_combycca(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_COMBYCCA, "Combine YCbCrA", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_combycca_in, cmp_node_combycca_out);
- node_type_size(&ntype, 80, 40, 140);
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c
index 88edf7ec6b0..7d7ec166fd4 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c
@@ -53,7 +53,6 @@ void register_node_type_cmp_sepyuva(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_SEPYUVA, "Separate YUVA", NODE_CLASS_CONVERTOR, 0);
node_type_socket_templates(&ntype, cmp_node_sepyuva_in, cmp_node_sepyuva_out);
- node_type_size(&ntype, 80, 40, 140);
nodeRegisterType(ttype, &ntype);
}
@@ -79,7 +78,6 @@ void register_node_type_cmp_combyuva(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_COMBYUVA, "Combine YUVA", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_combyuva_in, cmp_node_combyuva_out);
- node_type_size(&ntype, 80, 40, 140);
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_setalpha.c b/source/blender/nodes/composite/nodes/node_composite_setalpha.c
index 0cec19b15af..d36acc6c054 100644
--- a/source/blender/nodes/composite/nodes/node_composite_setalpha.c
+++ b/source/blender/nodes/composite/nodes/node_composite_setalpha.c
@@ -49,7 +49,6 @@ void register_node_type_cmp_setalpha(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_SETALPHA, "Set Alpha", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_setalpha_in, cmp_node_setalpha_out);
- node_type_size(&ntype, 120, 40, 140);
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_splitViewer.c b/source/blender/nodes/composite/nodes/node_composite_splitViewer.c
index 3f4c3d67e2c..38a6981613a 100644
--- a/source/blender/nodes/composite/nodes/node_composite_splitViewer.c
+++ b/source/blender/nodes/composite/nodes/node_composite_splitViewer.c
@@ -55,7 +55,6 @@ void register_node_type_cmp_splitviewer(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_SPLITVIEWER, "Split Viewer", NODE_CLASS_OUTPUT, NODE_PREVIEW|NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_splitviewer_in, NULL);
- node_type_size(&ntype, 140, 100, 320);
node_type_init(&ntype, node_composit_init_splitviewer);
node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c
index 964e54eb862..6b345b4c15c 100644
--- a/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c
+++ b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c
@@ -51,7 +51,6 @@ void register_node_type_cmp_stabilize2d(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_STABILIZE2D, "Stabilize 2D", NODE_CLASS_DISTORT, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_stabilize2d_in, cmp_node_stabilize2d_out);
- node_type_size(&ntype, 140, 100, 320);
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_switch.c b/source/blender/nodes/composite/nodes/node_composite_switch.c
index 7f9127c969f..49fa61a8397 100644
--- a/source/blender/nodes/composite/nodes/node_composite_switch.c
+++ b/source/blender/nodes/composite/nodes/node_composite_switch.c
@@ -52,7 +52,7 @@ void register_node_type_cmp_switch(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_SWITCH, "Switch", NODE_CLASS_LAYOUT, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_switch_in, cmp_node_switch_out);
- node_type_size(&ntype, 110, 60, 120);
+ node_type_size_preset(&ntype, NODE_SIZE_SMALL);
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_texture.c b/source/blender/nodes/composite/nodes/node_composite_texture.c
index 17b5720c7ad..515093fc3e1 100644
--- a/source/blender/nodes/composite/nodes/node_composite_texture.c
+++ b/source/blender/nodes/composite/nodes/node_composite_texture.c
@@ -50,7 +50,6 @@ void register_node_type_cmp_texture(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW);
node_type_socket_templates(&ntype, cmp_node_texture_in, cmp_node_texture_out);
- node_type_size(&ntype, 120, 80, 240);
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_tonemap.c b/source/blender/nodes/composite/nodes/node_composite_tonemap.c
index 94492431c9f..fd3a217b150 100644
--- a/source/blender/nodes/composite/nodes/node_composite_tonemap.c
+++ b/source/blender/nodes/composite/nodes/node_composite_tonemap.c
@@ -63,7 +63,6 @@ void register_node_type_cmp_tonemap(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_TONEMAP, "Tonemap", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_tonemap_in, cmp_node_tonemap_out);
- node_type_size(&ntype, 150, 120, 200);
node_type_init(&ntype, node_composit_init_tonemap);
node_type_storage(&ntype, "NodeTonemap", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_trackpos.c b/source/blender/nodes/composite/nodes/node_composite_trackpos.c
index 41dc5633ee5..8014e879894 100644
--- a/source/blender/nodes/composite/nodes/node_composite_trackpos.c
+++ b/source/blender/nodes/composite/nodes/node_composite_trackpos.c
@@ -52,7 +52,6 @@ void register_node_type_cmp_trackpos(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_TRACKPOS, "Track Position", NODE_CLASS_INPUT, NODE_OPTIONS);
node_type_socket_templates(&ntype, NULL, cmp_node_trackpos_out);
- node_type_size(&ntype, 120, 80, 300);
node_type_init(&ntype, init);
node_type_storage(&ntype, "NodeTrackPosData", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_transform.c b/source/blender/nodes/composite/nodes/node_composite_transform.c
index f51e49328ab..3ed8bdb9995 100644
--- a/source/blender/nodes/composite/nodes/node_composite_transform.c
+++ b/source/blender/nodes/composite/nodes/node_composite_transform.c
@@ -54,7 +54,6 @@ void register_node_type_cmp_transform(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_TRANSFORM, "Transform", NODE_CLASS_DISTORT, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_transform_in, cmp_node_transform_out);
- node_type_size(&ntype, 140, 100, 320);
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_translate.c b/source/blender/nodes/composite/nodes/node_composite_translate.c
index 60b32563569..5d555cdcda9 100644
--- a/source/blender/nodes/composite/nodes/node_composite_translate.c
+++ b/source/blender/nodes/composite/nodes/node_composite_translate.c
@@ -58,7 +58,6 @@ void register_node_type_cmp_translate(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_TRANSLATE, "Translate", NODE_CLASS_DISTORT, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_translate_in, cmp_node_translate_out);
- node_type_size(&ntype, 140, 100, 320);
node_type_init(&ntype, node_composit_init_translate);
node_type_storage(&ntype, "NodeTranslateData", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_valToRgb.c b/source/blender/nodes/composite/nodes/node_composite_valToRgb.c
index c40880cc421..5a23507bcc7 100644
--- a/source/blender/nodes/composite/nodes/node_composite_valToRgb.c
+++ b/source/blender/nodes/composite/nodes/node_composite_valToRgb.c
@@ -55,7 +55,7 @@ void register_node_type_cmp_valtorgb(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_valtorgb_in, cmp_node_valtorgb_out);
- node_type_size(&ntype, 240, 200, 300);
+ node_type_size(&ntype, 240, 200, 320);
node_type_init(&ntype, node_composit_init_valtorgb);
node_type_storage(&ntype, "ColorBand", node_free_standard_storage, node_copy_standard_storage);
@@ -80,7 +80,7 @@ void register_node_type_cmp_rgbtobw(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTOR, 0);
node_type_socket_templates(&ntype, cmp_node_rgbtobw_in, cmp_node_rgbtobw_out);
- node_type_size(&ntype, 80, 40, 120);
+ node_type_size_preset(&ntype, NODE_SIZE_SMALL);
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_value.c b/source/blender/nodes/composite/nodes/node_composite_value.c
index 05e79efa196..306170baf93 100644
--- a/source/blender/nodes/composite/nodes/node_composite_value.c
+++ b/source/blender/nodes/composite/nodes/node_composite_value.c
@@ -56,7 +56,7 @@ void register_node_type_cmp_value(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_VALUE, "Value", NODE_CLASS_INPUT, NODE_OPTIONS);
node_type_socket_templates(&ntype, NULL, cmp_node_value_out);
node_type_init(&ntype, node_composit_init_value);
- node_type_size(&ntype, 80, 40, 120);
+ node_type_size_preset(&ntype, NODE_SIZE_SMALL);
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_vecBlur.c b/source/blender/nodes/composite/nodes/node_composite_vecBlur.c
index ff4fe8d8da5..35fb4a944db 100644
--- a/source/blender/nodes/composite/nodes/node_composite_vecBlur.c
+++ b/source/blender/nodes/composite/nodes/node_composite_vecBlur.c
@@ -60,7 +60,6 @@ void register_node_type_cmp_vecblur(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_VECBLUR, "Vector Blur", NODE_CLASS_OP_FILTER, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_vecblur_in, cmp_node_vecblur_out);
- node_type_size(&ntype, 120, 80, 200);
node_type_init(&ntype, node_composit_init_vecblur);
node_type_storage(&ntype, "NodeBlurData", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_viewer.c b/source/blender/nodes/composite/nodes/node_composite_viewer.c
index 233a0627a7a..211ebe54eb0 100644
--- a/source/blender/nodes/composite/nodes/node_composite_viewer.c
+++ b/source/blender/nodes/composite/nodes/node_composite_viewer.c
@@ -58,7 +58,6 @@ void register_node_type_cmp_viewer(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_VIEWER, "Viewer", NODE_CLASS_OUTPUT, NODE_OPTIONS | NODE_PREVIEW);
node_type_socket_templates(&ntype, cmp_node_viewer_in, NULL);
- node_type_size(&ntype, 80, 60, 200);
node_type_init(&ntype, node_composit_init_viewer);
node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_zcombine.c b/source/blender/nodes/composite/nodes/node_composite_zcombine.c
index 89d0cccd183..ba81174e103 100644
--- a/source/blender/nodes/composite/nodes/node_composite_zcombine.c
+++ b/source/blender/nodes/composite/nodes/node_composite_zcombine.c
@@ -54,7 +54,6 @@ void register_node_type_cmp_zcombine(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_ZCOMBINE, "Z Combine", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_zcombine_in, cmp_node_zcombine_out);
- node_type_size(&ntype, 80, 40, 120);
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c
index 8d146bedb48..0c0ad50ebe4 100644
--- a/source/blender/python/generic/bpy_internal_import.c
+++ b/source/blender/python/generic/bpy_internal_import.c
@@ -66,7 +66,7 @@ static PyObject *imp_reload_orig = NULL;
*
* However Python's alternative is to use import hooks,
* which are implemented in a way that we can't use our own importer as a
- * fall-back (instead we must try and fail - raise an exception evert time).
+ * fall-back (instead we must try and fail - raise an exception every time).
* Since importing from blenders text-blocks is not the common case
* I prefer to use Pythons import by default and fall-back to
* Blenders - which we can only do by intercepting import calls I'm afraid.
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index 632018f2bf0..90199a403dc 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -928,3 +928,20 @@ static void bpy_module_free(void *UNUSED(mod))
}
#endif
+
+
+/* EVIL, define text.c functions here... */
+extern int text_check_identifier_unicode(const unsigned int ch);
+extern int text_check_identifier_nodigit_unicode(const unsigned int ch);
+extern int text_check_identifier(const char ch);
+extern int text_check_identifier_nodigit(const char ch);
+
+int text_check_identifier_unicode(const unsigned int ch)
+{
+ return (ch < 255 && text_check_identifier((char)ch)) || Py_UNICODE_ISALNUM(ch);
+}
+
+int text_check_identifier_nodigit_unicode(const unsigned int ch)
+{
+ return (ch < 255 && text_check_identifier_nodigit((char)ch)) || Py_UNICODE_ISALPHA(ch);
+}
diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c
index b42fdbd0ca4..830c2c8de3a 100644
--- a/source/blender/python/intern/bpy_props.c
+++ b/source/blender/python/intern/bpy_props.c
@@ -2796,12 +2796,17 @@ static PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject
}
PyDoc_STRVAR(BPy_RemoveProperty_doc,
-".. function:: RemoveProperty(attr)\n"
+".. function:: RemoveProperty(cls, attr="")\n"
"\n"
" Removes a dynamically defined property.\n"
"\n"
-" :arg attr: Property name.\n"
+" :arg cls: The class containing the property (must be a positional argument).\n"
+" :type cls: type\n"
+" :arg attr: Property name (must be passed as a keyword).\n"
" :type attr: string\n"
+"\n"
+".. note:: Typically this function doesn't need to be accessed directly.\n"
+" Instead use ``del cls.attr``\n"
);
static PyObject *BPy_RemoveProperty(PyObject *self, PyObject *args, PyObject *kw)
{
@@ -2816,7 +2821,7 @@ static PyObject *BPy_RemoveProperty(PyObject *self, PyObject *args, PyObject *kw
return ret;
}
else if (PyTuple_GET_SIZE(args) > 1) {
- PyErr_SetString(PyExc_ValueError, "all args must be keywords");
+ PyErr_SetString(PyExc_ValueError, "expected one positional arg, one keyword arg");
return NULL;
}
diff --git a/source/blender/render/intern/source/bake.c b/source/blender/render/intern/source/bake.c
index cb6f9611bfd..7c5d6038e0a 100644
--- a/source/blender/render/intern/source/bake.c
+++ b/source/blender/render/intern/source/bake.c
@@ -648,6 +648,8 @@ static int get_next_bake_face(BakeShade *bs)
ImBuf *ibuf = NULL;
const float vec_alpha[4] = {0.0f, 0.0f, 0.0f, 0.0f};
const float vec_solid[4] = {0.0f, 0.0f, 0.0f, 1.0f};
+ const float nor_alpha[4] = {0.5f, 0.5f, 1.0f, 0.0f};
+ const float nor_solid[4] = {0.5f, 0.5f, 1.0f, 1.0f};
tface = RE_vlakren_get_tface(obr, vlr, obr->bakemtface, NULL, 0);
@@ -684,9 +686,12 @@ static int get_next_bake_face(BakeShade *bs)
if (ibuf->rect_float)
imb_freerectImBuf(ibuf);
/* clear image */
- if (R.r.bake_flag & R_BAKE_CLEAR)
- IMB_rectfill(ibuf, (ibuf->planes == R_IMF_PLANES_RGBA) ? vec_alpha : vec_solid);
-
+ if (R.r.bake_flag & R_BAKE_CLEAR) {
+ if (R.r.bake_mode == RE_BAKE_NORMALS && R.r.bake_normal_space == R_BAKE_SPACE_TANGENT)
+ IMB_rectfill(ibuf, (ibuf->planes == R_IMF_PLANES_RGBA) ? nor_alpha : nor_solid);
+ else
+ IMB_rectfill(ibuf, (ibuf->planes == R_IMF_PLANES_RGBA) ? vec_alpha : vec_solid);
+ }
/* might be read by UI to set active image for display */
R.bakebuf = ima;
}
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index 28065002773..496edae9a38 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -4079,18 +4079,10 @@ static void set_renderlayer_lightgroups(Render *re, Scene *sce)
void init_render_world(Render *re)
{
int a;
- char *cp;
if (re->scene && re->scene->world) {
re->wrld= *(re->scene->world);
-
- cp= (char *)&re->wrld.fastcol;
-
- cp[0]= 255.0f*re->wrld.horr;
- cp[1]= 255.0f*re->wrld.horg;
- cp[2]= 255.0f*re->wrld.horb;
- cp[3]= 1;
-
+
copy_v3_v3(re->grvec, re->viewmat[2]);
normalize_v3(re->grvec);
copy_m3_m4(re->imat, re->viewinv);
diff --git a/source/blender/render/intern/source/multires_bake.c b/source/blender/render/intern/source/multires_bake.c
index ea42049989b..e81359e8fca 100644
--- a/source/blender/render/intern/source/multires_bake.c
+++ b/source/blender/render/intern/source/multires_bake.c
@@ -1258,13 +1258,13 @@ static void finish_images(MultiresBakeRender *bkr, MultiresBakeResult *result)
if (ibuf->x <= 0 || ibuf->y <= 0)
continue;
- RE_bake_ibuf_filter(ibuf, userdata->mask_buffer, bkr->bake_filter);
-
if (use_displacement_buffer) {
RE_bake_ibuf_normalize_displacement(ibuf, userdata->displacement_buffer, userdata->mask_buffer,
result->height_min, result->height_max);
}
+ RE_bake_ibuf_filter(ibuf, userdata->mask_buffer, bkr->bake_filter);
+
ibuf->userflags |= IB_BITMAPDIRTY | IB_DISPLAY_BUFFER_INVALID;
if (ibuf->rect_float)
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index 05601a6b5e6..076bdaeaea7 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -678,6 +678,10 @@ static void *do_part_thread(void *pa_v)
else
zbufshade_tile(pa);
+ /* we do actually write pixels, but don't allocate/deallocate anything,
+ * so it is safe with other threads reading at the same time */
+ BLI_rw_mutex_lock(&R.resultmutex, THREAD_LOCK_READ);
+
/* merge too on break! */
if (R.result->do_exr_tile) {
render_result_exr_file_merge(R.result, pa->result);
@@ -691,6 +695,8 @@ static void *do_part_thread(void *pa_v)
render_result_merge(R.result, pa->result);
}
}
+
+ BLI_rw_mutex_unlock(&R.resultmutex);
}
pa->status = PART_STATUS_READY;
@@ -724,24 +730,33 @@ float panorama_pixel_rot(Render *re)
return phi;
}
-/* call when all parts stopped rendering, to find the next Y slice */
-/* if slice found, it rotates the dbase */
-static RenderPart *find_next_pano_slice(Render *re, int *minx, rctf *viewplane)
+/* for panorama, we render per Y slice, and update
+ * camera parameters when we go the next slice */
+static bool find_next_pano_slice(Render *re, int *slice, int *minx, rctf *viewplane)
{
RenderPart *pa, *best = NULL;
+ bool found = false;
*minx = re->winx;
+ if (!(re->r.mode & R_PANORAMA)) {
+ /* for regular render, just one 'slice' */
+ found = (*slice == 0);
+ (*slice)++;
+ return found;
+ }
+
/* most left part of the non-rendering parts */
for (pa = re->parts.first; pa; pa = pa->next) {
if (pa->status == PART_STATUS_NONE && pa->nr == 0) {
if (pa->disprect.xmin < *minx) {
+ found = true;
best = pa;
*minx = pa->disprect.xmin;
}
}
}
-
+
if (best) {
float phi = panorama_pixel_rot(re);
@@ -759,7 +774,10 @@ static RenderPart *find_next_pano_slice(Render *re, int *minx, rctf *viewplane)
R.panosi = sin(R.panodxp * phi);
R.panoco = cos(R.panodxp * phi);
}
- return best;
+
+ (*slice)++;
+
+ return found;
}
static RenderPart *find_next_part(Render *re, int minx)
@@ -814,26 +832,53 @@ static void print_part_stats(Render *re, RenderPart *pa)
re->i.infostr = NULL;
}
+typedef struct RenderThread {
+ ThreadQueue *workqueue;
+ ThreadQueue *donequeue;
+
+ int number;
+} RenderThread;
+
+static void *do_render_thread(void *thread_v)
+{
+ RenderThread *thread = thread_v;
+ RenderPart *pa;
+
+ while ((pa = BLI_thread_queue_pop(thread->workqueue))) {
+ pa->thread = thread->number;
+ do_part_thread(pa);
+ BLI_thread_queue_push(thread->donequeue, pa);
+
+ if(R.test_break(R.tbh))
+ break;
+ }
+
+ return NULL;
+}
+
static void threaded_tile_processor(Render *re)
{
+ RenderThread thread[BLENDER_MAX_THREADS];
+ ThreadQueue *workqueue, *donequeue;
ListBase threads;
- RenderPart *pa, *nextpa;
+ RenderPart *pa;
rctf viewplane = re->viewplane;
- int rendering = 1, counter = 1, drawtimer = 0, hasdrawn, minx = 0;
+ double lastdraw, elapsed, redrawtime = 1.0f;
+ int totpart = 0, minx = 0, slice = 0, a, wait;
BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
/* first step; free the entire render result, make new, and/or prepare exr buffer saving */
if (re->result == NULL || !(re->r.scemode & R_PREVIEWBUTS)) {
render_result_free(re->result);
-
+
if (re->sss_points && render_display_draw_enabled(re))
re->result = render_result_new(re, &re->disprect, 0, RR_USE_MEM, RR_ALL_LAYERS);
else if (re->r.scemode & R_FULL_SAMPLE)
re->result = render_result_new_full_sample(re, &re->fullresult, &re->disprect, 0, RR_USE_EXR);
else
re->result = render_result_new(re, &re->disprect, 0,
- (re->r.scemode & R_EXR_TILE_FILE) ? RR_USE_EXR : RR_USE_MEM, RR_ALL_LAYERS);
+ (re->r.scemode & R_EXR_TILE_FILE) ? RR_USE_EXR : RR_USE_MEM, RR_ALL_LAYERS);
}
BLI_rw_mutex_unlock(&re->resultmutex);
@@ -848,53 +893,46 @@ static void threaded_tile_processor(Render *re)
if (re->result->do_exr_tile)
render_result_exr_file_begin(re);
- BLI_init_threads(&threads, do_part_thread, re->r.threads);
-
/* assuming no new data gets added to dbase... */
R = *re;
/* set threadsafe break */
R.test_break = thread_break;
- /* timer loop demands to sleep when no parts are left, so we enter loop with a part */
- if (re->r.mode & R_PANORAMA)
- nextpa = find_next_pano_slice(re, &minx, &viewplane);
- else
- nextpa = find_next_part(re, 0);
-
- while (rendering) {
-
- if (re->test_break(re->tbh))
- PIL_sleep_ms(50);
- else if (nextpa && BLI_available_threads(&threads)) {
- drawtimer = 0;
- nextpa->nr = counter++; /* for nicest part, and for stats */
- nextpa->thread = BLI_available_thread_index(&threads); /* sample index */
- BLI_insert_thread(&threads, nextpa);
-
- nextpa = find_next_part(re, minx);
- }
- else if (re->r.mode & R_PANORAMA) {
- if (nextpa == NULL && BLI_available_threads(&threads) == re->r.threads)
- nextpa = find_next_pano_slice(re, &minx, &viewplane);
- else {
- PIL_sleep_ms(50);
- drawtimer++;
- }
+ /* create and fill work queue */
+ workqueue = BLI_thread_queue_init();
+ donequeue = BLI_thread_queue_init();
+
+ /* for panorama we loop over slices */
+ while (find_next_pano_slice(re, &slice, &minx, &viewplane)) {
+ /* gather parts into queue */
+ while ((pa = find_next_part(re, minx))) {
+ pa->nr = totpart + 1; /* for nicest part, and for stats */
+ totpart++;
+ BLI_thread_queue_push(workqueue, pa);
}
- else {
- PIL_sleep_ms(50);
- drawtimer++;
+
+ BLI_thread_queue_nowait(workqueue);
+
+ /* start all threads */
+ BLI_init_threads(&threads, do_render_thread, re->r.threads);
+
+ for (a = 0; a < re->r.threads; a++) {
+ thread[a].workqueue = workqueue;
+ thread[a].donequeue = donequeue;
+ thread[a].number = a;
+ BLI_insert_thread(&threads, &thread[a]);
}
- /* check for ready ones to display, and if we need to continue */
- rendering = 0;
- hasdrawn = 0;
- for (pa = re->parts.first; pa; pa = pa->next) {
- if (pa->status == PART_STATUS_READY) {
-
- BLI_remove_thread(&threads, pa);
-
+ /* wait for results to come back */
+ lastdraw = PIL_check_seconds_timer();
+
+ while (1) {
+ elapsed = PIL_check_seconds_timer() - lastdraw;
+ wait = (redrawtime - elapsed)*1000;
+
+ /* handle finished part */
+ if ((pa=BLI_thread_queue_pop_timeout(donequeue, wait))) {
if (pa->result) {
if (render_display_draw_enabled(re))
re->display_draw(re->ddh, pa->result, NULL);
@@ -904,27 +942,40 @@ static void threaded_tile_processor(Render *re)
pa->result = NULL;
re->i.partsdone++;
re->progress(re->prh, re->i.partsdone / (float)re->i.totpart);
- hasdrawn = 1;
}
+
+ totpart--;
}
- else {
- rendering = 1;
- if (pa->nr && pa->result && drawtimer > 20) {
- if (render_display_draw_enabled(re))
- re->display_draw(re->ddh, pa->result, &pa->result->renrect);
- hasdrawn = 1;
- }
+
+ /* check for render cancel */
+ if ((g_break=re->test_break(re->tbh)))
+ break;
+
+ /* or done with parts */
+ if (totpart == 0)
+ break;
+
+ /* redraw in progress parts */
+ elapsed = PIL_check_seconds_timer() - lastdraw;
+ if (elapsed > redrawtime) {
+ if (render_display_draw_enabled(re))
+ for (pa = re->parts.first; pa; pa = pa->next)
+ if ((pa->status == PART_STATUS_IN_PROGRESS) && pa->nr && pa->result)
+ re->display_draw(re->ddh, pa->result, &pa->result->renrect);
+
+ lastdraw = PIL_check_seconds_timer();
}
}
- if (hasdrawn)
- drawtimer = 0;
-
- /* on break, wait for all slots to get freed */
- if ( (g_break = re->test_break(re->tbh)) && BLI_available_threads(&threads) == re->r.threads)
- rendering = 0;
+ BLI_end_threads(&threads);
+
+ if ((g_break=re->test_break(re->tbh)))
+ break;
}
+ BLI_thread_queue_free(donequeue);
+ BLI_thread_queue_free(workqueue);
+
if (re->result->do_exr_tile) {
BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
render_result_exr_file_end(re);
@@ -934,7 +985,6 @@ static void threaded_tile_processor(Render *re)
/* unset threadsafety */
g_break = 0;
- BLI_end_threads(&threads);
RE_parts_free(re);
re->viewplane = viewplane; /* restore viewplane, modified by pano render */
}
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index de0da3df868..da0c6dd2a63 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -33,7 +33,7 @@
#include <string.h>
#ifdef WIN32
-# include <Windows.h>
+# include <windows.h>
#endif
#include "MEM_guardedalloc.h"
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 41dd618caa5..79257479529 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1260,6 +1260,15 @@ static void wm_block_redo_cb(bContext *C, void *arg_op, int UNUSED(arg_event))
}
}
+static void wm_block_redo_cancel_cb(bContext *C, void *arg_op)
+{
+ wmOperator *op = arg_op;
+
+ /* if operator never got executed, free it */
+ if (op != WM_operator_last_redo(C))
+ WM_operator_free(op);
+}
+
static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op)
{
wmOperator *op = arg_op;
@@ -1402,7 +1411,7 @@ static uiBlock *wm_operator_ui_create(bContext *C, ARegion *ar, void *userData)
return block;
}
-static void wm_operator_ui_popup_cancel(void *userData)
+static void wm_operator_ui_popup_cancel(struct bContext *UNUSED(C), void *userData)
{
wmOpPopUp *data = userData;
if (data->free_op && data->op) {
@@ -1452,7 +1461,7 @@ static int wm_operator_props_popup_ex(bContext *C, wmOperator *op, const int do_
if (!(U.uiflag & USER_GLOBALUNDO))
return WM_operator_props_dialog_popup(C, op, 15 * UI_UNIT_X, UI_UNIT_Y);
- uiPupBlock(C, wm_block_create_redo, op);
+ uiPupBlockEx(C, wm_block_create_redo, NULL, wm_block_redo_cancel_cb, op);
if (do_call)
wm_block_redo_cb(C, op, 0);
@@ -1681,18 +1690,26 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
split = uiLayoutSplit(layout, 0.0f, FALSE);
col = uiLayoutColumn(split, FALSE);
- uiItemL(col, "Links", ICON_NONE);
- uiItemStringO(col, IFACE_("Donations"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/blenderorg/blender-foundation/donation-payment");
- uiItemStringO(col, IFACE_("Credits"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/credits");
- uiItemStringO(col, IFACE_("Release Log"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/release-logs/blender-266");
- uiItemStringO(col, IFACE_("Manual"), ICON_URL, "WM_OT_url_open", "url", "http://wiki.blender.org/index.php/Doc:2.6/Manual");
+ uiItemL(col, IFACE_("Links"), ICON_NONE);
+ uiItemStringO(col, IFACE_("Donations"), ICON_URL, "WM_OT_url_open", "url",
+ "http://www.blender.org/blenderorg/blender-foundation/donation-payment");
+ uiItemStringO(col, IFACE_("Credits"), ICON_URL, "WM_OT_url_open", "url",
+ "http://www.blender.org/development/credits");
+ uiItemStringO(col, IFACE_("Release Log"), ICON_URL, "WM_OT_url_open", "url",
+ "http://www.blender.org/development/release-logs/blender-266");
+ uiItemStringO(col, IFACE_("Manual"), ICON_URL, "WM_OT_url_open", "url",
+ "http://wiki.blender.org/index.php/Doc:2.6/Manual");
uiItemStringO(col, IFACE_("Blender Website"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org");
- uiItemStringO(col, IFACE_("User Community"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/community/user-community");
+ uiItemStringO(col, IFACE_("User Community"), ICON_URL, "WM_OT_url_open", "url",
+ "http://www.blender.org/community/user-community");
if (strcmp(STRINGIFY(BLENDER_VERSION_CYCLE), "release") == 0) {
- BLI_snprintf(url, sizeof(url), "http://www.blender.org/documentation/blender_python_api_%d_%d" STRINGIFY(BLENDER_VERSION_CHAR) "_release", BLENDER_VERSION / 100, BLENDER_VERSION % 100);
+ BLI_snprintf(url, sizeof(url), "http://www.blender.org/documentation/blender_python_api_%d_%d"
+ STRINGIFY(BLENDER_VERSION_CHAR) "_release",
+ BLENDER_VERSION / 100, BLENDER_VERSION % 100);
}
else {
- BLI_snprintf(url, sizeof(url), "http://www.blender.org/documentation/blender_python_api_%d_%d_%d", BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION);
+ BLI_snprintf(url, sizeof(url), "http://www.blender.org/documentation/blender_python_api_%d_%d_%d",
+ BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION);
}
uiItemStringO(col, IFACE_("Python API Reference"), ICON_URL, "WM_OT_url_open", "url", url);
uiItemL(col, "", ICON_NONE);
@@ -2157,8 +2174,7 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
flag_all_listbases_ids(LIB_PRE_EXISTING, 0);
/* recreate dependency graph to include new objects */
- DAG_scene_sort(bmain, scene);
- DAG_ids_flush_update(bmain, 0);
+ DAG_scene_relations_rebuild(bmain, scene);
BLO_blendhandle_close(bh);
@@ -3383,6 +3399,11 @@ static void radial_control_paint_cursor(bContext *C, int x, int y, void *customd
break;
}
+ /* adjust for DPI, like BKE_brush_size_get */
+ r1 *= U.pixelsize;
+ r2 *= U.pixelsize;
+ tex_radius *= U.pixelsize;
+
/* Keep cursor in the original place */
x = rc->initial_mouse[0] - ar->winrct.xmin;
y = rc->initial_mouse[1] - ar->winrct.ymin;