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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-03-24 16:13:13 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-03-24 16:13:13 +0400
commit385c72f5f26ae9c86bf40c127c44216ceea0e6c1 (patch)
tree6c0432578abee5437adc94e96b5a91c593b866b4 /source
parent5841d1c8145ba50addeb17fa0231705d949d8b3d (diff)
parentb5ce1b1a23a3befbcc4cd3c67a5ec6a76d77aa5a (diff)
Merged changes in the trunk up to revision 55546.
Conflicts resolved: source/blenderplayer/bad_level_call_stubs/SConscript Partly reverted changes to intern/cycles/blender/addon/ui.py in revision 52899 to make it easier to merge trunk changes.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenfont/BLF_translation.h13
-rw-r--r--source/blender/blenfont/intern/blf.c1
-rw-r--r--source/blender/blenfont/intern/blf_lang.c6
-rw-r--r--source/blender/blenfont/intern/blf_translation.c37
-rw-r--r--source/blender/blenkernel/BKE_anim.h4
-rw-r--r--source/blender/blenkernel/BKE_blender.h2
-rw-r--r--source/blender/blenkernel/BKE_brush.h5
-rw-r--r--source/blender/blenkernel/BKE_camera.h2
-rw-r--r--source/blender/blenkernel/BKE_curve.h1
-rw-r--r--source/blender/blenkernel/BKE_customdata.h1
-rw-r--r--source/blender/blenkernel/BKE_deform.h13
-rw-r--r--source/blender/blenkernel/BKE_displist.h4
-rw-r--r--source/blender/blenkernel/BKE_idcode.h42
-rw-r--r--source/blender/blenkernel/BKE_idprop.h84
-rw-r--r--source/blender/blenkernel/BKE_mesh.h2
-rw-r--r--source/blender/blenkernel/BKE_movieclip.h6
-rw-r--r--source/blender/blenkernel/BKE_multires.h2
-rw-r--r--source/blender/blenkernel/BKE_nla.h4
-rw-r--r--source/blender/blenkernel/BKE_node.h7
-rw-r--r--source/blender/blenkernel/BKE_object.h10
-rw-r--r--source/blender/blenkernel/BKE_sequencer.h2
-rw-r--r--source/blender/blenkernel/intern/anim.c6
-rw-r--r--source/blender/blenkernel/intern/blender.c3
-rw-r--r--source/blender/blenkernel/intern/bpath.c4
-rw-r--r--source/blender/blenkernel/intern/brush.c18
-rw-r--r--source/blender/blenkernel/intern/camera.c2
-rw-r--r--source/blender/blenkernel/intern/constraint.c6
-rw-r--r--source/blender/blenkernel/intern/curve.c138
-rw-r--r--source/blender/blenkernel/intern/customdata.c8
-rw-r--r--source/blender/blenkernel/intern/deform.c10
-rw-r--r--source/blender/blenkernel/intern/displist.c12
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c27
-rw-r--r--source/blender/blenkernel/intern/fcurve.c22
-rw-r--r--source/blender/blenkernel/intern/idcode.c38
-rw-r--r--source/blender/blenkernel/intern/idprop.c107
-rw-r--r--source/blender/blenkernel/intern/image.c6
-rw-r--r--source/blender/blenkernel/intern/mesh.c2
-rw-r--r--source/blender/blenkernel/intern/modifier.c2
-rw-r--r--source/blender/blenkernel/intern/movieclip.c86
-rw-r--r--source/blender/blenkernel/intern/multires.c2
-rw-r--r--source/blender/blenkernel/intern/node.c152
-rw-r--r--source/blender/blenkernel/intern/object.c38
-rw-r--r--source/blender/blenkernel/intern/particle.c14
-rw-r--r--source/blender/blenkernel/intern/smoke.c40
-rw-r--r--source/blender/blenkernel/intern/writeavi.c2
-rw-r--r--source/blender/blenkernel/nla_private.h4
-rw-r--r--source/blender/blenlib/BLI_callbacks.h2
-rw-r--r--source/blender/blenlib/BLI_gsqueue.h50
-rw-r--r--source/blender/blenlib/BLI_math_geom.h4
-rw-r--r--source/blender/blenlib/BLI_path_util.h12
-rw-r--r--source/blender/blenlib/BLI_rect.h2
-rw-r--r--source/blender/blenlib/BLI_vfontdata.h8
-rw-r--r--source/blender/blenlib/intern/fileops.c4
-rw-r--r--source/blender/blenlib/intern/freetypefont.c9
-rw-r--r--source/blender/blenlib/intern/gsqueue.c46
-rw-r--r--source/blender/blenlib/intern/math_geom.c4
-rw-r--r--source/blender/blenlib/intern/path_util.c31
-rw-r--r--source/blender/blenlib/intern/rct.c13
-rw-r--r--source/blender/blenlib/intern/voronoi.c2
-rw-r--r--source/blender/blenloader/intern/readfile.c61
-rw-r--r--source/blender/blenloader/intern/writefile.c179
-rw-r--r--source/blender/bmesh/operators/bmo_utils.c1
-rw-r--r--source/blender/collada/ArmatureExporter.cpp2
-rw-r--r--source/blender/collada/collada_internal.cpp2
-rw-r--r--source/blender/compositor/CMakeLists.txt2
-rw-r--r--source/blender/compositor/intern/COM_Converter.cpp1
-rw-r--r--source/blender/compositor/intern/COM_ExecutionGroup.cpp10
-rw-r--r--source/blender/compositor/intern/COM_ExecutionGroup.h2
-rw-r--r--source/blender/compositor/intern/COM_ExecutionSystem.cpp10
-rw-r--r--source/blender/compositor/intern/COM_NodeOperation.h3
-rw-r--r--source/blender/compositor/intern/COM_compositor.cpp4
-rw-r--r--source/blender/compositor/nodes/COM_CompositorNode.cpp5
-rw-r--r--source/blender/compositor/nodes/COM_MovieClipNode.cpp21
-rw-r--r--source/blender/compositor/nodes/COM_RenderLayersNode.cpp2
-rw-r--r--source/blender/compositor/nodes/COM_SocketProxyNode.h4
-rw-r--r--source/blender/compositor/nodes/COM_SplitViewerNode.cpp12
-rw-r--r--source/blender/compositor/nodes/COM_ViewerNode.cpp9
-rw-r--r--source/blender/compositor/operations/COM_CompositorOperation.cpp53
-rw-r--r--source/blender/compositor/operations/COM_CompositorOperation.h13
-rw-r--r--source/blender/compositor/operations/COM_CropOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp26
-rw-r--r--source/blender/compositor/operations/COM_MovieClipOperation.cpp30
-rw-r--r--source/blender/compositor/operations/COM_MovieClipOperation.h19
-rw-r--r--source/blender/compositor/operations/COM_OpenCLKernels.cl2
-rw-r--r--source/blender/compositor/operations/COM_OutputFileOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp24
-rw-r--r--source/blender/compositor/operations/COM_RenderLayersBaseProg.h8
-rw-r--r--source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp2
-rw-r--r--source/blender/editors/animation/anim_markers.c6
-rw-r--r--source/blender/editors/armature/armature_select.c6
-rw-r--r--source/blender/editors/armature/pose_select.c14
-rw-r--r--source/blender/editors/armature/pose_transform.c2
-rw-r--r--source/blender/editors/curve/editcurve.c195
-rw-r--r--source/blender/editors/gpencil/drawgpencil.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_buttons.c4
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c63
-rw-r--r--source/blender/editors/include/ED_anim_api.h4
-rw-r--r--source/blender/editors/include/ED_armature.h4
-rw-r--r--source/blender/editors/include/ED_curve.h3
-rw-r--r--source/blender/editors/include/ED_gpencil.h2
-rw-r--r--source/blender/editors/include/ED_mball.h2
-rw-r--r--source/blender/editors/include/ED_mesh.h58
-rw-r--r--source/blender/editors/include/ED_object.h9
-rw-r--r--source/blender/editors/include/ED_particle.h6
-rw-r--r--source/blender/editors/include/ED_transform.h6
-rw-r--r--source/blender/editors/include/ED_view3d.h38
-rw-r--r--source/blender/editors/include/UI_icons.h6
-rw-r--r--source/blender/editors/include/UI_interface.h9
-rw-r--r--source/blender/editors/include/UI_resources.h2
-rw-r--r--source/blender/editors/include/UI_view2d.h16
-rw-r--r--source/blender/editors/interface/interface.c37
-rw-r--r--source/blender/editors/interface/interface_handlers.c17
-rw-r--r--source/blender/editors/interface/interface_intern.h6
-rw-r--r--source/blender/editors/interface/interface_layout.c10
-rw-r--r--source/blender/editors/interface/interface_panel.c14
-rw-r--r--source/blender/editors/interface/interface_utils.c2
-rw-r--r--source/blender/editors/interface/interface_widgets.c9
-rw-r--r--source/blender/editors/interface/view2d.c7
-rw-r--r--source/blender/editors/io/io_collada.c2
-rw-r--r--source/blender/editors/io/io_ops.c2
-rw-r--r--source/blender/editors/mask/mask_select.c8
-rw-r--r--source/blender/editors/mesh/editface.c50
-rw-r--r--source/blender/editors/mesh/editmesh_add.c48
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c86
-rw-r--r--source/blender/editors/mesh/editmesh_knife_project.c8
-rw-r--r--source/blender/editors/mesh/editmesh_loopcut.c40
-rw-r--r--source/blender/editors/mesh/editmesh_rip.c64
-rw-r--r--source/blender/editors/mesh/editmesh_select.c369
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c656
-rw-r--r--source/blender/editors/mesh/editmesh_utils.c88
-rw-r--r--source/blender/editors/mesh/mesh_data.c153
-rw-r--r--source/blender/editors/mesh/mesh_intern.h16
-rw-r--r--source/blender/editors/mesh/mesh_navmesh.c16
-rw-r--r--source/blender/editors/mesh/mesh_ops.c76
-rw-r--r--source/blender/editors/mesh/meshtools.c52
-rw-r--r--source/blender/editors/metaball/mball_edit.c6
-rw-r--r--source/blender/editors/object/object_add.c34
-rw-r--r--source/blender/editors/object/object_bake.c6
-rw-r--r--source/blender/editors/object/object_edit.c64
-rw-r--r--source/blender/editors/object/object_intern.h4
-rw-r--r--source/blender/editors/object/object_lattice.c6
-rw-r--r--source/blender/editors/object/object_modifier.c2
-rw-r--r--source/blender/editors/object/object_relations.c10
-rw-r--r--source/blender/editors/object/object_select.c20
-rw-r--r--source/blender/editors/physics/dynamicpaint_ops.c5
-rw-r--r--source/blender/editors/physics/particle_edit.c6
-rw-r--r--source/blender/editors/render/render_internal.c2
-rw-r--r--source/blender/editors/render/render_ops.c6
-rw-r--r--source/blender/editors/render/render_preview.c12
-rw-r--r--source/blender/editors/screen/screen_edit.c2
-rw-r--r--source/blender/editors/screen/screen_ops.c2
-rw-r--r--source/blender/editors/screen/screendump.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_2d.c6
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c8
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c2
-rw-r--r--source/blender/editors/sound/sound_ops.c2
-rw-r--r--source/blender/editors/space_action/action_intern.h16
-rw-r--r--source/blender/editors/space_buttons/buttons_texture.c6
-rw-r--r--source/blender/editors/space_clip/clip_draw.c17
-rw-r--r--source/blender/editors/space_clip/clip_editor.c391
-rw-r--r--source/blender/editors/space_clip/clip_intern.h3
-rw-r--r--source/blender/editors/space_clip/clip_ops.c5
-rw-r--r--source/blender/editors/space_clip/space_clip.c25
-rw-r--r--source/blender/editors/space_console/console_intern.h4
-rw-r--r--source/blender/editors/space_console/console_ops.c14
-rw-r--r--source/blender/editors/space_file/file_panels.c8
-rw-r--r--source/blender/editors/space_graph/graph_draw.c112
-rw-r--r--source/blender/editors/space_graph/graph_intern.h16
-rw-r--r--source/blender/editors/space_image/image_ops.c10
-rw-r--r--source/blender/editors/space_nla/nla_intern.h8
-rw-r--r--source/blender/editors/space_node/drawnode.c101
-rw-r--r--source/blender/editors/space_node/node_add.c3
-rw-r--r--source/blender/editors/space_node/node_buttons.c4
-rw-r--r--source/blender/editors/space_node/node_draw.c34
-rw-r--r--source/blender/editors/space_node/node_edit.c78
-rw-r--r--source/blender/editors/space_node/node_group.c43
-rw-r--r--source/blender/editors/space_node/node_intern.h5
-rw-r--r--source/blender/editors/space_node/node_templates.c2
-rw-r--r--source/blender/editors/space_node/space_node.c2
-rw-r--r--source/blender/editors/space_outliner/outliner_select.c4
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_select.c10
-rw-r--r--source/blender/editors/space_text/space_text.c5
-rw-r--r--source/blender/editors/space_text/text_format_lua.c2
-rw-r--r--source/blender/editors/space_text/text_format_osl.c2
-rw-r--r--source/blender/editors/space_text/text_format_py.c2
-rw-r--r--source/blender/editors/space_view3d/drawarmature.c47
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c30
-rw-r--r--source/blender/editors/space_view3d/drawobject.c278
-rw-r--r--source/blender/editors/space_view3d/drawvolume.c2
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c10
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c12
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c119
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c152
-rw-r--r--source/blender/editors/space_view3d/view3d_fly.c163
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c8
-rw-r--r--source/blender/editors/space_view3d/view3d_intern.h16
-rw-r--r--source/blender/editors/space_view3d/view3d_project.c34
-rw-r--r--source/blender/editors/space_view3d/view3d_ruler.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c258
-rw-r--r--source/blender/editors/space_view3d/view3d_snap.c8
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c56
-rw-r--r--source/blender/editors/transform/transform_conversions.c6
-rw-r--r--source/blender/editors/transform/transform_orientations.c2
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c14
-rw-r--r--source/blender/editors/uvedit/uvedit_unwrap_ops.c2
-rw-r--r--source/blender/gpu/GPU_draw.h4
-rw-r--r--source/blender/gpu/intern/gpu_draw.c8
-rw-r--r--source/blender/gpu/intern/gpu_material.c3
-rw-r--r--source/blender/gpu/intern/gpu_simple_shader.c2
-rw-r--r--source/blender/imbuf/IMB_moviecache.h2
-rw-r--r--source/blender/imbuf/intern/cineon/cineon_dpx.c22
-rw-r--r--source/blender/imbuf/intern/cineon/cineonlib.c44
-rw-r--r--source/blender/imbuf/intern/cineon/dpxlib.c50
-rw-r--r--source/blender/imbuf/intern/cineon/logImageCore.c40
-rw-r--r--source/blender/imbuf/intern/moviecache.c46
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_api.cpp18
-rw-r--r--source/blender/imbuf/intern/rectop.c3
-rw-r--r--source/blender/imbuf/intern/scaling.c2
-rw-r--r--source/blender/makesdna/DNA_movieclip_types.h5
-rw-r--r--source/blender/makesdna/DNA_node_types.h5
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h9
-rw-r--r--source/blender/makesrna/intern/rna_access.c5
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c6
-rw-r--r--source/blender/makesrna/intern/rna_curve.c2
-rw-r--r--source/blender/makesrna/intern/rna_define.c7
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c51
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c15
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c112
-rw-r--r--source/blender/makesrna/intern/rna_object_api.c14
-rw-r--r--source/blender/makesrna/intern/rna_rna.c8
-rw-r--r--source/blender/makesrna/intern/rna_scene.c7
-rw-r--r--source/blender/makesrna/intern/rna_ui.c13
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c19
-rw-r--r--source/blender/modifiers/intern/MOD_boolean_util.c10
-rw-r--r--source/blender/modifiers/intern/MOD_cloth.c1
-rw-r--r--source/blender/modifiers/intern/MOD_mirror.c8
-rw-r--r--source/blender/modifiers/intern/MOD_ocean.c2
-rw-r--r--source/blender/nodes/composite/node_composite_tree.c5
-rw-r--r--source/blender/nodes/composite/node_composite_util.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_image.c22
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_movieclip.c1
-rw-r--r--source/blender/nodes/intern/node_exec.c4
-rw-r--r--source/blender/nodes/shader/node_shader_tree.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_mix_shader.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_value.c2
-rw-r--r--source/blender/nodes/texture/node_texture_tree.c19
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_meshdata.c2
-rw-r--r--source/blender/python/intern/bpy.c2
-rw-r--r--source/blender/python/intern/bpy_app.c3
-rw-r--r--source/blender/python/intern/bpy_app_translations.c61
-rw-r--r--source/blender/python/intern/bpy_operator_wrap.c7
-rw-r--r--source/blender/python/intern/bpy_rna.c8
-rw-r--r--source/blender/python/intern/bpy_rna.h2
-rw-r--r--source/blender/python/intern/gpu.c2
-rw-r--r--source/blender/render/CMakeLists.txt2
-rw-r--r--source/blender/render/extern/include/RE_engine.h2
-rw-r--r--source/blender/render/intern/source/external_engine.c2
-rw-r--r--source/blender/render/intern/source/pipeline.c2
-rw-r--r--source/blender/render/intern/source/render_result.c2
-rw-r--r--source/blender/windowmanager/WM_api.h6
-rw-r--r--source/blender/windowmanager/intern/wm_cursors.c4
-rw-r--r--source/blender/windowmanager/intern/wm_files.c4
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c2
-rw-r--r--source/blender/windowmanager/intern/wm_jobs.c13
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c6
-rw-r--r--source/blenderplayer/bad_level_call_stubs/CMakeLists.txt1
-rw-r--r--source/blenderplayer/bad_level_call_stubs/SConscript23
-rw-r--r--source/blenderplayer/bad_level_call_stubs/stubs.c12
-rw-r--r--source/creator/CMakeLists.txt2
-rw-r--r--source/creator/creator.c7
-rw-r--r--source/gameengine/Converter/BL_BlenderDataConversion.cpp142
-rw-r--r--source/gameengine/Converter/BL_ModifierDeformer.cpp4
-rw-r--r--source/gameengine/Expressions/Value.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_CameraActuator.cpp3
-rw-r--r--source/gameengine/Ketsji/KX_KetsjiEngine.cpp26
-rw-r--r--source/gameengine/Ketsji/KX_KetsjiEngine.h2
-rw-r--r--source/gameengine/Ketsji/KX_NavMeshObject.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_ObjectActuator.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp10
-rw-r--r--source/gameengine/Ketsji/KX_Scene.cpp5
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp2
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.cpp2
284 files changed, 4371 insertions, 2980 deletions
diff --git a/source/blender/blenfont/BLF_translation.h b/source/blender/blenfont/BLF_translation.h
index 19746f7d5b4..dc72c77b3bf 100644
--- a/source/blender/blenfont/BLF_translation.h
+++ b/source/blender/blenfont/BLF_translation.h
@@ -71,13 +71,16 @@ void BLF_free_unifont(void);
unsigned char *BLF_get_unifont_mono(int *unifont_size);
void BLF_free_unifont_mono(void);
+bool BLF_is_default_context(const char *msgctxt);
const char *BLF_pgettext(const char *msgctxt, const char *msgid);
/* translation */
bool BLF_translate_iface(void);
bool BLF_translate_tooltips(void);
+bool BLF_translate_new_dataname(void);
const char *BLF_translate_do_iface(const char *msgctxt, const char *msgid);
const char *BLF_translate_do_tooltip(const char *msgctxt, const char *msgid);
+const char *BLF_translate_do_new_dataname(const char *msgctxt, const char *msgid);
/* The "translation-marker" macro. */
@@ -89,19 +92,23 @@ const char *BLF_translate_do_tooltip(const char *msgctxt, const char *msgid);
/*# define _(msgid) BLF_gettext(msgid) */
# define IFACE_(msgid) BLF_translate_do_iface(NULL, msgid)
# define TIP_(msgid) BLF_translate_do_tooltip(NULL, msgid)
+# define DATA_(msgid) BLF_translate_do_new_dataname(NULL, msgid)
# define CTX_IFACE_(context, msgid) BLF_translate_do_iface(context, msgid)
# define CTX_TIP_(context, msgid) BLF_translate_do_tooltip(context, msgid)
+# define CTX_DATA_(context, msgid) BLF_translate_do_new_dataname(context, msgid)
#else
/*# define _(msgid) msgid */
# define IFACE_(msgid) msgid
# define TIP_(msgid) msgid
+# define DATA_(msgid) msgid
# define CTX_IFACE_(context, msgid) msgid
# define CTX_TIP_(context, msgid) msgid
+# define CTX_DATA_(context, msgid) msgid
#endif
/* Helper macro, when we want to define a same msgid for multiple msgctxt...
* Does nothing in C, but is "parsed" by our i18n py tools.
- * XXX Currently limited to at most 16 contexts at most
+ * XXX Currently limited to at most 16 contexts at once
* (but you can call it several times with the same msgid, should you need more contexts!).
*/
#define BLF_I18N_MSGID_MULTI_CTXT(msgid, ...)
@@ -122,7 +129,7 @@ const char *BLF_translate_do_tooltip(const char *msgctxt, const char *msgid);
* with the same char!
*/
#define BLF_I18NCONTEXT_DEFAULT NULL
-#define BLF_I18NCONTEXT_DEFAULT_BPY "*"
+#define BLF_I18NCONTEXT_DEFAULT_BPYRNA "*"
/* Default context for operator names/labels. */
#define BLF_I18NCONTEXT_OPERATOR_DEFAULT "Operator"
@@ -175,7 +182,7 @@ typedef struct
#define BLF_I18NCONTEXTS_DESC { \
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_DEFAULT, "default_real"), \
- BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_DEFAULT_BPY, "default"), \
+ BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_DEFAULT_BPYRNA, "default"), \
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "operator_default"), \
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_ACTION, "id_action"), \
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_ARMATURE, "id_armature"), \
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index e7e277b7b34..6523aa87473 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -619,6 +619,7 @@ void BLF_width_and_height_default(const char *str, float *width, float *height)
return;
}
+ BLF_size(global_font_default, global_font_points, global_font_dpi);
BLF_width_and_height(global_font_default, str, width, height);
}
diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c
index d1c037b0358..65abfc52ee5 100644
--- a/source/blender/blenfont/intern/blf_lang.c
+++ b/source/blender/blenfont/intern/blf_lang.c
@@ -207,8 +207,10 @@ void BLF_lang_free(void)
#endif
}
-#define ULANGUAGE ((U.language >= 0 && U.language < num_locales) ? U.language : 0)
-#define LOCALE(_id) (locales ? locales[(_id)] : "")
+#ifdef WITH_INTERNATIONAL
+# define ULANGUAGE ((U.language >= 0 && U.language < num_locales) ? U.language : 0)
+# define LOCALE(_id) (locales ? locales[(_id)] : "")
+#endif
void BLF_lang_set(const char *str)
{
diff --git a/source/blender/blenfont/intern/blf_translation.c b/source/blender/blenfont/intern/blf_translation.c
index 4e9408c512a..57f442f8bfc 100644
--- a/source/blender/blenfont/intern/blf_translation.c
+++ b/source/blender/blenfont/intern/blf_translation.c
@@ -125,15 +125,22 @@ void BLF_free_unifont_mono(void)
#endif
}
+bool BLF_is_default_context(const char *msgctxt)
+{
+ /* We use the "short" test, a more complete one could be:
+ * return (!msgctxt || !msgctxt[0] || !strcmp(msgctxt == BLF_I18NCONTEXT_DEFAULT_BPYRNA))
+ */
+ /* Note: trying without the void string check for now, it *should* not be necessary... */
+ return (!msgctxt || msgctxt[0] == BLF_I18NCONTEXT_DEFAULT_BPYRNA[0]);
+}
+
const char *BLF_pgettext(const char *msgctxt, const char *msgid)
{
#ifdef WITH_INTERNATIONAL
const char *ret = msgid;
if (msgid && msgid[0]) {
- /*if (msgctxt && !strcmp(msgctxt, BLF_I18NCONTEXT_DEFAULT_BPY_INTERN)) { */
- if (msgctxt && (!msgctxt[0] || msgctxt[0] == BLF_I18NCONTEXT_DEFAULT_BPY[0])) {
- /* BLF_I18NCONTEXT_DEFAULT_BPY context is reserved and considered the same as default NULL one. */
+ if (BLF_is_default_context(msgctxt)) {
msgctxt = BLF_I18NCONTEXT_DEFAULT;
}
ret = bl_locale_pgettext(msgctxt, msgid);
@@ -170,6 +177,15 @@ bool BLF_translate_tooltips(void)
#endif
}
+bool BLF_translate_new_dataname(void)
+{
+#ifdef WITH_INTERNATIONAL
+ return (U.transopts & USER_DOTRANSLATE) && (U.transopts & USER_TR_NEWDATANAME);
+#else
+ return false;
+#endif
+}
+
const char *BLF_translate_do_iface(const char *msgctxt, const char *msgid)
{
#ifdef WITH_INTERNATIONAL
@@ -199,3 +215,18 @@ const char *BLF_translate_do_tooltip(const char *msgctxt, const char *msgid)
return msgid;
#endif
}
+
+const char *BLF_translate_do_new_dataname(const char *msgctxt, const char *msgid)
+{
+#ifdef WITH_INTERNATIONAL
+ if (BLF_translate_new_dataname()) {
+ return BLF_pgettext(msgctxt, msgid);
+ }
+ else {
+ return msgid;
+ }
+#else
+ (void)msgctxt;
+ return msgid;
+#endif
+}
diff --git a/source/blender/blenkernel/BKE_anim.h b/source/blender/blenkernel/BKE_anim.h
index 11537964e32..539c5780cd5 100644
--- a/source/blender/blenkernel/BKE_anim.h
+++ b/source/blender/blenkernel/BKE_anim.h
@@ -65,8 +65,8 @@ int where_on_path(struct Object *ob, float ctime, float vec[4], float dir[3], fl
/* ---------------------------------------------------- */
/* Dupli-Geometry */
-struct ListBase *object_duplilist_ex(struct Scene *sce, struct Object *ob, int update, int for_render);
-struct ListBase *object_duplilist(struct Scene *sce, struct Object *ob, int for_render);
+struct ListBase *object_duplilist_ex(struct Scene *sce, struct Object *ob, bool update, bool for_render);
+struct ListBase *object_duplilist(struct Scene *sce, struct Object *ob, bool for_render);
void free_object_duplilist(struct ListBase *lb);
int count_duplilist(struct Object *ob);
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index d03c631f7a1..c6b02bc8361 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -42,7 +42,7 @@ extern "C" {
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 266
-#define BLENDER_SUBVERSION 2
+#define BLENDER_SUBVERSION 3
/* 262 was the last editmesh release but it has compatibility code for bmesh data */
#define BLENDER_MINVERSION 262
diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h
index 4dfc70db952..e0afb1929a5 100644
--- a/source/blender/blenkernel/BKE_brush.h
+++ b/source/blender/blenkernel/BKE_brush.h
@@ -42,6 +42,11 @@ struct Scene;
struct wmOperator;
// enum CurveMappingPreset;
+
+/* globals for brush execution */
+void BKE_brush_system_init(void);
+void BKE_brush_system_exit(void);
+
/* datablock functions */
struct Brush *BKE_brush_add(struct Main *bmain, const char *name);
struct Brush *BKE_brush_copy(struct Brush *brush);
diff --git a/source/blender/blenkernel/BKE_camera.h b/source/blender/blenkernel/BKE_camera.h
index 057cd79b9e4..a07558cc8af 100644
--- a/source/blender/blenkernel/BKE_camera.h
+++ b/source/blender/blenkernel/BKE_camera.h
@@ -112,7 +112,7 @@ void BKE_camera_params_compute_matrix(CameraParams *params);
/* Camera View Frame */
-void BKE_camera_view_frame_ex(struct Scene *scene, struct Camera *camera, float drawsize, const short do_clip, const float scale[3],
+void BKE_camera_view_frame_ex(struct Scene *scene, struct Camera *camera, float drawsize, const bool do_clip, const float scale[3],
float r_asp[2], float r_shift[2], float *r_drawsize, float r_vec[4][3]);
void BKE_camera_view_frame(struct Scene *scene, struct Camera *camera, float r_vec[4][3]);
diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h
index 88d9cbb9b35..6e298a6d4f6 100644
--- a/source/blender/blenkernel/BKE_curve.h
+++ b/source/blender/blenkernel/BKE_curve.h
@@ -124,6 +124,7 @@ bool BKE_nurb_order_clamp_u(struct Nurb *nu);
bool BKE_nurb_order_clamp_v(struct Nurb *nu);
void BKE_nurb_direction_switch(struct Nurb *nu);
+bool BKE_nurb_type_convert(struct Nurb *nu, const short type, const bool use_handles);
void BKE_nurb_points_add(struct Nurb *nu, int number);
void BKE_nurb_bezierPoints_add(struct Nurb *nu, int number);
diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h
index 36733d1ced0..a51de2d4ae1 100644
--- a/source/blender/blenkernel/BKE_customdata.h
+++ b/source/blender/blenkernel/BKE_customdata.h
@@ -259,6 +259,7 @@ int CustomData_get_active_layer_index(const struct CustomData *data, int type);
int CustomData_get_render_layer_index(const struct CustomData *data, int type);
int CustomData_get_clone_layer_index(const struct CustomData *data, int type);
int CustomData_get_stencil_layer_index(const struct CustomData *data, int type);
+int CustomData_get_named_layer(const struct CustomData *data, int type, const char *name);
int CustomData_get_active_layer(const struct CustomData *data, int type);
int CustomData_get_render_layer(const struct CustomData *data, int type);
int CustomData_get_clone_layer(const struct CustomData *data, int type);
diff --git a/source/blender/blenkernel/BKE_deform.h b/source/blender/blenkernel/BKE_deform.h
index b209e8bf667..b18bb5a87b6 100644
--- a/source/blender/blenkernel/BKE_deform.h
+++ b/source/blender/blenkernel/BKE_deform.h
@@ -43,9 +43,9 @@ struct MDeformVert;
void defgroup_copy_list(struct ListBase *lb1, struct ListBase *lb2);
struct bDeformGroup *defgroup_duplicate(struct bDeformGroup *ingroup);
struct bDeformGroup *defgroup_find_name(struct Object *ob, const char *name);
-int *defgroup_flip_map(struct Object *ob, int *flip_map_len, int use_default);
-int *defgroup_flip_map_single(struct Object *ob, int *flip_map_len, int use_default, int defgroup);
-int defgroup_flip_index(struct Object *ob, int index, int use_default);
+int *defgroup_flip_map(struct Object *ob, int *flip_map_len, const bool use_default);
+int *defgroup_flip_map_single(struct Object *ob, int *flip_map_len, const bool use_default, int defgroup);
+int defgroup_flip_index(struct Object *ob, int index, const bool use_default);
int defgroup_name_index(struct Object *ob, const char *name);
void defgroup_unique_name(struct bDeformGroup *dg, struct Object *ob);
@@ -66,9 +66,9 @@ float defvert_array_find_weight_safe(const struct MDeformVert *dvert, const int
void defvert_copy(struct MDeformVert *dvert_dst, const struct MDeformVert *dvert_src);
void defvert_copy_index(struct MDeformVert *dvert_dst, const struct MDeformVert *dvert_src, const int defgroup);
-void defvert_sync(struct MDeformVert *dvert_dst, const struct MDeformVert *dvert_src, int use_verify);
+void defvert_sync(struct MDeformVert *dvert_dst, const struct MDeformVert *dvert_src, const bool use_verify);
void defvert_sync_mapped(struct MDeformVert *dvert_dst, const struct MDeformVert *dvert_src,
- const int *flip_map, const int flip_map_len, const int use_verify);
+ const int *flip_map, const int flip_map_len, const bool use_verify);
void defvert_remap(struct MDeformVert *dvert, int *map, const int map_len);
void defvert_flip(struct MDeformVert *dvert, const int *flip_map, const int flip_map_len);
void defvert_flip_merged(struct MDeformVert *dvert, const int *flip_map, const int flip_map_len);
@@ -84,5 +84,4 @@ void BKE_deform_split_prefix(const char string[MAX_VGROUP_NAME], char base[MAX_V
void flip_side_name(char name[MAX_VGROUP_NAME], const char from_name[MAX_VGROUP_NAME], int strip_number);
-#endif
-
+#endif /* __BKE_DEFORM_H__ */
diff --git a/source/blender/blenkernel/BKE_displist.h b/source/blender/blenkernel/BKE_displist.h
index 6b986cdceda..10c31189d02 100644
--- a/source/blender/blenkernel/BKE_displist.h
+++ b/source/blender/blenkernel/BKE_displist.h
@@ -85,7 +85,7 @@ DispList *BKE_displist_find(struct ListBase *lb, int type);
void BKE_displist_normals_add(struct ListBase *lb);
void BKE_displist_count(struct ListBase *lb, int *totvert, int *totface, int *tottri);
void BKE_displist_free(struct ListBase *lb);
-int BKE_displist_has_faces(struct ListBase *lb);
+bool BKE_displist_has_faces(struct ListBase *lb);
void BKE_displist_make_surf(struct Scene *scene, struct Object *ob, struct ListBase *dispbase, struct DerivedMesh **derivedFinal, int forRender, int forOrco);
void BKE_displist_make_curveTypes(struct Scene *scene, struct Object *ob, int forOrco);
@@ -94,7 +94,7 @@ void BKE_displist_make_curveTypes_forOrco(struct Scene *scene, struct Object *ob
void BKE_displist_make_mball(struct Scene *scene, struct Object *ob);
void BKE_displist_make_mball_forRender(struct Scene *scene, struct Object *ob, struct ListBase *dispbase);
-int BKE_displist_surfindex_get(DispList *dl, int a, int *b, int *p1, int *p2, int *p3, int *p4);
+bool BKE_displist_surfindex_get(DispList *dl, int a, int *b, int *p1, int *p2, int *p3, int *p4);
void BKE_displist_fill(struct ListBase *dispbase, struct ListBase *to, int flipnormal);
float BKE_displist_calc_taper(struct Scene *scene, struct Object *taperobj, int cur, int tot);
diff --git a/source/blender/blenkernel/BKE_idcode.h b/source/blender/blenkernel/BKE_idcode.h
index 74dc8de753e..10a34838662 100644
--- a/source/blender/blenkernel/BKE_idcode.h
+++ b/source/blender/blenkernel/BKE_idcode.h
@@ -32,47 +32,11 @@
* \ingroup bke
*/
-/**
- * Convert an idcode into a name.
- *
- * \param code The code to convert.
- * \return A static string representing the name of
- * the code.
- */
const char *BKE_idcode_to_name(int code);
-
-/**
- * Convert an idcode into a name (plural).
- *
- * \param code The code to convert.
- * \return A static string representing the name of
- * the code.
- */
const char *BKE_idcode_to_name_plural(int code);
-
-/**
- * Convert a name into an idcode (ie. ID_SCE)
- *
- * \param name The name to convert.
- * \return The code for the name, or 0 if invalid.
- */
-int BKE_idcode_from_name(const char *name);
-
-/**
- * Return non-zero when an ID type is linkable.
- *
- * \param code The code to check.
- * \return Boolean, 0 when non linkable.
- */
-bool BKE_idcode_is_linkable(int code);
-
-/**
- * Return if the ID code is a valid ID code.
- *
- * \param code The code to check.
- * \return Boolean, 0 when invalid.
- */
-bool BKE_idcode_is_valid(int code);
+int BKE_idcode_from_name(const char *name);
+bool BKE_idcode_is_linkable(int code);
+bool BKE_idcode_is_valid(int code);
/**
* Return an ID code and steps the index forward 1.
diff --git a/source/blender/blenkernel/BKE_idprop.h b/source/blender/blenkernel/BKE_idprop.h
index ad3e4bb2251..d8ad3b2e892 100644
--- a/source/blender/blenkernel/BKE_idprop.h
+++ b/source/blender/blenkernel/BKE_idprop.h
@@ -58,8 +58,6 @@ typedef union IDPropertyTemplate {
/* ----------- Property Array Type ---------- */
-/* note: as a start to move away from the stupid IDP_New function, this type
- * has it's own allocation function.*/
IDProperty *IDP_NewIDPArray(const char *name)
#ifdef __GNUC__
__attribute__((warn_unused_result))
@@ -136,18 +134,11 @@ __attribute__((nonnull))
#endif
;
-/**
- * replaces all properties with the same name in a destination group from a source group.
- */
void IDP_ReplaceGroupInGroup(struct IDProperty *dest, struct IDProperty *src)
#ifdef __GNUC__
__attribute__((nonnull))
#endif
;
-
-/**
- * Checks if a property with the same name as prop exists, and if so replaces it.
- * Use this to preserve order!*/
void IDP_ReplaceInGroup(struct IDProperty *group, struct IDProperty *prop)
#ifdef __GNUC__
__attribute__((nonnull))
@@ -160,42 +151,17 @@ __attribute__((nonnull))
#endif
;
-/**
- * This function has a sanity check to make sure ID properties with the same name don't
- * get added to the group.
- *
- * The sanity check just means the property is not added to the group if another property
- * exists with the same name; the client code using ID properties then needs to detect this
- * (the function that adds new properties to groups, IDP_AddToGroup, returns 0 if a property can't
- * be added to the group, and 1 if it can) and free the property.
- *
- * Currently the code to free ID properties is designed to leave the actual struct
- * you pass it un-freed, this is needed for how the system works. This means
- * to free an ID property, you first call IDP_FreeProperty then MEM_freeN the
- * struct. In the future this will just be IDP_FreeProperty and the code will
- * be reorganized to work properly.
- */
int IDP_AddToGroup(struct IDProperty *group, struct IDProperty *prop)
#ifdef __GNUC__
__attribute__((nonnull))
#endif
;
-
-/** this is the same as IDP_AddToGroup, only you pass an item
- * in the group list to be inserted after. */
int IDP_InsertToGroup(struct IDProperty *group, struct IDProperty *previous,
struct IDProperty *pnew)
#ifdef __GNUC__
__attribute__((nonnull (1, 3))) /* 'group', 'pnew' */
#endif
;
-
-/** \note this does not free the property!!
- *
- * To free the property, you have to do:
- * IDP_FreeProperty(prop); //free all subdata
- * MEM_freeN(prop); //free property struct itself
- */
void IDP_RemFromGroup(struct IDProperty *group, struct IDProperty *prop)
#ifdef __GNUC__
__attribute__((nonnull))
@@ -208,41 +174,23 @@ __attribute__((warn_unused_result))
__attribute__((nonnull))
#endif
;
-/** same as above but ensure type match */
IDProperty *IDP_GetPropertyTypeFromGroup(struct IDProperty *prop, const char *name, const char type)
#ifdef __GNUC__
__attribute__((warn_unused_result))
__attribute__((nonnull))
#endif
;
-
-/**
- * Get an iterator to iterate over the members of an id property group.
- * Note that this will automatically free the iterator once iteration is complete;
- * if you stop the iteration before hitting the end, make sure to call
- * IDP_FreeIterBeforeEnd(). */
void *IDP_GetGroupIterator(struct IDProperty *prop)
#ifdef __GNUC__
__attribute__((warn_unused_result))
#endif
;
-
-/**
- * Returns the next item in the iteration. To use, simple for a loop like the following:
- * while (IDP_GroupIterNext(iter) != NULL) {
- * ...
- * }
- */
IDProperty *IDP_GroupIterNext(void *vself)
#ifdef __GNUC__
__attribute__((warn_unused_result))
__attribute__((nonnull))
#endif
;
-
-/**
- * Frees the iterator pointed to at vself, only use this if iteration is stopped early;
- * when the iterator hits the end of the list it'll automatically free itself.*/
void IDP_FreeIterBeforeEnd(void *vself)
#ifdef __GNUC__
__attribute__((nonnull))
@@ -250,9 +198,6 @@ __attribute__((nonnull))
;
/*-------- Main Functions --------*/
-/** Get the Group property that contains the id properties for ID id. Set create_if_needed
- * to create the Group property and attach it to id if it doesn't exist; otherwise
- * the function will return NULL if there's no Group property attached to the ID.*/
struct IDProperty *IDP_GetProperties(struct ID *id, int create_if_needed)
#ifdef __GNUC__
__attribute__((warn_unused_result))
@@ -278,31 +223,6 @@ __attribute__((warn_unused_result))
#endif
;
-/**
- * Allocate a new ID.
- *
- * This function takes three arguments: the ID property type, a union which defines
- * it's initial value, and a name.
- *
- * The union is simple to use; see the top of this header file for its definition.
- * An example of using this function:
- *
- * IDPropertyTemplate val;
- * IDProperty *group, *idgroup, *color;
- * group = IDP_New(IDP_GROUP, val, "group1"); //groups don't need a template.
- *
- * val.array.len = 4
- * val.array.type = IDP_FLOAT;
- * color = IDP_New(IDP_ARRAY, val, "color1");
- *
- * idgroup = IDP_GetProperties(some_id, 1);
- * IDP_AddToGroup(idgroup, color);
- * IDP_AddToGroup(idgroup, group);
- *
- * Note that you MUST either attach the id property to an id property group with
- * IDP_AddToGroup or MEM_freeN the property, doing anything else might result in
- * a memory leak.
- */
struct IDProperty *IDP_New(const int type, const IDPropertyTemplate *val, const char *name)
#ifdef __GNUC__
__attribute__((warn_unused_result))
@@ -310,14 +230,10 @@ __attribute__((nonnull))
#endif
;
-/** \note this will free all child properties of list arrays and groups!
- * Also, note that this does NOT unlink anything! Plus it doesn't free
- * the actual struct IDProperty struct either.*/
void IDP_FreeProperty(struct IDProperty *prop);
void IDP_ClearProperty(IDProperty *prop);
-/** Unlinks any struct IDProperty<->ID linkage that might be going on.*/
void IDP_UnlinkProperty(struct IDProperty *prop);
#define IDP_Int(prop) ((prop)->data.val)
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h
index eb29c49ab84..71024a4ead2 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -212,7 +212,7 @@ void BKE_mesh_calc_normals_mapping_ex(
struct MVert *mverts, int numVerts,
struct MLoop *mloop, struct MPoly *mpolys, int numLoops, int numPolys, float (*polyNors_r)[3],
struct MFace *mfaces, int numFaces, int *origIndexFace, float (*faceNors_r)[3],
- const short only_face_normals);
+ const bool only_face_normals);
void BKE_mesh_calc_normals(
struct MVert *mverts, int numVerts,
diff --git a/source/blender/blenkernel/BKE_movieclip.h b/source/blender/blenkernel/BKE_movieclip.h
index c8c94b2898b..f97b5b1f3a1 100644
--- a/source/blender/blenkernel/BKE_movieclip.h
+++ b/source/blender/blenkernel/BKE_movieclip.h
@@ -70,7 +70,11 @@ void BKE_movieclip_build_proxy_frame_for_ibuf(struct MovieClip *clip, struct ImB
float BKE_movieclip_remap_scene_to_clip_frame(struct MovieClip *clip, float framenr);
float BKE_movieclip_remap_clip_to_scene_frame(struct MovieClip *clip, float framenr);
-void BKE_movieclip_filename_for_frame(struct MovieClip *clip, int framenr, char *name);
+void BKE_movieclip_filename_for_frame(struct MovieClip *clip, struct MovieClipUser *user, char *name);
+struct ImBuf *BKE_movieclip_anim_ibuf_for_frame(struct MovieClip *clip, struct MovieClipUser *user);
+
+int BKE_movieclip_has_cached_frame(struct MovieClip *clip, struct MovieClipUser *user);
+int BKE_movieclip_put_frame_if_possible(struct MovieClip *clip, struct MovieClipUser *user, struct ImBuf *ibuf);
/* cacheing flags */
#define MOVIECLIP_CACHE_SKIP (1 << 0)
diff --git a/source/blender/blenkernel/BKE_multires.h b/source/blender/blenkernel/BKE_multires.h
index bee2c374f27..aa09fe1ce8d 100644
--- a/source/blender/blenkernel/BKE_multires.h
+++ b/source/blender/blenkernel/BKE_multires.h
@@ -75,7 +75,7 @@ struct DerivedMesh *multires_make_derived_from_derived(struct DerivedMesh *dm,
struct MultiresModifierData *find_multires_modifier_before(struct Scene *scene,
struct ModifierData *lastmd);
-struct MultiresModifierData *get_multires_modifier(struct Scene *scene, struct Object *ob, int use_first);
+struct MultiresModifierData *get_multires_modifier(struct Scene *scene, struct Object *ob, bool use_first);
struct DerivedMesh *get_multires_dm(struct Scene *scene, struct MultiresModifierData *mmd,
struct Object *ob);
void multiresModifier_del_levels(struct MultiresModifierData *, struct Object *, int direction);
diff --git a/source/blender/blenkernel/BKE_nla.h b/source/blender/blenkernel/BKE_nla.h
index 9e08f3a8c83..5b41dc481c9 100644
--- a/source/blender/blenkernel/BKE_nla.h
+++ b/source/blender/blenkernel/BKE_nla.h
@@ -114,7 +114,7 @@ void BKE_nla_tweakmode_exit(struct AnimData *adt);
/* Time Mapping */
/* time mapping conversion modes */
-enum {
+enum eNlaTime_ConvertModes {
/* convert from global time to strip time - for evaluation */
NLATIME_CONVERT_EVAL = 0,
/* convert from global time to strip time - for editing corrections */
@@ -123,7 +123,7 @@ enum {
/* convert from strip time to global time */
// xxx old 1 invert
NLATIME_CONVERT_MAP,
-} eNlaTime_ConvertModes;
+};
float BKE_nla_tweakedit_remap(struct AnimData *adt, float cframe, short mode);
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index d9a311b7e13..e62994576a3 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -83,6 +83,7 @@ struct ColorManagedViewSettings;
struct ColorManagedDisplaySettings;
struct bNodeInstanceHash;
+
/* ************** NODE TYPE DEFINITIONS ***** */
/** Compact definition of a node socket.
@@ -331,6 +332,7 @@ typedef struct bNodeTreeType {
struct bNodeTreeType *ntreeTypeFind(const char *idname);
void ntreeTypeAdd(struct bNodeTreeType *nt);
void ntreeTypeFreeLink(struct bNodeTreeType *nt);
+bool ntreeIsRegistered(struct bNodeTree *ntree);
struct GHashIterator *ntreeTypeGetIterator(void);
/* helper macros for iterating over tree types */
@@ -346,7 +348,6 @@ struct GHashIterator *ntreeTypeGetIterator(void);
}
void ntreeSetTypes(const struct bContext *C, struct bNodeTree *ntree);
-int ntreeIsValid(struct bNodeTree *ntree);
struct bNodeTree *ntreeAddTree(struct Main *bmain, const char *name, const char *idname);
@@ -407,6 +408,7 @@ void ntreeInterfaceTypeUpdate(struct bNodeTree *ntree);
struct bNodeType *nodeTypeFind(const char *idname);
void nodeRegisterType(struct bNodeType *ntype);
void nodeUnregisterType(struct bNodeType *ntype);
+bool nodeIsRegistered(struct bNode *node);
struct GHashIterator *nodeTypeGetIterator(void);
/* helper macros for iterating over node types */
@@ -424,6 +426,7 @@ struct GHashIterator *nodeTypeGetIterator(void);
struct bNodeSocketType *nodeSocketTypeFind(const char *idname);
void nodeRegisterSocketType(struct bNodeSocketType *stype);
void nodeUnregisterSocketType(struct bNodeSocketType *stype);
+bool nodeSocketIsRegistered(struct bNodeSocket *sock);
struct GHashIterator *nodeSocketTypeGetIterator(void);
const char * nodeStaticSocketType(int type, int subtype);
const char * nodeStaticSocketInterfaceType(int type, int subtype);
@@ -563,7 +566,7 @@ void BKE_node_preview_clear(struct bNodePreview *preview);
void BKE_node_preview_clear_tree(struct bNodeTree *ntree);
void BKE_node_preview_sync_tree(struct bNodeTree *to_ntree, struct bNodeTree *from_ntree);
-void BKE_node_preview_merge_tree(struct bNodeTree *to_ntree, struct bNodeTree *from_ntree);
+void BKE_node_preview_merge_tree(struct bNodeTree *to_ntree, struct bNodeTree *from_ntree, bool remove_old);
void BKE_node_preview_set_pixel(struct bNodePreview *preview, const float col[4], int x, int y, int do_manage);
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 5caa484caa0..da5fa3e8195 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -91,11 +91,11 @@ bool BKE_object_is_libdata(struct Object *ob);
bool BKE_object_obdata_is_libdata(struct Object *ob);
void BKE_object_scale_to_mat3(struct Object *ob, float mat[3][3]);
-void BKE_object_rot_to_mat3(struct Object *ob, float mat[3][3], short use_drot);
-void BKE_object_mat3_to_rot(struct Object *ob, float mat[3][3], short use_compat);
+void BKE_object_rot_to_mat3(struct Object *ob, float mat[3][3], bool use_drot);
+void BKE_object_mat3_to_rot(struct Object *ob, float mat[3][3], bool use_compat);
void BKE_object_to_mat3(struct Object *ob, float mat[3][3]);
void BKE_object_to_mat4(struct Object *ob, float mat[4][4]);
-void BKE_object_apply_mat4(struct Object *ob, float mat[4][4], const short use_compat, const short use_parent);
+void BKE_object_apply_mat4(struct Object *ob, float mat[4][4], const bool use_compat, const bool use_parent);
int BKE_object_pose_context_check(struct Object *ob);
struct Object *BKE_object_pose_armature_get(struct Object *ob);
@@ -117,8 +117,8 @@ struct BoundBox *BKE_object_boundbox_get(struct Object *ob);
void BKE_object_dimensions_get(struct Object *ob, float vec[3]);
void BKE_object_dimensions_set(struct Object *ob, const float *value);
void BKE_object_boundbox_flag(struct Object *ob, int flag, int set);
-void BKE_object_minmax(struct Object *ob, float r_min[3], float r_max[3], const short use_hidden);
-int BKE_object_minmax_dupli(struct Scene *scene, struct Object *ob, float r_min[3], float r_max[3], const short use_hidden);
+void BKE_object_minmax(struct Object *ob, float r_min[3], float r_max[3], const bool use_hidden);
+int BKE_object_minmax_dupli(struct Scene *scene, struct Object *ob, float r_min[3], float r_max[3], const bool use_hidden);
/* sometimes min-max isn't enough, we need to loop over each point */
void BKE_object_foreach_display_point(struct Object *ob, float obmat[4][4],
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h
index a46d947b9d9..9586df6d119 100644
--- a/source/blender/blenkernel/BKE_sequencer.h
+++ b/source/blender/blenkernel/BKE_sequencer.h
@@ -368,7 +368,7 @@ struct Sequence *BKE_sequencer_add_sound_strip(struct bContext *C, ListBase *seq
struct Sequence *BKE_sequencer_add_movie_strip(struct bContext *C, ListBase *seqbasep, struct SeqLoadInfo *seq_load);
/* view3d draw callback, run when not in background view */
-typedef struct ImBuf *(*SequencerDrawView)(struct Scene *, struct Object *, int, int, unsigned int, int, int, int, int, char[256]);
+typedef struct ImBuf *(*SequencerDrawView)(struct Scene *, struct Object *, int, int, unsigned int, int, bool, bool, int, char[256]);
extern SequencerDrawView sequencer_view3d_cb;
/* copy/paste */
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index ddb4cc4391a..ad791852253 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -1712,7 +1712,7 @@ static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBas
/* Returns a list of DupliObject
* note; group dupli's already set transform matrix. see note in group_duplilist() */
-ListBase *object_duplilist_ex(Scene *sce, Object *ob, int update, int for_render)
+ListBase *object_duplilist_ex(Scene *sce, Object *ob, bool update, bool for_render)
{
ListBase *duplilist = MEM_mallocN(sizeof(ListBase), "duplilist");
int persistent_id[MAX_DUPLI_RECUR] = {0};
@@ -1728,9 +1728,9 @@ ListBase *object_duplilist_ex(Scene *sce, Object *ob, int update, int for_render
/* note: previously updating was always done, this is why it defaults to be on
* but there are likely places it can be called without updating */
-ListBase *object_duplilist(Scene *sce, Object *ob, int for_render)
+ListBase *object_duplilist(Scene *sce, Object *ob, bool for_render)
{
- return object_duplilist_ex(sce, ob, TRUE, for_render);
+ return object_duplilist_ex(sce, ob, true, for_render);
}
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index fa6aafabe05..b3c94beba93 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -66,6 +66,7 @@
#include "BKE_blender.h"
#include "BKE_bpath.h"
+#include "BKE_brush.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_displist.h"
@@ -120,6 +121,8 @@ void free_blender(void)
IMB_exit();
BKE_images_exit();
+ BKE_brush_system_exit();
+
BLI_callback_global_finalize();
BKE_sequencer_cache_destruct();
diff --git a/source/blender/blenkernel/intern/bpath.c b/source/blender/blenkernel/intern/bpath.c
index 6998ffabe65..852dcc6216c 100644
--- a/source/blender/blenkernel/intern/bpath.c
+++ b/source/blender/blenkernel/intern/bpath.c
@@ -682,14 +682,14 @@ int BKE_bpath_relocate_visitor(void *pathbase_v, char *path_dst, const char *pat
struct PathStore {
struct PathStore *next, *prev;
-} PathStore;
+};
static int bpath_list_append(void *userdata, char *UNUSED(path_dst), const char *path_src)
{
/* store the path and string in a single alloc */
ListBase *ls = userdata;
size_t path_size = strlen(path_src) + 1;
- struct PathStore *path_store = MEM_mallocN(sizeof(PathStore) + path_size, __func__);
+ struct PathStore *path_store = MEM_mallocN(sizeof(struct PathStore) + path_size, __func__);
char *filepath = (char *)(path_store + 1);
memcpy(filepath, path_src, path_size);
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index c594e19b960..d6cd7290038 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -55,6 +55,20 @@
#include "RE_render_ext.h" /* externtex */
#include "RE_shader_ext.h"
+static RNG *brush_rng;
+
+void BKE_brush_system_init(void)
+{
+ brush_rng = BLI_rng_new(0);
+ BLI_rng_srandom(brush_rng, 31415682);
+}
+
+void BKE_brush_system_exit(void)
+{
+ BLI_rng_free(brush_rng);
+}
+
+
static void brush_defaults(Brush *brush)
{
brush->blend = 0;
@@ -877,8 +891,8 @@ void BKE_brush_jitter_pos(const Scene *scene, Brush *brush, const float pos[2],
int diameter;
do {
- rand_pos[0] = BLI_frand() - 0.5f;
- rand_pos[1] = BLI_frand() - 0.5f;
+ rand_pos[0] = BLI_rng_get_float(brush_rng) - 0.5f;
+ rand_pos[1] = BLI_rng_get_float(brush_rng) - 0.5f;
} while (len_v2(rand_pos) > 0.5f);
diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c
index 34c2d144f4c..ae1fa3025b9 100644
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@ -371,7 +371,7 @@ void BKE_camera_params_compute_matrix(CameraParams *params)
/***************************** Camera View Frame *****************************/
-void BKE_camera_view_frame_ex(Scene *scene, Camera *camera, float drawsize, const short do_clip, const float scale[3],
+void BKE_camera_view_frame_ex(Scene *scene, Camera *camera, float drawsize, const bool do_clip, const float scale[3],
float r_asp[2], float r_shift[2], float *r_drawsize, float r_vec[4][3])
{
float facx, facy;
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 3430c2ea7a1..dc47ff40863 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -43,6 +43,8 @@
#include "BLI_kdopbvh.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "DNA_armature_types.h"
#include "DNA_camera_types.h"
#include "DNA_constraint_types.h"
@@ -4353,12 +4355,12 @@ static bConstraint *add_new_constraint_internal(const char *name, short type)
cti->new_data(con->data);
/* if no name is provided, use the type of the constraint as the name */
- newName = (name && name[0]) ? name : cti->name;
+ newName = (name && name[0]) ? name : DATA_(cti->name);
}
else {
/* if no name is provided, use the generic "Const" name */
/* NOTE: any constraint type that gets here really shouldn't get added... */
- newName = (name && name[0]) ? name : "Const";
+ newName = (name && name[0]) ? name : DATA_("Const");
}
/* copy the name */
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 5d2c85e5825..5fba308e3df 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -3393,6 +3393,144 @@ bool BKE_nurb_order_clamp_v(struct Nurb *nu)
return change;
}
+bool BKE_nurb_type_convert(Nurb *nu, const short type, const bool use_handles)
+{
+ BezTriple *bezt;
+ BPoint *bp;
+ int a, c, nr;
+
+ if (nu->type == CU_POLY) {
+ if (type == CU_BEZIER) { /* to Bezier with vecthandles */
+ nr = nu->pntsu;
+ bezt = (BezTriple *)MEM_callocN(nr * sizeof(BezTriple), "setsplinetype2");
+ nu->bezt = bezt;
+ a = nr;
+ bp = nu->bp;
+ while (a--) {
+ copy_v3_v3(bezt->vec[1], bp->vec);
+ bezt->f1 = bezt->f2 = bezt->f3 = bp->f1;
+ bezt->h1 = bezt->h2 = HD_VECT;
+ bezt->weight = bp->weight;
+ bezt->radius = bp->radius;
+ bp++;
+ bezt++;
+ }
+ MEM_freeN(nu->bp);
+ nu->bp = NULL;
+ nu->pntsu = nr;
+ nu->type = CU_BEZIER;
+ BKE_nurb_handles_calc(nu);
+ }
+ else if (type == CU_NURBS) {
+ nu->type = CU_NURBS;
+ nu->orderu = 4;
+ nu->flagu &= CU_NURB_CYCLIC; /* disable all flags except for cyclic */
+ BKE_nurb_knot_calc_u(nu);
+ a = nu->pntsu * nu->pntsv;
+ bp = nu->bp;
+ while (a--) {
+ bp->vec[3] = 1.0;
+ bp++;
+ }
+ }
+ }
+ else if (nu->type == CU_BEZIER) { /* Bezier */
+ if (type == CU_POLY || type == CU_NURBS) {
+ nr = use_handles ? (3 * nu->pntsu) : nu->pntsu;
+ nu->bp = MEM_callocN(nr * sizeof(BPoint), "setsplinetype");
+ a = nu->pntsu;
+ bezt = nu->bezt;
+ bp = nu->bp;
+ while (a--) {
+ if ((type == CU_POLY && bezt->h1 == HD_VECT && bezt->h2 == HD_VECT) || (use_handles == false)) {
+ /* vector handle becomes 1 poly vertice */
+ copy_v3_v3(bp->vec, bezt->vec[1]);
+ bp->vec[3] = 1.0;
+ bp->f1 = bezt->f2;
+ if (use_handles) nr -= 2;
+ bp->radius = bezt->radius;
+ bp->weight = bezt->weight;
+ bp++;
+ }
+ else {
+ char *f = &bezt->f1;
+ for (c = 0; c < 3; c++, f++) {
+ copy_v3_v3(bp->vec, bezt->vec[c]);
+ bp->vec[3] = 1.0;
+ bp->f1 = *f;
+ bp->radius = bezt->radius;
+ bp->weight = bezt->weight;
+ bp++;
+ }
+ }
+ bezt++;
+ }
+ MEM_freeN(nu->bezt);
+ nu->bezt = NULL;
+ nu->pntsu = nr;
+ nu->pntsv = 1;
+ nu->orderu = 4;
+ nu->orderv = 1;
+ nu->type = type;
+
+#if 0 /* UNUSED */
+ if (nu->flagu & CU_NURB_CYCLIC) c = nu->orderu - 1;
+ else c = 0;
+#endif
+
+ if (type == CU_NURBS) {
+ nu->flagu &= CU_NURB_CYCLIC; /* disable all flags except for cyclic */
+ nu->flagu |= CU_NURB_BEZIER;
+ BKE_nurb_knot_calc_u(nu);
+ }
+ }
+ }
+ else if (nu->type == CU_NURBS) {
+ if (type == CU_POLY) {
+ nu->type = CU_POLY;
+ if (nu->knotsu) MEM_freeN(nu->knotsu); /* python created nurbs have a knotsu of zero */
+ nu->knotsu = NULL;
+ if (nu->knotsv) MEM_freeN(nu->knotsv);
+ nu->knotsv = NULL;
+ }
+ else if (type == CU_BEZIER) { /* to Bezier */
+ nr = nu->pntsu / 3;
+
+ if (nr < 2) {
+ return false; /* conversion impossible */
+ }
+ else {
+ bezt = MEM_callocN(nr * sizeof(BezTriple), "setsplinetype2");
+ nu->bezt = bezt;
+ a = nr;
+ bp = nu->bp;
+ while (a--) {
+ copy_v3_v3(bezt->vec[0], bp->vec);
+ bezt->f1 = bp->f1;
+ bp++;
+ copy_v3_v3(bezt->vec[1], bp->vec);
+ bezt->f2 = bp->f1;
+ bp++;
+ copy_v3_v3(bezt->vec[2], bp->vec);
+ bezt->f3 = bp->f1;
+ bezt->radius = bp->radius;
+ bezt->weight = bp->weight;
+ bp++;
+ bezt++;
+ }
+ MEM_freeN(nu->bp);
+ nu->bp = NULL;
+ MEM_freeN(nu->knotsu);
+ nu->knotsu = NULL;
+ nu->pntsu = nr;
+ nu->type = CU_BEZIER;
+ }
+ }
+ }
+
+ return true;
+}
+
/* Get edit nurbs or normal nurbs list */
ListBase *BKE_curve_nurbs_get(Curve *cu)
{
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index e91fd0cc929..bb14dbd3ad0 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -1463,6 +1463,14 @@ int CustomData_get_stencil_layer_index(const CustomData *data, int type)
/* -------------------------------------------------------------------- */
/* index values per layer type */
+int CustomData_get_named_layer(const struct CustomData *data, int type, const char *name)
+{
+ const int named_index = CustomData_get_named_layer_index(data, type, name);
+ const int layer_index = data->typemap[type];
+ BLI_assert(customdata_typemap_is_valid(data));
+ return (named_index != -1) ? named_index - layer_index : -1;
+}
+
int CustomData_get_active_layer(const CustomData *data, int type)
{
const int layer_index = data->typemap[type];
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c
index 2ba71ecd9b5..7543892f2e3 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -126,7 +126,7 @@ void defvert_copy_index(MDeformVert *dvert_dst, const MDeformVert *dvert_src, co
/* only sync over matching weights, don't add or remove groups
* warning, loop within loop.
*/
-void defvert_sync(MDeformVert *dvert_dst, const MDeformVert *dvert_src, int use_verify)
+void defvert_sync(MDeformVert *dvert_dst, const MDeformVert *dvert_src, const bool use_verify)
{
if (dvert_src->totweight && dvert_dst->totweight) {
int i;
@@ -145,7 +145,7 @@ void defvert_sync(MDeformVert *dvert_dst, const MDeformVert *dvert_src, int use_
/* be sure all flip_map values are valid */
void defvert_sync_mapped(MDeformVert *dvert_dst, const MDeformVert *dvert_src,
- const int *flip_map, const int flip_map_len, const int use_verify)
+ const int *flip_map, const int flip_map_len, const bool use_verify)
{
if (dvert_src->totweight && dvert_dst->totweight) {
int i;
@@ -346,7 +346,7 @@ int defgroup_name_index(Object *ob, const char *name)
}
/* note, must be freed */
-int *defgroup_flip_map(Object *ob, int *flip_map_len, int use_default)
+int *defgroup_flip_map(Object *ob, int *flip_map_len, const bool use_default)
{
int defbase_tot = *flip_map_len = BLI_countlist(&ob->defbase);
@@ -384,7 +384,7 @@ int *defgroup_flip_map(Object *ob, int *flip_map_len, int use_default)
}
/* note, must be freed */
-int *defgroup_flip_map_single(Object *ob, int *flip_map_len, int use_default, int defgroup)
+int *defgroup_flip_map_single(Object *ob, int *flip_map_len, const bool use_default, int defgroup)
{
int defbase_tot = *flip_map_len = BLI_countlist(&ob->defbase);
@@ -416,7 +416,7 @@ int *defgroup_flip_map_single(Object *ob, int *flip_map_len, int use_default, in
}
}
-int defgroup_flip_index(Object *ob, int index, int use_default)
+int defgroup_flip_index(Object *ob, int index, const bool use_default)
{
bDeformGroup *dg = BLI_findlink(&ob->defbase, index);
int flip_index = -1;
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index 6f85d4de60e..e4d7814c4e1 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -122,17 +122,17 @@ DispList *BKE_displist_find(ListBase *lb, int type)
return NULL;
}
-int BKE_displist_has_faces(ListBase *lb)
+bool BKE_displist_has_faces(ListBase *lb)
{
DispList *dl;
for (dl = lb->first; dl; dl = dl->next) {
if (ELEM3(dl->type, DL_INDEX3, DL_INDEX4, DL_SURF)) {
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
void BKE_displist_copy(ListBase *lbn, ListBase *lb)
@@ -271,10 +271,10 @@ void BKE_displist_count(ListBase *lb, int *totvert, int *totface, int *tottri)
}
}
-int BKE_displist_surfindex_get(DispList *dl, int a, int *b, int *p1, int *p2, int *p3, int *p4)
+bool BKE_displist_surfindex_get(DispList *dl, int a, int *b, int *p1, int *p2, int *p3, int *p4)
{
if ((dl->flag & DL_CYCL_V) == 0 && a == (dl->parts) - 1) {
- return 0;
+ return false;
}
if (dl->flag & DL_CYCL_U) {
@@ -297,7 +297,7 @@ int BKE_displist_surfindex_get(DispList *dl, int a, int *b, int *p1, int *p2, in
(*p4) -= dl->nr * dl->parts;
}
- return 1;
+ return true;
}
/* ****************** make displists ********************* */
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index 24fb949481f..4e05595b93a 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -107,9 +107,9 @@ static int neighX[8] = {1, 1, 0, -1, -1, -1, 0, 1};
static int neighY[8] = {0, 1, 1, 1, 0, -1, -1, -1};
/* subframe_updateObject() flags */
-#define UPDATE_PARENTS (1 << 0)
+#define SUBFRAME_RECURSION 5
#define UPDATE_MESH (1 << 1)
-#define UPDATE_EVERYTHING (UPDATE_PARENTS | UPDATE_MESH)
+#define UPDATE_EVERYTHING (UPDATE_MESH) // | UPDATE_PARENTS
/* surface_getBrushFlags() return vals */
#define BRUSH_USES_VELOCITY (1 << 0)
/* brush mesh raycast status */
@@ -509,7 +509,7 @@ static void object_cacheIgnoreClear(Object *ob, int state)
BLI_freelistN(&pidlist);
}
-static int subframe_updateObject(Scene *scene, Object *ob, int flags, float frame)
+static int subframe_updateObject(Scene *scene, Object *ob, int flags, int parent_recursion, float frame)
{
DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)modifiers_findByType(ob, eModifierType_DynamicPaint);
bConstraint *con;
@@ -519,10 +519,11 @@ static int subframe_updateObject(Scene *scene, Object *ob, int flags, float fram
return 1;
/* if object has parents, update them too */
- if (flags & UPDATE_PARENTS) {
+ if (parent_recursion) {
+ int recursion = parent_recursion-1;
int is_canvas = 0;
- if (ob->parent) is_canvas += subframe_updateObject(scene, ob->parent, 0, frame);
- if (ob->track) is_canvas += subframe_updateObject(scene, ob->track, 0, frame);
+ if (ob->parent) is_canvas += subframe_updateObject(scene, ob->parent, 0, recursion, frame);
+ if (ob->track) is_canvas += subframe_updateObject(scene, ob->track, 0, recursion, frame);
/* skip subframe if object is parented
* to vertex of a dynamic paint canvas */
@@ -539,7 +540,7 @@ static int subframe_updateObject(Scene *scene, Object *ob, int flags, float fram
cti->get_constraint_targets(con, &targets);
for (ct = targets.first; ct; ct = ct->next) {
if (ct->tar)
- subframe_updateObject(scene, ct->tar, 0, frame);
+ subframe_updateObject(scene, ct->tar, 0, recursion, frame);
}
/* free temp targets */
if (cti->flush_constraint_targets)
@@ -3183,7 +3184,7 @@ static void dynamicPaint_brushMeshCalculateVelocity(Scene *scene, Object *ob, Dy
scene->r.cfra = prev_fra;
scene->r.subframe = prev_sfra;
- subframe_updateObject(scene, ob, UPDATE_EVERYTHING, BKE_scene_frame_get(scene));
+ subframe_updateObject(scene, ob, UPDATE_EVERYTHING, SUBFRAME_RECURSION, BKE_scene_frame_get(scene));
dm_p = CDDM_copy(brush->dm);
numOfVerts_p = dm_p->getNumVerts(dm_p);
mvert_p = dm_p->getVertArray(dm_p);
@@ -3193,7 +3194,7 @@ static void dynamicPaint_brushMeshCalculateVelocity(Scene *scene, Object *ob, Dy
scene->r.cfra = cur_fra;
scene->r.subframe = cur_sfra;
- subframe_updateObject(scene, ob, UPDATE_EVERYTHING, BKE_scene_frame_get(scene));
+ subframe_updateObject(scene, ob, UPDATE_EVERYTHING, SUBFRAME_RECURSION, BKE_scene_frame_get(scene));
dm_c = brush->dm;
numOfVerts_c = dm_c->getNumVerts(dm_c);
mvert_c = dm_p->getVertArray(dm_c);
@@ -3243,13 +3244,13 @@ static void dynamicPaint_brushObjectCalculateVelocity(Scene *scene, Object *ob,
/* previous frame dm */
scene->r.cfra = prev_fra;
scene->r.subframe = prev_sfra;
- subframe_updateObject(scene, ob, UPDATE_PARENTS, BKE_scene_frame_get(scene));
+ subframe_updateObject(scene, ob, 0, SUBFRAME_RECURSION, BKE_scene_frame_get(scene));
copy_m4_m4(prev_obmat, ob->obmat);
/* current frame dm */
scene->r.cfra = cur_fra;
scene->r.subframe = cur_sfra;
- subframe_updateObject(scene, ob, UPDATE_PARENTS, BKE_scene_frame_get(scene));
+ subframe_updateObject(scene, ob, 0, SUBFRAME_RECURSION, BKE_scene_frame_get(scene));
/* calculate speed */
mul_m4_v3(prev_obmat, prev_loc);
@@ -4973,7 +4974,7 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su
/* update object data on this subframe */
if (subframe) {
scene_setSubframe(scene, subframe);
- subframe_updateObject(scene, brushObj, UPDATE_EVERYTHING, BKE_scene_frame_get(scene));
+ subframe_updateObject(scene, brushObj, UPDATE_EVERYTHING, SUBFRAME_RECURSION, BKE_scene_frame_get(scene));
}
/* Prepare materials if required */
if (brush_usesMaterial(brush, scene))
@@ -5007,7 +5008,7 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su
if (subframe) {
scene->r.cfra = scene_frame;
scene->r.subframe = scene_subframe;
- subframe_updateObject(scene, brushObj, UPDATE_EVERYTHING, BKE_scene_frame_get(scene));
+ subframe_updateObject(scene, brushObj, UPDATE_EVERYTHING, SUBFRAME_RECURSION, BKE_scene_frame_get(scene));
}
/* process special brush effects, like smudge */
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index 594b887d361..f63eb9f87e3 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -1024,10 +1024,11 @@ static float dtar_get_prop_val(ChannelDriver *driver, DriverTarget *dtar)
id = dtar_id_ensure_proxy_from(dtar->id);
/* error check for missing pointer... */
- /* TODO: tag the specific target too as having issues */
if (id == NULL) {
- printf("Error: driver has an invalid target to use\n");
- if (G.debug & G_DEBUG) printf("\tpath = %s\n", dtar->rna_path);
+ if (G.debug & G_DEBUG) {
+ printf("Error: driver has an invalid target to use (path = %s)\n", dtar->rna_path);
+ }
+
driver->flag |= DRIVER_FLAG_INVALID;
dtar->flag |= DTAR_FLAG_INVALID;
return 0.0f;
@@ -1089,8 +1090,9 @@ static float dtar_get_prop_val(ChannelDriver *driver, DriverTarget *dtar)
}
else {
/* path couldn't be resolved */
- if (G.debug & G_DEBUG)
+ if (G.debug & G_DEBUG) {
printf("Driver Evaluation Error: cannot resolve target for %s -> %s\n", id->name, dtar->rna_path);
+ }
driver->flag |= DRIVER_FLAG_INVALID;
dtar->flag |= DTAR_FLAG_INVALID;
@@ -1152,19 +1154,25 @@ static float dvar_eval_rotDiff(ChannelDriver *driver, DriverVar *dvar)
/* check what the error was */
if ((pchan == NULL) && (pchan2 == NULL)) {
- printf("Driver Evaluation Error: Rotational difference failed - first 2 targets invalid\n");
+ if (G.debug & G_DEBUG) {
+ printf("Driver Evaluation Error: Rotational difference failed - first 2 targets invalid\n");
+ }
dtar1->flag |= DTAR_FLAG_INVALID;
dtar2->flag |= DTAR_FLAG_INVALID;
}
else if (pchan == NULL) {
- printf("Driver Evaluation Error: Rotational difference failed - first target not valid PoseChannel\n");
+ if (G.debug & G_DEBUG) {
+ printf("Driver Evaluation Error: Rotational difference failed - first target not valid PoseChannel\n");
+ }
dtar1->flag |= DTAR_FLAG_INVALID;
dtar2->flag &= ~DTAR_FLAG_INVALID;
}
else if (pchan2 == NULL) {
- printf("Driver Evaluation Error: Rotational difference failed - second target not valid PoseChannel\n");
+ if (G.debug & G_DEBUG) {
+ printf("Driver Evaluation Error: Rotational difference failed - second target not valid PoseChannel\n");
+ }
dtar1->flag &= ~DTAR_FLAG_INVALID;
dtar2->flag |= DTAR_FLAG_INVALID;
diff --git a/source/blender/blenkernel/intern/idcode.c b/source/blender/blenkernel/intern/idcode.c
index adc0503df29..c64c261b9b0 100644
--- a/source/blender/blenkernel/intern/idcode.c
+++ b/source/blender/blenkernel/intern/idcode.c
@@ -109,17 +109,36 @@ static IDType *idtype_from_code(int code)
return NULL;
}
+/**
+ * Return if the ID code is a valid ID code.
+ *
+ * \param code The code to check.
+ * \return Boolean, 0 when invalid.
+ */
bool BKE_idcode_is_valid(int code)
{
return idtype_from_code(code) ? true : false;
}
+/**
+ * Return non-zero when an ID type is linkable.
+ *
+ * \param code The code to check.
+ * \return Boolean, 0 when non linkable.
+ */
bool BKE_idcode_is_linkable(int code)
{
IDType *idt = idtype_from_code(code);
return idt ? ((idt->flags & IDTYPE_FLAGS_ISLINKABLE) != 0) : false;
}
+/**
+ * Convert an idcode into a name.
+ *
+ * \param code The code to convert.
+ * \return A static string representing the name of
+ * the code.
+ */
const char *BKE_idcode_to_name(int code)
{
IDType *idt = idtype_from_code(code);
@@ -127,6 +146,12 @@ const char *BKE_idcode_to_name(int code)
return idt ? idt->name : NULL;
}
+/**
+ * Convert a name into an idcode (ie. ID_SCE)
+ *
+ * \param name The name to convert.
+ * \return The code for the name, or 0 if invalid.
+ */
int BKE_idcode_from_name(const char *name)
{
IDType *idt = idtype_from_name(name);
@@ -134,6 +159,13 @@ int BKE_idcode_from_name(const char *name)
return idt ? idt->code : 0;
}
+/**
+ * Convert an idcode into a name (plural).
+ *
+ * \param code The code to convert.
+ * \return A static string representing the name of
+ * the code.
+ */
const char *BKE_idcode_to_name_plural(int code)
{
IDType *idt = idtype_from_code(code);
@@ -141,6 +173,12 @@ const char *BKE_idcode_to_name_plural(int code)
return idt ? idt->plural : NULL;
}
+/**
+ * Return an ID code and steps the index forward 1.
+ *
+ * \param index start as 0.
+ * \return the code, 0 when all codes have been returned.
+ */
int BKE_idcode_iter_step(int *index)
{
return (*index < nidtypes) ? idtypes[(*index)++].code : 0;
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index 8dc284e0a3e..ca1ae23c364 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -61,8 +61,10 @@ static char idp_size_table[] = {
/* --------- property array type -------------*/
-/* note: as a start to move away from the stupid IDP_New function, this type
- * has it's own allocation function.*/
+/**
+ * \note as a start to move away from the stupid IDP_New function, this type
+ * has it's own allocation function.
+ */
IDProperty *IDP_NewIDPArray(const char *name)
{
IDProperty *prop = MEM_callocN(sizeof(IDProperty), "IDProperty prop array");
@@ -443,8 +445,8 @@ void IDP_SyncGroupValues(IDProperty *dest, IDProperty *src)
}
}
-/*
- * replaces all properties with the same name in a destination group from a source group.
+/**
+ * Replaces all properties with the same name in a destination group from a source group.
*/
void IDP_ReplaceGroupInGroup(IDProperty *dest, IDProperty *src)
{
@@ -471,9 +473,10 @@ void IDP_ReplaceGroupInGroup(IDProperty *dest, IDProperty *src)
}
}
}
-/*
- * replaces a property with the same name in a group, or adds
- * it if the properly doesn't exist.
+
+/**
+ * Checks if a property with the same name as prop exists, and if so replaces it.
+ * Use this to preserve order!
*/
void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop)
{
@@ -515,8 +518,21 @@ void IDP_MergeGroup(IDProperty *dest, IDProperty *src, const int do_overwrite)
}
}
-/* returns 0 if an id property with the same name exists and it failed,
- * or 1 if it succeeded in adding to the group.*/
+/**
+ * This function has a sanity check to make sure ID properties with the same name don't
+ * get added to the group.
+ *
+ * The sanity check just means the property is not added to the group if another property
+ * exists with the same name; the client code using ID properties then needs to detect this
+ * (the function that adds new properties to groups, IDP_AddToGroup,returns 0 if a property can't
+ * be added to the group, and 1 if it can) and free the property.
+ *
+ * Currently the code to free ID properties is designed to leave the actual struct
+ * you pass it un-freed, this is needed for how the system works. This means
+ * to free an ID property, you first call IDP_FreeProperty then MEM_freeN the
+ * struct. In the future this will just be IDP_FreeProperty and the code will
+ * be reorganized to work properly.
+ */
int IDP_AddToGroup(IDProperty *group, IDProperty *prop)
{
if (IDP_GetPropertyFromGroup(group, prop->name) == NULL) {
@@ -528,6 +544,10 @@ int IDP_AddToGroup(IDProperty *group, IDProperty *prop)
return 0;
}
+/**
+ * This is the same as IDP_AddToGroup, only you pass an item
+ * in the group list to be inserted after.
+ */
int IDP_InsertToGroup(IDProperty *group, IDProperty *previous, IDProperty *pnew)
{
if (IDP_GetPropertyFromGroup(group, pnew->name) == NULL) {
@@ -539,6 +559,13 @@ int IDP_InsertToGroup(IDProperty *group, IDProperty *previous, IDProperty *pnew)
return 0;
}
+/**
+ * \note this does not free the property!!
+ *
+ * To free the property, you have to do:
+ * IDP_FreeProperty(prop); //free all subdata
+ * MEM_freeN(prop); //free property struct itself
+ */
void IDP_RemFromGroup(IDProperty *group, IDProperty *prop)
{
group->len--;
@@ -549,7 +576,7 @@ IDProperty *IDP_GetPropertyFromGroup(IDProperty *prop, const char *name)
{
return (IDProperty *)BLI_findstring(&prop->data.group, name, offsetof(IDProperty, name));
}
-
+/** same as above but ensure type match */
IDProperty *IDP_GetPropertyTypeFromGroup(IDProperty *prop, const char *name, const char type)
{
IDProperty *idprop = IDP_GetPropertyFromGroup(prop, name);
@@ -561,6 +588,12 @@ typedef struct IDPIter {
IDProperty *parent;
} IDPIter;
+/**
+ * Get an iterator to iterate over the members of an id property group.
+ * Note that this will automatically free the iterator once iteration is complete;
+ * if you stop the iteration before hitting the end, make sure to call
+ * IDP_FreeIterBeforeEnd().
+ */
void *IDP_GetGroupIterator(IDProperty *prop)
{
IDPIter *iter = MEM_callocN(sizeof(IDPIter), "IDPIter");
@@ -569,6 +602,12 @@ void *IDP_GetGroupIterator(IDProperty *prop)
return (void *) iter;
}
+/**
+ * Returns the next item in the iteration. To use, simple for a loop like the following:
+ * while (IDP_GroupIterNext(iter) != NULL) {
+ * ...
+ * }
+ */
IDProperty *IDP_GroupIterNext(void *vself)
{
IDPIter *self = (IDPIter *) vself;
@@ -582,6 +621,10 @@ IDProperty *IDP_GroupIterNext(void *vself)
return (void *) next;
}
+/**
+ * Frees the iterator pointed to at vself, only use this if iteration is stopped early;
+ * when the iterator hits the end of the list it'll automatically free itself.\
+ */
void IDP_FreeIterBeforeEnd(void *vself)
{
MEM_freeN(vself);
@@ -613,6 +656,11 @@ IDProperty *IDP_CopyProperty(IDProperty *prop)
}
}
+/**
+ * Get the Group property that contains the id properties for ID id. Set create_if_needed
+ * to create the Group property and attach it to id if it doesn't exist; otherwise
+ * the function will return NULL if there's no Group property attached to the ID.
+ */
IDProperty *IDP_GetProperties(ID *id, int create_if_needed)
{
if (id->properties) {
@@ -702,7 +750,31 @@ int IDP_EqualsProperties(IDProperty *prop1, IDProperty *prop2)
return IDP_EqualsProperties_ex(prop1, prop2, TRUE);
}
-/* 'val' is never NULL, don't check */
+/**
+ * Allocate a new ID.
+ *
+ * This function takes three arguments: the ID property type, a union which defines
+ * it's initial value, and a name.
+ *
+ * The union is simple to use; see the top of this header file for its definition.
+ * An example of using this function:
+ *
+ * IDPropertyTemplate val;
+ * IDProperty *group, *idgroup, *color;
+ * group = IDP_New(IDP_GROUP, val, "group1"); //groups don't need a template.
+ *
+ * val.array.len = 4
+ * val.array.type = IDP_FLOAT;
+ * color = IDP_New(IDP_ARRAY, val, "color1");
+ *
+ * idgroup = IDP_GetProperties(some_id, 1);
+ * IDP_AddToGroup(idgroup, color);
+ * IDP_AddToGroup(idgroup, group);
+ *
+ * Note that you MUST either attach the id property to an id property group with
+ * IDP_AddToGroup or MEM_freeN the property, doing anything else might result in
+ * a memory leak.
+ */
IDProperty *IDP_New(const int type, const IDPropertyTemplate *val, const char *name)
{
IDProperty *prop = NULL;
@@ -793,9 +865,11 @@ IDProperty *IDP_New(const int type, const IDPropertyTemplate *val, const char *n
return prop;
}
-/* NOTE: this will free all child properties including list arrays and groups!
+/**
+ * \note this will free all child properties of list arrays and groups!
* Also, note that this does NOT unlink anything! Plus it doesn't free
- * the actual IDProperty struct either.*/
+ * the actual struct IDProperty struct either.
+ */
void IDP_FreeProperty(IDProperty *prop)
{
switch (prop->type) {
@@ -821,8 +895,11 @@ void IDP_ClearProperty(IDProperty *prop)
prop->len = prop->totallen = 0;
}
-/* Unlinks any IDProperty<->ID linkage that might be going on.
- * note: currently unused.*/
+/**
+ * Unlinks any struct IDProperty<->ID linkage that might be going on.
+ *
+ * \note currently unused
+ */
void IDP_UnlinkProperty(IDProperty *prop)
{
switch (prop->type) {
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 4e79c086d4d..26651d76f68 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -1819,7 +1819,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
}
/* cleanup the buffer. */
- BLF_buffer(mono, NULL, NULL, 0, 0, 0, FALSE);
+ BLF_buffer(mono, NULL, NULL, 0, 0, 0, NULL);
#undef BUFF_MARGIN_X
#undef BUFF_MARGIN_Y
@@ -3379,7 +3379,7 @@ void BKE_image_get_aspect(Image *image, float *aspx, float *aspy)
unsigned char *BKE_image_get_pixels_for_frame(struct Image *image, int frame)
{
- ImageUser iuser = {0};
+ ImageUser iuser = {NULL};
void *lock;
ImBuf *ibuf;
unsigned char *pixels = NULL;
@@ -3406,7 +3406,7 @@ unsigned char *BKE_image_get_pixels_for_frame(struct Image *image, int frame)
float *BKE_image_get_float_pixels_for_frame(struct Image *image, int frame)
{
- ImageUser iuser = {0};
+ ImageUser iuser = {NULL};
void *lock;
ImBuf *ibuf;
float *pixels = NULL;
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index de176651c19..b36f484f4ee 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -1814,7 +1814,7 @@ void BKE_mesh_calc_normals_mapping_ex(MVert *mverts, int numVerts,
MLoop *mloop, MPoly *mpolys,
int numLoops, int numPolys, float (*polyNors_r)[3],
MFace *mfaces, int numFaces, int *origIndexFace, float (*faceNors_r)[3],
- const short only_face_normals)
+ const bool only_face_normals)
{
float (*pnors)[3] = polyNors_r, (*fnors)[3] = faceNors_r;
int i;
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index b0566a6495f..9b8101cdad4 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -95,7 +95,7 @@ ModifierData *modifier_new(int type)
ModifierData *md = MEM_callocN(mti->structSize, mti->structName);
/* note, this name must be made unique later */
- BLI_strncpy(md->name, mti->name, sizeof(md->name));
+ BLI_strncpy(md->name, DATA_(mti->name), sizeof(md->name));
md->type = type;
md->mode = eModifierMode_Realtime | eModifierMode_Render | eModifierMode_Expanded;
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c
index 821c8fe3bda..49a64d8e478 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -457,7 +457,29 @@ static ImBuf *get_imbuf_cache(MovieClip *clip, MovieClipUser *user, int flag)
return NULL;
}
-static void put_imbuf_cache(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf, int flag)
+static int has_imbuf_cache(MovieClip *clip, MovieClipUser *user, int flag)
+{
+ if (clip->cache) {
+ MovieClipImBufCacheKey key;
+
+ key.framenr = user->framenr;
+
+ if (flag & MCLIP_USE_PROXY) {
+ key.proxy = rendersize_to_proxy(user, flag);
+ key.render_flag = user->render_flag;
+ }
+ else {
+ key.proxy = IMB_PROXY_NONE;
+ key.render_flag = 0;
+ }
+
+ return IMB_moviecache_has_frame(clip->cache->moviecache, &key);
+ }
+
+ return FALSE;
+}
+
+static bool put_imbuf_cache(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf, int flag, bool destructive)
{
MovieClipImBufCacheKey key;
@@ -489,7 +511,13 @@ static void put_imbuf_cache(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf, i
key.render_flag = 0;
}
- IMB_moviecache_put(clip->cache->moviecache, &key, ibuf);
+ if (destructive) {
+ IMB_moviecache_put(clip->cache->moviecache, &key, ibuf);
+ return true;
+ }
+ else {
+ return IMB_moviecache_put_if_possible(clip->cache->moviecache, &key, ibuf);
+ }
}
/*********************** common functions *************************/
@@ -814,7 +842,7 @@ static ImBuf *movieclip_get_postprocessed_ibuf(MovieClip *clip, MovieClipUser *u
}
if (ibuf && (cache_flag & MOVIECLIP_CACHE_SKIP) == 0)
- put_imbuf_cache(clip, user, ibuf, flag);
+ put_imbuf_cache(clip, user, ibuf, flag, true);
}
if (ibuf) {
@@ -1111,6 +1139,7 @@ void BKE_movieclip_reload(MovieClip *clip)
free_buffers(clip);
clip->tracking.stabilization.ok = FALSE;
+ clip->prefetch_ok = FALSE;
/* update clip source */
detect_clip_source(clip);
@@ -1420,13 +1449,58 @@ float BKE_movieclip_remap_clip_to_scene_frame(MovieClip *clip, float framenr)
return framenr + (float) clip->start_frame - 1.0f;
}
-void BKE_movieclip_filename_for_frame(MovieClip *clip, int framenr, char *name)
+void BKE_movieclip_filename_for_frame(MovieClip *clip, MovieClipUser *user, char *name)
{
- if (clip->source != MCLIP_SRC_MOVIE) {
- get_sequence_fname(clip, framenr, name);
+ if (clip->source == MCLIP_SRC_SEQUENCE) {
+ int use_proxy;
+
+ use_proxy = (clip->flag & MCLIP_USE_PROXY) && user->render_size != MCLIP_PROXY_RENDER_SIZE_FULL;
+
+ if (use_proxy) {
+ int undistort = user->render_flag & MCLIP_PROXY_RENDER_UNDISTORT;
+ get_proxy_fname(clip, user->render_size, undistort, user->framenr, name);
+ }
+ else {
+ get_sequence_fname(clip, user->framenr, name);
+ }
}
else {
BLI_strncpy(name, clip->name, FILE_MAX);
BLI_path_abs(name, ID_BLEND_PATH(G.main, &clip->id));
}
}
+
+ImBuf *BKE_movieclip_anim_ibuf_for_frame(MovieClip *clip, MovieClipUser *user)
+{
+ ImBuf *ibuf = NULL;
+
+ if (clip->source == MCLIP_SRC_MOVIE) {
+ BLI_lock_thread(LOCK_MOVIECLIP);
+ ibuf = movieclip_load_movie_file(clip, user, user->framenr, clip->flag);
+ BLI_unlock_thread(LOCK_MOVIECLIP);
+ }
+
+ return ibuf;
+}
+
+int BKE_movieclip_has_cached_frame(MovieClip *clip, MovieClipUser *user)
+{
+ int has_frame = FALSE;
+
+ BLI_lock_thread(LOCK_MOVIECLIP);
+ has_frame = has_imbuf_cache(clip, user, clip->flag);
+ BLI_unlock_thread(LOCK_MOVIECLIP);
+
+ return has_frame;
+}
+
+int BKE_movieclip_put_frame_if_possible(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf)
+{
+ bool result;
+
+ BLI_lock_thread(LOCK_MOVIECLIP);
+ result = put_imbuf_cache(clip, user, ibuf, clip->flag, false);
+ BLI_unlock_thread(LOCK_MOVIECLIP);
+
+ return result;
+}
diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c
index 722e1f2b918..88f534c581c 100644
--- a/source/blender/blenkernel/intern/multires.c
+++ b/source/blender/blenkernel/intern/multires.c
@@ -310,7 +310,7 @@ MultiresModifierData *find_multires_modifier_before(Scene *scene, ModifierData *
/* used for applying scale on mdisps layer and syncing subdivide levels when joining objects
* use_first - return first multires modifier if all multires'es are disabled
*/
-MultiresModifierData *get_multires_modifier(Scene *scene, Object *ob, int use_first)
+MultiresModifierData *get_multires_modifier(Scene *scene, Object *ob, bool use_first)
{
ModifierData *md;
MultiresModifierData *mmd = NULL, *firstmmd = NULL;
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 757571b9cf6..788b185c6eb 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -74,6 +74,11 @@
#include "NOD_shader.h"
#include "NOD_texture.h"
+/* Fallback types for undefined tree, nodes, sockets */
+bNodeTreeType NodeTreeTypeUndefined;
+bNodeType NodeTypeUndefined;
+bNodeSocketType NodeSocketTypeUndefined;
+
static void node_add_sockets_from_type(bNodeTree *ntree, bNode *node, bNodeType *ntype)
{
@@ -101,12 +106,11 @@ static void node_add_sockets_from_type(bNodeTree *ntree, bNode *node, bNodeType
/* Note: This function is called to initialize node data based on the type.
* The bNodeType may not be registered at creation time of the node,
* so this can be delayed until the node type gets registered.
- * The node->typeinfo must not be used in that case until it is defined!
*/
static void node_init(const struct bContext *C, bNodeTree *ntree, bNode *node)
{
bNodeType *ntype = node->typeinfo;
- if (!ntype)
+ if (ntype == &NodeTypeUndefined)
return;
/* only do this once */
@@ -151,22 +155,24 @@ static void node_init(const struct bContext *C, bNodeTree *ntree, bNode *node)
static void ntree_set_typeinfo(bNodeTree *ntree, bNodeTreeType *typeinfo)
{
- ntree->typeinfo = typeinfo;
-
if (typeinfo) {
+ ntree->typeinfo = typeinfo;
+
/* deprecated integer type */
ntree->type = typeinfo->type;
}
else {
+ ntree->typeinfo = &NodeTreeTypeUndefined;
+
ntree->init &= ~NTREE_TYPE_INIT;
}
}
static void node_set_typeinfo(const struct bContext *C, bNodeTree *ntree, bNode *node, bNodeType *typeinfo)
{
- node->typeinfo = typeinfo;
-
if (typeinfo) {
+ node->typeinfo = typeinfo;
+
/* deprecated integer type */
node->type = typeinfo->type;
@@ -174,21 +180,25 @@ static void node_set_typeinfo(const struct bContext *C, bNodeTree *ntree, bNode
node_init(C, ntree, node);
}
else {
+ node->typeinfo = &NodeTypeUndefined;
+
ntree->init &= ~NTREE_TYPE_INIT;
}
}
static void node_socket_set_typeinfo(bNodeTree *ntree, bNodeSocket *sock, bNodeSocketType *typeinfo)
{
- sock->typeinfo = typeinfo;
-
if (typeinfo) {
+ sock->typeinfo = typeinfo;
+
if (sock->default_value == NULL) {
/* initialize the default_value pointer used by standard socket types */
node_socket_init_default_value(sock);
}
}
else {
+ sock->typeinfo = &NodeSocketTypeUndefined;
+
ntree->init &= ~NTREE_TYPE_INIT;
}
}
@@ -301,14 +311,14 @@ void ntreeTypeFreeLink(bNodeTreeType *nt)
BLI_ghash_remove(nodetreetypes_hash, nt->idname, NULL, ntree_free_type);
}
-GHashIterator *ntreeTypeGetIterator(void)
+bool ntreeIsRegistered(bNodeTree *ntree)
{
- return BLI_ghashIterator_new(nodetreetypes_hash);
+ return (ntree->typeinfo != &NodeTreeTypeUndefined);
}
-int ntreeIsValid(bNodeTree *ntree)
+GHashIterator *ntreeTypeGetIterator(void)
{
- return (ntree && (ntree->init & NTREE_TYPE_INIT));
+ return BLI_ghashIterator_new(nodetreetypes_hash);
}
bNodeType *nodeTypeFind(const char *idname)
@@ -370,6 +380,11 @@ void nodeUnregisterType(bNodeType *nt)
BLI_ghash_remove(nodetypes_hash, nt->idname, NULL, node_free_type);
}
+bool nodeIsRegistered(bNode *node)
+{
+ return (node->typeinfo != &NodeTypeUndefined);
+}
+
GHashIterator *nodeTypeGetIterator(void)
{
return BLI_ghashIterator_new(nodetypes_hash);
@@ -410,6 +425,11 @@ void nodeUnregisterSocketType(bNodeSocketType *st)
BLI_ghash_remove(nodesockettypes_hash, st->idname, NULL, node_free_socket_type);
}
+bool nodeSocketIsRegistered(bNodeSocket *sock)
+{
+ return (sock->typeinfo != &NodeSocketTypeUndefined);
+}
+
GHashIterator *nodeSocketTypeGetIterator(void)
{
return BLI_ghashIterator_new(nodesockettypes_hash);
@@ -1329,7 +1349,7 @@ static void node_preview_init_tree_recursive(bNodeInstanceHash *previews, bNodeT
BKE_node_preview_verify(previews, key, xsize, ysize, create);
}
- if (node->type == NODE_GROUP)
+ if (node->type == NODE_GROUP && node->id)
node_preview_init_tree_recursive(previews, (bNodeTree *)node->id, key, xsize, ysize, create);
}
}
@@ -1354,7 +1374,7 @@ static void node_preview_tag_used_recursive(bNodeInstanceHash *previews, bNodeTr
if (BKE_node_preview_used(node))
BKE_node_instance_hash_tag_key(previews, key);
- if (node->type == NODE_GROUP)
+ if (node->type == NODE_GROUP && node->id)
node_preview_tag_used_recursive(previews, (bNodeTree *)node->id, key);
}
}
@@ -1433,18 +1453,38 @@ void BKE_node_preview_sync_tree(bNodeTree *to_ntree, bNodeTree *from_ntree)
}
}
-void BKE_node_preview_merge_tree(bNodeTree *to_ntree, bNodeTree *from_ntree)
+void BKE_node_preview_merge_tree(bNodeTree *to_ntree, bNodeTree *from_ntree, bool remove_old)
{
- /* free old previews */
- if (to_ntree->previews)
- BKE_node_instance_hash_free(to_ntree->previews, (bNodeInstanceValueFP)BKE_node_preview_free);
-
- /* transfer previews */
- to_ntree->previews = from_ntree->previews;
- from_ntree->previews = NULL;
-
- /* clean up, in case any to_ntree nodes have been removed */
- BKE_node_preview_remove_unused(to_ntree);
+ if (remove_old || !to_ntree->previews) {
+ /* free old previews */
+ if (to_ntree->previews)
+ BKE_node_instance_hash_free(to_ntree->previews, (bNodeInstanceValueFP)BKE_node_preview_free);
+
+ /* transfer previews */
+ to_ntree->previews = from_ntree->previews;
+ from_ntree->previews = NULL;
+
+ /* clean up, in case any to_ntree nodes have been removed */
+ BKE_node_preview_remove_unused(to_ntree);
+ }
+ else {
+ bNodeInstanceHashIterator iter;
+
+ if (from_ntree->previews) {
+ NODE_INSTANCE_HASH_ITER(iter, from_ntree->previews) {
+ bNodeInstanceKey key = BKE_node_instance_hash_iterator_get_key(&iter);
+ bNodePreview *preview = BKE_node_instance_hash_iterator_get_value(&iter);
+
+ /* replace existing previews */
+ BKE_node_instance_hash_remove(to_ntree->previews, key, (bNodeInstanceValueFP)BKE_node_preview_free);
+ BKE_node_instance_hash_insert(to_ntree->previews, key, preview);
+ }
+
+ /* Note: NULL free function here, because pointers have already been moved over to to_ntree->previews! */
+ BKE_node_instance_hash_free(from_ntree->previews, NULL);
+ from_ntree->previews = NULL;
+ }
+ }
}
/* hack warning! this function is only used for shader previews, and
@@ -1887,7 +1927,7 @@ int ntreeOutputExists(bNode *node, bNodeSocket *testsock)
/* returns localized tree for execution in threads */
bNodeTree *ntreeLocalize(bNodeTree *ntree)
{
- if (ntreeIsValid(ntree)) {
+ if (ntree) {
bNodeTree *ltree;
bNode *node;
@@ -1944,13 +1984,7 @@ bNodeTree *ntreeLocalize(bNodeTree *ntree)
/* is called by jobs manager, outside threads, so it doesnt happen during draw */
void ntreeLocalSync(bNodeTree *localtree, bNodeTree *ntree)
{
- if (localtree && ntreeIsValid(ntree)) {
- /* XXX syncing was disabled for compositor nodes.
- * It has to be ensured that there is no concurrent read/write access!
- * Possibly needs a mutex lock or a flag to disable for certain tree types ...
- */
- BKE_node_preview_sync_tree(ntree, localtree);
-
+ if (localtree && ntree) {
if (ntree->typeinfo->local_sync)
ntree->typeinfo->local_sync(localtree, ntree);
}
@@ -1960,9 +1994,7 @@ void ntreeLocalSync(bNodeTree *localtree, bNodeTree *ntree)
/* we have to assume the editor already changed completely */
void ntreeLocalMerge(bNodeTree *localtree, bNodeTree *ntree)
{
- if (localtree && ntreeIsValid(ntree)) {
- BKE_node_preview_merge_tree(ntree, localtree);
-
+ if (localtree && ntree) {
if (ntree->typeinfo->local_merge)
ntree->typeinfo->local_merge(localtree, ntree);
@@ -2006,14 +2038,14 @@ static bNodeSocket *make_socket_template(bNodeTree *ntree, int in_out,
* but reconstructing own_index in writefile.c would require parsing the identifier string.
*/
-#if (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 406))
+#if (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 406)) || defined(__clang__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
sock->own_index = own_index;
-#if (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 406))
+#if (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 406)) || defined(__clang__)
# pragma GCC diagnostic pop
#endif
@@ -2425,7 +2457,7 @@ typedef struct bNodeClipboard {
int type;
} bNodeClipboard;
-bNodeClipboard node_clipboard = {{0}};
+static bNodeClipboard node_clipboard = {{NULL}};
void BKE_node_clipboard_init(struct bNodeTree *ntree)
{
@@ -2831,11 +2863,8 @@ void ntreeVerifyNodes(struct Main *main, struct ID *id)
FOREACH_NODETREE(main, ntree, owner_id) {
bNode *node;
- if (!ntreeIsValid(ntree))
- return;
-
for (node = ntree->nodes.first; node; node = node->next)
- if (node->typeinfo && node->typeinfo->verifyfunc)
+ if (node->typeinfo->verifyfunc)
node->typeinfo->verifyfunc(ntree, node, id);
} FOREACH_NODETREE_END
}
@@ -2844,15 +2873,14 @@ void ntreeUpdateTree(bNodeTree *ntree)
{
bNode *node;
+ if (!ntree)
+ return;
+
/* avoid reentrant updates, can be caused by RNA update callbacks */
if (ntree->is_updating)
return;
ntree->is_updating = TRUE;
- /* only if types are initialized */
- if (!ntreeIsValid(ntree))
- return;
-
if (ntree->update & (NTREE_UPDATE_LINKS | NTREE_UPDATE_NODES)) {
/* set the bNodeSocket->link pointers */
ntree_update_link_pointers(ntree);
@@ -3239,6 +3267,34 @@ void node_type_compatibility(struct bNodeType *ntype, short compatibility)
ntype->compatibility = compatibility;
}
+/* callbacks for undefined types */
+
+static int node_undefined_poll(bNodeType *UNUSED(ntype), bNodeTree *UNUSED(nodetree))
+{
+ /* this type can not be added deliberately, it's just a placeholder */
+ return false;
+}
+
+/* register fallback types used for undefined tree, nodes, sockets */
+static void register_undefined_types(void)
+{
+ /* Note: these types are not registered in the type hashes,
+ * they are just used as placeholders in case the actual types are not registered.
+ */
+
+ strcpy(NodeTreeTypeUndefined.idname, "NodeTreeUndefined");
+ strcpy(NodeTreeTypeUndefined.ui_name, "Undefined");
+ strcpy(NodeTreeTypeUndefined.ui_description, "Undefined Node Tree Type");
+
+ node_type_base_custom(&NodeTypeUndefined, "NodeUndefined", "Undefined", 0, 0);
+ NodeTypeUndefined.poll = node_undefined_poll;
+
+ BLI_strncpy(NodeSocketTypeUndefined.idname, "NodeSocketUndefined", sizeof(NodeSocketTypeUndefined.idname));
+ /* extra type info for standard socket types */
+ NodeSocketTypeUndefined.type = SOCK_CUSTOM;
+ NodeSocketTypeUndefined.subtype = PROP_NONE;
+}
+
static void registerCompositNodes(void)
{
register_node_type_cmp_group();
@@ -3464,6 +3520,8 @@ void init_nodesystem(void)
nodetypes_hash = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "nodetypes_hash gh");
nodesockettypes_hash = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "nodesockettypes_hash gh");
+ register_undefined_types();
+
register_standard_node_socket_types();
register_node_tree_type_cmp();
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 20a5daf7116..f3655e94eb0 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -65,6 +65,8 @@
#include "BLI_utildefines.h"
#include "BLI_linklist.h"
+#include "BLF_translation.h"
+
#include "BKE_pbvh.h"
#include "BKE_main.h"
#include "BKE_global.h"
@@ -865,20 +867,20 @@ void *BKE_object_obdata_add_from_type(int type)
static const char *get_obdata_defname(int type)
{
switch (type) {
- case OB_MESH: return "Mesh";
- case OB_CURVE: return "Curve";
- case OB_SURF: return "Surf";
- case OB_FONT: return "Text";
- case OB_MBALL: return "Mball";
- case OB_CAMERA: return "Camera";
- case OB_LAMP: return "Lamp";
- case OB_LATTICE: return "Lattice";
- case OB_ARMATURE: return "Armature";
- case OB_SPEAKER: return "Speaker";
- case OB_EMPTY: return "Empty";
+ case OB_MESH: return DATA_("Mesh");
+ case OB_CURVE: return DATA_("Curve");
+ case OB_SURF: return DATA_("Surf");
+ case OB_FONT: return DATA_("Text");
+ case OB_MBALL: return DATA_("Mball");
+ case OB_CAMERA: return DATA_("Camera");
+ case OB_LAMP: return DATA_("Lamp");
+ case OB_LATTICE: return DATA_("Lattice");
+ case OB_ARMATURE: return DATA_("Armature");
+ case OB_SPEAKER: return DATA_("Speaker");
+ case OB_EMPTY: return DATA_("Empty");
default:
printf("get_obdata_defname: Internal error, bad type: %d\n", type);
- return "Empty";
+ return DATA_("Empty");
}
}
@@ -1589,7 +1591,7 @@ void BKE_object_scale_to_mat3(Object *ob, float mat[3][3])
size_to_mat3(mat, vec);
}
-void BKE_object_rot_to_mat3(Object *ob, float mat[3][3], short use_drot)
+void BKE_object_rot_to_mat3(Object *ob, float mat[3][3], bool use_drot)
{
float rmat[3][3], dmat[3][3];
@@ -1626,7 +1628,7 @@ void BKE_object_rot_to_mat3(Object *ob, float mat[3][3], short use_drot)
copy_m3_m3(mat, rmat);
}
-void BKE_object_mat3_to_rot(Object *ob, float mat[3][3], short use_compat)
+void BKE_object_mat3_to_rot(Object *ob, float mat[3][3], bool use_compat)
{
switch (ob->rotmode) {
case ROT_MODE_QUAT:
@@ -1729,7 +1731,7 @@ void BKE_object_tfm_protected_restore(Object *ob,
}
/* see BKE_pchan_apply_mat4() for the equivalent 'pchan' function */
-void BKE_object_apply_mat4(Object *ob, float mat[4][4], const short use_compat, const short use_parent)
+void BKE_object_apply_mat4(Object *ob, float mat[4][4], const bool use_compat, const bool use_parent)
{
float rot[3][3];
@@ -2370,7 +2372,7 @@ void BKE_object_dimensions_set(Object *ob, const float *value)
}
}
-void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3], const short use_hidden)
+void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3], const bool use_hidden)
{
BoundBox bb;
float vec[3];
@@ -2474,7 +2476,7 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3], const short u
}
}
-int BKE_object_minmax_dupli(Scene *scene, Object *ob, float r_min[3], float r_max[3], const short use_hidden)
+int BKE_object_minmax_dupli(Scene *scene, Object *ob, float r_min[3], float r_max[3], const bool use_hidden)
{
int ok = FALSE;
if ((ob->transflag & OB_DUPLI) == 0) {
@@ -2486,7 +2488,7 @@ int BKE_object_minmax_dupli(Scene *scene, Object *ob, float r_min[3], float r_ma
lb = object_duplilist(scene, ob, FALSE);
for (dob = lb->first; dob; dob = dob->next) {
- if ((use_hidden == FALSE) && (dob->no_draw != 0)) {
+ if ((use_hidden == false) && (dob->no_draw != 0)) {
/* pass */
}
else {
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index f90fde983aa..d9dabf24ba0 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -56,6 +56,8 @@
#include "BLI_threads.h"
#include "BLI_linklist.h"
+#include "BLF_translation.h"
+
#include "BKE_anim.h"
#include "BKE_animsys.h"
@@ -3488,17 +3490,19 @@ ModifierData *object_add_particle_system(Scene *scene, Object *ob, const char *n
psys->pointcache = BKE_ptcache_add(&psys->ptcaches);
BLI_addtail(&ob->particlesystem, psys);
- psys->part = psys_new_settings("ParticleSettings", NULL);
+ psys->part = psys_new_settings(DATA_("ParticleSettings"), NULL);
if (BLI_countlist(&ob->particlesystem) > 1)
- BLI_snprintf(psys->name, sizeof(psys->name), "ParticleSystem %i", BLI_countlist(&ob->particlesystem));
+ BLI_snprintf(psys->name, sizeof(psys->name), DATA_("ParticleSystem %i"), BLI_countlist(&ob->particlesystem));
else
- strcpy(psys->name, "ParticleSystem");
+ strcpy(psys->name, DATA_("ParticleSystem"));
md = modifier_new(eModifierType_ParticleSystem);
- if (name) BLI_strncpy_utf8(md->name, name, sizeof(md->name));
- else BLI_snprintf(md->name, sizeof(md->name), "ParticleSystem %i", BLI_countlist(&ob->particlesystem));
+ if (name)
+ BLI_strncpy_utf8(md->name, name, sizeof(md->name));
+ else
+ BLI_snprintf(md->name, sizeof(md->name), DATA_("ParticleSystem %i"), BLI_countlist(&ob->particlesystem));
modifier_unique_name(&ob->modifiers, md);
psmd = (ParticleSystemModifierData *) md;
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 435e81556ab..0863517c7d7 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -1303,9 +1303,17 @@ static void adjustDomainResolution(SmokeDomainSettings *sds, int new_shift[3], E
int x, y, z, i;
float *density = smoke_get_density(sds->fluid);
float *fuel = smoke_get_fuel(sds->fluid);
+ float *bigdensity = smoke_turbulence_get_density(sds->wt);
+ float *bigfuel = smoke_turbulence_get_fuel(sds->wt);
float *vx = smoke_get_velocity_x(sds->fluid);
float *vy = smoke_get_velocity_y(sds->fluid);
float *vz = smoke_get_velocity_z(sds->fluid);
+ int block_size = sds->amplify + 1;
+ int wt_res[3];
+
+ if (sds->flags & MOD_SMOKE_HIGHRES && sds->wt) {
+ smoke_turbulence_get_res(sds->wt, wt_res);
+ }
INIT_MINMAX(min_vel, max_vel);
@@ -1317,8 +1325,35 @@ static void adjustDomainResolution(SmokeDomainSettings *sds, int new_shift[3], E
int xn = x - new_shift[0];
int yn = y - new_shift[1];
int zn = z - new_shift[2];
- int index = smoke_get_index(x - sds->res_min[0], sds->res[0], y - sds->res_min[1], sds->res[1], z - sds->res_min[2]);
- float max_den = (fuel) ? MAX2(density[index], fuel[index]) : density[index];
+ int index;
+ float max_den;
+
+ /* skip if cell already belongs to new area */
+ if (xn >= min[0] && xn <= max[0] && yn >= min[1] && yn <= max[1] && zn >= min[2] && zn <= max[2])
+ continue;
+
+ index = smoke_get_index(x - sds->res_min[0], sds->res[0], y - sds->res_min[1], sds->res[1], z - sds->res_min[2]);
+ max_den = (fuel) ? MAX2(density[index], fuel[index]) : density[index];
+
+ /* check high resolution bounds if max density isnt already high enough */
+ if (max_den < sds->adapt_threshold && sds->flags & MOD_SMOKE_HIGHRES && sds->wt) {
+ int i, j, k;
+ /* high res grid index */
+ int xx = (x - sds->res_min[0]) * block_size;
+ int yy = (y - sds->res_min[1]) * block_size;
+ int zz = (z - sds->res_min[2]) * block_size;
+
+ for (i = 0; i < block_size; i++)
+ for (j = 0; j < block_size; j++)
+ for (k = 0; k < block_size; k++)
+ {
+ int big_index = smoke_get_index(xx + i, wt_res[0], yy + j, wt_res[1], zz + k);
+ float den = (bigfuel) ? MAX2(bigdensity[big_index], bigfuel[big_index]) : bigdensity[big_index];
+ if (den > max_den) {
+ max_den = den;
+ }
+ }
+ }
/* content bounds (use shifted coordinates) */
if (max_den >= sds->adapt_threshold) {
@@ -1329,6 +1364,7 @@ static void adjustDomainResolution(SmokeDomainSettings *sds, int new_shift[3], E
if (max[1] < yn) max[1] = yn;
if (max[2] < zn) max[2] = zn;
}
+
/* velocity bounds */
if (min_vel[0] > vx[index]) min_vel[0] = vx[index];
if (min_vel[1] > vy[index]) min_vel[1] = vy[index];
diff --git a/source/blender/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c
index d4428be3faf..ff6212f6b09 100644
--- a/source/blender/blenkernel/intern/writeavi.c
+++ b/source/blender/blenkernel/intern/writeavi.c
@@ -73,7 +73,7 @@ static void filepath_avi(char *string, RenderData *rd);
bMovieHandle *BKE_movie_handle_get(const char imtype)
{
- static bMovieHandle mh = {0};
+ static bMovieHandle mh = {NULL};
/* set the default handle, as builtin */
#ifdef WITH_AVI
diff --git a/source/blender/blenkernel/nla_private.h b/source/blender/blenkernel/nla_private.h
index f068c4c58f0..2e38e33a308 100644
--- a/source/blender/blenkernel/nla_private.h
+++ b/source/blender/blenkernel/nla_private.h
@@ -49,7 +49,7 @@ typedef struct NlaEvalStrip {
} NlaEvalStrip;
/* NlaEvalStrip->strip_mode */
-enum {
+enum eNlaEvalStrip_StripMode {
/* standard evaluation */
NES_TIME_BEFORE = -1,
NES_TIME_WITHIN,
@@ -58,7 +58,7 @@ enum {
/* transition-strip evaluations */
NES_TIME_TRANSITION_START,
NES_TIME_TRANSITION_END,
-} eNlaEvalStrip_StripMode;
+};
/* temp channel for accumulating data from NLA (avoids needing to clear all values first) */
diff --git a/source/blender/blenlib/BLI_callbacks.h b/source/blender/blenlib/BLI_callbacks.h
index 1e95510f6ec..e3d5a80b27f 100644
--- a/source/blender/blenlib/BLI_callbacks.h
+++ b/source/blender/blenlib/BLI_callbacks.h
@@ -54,7 +54,7 @@ typedef enum {
} eCbEvent;
-typedef struct {
+typedef struct bCallbackFuncStore {
struct bCallbackFuncStore *next, *prev;
void (*func)(struct Main *, struct ID *, void *arg);
void *arg;
diff --git a/source/blender/blenlib/BLI_gsqueue.h b/source/blender/blenlib/BLI_gsqueue.h
index b9d8a8f9d14..e002545d189 100644
--- a/source/blender/blenlib/BLI_gsqueue.h
+++ b/source/blender/blenlib/BLI_gsqueue.h
@@ -36,63 +36,13 @@
typedef struct _GSQueue GSQueue;
-/**
- * Create a new GSQueue.
- *
- * \param elem_size The size of the structures in the queue.
- * \retval The new queue
- */
GSQueue *BLI_gsqueue_new(int elem_size);
-
-/**
- * Query if the queue is empty
- */
bool BLI_gsqueue_is_empty(GSQueue *gq);
-
-/**
- * Query number elements in the queue
- */
int BLI_gsqueue_size(GSQueue *gq);
-
-/**
- * Access the item at the head of the queue
- * without removing it.
- *
- * \param item_r A pointer to an appropriately
- * sized structure (the size passed to BLI_gsqueue_new)
- */
void BLI_gsqueue_peek(GSQueue *gq, void *item_r);
-
-/**
- * Access the item at the head of the queue
- * and remove it.
- *
- * \param item_r A pointer to an appropriately
- * sized structure (the size passed to BLI_gsqueue_new).
- * Can be NULL if desired.
- */
void BLI_gsqueue_pop(GSQueue *gq, void *item_r);
-
-/**
- * Push an element onto the tail of the queue.
- *
- * \param item A pointer to an appropriately
- * sized structure (the size passed to BLI_gsqueue_new).
- */
void BLI_gsqueue_push(GSQueue *gq, void *item);
-
-/**
- * Push an element back onto the head of the queue (so
- * it would be returned from the next call to BLI_gsqueue_pop).
- *
- * \param item A pointer to an appropriately
- * sized structure (the size passed to BLI_gsqueue_new).
- */
void BLI_gsqueue_pushback(GSQueue *gq, void *item);
-
-/**
- * Free the queue
- */
void BLI_gsqueue_free(GSQueue *gq);
#endif /* __BLI_GSQUEUE_H__ */
diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h
index 94fa88801f0..7028c7c7530 100644
--- a/source/blender/blenlib/BLI_math_geom.h
+++ b/source/blender/blenlib/BLI_math_geom.h
@@ -118,7 +118,7 @@ int isect_ray_plane_v3(const float p1[3], const float d[3],
float *r_lambda, const int clip);
int isect_line_plane_v3(float out[3], const float l1[3], const float l2[3],
- const float plane_co[3], const float plane_no[3], const short no_flip);
+ const float plane_co[3], const float plane_no[3], const bool no_flip);
void isect_plane_plane_v3(float r_isect_co[3], float r_isect_no[3],
const float plane_a_co[3], const float plane_a_no[3],
@@ -170,7 +170,7 @@ int isect_axial_line_tri_v3(const int axis, const float co1[3], const float co2[
int clip_line_plane(float p1[3], float p2[3], const float plane[4]);
-void plot_line_v2v2i(const int p1[2], const int p2[2], int (*callback)(int, int, void *), void *userData);
+void plot_line_v2v2i(const int p1[2], const int p2[2], bool (*callback)(int, int, void *), void *userData);
/****************************** Interpolation ********************************/
diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h
index 136a51cf55e..1ba3c8b619c 100644
--- a/source/blender/blenlib/BLI_path_util.h
+++ b/source/blender/blenlib/BLI_path_util.h
@@ -170,14 +170,6 @@ bool BLI_path_is_rel(const char *path);
# define BLI_path_ncmp strncmp
#endif
-/**
- * Change every \a from in \a string into \a to. The
- * result will be in \a string
- *
- * \a string The string to work on
- * \a from The character to replace
- * \a to The character to replace with
- */
void BLI_char_switch(char *string, char from, char to)
#ifdef __GNUC__
__attribute__((nonnull(1)))
@@ -190,13 +182,9 @@ void BLI_init_program_path(const char *argv0);
* NOTE: On Window userdir will be set to the temporary directory! */
void BLI_init_temporary_dir(char *userdir);
-/* Path to executable */
const char *BLI_program_path(void);
-/* Path to directory of executable */
const char *BLI_program_dir(void);
-/* Path to temporary directory (with trailing slash) */
const char *BLI_temporary_dir(void);
-/* Path to the system temporary directory (with trailing slash) */
void BLI_system_temporary_dir(char *dir);
#ifdef WITH_ICONV
diff --git a/source/blender/blenlib/BLI_rect.h b/source/blender/blenlib/BLI_rect.h
index 9ce75de5ea8..ac0ae22c656 100644
--- a/source/blender/blenlib/BLI_rect.h
+++ b/source/blender/blenlib/BLI_rect.h
@@ -54,6 +54,8 @@ void BLI_rctf_do_minmax_v(struct rctf *rect, const float xy[2]);
void BLI_rctf_translate(struct rctf *rect, float x, float y);
void BLI_rcti_translate(struct rcti *rect, int x, int y);
+void BLI_rcti_recenter(struct rcti *rect, int x, int y);
+void BLI_rctf_recenter(struct rctf *rect, float x, float y);
void BLI_rcti_resize(struct rcti *rect, int x, int y);
void BLI_rctf_resize(struct rctf *rect, float x, float y);
void BLI_rcti_scale(rcti *rect, const float scale);
diff --git a/source/blender/blenlib/BLI_vfontdata.h b/source/blender/blenlib/BLI_vfontdata.h
index ed7d10ab257..b0a57ee9288 100644
--- a/source/blender/blenlib/BLI_vfontdata.h
+++ b/source/blender/blenlib/BLI_vfontdata.h
@@ -53,14 +53,6 @@ typedef struct VChar {
float *points;
} VChar;
-/**
- * Construct a new VFontData structure from
- * Freetype font data in a PackedFile.
- *
- * \param pf The font data.
- * \retval A new VFontData structure, or NULL
- * if unable to load.
- */
VFontData *BLI_vfontdata_from_freetypefont(struct PackedFile *pf);
int BLI_vfontchar_from_freetypefont(struct VFont *vfont, unsigned long character);
diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c
index 29280c36222..8b3cfd07ee9 100644
--- a/source/blender/blenlib/intern/fileops.c
+++ b/source/blender/blenlib/intern/fileops.c
@@ -423,7 +423,7 @@ enum {
/* error occured in callback and recursive walking should stop immediately */
RecursiveOp_Callback_Error = 2
-} recuresiveOp_Callback_Result;
+};
typedef int (*RecursiveOp_Callback)(const char *from, const char *to);
@@ -498,7 +498,7 @@ static int recursive_operation(const char *startfrom, const char *startto,
break;
}
- n = scandir(startfrom, &dirlist, 0, alphasort);
+ n = scandir(startfrom, &dirlist, NULL, alphasort);
if (n < 0) {
/* error opening directory for listing */
perror("scandir");
diff --git a/source/blender/blenlib/intern/freetypefont.c b/source/blender/blenlib/intern/freetypefont.c
index 2b3e2d233d9..24a8edae325 100644
--- a/source/blender/blenlib/intern/freetypefont.c
+++ b/source/blender/blenlib/intern/freetypefont.c
@@ -467,7 +467,14 @@ static int check_freetypefont(PackedFile *pf)
return success;
}
-
+/**
+ * Construct a new VFontData structure from
+ * Freetype font data in a PackedFile.
+ *
+ * \param pf The font data.
+ * \retval A new VFontData structure, or NULL
+ * if unable to load.
+ */
VFontData *BLI_vfontdata_from_freetypefont(PackedFile *pf)
{
VFontData *vfd = NULL;
diff --git a/source/blender/blenlib/intern/gsqueue.c b/source/blender/blenlib/intern/gsqueue.c
index 272f840296e..7f158bc3efb 100644
--- a/source/blender/blenlib/intern/gsqueue.c
+++ b/source/blender/blenlib/intern/gsqueue.c
@@ -47,6 +47,12 @@ struct _GSQueue {
int elem_size;
};
+/**
+ * Create a new GSQueue.
+ *
+ * \param elem_size The size of the structures in the queue.
+ * \retval The new queue
+ */
GSQueue *BLI_gsqueue_new(int elem_size)
{
GSQueue *gq = MEM_mallocN(sizeof(*gq), "gqueue_new");
@@ -56,11 +62,17 @@ GSQueue *BLI_gsqueue_new(int elem_size)
return gq;
}
+/**
+ * Query if the queue is empty
+ */
bool BLI_gsqueue_is_empty(GSQueue *gq)
{
return (gq->head == NULL);
}
+/**
+ * Query number elements in the queue
+ */
int BLI_gsqueue_size(GSQueue *gq)
{
GSQueueElem *elem;
@@ -72,10 +84,26 @@ int BLI_gsqueue_size(GSQueue *gq)
return size;
}
+/**
+ * Access the item at the head of the queue
+ * without removing it.
+ *
+ * \param item_r A pointer to an appropriately
+ * sized structure (the size passed to BLI_gsqueue_new)
+ */
void BLI_gsqueue_peek(GSQueue *gq, void *item_r)
{
memcpy(item_r, &gq->head[1], gq->elem_size);
}
+
+/**
+ * Access the item at the head of the queue
+ * and remove it.
+ *
+ * \param item_r A pointer to an appropriately
+ * sized structure (the size passed to BLI_gsqueue_new).
+ * Can be NULL if desired.
+ */
void BLI_gsqueue_pop(GSQueue *gq, void *item_r)
{
GSQueueElem *elem = gq->head;
@@ -89,6 +117,13 @@ void BLI_gsqueue_pop(GSQueue *gq, void *item_r)
if (item_r) memcpy(item_r, &elem[1], gq->elem_size);
MEM_freeN(elem);
}
+
+/**
+ * Push an element onto the tail of the queue.
+ *
+ * \param item A pointer to an appropriately
+ * sized structure (the size passed to BLI_gsqueue_new).
+ */
void BLI_gsqueue_push(GSQueue *gq, void *item)
{
GSQueueElem *elem;
@@ -109,6 +144,14 @@ void BLI_gsqueue_push(GSQueue *gq, void *item)
gq->tail = gq->tail->next = elem;
}
}
+
+/**
+ * Push an element back onto the head of the queue (so
+ * it would be returned from the next call to BLI_gsqueue_pop).
+ *
+ * \param item A pointer to an appropriately
+ * sized structure (the size passed to BLI_gsqueue_new).
+ */
void BLI_gsqueue_pushback(GSQueue *gq, void *item)
{
GSQueueElem *elem = MEM_mallocN(sizeof(*elem) + gq->elem_size, "gqueue_push");
@@ -123,6 +166,9 @@ void BLI_gsqueue_pushback(GSQueue *gq, void *item)
}
}
+/**
+ * Free the queue
+ */
void BLI_gsqueue_free(GSQueue *gq)
{
while (gq->head) {
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index 173c6d06861..579f397f833 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -1087,7 +1087,7 @@ int isect_ray_tri_threshold_v3(const float p1[3], const float d[3],
*/
int isect_line_plane_v3(float out[3],
const float l1[3], const float l2[3],
- const float plane_co[3], const float plane_no[3], const short no_flip)
+ const float plane_co[3], const float plane_no[3], const bool no_flip)
{
float l_vec[3]; /* l1 -> l2 normalized vector */
float p_no[3]; /* 'plane_no' normalized */
@@ -1997,7 +1997,7 @@ int clip_line_plane(float p1[3], float p2[3], const float plane[4])
}
}
-void plot_line_v2v2i(const int p1[2], const int p2[2], int (*callback)(int, int, void *), void *userData)
+void plot_line_v2v2i(const int p1[2], const int p2[2], bool (*callback)(int, int, void *), void *userData)
{
int x1 = p1[0];
int y1 = p1[1];
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index c3bc35a906b..f9cf913157b 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -122,6 +122,7 @@ int BLI_stringdec(const char *string, char *head, char *tail, unsigned short *nu
if (found_digit) break;
}
}
+
if (found_digit) {
if (tail) strcpy(tail, &string[nume + 1]);
if (head) {
@@ -131,13 +132,14 @@ int BLI_stringdec(const char *string, char *head, char *tail, unsigned short *nu
if (numlen) *numlen = nume - nums + 1;
return ((int)atoi(&(string[nums])));
}
- if (tail) strcpy(tail, string + name_end);
- if (head) {
- strncpy(head, string, name_end);
- head[name_end] = '\0';
+ else {
+ if (tail) strcpy(tail, string + name_end);
+ if (head) {
+ BLI_strncpy(head, string, name_end);
+ }
+ if (numlen) *numlen = 0;
+ return 0;
}
- if (numlen) *numlen = 0;
- return 0;
}
@@ -1364,7 +1366,12 @@ void BLI_clean(char *path)
}
/**
- * Replaces occurrences of from with to in *string.
+ * Change every \a from in \a string into \a to. The
+ * result will be in \a string
+ *
+ * \param string The string to work on
+ * \param from The character to replace
+ * \param to The character to replace with
*/
void BLI_char_switch(char *string, char from, char to)
{
@@ -2060,11 +2067,17 @@ void BLI_init_program_path(const char *argv0)
BLI_split_dir_part(bprogname, bprogdir, sizeof(bprogdir));
}
+/**
+ * Path to executable
+ */
const char *BLI_program_path(void)
{
return bprogname;
}
+/**
+ * Path to directory of executable
+ */
const char *BLI_program_dir(void)
{
return bprogdir;
@@ -2137,7 +2150,7 @@ void BLI_init_temporary_dir(char *userdir)
}
/**
- * Returns the path to the temporary directory.
+ * Path to temporary directory (with trailing slash)
*/
const char *BLI_temporary_dir(void)
{
@@ -2145,7 +2158,7 @@ const char *BLI_temporary_dir(void)
}
/**
- * Puts in *dir path to OS-specific temporary directory.
+ * Path to the system temporary directory (with trailing slash)
*/
void BLI_system_temporary_dir(char *dir)
{
diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c
index 127855161c0..91fcb5a5b83 100644
--- a/source/blender/blenlib/intern/rct.c
+++ b/source/blender/blenlib/intern/rct.c
@@ -296,6 +296,19 @@ void BLI_rctf_translate(rctf *rect, float x, float y)
rect->ymax += y;
}
+void BLI_rcti_recenter(rcti *rect, int x, int y)
+{
+ const int dx = x - BLI_rcti_cent_x(rect);
+ const int dy = y - BLI_rcti_cent_y(rect);
+ BLI_rcti_translate(rect, dx, dy);
+}
+void BLI_rctf_recenter(rctf *rect, float x, float y)
+{
+ const float dx = x - BLI_rctf_cent_x(rect);
+ const float dy = y - BLI_rctf_cent_y(rect);
+ BLI_rctf_translate(rect, dx, dy);
+}
+
/* change width & height around the central location */
void BLI_rcti_resize(rcti *rect, int x, int y)
{
diff --git a/source/blender/blenlib/intern/voronoi.c b/source/blender/blenlib/intern/voronoi.c
index 601b07c9a5d..7a545090090 100644
--- a/source/blender/blenlib/intern/voronoi.c
+++ b/source/blender/blenlib/intern/voronoi.c
@@ -44,7 +44,7 @@
enum {
voronoiEventType_Site = 0,
voronoiEventType_Circle = 1
-} voronoiEventType;
+};
typedef struct VoronoiEvent {
struct VoronoiEvent *next, *prev;
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 2be1b958982..082702f6d9d 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -1020,7 +1020,7 @@ static int fd_read_gzip_from_memory(FileData *filedata, void *buffer, unsigned i
if (err == Z_STREAM_END) {
return 0;
}
- else if (err != Z_OK) {
+ else if (err != Z_OK) {
printf("fd_read_gzip_from_memory: zlib error\n");
return 0;
}
@@ -2459,9 +2459,13 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
*
* XXX this should actually be part of do_versions,
* but needs valid typeinfo pointers to create interface nodes.
+ *
+ * Note: theoretically only needed in node groups (main->nodetree),
+ * but due to a temporary bug such links could have been added in all trees,
+ * so have to clean up all of them ...
*/
- for (ntree = main->nodetree.first; ntree; ntree = ntree->id.next) {
+ FOREACH_NODETREE(main, ntree, id) {
if (ntree->flag & NTREE_DO_VERSIONS_CUSTOMNODES_GROUP) {
bNode *input_node = NULL, *output_node = NULL;
int num_inputs = 0, num_outputs = 0;
@@ -2541,6 +2545,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
ntree->flag &= ~(NTREE_DO_VERSIONS_CUSTOMNODES_GROUP | NTREE_DO_VERSIONS_CUSTOMNODES_GROUP_CREATE_INTERFACE);
}
}
+ FOREACH_NODETREE_END
}
/* verify all group user nodes */
@@ -6593,6 +6598,8 @@ static void direct_link_movieclip(FileData *fd, MovieClip *clip)
clip->tracking.dopesheet.channels.first = clip->tracking.dopesheet.channels.last = NULL;
clip->tracking.dopesheet.coverage_segments.first = clip->tracking.dopesheet.coverage_segments.last = NULL;
+ clip->prefetch_ok = FALSE;
+
link_list(fd, &tracking->objects);
for (object = tracking->objects.first; object; object = object->next) {
@@ -7742,10 +7749,21 @@ static void do_versions_userdef(FileData *fd, BlendFileData *bfd)
if (user == NULL) return;
+ if (MAIN_VERSION_OLDER(bmain, 266, 4)) {
+ bTheme *btheme;
+
+ /* themes for Node and Sequence editor were not using grid color, but back. we copy this over then */
+ for (btheme = user->themes.first; btheme; btheme = btheme->next) {
+ copy_v4_v4_char(btheme->tnode.grid, btheme->tnode.back);
+ copy_v4_v4_char(btheme->tseq.grid, btheme->tseq.back);
+ }
+ }
+
if (bmain->versionfile < 267) {
if (!DNA_struct_elem_find(fd->filesdna, "UserDef", "short", "image_gpubuffer_limit"))
- user->image_gpubuffer_limit = 10;
+ user->image_gpubuffer_limit = 20;
+
}
}
static void do_versions(FileData *fd, Library *lib, Main *main)
@@ -9158,13 +9176,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
} FOREACH_NODETREE_END
}
- if (!MAIN_VERSION_ATLEAST(main, 266, 2)) {
+ if (MAIN_VERSION_OLDER(main, 266, 2)) {
FOREACH_NODETREE(main, ntree, id) {
do_versions_nodetree_customnodes(ntree, ((ID *)ntree == id));
} FOREACH_NODETREE_END
}
- if (!MAIN_VERSION_ATLEAST(main, 266, 2)) {
+ if (MAIN_VERSION_OLDER(main, 266, 2)) {
bScreen *sc;
for (sc= main->screen.first; sc; sc= sc->id.next) {
ScrArea *sa;
@@ -9200,8 +9218,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* Set flag for delayed do_versions in lib_verify_nodetree. It needs valid typeinfo pointers ... */
{
- bNodeTree *ntree;
- for (ntree = main->nodetree.first; ntree; ntree = ntree->id.next) {
+ FOREACH_NODETREE(main, ntree, id) {
/* XXX This should be kept without version check for now!
* As long as USE_NODE_COMPAT_CUSTOMNODES is active, files will write links
* to tree interface sockets for forward compatibility. These links need to be removed again
@@ -9213,9 +9230,30 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* Only add interface nodes once.
* In old Blender versions they will be removed automatically due to undefined type */
- if (!MAIN_VERSION_ATLEAST(main, 266, 2))
+ if (MAIN_VERSION_OLDER(main, 266, 2))
ntree->flag |= NTREE_DO_VERSIONS_CUSTOMNODES_GROUP_CREATE_INTERFACE;
}
+ FOREACH_NODETREE_END
+ }
+
+ if (MAIN_VERSION_OLDER(main, 266, 3)) {
+ {
+ /* Fix for a very old issue:
+ * Node names were nominally made unique in r24478 (2.50.8), but the do_versions check
+ * to update existing node names only applied to main->nodetree (i.e. group nodes).
+ * Uniqueness is now required for proper preview mapping,
+ * so do this now to ensure old files don't break.
+ */
+ bNode *node;
+ FOREACH_NODETREE(main, ntree, id) {
+ if (id == &ntree->id)
+ continue; /* already fixed for node groups */
+
+ for (node = ntree->nodes.first; node; node = node->next)
+ nodeUniqueName(ntree, node);
+ }
+ FOREACH_NODETREE_END
+ }
}
if (main->versionfile < 267) {
@@ -10582,7 +10620,7 @@ static int object_in_any_scene(Main *mainvar, Object *ob)
return 0;
}
-static void give_base_to_objects(Main *mainvar, Scene *sce, Library *lib, const short idcode, const short is_link)
+static void give_base_to_objects(Main *mainvar, Scene *sce, Library *lib, const short idcode, const short is_link, const short active_lay)
{
Object *ob;
Base *base;
@@ -10626,6 +10664,9 @@ static void give_base_to_objects(Main *mainvar, Scene *sce, Library *lib, const
if (do_it) {
base = MEM_callocN(sizeof(Base), "add_ext_base");
BLI_addtail(&sce->base, base);
+
+ if (active_lay) ob->lay = sce->lay;
+
base->lay = ob->lay;
base->object = ob;
base->flag = ob->flag;
@@ -10884,7 +10925,7 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in
/* don't instance anything when linking in scenes, assume the scene its self instances the data */
}
else {
- give_base_to_objects(mainvar, scene, curlib, idcode, is_link);
+ give_base_to_objects(mainvar, scene, curlib, idcode, is_link, flag & FILE_ACTIVELAY);
if (flag & FILE_GROUP_INSTANCE) {
give_base_to_groups(mainvar, scene);
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 24075a1fe58..3c6e646fe9c 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1804,7 +1804,7 @@ static void write_meshs(WriteData *wd, ListBase *idbase)
if (!save_for_old_blender) {
#ifdef USE_BMESH_SAVE_WITHOUT_MFACE
- Mesh backup_mesh = {{0}};
+ Mesh backup_mesh = {{NULL}};
/* cache only - don't write */
backup_mesh.mface = mesh->mface;
mesh->mface = NULL;
@@ -1847,7 +1847,7 @@ static void write_meshs(WriteData *wd, ListBase *idbase)
#ifdef USE_BMESH_SAVE_AS_COMPAT
- Mesh backup_mesh = {{0}};
+ Mesh backup_mesh = {{NULL}};
/* backup */
backup_mesh.mpoly = mesh->mpoly;
@@ -2799,114 +2799,69 @@ static void write_nodetrees(WriteData *wd, ListBase *idbase)
}
#ifdef USE_NODE_COMPAT_CUSTOMNODES
-static void customnodes_add_deprecated_nodetree_data(bNodeTree *ntree)
-{
- bNodeLink *link, *last_link = ntree->links.last;
- /* Forward compatibility for group nodes: add links to node tree interface sockets.
- * These links are invalid by new rules (missing node pointer)!
- * They will be removed again in customnodes_free_deprecated_data,
- * cannot do this directly lest bNodeLink pointer mapping becomes ambiguous.
- * When loading files with such links in a new Blender version
- * they will be removed as well.
- */
- for (link = ntree->links.first; link; link = link->next) {
- bNode *fromnode = link->fromnode, *tonode = link->tonode;
- bNodeSocket *fromsock = link->fromsock, *tosock = link->tosock;
+static void customnodes_add_deprecated_data(Main *mainvar)
+{
+ FOREACH_NODETREE(mainvar, ntree, id) {
+ bNodeLink *link, *last_link = ntree->links.last;
- /* check both sides of the link, to handle direct input-to-output links */
- if (fromnode->type == NODE_GROUP_INPUT) {
- fromnode = NULL;
- fromsock = ntreeFindSocketInterface(ntree, SOCK_IN, fromsock->identifier);
- }
- /* only the active output node defines links */
- if (tonode->type == NODE_GROUP_OUTPUT && (tonode->flag & NODE_DO_OUTPUT)) {
- tonode = NULL;
- tosock = ntreeFindSocketInterface(ntree, SOCK_OUT, tosock->identifier);
- }
+ /* only do this for node groups */
+ if (id != &ntree->id)
+ continue;
- if (!fromnode || !tonode) {
- /* Note: not using nodeAddLink here, it asserts existing node pointers */
- bNodeLink *tlink = MEM_callocN(sizeof(bNodeLink), "group node link");
- tlink->fromnode = fromnode;
- tlink->fromsock = fromsock;
- tlink->tonode = tonode;
- tlink->tosock= tosock;
- tosock->link = tlink;
- tlink->flag |= NODE_LINK_VALID;
- BLI_addtail(&ntree->links, tlink);
+ /* Forward compatibility for group nodes: add links to node tree interface sockets.
+ * These links are invalid by new rules (missing node pointer)!
+ * They will be removed again in customnodes_free_deprecated_data,
+ * cannot do this directly lest bNodeLink pointer mapping becomes ambiguous.
+ * When loading files with such links in a new Blender version
+ * they will be removed as well.
+ */
+ for (link = ntree->links.first; link; link = link->next) {
+ bNode *fromnode = link->fromnode, *tonode = link->tonode;
+ bNodeSocket *fromsock = link->fromsock, *tosock = link->tosock;
+
+ /* check both sides of the link, to handle direct input-to-output links */
+ if (fromnode->type == NODE_GROUP_INPUT) {
+ fromnode = NULL;
+ fromsock = ntreeFindSocketInterface(ntree, SOCK_IN, fromsock->identifier);
+ }
+ /* only the active output node defines links */
+ if (tonode->type == NODE_GROUP_OUTPUT && (tonode->flag & NODE_DO_OUTPUT)) {
+ tonode = NULL;
+ tosock = ntreeFindSocketInterface(ntree, SOCK_OUT, tosock->identifier);
+ }
+
+ if (!fromnode || !tonode) {
+ /* Note: not using nodeAddLink here, it asserts existing node pointers */
+ bNodeLink *tlink = MEM_callocN(sizeof(bNodeLink), "group node link");
+ tlink->fromnode = fromnode;
+ tlink->fromsock = fromsock;
+ tlink->tonode = tonode;
+ tlink->tosock= tosock;
+ tosock->link = tlink;
+ tlink->flag |= NODE_LINK_VALID;
+ BLI_addtail(&ntree->links, tlink);
+ }
+
+ /* don't check newly created compatibility links */
+ if (link == last_link)
+ break;
}
-
- /* don't check newly created compatibility links */
- if (link == last_link)
- break;
- }
-}
-
-static void customnodes_add_deprecated_data(Main *mainvar)
-{
- bNodeTree *ntree;
- Scene *scene;
- Material *mat;
- World *world;
- Lamp *lamp;
- Tex *tex;
-
- for (ntree = mainvar->nodetree.first; ntree; ntree = ntree->id.next)
- customnodes_add_deprecated_nodetree_data(ntree);
- for (scene = mainvar->scene.first; scene; scene = scene->id.next)
- if (scene->nodetree)
- customnodes_add_deprecated_nodetree_data(scene->nodetree);
- for (mat = mainvar->mat.first; mat; mat = mat->id.next)
- if (mat->nodetree)
- customnodes_add_deprecated_nodetree_data(mat->nodetree);
- for (world = mainvar->world.first; world; world = world->id.next)
- if (world->nodetree)
- customnodes_add_deprecated_nodetree_data(world->nodetree);
- for (lamp = mainvar->lamp.first; lamp; lamp = lamp->id.next)
- if (lamp->nodetree)
- customnodes_add_deprecated_nodetree_data(lamp->nodetree);
- for (tex = mainvar->tex.first; tex; tex = tex->id.next)
- if (tex->nodetree)
- customnodes_add_deprecated_nodetree_data(tex->nodetree);
-}
-
-static void customnodes_free_deprecated_nodetree_data(bNodeTree *ntree)
-{
- bNodeLink *link, *next_link;
-
- for (link = ntree->links.first; link; link = next_link) {
- next_link = link->next;
- if (link->fromnode == NULL || link->tonode == NULL)
- nodeRemLink(ntree, link);
}
+ FOREACH_NODETREE_END
}
static void customnodes_free_deprecated_data(Main *mainvar)
{
- bNodeTree *ntree;
- Scene *scene;
- Material *mat;
- World *world;
- Lamp *lamp;
- Tex *tex;
-
- for (ntree = mainvar->nodetree.first; ntree; ntree = ntree->id.next)
- customnodes_free_deprecated_nodetree_data(ntree);
- for (scene = mainvar->scene.first; scene; scene = scene->id.next)
- if (scene->nodetree)
- customnodes_free_deprecated_nodetree_data(scene->nodetree);
- for (mat = mainvar->mat.first; mat; mat = mat->id.next)
- if (mat->nodetree)
- customnodes_free_deprecated_nodetree_data(mat->nodetree);
- for (world = mainvar->world.first; world; world = world->id.next)
- if (world->nodetree)
- customnodes_free_deprecated_nodetree_data(world->nodetree);
- for (lamp = mainvar->lamp.first; lamp; lamp = lamp->id.next)
- if (lamp->nodetree)
- customnodes_free_deprecated_nodetree_data(lamp->nodetree);
- for (tex = mainvar->tex.first; tex; tex = tex->id.next)
- if (tex->nodetree)
- customnodes_free_deprecated_nodetree_data(tex->nodetree);
+ FOREACH_NODETREE(mainvar, ntree, id) {
+ bNodeLink *link, *next_link;
+
+ for (link = ntree->links.first; link; link = next_link) {
+ next_link = link->next;
+ if (link->fromnode == NULL || link->tonode == NULL)
+ nodeRemLink(ntree, link);
+ }
+ }
+ FOREACH_NODETREE_END
}
#endif
@@ -3323,8 +3278,11 @@ static int write_file_handle(Main *mainvar, int handle, MemFile *compare, MemFil
#endif
#ifdef USE_NODE_COMPAT_CUSTOMNODES
- /* deprecated forward compat data is freed again below */
- customnodes_add_deprecated_data(mainvar);
+ /* don't write compatibility data on undo */
+ if (!current) {
+ /* deprecated forward compat data is freed again below */
+ customnodes_add_deprecated_data(mainvar);
+ }
#endif
sprintf(buf, "BLENDER%c%c%.3d", (sizeof(void*)==8)?'-':'_', (ENDIAN_ORDER==B_ENDIAN)?'V':'v', BLENDER_VERSION);
@@ -3374,11 +3332,14 @@ static int write_file_handle(Main *mainvar, int handle, MemFile *compare, MemFil
writedata(wd, DNA1, wd->sdna->datalen, wd->sdna->data);
#ifdef USE_NODE_COMPAT_CUSTOMNODES
- /* Ugly, forward compatibility code generates deprecated data during writing,
- * this has to be freed again. Can not be done directly after writing, otherwise
- * the data pointers could be reused and not be mapped correctly.
- */
- customnodes_free_deprecated_data(mainvar);
+ /* compatibility data not created on undo */
+ if (!current) {
+ /* Ugly, forward compatibility code generates deprecated data during writing,
+ * this has to be freed again. Can not be done directly after writing, otherwise
+ * the data pointers could be reused and not be mapped correctly.
+ */
+ customnodes_free_deprecated_data(mainvar);
+ }
#endif
/* end of file */
diff --git a/source/blender/bmesh/operators/bmo_utils.c b/source/blender/bmesh/operators/bmo_utils.c
index 6398d9d04b1..76962807cd5 100644
--- a/source/blender/bmesh/operators/bmo_utils.c
+++ b/source/blender/bmesh/operators/bmo_utils.c
@@ -575,7 +575,6 @@ void bmo_reverse_uvs_exec(BMesh *bm, BMOperator *op)
}
/* now that we have the uvs in the array, reverse! */
- i = 0;
BM_ITER_ELEM_INDEX (lf, &l_iter, fs, BM_LOOPS_OF_FACE, i) {
/* current loop uv is the previous loop uv */
MLoopUV *luv = CustomData_bmesh_get(&bm->ldata, lf->head.data, CD_MLOOPUV);
diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp
index a56010aeb27..2d3dc979416 100644
--- a/source/blender/collada/ArmatureExporter.cpp
+++ b/source/blender/collada/ArmatureExporter.cpp
@@ -171,7 +171,7 @@ void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm, Scene *sce,
if (bone->childbase.first == NULL || BLI_countlist(&(bone->childbase)) >= 2) {
add_blender_leaf_bone( bone, ob_arm, node);
}
- else{
+ else {
#endif
node.start();
diff --git a/source/blender/collada/collada_internal.cpp b/source/blender/collada/collada_internal.cpp
index c3df2f0dc2f..069419f938b 100644
--- a/source/blender/collada/collada_internal.cpp
+++ b/source/blender/collada/collada_internal.cpp
@@ -111,7 +111,7 @@ void UnitConverter::mat4_to_dae_double(double out[4][4], float in[4][4])
float(&UnitConverter::get_rotation())[4][4]
{
- switch(up_axis) {
+ switch (up_axis) {
case COLLADAFW::FileInfo::X_UP:
return x_up_mat4;
break;
diff --git a/source/blender/compositor/CMakeLists.txt b/source/blender/compositor/CMakeLists.txt
index ba897a87f97..4b058a41f71 100644
--- a/source/blender/compositor/CMakeLists.txt
+++ b/source/blender/compositor/CMakeLists.txt
@@ -660,6 +660,6 @@ list(APPEND INC
${CMAKE_CURRENT_BINARY_DIR}/operations
)
data_to_c(${CMAKE_CURRENT_SOURCE_DIR}/operations/COM_OpenCLKernels.cl
- ${CMAKE_CURRENT_BINARY_DIR}/operations/COM_OpenCLKernels.cl.h SRC)
+ ${CMAKE_CURRENT_BINARY_DIR}/operations/COM_OpenCLKernels.cl.h SRC)
blender_add_lib(bf_compositor "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/compositor/intern/COM_Converter.cpp b/source/blender/compositor/intern/COM_Converter.cpp
index 80f5b4fc149..80ae952b87f 100644
--- a/source/blender/compositor/intern/COM_Converter.cpp
+++ b/source/blender/compositor/intern/COM_Converter.cpp
@@ -403,6 +403,7 @@ Node *Converter::convert(bNode *b_node, bool fast)
node = new PixelateNode(b_node);
break;
default:
+ node = new MuteNode(b_node);
break;
}
return node;
diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cpp b/source/blender/compositor/intern/COM_ExecutionGroup.cpp
index 14fd7e0b6cf..82d1c7883e1 100644
--- a/source/blender/compositor/intern/COM_ExecutionGroup.cpp
+++ b/source/blender/compositor/intern/COM_ExecutionGroup.cpp
@@ -633,3 +633,13 @@ void ExecutionGroup::setViewerBorder(float xmin, float xmax, float ymin, float y
ymin * this->m_height, ymax * this->m_height);
}
}
+
+void ExecutionGroup::setRenderBorder(float xmin, float xmax, float ymin, float ymax)
+{
+ NodeOperation *operation = this->getOutputNodeOperation();
+
+ if (operation->isOutputOperation(true) && !(operation->isViewerOperation() || operation->isPreviewOperation())) {
+ BLI_rcti_init(&this->m_viewerBorder, xmin * this->m_width, xmax * this->m_width,
+ ymin * this->m_height, ymax * this->m_height);
+ }
+}
diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.h b/source/blender/compositor/intern/COM_ExecutionGroup.h
index b5f02e05be1..537dcb5974a 100644
--- a/source/blender/compositor/intern/COM_ExecutionGroup.h
+++ b/source/blender/compositor/intern/COM_ExecutionGroup.h
@@ -417,6 +417,8 @@ public:
*/
void setViewerBorder(float xmin, float xmax, float ymin, float ymax);
+ void setRenderBorder(float xmin, float xmax, float ymin, float ymax);
+
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("COM:ExecutionGroup")
#endif
diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.cpp b/source/blender/compositor/intern/COM_ExecutionSystem.cpp
index 2d87845d254..450d1b03917 100644
--- a/source/blender/compositor/intern/COM_ExecutionSystem.cpp
+++ b/source/blender/compositor/intern/COM_ExecutionSystem.cpp
@@ -95,6 +95,16 @@ ExecutionSystem::ExecutionSystem(RenderData *rd, bNodeTree *editingtree, bool re
ExecutionGroup *executionGroup = this->m_groups[index];
executionGroup->determineResolution(resolution);
+ if (rendering) {
+ /* case when cropping to render border happens is handled in
+ * compositor output and render layer nodes
+ */
+ if ((rd->mode & R_BORDER) && !(rd->mode & R_CROP)) {
+ executionGroup->setRenderBorder(rd->border.xmin, rd->border.xmax,
+ rd->border.ymin, rd->border.ymax);
+ }
+ }
+
if (use_viewer_border) {
executionGroup->setViewerBorder(viewer_border->xmin, viewer_border->xmax,
viewer_border->ymin, viewer_border->ymax);
diff --git a/source/blender/compositor/intern/COM_NodeOperation.h b/source/blender/compositor/intern/COM_NodeOperation.h
index 60ffadf60f7..26a382929cb 100644
--- a/source/blender/compositor/intern/COM_NodeOperation.h
+++ b/source/blender/compositor/intern/COM_NodeOperation.h
@@ -81,6 +81,9 @@ private:
*/
const bNodeTree *m_btree;
+ /**
+ * @brief set to truth when resolution for this operation is set
+ */
bool m_isResolutionSet;
public:
/**
diff --git a/source/blender/compositor/intern/COM_compositor.cpp b/source/blender/compositor/intern/COM_compositor.cpp
index 94a27e17b68..a0f660058f9 100644
--- a/source/blender/compositor/intern/COM_compositor.cpp
+++ b/source/blender/compositor/intern/COM_compositor.cpp
@@ -65,8 +65,10 @@ void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering,
/* Make sure node tree has previews.
* Don't create previews in advance, this is done when adding preview operations.
+ * Reserved preview size is determined by render output for now.
*/
- BKE_node_preview_init_tree(editingtree, COM_PREVIEW_SIZE, COM_PREVIEW_SIZE, FALSE);
+ float aspect = rd->xsch > 0 ? (float)rd->ysch / (float)rd->xsch : 1.0;
+ BKE_node_preview_init_tree(editingtree, COM_PREVIEW_SIZE, (int)(COM_PREVIEW_SIZE * aspect), FALSE);
/* initialize workscheduler, will check if already done. TODO deinitialize somewhere */
bool use_opencl = (editingtree->flag & NTREE_COM_OPENCL);
diff --git a/source/blender/compositor/nodes/COM_CompositorNode.cpp b/source/blender/compositor/nodes/COM_CompositorNode.cpp
index a78f96adfc6..f555e53f156 100644
--- a/source/blender/compositor/nodes/COM_CompositorNode.cpp
+++ b/source/blender/compositor/nodes/COM_CompositorNode.cpp
@@ -32,6 +32,8 @@ CompositorNode::CompositorNode(bNode *editorNode) : Node(editorNode)
void CompositorNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
bNode *editorNode = this->getbNode();
+ bool is_active = (editorNode->flag & NODE_DO_OUTPUT_RECALC) ||
+ context->isRendering();
InputSocket *imageSocket = this->getInputSocket(0);
InputSocket *alphaSocket = this->getInputSocket(1);
@@ -42,10 +44,11 @@ void CompositorNode::convertToOperations(ExecutionSystem *graph, CompositorConte
compositorOperation->setRenderData(context->getRenderData());
compositorOperation->setbNodeTree(context->getbNodeTree());
compositorOperation->setIgnoreAlpha(editorNode->custom2 & CMP_NODE_OUTPUT_IGNORE_ALPHA);
+ compositorOperation->setActive(is_active);
imageSocket->relinkConnections(compositorOperation->getInputSocket(0), 0, graph);
alphaSocket->relinkConnections(compositorOperation->getInputSocket(1));
depthSocket->relinkConnections(compositorOperation->getInputSocket(2));
graph->addOperation(compositorOperation);
+
addPreviewOperation(graph, context, compositorOperation->getInputSocket(0));
}
-
diff --git a/source/blender/compositor/nodes/COM_MovieClipNode.cpp b/source/blender/compositor/nodes/COM_MovieClipNode.cpp
index 5d5e68fba37..10dd72ec7bf 100644
--- a/source/blender/compositor/nodes/COM_MovieClipNode.cpp
+++ b/source/blender/compositor/nodes/COM_MovieClipNode.cpp
@@ -41,10 +41,11 @@ MovieClipNode::MovieClipNode(bNode *editorNode) : Node(editorNode)
void MovieClipNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
OutputSocket *outputMovieClip = this->getOutputSocket(0);
- OutputSocket *offsetXMovieClip = this->getOutputSocket(1);
- OutputSocket *offsetYMovieClip = this->getOutputSocket(2);
- OutputSocket *scaleMovieClip = this->getOutputSocket(3);
- OutputSocket *angleMovieClip = this->getOutputSocket(4);
+ OutputSocket *alphaMovieClip = this->getOutputSocket(1);
+ OutputSocket *offsetXMovieClip = this->getOutputSocket(2);
+ OutputSocket *offsetYMovieClip = this->getOutputSocket(3);
+ OutputSocket *scaleMovieClip = this->getOutputSocket(4);
+ OutputSocket *angleMovieClip = this->getOutputSocket(5);
bNode *editorNode = this->getbNode();
MovieClip *movieClip = (MovieClip *)editorNode->id;
@@ -73,6 +74,16 @@ void MovieClipNode::convertToOperations(ExecutionSystem *graph, CompositorContex
operation->setCacheFrame(cacheFrame);
graph->addOperation(operation);
+ if (alphaMovieClip->isConnected()) {
+ MovieClipAlphaOperation *alphaOperation = new MovieClipAlphaOperation();
+ alphaOperation->setMovieClip(movieClip);
+ alphaOperation->setMovieClipUser(movieClipUser);
+ alphaOperation->setFramenumber(context->getFramenumber());
+ alphaOperation->setCacheFrame(cacheFrame);
+ alphaMovieClip->relinkConnections(alphaOperation->getOutputSocket());
+ graph->addOperation(alphaOperation);
+ }
+
MovieTrackingStabilization *stab = &movieClip->tracking.stabilization;
float loc[2], scale, angle;
loc[0] = 0.0f;
@@ -87,7 +98,7 @@ void MovieClipNode::convertToOperations(ExecutionSystem *graph, CompositorContex
BKE_tracking_stabilization_data_get(&movieClip->tracking, clip_framenr, ibuf->x, ibuf->y, loc, &scale, &angle);
}
}
-
+
if (offsetXMovieClip->isConnected()) {
SetValueOperation *operationSetValue = new SetValueOperation();
operationSetValue->setValue(loc[0]);
diff --git a/source/blender/compositor/nodes/COM_RenderLayersNode.cpp b/source/blender/compositor/nodes/COM_RenderLayersNode.cpp
index b57e99754d6..5259fbc7dc5 100644
--- a/source/blender/compositor/nodes/COM_RenderLayersNode.cpp
+++ b/source/blender/compositor/nodes/COM_RenderLayersNode.cpp
@@ -61,6 +61,7 @@ void RenderLayersNode::testSocketConnection(ExecutionSystem *system, CompositorC
if (outputSocket->isConnected()) {
operation->setScene(scene);
operation->setLayerId(layerId);
+ operation->setRenderData(context->getRenderData());
outputSocket->relinkConnections(operation->getOutputSocket());
system->addOperation(operation);
if (outputSocketNumber == 0) { // only do for image socket if connected
@@ -72,6 +73,7 @@ void RenderLayersNode::testSocketConnection(ExecutionSystem *system, CompositorC
system->addOperation(operation);
operation->setScene(scene);
operation->setLayerId(layerId);
+ operation->setRenderData(context->getRenderData());
addPreviewOperation(system, context, operation->getOutputSocket());
}
else {
diff --git a/source/blender/compositor/nodes/COM_SocketProxyNode.h b/source/blender/compositor/nodes/COM_SocketProxyNode.h
index a83ac094b2b..b679901ba2c 100644
--- a/source/blender/compositor/nodes/COM_SocketProxyNode.h
+++ b/source/blender/compositor/nodes/COM_SocketProxyNode.h
@@ -31,9 +31,9 @@
*/
class SocketProxyNode : public Node {
private:
- bool m_buffer;
+ bool m_buffer;
public:
- SocketProxyNode(bNode *editorNode, bNodeSocket *editorInput, bNodeSocket *editorOutput, bool buffer);
+ SocketProxyNode(bNode *editorNode, bNodeSocket *editorInput, bNodeSocket *editorOutput, bool buffer);
void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
virtual bool isProxyNode() const { return true; }
diff --git a/source/blender/compositor/nodes/COM_SplitViewerNode.cpp b/source/blender/compositor/nodes/COM_SplitViewerNode.cpp
index 37b888becca..0293f4926db 100644
--- a/source/blender/compositor/nodes/COM_SplitViewerNode.cpp
+++ b/source/blender/compositor/nodes/COM_SplitViewerNode.cpp
@@ -33,6 +33,11 @@ SplitViewerNode::SplitViewerNode(bNode *editorNode) : Node(editorNode)
void SplitViewerNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
+ bNode *editorNode = this->getbNode();
+ bool is_active = ((editorNode->flag & NODE_DO_OUTPUT_RECALC) &&
+ (editorNode->flag & NODE_DO_OUTPUT) && this->isInActiveGroup()) ||
+ context->isRendering();
+
InputSocket *image1Socket = this->getInputSocket(0);
InputSocket *image2Socket = this->getInputSocket(1);
Image *image = (Image *)this->getbNode()->id;
@@ -41,7 +46,7 @@ void SplitViewerNode::convertToOperations(ExecutionSystem *graph, CompositorCont
SplitViewerOperation *splitViewerOperation = new SplitViewerOperation();
splitViewerOperation->setImage(image);
splitViewerOperation->setImageUser(imageUser);
- splitViewerOperation->setActive((this->getbNode()->flag & NODE_DO_OUTPUT) && this->isInActiveGroup());
+ splitViewerOperation->setActive(is_active);
splitViewerOperation->setSplitPercentage(this->getbNode()->custom1);
splitViewerOperation->setViewSettings(context->getViewSettings());
@@ -56,7 +61,10 @@ void SplitViewerNode::convertToOperations(ExecutionSystem *graph, CompositorCont
splitViewerOperation->setXSplit(!this->getbNode()->custom2);
image1Socket->relinkConnections(splitViewerOperation->getInputSocket(0), 0, graph);
image2Socket->relinkConnections(splitViewerOperation->getInputSocket(1), 1, graph);
- addPreviewOperation(graph, context, splitViewerOperation->getInputSocket(0));
+
+ if (is_active)
+ addPreviewOperation(graph, context, splitViewerOperation->getInputSocket(0));
+
graph->addOperation(splitViewerOperation);
}
}
diff --git a/source/blender/compositor/nodes/COM_ViewerNode.cpp b/source/blender/compositor/nodes/COM_ViewerNode.cpp
index 8f9e58fee13..70cc3a288ee 100644
--- a/source/blender/compositor/nodes/COM_ViewerNode.cpp
+++ b/source/blender/compositor/nodes/COM_ViewerNode.cpp
@@ -33,17 +33,21 @@ ViewerNode::ViewerNode(bNode *editorNode) : Node(editorNode)
void ViewerNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
+ bNode *editorNode = this->getbNode();
+ bool is_active = ((editorNode->flag & NODE_DO_OUTPUT_RECALC) &&
+ (editorNode->flag & NODE_DO_OUTPUT) && this->isInActiveGroup()) ||
+ context->isRendering();
+
InputSocket *imageSocket = this->getInputSocket(0);
InputSocket *alphaSocket = this->getInputSocket(1);
InputSocket *depthSocket = this->getInputSocket(2);
Image *image = (Image *)this->getbNode()->id;
ImageUser *imageUser = (ImageUser *) this->getbNode()->storage;
- bNode *editorNode = this->getbNode();
ViewerOperation *viewerOperation = new ViewerOperation();
viewerOperation->setbNodeTree(context->getbNodeTree());
viewerOperation->setImage(image);
viewerOperation->setImageUser(imageUser);
- viewerOperation->setActive((editorNode->flag & NODE_DO_OUTPUT) && this->isInActiveGroup());
+ viewerOperation->setActive(is_active);
viewerOperation->setChunkOrder((OrderOfChunks)editorNode->custom1);
viewerOperation->setCenterX(editorNode->custom3);
viewerOperation->setCenterY(editorNode->custom4);
@@ -63,5 +67,6 @@ void ViewerNode::convertToOperations(ExecutionSystem *graph, CompositorContext *
alphaSocket->relinkConnections(viewerOperation->getInputSocket(1));
depthSocket->relinkConnections(viewerOperation->getInputSocket(2));
graph->addOperation(viewerOperation);
+
addPreviewOperation(graph, context, viewerOperation->getInputSocket(0));
}
diff --git a/source/blender/compositor/operations/COM_CompositorOperation.cpp b/source/blender/compositor/operations/COM_CompositorOperation.cpp
index 43f491ad2d9..56527da47bc 100644
--- a/source/blender/compositor/operations/COM_CompositorOperation.cpp
+++ b/source/blender/compositor/operations/COM_CompositorOperation.cpp
@@ -50,12 +50,16 @@ CompositorOperation::CompositorOperation() : NodeOperation()
this->m_depthInput = NULL;
this->m_ignoreAlpha = false;
+ this->m_active = false;
this->m_sceneName[0] = '\0';
}
void CompositorOperation::initExecution()
{
+ if (!this->m_active)
+ return;
+
// When initializing the tree during initial load the width and height can be zero.
this->m_imageInput = getInputSocketReader(0);
this->m_alphaInput = getInputSocketReader(1);
@@ -70,6 +74,9 @@ void CompositorOperation::initExecution()
void CompositorOperation::deinitExecution()
{
+ if (!this->m_active)
+ return;
+
if (!isBreaked()) {
Render *re = RE_GetRender(this->m_sceneName);
RenderResult *rr = RE_AcquireResultWrite(re);
@@ -136,23 +143,63 @@ void CompositorOperation::executeRegion(rcti *rect, unsigned int tileNumber)
int x;
int y;
bool breaked = false;
+ int dx = 0, dy = 0;
+
+ const RenderData *rd = this->m_rd;
+
+ if (rd->mode & R_BORDER && rd->mode & R_CROP) {
+ /*!
+ When using cropped render result, need to re-position area of interest,
+ so it'll natch bounds of render border within frame. By default, canvas
+ will be centered between full frame and cropped frame, so we use such
+ scheme to map cropped coordinates to full-frame coordinates
+
+ ^ Y
+ | Width
+ +------------------------------------------------+
+ | |
+ | |
+ | Centered canvas, we map coordinate from it |
+ | +------------------+ |
+ | | | | H
+ | | | | e
+ | +------------------+ . Center | | i
+ | | | | | | g
+ | | | | | | h
+ | |....dx.... +------|-----------+ | t
+ | | . dy | |
+ | +------------------+ |
+ | Render border, we map coordinates to it |
+ | | X
+ +------------------------------------------------+---->
+ Full frame
+ */
+
+ int full_width = rd->xsch * rd->size / 100;
+ int full_height =rd->ysch * rd->size / 100;
+
+ dx = rd->border.xmin * full_width - (full_width - this->getWidth()) / 2.0f;
+ dy = rd->border.ymin * full_height - (full_height - this->getHeight()) / 2.0f;
+ }
for (y = y1; y < y2 && (!breaked); y++) {
for (x = x1; x < x2 && (!breaked); x++) {
- this->m_imageInput->read(color, x, y, COM_PS_NEAREST);
+ int input_x = x + dx, input_y = y + dy;
+
+ this->m_imageInput->read(color, input_x, input_y, COM_PS_NEAREST);
if (this->m_ignoreAlpha) {
color[3] = 1.0f;
}
else {
if (this->m_alphaInput != NULL) {
- this->m_alphaInput->read(&(color[3]), x, y, COM_PS_NEAREST);
+ this->m_alphaInput->read(&(color[3]), input_x, input_y, COM_PS_NEAREST);
}
}
copy_v4_v4(buffer + offset4, color);
if (this->m_depthInput != NULL) {
- this->m_depthInput->read(color, x, y, COM_PS_NEAREST);
+ this->m_depthInput->read(color, input_x, input_y, COM_PS_NEAREST);
zbuffer[offset] = color[0];
}
offset4 += COM_NUMBER_OF_CHANNELS;
diff --git a/source/blender/compositor/operations/COM_CompositorOperation.h b/source/blender/compositor/operations/COM_CompositorOperation.h
index 27d29664610..d33e89ed742 100644
--- a/source/blender/compositor/operations/COM_CompositorOperation.h
+++ b/source/blender/compositor/operations/COM_CompositorOperation.h
@@ -66,19 +66,28 @@ private:
*/
SocketReader *m_depthInput;
- /* Ignore any alpha input */
+ /**
+ * @brief Ignore any alpha input
+ */
bool m_ignoreAlpha;
+ /**
+ * @brief operation is active for calculating final compo result
+ */
+ bool m_active;
public:
CompositorOperation();
+ const bool isActiveCompositorOutput() const { return this->m_active; }
void executeRegion(rcti *rect, unsigned int tileNumber);
void setSceneName(const char *sceneName) { BLI_strncpy(this->m_sceneName, sceneName, sizeof(this->m_sceneName)); }
void setRenderData(const RenderData *rd) { this->m_rd = rd; }
- bool isOutputOperation(bool rendering) const { return true; }
+ bool isOutputOperation(bool rendering) const { return this->isActiveCompositorOutput(); }
void initExecution();
void deinitExecution();
const CompositorPriority getRenderPriority() const { return COM_PRIORITY_MEDIUM; }
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
void setIgnoreAlpha(bool value) { this->m_ignoreAlpha = value; }
+ void setActive(bool active) { this->m_active = active; }
};
#endif
+
diff --git a/source/blender/compositor/operations/COM_CropOperation.cpp b/source/blender/compositor/operations/COM_CropOperation.cpp
index 4f9cd771988..844d23db2ac 100644
--- a/source/blender/compositor/operations/COM_CropOperation.cpp
+++ b/source/blender/compositor/operations/COM_CropOperation.cpp
@@ -119,7 +119,7 @@ void CropImageOperation::determineResolution(unsigned int resolution[2], unsigne
void CropImageOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
- if (x >= 0 && x < getWidth() && y >= 0 && y < getHeight()) {
+ if (x >= 0 && x < getWidth() && y >= 0 && y < getHeight()) {
this->m_inputOperation->read(output, (x + this->m_xmin), (y + this->m_ymin), sampler);
}
else {
diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
index 2d662c1061e..c236c73e50f 100644
--- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
@@ -62,7 +62,6 @@ void GaussianBokehBlurOperation::updateGauss()
int n;
float *dgauss;
float *ddgauss;
- float val;
int j, i;
const float width = this->getWidth();
const float height = this->getHeight();
@@ -84,13 +83,15 @@ void GaussianBokehBlurOperation::updateGauss()
this->m_radx = ceil(radxf);
this->m_rady = ceil(radyf);
-
- n = (2 * this->m_radx + 1) * (2 * this->m_rady + 1);
+
+ int ddwidth = 2 * this->m_radx + 1;
+ int ddheight = 2 * this->m_rady + 1;
+ n = ddwidth * ddheight;
/* create a full filter image */
ddgauss = (float *)MEM_mallocN(sizeof(float) * n, __func__);
dgauss = ddgauss;
- val = 0.0f;
+ float sum = 0.0f;
for (j = -this->m_rady; j <= this->m_rady; j++) {
for (i = -this->m_radx; i <= this->m_radx; i++, dgauss++) {
float fj = (float)j / radyf;
@@ -98,16 +99,19 @@ void GaussianBokehBlurOperation::updateGauss()
float dist = sqrt(fj * fj + fi * fi);
*dgauss = RE_filter_value(this->m_data->filtertype, dist);
- val += *dgauss;
+ sum += *dgauss;
}
}
- if (val != 0.0f) {
- val = 1.0f / val;
- for (j = n - 1; j >= 0; j--) {
- ddgauss[j] *= val;
- }
+ if (sum > 0.0f) {
+ /* normalize */
+ float norm = 1.0f / sum;
+ for (j = n - 1; j >= 0; j--)
+ ddgauss[j] *= norm;
+ }
+ else {
+ int center = m_rady * ddwidth + m_radx;
+ ddgauss[center] = 1.0f;
}
- else ddgauss[4] = 1.0f;
this->m_gausstab = ddgauss;
}
diff --git a/source/blender/compositor/operations/COM_MovieClipOperation.cpp b/source/blender/compositor/operations/COM_MovieClipOperation.cpp
index 74761f00e1f..a74f2c7299b 100644
--- a/source/blender/compositor/operations/COM_MovieClipOperation.cpp
+++ b/source/blender/compositor/operations/COM_MovieClipOperation.cpp
@@ -30,9 +30,8 @@ extern "C" {
}
#include "BKE_image.h"
-MovieClipOperation::MovieClipOperation() : NodeOperation()
+MovieClipBaseOperation::MovieClipBaseOperation() : NodeOperation()
{
- this->addOutputSocket(COM_DT_COLOR);
this->m_movieClip = NULL;
this->m_movieClipBuffer = NULL;
this->m_movieClipUser = NULL;
@@ -42,7 +41,7 @@ MovieClipOperation::MovieClipOperation() : NodeOperation()
}
-void MovieClipOperation::initExecution()
+void MovieClipBaseOperation::initExecution()
{
if (this->m_movieClip) {
BKE_movieclip_user_set_frame(this->m_movieClipUser, this->m_framenumber);
@@ -63,7 +62,7 @@ void MovieClipOperation::initExecution()
}
}
-void MovieClipOperation::deinitExecution()
+void MovieClipBaseOperation::deinitExecution()
{
if (this->m_movieClipBuffer) {
IMB_freeImBuf(this->m_movieClipBuffer);
@@ -72,7 +71,7 @@ void MovieClipOperation::deinitExecution()
}
}
-void MovieClipOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
+void MovieClipBaseOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
{
resolution[0] = 0;
resolution[1] = 0;
@@ -87,7 +86,7 @@ void MovieClipOperation::determineResolution(unsigned int resolution[2], unsigne
}
}
-void MovieClipOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
+void MovieClipBaseOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
if (this->m_movieClipBuffer == NULL || x < 0 || y < 0 || x >= this->getWidth() || y >= this->getHeight() ) {
zero_v4(output);
@@ -106,3 +105,22 @@ void MovieClipOperation::executePixel(float output[4], float x, float y, PixelSa
}
}
}
+
+MovieClipOperation::MovieClipOperation() : MovieClipBaseOperation()
+{
+ this->addOutputSocket(COM_DT_COLOR);
+}
+
+MovieClipAlphaOperation::MovieClipAlphaOperation() : MovieClipBaseOperation()
+{
+ this->addOutputSocket(COM_DT_VALUE);
+}
+
+void MovieClipAlphaOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
+{
+ MovieClipBaseOperation::executePixel(output, x, y, sampler);
+ output[0] = output[3];
+ output[1] = 0.0f;
+ output[2] = 0.0f;
+ output[3] = 0.0f;
+}
diff --git a/source/blender/compositor/operations/COM_MovieClipOperation.h b/source/blender/compositor/operations/COM_MovieClipOperation.h
index 7cce42f6727..a368dca423c 100644
--- a/source/blender/compositor/operations/COM_MovieClipOperation.h
+++ b/source/blender/compositor/operations/COM_MovieClipOperation.h
@@ -30,11 +30,9 @@
#include "IMB_imbuf_types.h"
/**
- * Base class for all renderlayeroperations
- *
- * @todo: rename to operation.
+ * Base class for movie clip
*/
-class MovieClipOperation : public NodeOperation {
+class MovieClipBaseOperation : public NodeOperation {
protected:
MovieClip *m_movieClip;
MovieClipUser *m_movieClipUser;
@@ -50,7 +48,7 @@ protected:
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
public:
- MovieClipOperation();
+ MovieClipBaseOperation();
void initExecution();
void deinitExecution();
@@ -62,4 +60,15 @@ public:
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
+class MovieClipOperation : public MovieClipBaseOperation {
+public:
+ MovieClipOperation();
+};
+
+class MovieClipAlphaOperation : public MovieClipBaseOperation {
+public:
+ MovieClipAlphaOperation();
+ void executePixel(float output[4], float x, float y, PixelSampler sampler);
+};
+
#endif
diff --git a/source/blender/compositor/operations/COM_OpenCLKernels.cl b/source/blender/compositor/operations/COM_OpenCLKernels.cl
index 8cc25fc3360..d7a81001531 100644
--- a/source/blender/compositor/operations/COM_OpenCLKernels.cl
+++ b/source/blender/compositor/operations/COM_OpenCLKernels.cl
@@ -112,7 +112,7 @@ __kernel void defocusKernel(__read_only image2d_t inputImage, __read_only image2
float dx = nx - realCoordinate.s0;
if (dx != 0 || dy != 0) {
inputCoordinate.s0 = nx - offsetInput.s0;
- size = read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0 * scalar;
+ size = min(read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0 * scalar, size_center);
if (size > threshold) {
if (size >= fabs(dx) && size >= fabs(dy)) {
float2 uv = {256.0f + dx * 255.0f / size,
diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.cpp b/source/blender/compositor/operations/COM_OutputFileOperation.cpp
index 47b69ec87f9..15e5ab947d4 100644
--- a/source/blender/compositor/operations/COM_OutputFileOperation.cpp
+++ b/source/blender/compositor/operations/COM_OutputFileOperation.cpp
@@ -166,7 +166,7 @@ OutputOpenExrLayer::OutputOpenExrLayer(const char *name_, DataType datatype_)
}
OutputOpenExrMultiLayerOperation::OutputOpenExrMultiLayerOperation(
- const RenderData *rd, const bNodeTree *tree, const char *path, char exr_codec)
+ const RenderData *rd, const bNodeTree *tree, const char *path, char exr_codec)
{
this->m_rd = rd;
this->m_tree = tree;
diff --git a/source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp b/source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp
index 2ca499683d3..3421b0a2b34 100644
--- a/source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp
+++ b/source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp
@@ -37,6 +37,7 @@ RenderLayersBaseProg::RenderLayersBaseProg(int renderpass, int elementsize) : No
this->setScene(NULL);
this->m_inputBuffer = NULL;
this->m_elementsize = elementsize;
+ this->m_rd = NULL;
}
@@ -111,14 +112,29 @@ void RenderLayersBaseProg::doInterpolation(float output[4], float x, float y, Pi
void RenderLayersBaseProg::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
- int ix = x;
- int iy = y;
-
+ const RenderData *rd = this->m_rd;
+
+ int dx = 0, dy = 0;
+
+ if (rd->mode & R_BORDER && rd->mode & R_CROP) {
+ /* see comment in executeRegion describing coordinate mapping,
+ * here it simply goes other way around
+ */
+ int full_width = rd->xsch * rd->size / 100;
+ int full_height = rd->ysch * rd->size / 100;
+
+ dx = rd->border.xmin * full_width - (full_width - this->getWidth()) / 2.0f;
+ dy = rd->border.ymin * full_height - (full_height - this->getHeight()) / 2.0f;
+ }
+
+ int ix = x - dx;
+ int iy = y - dy;
+
if (this->m_inputBuffer == NULL || ix < 0 || iy < 0 || ix >= (int)this->getWidth() || iy >= (int)this->getHeight() ) {
zero_v4(output);
}
else {
- doInterpolation(output, x, y, sampler);
+ doInterpolation(output, ix, iy, sampler);
}
}
diff --git a/source/blender/compositor/operations/COM_RenderLayersBaseProg.h b/source/blender/compositor/operations/COM_RenderLayersBaseProg.h
index 3916862a0b3..84d6c1ee188 100644
--- a/source/blender/compositor/operations/COM_RenderLayersBaseProg.h
+++ b/source/blender/compositor/operations/COM_RenderLayersBaseProg.h
@@ -63,7 +63,12 @@ private:
int m_renderpass;
int m_elementsize;
-
+
+ /**
+ * @brief render data used for active rendering
+ */
+ const RenderData *m_rd;
+
protected:
/**
* Constructor
@@ -89,6 +94,7 @@ public:
*/
void setScene(Scene *scene) { this->m_scene = scene; }
Scene *getScene() { return this->m_scene; }
+ void setRenderData(const RenderData *rd) { this->m_rd = rd; }
void setLayerId(short layerId) { this->m_layerId = layerId; }
short getLayerId() { return this->m_layerId; }
void initExecution();
diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp
index 61720c7676d..03031e0f764 100644
--- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp
@@ -146,7 +146,7 @@ void VariableSizeBokehBlurOperation::executePixel(float output[4], int x, int y,
int offsetNxNy = offsetNy + (minx * COM_NUMBER_OF_CHANNELS);
for (int nx = minx; nx < maxx; nx += QualityStepHelper::getStep()) {
if (nx != x || ny != y) {
- float size = inputSizeFloatBuffer[offsetNxNy] * scalar;
+ float size = min(inputSizeFloatBuffer[offsetNxNy] * scalar, size_center);
if (size > this->m_threshold) {
float dx = nx - x;
if (size > fabsf(dx) && size > fabsf(dy)) {
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 7a3fc3a8d9b..205f67cf96a 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -1037,7 +1037,7 @@ static void select_timeline_marker_frame(ListBase *markers, int frame, unsigned
}
}
-static int ed_marker_select(bContext *C, const wmEvent *event, int extend, int camera)
+static int ed_marker_select(bContext *C, const wmEvent *event, bool extend, bool camera)
{
ListBase *markers = ED_context_get_markers(C);
ARegion *ar = CTX_wm_region(C);
@@ -1106,8 +1106,8 @@ static int ed_marker_select(bContext *C, const wmEvent *event, int extend, int c
static int ed_marker_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- short extend = RNA_boolean_get(op->ptr, "extend");
- short camera = 0;
+ bool extend = RNA_boolean_get(op->ptr, "extend");
+ bool camera = false;
#ifdef DURIAN_CAMERA_SWITCH
camera = RNA_boolean_get(op->ptr, "camera");
#endif
diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c
index 7ff318bb6b6..bbdc0df41a7 100644
--- a/source/blender/editors/armature/armature_select.c
+++ b/source/blender/editors/armature/armature_select.c
@@ -454,7 +454,7 @@ static int ebone_select_flag(EditBone *ebone)
}
/* context: editmode armature in view3d */
-int mouse_armature(bContext *C, const int mval[2], int extend, int deselect, int toggle)
+bool mouse_armature(bContext *C, const int mval[2], bool extend, bool deselect, bool toggle)
{
Object *obedit = CTX_data_edit_object(C);
bArmature *arm = obedit->data;
@@ -550,10 +550,10 @@ int mouse_armature(bContext *C, const int mval[2], int extend, int deselect, int
}
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, vc.obedit);
- return 1;
+ return true;
}
- return 0;
+ return false;
}
diff --git a/source/blender/editors/armature/pose_select.c b/source/blender/editors/armature/pose_select.c
index 4fa1389426d..c599e978e58 100644
--- a/source/blender/editors/armature/pose_select.c
+++ b/source/blender/editors/armature/pose_select.c
@@ -67,7 +67,7 @@
/* called from editview.c, for mode-less pose selection */
/* assumes scene obact and basact is still on old situation */
int ED_do_pose_selectbuffer(Scene *scene, Base *base, unsigned int *buffer, short hits,
- short extend, short deselect, short toggle)
+ bool extend, bool deselect, bool toggle)
{
Object *ob = base->object;
Bone *nearBone;
@@ -575,7 +575,7 @@ void POSE_OT_select_hierarchy(wmOperatorType *ot)
/* -------------------------------------- */
-static short pose_select_same_group(bContext *C, Object *ob, short extend)
+static short pose_select_same_group(bContext *C, Object *ob, bool extend)
{
bArmature *arm = (ob) ? ob->data : NULL;
bPose *pose = (ob) ? ob->pose : NULL;
@@ -607,7 +607,7 @@ static short pose_select_same_group(bContext *C, Object *ob, short extend)
}
/* deselect all bones before selecting new ones? */
- if ((extend == 0) && (pchan->bone->flag & BONE_UNSELECTABLE) == 0)
+ if ((extend == false) && (pchan->bone->flag & BONE_UNSELECTABLE) == 0)
pchan->bone->flag &= ~BONE_SELECTED;
}
CTX_DATA_END;
@@ -634,7 +634,7 @@ static short pose_select_same_group(bContext *C, Object *ob, short extend)
return changed;
}
-static short pose_select_same_layer(bContext *C, Object *ob, short extend)
+static short pose_select_same_layer(bContext *C, Object *ob, bool extend)
{
bPose *pose = (ob) ? ob->pose : NULL;
bArmature *arm = (ob) ? ob->data : NULL;
@@ -652,7 +652,7 @@ static short pose_select_same_layer(bContext *C, Object *ob, short extend)
layers |= pchan->bone->layer;
/* deselect all bones before selecting new ones? */
- if ((extend == 0) && (pchan->bone->flag & BONE_UNSELECTABLE) == 0)
+ if ((extend == false) && (pchan->bone->flag & BONE_UNSELECTABLE) == 0)
pchan->bone->flag &= ~BONE_SELECTED;
}
CTX_DATA_END;
@@ -673,7 +673,7 @@ static short pose_select_same_layer(bContext *C, Object *ob, short extend)
return changed;
}
-static int pose_select_same_keyingset(bContext *C, Object *ob, short extend)
+static int pose_select_same_keyingset(bContext *C, Object *ob, bool extend)
{
KeyingSet *ks = ANIM_scene_get_active_keyingset(CTX_data_scene(C));
KS_Path *ksp;
@@ -690,7 +690,7 @@ static int pose_select_same_keyingset(bContext *C, Object *ob, short extend)
return 0;
/* if not extending selection, deselect all selected first */
- if (extend == 0) {
+ if (extend == false) {
CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones)
{
if ((pchan->bone->flag & BONE_UNSELECTABLE) == 0)
diff --git a/source/blender/editors/armature/pose_transform.c b/source/blender/editors/armature/pose_transform.c
index 2525641e58c..c530faedd68 100644
--- a/source/blender/editors/armature/pose_transform.c
+++ b/source/blender/editors/armature/pose_transform.c
@@ -459,7 +459,7 @@ static int pose_paste_exec(bContext *C, wmOperator *op)
int selOnly = RNA_boolean_get(op->ptr, "selected_mask");
/* get KeyingSet to use */
- KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, ANIM_KS_LOC_ROT_SCALE_ID);
+ KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, ANIM_KS_WHOLE_CHARACTER_ID);
/* sanity checks */
if (ELEM(NULL, ob, ob->pose))
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index e134507600e..f95fbd1eacb 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -3387,156 +3387,14 @@ static void findselectedNurbvert(ListBase *editnurb, Nurb **nu, BezTriple **bezt
/***************** set spline type operator *******************/
-static int convertspline(short type, Nurb *nu)
-{
- BezTriple *bezt;
- BPoint *bp;
- int a, c, nr;
-
- if (nu->type == CU_POLY) {
- if (type == CU_BEZIER) { /* to Bezier with vecthandles */
- nr = nu->pntsu;
- bezt = (BezTriple *)MEM_callocN(nr * sizeof(BezTriple), "setsplinetype2");
- nu->bezt = bezt;
- a = nr;
- bp = nu->bp;
- while (a--) {
- copy_v3_v3(bezt->vec[1], bp->vec);
- bezt->f1 = bezt->f2 = bezt->f3 = bp->f1;
- bezt->h1 = bezt->h2 = HD_VECT;
- bezt->weight = bp->weight;
- bezt->radius = bp->radius;
- bp++;
- bezt++;
- }
- MEM_freeN(nu->bp);
- nu->bp = NULL;
- nu->pntsu = nr;
- nu->type = CU_BEZIER;
- BKE_nurb_handles_calc(nu);
- }
- else if (type == CU_NURBS) {
- nu->type = CU_NURBS;
- nu->orderu = 4;
- nu->flagu &= CU_NURB_CYCLIC; /* disable all flags except for cyclic */
- BKE_nurb_knot_calc_u(nu);
- a = nu->pntsu * nu->pntsv;
- bp = nu->bp;
- while (a--) {
- bp->vec[3] = 1.0;
- bp++;
- }
- }
- }
- else if (nu->type == CU_BEZIER) { /* Bezier */
- if (type == CU_POLY || type == CU_NURBS) {
- nr = 3 * nu->pntsu;
- nu->bp = MEM_callocN(nr * sizeof(BPoint), "setsplinetype");
- a = nu->pntsu;
- bezt = nu->bezt;
- bp = nu->bp;
- while (a--) {
- if (type == CU_POLY && bezt->h1 == HD_VECT && bezt->h2 == HD_VECT) {
- /* vector handle becomes 1 poly vertice */
- copy_v3_v3(bp->vec, bezt->vec[1]);
- bp->vec[3] = 1.0;
- bp->f1 = bezt->f2;
- nr -= 2;
- bp->radius = bezt->radius;
- bp->weight = bezt->weight;
- bp++;
- }
- else {
- for (c = 0; c < 3; c++) {
- copy_v3_v3(bp->vec, bezt->vec[c]);
- bp->vec[3] = 1.0;
- if (c == 0) bp->f1 = bezt->f1;
- else if (c == 1) bp->f1 = bezt->f2;
- else bp->f1 = bezt->f3;
- bp->radius = bezt->radius;
- bp->weight = bezt->weight;
- bp++;
- }
- }
- bezt++;
- }
- MEM_freeN(nu->bezt);
- nu->bezt = NULL;
- nu->pntsu = nr;
- nu->pntsv = 1;
- nu->orderu = 4;
- nu->orderv = 1;
- nu->type = type;
-
-#if 0 /* UNUSED */
- if (nu->flagu & CU_NURB_CYCLIC) c = nu->orderu - 1;
- else c = 0;
-#endif
-
- if (type == CU_NURBS) {
- nu->flagu &= CU_NURB_CYCLIC; /* disable all flags except for cyclic */
- nu->flagu |= CU_NURB_BEZIER;
- BKE_nurb_knot_calc_u(nu);
- }
- }
- }
- else if (nu->type == CU_NURBS) {
- if (type == CU_POLY) {
- nu->type = CU_POLY;
- if (nu->knotsu) MEM_freeN(nu->knotsu); /* python created nurbs have a knotsu of zero */
- nu->knotsu = NULL;
- if (nu->knotsv) MEM_freeN(nu->knotsv);
- nu->knotsv = NULL;
- }
- else if (type == CU_BEZIER) { /* to Bezier */
- nr = nu->pntsu / 3;
-
- if (nr < 2) {
- return 1; /* conversion impossible */
- }
- else {
- bezt = MEM_callocN(nr * sizeof(BezTriple), "setsplinetype2");
- nu->bezt = bezt;
- a = nr;
- bp = nu->bp;
- while (a--) {
- copy_v3_v3(bezt->vec[0], bp->vec);
- bezt->f1 = bp->f1;
- bp++;
- copy_v3_v3(bezt->vec[1], bp->vec);
- bezt->f2 = bp->f1;
- bp++;
- copy_v3_v3(bezt->vec[2], bp->vec);
- bezt->f3 = bp->f1;
- bezt->radius = bp->radius;
- bezt->weight = bp->weight;
- bp++;
- bezt++;
- }
- MEM_freeN(nu->bp);
- nu->bp = NULL;
- MEM_freeN(nu->knotsu);
- nu->knotsu = NULL;
- nu->pntsu = nr;
- nu->type = CU_BEZIER;
- }
- }
- }
-
- return 0;
-}
-
-void ED_nurb_set_spline_type(Nurb *nu, int type)
-{
- convertspline(type, nu);
-}
-
static int set_spline_type_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
ListBase *editnurb = object_editcurve_get(obedit);
Nurb *nu;
- int changed = 0, type = RNA_enum_get(op->ptr, "type");
+ bool change = false;
+ const bool use_handles = RNA_boolean_get(op->ptr, "use_handles");
+ const int type = RNA_enum_get(op->ptr, "type");
if (type == CU_CARDINAL || type == CU_BSPLINE) {
BKE_report(op->reports, RPT_ERROR, "Not yet implemented");
@@ -3545,14 +3403,14 @@ static int set_spline_type_exec(bContext *C, wmOperator *op)
for (nu = editnurb->first; nu; nu = nu->next) {
if (isNurbsel(nu)) {
- if (convertspline(type, nu))
+ if (BKE_nurb_type_convert(nu, type, use_handles) == false)
BKE_report(op->reports, RPT_ERROR, "No conversion possible");
else
- changed = 1;
+ change = true;
}
}
- if (changed) {
+ if (change) {
if (ED_curve_updateAnimPaths(obedit->data))
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit);
@@ -3592,6 +3450,7 @@ void CURVE_OT_spline_type_set(wmOperatorType *ot)
/* properties */
ot->prop = RNA_def_enum(ot->srna, "type", type_items, CU_POLY, "Type", "Spline type");
+ RNA_def_boolean(ot->srna, "use_handles", 0, "Handles", "Use handles when converting bezier curves into polygons");
}
/***************** set handle type operator *******************/
@@ -4201,7 +4060,7 @@ void CURVE_OT_make_segment(wmOperatorType *ot)
/***************** pick select from 3d view **********************/
-int mouse_nurb(bContext *C, const int mval[2], int extend, int deselect, int toggle)
+bool mouse_nurb(bContext *C, const int mval[2], bool extend, bool deselect, bool toggle)
{
Object *obedit = CTX_data_edit_object(C);
Curve *cu = obedit->data;
@@ -4314,10 +4173,10 @@ int mouse_nurb(bContext *C, const int mval[2], int extend, int deselect, int tog
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
- return 1;
+ return true;
}
- return 0;
+ return false;
}
/******************** spin operator ***********************/
@@ -6275,8 +6134,8 @@ int join_curve_exec(bContext *C, wmOperator *UNUSED(op))
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);
+ ED_object_editmode_enter(C, EM_WAITCURSOR);
+ ED_object_editmode_exit(C, EM_FREEDATA | EM_WAITCURSOR | EM_DO_UNDO);
WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
@@ -6291,20 +6150,20 @@ static const char *get_curve_defname(int type)
if ((type & CU_TYPE) == CU_BEZIER) {
switch (stype) {
- case CU_PRIM_CURVE: return "BezierCurve";
- case CU_PRIM_CIRCLE: return "BezierCircle";
- case CU_PRIM_PATH: return "CurvePath";
+ case CU_PRIM_CURVE: return DATA_("BezierCurve");
+ case CU_PRIM_CIRCLE: return DATA_("BezierCircle");
+ case CU_PRIM_PATH: return DATA_("CurvePath");
default:
- return "Curve";
+ return DATA_("Curve");
}
}
else {
switch (stype) {
- case CU_PRIM_CURVE: return "NurbsCurve";
- case CU_PRIM_CIRCLE: return "NurbsCircle";
- case CU_PRIM_PATH: return "NurbsPath";
+ case CU_PRIM_CURVE: return DATA_("NurbsCurve");
+ case CU_PRIM_CIRCLE: return DATA_("NurbsCircle");
+ case CU_PRIM_PATH: return DATA_("NurbsPath");
default:
- return "Curve";
+ return DATA_("Curve");
}
}
}
@@ -6314,13 +6173,13 @@ static const char *get_surf_defname(int type)
int stype = type & CU_PRIMITIVE;
switch (stype) {
- case CU_PRIM_CURVE: return "SurfCurve";
- case CU_PRIM_CIRCLE: return "SurfCircle";
- case CU_PRIM_PATCH: return "SurfPatch";
- case CU_PRIM_SPHERE: return "SurfSphere";
- case CU_PRIM_DONUT: return "SurfTorus";
+ case CU_PRIM_CURVE: return DATA_("SurfCurve");
+ case CU_PRIM_CIRCLE: return DATA_("SurfCircle");
+ case CU_PRIM_PATCH: return DATA_("SurfPatch");
+ case CU_PRIM_SPHERE: return DATA_("SurfSphere");
+ case CU_PRIM_DONUT: return DATA_("SurfTorus");
default:
- return "Surface";
+ return DATA_("Surface");
}
}
@@ -6744,7 +6603,7 @@ static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf)
/* userdef */
if (newob && !enter_editmode) {
- ED_object_exit_editmode(C, EM_FREEDATA);
+ ED_object_editmode_exit(C, EM_FREEDATA);
}
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obedit);
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index 09a7890a539..59850aff72f 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -757,7 +757,7 @@ void draw_gpencil_view2d(const bContext *C, short onlyv2d)
/* draw grease-pencil sketches to specified 3d-view assuming that matrices are already set correctly
* Note: this gets called twice - first time with only3d=1 to draw 3d-strokes,
* second time with only3d=0 for screen-aligned strokes */
-void draw_gpencil_view3d(Scene *scene, View3D *v3d, ARegion *ar, short only3d)
+void draw_gpencil_view3d(Scene *scene, View3D *v3d, ARegion *ar, bool only3d)
{
bGPdata *gpd;
int dflag = 0;
diff --git a/source/blender/editors/gpencil/gpencil_buttons.c b/source/blender/editors/gpencil/gpencil_buttons.c
index 19c1bc34f5c..e7033ef0147 100644
--- a/source/blender/editors/gpencil/gpencil_buttons.c
+++ b/source/blender/editors/gpencil/gpencil_buttons.c
@@ -198,6 +198,8 @@ static void gp_drawui_layer(uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, cons
uiItemR(sub, &ptr, "info", 0, "", ICON_NONE);
/* move up/down */
+ uiBlockBeginAlign(block);
+
if (gpl->prev) {
but = uiDefIconBut(block, BUT, 0, ICON_TRIA_UP, 0, 0, UI_UNIT_X, UI_UNIT_Y,
NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Move layer up"));
@@ -209,6 +211,8 @@ static void gp_drawui_layer(uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, cons
uiButSetFunc(but, gp_ui_layer_down_cb, gpd, gpl);
}
+ uiBlockEndAlign(block);
+
/* delete 'button' */
uiBlockSetEmboss(block, UI_EMBOSSN);
/* right-align ............................... */
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 671adfb8d1e..e4c7a1edbcb 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -63,6 +63,7 @@
#include "BKE_library.h"
#include "BKE_object.h"
#include "BKE_report.h"
+#include "BKE_scene.h"
#include "BKE_tracking.h"
#include "UI_interface.h"
@@ -393,6 +394,7 @@ void GPENCIL_OT_active_frame_delete(wmOperatorType *ot)
enum {
GP_STROKECONVERT_PATH = 1,
GP_STROKECONVERT_CURVE,
+ GP_STROKECONVERT_POLY,
};
/* Defines for possible timing modes */
@@ -407,6 +409,7 @@ enum {
static EnumPropertyItem prop_gpencil_convertmodes[] = {
{GP_STROKECONVERT_PATH, "PATH", 0, "Path", ""},
{GP_STROKECONVERT_CURVE, "CURVE", 0, "Bezier Curve", ""},
+ {GP_STROKECONVERT_POLY, "POLY", 0, "Polygon Curve", ""},
{0, NULL, 0, NULL, NULL}
};
@@ -1278,13 +1281,14 @@ static void gp_stroke_norm_curve_weights(Curve *cu, float minmax_weights[2])
static void gp_layer_to_curve(bContext *C, ReportList *reports, bGPdata *gpd, bGPDlayer *gpl, int mode,
int norm_weights, float rad_fac, int link_strokes, tGpTimingData *gtd)
{
+ struct Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
bGPDframe *gpf = gpencil_layer_getframe(gpl, CFRA, 0);
bGPDstroke *gps, *prev_gps = NULL;
Object *ob;
Curve *cu;
Nurb *nu = NULL;
- Base *base = BASACT, *newbase = NULL;
+ Base *base_orig = BASACT, *base_new = NULL;
float minmax_weights[2] = {1.0f, 0.0f};
/* camera framing */
@@ -1306,16 +1310,12 @@ static void gp_layer_to_curve(bContext *C, ReportList *reports, bGPdata *gpd, bG
/* init the curve object (remove rotation and get curve data from it)
* - must clear transforms set on object, as those skew our results
*/
- ob = BKE_object_add(scene, OB_CURVE);
- zero_v3(ob->loc);
- zero_v3(ob->rot);
- cu = ob->data;
+ ob = BKE_object_add_only_object(bmain, OB_CURVE, gpl->info);
+ cu = ob->data = BKE_curve_add(bmain, gpl->info, OB_CURVE);
+ base_new = BKE_scene_base_add(scene, ob);
+
cu->flag |= CU_3D;
- /* rename object and curve to layer name */
- rename_id((ID *)ob, gpl->info);
- rename_id((ID *)cu, gpl->info);
-
gtd->inittime = ((bGPDstroke *)gpf->strokes.first)->inittime;
/* add points to curve */
@@ -1344,6 +1344,7 @@ static void gp_layer_to_curve(bContext *C, ReportList *reports, bGPdata *gpd, bG
gp_stroke_to_path(C, gpl, gps, cu, subrect_ptr, &nu, minmax_weights, rad_fac, stitch, gtd);
break;
case GP_STROKECONVERT_CURVE:
+ case GP_STROKECONVERT_POLY: /* convert after */
gp_stroke_to_bezier(C, gpl, gps, cu, subrect_ptr, &nu, minmax_weights, rad_fac, stitch, gtd);
break;
default:
@@ -1364,19 +1365,15 @@ static void gp_layer_to_curve(bContext *C, ReportList *reports, bGPdata *gpd, bG
/* Create the path animation, if needed */
gp_stroke_path_animation(C, reports, cu, gtd);
- /* Reset original object as active, else we can't edit operator's settings!!! */
- /* set layers OK */
- newbase = BASACT;
- if (base) {
- newbase->lay = base->lay;
- ob->lay = newbase->lay;
- }
-
- /* restore, BKE_object_add sets active */
- BASACT = base;
- if (base) {
- base->flag |= SELECT;
+ if (mode == GP_STROKECONVERT_POLY) {
+ for (nu = cu->nurb.first; nu; nu = nu->next) {
+ BKE_nurb_type_convert(nu, CU_POLY, false);
+ }
}
+
+ /* set the layer and select */
+ base_new->lay = ob->lay = base_orig ? base_orig->lay : scene->lay;
+ base_new->flag = ob->flag = base_new->flag | SELECT;
}
/* --- */
@@ -1526,7 +1523,7 @@ static int gp_convert_layer_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int gp_convert_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop)
+static bool gp_convert_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop)
{
const char *prop_id = RNA_property_identifier(prop);
int link_strokes = RNA_boolean_get(ptr, "use_link_strokes");
@@ -1542,7 +1539,7 @@ static int gp_convert_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop)
strcmp(prop_id, "radius_multiplier") == 0 ||
strcmp(prop_id, "use_link_strokes") == 0)
{
- return TRUE;
+ return true;
}
/* Never show this prop */
@@ -1550,44 +1547,44 @@ static int gp_convert_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop)
return FALSE;
if (link_strokes) {
- /* Only show when link_stroke is TRUE */
+ /* Only show when link_stroke is true */
if (strcmp(prop_id, "timing_mode") == 0)
- return TRUE;
+ return true;
if (timing_mode != GP_STROKECONVERT_TIMING_NONE) {
- /* Only show when link_stroke is TRUE and stroke timing is enabled */
+ /* Only show when link_stroke is true and stroke timing is enabled */
if (strcmp(prop_id, "frame_range") == 0 ||
strcmp(prop_id, "start_frame") == 0)
{
- return TRUE;
+ return true;
}
/* Only show if we have valid timing data! */
if (valid_timing && strcmp(prop_id, "use_realtime") == 0)
- return TRUE;
+ return true;
/* Only show if realtime or valid_timing is FALSE! */
if ((!realtime || !valid_timing) && strcmp(prop_id, "end_frame") == 0)
- return TRUE;
+ return true;
if (valid_timing && timing_mode == GP_STROKECONVERT_TIMING_CUSTOMGAP) {
/* Only show for custom gaps! */
if (strcmp(prop_id, "gap_duration") == 0)
- return TRUE;
+ return true;
/* Only show randomness for non-null custom gaps! */
if (strcmp(prop_id, "gap_randomness") == 0 && (gap_duration > 0.0f))
- return TRUE;
+ return true;
/* Only show seed for randomize action! */
if (strcmp(prop_id, "seed") == 0 && (gap_duration > 0.0f) && (gap_randomness > 0.0f))
- return TRUE;
+ return true;
}
}
}
/* Else, hidden! */
- return FALSE;
+ return false;
}
static void gp_convert_ui(bContext *C, wmOperator *op)
diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h
index 1c2ec27a061..b8ad40b2bd9 100644
--- a/source/blender/editors/include/ED_anim_api.h
+++ b/source/blender/editors/include/ED_anim_api.h
@@ -474,7 +474,7 @@ void ANIM_timecode_string_from_frame(char *str, struct Scene *scene, int power,
/* ---------- Current Frame Drawing ---------------- */
/* flags for Current Frame Drawing */
-enum {
+enum eAnimEditDraw_CurrentFrame {
/* plain time indicator with no special indicators */
DRAWCFRA_PLAIN = 0,
/* draw box indicating current frame number */
@@ -483,7 +483,7 @@ enum {
DRAWCFRA_UNIT_SECONDS = (1 << 1),
/* draw indicator extra wide (for timeline) */
DRAWCFRA_WIDE = (1 << 2)
-} eAnimEditDraw_CurrentFrame;
+};
/* main call to draw current-frame indicator in an Animation Editor */
void ANIM_draw_cfra(const struct bContext *C, struct View2D *v2d, short flag);
diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h
index 310b60f13e8..3367dcb9c4c 100644
--- a/source/blender/editors/include/ED_armature.h
+++ b/source/blender/editors/include/ED_armature.h
@@ -123,8 +123,8 @@ void ED_armature_deselect_all(struct Object *obedit, int toggle);
void ED_armature_deselect_all_visible(struct Object *obedit);
int ED_do_pose_selectbuffer(struct Scene *scene, struct Base *base, unsigned int *buffer,
- short hits, short extend, short deselect, short toggle);
-int mouse_armature(struct bContext *C, const int mval[2], int extend, int deselect, int toggle);
+ short hits, bool extend, bool deselect, bool toggle);
+bool mouse_armature(struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle);
int join_armature_exec(struct bContext *C, struct wmOperator *op);
struct Bone *get_indexed_bone(struct Object *ob, int index);
float ED_rollBoneToVector(EditBone *bone, const float new_up_axis[3], const short axis_only);
diff --git a/source/blender/editors/include/ED_curve.h b/source/blender/editors/include/ED_curve.h
index 66c1798f507..1d26204095c 100644
--- a/source/blender/editors/include/ED_curve.h
+++ b/source/blender/editors/include/ED_curve.h
@@ -63,12 +63,11 @@ void load_editNurb(struct Object *obedit);
void make_editNurb(struct Object *obedit);
void free_editNurb(struct Object *obedit);
-int mouse_nurb(struct bContext *C, const int mval[2], int extend, int deselect, int toggle);
+bool mouse_nurb(struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle);
struct Nurb *add_nurbs_primitive(struct bContext *C, struct Object *obedit, float mat[4][4], int type, int newob);
int isNurbsel(struct Nurb *nu);
-void ED_nurb_set_spline_type(struct Nurb *nu, int type);
int join_curve_exec(struct bContext *C, struct wmOperator *op);
diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h
index 29d4097521d..cb4a81be8b8 100644
--- a/source/blender/editors/include/ED_gpencil.h
+++ b/source/blender/editors/include/ED_gpencil.h
@@ -79,7 +79,7 @@ void ED_operatortypes_gpencil(void);
void draw_gpencil_2dimage(const struct bContext *C);
void draw_gpencil_view2d(const struct bContext *C, short onlyv2d);
-void draw_gpencil_view3d(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, short only3d);
+void draw_gpencil_view3d(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, bool only3d);
void gpencil_panel_standard_header(const struct bContext *C, struct Panel *pa);
void gpencil_panel_standard(const struct bContext *C, struct Panel *pa);
diff --git a/source/blender/editors/include/ED_mball.h b/source/blender/editors/include/ED_mball.h
index 4655188a3dd..da96aba011e 100644
--- a/source/blender/editors/include/ED_mball.h
+++ b/source/blender/editors/include/ED_mball.h
@@ -41,7 +41,7 @@ void ED_keymap_metaball(struct wmKeyConfig *keyconf);
struct MetaElem *add_metaball_primitive(struct bContext *C, struct Object *obedit, float mat[4][4], float dia, int type, int newname);
-int mouse_mball(struct bContext *C, const int mval[2], int extend, int deselect, int toggle);
+bool mouse_mball(struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle);
void free_editMball(struct Object *obedit);
void make_editMball(struct Object *obedit);
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index e704b8f0bf3..f84281a4f08 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -74,7 +74,7 @@ struct rcti;
/* editmesh_utils.c */
-void EDBM_verts_mirror_cache_begin(struct BMEditMesh *em, const short use_select); /* note, replaces EM_cache_x_mirror_vert in trunk */
+void EDBM_verts_mirror_cache_begin(struct BMEditMesh *em, const bool use_select); /* note, replaces EM_cache_x_mirror_vert in trunk */
void EDBM_verts_mirror_apply(struct BMEditMesh *em, const int sel_from, const int sel_to);
struct BMVert *EDBM_verts_mirror_get(struct BMEditMesh *em, struct BMVert *v);
void EDBM_verts_mirror_cache_clear(struct BMEditMesh *em, struct BMVert *v);
@@ -93,7 +93,7 @@ void EDBM_index_arrays_ensure(struct BMEditMesh *em, const char htype)
void EDBM_index_arrays_init(struct BMEditMesh *em, const char htype);
void EDBM_index_arrays_free(struct BMEditMesh *em);
#ifndef NDEBUG
-int EDBM_index_arrays_check(struct BMEditMesh *em);
+bool EDBM_index_arrays_check(struct BMEditMesh *em);
#endif
struct BMVert *EDBM_vert_at_index(struct BMEditMesh *em, int index);
struct BMEdge *EDBM_edge_at_index(struct BMEditMesh *em, int index);
@@ -137,30 +137,33 @@ void EDBM_flag_disable_all(struct BMEditMesh *em, const char hflag);
/* editmesh_select.c */
-void EDBM_select_mirrored(struct Object *obedit, struct BMEditMesh *em, int extend);
+void EDBM_select_mirrored(struct Object *obedit, struct BMEditMesh *em, bool extend);
void EDBM_automerge(struct Scene *scene, struct Object *ob, int update);
-int EDBM_backbuf_border_init(struct ViewContext *vc, short xmin, short ymin, short xmax, short ymax);
+bool EDBM_backbuf_border_init(struct ViewContext *vc, short xmin, short ymin, short xmax, short ymax);
int EDBM_backbuf_check(unsigned int index);
void EDBM_backbuf_free(void);
-int EDBM_backbuf_border_mask_init(struct ViewContext *vc, const int mcords[][2], short tot,
+bool EDBM_backbuf_border_mask_init(struct ViewContext *vc, const int mcords[][2], short tot,
short xmin, short ymin, short xmax, short ymax);
-int EDBM_backbuf_circle_init(struct ViewContext *vc, short xs, short ys, short rads);
+bool EDBM_backbuf_circle_init(struct ViewContext *vc, short xs, short ys, short rads);
-struct BMVert *EDBM_vert_find_nearest(struct ViewContext *vc, float *r_dist, const short sel, const short strict);
+struct BMVert *EDBM_vert_find_nearest(struct ViewContext *vc, float *r_dist, const bool sel, const bool strict);
struct BMEdge *EDBM_edge_find_nearest(struct ViewContext *vc, float *r_dist);
struct BMFace *EDBM_face_find_nearest(struct ViewContext *vc, float *r_dist);
-int EDBM_select_pick(struct bContext *C, const int mval[2], short extend, short deselect, short toggle);
+bool EDBM_select_pick(struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle);
void EDBM_selectmode_set(struct BMEditMesh *em);
void EDBM_selectmode_convert(struct BMEditMesh *em, const short selectmode_old, const short selectmode_new);
/* user access this */
-int EDBM_selectmode_toggle(struct bContext *C, const short selectmode_new,
- const int action, const int use_extend, const int use_expand);
+bool EDBM_selectmode_toggle(struct bContext *C, const short selectmode_new,
+ const int action, const bool use_extend, const bool use_expand);
+bool EDBM_selectmode_disable(struct Scene *scene, struct BMEditMesh *em,
+ const short selectmode_disable,
+ const short selectmode_fallback);
void EDBM_deselect_by_material(struct BMEditMesh *em, const short index, const short select);
@@ -183,17 +186,17 @@ void EMBM_project_snap_verts(struct bContext *C, struct ARegion *ar, struct BMEd
/* editface.c */
void paintface_flush_flags(struct Object *ob);
-int paintface_mouse_select(struct bContext *C, struct Object *ob, const int mval[2], int extend, int deselect, int toggle);
-int do_paintface_box_select(struct ViewContext *vc, struct rcti *rect, int select, int extend);
-void paintface_deselect_all_visible(struct Object *ob, int action, short flush_flags);
+bool paintface_mouse_select(struct bContext *C, struct Object *ob, const int mval[2], bool extend, bool deselect, bool toggle);
+int do_paintface_box_select(struct ViewContext *vc, struct rcti *rect, bool select, bool extend);
+void paintface_deselect_all_visible(struct Object *ob, int action, bool flush_flags);
void paintface_select_linked(struct bContext *C, struct Object *ob, const int mval[2], int mode);
-int paintface_minmax(struct Object *ob, float r_min[3], float r_max[3]);
+bool paintface_minmax(struct Object *ob, float r_min[3], float r_max[3]);
void paintface_hide(struct Object *ob, const int unselected);
void paintface_reveal(struct Object *ob);
-void paintvert_deselect_all_visible(struct Object *ob, int action, short flush_flags);
-void paintvert_select_ungrouped(struct Object *ob, short extend, short flush_flags);
+void paintvert_deselect_all_visible(struct Object *ob, int action, bool flush_flags);
+void paintvert_select_ungrouped(struct Object *ob, bool extend, bool flush_flags);
void paintvert_flush_flags(struct Object *ob);
/* mirrtopo */
@@ -204,9 +207,9 @@ typedef struct MirrTopoStore_t {
int prev_ob_mode;
} MirrTopoStore_t;
-int ED_mesh_mirrtopo_recalc_check(struct Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_topo_store);
+bool ED_mesh_mirrtopo_recalc_check(struct Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_topo_store);
void ED_mesh_mirrtopo_init(struct Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_topo_store,
- const short skip_em_vert_array_init);
+ const bool skip_em_vert_array_init);
void ED_mesh_mirrtopo_free(MirrTopoStore_t *mesh_topo_store);
@@ -251,13 +254,16 @@ void ED_mesh_calc_tessface(struct Mesh *mesh);
void ED_mesh_material_link(struct Mesh *me, struct Material *ma);
void ED_mesh_update(struct Mesh *mesh, struct bContext *C, int calc_edges, int calc_tessface);
-int ED_mesh_uv_texture_add(struct bContext *C, struct Mesh *me, const char *name, int active_set);
-int ED_mesh_uv_texture_remove(struct bContext *C, struct Object *ob, struct Mesh *me);
+int ED_mesh_uv_texture_add(struct Mesh *me, const char *name, const bool active_set);
+bool ED_mesh_uv_texture_remove_index(struct Mesh *me, const int n);
+bool ED_mesh_uv_texture_remove_active(struct Mesh *me);
+bool ED_mesh_uv_texture_remove_named(struct Mesh *me, const char *name);
int ED_mesh_uv_loop_reset(struct bContext *C, struct Mesh *me);
int ED_mesh_uv_loop_reset_ex(struct Mesh *me, const int layernum);
-int ED_mesh_color_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me, const char *name, int active_set);
-int ED_mesh_color_remove(struct bContext *C, struct Object *ob, struct Mesh *me);
-int ED_mesh_color_remove_named(struct bContext *C, struct Object *ob, struct Mesh *me, const char *name);
+int ED_mesh_color_add(struct Mesh *me, const char *name, const bool active_set);
+bool ED_mesh_color_remove_index(struct Mesh *me, const int n);
+bool ED_mesh_color_remove_active(struct Mesh *me);
+bool ED_mesh_color_remove_named(struct Mesh *me, const char *name);
/* mesh backup */
typedef struct BMBackup {
@@ -286,9 +292,9 @@ int mesh_get_x_mirror_vert(struct Object *ob, int index);
struct BMVert *editbmesh_get_x_mirror_vert(struct Object *ob, struct BMEditMesh *em, struct BMVert *eve, const float co[3], int index);
int *mesh_get_x_mirror_faces(struct Object *ob, struct BMEditMesh *em);
-int ED_mesh_pick_vert(struct bContext *C, struct Object *ob, const int mval[2], unsigned int *index, int size, int use_zbuf);
-int ED_mesh_pick_face(struct bContext *C, struct Object *ob, const int mval[2], unsigned int *index, int size);
-int ED_mesh_pick_face_vert(struct bContext *C, struct Object *ob, const int mval[2], unsigned int *index, int size);
+bool ED_mesh_pick_vert(struct bContext *C, struct Object *ob, const int mval[2], unsigned int *index, int size, bool use_zbuf);
+bool ED_mesh_pick_face(struct bContext *C, struct Object *ob, const int mval[2], unsigned int *index, int size);
+bool ED_mesh_pick_face_vert(struct bContext *C, struct Object *ob, const int mval[2], unsigned int *index, int size);
#define ED_MESH_PICK_DEFAULT_VERT_SIZE 50
#define ED_MESH_PICK_DEFAULT_FACE_SIZE 3
diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h
index 2c43f6e4f25..e23465f15a8 100644
--- a/source/blender/editors/include/ED_object.h
+++ b/source/blender/editors/include/ED_object.h
@@ -128,8 +128,9 @@ void ED_object_toggle_modes(struct bContext *C, int mode);
#define EM_WAITCURSOR 4
#define EM_DO_UNDO 8
#define EM_IGNORE_LAYER 16
-void ED_object_exit_editmode(struct bContext *C, int flag);
-void ED_object_enter_editmode(struct bContext *C, int flag);
+void ED_object_editmode_exit(struct bContext *C, int flag);
+void ED_object_editmode_enter(struct bContext *C, int flag);
+bool ED_object_editmode_load(struct Object *obedit);
void ED_object_location_from_view(struct bContext *C, float loc[3]);
void ED_object_rotation_from_view(struct bContext *C, float rot[3]);
@@ -164,7 +165,7 @@ void ED_object_constraint_update(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);
+bool mouse_lattice(struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle);
void undo_push_lattice(struct bContext *C, const char *name);
/* object_lattice.c */
@@ -190,7 +191,7 @@ int ED_object_modifier_apply(struct ReportList *reports, struct Scene *scene,
struct Object *ob, struct ModifierData *md, int mode);
int ED_object_modifier_copy(struct ReportList *reports, struct Object *ob, struct ModifierData *md);
-int ED_object_iter_other(struct Main *bmain, struct Object *orig_ob, int include_orig,
+int ED_object_iter_other(struct Main *bmain, struct Object *orig_ob, const bool include_orig,
int (*callback)(struct Object *ob, void *callback_data),
void *callback_data);
diff --git a/source/blender/editors/include/ED_particle.h b/source/blender/editors/include/ED_particle.h
index dee97c7882a..f9516f255cf 100644
--- a/source/blender/editors/include/ED_particle.h
+++ b/source/blender/editors/include/ED_particle.h
@@ -58,10 +58,10 @@ void PE_hide_keys_time(struct Scene *scene, struct PTCacheEdit *edit, float cfra
void PE_update_object(struct Scene *scene, struct Object *ob, int useflag);
/* selection tools */
-int PE_mouse_particles(struct bContext *C, const int mval[2], int extend, int deselect, int toggle);
-int PE_border_select(struct bContext *C, struct rcti *rect, int select, int extend);
+int PE_mouse_particles(struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle);
+int PE_border_select(struct bContext *C, struct rcti *rect, bool select, bool extend);
int PE_circle_select(struct bContext *C, int selecting, const int mval[2], float rad);
-int PE_lasso_select(struct bContext *C, const int mcords[][2], const short moves, short extend, short select);
+int PE_lasso_select(struct bContext *C, const int mcords[][2], const short moves, bool extend, bool select);
void PE_deselect_all_visible(struct PTCacheEdit *edit);
/* undo */
diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h
index 6101d03b946..d43582fa8d1 100644
--- a/source/blender/editors/include/ED_transform.h
+++ b/source/blender/editors/include/ED_transform.h
@@ -52,7 +52,7 @@ void transform_operatortypes(void);
/* ******************** Macros & Prototypes *********************** */
/* MODE AND NUMINPUT FLAGS */
-enum {
+enum TfmMode {
TFM_INIT = -1,
TFM_DUMMY,
TFM_TRANSLATION,
@@ -85,7 +85,7 @@ enum {
TFM_EDGE_SLIDE,
TFM_VERT_SLIDE,
TFM_SEQ_SLIDE
-} TfmMode;
+};
/* TRANSFORM CONTEXTS */
#define CTX_NONE 0
@@ -125,7 +125,7 @@ void BIF_createTransformOrientation(struct bContext *C, struct ReportList *repor
void BIF_selectTransformOrientation(struct bContext *C, struct TransformOrientation *ts);
void BIF_selectTransformOrientationValue(struct bContext *C, int orientation);
-void ED_getTransformOrientationMatrix(const struct bContext *C, float orientation_mat[3][3], int activeOnly);
+void ED_getTransformOrientationMatrix(const struct bContext *C, float orientation_mat[3][3], const bool activeOnly);
struct EnumPropertyItem *BIF_enumTransformOrientation(struct bContext *C);
const char *BIF_menustringTransformOrientation(const struct bContext *C, const char *title); /* the returned value was allocated and needs to be freed after use */
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index 12afeb2d343..81f49b4e1f8 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -79,7 +79,7 @@ typedef struct ViewDepths {
float *depths;
double depth_range[2];
- char damaged;
+ bool damaged;
} ViewDepths;
float *give_cursor(struct Scene *scene, struct View3D *v3d);
@@ -201,8 +201,10 @@ void ED_view3d_global_to_vector(const struct RegionView3D *rv3d, const float coo
void ED_view3d_win_to_3d(const struct ARegion *ar, const float depth_pt[3], const float mval[2], float out[3]);
void ED_view3d_win_to_delta(const struct ARegion *ar, const float mval[2], float out[3], const float zfac);
void ED_view3d_win_to_vector(const struct ARegion *ar, const float mval[2], float out[3]);
-void ED_view3d_win_to_segment(const struct ARegion *ar, struct View3D *v3d, const float mval[2], float ray_start[3], float ray_end[3]);
-int ED_view3d_win_to_segment_clip(const struct ARegion *ar, struct View3D *v3d, const float mval[2], float ray_start[3], float ray_end[3]);
+void ED_view3d_win_to_segment(const struct ARegion *ar, struct View3D *v3d, const float mval[2],
+ float ray_start[3], float ray_end[3]);
+bool ED_view3d_win_to_segment_clip(const struct ARegion *ar, struct View3D *v3d, const float mval[2],
+ float ray_start[3], float ray_end[3]);
void ED_view3d_ob_project_mat_get(const struct RegionView3D *v3d, struct Object *ob, float pmat[4][4]);
void ED_view3d_unproject(struct bglMats *mats, float out[3], const float x, const float y, const float z);
@@ -223,7 +225,7 @@ void ED_view3d_calc_camera_border_size(struct Scene *scene, struct ARegion *ar,
void ED_view3d_clipping_calc(struct BoundBox *bb, float planes[4][4], struct bglMats *mats, const struct rcti *rect);
void ED_view3d_clipping_local(struct RegionView3D *rv3d, float mat[4][4]);
-int ED_view3d_clipping_test(struct RegionView3D *rv3d, const float co[3], const bool is_local);
+bool ED_view3d_clipping_test(struct RegionView3D *rv3d, const float co[3], const bool is_local);
void ED_view3d_clipping_set(struct RegionView3D *rv3d);
void ED_view3d_clipping_enable(void);
void ED_view3d_clipping_disable(void);
@@ -244,13 +246,13 @@ unsigned int view3d_sample_backbuf_rect(struct ViewContext *vc, const int mval[2
unsigned int view3d_sample_backbuf(struct ViewContext *vc, int x, int y);
/* draws and does a 4x4 sample */
-int ED_view3d_autodist(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, const int mval[2], float mouse_worldloc[3], bool alphaoverride);
+bool ED_view3d_autodist(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, const int mval[2], float mouse_worldloc[3], bool alphaoverride);
/* only draw so ED_view3d_autodist_simple can be called many times after */
-int ED_view3d_autodist_init(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, int mode);
-int ED_view3d_autodist_simple(struct ARegion *ar, const int mval[2], float mouse_worldloc[3], int margin, float *force_depth);
-int ED_view3d_autodist_depth(struct ARegion *ar, const int mval[2], int margin, float *depth);
-int ED_view3d_autodist_depth_seg(struct ARegion *ar, const int mval_sta[2], const int mval_end[2], int margin, float *depth);
+void ED_view3d_autodist_init(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, int mode);
+bool ED_view3d_autodist_simple(struct ARegion *ar, const int mval[2], float mouse_worldloc[3], int margin, float *force_depth);
+bool ED_view3d_autodist_depth(struct ARegion *ar, const int mval[2], int margin, float *depth);
+bool ED_view3d_autodist_depth_seg(struct ARegion *ar, const int mval_sta[2], const int mval_end[2], int margin, float *depth);
/* select */
#define MAXPICKBUF 10000
@@ -264,11 +266,11 @@ void view3d_opengl_read_pixels(struct ARegion *ar, int x, int y, int w, int h, i
void view3d_get_transformation(const struct ARegion *ar, struct RegionView3D *rv3d, struct Object *ob, struct bglMats *mats);
/* XXX should move to BLI_math */
-int edge_inside_circle(const float cent[2], float radius, const float screen_co_a[2], const float screen_co_b[2]);
+bool edge_inside_circle(const float cent[2], float radius, const float screen_co_a[2], const float screen_co_b[2]);
/* get 3d region from context, also if mouse is in header or toolbar */
struct RegionView3D *ED_view3d_context_rv3d(struct bContext *C);
-int ED_view3d_context_user_region(struct bContext *C, struct View3D **r_v3d, struct ARegion **r_ar);
+bool ED_view3d_context_user_region(struct bContext *C, struct View3D **r_v3d, struct ARegion **r_ar);
int ED_operator_rv3d_user_region_poll(struct bContext *C);
void ED_view3d_init_mats_rv3d(struct Object *ob, struct RegionView3D *rv3d);
@@ -276,19 +278,19 @@ void ED_view3d_init_mats_rv3d_gl(struct Object *ob, struct RegionView3D *rv3d);
int ED_view3d_scene_layer_set(int lay, const int *values, int *active);
-int ED_view3d_context_activate(struct bContext *C);
+bool ED_view3d_context_activate(struct bContext *C);
void ED_view3d_draw_offscreen_init(struct Scene *scene, struct View3D *v3d);
void ED_view3d_draw_offscreen(struct Scene *scene, struct View3D *v3d, struct ARegion *ar,
- int winx, int winy, float viewmat[4][4], float winmat[4][4], int do_bgpic);
+ int winx, int winy, float viewmat[4][4], float winmat[4][4], bool do_bgpic);
struct ImBuf *ED_view3d_draw_offscreen_imbuf(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, int sizex, int sizey, unsigned int flag,
- int draw_background, int alpha_mode, char err_out[256]);
+ bool draw_background, int alpha_mode, char err_out[256]);
struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(struct Scene *scene, struct Object *camera, int width, int height, unsigned int flag, int drawtype,
- int use_solid_tex, int draw_background, int alpha_mode, char err_out[256]);
+ bool use_solid_tex, bool draw_background, int alpha_mode, char err_out[256]);
void ED_view3d_offscreen_sky_color_get(struct Scene *scene, float sky_color[3]);
struct Base *ED_view3d_give_base_under_cursor(struct bContext *C, const int mval[2]);
-void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar, short do_clip);
+void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar, bool do_clip);
void ED_view3d_update_viewmat(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, float viewmat[4][4], float winmat[4][4]);
bool ED_view3d_lock(struct RegionView3D *rv3d);
@@ -297,11 +299,11 @@ uint64_t ED_view3d_screen_datamask(struct bScreen *screen);
uint64_t ED_view3d_object_datamask(struct Scene *scene);
/* camera lock functions */
-int ED_view3d_camera_lock_check(struct View3D *v3d, struct RegionView3D *rv3d);
+bool ED_view3d_camera_lock_check(struct View3D *v3d, struct RegionView3D *rv3d);
/* copy the camera to the view before starting a view transformation */
void ED_view3d_camera_lock_init(struct View3D *v3d, struct RegionView3D *rv3d);
/* copy the view to the camera, return TRUE if */
-int ED_view3d_camera_lock_sync(struct View3D *v3d, struct RegionView3D *rv3d);
+bool ED_view3d_camera_lock_sync(struct View3D *v3d, struct RegionView3D *rv3d);
void ED_view3D_lock_clear(struct View3D *v3d);
diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h
index 0560cbd69cc..2e2842210c2 100644
--- a/source/blender/editors/include/UI_icons.h
+++ b/source/blender/editors/include/UI_icons.h
@@ -748,10 +748,8 @@ DEF_ICON(PASTEFLIPDOWN)
DEF_ICON(BLANK230)
#endif
DEF_ICON(SNAP_SURFACE)
-#ifndef DEF_ICON_BLANK_SKIP
- DEF_ICON(BLANK232)
- DEF_ICON(BLANK233)
-#endif
+DEF_ICON(AUTOMERGE_ON)
+DEF_ICON(AUTOMERGE_OFF)
DEF_ICON(RETOPO)
DEF_ICON(UV_VERTEXSEL)
DEF_ICON(UV_EDGESEL)
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index f805b199280..3b4415703d5 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -223,7 +223,7 @@ typedef enum {
NUMSLI = (14 << 9),
COLOR = (15 << 9),
IDPOIN = (16 << 9),
- HSVSLI = (17 << 9), /* UNUSED, but code still references */
+ /* HSVSLI = (17 << 9), */ /* UNUSED */
SCROLL = (18 << 9),
BLOCK = (19 << 9),
BUTM = (20 << 9),
@@ -608,7 +608,7 @@ uiBut *uiDefHotKeyevtButS(uiBlock *block, int retval, const char *str, int x, in
uiBut *uiDefSearchBut(uiBlock *block, void *arg, int retval, int icon, int maxlen, int x, int y, short width, short height, float a1, float a2, const char *tip);
uiBut *uiDefAutoButR(uiBlock *block, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, const char *name, int icon, int x1, int y1, int x2, int y2);
-int uiDefAutoButsRNA(uiLayout *layout, struct PointerRNA *ptr, int (*check_prop)(struct PointerRNA *, struct PropertyRNA *), const char label_align);
+int uiDefAutoButsRNA(uiLayout *layout, struct PointerRNA *ptr, bool (*check_prop)(struct PointerRNA *, struct PropertyRNA *), const char label_align);
/* Links
*
@@ -762,7 +762,7 @@ void uiLayoutSetContextPointer(uiLayout *layout, const char *name, struct Pointe
void uiLayoutContextCopy(uiLayout *layout, struct bContextStore *context);
const char *uiLayoutIntrospect(uiLayout *layout); // XXX - testing
void uiLayoutOperatorButs(const struct bContext *C, struct uiLayout *layout, struct wmOperator *op,
- int (*check_prop)(struct PointerRNA *, struct PropertyRNA *),
+ bool (*check_prop)(struct PointerRNA *, struct PropertyRNA *),
const char label_align, const short flag);
struct MenuType *uiButGetMenuType(uiBut *but);
@@ -922,5 +922,4 @@ void UI_template_fix_linking(void);
int UI_editsource_enable_check(void);
void UI_editsource_active_but_test(uiBut *but);
-#endif /* __UI_INTERFACE_H__ */
-
+#endif /* __UI_INTERFACE_H__ */
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index 308ca8c9355..050e9c81f2a 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -310,4 +310,4 @@ const unsigned char *UI_ThemeGetColorPtr(struct bTheme *btheme, int spacetype, i
void UI_make_axis_color(const unsigned char *src_col, unsigned char *dst_col, const char axis);
-#endif /* UI_ICONS_H */
+#endif /* UI_RESOURCES_H */
diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h
index 3743539a9bd..100e72e18ed 100644
--- a/source/blender/editors/include/UI_view2d.h
+++ b/source/blender/editors/include/UI_view2d.h
@@ -47,7 +47,7 @@
* and settings for a View2D region, and that set of settings is used in more
* than one specific place
*/
-enum {
+enum eView2D_CommonViewTypes {
/* custom view type (region has defined all necessary flags already) */
V2D_COMMONVIEW_CUSTOM = -1,
/* standard (only use this when setting up a new view, as a sensible base for most settings) */
@@ -60,7 +60,7 @@ enum {
V2D_COMMONVIEW_HEADER,
/* ui region containing panels */
V2D_COMMONVIEW_PANELS_UI
-} eView2D_CommonViewTypes;
+};
/* ---- Defines for Scroller/Grid Arguments ----- */
@@ -68,7 +68,7 @@ enum {
#define V2D_ARG_DUMMY -1
/* Grid units */
-enum {
+enum eView2D_Units {
/* for drawing time */
V2D_UNIT_SECONDS = 0,
V2D_UNIT_FRAMES,
@@ -79,16 +79,16 @@ enum {
V2D_UNIT_DEGREES,
V2D_UNIT_TIME,
V2D_UNIT_SECONDSSEQ
-} eView2D_Units;
+};
/* clamping of grid values to whole numbers */
-enum {
+enum eView2D_Clamp {
V2D_GRID_NOCLAMP = 0,
V2D_GRID_CLAMP
-} eView2D_Clamp;
+};
/* flags for grid-lines to draw */
-enum {
+enum eView2D_Gridlines {
V2D_HORIZONTAL_LINES = (1 << 0),
V2D_VERTICAL_LINES = (1 << 1),
V2D_HORIZONTAL_AXIS = (1 << 2),
@@ -97,7 +97,7 @@ enum {
V2D_GRIDLINES_MAJOR = (V2D_VERTICAL_LINES | V2D_VERTICAL_AXIS | V2D_HORIZONTAL_LINES | V2D_HORIZONTAL_AXIS),
V2D_GRIDLINES_ALL = (V2D_GRIDLINES_MAJOR | V2D_HORIZONTAL_FINELINES),
-} eView2D_Gridlines;
+};
/* ------ Defines for Scrollers ----- */
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 4f0d788d733..16598511921 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -1492,18 +1492,6 @@ double ui_get_but_val(uiBut *but)
break;
}
}
- else if (but->type == HSVSLI) {
- float *fp, hsv[3];
-
- fp = (but->editvec) ? but->editvec : (float *)but->poin;
- rgb_to_hsv_v(fp, hsv);
-
- switch (but->str[0]) {
- case 'H': value = hsv[0]; break;
- case 'S': value = hsv[1]; break;
- case 'V': value = hsv[2]; break;
- }
- }
else if (but->pointype == UI_BUT_POIN_CHAR) {
value = *(char *)but->poin;
}
@@ -1570,21 +1558,6 @@ void ui_set_but_val(uiBut *but, double value)
else if (but->pointype == 0) {
/* pass */
}
- else if (but->type == HSVSLI) {
- float *fp, hsv[3];
-
- fp = (but->editvec) ? but->editvec : (float *)but->poin;
- rgb_to_hsv_v(fp, hsv);
-
- switch (but->str[0]) {
- case 'H': hsv[0] = value; break;
- case 'S': hsv[1] = value; break;
- case 'V': hsv[2] = value; break;
- }
-
- hsv_to_rgb_v(hsv, fp);
-
- }
else {
/* first do rounding */
if (but->pointype == UI_BUT_POIN_CHAR) {
@@ -2300,7 +2273,6 @@ void ui_check_but(uiBut *but)
case SLI:
case SCROLL:
case NUMSLI:
- case HSVSLI:
UI_GET_BUT_VALUE_INIT(but, value);
if (value < (double)but->hardmin) ui_set_but_val(but, but->hardmin);
else if (value > (double)but->hardmax) ui_set_but_val(but, but->hardmax);
@@ -2360,7 +2332,6 @@ void ui_check_but(uiBut *but)
case NUM:
case NUMSLI:
- case HSVSLI:
case NUMABS:
UI_GET_BUT_VALUE_INIT(but, value);
@@ -2786,7 +2757,7 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
but->pos = -1; /* cursor invisible */
- if (ELEM4(but->type, NUM, NUMABS, NUMSLI, HSVSLI)) { /* add a space to name */
+ if (ELEM3(but->type, NUM, NUMABS, NUMSLI)) { /* add a space to name */
/* slen remains unchanged from previous assignment, ensure this stays true */
if (slen > 0 && slen < UI_MAX_NAME_STR - 2) {
if (but->str[slen - 1] != ' ') {
@@ -3963,7 +3934,7 @@ void uiButGetStrInfo(bContext *C, uiBut *but, ...)
}
}
else if (type == BUT_GET_RNA_LABEL_CONTEXT) {
- const char *_tmp = NULL;
+ const char *_tmp = BLF_I18NCONTEXT_DEFAULT;
if (but->rnaprop)
_tmp = RNA_property_translation_context(but->rnaprop);
else if (but->optype)
@@ -3973,8 +3944,8 @@ void uiButGetStrInfo(bContext *C, uiBut *but, ...)
if (mt)
_tmp = RNA_struct_translation_context(mt->ext.srna);
}
- if (!_tmp) { /* _tmp == BLF_I18NCONTEXT_DEFAULT */
- _tmp = BLF_I18NCONTEXT_DEFAULT_BPY;
+ if (BLF_is_default_context(_tmp)) {
+ _tmp = BLF_I18NCONTEXT_DEFAULT_BPYRNA;
}
tmp = BLI_strdup(_tmp);
}
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 54a173af603..b34f4c9653f 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -1270,8 +1270,6 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
case NUMSLI:
ui_apply_but_NUM(C, but, data);
break;
- case HSVSLI:
- break;
case TOG3:
ui_apply_but_TOG3(C, but, data);
break;
@@ -1393,7 +1391,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
}
/* numeric value */
- if (ELEM4(but->type, NUM, NUMABS, NUMSLI, HSVSLI)) {
+ if (ELEM3(but->type, NUM, NUMABS, NUMSLI)) {
if (but->poin == NULL && but->rnapoin.data == NULL) {
/* pass */
@@ -2053,7 +2051,7 @@ static void ui_textedit_next_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa
return;
for (but = actbut->next; but; but = but->next) {
- if (ELEM8(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI, IDPOIN, SEARCH_MENU, SEARCH_MENU_UNLINK)) {
+ if (ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, IDPOIN, SEARCH_MENU, SEARCH_MENU_UNLINK)) {
if (!(but->flag & UI_BUT_DISABLED)) {
data->postbut = but;
data->posttype = BUTTON_ACTIVATE_TEXT_EDITING;
@@ -2062,7 +2060,7 @@ static void ui_textedit_next_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa
}
}
for (but = block->buttons.first; but != actbut; but = but->next) {
- if (ELEM8(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI, IDPOIN, SEARCH_MENU, SEARCH_MENU_UNLINK)) {
+ if (ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, IDPOIN, SEARCH_MENU, SEARCH_MENU_UNLINK)) {
if (!(but->flag & UI_BUT_DISABLED)) {
data->postbut = but;
data->posttype = BUTTON_ACTIVATE_TEXT_EDITING;
@@ -2081,7 +2079,7 @@ static void ui_textedit_prev_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa
return;
for (but = actbut->prev; but; but = but->prev) {
- if (ELEM8(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI, IDPOIN, SEARCH_MENU, SEARCH_MENU_UNLINK)) {
+ if (ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, IDPOIN, SEARCH_MENU, SEARCH_MENU_UNLINK)) {
if (!(but->flag & UI_BUT_DISABLED)) {
data->postbut = but;
data->posttype = BUTTON_ACTIVATE_TEXT_EDITING;
@@ -2090,7 +2088,7 @@ static void ui_textedit_prev_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa
}
}
for (but = block->buttons.last; but != actbut; but = but->prev) {
- if (ELEM8(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI, IDPOIN, SEARCH_MENU, SEARCH_MENU_UNLINK)) {
+ if (ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, IDPOIN, SEARCH_MENU, SEARCH_MENU_UNLINK)) {
if (!(but->flag & UI_BUT_DISABLED)) {
data->postbut = but;
data->posttype = BUTTON_ACTIVATE_TEXT_EDITING;
@@ -3121,10 +3119,6 @@ static bool ui_numedit_but_SLI(uiBut *but, uiHandleButtonData *data,
offs = (BLI_rctf_size_y(&but->rect) / 2.0f) * but->aspect;
deler = BLI_rctf_size_x(&but->rect) - offs;
}
- else if (but->type == HSVSLI) {
- offs = (BLI_rctf_size_y(&but->rect) / 2.0f) * but->aspect;
- deler = (BLI_rctf_size_x(&but->rect) / 2.0f) - offs;
- }
else if (but->type == SCROLL) {
const float size = (is_horizontal) ? BLI_rctf_size_x(&but->rect) : -BLI_rctf_size_y(&but->rect);
deler = size * (but->softmax - but->softmin) / (but->softmax - but->softmin + but->a1);
@@ -5423,7 +5417,6 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent *
break;
case SLI:
case NUMSLI:
- case HSVSLI:
retval = ui_do_but_SLI(C, block, but, data, event);
break;
case ROUNDBOX:
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 19b863dd6fa..9f836ed789f 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -208,12 +208,6 @@ struct uiBut {
struct bContextStore *context;
- /* not used yet, was used in 2.4x for ui_draw_pulldown_round & friends */
-#if 0
- void (*embossfunc)(int, int, float, float, float, float, float, int);
- void (*sliderfunc)(int, float, float, float, float, float, float, int);
-#endif
-
uiButCompleteFunc autocomplete_func;
void *autofunc_arg;
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 2ca26ae5317..53887163778 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -1599,6 +1599,14 @@ static uiBut *uiItemL_(uiLayout *layout, const char *name, int icon)
else
but = uiDefBut(block, LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+ /* to compensate for string size padding in ui_text_icon_width,
+ * make text aligned right if the layout is aligned right.
+ */
+ if (uiLayoutGetAlignment(layout) == UI_LAYOUT_ALIGN_RIGHT) {
+ but->flag &= ~UI_TEXT_LEFT; /* default, needs to be unset */
+ but->flag |= UI_TEXT_RIGHT;
+ }
+
return but;
}
@@ -2914,7 +2922,7 @@ static void ui_layout_operator_buts__reset_cb(bContext *UNUSED(C), void *op_pt,
/* this function does not initialize the layout, functions can be called on the layout before and after */
void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op,
- int (*check_prop)(struct PointerRNA *, struct PropertyRNA *),
+ bool (*check_prop)(struct PointerRNA *, struct PropertyRNA *),
const char label_align, const short flag)
{
if (!op->properties) {
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index a741ea432a5..ca26044f662 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -1378,19 +1378,5 @@ static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelStat
}
ED_region_tag_redraw(ar);
-
- /* XXX exception handling, 3d window preview panel */
-#if 0
- if (block->drawextra == BIF_view3d_previewdraw)
- BIF_view3d_previewrender_clear(curarea);
-#endif
-
- /* XXX exception handling, 3d window preview panel */
-#if 0
- if (block->drawextra == BIF_view3d_previewdraw)
- BIF_view3d_previewrender_signal(curarea, PR_DISPRECT);
- else if (strcmp(block->name, "image_panel_preview") == 0)
- image_preview_event(2);
-#endif
}
diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c
index 7c84784c46b..3bf1a1a7701 100644
--- a/source/blender/editors/interface/interface_utils.c
+++ b/source/blender/editors/interface/interface_utils.c
@@ -137,7 +137,7 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
* in cases where PROP_HIDDEN flag can't be used for a property.
*/
int uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr,
- int (*check_prop)(PointerRNA *, PropertyRNA *),
+ bool (*check_prop)(PointerRNA *, PropertyRNA *),
const char label_align)
{
uiLayout *split, *col;
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index f2e553bd140..96c8ded46da 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -1147,6 +1147,8 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
if (but->editstr || (but->flag & UI_TEXT_LEFT))
fstyle->align = UI_STYLE_TEXT_LEFT;
+ else if (but->flag & UI_TEXT_RIGHT)
+ fstyle->align = UI_STYLE_TEXT_RIGHT;
else
fstyle->align = UI_STYLE_TEXT_CENTER;
@@ -1333,10 +1335,16 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
if (but->editstr || (but->flag & UI_TEXT_LEFT)) {
rect->xmin += (UI_TEXT_MARGIN_X * U.widget_unit) / but->block->aspect;
}
+ else if ((but->flag & UI_TEXT_RIGHT)) {
+ rect->xmax -= (UI_TEXT_MARGIN_X * U.widget_unit) / but->block->aspect;
+ }
}
else if ((but->flag & UI_TEXT_LEFT)) {
rect->xmin += (UI_TEXT_MARGIN_X * U.widget_unit) / but->block->aspect;
}
+ else if ((but->flag & UI_TEXT_RIGHT)) {
+ rect->xmax -= (UI_TEXT_MARGIN_X * U.widget_unit) / but->block->aspect;
+ }
/* unlink icon for this button type */
if (but->type == SEARCH_MENU_UNLINK && but->drawstr[0]) {
@@ -3216,7 +3224,6 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
break;
case NUMSLI:
- case HSVSLI:
wt = widget_type(UI_WTYPE_SLIDER);
break;
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index 013b6d3c606..a66169d54ae 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -2086,13 +2086,8 @@ void UI_view2d_getcenter(struct View2D *v2d, float *x, float *y)
}
void UI_view2d_setcenter(struct View2D *v2d, float x, float y)
{
- /* get delta from current center */
- float dx = x - BLI_rctf_cent_x(&v2d->cur);
- float dy = y - BLI_rctf_cent_y(&v2d->cur);
+ BLI_rctf_recenter(&v2d->cur, x, y);
- /* add to cur */
- BLI_rctf_translate(&v2d->cur, dx, dy);
-
/* make sure that 'cur' rect is in a valid state as a result of these changes */
UI_view2d_curRect_validate(v2d);
}
diff --git a/source/blender/editors/io/io_collada.c b/source/blender/editors/io/io_collada.c
index c673e0fb2b0..a1bb7a8ae88 100644
--- a/source/blender/editors/io/io_collada.c
+++ b/source/blender/editors/io/io_collada.c
@@ -127,7 +127,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
second_life = RNA_boolean_get(op->ptr, "second_life");
/* get editmode results */
- ED_object_exit_editmode(C, 0); /* 0 = does not exit editmode */
+ ED_object_editmode_load(CTX_data_edit_object(C));
if (collada_export(CTX_data_scene(C),
filepath,
diff --git a/source/blender/editors/io/io_ops.c b/source/blender/editors/io/io_ops.c
index f2a0532932d..a33340cc39a 100644
--- a/source/blender/editors/io/io_ops.c
+++ b/source/blender/editors/io/io_ops.c
@@ -31,6 +31,8 @@
#include "io_collada.h"
+#include "BLI_utildefines.h"
+
#include "WM_types.h"
#include "WM_api.h"
diff --git a/source/blender/editors/mask/mask_select.c b/source/blender/editors/mask/mask_select.c
index ccc2fad5f52..7de6f66f2ef 100644
--- a/source/blender/editors/mask/mask_select.c
+++ b/source/blender/editors/mask/mask_select.c
@@ -252,9 +252,9 @@ static int select_exec(bContext *C, wmOperator *op)
MaskSpline *spline;
MaskSplinePoint *point = NULL;
float co[2];
- short extend = RNA_boolean_get(op->ptr, "extend");
- short deselect = RNA_boolean_get(op->ptr, "deselect");
- short toggle = RNA_boolean_get(op->ptr, "toggle");
+ bool extend = RNA_boolean_get(op->ptr, "extend");
+ bool deselect = RNA_boolean_get(op->ptr, "deselect");
+ bool toggle = RNA_boolean_get(op->ptr, "toggle");
int is_handle = 0;
const float threshold = 19;
@@ -263,7 +263,7 @@ static int select_exec(bContext *C, wmOperator *op)
point = ED_mask_point_find_nearest(C, mask, co, threshold, &masklay, &spline, &is_handle, NULL);
- if (extend == 0 && deselect == 0 && toggle == 0)
+ if (extend == false && deselect == false && toggle == false)
ED_mask_select_toggle_all(mask, SEL_DESELECT);
if (point) {
diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c
index 260d01d726a..d6ae2497cbb 100644
--- a/source/blender/editors/mesh/editface.c
+++ b/source/blender/editors/mesh/editface.c
@@ -203,7 +203,8 @@ static void select_linked_tfaces_with_seams(int mode, Mesh *me, unsigned int ind
MLoop *ml;
MEdge *med;
char *linkflag;
- int a, b, do_it = TRUE, mark = 0;
+ int a, b, mark = 0;
+ bool do_it = true;
ehash = BLI_edgehash_new();
seamhash = BLI_edgehash_new();
@@ -234,7 +235,7 @@ static void select_linked_tfaces_with_seams(int mode, Mesh *me, unsigned int ind
}
while (do_it) {
- do_it = FALSE;
+ do_it = false;
/* expand selection */
mp = me->mpoly;
@@ -257,7 +258,7 @@ static void select_linked_tfaces_with_seams(int mode, Mesh *me, unsigned int ind
if (mark) {
linkflag[a] = 1;
hash_add_face(ehash, mp, me->mloop + mp->loopstart);
- do_it = TRUE;
+ do_it = true;
}
}
}
@@ -315,7 +316,7 @@ void paintface_select_linked(bContext *UNUSED(C), Object *ob, const int UNUSED(m
paintface_flush_flags(ob);
}
-void paintface_deselect_all_visible(Object *ob, int action, short flush_flags)
+void paintface_deselect_all_visible(Object *ob, int action, bool flush_flags)
{
Mesh *me;
MPoly *mpoly;
@@ -374,14 +375,15 @@ void paintface_deselect_all_visible(Object *ob, int action, short flush_flags)
}
}
-int paintface_minmax(Object *ob, float r_min[3], float r_max[3])
+bool paintface_minmax(Object *ob, float r_min[3], float r_max[3])
{
Mesh *me;
MPoly *mp;
MTexPoly *tf;
MLoop *ml;
MVert *mvert;
- int a, b, ok = FALSE;
+ int a, b;
+ bool ok = false;
float vec[3], bmat[3][3];
me = BKE_mesh_from_object(ob);
@@ -404,7 +406,7 @@ int paintface_minmax(Object *ob, float r_min[3], float r_max[3])
minmax_v3v3_v3(r_min, r_max, vec);
}
- ok = TRUE;
+ ok = true;
}
return ok;
@@ -483,7 +485,7 @@ void seam_mark_clear_tface(Scene *scene, short mode)
}
#endif
-int paintface_mouse_select(struct bContext *C, Object *ob, const int mval[2], int extend, int deselect, int toggle)
+bool paintface_mouse_select(struct bContext *C, Object *ob, const int mval[2], bool extend, bool deselect, bool toggle)
{
Mesh *me;
MPoly *mpoly, *mpoly_sel;
@@ -493,13 +495,13 @@ int paintface_mouse_select(struct bContext *C, Object *ob, const int mval[2], in
me = BKE_mesh_from_object(ob);
if (!ED_mesh_pick_face(C, ob, mval, &index, ED_MESH_PICK_DEFAULT_FACE_SIZE))
- return 0;
+ return false;
if (index >= me->totpoly)
- return 0;
+ return false;
mpoly_sel = me->mpoly + index;
- if (mpoly_sel->flag & ME_HIDE) return 0;
+ if (mpoly_sel->flag & ME_HIDE) return false;
/* clear flags */
mpoly = me->mpoly;
@@ -534,10 +536,10 @@ int paintface_mouse_select(struct bContext *C, Object *ob, const int mval[2], in
paintface_flush_flags(ob);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, ob->data);
ED_region_tag_redraw(CTX_wm_region(C)); // XXX - should redraw all 3D views
- return 1;
+ return true;
}
-int do_paintface_box_select(ViewContext *vc, rcti *rect, int select, int extend)
+int do_paintface_box_select(ViewContext *vc, rcti *rect, bool select, bool extend)
{
Object *ob = vc->obact;
Mesh *me;
@@ -556,8 +558,8 @@ int do_paintface_box_select(ViewContext *vc, rcti *rect, int select, int extend)
selar = MEM_callocN(me->totpoly + 1, "selar");
- if (extend == 0 && select) {
- paintface_deselect_all_visible(vc->obact, SEL_DESELECT, FALSE);
+ if (extend == false && select) {
+ paintface_deselect_all_visible(vc->obact, SEL_DESELECT, false);
mpoly = me->mpoly;
for (a = 1; a <= me->totpoly; a++, mpoly++) {
@@ -652,8 +654,8 @@ void paintvert_flush_flags(Object *ob)
}
}
}
-/* note: if the caller passes FALSE to flush_flags, then they will need to run paintvert_flush_flags(ob) themselves */
-void paintvert_deselect_all_visible(Object *ob, int action, short flush_flags)
+/* note: if the caller passes false to flush_flags, then they will need to run paintvert_flush_flags(ob) themselves */
+void paintvert_deselect_all_visible(Object *ob, int action, bool flush_flags)
{
Mesh *me;
MVert *mvert;
@@ -712,7 +714,7 @@ void paintvert_deselect_all_visible(Object *ob, int action, short flush_flags)
}
}
-void paintvert_select_ungrouped(Object *ob, short extend, short flush_flags)
+void paintvert_select_ungrouped(Object *ob, bool extend, bool flush_flags)
{
Mesh *me = BKE_mesh_from_object(ob);
MVert *mv;
@@ -724,7 +726,7 @@ void paintvert_select_ungrouped(Object *ob, short extend, short flush_flags)
}
if (!extend) {
- paintvert_deselect_all_visible(ob, SEL_DESELECT, FALSE);
+ paintvert_deselect_all_visible(ob, SEL_DESELECT, false);
}
dv = me->dvert;
@@ -769,7 +771,7 @@ static int mirrtopo_vert_sort(const void *v1, const void *v2)
return 0;
}
-int ED_mesh_mirrtopo_recalc_check(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_topo_store)
+bool ED_mesh_mirrtopo_recalc_check(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_topo_store)
{
int totvert;
int totedge;
@@ -788,16 +790,16 @@ int ED_mesh_mirrtopo_recalc_check(Mesh *me, const int ob_mode, MirrTopoStore_t *
(totvert != mesh_topo_store->prev_vert_tot) ||
(totedge != mesh_topo_store->prev_edge_tot))
{
- return TRUE;
+ return true;
}
else {
- return FALSE;
+ return false;
}
}
void ED_mesh_mirrtopo_init(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_topo_store,
- const short skip_em_vert_array_init)
+ const bool skip_em_vert_array_init)
{
MEdge *medge;
BMEditMesh *em = me->edit_btmesh;
@@ -900,7 +902,7 @@ void ED_mesh_mirrtopo_init(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_to
index_lookup = MEM_mallocN(totvert * sizeof(*index_lookup), "mesh_topo_lookup");
if (em) {
- if (skip_em_vert_array_init == FALSE) {
+ if (skip_em_vert_array_init == false) {
EDBM_index_arrays_ensure(em, BM_VERT);
}
}
diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c
index 174715495f6..1daf39d3319 100644
--- a/source/blender/editors/mesh/editmesh_add.c
+++ b/source/blender/editors/mesh/editmesh_add.c
@@ -34,6 +34,8 @@
#include "BLI_math.h"
+#include "BLF_translation.h"
+
#include "BKE_context.h"
#include "BKE_library.h"
#include "BKE_tessmesh.h"
@@ -62,17 +64,17 @@ static Object *make_prim_init(bContext *C, const char *idname,
*state = 0;
if (obedit == NULL || obedit->type != OB_MESH) {
- obedit = ED_object_add_type(C, OB_MESH, loc, rot, FALSE, layer);
+ obedit = ED_object_add_type(C, OB_MESH, loc, rot, false, layer);
rename_id((ID *)obedit, idname);
rename_id((ID *)obedit->data, idname);
/* create editmode */
- ED_object_enter_editmode(C, EM_DO_UNDO | EM_IGNORE_LAYER); /* rare cases the active layer is messed up */
+ ED_object_editmode_enter(C, EM_DO_UNDO | EM_IGNORE_LAYER); /* rare cases the active layer is messed up */
*state = 1;
}
- *dia = ED_object_new_primitive_matrix(C, obedit, loc, rot, mat, FALSE);
+ *dia = ED_object_new_primitive_matrix(C, obedit, loc, rot, mat, false);
return obedit;
}
@@ -87,11 +89,11 @@ static void make_prim_finish(bContext *C, Object *obedit, int *state, int enter_
EDBM_selectmode_flush_ex(em, SCE_SELECT_VERTEX);
/* only recalc editmode tessface if we are staying in editmode */
- EDBM_update_generic(em, !exit_editmode, TRUE);
+ EDBM_update_generic(em, !exit_editmode, true);
/* userdef */
if (exit_editmode) {
- ED_object_exit_editmode(C, EM_FREEDATA); /* adding EM_DO_UNDO messes up operator redo */
+ ED_object_editmode_exit(C, EM_FREEDATA); /* adding EM_DO_UNDO messes up operator redo */
}
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obedit);
}
@@ -106,7 +108,7 @@ static int add_primitive_plane_exec(bContext *C, wmOperator *op)
unsigned int layer;
ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
- obedit = make_prim_init(C, "Plane", &dia, mat, &state, loc, rot, layer);
+ obedit = make_prim_init(C, DATA_("Plane"), &dia, mat, &state, loc, rot, layer);
em = BMEdit_FromObject(obedit);
if (!EDBM_op_call_and_selectf(em, op, "verts.out",
@@ -134,7 +136,7 @@ void MESH_OT_primitive_plane_add(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
- ED_object_add_generic_props(ot, TRUE);
+ ED_object_add_generic_props(ot, true);
}
static int add_primitive_cube_exec(bContext *C, wmOperator *op)
@@ -147,7 +149,7 @@ static int add_primitive_cube_exec(bContext *C, wmOperator *op)
unsigned int layer;
ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
- obedit = make_prim_init(C, "Cube", &dia, mat, &state, loc, rot, layer);
+ obedit = make_prim_init(C, DATA_("Cube"), &dia, mat, &state, loc, rot, layer);
em = BMEdit_FromObject(obedit);
if (!EDBM_op_call_and_selectf(em, op, "verts.out", "create_cube matrix=%m4 size=%f", mat, dia * 2.0f)) {
@@ -174,7 +176,7 @@ void MESH_OT_primitive_cube_add(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
- ED_object_add_generic_props(ot, TRUE);
+ ED_object_add_generic_props(ot, true);
}
static const EnumPropertyItem fill_type_items[] = {
@@ -196,7 +198,7 @@ static int add_primitive_circle_exec(bContext *C, wmOperator *op)
cap_tri = (cap_end == 2);
ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
- obedit = make_prim_init(C, "Circle", &dia, mat, &state, loc, rot, layer);
+ obedit = make_prim_init(C, DATA_("Circle"), &dia, mat, &state, loc, rot, layer);
em = BMEdit_FromObject(obedit);
if (!EDBM_op_call_and_selectf(em, op, "verts.out",
@@ -235,7 +237,7 @@ void MESH_OT_primitive_circle_add(wmOperatorType *ot)
RNA_def_property_subtype(prop, PROP_DISTANCE);
RNA_def_enum(ot->srna, "fill_type", fill_type_items, 0, "Fill Type", "");
- ED_object_add_generic_props(ot, TRUE);
+ ED_object_add_generic_props(ot, true);
}
static int add_primitive_cylinder_exec(bContext *C, wmOperator *op)
@@ -251,7 +253,7 @@ static int add_primitive_cylinder_exec(bContext *C, wmOperator *op)
cap_tri = (cap_end == 2);
ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
- obedit = make_prim_init(C, "Cylinder", &dia, mat, &state, loc, rot, layer);
+ obedit = make_prim_init(C, DATA_("Cylinder"), &dia, mat, &state, loc, rot, layer);
em = BMEdit_FromObject(obedit);
if (!EDBM_op_call_and_selectf(
@@ -296,7 +298,7 @@ void MESH_OT_primitive_cylinder_add(wmOperatorType *ot)
RNA_def_property_subtype(prop, PROP_DISTANCE);
RNA_def_enum(ot->srna, "end_fill_type", fill_type_items, 1, "Cap Fill Type", "");
- ED_object_add_generic_props(ot, TRUE);
+ ED_object_add_generic_props(ot, true);
}
static int add_primitive_cone_exec(bContext *C, wmOperator *op)
@@ -312,7 +314,7 @@ static int add_primitive_cone_exec(bContext *C, wmOperator *op)
cap_tri = (cap_end == 2);
ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
- obedit = make_prim_init(C, "Cone", &dia, mat, &state, loc, rot, layer);
+ obedit = make_prim_init(C, DATA_("Cone"), &dia, mat, &state, loc, rot, layer);
em = BMEdit_FromObject(obedit);
if (!EDBM_op_call_and_selectf(
@@ -356,7 +358,7 @@ void MESH_OT_primitive_cone_add(wmOperatorType *ot)
RNA_def_property_subtype(prop, PROP_DISTANCE);
RNA_def_enum(ot->srna, "end_fill_type", fill_type_items, 1, "Base Fill Type", "");
- ED_object_add_generic_props(ot, TRUE);
+ ED_object_add_generic_props(ot, true);
}
static int add_primitive_grid_exec(bContext *C, wmOperator *op)
@@ -369,7 +371,7 @@ static int add_primitive_grid_exec(bContext *C, wmOperator *op)
unsigned int layer;
ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
- obedit = make_prim_init(C, "Grid", &dia, mat, &state, loc, rot, layer);
+ obedit = make_prim_init(C, DATA_("Grid"), &dia, mat, &state, loc, rot, layer);
em = BMEdit_FromObject(obedit);
if (!EDBM_op_call_and_selectf(em, op, "verts.out",
@@ -409,7 +411,7 @@ void MESH_OT_primitive_grid_add(wmOperatorType *ot)
prop = RNA_def_float(ot->srna, "size", 1.0f, 0.0, FLT_MAX, "Size", "", 0.001, FLT_MAX);
RNA_def_property_subtype(prop, PROP_DISTANCE);
- ED_object_add_generic_props(ot, TRUE);
+ ED_object_add_generic_props(ot, true);
}
static int add_primitive_monkey_exec(bContext *C, wmOperator *op)
@@ -425,7 +427,7 @@ static int add_primitive_monkey_exec(bContext *C, wmOperator *op)
if (!view_aligned)
rot[0] += (float)M_PI / 2.0f;
- obedit = make_prim_init(C, "Suzanne", &dia, mat, &state, loc, rot, layer);
+ obedit = make_prim_init(C, DATA_("Suzanne"), &dia, mat, &state, loc, rot, layer);
mat[0][0] *= dia;
mat[1][1] *= dia;
mat[2][2] *= dia;
@@ -455,7 +457,7 @@ void MESH_OT_primitive_monkey_add(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
- ED_object_add_generic_props(ot, TRUE);
+ ED_object_add_generic_props(ot, true);
}
static int add_primitive_uvsphere_exec(bContext *C, wmOperator *op)
@@ -468,7 +470,7 @@ static int add_primitive_uvsphere_exec(bContext *C, wmOperator *op)
unsigned int layer;
ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
- obedit = make_prim_init(C, "Sphere", &dia, mat, &state, loc, rot, layer);
+ obedit = make_prim_init(C, DATA_("Sphere"), &dia, mat, &state, loc, rot, layer);
em = BMEdit_FromObject(obedit);
if (!EDBM_op_call_and_selectf(em, op, "verts.out",
@@ -507,7 +509,7 @@ void MESH_OT_primitive_uv_sphere_add(wmOperatorType *ot)
prop = RNA_def_float(ot->srna, "size", 1.0f, 0.0, FLT_MAX, "Size", "", 0.001, 100.00);
RNA_def_property_subtype(prop, PROP_DISTANCE);
- ED_object_add_generic_props(ot, TRUE);
+ ED_object_add_generic_props(ot, true);
}
static int add_primitive_icosphere_exec(bContext *C, wmOperator *op)
@@ -520,7 +522,7 @@ static int add_primitive_icosphere_exec(bContext *C, wmOperator *op)
unsigned int layer;
ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
- obedit = make_prim_init(C, "Icosphere", &dia, mat, &state, loc, rot, layer);
+ obedit = make_prim_init(C, DATA_("Icosphere"), &dia, mat, &state, loc, rot, layer);
em = BMEdit_FromObject(obedit);
if (!EDBM_op_call_and_selectf(
@@ -559,5 +561,5 @@ void MESH_OT_primitive_ico_sphere_add(wmOperatorType *ot)
prop = RNA_def_float(ot->srna, "size", 1.0f, 0.0f, FLT_MAX, "Size", "", 0.001f, 100.00);
RNA_def_property_subtype(prop, PROP_DISTANCE);
- ED_object_add_generic_props(ot, TRUE);
+ ED_object_add_generic_props(ot, true);
}
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index b5b6a92cbf5..57d3f7406ca 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -1200,7 +1200,7 @@ static BMEdgeHit *knife_edge_tri_isect(KnifeTool_OpData *kcd, BMBVHTree *bmtree,
for (i = 0; i < tot; i++, result++) {
BMLoop *l1;
- BMFace *hitf;
+ BMFace *f_hit;
ListBase *lst;
Ref *ref;
@@ -1233,7 +1233,7 @@ static BMEdgeHit *knife_edge_tri_isect(KnifeTool_OpData *kcd, BMBVHTree *bmtree,
continue;
}
if ((kcd->vc.rv3d->rflag & RV3D_CLIPPING) &&
- ED_view3d_clipping_test(kcd->vc.rv3d, p, TRUE))
+ ED_view3d_clipping_test(kcd->vc.rv3d, p, true))
{
continue;
}
@@ -1243,7 +1243,7 @@ static BMEdgeHit *knife_edge_tri_isect(KnifeTool_OpData *kcd, BMBVHTree *bmtree,
mul_m4_v3(kcd->ob->imat, view);
if (kcd->cut_through) {
- hitf = FALSE;
+ f_hit = NULL;
}
else {
/* check if this point is visible in the viewport */
@@ -1267,11 +1267,11 @@ static BMEdgeHit *knife_edge_tri_isect(KnifeTool_OpData *kcd, BMBVHTree *bmtree,
add_v3_v3(p1, no);
/* ray cast */
- hitf = BMBVH_RayCast(bmtree, p1, no, NULL, NULL);
+ f_hit = BMBVH_RayCast(bmtree, p1, no, NULL, NULL);
}
/* ok, if visible add the new point */
- if (!hitf && !BLI_smallhash_haskey(ehash, (intptr_t)kfe)) {
+ if (!f_hit && !BLI_smallhash_haskey(ehash, (intptr_t)kfe)) {
BMEdgeHit hit;
if (len_squared_v3v3(p, kcd->curr.co) < depsilon_sq ||
@@ -1555,7 +1555,7 @@ static int knife_sample_screen_density(KnifeTool_OpData *kcd, const float radius
dis_sq = len_squared_v2v2(kfv->sco, sco);
if (dis_sq < radius_sq) {
if (kcd->vc.rv3d->rflag & RV3D_CLIPPING) {
- if (ED_view3d_clipping_test(kcd->vc.rv3d, kfv->cageco, TRUE) == 0) {
+ if (ED_view3d_clipping_test(kcd->vc.rv3d, kfv->cageco, true) == 0) {
c++;
}
}
@@ -1634,7 +1634,7 @@ static KnifeEdge *knife_find_closest_edge(KnifeTool_OpData *kcd, float p[3], flo
interp_v3_v3v3(vec, kfe->v1->cageco, kfe->v2->cageco, lambda);
- if (ED_view3d_clipping_test(kcd->vc.rv3d, vec, TRUE) == 0) {
+ if (ED_view3d_clipping_test(kcd->vc.rv3d, vec, true) == 0) {
cure = kfe;
curdis = dis;
}
@@ -1725,7 +1725,7 @@ static KnifeVert *knife_find_closest_vert(KnifeTool_OpData *kcd, float p[3], flo
dis_sq = len_squared_v2v2(kfv->sco, sco);
if (dis_sq < curdis_sq && dis_sq < maxdist_sq) {
if (kcd->vc.rv3d->rflag & RV3D_CLIPPING) {
- if (ED_view3d_clipping_test(kcd->vc.rv3d, kfv->cageco, TRUE) == 0) {
+ if (ED_view3d_clipping_test(kcd->vc.rv3d, kfv->cageco, true) == 0) {
curv = kfv;
curdis_sq = dis_sq;
}
@@ -1933,7 +1933,7 @@ static void remerge_faces(KnifeTool_OpData *kcd)
if (BLI_array_count(faces) > 0) {
idx = BM_elem_index_get(faces[0]);
- f2 = BM_faces_join(bm, faces, BLI_array_count(faces), TRUE);
+ f2 = BM_faces_join(bm, faces, BLI_array_count(faces), true);
if (f2) {
BMO_elem_flag_enable(bm, f2, FACE_NEW);
BM_elem_index_set(f2, idx); /* set_dirty! *//* BMESH_TODO, check if this is valid or not */
@@ -2144,7 +2144,7 @@ static void knifenet_fill_faces(KnifeTool_OpData *kcd)
f2 = BM_face_create_quad_tri(bm,
v1, v2, v3, NULL,
- NULL, FALSE);
+ NULL, false);
BMO_elem_flag_enable(bm, f2, FACE_NEW);
@@ -2184,7 +2184,7 @@ static void knifenet_fill_faces(KnifeTool_OpData *kcd)
BM_elem_attrs_copy(bm, bm, f2, f);
BM_ITER_ELEM (l1, &liter1, f, BM_LOOPS_OF_FACE) {
- BM_loop_interp_from_face(bm, l1, f2, TRUE, TRUE);
+ BM_loop_interp_from_face(bm, l1, f2, true, true);
}
}
@@ -2434,11 +2434,11 @@ static ListBase *find_hole(KnifeTool_OpData *kcd, ListBase *fedges)
}
/* Try to find "nice" diagonals - short, and far apart from each other.
- * If found, return TRUE and make a 'main chain' going across f which uses
+ * If found, return true and make a 'main chain' going across f which uses
* the two diagonals and one part of the hole, and a 'side chain' that
* completes the hole. */
-static int find_hole_chains(KnifeTool_OpData *kcd, ListBase *hole, BMFace *f, ListBase **mainchain,
- ListBase **sidechain)
+static bool find_hole_chains(KnifeTool_OpData *kcd, ListBase *hole, BMFace *f, ListBase **mainchain,
+ ListBase **sidechain)
{
float **fco, **hco;
BMVert **fv;
@@ -2450,14 +2450,14 @@ static int find_hole_chains(KnifeTool_OpData *kcd, ListBase *hole, BMFace *f, Li
ListBase *chain;
BMVert *v;
BMIter iter;
- int nh, nf, i, j, k, m, ax, ay, ok, sep = 0 /* Quite warnings */, bestsep;
+ int nh, nf, i, j, k, m, ax, ay, sep = 0 /* Quite warnings */, bestsep;
int besti[2], bestj[2];
float d, bestd;
nh = BLI_countlist(hole);
nf = f->len;
if (nh < 2 || nf < 3)
- return 0;
+ return false;
/* Gather 2d projections of hole and face vertex coordinates.
* Use best-axis projection - not completely accurate, maybe revisit */
@@ -2518,18 +2518,20 @@ static int find_hole_chains(KnifeTool_OpData *kcd, ListBase *hole, BMFace *f, Li
bestd = FLT_MAX;
}
for (j = 0; j < nf; j++) {
+ bool ok;
+
if (m == 1 && j == bestj[0])
continue;
d = len_squared_v2v2(hco[i], fco[j]);
if (d > bestd)
continue;
- ok = TRUE;
+ ok = true;
for (k = 0; k < nh && ok; k++) {
if (k == i || (k + 1) % nh == i)
continue;
if (isect_line_line_v2(hco[i], fco[j], hco[k], hco[(k + 1) % nh]))
- ok = FALSE;
+ ok = false;
}
if (!ok)
continue;
@@ -2537,7 +2539,7 @@ static int find_hole_chains(KnifeTool_OpData *kcd, ListBase *hole, BMFace *f, Li
if (k == j || (k + 1) % nf == j)
continue;
if (isect_line_line_v2(hco[i], fco[j], fco[k], fco[(k + 1) % nf]))
- ok = FALSE;
+ ok = false;
}
if (ok) {
besti[m] = i;
@@ -2572,14 +2574,14 @@ static int find_hole_chains(KnifeTool_OpData *kcd, ListBase *hole, BMFace *f, Li
}
*sidechain = chain;
- return TRUE;
+ return true;
}
else {
- return FALSE;
+ return false;
}
}
-static int knife_edge_in_face(KnifeTool_OpData *UNUSED(kcd), KnifeEdge *kfe, BMFace *f)
+static bool knife_edge_in_face(KnifeTool_OpData *UNUSED(kcd), KnifeEdge *kfe, BMFace *f)
{
/* BMesh *bm = kcd->em->bm; */ /* UNUSED */
BMVert *v1, *v2;
@@ -2589,7 +2591,7 @@ static int knife_edge_in_face(KnifeTool_OpData *UNUSED(kcd), KnifeEdge *kfe, BMF
int v1inside, v2inside;
if (!f)
- return FALSE;
+ return false;
v1 = kfe->v1->v;
v2 = kfe->v2->v;
@@ -2608,7 +2610,7 @@ static int knife_edge_in_face(KnifeTool_OpData *UNUSED(kcd), KnifeEdge *kfe, BMF
v1inside = l1 ? 0 : BM_face_point_inside_test(f, kfe->v1->co);
v2inside = l2 ? 0 : BM_face_point_inside_test(f, kfe->v2->co);
if ((l1 && v2inside) || (l2 && v1inside) || (v1inside && v2inside))
- return TRUE;
+ return true;
if (l1 && l2) {
/* Can have case where v1 and v2 are on shared chain between two faces.
* BM_face_legal_splits does visibility and self-intersection tests,
@@ -2617,7 +2619,7 @@ static int knife_edge_in_face(KnifeTool_OpData *UNUSED(kcd), KnifeEdge *kfe, BMF
mid_v3_v3v3(mid, kfe->v1->co, kfe->v2->co);
return BM_face_point_inside_test(f, mid);
}
- return FALSE;
+ return false;
}
/* Split face f with KnifeEdges on chain. f remains as one side, the face formed is put in *newface.
@@ -2658,7 +2660,7 @@ static void knife_make_chain_cut(KnifeTool_OpData *kcd, BMFace *f, ListBase *cha
*newface = NULL;
}
else {
- *newface = BM_face_split(bm, f, v1, v2, &lnew, NULL, TRUE);
+ *newface = BM_face_split(bm, f, v1, v2, &lnew, NULL, true);
}
}
else {
@@ -2670,7 +2672,7 @@ static void knife_make_chain_cut(KnifeTool_OpData *kcd, BMFace *f, ListBase *cha
for (l_iter = lnew->next, i = 0; i < nco; l_iter = l_iter->next, i++) {
BLI_assert(equals_v3v3(cos[i], l_iter->v->co));
if (kcd->select_result) {
- BM_edge_select_set(bm, l_iter->e, TRUE);
+ BM_edge_select_set(bm, l_iter->e, true);
}
kverts[i]->v = l_iter->v;
}
@@ -2680,7 +2682,7 @@ static void knife_make_chain_cut(KnifeTool_OpData *kcd, BMFace *f, ListBase *cha
/* the select chain above doesnt account for the first loop */
if (kcd->select_result) {
if (lnew) {
- BM_edge_select_set(bm, lnew->e, TRUE);
+ BM_edge_select_set(bm, lnew->e, true);
}
}
}
@@ -2717,7 +2719,7 @@ static void knife_make_face_cuts(KnifeTool_OpData *kcd, BMFace *f, ListBase *kfe
if (fnew_kfedges->first)
knife_make_face_cuts(kcd, fnew, fnew_kfedges);
- /* find_chain should always remove edges if it returns TRUE,
+ /* find_chain should always remove edges if it returns true,
* but guard against infinite loop anyway */
count = BLI_countlist(kfedges);
if (count >= oldcount) {
@@ -2740,10 +2742,16 @@ static void knife_make_face_cuts(KnifeTool_OpData *kcd, BMFace *f, ListBase *kfe
kfe = ((Ref *)sidechain->first)->ref;
if (knife_edge_in_face(kcd, kfe, f)) {
knife_make_chain_cut(kcd, f, sidechain, &fnew2);
+ if (fnew2 == NULL) {
+ return;
+ }
fhole = f;
}
else if (knife_edge_in_face(kcd, kfe, fnew)) {
knife_make_chain_cut(kcd, fnew, sidechain, &fnew2);
+ if (fnew2 == NULL) {
+ return;
+ }
fhole = fnew2;
}
else {
@@ -2777,7 +2785,7 @@ static void knife_make_face_cuts(KnifeTool_OpData *kcd, BMFace *f, ListBase *kfe
knife_make_face_cuts(kcd, fnew2, fnew2_kfedges);
if (f == fhole)
break;
- /* find_hole should always remove edges if it returns TRUE,
+ /* find_hole should always remove edges if it returns true,
* but guard against infinite loop anyway */
count = BLI_countlist(kfedges);
if (count >= oldcount) {
@@ -2881,7 +2889,7 @@ static void knifetool_finish_ex(KnifeTool_OpData *kcd)
#endif
EDBM_mesh_normals_update(kcd->em);
- EDBM_update_generic(kcd->em, TRUE, TRUE);
+ EDBM_update_generic(kcd->em, true, true);
}
static void knifetool_finish(wmOperator *op)
{
@@ -3185,7 +3193,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event)
knife_update_active(kcd);
knife_update_header(C, kcd);
ED_region_tag_redraw(kcd->ar);
- do_refresh = TRUE;
+ do_refresh = true;
break;
case KNF_MODAL_MIDPOINT_OFF:
kcd->snap_midpoints = false;
@@ -3194,29 +3202,29 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event)
knife_update_active(kcd);
knife_update_header(C, kcd);
ED_region_tag_redraw(kcd->ar);
- do_refresh = TRUE;
+ do_refresh = true;
break;
case KNF_MODEL_IGNORE_SNAP_ON:
ED_region_tag_redraw(kcd->ar);
kcd->ignore_vert_snapping = kcd->ignore_edge_snapping = true;
knife_update_header(C, kcd);
- do_refresh = TRUE;
+ do_refresh = true;
break;
case KNF_MODEL_IGNORE_SNAP_OFF:
ED_region_tag_redraw(kcd->ar);
kcd->ignore_vert_snapping = kcd->ignore_edge_snapping = false;
knife_update_header(C, kcd);
- do_refresh = TRUE;
+ do_refresh = true;
break;
case KNF_MODAL_ANGLE_SNAP_TOGGLE:
kcd->angle_snapping = !kcd->angle_snapping;
knife_update_header(C, kcd);
- do_refresh = TRUE;
+ do_refresh = true;
break;
case KNF_MODAL_CUT_THROUGH_TOGGLE:
kcd->cut_through = !kcd->cut_through;
knife_update_header(C, kcd);
- do_refresh = TRUE;
+ do_refresh = true;
break;
case KNF_MODAL_NEW_CUT:
ED_region_tag_redraw(kcd->ar);
@@ -3295,8 +3303,8 @@ void MESH_OT_knife_tool(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
- RNA_def_boolean(ot->srna, "use_occlude_geometry", TRUE, "Occlude Geometry", "Only cut the front most geometry");
- RNA_def_boolean(ot->srna, "only_selected", FALSE, "Only Selected", "Only cut selected geometry");
+ RNA_def_boolean(ot->srna, "use_occlude_geometry", true, "Occlude Geometry", "Only cut the front most geometry");
+ RNA_def_boolean(ot->srna, "only_selected", false, "Only Selected", "Only cut selected geometry");
}
diff --git a/source/blender/editors/mesh/editmesh_knife_project.c b/source/blender/editors/mesh/editmesh_knife_project.c
index c581ce5a2e8..c8256914884 100644
--- a/source/blender/editors/mesh/editmesh_knife_project.c
+++ b/source/blender/editors/mesh/editmesh_knife_project.c
@@ -51,6 +51,7 @@
#include "WM_types.h"
+#include "ED_mesh.h"
#include "ED_screen.h"
#include "ED_view3d.h"
@@ -137,6 +138,12 @@ static int knifeproject_exec(bContext *C, wmOperator *op)
/* select only tagged faces */
BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, false);
+
+ /* not essential, but switch out of vertex mode since the
+ * selected regions wont be nicely isolated after flushing.
+ * note: call after de-select to avoid selection flushing */
+ EDBM_selectmode_disable(scene, em, SCE_SELECT_VERTEX, SCE_SELECT_EDGE);
+
BM_mesh_elem_hflag_enable_test(em->bm, BM_FACE, BM_ELEM_SELECT, true, BM_ELEM_TAG);
BM_mesh_select_mode_flush(em->bm);
@@ -165,4 +172,3 @@ void MESH_OT_knife_project(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
}
-
diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c
index 5b9864ca239..ee1c274b154 100644
--- a/source/blender/editors/mesh/editmesh_loopcut.c
+++ b/source/blender/editors/mesh/editmesh_loopcut.c
@@ -77,8 +77,8 @@ typedef struct RingSelOpData {
BMEdge *eed;
NumInput num;
- int extend;
- int do_cut;
+ bool extend;
+ bool do_cut;
} RingSelOpData;
/* modal loop selection drawing callback */
@@ -186,7 +186,7 @@ static void edgering_sel(RingSelOpData *lcd, int previewlines, int select)
BMW_NIL_LAY);
for (eed = BMW_begin(&walker, eed_start); eed; eed = BMW_step(&walker)) {
- BM_edge_select_set(em->bm, eed, TRUE);
+ BM_edge_select_set(em->bm, eed, true);
}
BMW_end(&walker);
@@ -276,9 +276,9 @@ static void ringsel_finish(bContext *C, wmOperator *op)
const int cuts = RNA_int_get(op->ptr, "number_cuts");
const float smoothness = 0.292f * RNA_float_get(op->ptr, "smoothness");
#ifdef BMW_EDGERING_NGON
- const int use_only_quads = FALSE;
+ const bool use_only_quads = false;
#else
- const int use_only_quads = TRUE;
+ const bool use_only_quads = false;
#endif
if (lcd->eed) {
@@ -293,24 +293,18 @@ static void ringsel_finish(bContext *C, wmOperator *op)
BM_mesh_esubdivide(em->bm, BM_ELEM_SELECT,
smoothness, 0.0f, 0.0f,
cuts,
- SUBDIV_SELECT_LOOPCUT, SUBD_PATH, 0, TRUE,
+ SUBDIV_SELECT_LOOPCUT, SUBD_PATH, 0, true,
use_only_quads, 0);
/* tessface is already re-recalculated */
- EDBM_update_generic(em, FALSE, TRUE);
+ EDBM_update_generic(em, false, true);
/* force edge slide to edge select mode in in face select mode */
- if (em->selectmode & SCE_SELECT_FACE) {
- if (em->selectmode == SCE_SELECT_FACE)
- em->selectmode = SCE_SELECT_EDGE;
- else
- em->selectmode &= ~SCE_SELECT_FACE;
- CTX_data_tool_settings(C)->selectmode = em->selectmode;
- EDBM_selectmode_set(em);
-
- WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, CTX_data_scene(C));
+ if (EDBM_selectmode_disable(lcd->vc.scene, em, SCE_SELECT_FACE, SCE_SELECT_EDGE)) {
+ /* pass, the change will flush selection */
}
else {
+ /* else flush explicitly */
EDBM_selectmode_flush(lcd->em);
}
}
@@ -349,7 +343,7 @@ static void ringsel_exit(bContext *UNUSED(C), wmOperator *op)
/* called when modal loop selection gets set up... */
-static int ringsel_init(bContext *C, wmOperator *op, int do_cut)
+static int ringsel_init(bContext *C, wmOperator *op, bool do_cut)
{
RingSelOpData *lcd;
@@ -423,7 +417,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event)
float smoothness = RNA_float_get(op->ptr, "smoothness");
int cuts = RNA_int_get(op->ptr, "number_cuts");
RingSelOpData *lcd = op->customdata;
- int show_cuts = 0;
+ bool show_cuts = false;
view3d_operator_needs_opengl(C);
@@ -471,12 +465,12 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event)
cuts++;
RNA_int_set(op->ptr, "number_cuts", cuts);
ringsel_find_edge(lcd, cuts);
- show_cuts = TRUE;
+ show_cuts = true;
}
else {
smoothness = min_ff(smoothness + 0.05f, 4.0f);
RNA_float_set(op->ptr, "smoothness", smoothness);
- show_cuts = TRUE;
+ show_cuts = true;
}
ED_region_tag_redraw(lcd->ar);
@@ -491,12 +485,12 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event)
cuts = max_ii(cuts - 1, 0);
RNA_int_set(op->ptr, "number_cuts", cuts);
ringsel_find_edge(lcd, cuts);
- show_cuts = TRUE;
+ show_cuts = true;
}
else {
smoothness = max_ff(smoothness - 0.05f, 0.0f);
RNA_float_set(op->ptr, "smoothness", smoothness);
- show_cuts = TRUE;
+ show_cuts = true;
}
ED_region_tag_redraw(lcd->ar);
@@ -534,7 +528,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event)
RNA_int_set(op->ptr, "number_cuts", cuts);
ringsel_find_edge(lcd, cuts);
- show_cuts = TRUE;
+ show_cuts = true;
ED_region_tag_redraw(lcd->ar);
}
diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c
index 8198e088e5a..0ea02f371f0 100644
--- a/source/blender/editors/mesh/editmesh_rip.c
+++ b/source/blender/editors/mesh/editmesh_rip.c
@@ -207,7 +207,7 @@ static BMEdge *edbm_ripsel_edge_mark_step(BMVert *v, const int uid)
BM_edge_loop_pair(e, &l_a, &l_b); /* no need to check, we know this will be true */
- /* so (IS_VISIT_DONE == TRUE) */
+ /* so (IS_VISIT_DONE == true) */
BM_elem_index_set(l_a, uid);
BM_elem_index_set(l_b, uid);
@@ -246,7 +246,7 @@ static EdgeLoopPair *edbm_ripsel_looptag_helper(BMesh *bm)
}
/* set contiguous loops ordered 'uid' values for walking after split */
- while (TRUE) {
+ while (true) {
int tot = 0;
BMIter eiter;
BMEdge *e_step;
@@ -373,7 +373,7 @@ static void edbm_ripsel_deselect_helper(BMesh *bm, EdgeLoopPair *eloop_pairs,
e = (score_a > score_b) ? lp->l_a->e : lp->l_b->e;
v_prev = edbm_ripsel_edloop_pair_start_vert(e);
for (; e; e = edbm_ripsel_edge_uid_step(e, &v_prev)) {
- BM_edge_select_set(bm, e, FALSE);
+ BM_edge_select_set(bm, e, false);
}
}
}
@@ -486,9 +486,9 @@ static void edbm_tagged_loop_pairs_do_fill_faces(BMesh *bm, UnorderedLoopPair *u
}
/* face should never exist */
- BLI_assert(BM_face_exists(f_verts, f_verts[3] ? 4 : 3, &f) == FALSE);
+ BLI_assert(BM_face_exists(f_verts, f_verts[3] ? 4 : 3, &f) == false);
- f = BM_face_create_quad_tri_v(bm, f_verts, f_verts[3] ? 4 : 3, f_example, FALSE);
+ f = BM_face_create_quad_tri_v(bm, f_verts, f_verts[3] ? 4 : 3, f_example, false);
l_iter = BM_FACE_FIRST_LOOP(f);
@@ -511,21 +511,21 @@ static void edbm_tagged_loop_pairs_do_fill_faces(BMesh *bm, UnorderedLoopPair *u
/* --- end 'face-fill' code --- */
-static int edbm_rip_call_edgesplit(BMEditMesh *em, wmOperator *op)
+static bool edbm_rip_call_edgesplit(BMEditMesh *em, wmOperator *op)
{
BMOperator bmop;
if (!EDBM_op_init(em, &bmop, op, "split_edges edges=%he verts=%hv use_verts=%b",
- BM_ELEM_TAG, BM_ELEM_SELECT, TRUE))
+ BM_ELEM_TAG, BM_ELEM_SELECT, true))
{
- return FALSE;
+ return false;
}
BMO_op_exec(em->bm, &bmop);
- if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
- return FALSE;
+ if (!EDBM_op_finish(em, &bmop, op, true)) {
+ return false;
}
- return TRUE;
+ return true;
}
/**
@@ -533,7 +533,7 @@ static int edbm_rip_call_edgesplit(BMEditMesh *em, wmOperator *op)
*/
static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, const wmEvent *event)
{
- const int do_fill = RNA_boolean_get(op->ptr, "use_fill");
+ const bool do_fill = RNA_boolean_get(op->ptr, "use_fill");
UnorderedLoopPair *fill_uloop_pairs = NULL;
Object *obedit = CTX_data_edit_object(C);
ARegion *ar = CTX_wm_region(C);
@@ -549,7 +549,7 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, const wmEvent *eve
float projectMat[4][4], fmval[3] = {event->mval[0], event->mval[1]};
float dist = FLT_MAX;
float d;
- int is_wire;
+ bool is_wire;
BMEditSelection ese;
int totboundary_edge = 0;
@@ -585,7 +585,7 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, const wmEvent *eve
* otherwise we can't a face away from a wire edge */
totboundary_edge += (is_boundary != 0 || BM_edge_is_wire(e));
if (!BM_elem_flag_test(e, BM_ELEM_HIDDEN)) {
- if (is_boundary == FALSE && BM_edge_is_manifold(e)) {
+ if (is_boundary == false && BM_edge_is_manifold(e)) {
d = edbm_rip_edgedist(ar, projectMat, e->v1->co, e->v2->co, fmval, INSET_DEFAULT);
if (d < dist) {
dist = d;
@@ -640,22 +640,22 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, const wmEvent *eve
* - the boundary edge total is greater then 2,
* in this case edge split _can_ work but we get far nicer results if we use this special case.
* - there are only 2 edges but we are a wire vert. */
- if ((is_wire == FALSE && totboundary_edge > 2) ||
- (is_wire == TRUE && totboundary_edge > 1))
+ if ((is_wire == false && totboundary_edge > 2) ||
+ (is_wire == true && totboundary_edge > 1))
{
BMVert **vout;
int vout_len;
- BM_vert_select_set(bm, v, FALSE);
+ BM_vert_select_set(bm, v, false);
- if (bmesh_vert_separate(bm, v, &vout, &vout_len) == FALSE) {
+ if (bmesh_vert_separate(bm, v, &vout, &vout_len) == false) {
BKE_report(op->reports, RPT_ERROR, "Error ripping vertex from faces");
return OPERATOR_CANCELLED;
}
else if (vout_len < 2) {
MEM_freeN(vout);
/* set selection back to avoid active-unselected vertex */
- BM_vert_select_set(bm, v, TRUE);
+ BM_vert_select_set(bm, v, true);
/* should never happen */
BKE_report(op->reports, RPT_ERROR, "Error ripping vertex from faces");
return OPERATOR_CANCELLED;
@@ -673,7 +673,7 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, const wmEvent *eve
* either by its face corner, or connected edge (when no faces are attached) */
for (i = 0; i < vout_len; i++) {
- if (BM_vert_is_wire(vout[i]) == FALSE) {
+ if (BM_vert_is_wire(vout[i]) == false) {
/* find the best face corner */
BM_ITER_ELEM (l, &iter, vout[i], BM_LOOPS_OF_VERT) {
if (!BM_elem_flag_test(l->f, BM_ELEM_HIDDEN)) {
@@ -709,7 +709,7 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, const wmEvent *eve
/* select the vert from the best region */
v = vout[vi_best];
- BM_vert_select_set(bm, v, TRUE);
+ BM_vert_select_set(bm, v, true);
if (ese.ele) {
BM_select_history_store(bm, v);
@@ -804,7 +804,7 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, const wmEvent *eve
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(v, BM_ELEM_SELECT)) {
/* disable by default, re-enable winner at end */
- BM_vert_select_set(bm, v, FALSE);
+ BM_vert_select_set(bm, v, false);
BM_ITER_ELEM (l, &liter, v, BM_LOOPS_OF_VERT) {
/* calculate a point in the face, rather then calculate the middle,
@@ -829,7 +829,7 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, const wmEvent *eve
}
if (v_best) {
- BM_vert_select_set(bm, v_best, TRUE);
+ BM_vert_select_set(bm, v_best, true);
if (ese.ele) {
BM_select_history_store(bm, v_best);
}
@@ -855,7 +855,7 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, const wmEvent *eve
*/
static int edbm_rip_invoke__edge(bContext *C, wmOperator *op, const wmEvent *event)
{
- const int do_fill = RNA_boolean_get(op->ptr, "use_fill");
+ const bool do_fill = RNA_boolean_get(op->ptr, "use_fill");
UnorderedLoopPair *fill_uloop_pairs = NULL;
Object *obedit = CTX_data_edit_object(C);
ARegion *ar = CTX_wm_region(C);
@@ -878,14 +878,14 @@ static int edbm_rip_invoke__edge(bContext *C, wmOperator *op, const wmEvent *eve
/* expand edge selection */
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
- int all_manifold;
+ bool all_manifold;
int totedge_manifold; /* manifold, visible edges */
int i;
e2 = NULL;
i = 0;
totedge_manifold = 0;
- all_manifold = TRUE;
+ all_manifold = true;
BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
if (!BM_edge_is_wire(e) &&
@@ -901,8 +901,8 @@ static int edbm_rip_invoke__edge(bContext *C, wmOperator *op, const wmEvent *eve
}
/** #BM_vert_other_disk_edge has no hidden checks so don't check hidden here */
- if ((all_manifold == TRUE) && (BM_edge_is_manifold(e) == FALSE)) {
- all_manifold = FALSE;
+ if ((all_manifold == true) && (BM_edge_is_manifold(e) == false)) {
+ all_manifold = false;
}
}
@@ -911,7 +911,7 @@ static int edbm_rip_invoke__edge(bContext *C, wmOperator *op, const wmEvent *eve
/* note: if the case of 3 edges has one change in loop stepping,
* if this becomes more involved we may be better off splitting
* the 3 edge case into its own else-if branch */
- if ((totedge_manifold == 4 || totedge_manifold == 3) || (all_manifold == FALSE)) {
+ if ((totedge_manifold == 4 || totedge_manifold == 3) || (all_manifold == false)) {
BMLoop *l_a = e2->l;
BMLoop *l_b = l_a->radial_next;
@@ -1034,7 +1034,7 @@ static int edbm_rip_invoke(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_CANCELLED;
}
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
return OPERATOR_FINISHED;
}
@@ -1056,6 +1056,6 @@ void MESH_OT_rip(wmOperatorType *ot)
/* to give to transform */
Transform_Properties(ot, P_PROPORTIONAL);
- RNA_def_boolean(ot->srna, "mirror", FALSE, "Mirror Editing", "");
- RNA_def_boolean(ot->srna, "use_fill", FALSE, "Fill", "Fill the ripped region");
+ RNA_def_boolean(ot->srna, "mirror", false, "Mirror Editing", "");
+ RNA_def_boolean(ot->srna, "use_fill", false, "Fill", "Fill the ripped region");
}
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c
index a1c302c6a63..9474c051cee 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -74,7 +74,7 @@
/* ****************************** MIRROR **************** */
-void EDBM_select_mirrored(Object *UNUSED(obedit), BMEditMesh *em, int extend)
+void EDBM_select_mirrored(Object *UNUSED(obedit), BMEditMesh *em, bool extend)
{
BMVert *v1, *v2;
BMIter iter;
@@ -88,7 +88,7 @@ void EDBM_select_mirrored(Object *UNUSED(obedit), BMEditMesh *em, int extend)
}
}
- EDBM_verts_mirror_cache_begin(em, TRUE);
+ EDBM_verts_mirror_cache_begin(em, true);
if (!extend)
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
@@ -99,7 +99,7 @@ void EDBM_select_mirrored(Object *UNUSED(obedit), BMEditMesh *em, int extend)
v2 = EDBM_verts_mirror_get(em, v1);
if (v2 && !BM_elem_flag_test(v2, BM_ELEM_HIDDEN)) {
- BM_vert_select_set(em->bm, v2, TRUE);
+ BM_vert_select_set(em->bm, v2, true);
}
}
@@ -124,7 +124,7 @@ void EDBM_automerge(Scene *scene, Object *obedit, int update)
BM_ELEM_SELECT, scene->toolsettings->doublimit);
if (LIKELY(ok) && update) {
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
}
}
}
@@ -184,19 +184,19 @@ static void draw_triangulated(const int mcords[][2], const short tot)
/* reads rect, and builds selection array for quick lookup */
/* returns if all is OK */
-int EDBM_backbuf_border_init(ViewContext *vc, short xmin, short ymin, short xmax, short ymax)
+bool EDBM_backbuf_border_init(ViewContext *vc, short xmin, short ymin, short xmax, short ymax)
{
struct ImBuf *buf;
unsigned int *dr;
int a;
if (vc->obedit == NULL || vc->v3d->drawtype < OB_SOLID || (vc->v3d->flag & V3D_ZBUF_SELECT) == 0) {
- return 0;
+ return false;
}
buf = view3d_read_backbuf(vc, xmin, ymin, xmax, ymax);
- if (buf == NULL) return 0;
- if (bm_vertoffs == 0) return 0;
+ if (buf == NULL) return false;
+ if (bm_vertoffs == 0) return false;
dr = buf->rect;
@@ -210,7 +210,7 @@ int EDBM_backbuf_border_init(ViewContext *vc, short xmin, short ymin, short xmax
dr++;
}
IMB_freeImBuf(buf);
- return 1;
+ return true;
}
int EDBM_backbuf_check(unsigned int index)
@@ -233,7 +233,7 @@ void EDBM_backbuf_free(void)
* - grab again and compare
* returns 'OK'
*/
-int EDBM_backbuf_border_mask_init(ViewContext *vc, const int mcords[][2], short tot, short xmin, short ymin, short xmax, short ymax)
+bool EDBM_backbuf_border_mask_init(ViewContext *vc, const int mcords[][2], short tot, short xmin, short ymin, short xmax, short ymax)
{
unsigned int *dr, *drm;
struct ImBuf *buf, *bufmask;
@@ -242,16 +242,16 @@ int EDBM_backbuf_border_mask_init(ViewContext *vc, const int mcords[][2], short
/* method in use for face selecting too */
if (vc->obedit == NULL) {
if (!(paint_facesel_test(vc->obact) || paint_vertsel_test(vc->obact))) {
- return 0;
+ return false;
}
}
else if (vc->v3d->drawtype < OB_SOLID || (vc->v3d->flag & V3D_ZBUF_SELECT) == 0) {
- return 0;
+ return false;
}
buf = view3d_read_backbuf(vc, xmin, ymin, xmax, ymax);
- if (buf == NULL) return 0;
- if (bm_vertoffs == 0) return 0;
+ if (buf == NULL) return false;
+ if (bm_vertoffs == 0) return false;
dr = buf->rect;
@@ -282,7 +282,7 @@ int EDBM_backbuf_border_mask_init(ViewContext *vc, const int mcords[][2], short
bufmask = view3d_read_backbuf(vc, xmin, ymin, xmax, ymax);
if (bufmask == NULL) {
- return 0; /* only when mem alloc fails, go crash somewhere else! */
+ return false; /* only when mem alloc fails, go crash somewhere else! */
}
else {
drm = bufmask->rect;
@@ -299,11 +299,11 @@ int EDBM_backbuf_border_mask_init(ViewContext *vc, const int mcords[][2], short
IMB_freeImBuf(buf);
IMB_freeImBuf(bufmask);
- return 1;
+ return true;
}
/* circle shaped sample area */
-int EDBM_backbuf_circle_init(ViewContext *vc, short xs, short ys, short rads)
+bool EDBM_backbuf_circle_init(ViewContext *vc, short xs, short ys, short rads)
{
struct ImBuf *buf;
unsigned int *dr;
@@ -313,18 +313,18 @@ int EDBM_backbuf_circle_init(ViewContext *vc, short xs, short ys, short rads)
/* method in use for face selecting too */
if (vc->obedit == NULL) {
if (!(paint_facesel_test(vc->obact) || paint_vertsel_test(vc->obact))) {
- return 0;
+ return false;
}
}
else if (vc->v3d->drawtype < OB_SOLID || (vc->v3d->flag & V3D_ZBUF_SELECT) == 0) {
- return 0;
+ return false;
}
xmin = xs - rads; xmax = xs + rads;
ymin = ys - rads; ymax = ys + rads;
buf = view3d_read_backbuf(vc, xmin, ymin, xmax, ymax);
- if (bm_vertoffs == 0) return 0;
- if (buf == NULL) return 0;
+ if (bm_vertoffs == 0) return false;
+ if (buf == NULL) return false;
dr = buf->rect;
@@ -340,7 +340,7 @@ int EDBM_backbuf_circle_init(ViewContext *vc, short xs, short ys, short rads)
}
IMB_freeImBuf(buf);
- return 1;
+ return true;
}
@@ -396,7 +396,7 @@ static unsigned int findnearestvert__backbufIndextest(void *handle, unsigned int
* if 0, unselected vertice are given the bias
* strict: if 1, the vertice corresponding to the sel parameter are ignored and not just biased
*/
-BMVert *EDBM_vert_find_nearest(ViewContext *vc, float *r_dist, const short sel, const short strict)
+BMVert *EDBM_vert_find_nearest(ViewContext *vc, float *r_dist, const bool sel, const bool strict)
{
if (vc->v3d->drawtype > OB_WIRE && (vc->v3d->flag & V3D_ZBUF_SELECT)) {
float distance;
@@ -436,7 +436,7 @@ BMVert *EDBM_vert_find_nearest(ViewContext *vc, float *r_dist, const short sel,
data.lastIndex = lastSelectedIndex;
data.mval_fl[0] = vc->mval[0];
data.mval_fl[1] = vc->mval[1];
- data.select = sel;
+ data.select = sel ? BM_ELEM_SELECT : 0;
data.dist = *r_dist;
data.strict = strict;
data.closest = NULL;
@@ -482,7 +482,7 @@ static void findnearestedge__doClosest(void *userData, BMEdge *eed, const float
vec[1] = eed->v1->co[1] + lambda * (eed->v2->co[1] - eed->v1->co[1]);
vec[2] = eed->v1->co[2] + lambda * (eed->v2->co[2] - eed->v1->co[2]);
- if (ED_view3d_clipping_test(data->vc.rv3d, vec, TRUE) == 0) {
+ if (ED_view3d_clipping_test(data->vc.rv3d, vec, true) == 0) {
data->dist = distance;
data->closest = eed;
}
@@ -735,14 +735,14 @@ static int similar_face_select_exec(bContext *C, wmOperator *op)
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
/* select the output */
- BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, true);
/* finish the operator */
- if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ if (!EDBM_op_finish(em, &bmop, op, true)) {
return OPERATOR_CANCELLED;
}
- EDBM_update_generic(em, FALSE, FALSE);
+ EDBM_update_generic(em, false, false);
/* we succeeded */
return OPERATOR_FINISHED;
@@ -776,15 +776,15 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
/* select the output */
- BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "edges.out", BM_EDGE, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "edges.out", BM_EDGE, BM_ELEM_SELECT, true);
EDBM_selectmode_flush(em);
/* finish the operator */
- if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ if (!EDBM_op_finish(em, &bmop, op, true)) {
return OPERATOR_CANCELLED;
}
- EDBM_update_generic(em, FALSE, FALSE);
+ EDBM_update_generic(em, false, false);
/* we succeeded */
return OPERATOR_FINISHED;
@@ -805,7 +805,7 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op)
BMOperator bmop;
/* get the type from RNA */
const int type = RNA_enum_get(op->ptr, "type");
- float thresh = RNA_float_get(op->ptr, "threshold");
+ const float thresh = RNA_float_get(op->ptr, "threshold");
const int compare = RNA_enum_get(op->ptr, "compare");
/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
@@ -820,16 +820,16 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op)
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
/* select the output */
- BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "verts.out", BM_VERT, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "verts.out", BM_VERT, BM_ELEM_SELECT, true);
/* finish the operator */
- if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ if (!EDBM_op_finish(em, &bmop, op, true)) {
return OPERATOR_CANCELLED;
}
EDBM_selectmode_flush(em);
- EDBM_update_generic(em, FALSE, FALSE);
+ EDBM_update_generic(em, false, false);
/* we succeeded */
return OPERATOR_FINISHED;
@@ -929,10 +929,10 @@ void MESH_OT_select_similar(wmOperatorType *ot)
static int edbm_select_mode_exec(bContext *C, wmOperator *op)
{
- const int type = RNA_enum_get(op->ptr, "type");
- const int action = RNA_enum_get(op->ptr, "action");
- const int use_extend = RNA_boolean_get(op->ptr, "use_extend");
- const int use_expand = RNA_boolean_get(op->ptr, "use_expand");
+ const int type = RNA_enum_get(op->ptr, "type");
+ const int action = RNA_enum_get(op->ptr, "action");
+ const bool use_extend = RNA_boolean_get(op->ptr, "use_extend");
+ const bool use_expand = RNA_boolean_get(op->ptr, "use_expand");
if (EDBM_selectmode_toggle(C, type, action, use_extend, use_expand)) {
return OPERATOR_FINISHED;
@@ -986,9 +986,9 @@ void MESH_OT_select_mode(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- prop = RNA_def_boolean(ot->srna, "use_extend", FALSE, "Extend", "");
+ prop = RNA_def_boolean(ot->srna, "use_extend", false, "Extend", "");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
- prop = RNA_def_boolean(ot->srna, "use_expand", FALSE, "Expand", "");
+ prop = RNA_def_boolean(ot->srna, "use_expand", false, "Expand", "");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
ot->prop = prop = RNA_def_enum(ot->srna, "type", elem_items, 0, "Type", "");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
@@ -1000,7 +1000,7 @@ void MESH_OT_select_mode(wmOperatorType *ot)
/* **************** LOOP SELECTS *************** */
-static void walker_select(BMEditMesh *em, int walkercode, void *start, int select)
+static void walker_select(BMEditMesh *em, int walkercode, void *start, const bool select)
{
BMesh *bm = em->bm;
BMElem *ele;
@@ -1027,7 +1027,7 @@ static int edbm_loop_multiselect_exec(bContext *C, wmOperator *op)
BMEdge *eed;
BMEdge **edarray;
int edindex;
- int looptype = RNA_boolean_get(op->ptr, "ring");
+ const bool is_ring = RNA_boolean_get(op->ptr, "ring");
BMIter iter;
int totedgesel = 0;
@@ -1048,17 +1048,17 @@ static int edbm_loop_multiselect_exec(bContext *C, wmOperator *op)
}
}
- if (looptype) {
+ if (is_ring) {
for (edindex = 0; edindex < totedgesel; edindex += 1) {
eed = edarray[edindex];
- walker_select(em, BMW_EDGERING, eed, TRUE);
+ walker_select(em, BMW_EDGERING, eed, true);
}
EDBM_selectmode_flush(em);
}
else {
for (edindex = 0; edindex < totedgesel; edindex += 1) {
eed = edarray[edindex];
- walker_select(em, BMW_LOOP, eed, TRUE);
+ walker_select(em, BMW_LOOP, eed, true);
}
EDBM_selectmode_flush(em);
}
@@ -1094,12 +1094,12 @@ void MESH_OT_loop_multi_select(wmOperatorType *ot)
/* ***************** loop select (non modal) ************** */
-static void mouse_mesh_loop(bContext *C, const int mval[2], short extend, short deselect, short toggle, short ring)
+static void mouse_mesh_loop(bContext *C, const int mval[2], bool extend, bool deselect, bool toggle, bool ring)
{
ViewContext vc;
BMEditMesh *em;
BMEdge *eed;
- int select = TRUE;
+ bool select = true;
float dist = 50.0f;
float mvalf[2];
@@ -1113,21 +1113,21 @@ static void mouse_mesh_loop(bContext *C, const int mval[2], short extend, short
eed = EDBM_edge_find_nearest(&vc, &dist);
if (eed) {
- if (extend == 0 && deselect == 0 && toggle == 0) {
+ if (extend == false && deselect == false && toggle == false) {
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
}
if (extend) {
- select = TRUE;
+ select = true;
}
else if (deselect) {
- select = FALSE;
+ select = false;
}
else if (BM_elem_flag_test(eed, BM_ELEM_SELECT) == 0) {
- select = TRUE;
+ select = true;
}
else if (toggle) {
- select = FALSE;
+ select = false;
}
if (em->selectmode & SCE_SELECT_FACE) {
@@ -1218,7 +1218,8 @@ static int edbm_select_loop_invoke(bContext *C, wmOperator *op, const wmEvent *e
view3d_operator_needs_opengl(C);
- mouse_mesh_loop(C, event->mval, RNA_boolean_get(op->ptr, "extend"),
+ mouse_mesh_loop(C, event->mval,
+ RNA_boolean_get(op->ptr, "extend"),
RNA_boolean_get(op->ptr, "deselect"),
RNA_boolean_get(op->ptr, "toggle"),
RNA_boolean_get(op->ptr, "ring"));
@@ -1368,15 +1369,15 @@ static int edgetag_context_check(Scene *scene, BMesh *bm, BMEdge *e)
{
switch (scene->toolsettings->edge_mode) {
case EDGE_MODE_SELECT:
- return BM_elem_flag_test(e, BM_ELEM_SELECT) ? TRUE : FALSE;
+ return BM_elem_flag_test(e, BM_ELEM_SELECT) ? true : false;
case EDGE_MODE_TAG_SEAM:
return BM_elem_flag_test(e, BM_ELEM_SEAM);
case EDGE_MODE_TAG_SHARP:
return !BM_elem_flag_test(e, BM_ELEM_SMOOTH);
case EDGE_MODE_TAG_CREASE:
- return BM_elem_float_data_get(&bm->edata, e, CD_CREASE) ? TRUE : FALSE;
+ return BM_elem_float_data_get(&bm->edata, e, CD_CREASE) ? true : false;
case EDGE_MODE_TAG_BEVEL:
- return BM_elem_float_data_get(&bm->edata, e, CD_BWEIGHT) ? TRUE : FALSE;
+ return BM_elem_float_data_get(&bm->edata, e, CD_BWEIGHT) ? true : false;
#ifdef WITH_FREESTYLE
case EDGE_MODE_TAG_FREESTYLE:
{
@@ -1421,7 +1422,7 @@ static int edgetag_shortest_path(Scene *scene, BMesh *bm, BMEdge *e_src, BMEdge
edgetag_ensure_cd_flag(scene, OBACT->data);
BM_ITER_MESH_INDEX (e, &eiter, bm, BM_EDGES_OF_MESH, i) {
- if (BM_elem_flag_test(e, BM_ELEM_HIDDEN) == FALSE) {
+ if (BM_elem_flag_test(e, BM_ELEM_HIDDEN) == false) {
BM_elem_flag_disable(e, BM_ELEM_TAG);
}
else {
@@ -1470,14 +1471,14 @@ static int edgetag_shortest_path(Scene *scene, BMesh *bm, BMEdge *e_src, BMEdge
}
if (e == e_dst) {
- short all_set = TRUE;
+ bool all_set = true;
/* Check whether the path is already completely tagged.
* if it is, the tags will be cleared instead of set. */
e = e_dst;
do {
if (!edgetag_context_check(scene, bm, e)) {
- all_set = FALSE;
+ all_set = false;
break;
}
} while ((e = edges_prev[BM_elem_index_get(e)]));
@@ -1561,12 +1562,12 @@ static int mouse_mesh_shortest_path_edge(ViewContext *vc)
#endif
}
- EDBM_update_generic(em, FALSE, FALSE);
+ EDBM_update_generic(em, false, false);
- return TRUE;
+ return true;
}
else {
- return FALSE;
+ return false;
}
}
@@ -1643,7 +1644,7 @@ static int facetag_shortest_path(Scene *scene, BMesh *bm, BMFace *f_src, BMFace
// BM_mesh_elem_index_ensure(bm, BM_VERT /* | BM_EDGE */); // NOT NEEDED FOR FACETAG
BM_ITER_MESH_INDEX (f, &fiter, bm, BM_FACES_OF_MESH, i) {
- if (BM_elem_flag_test(f, BM_ELEM_HIDDEN) == FALSE) {
+ if (BM_elem_flag_test(f, BM_ELEM_HIDDEN) == false) {
BM_elem_flag_disable(f, BM_ELEM_TAG);
}
else {
@@ -1692,14 +1693,14 @@ static int facetag_shortest_path(Scene *scene, BMesh *bm, BMFace *f_src, BMFace
}
if (f == f_dst) {
- short all_set = TRUE;
+ bool all_set = true;
/* Check whether the path is already completely tagged.
* if it is, the tags will be cleared instead of set. */
f = f_dst;
do {
if (!facetag_context_check(scene, bm, f)) {
- all_set = FALSE;
+ all_set = false;
break;
}
} while ((f = faces_prev[BM_elem_index_get(f)]));
@@ -1727,7 +1728,7 @@ static int mouse_mesh_shortest_path_face(ViewContext *vc)
f_dst = EDBM_face_find_nearest(vc, &dist);
if (f_dst) {
int path = 0;
- BMFace *f_act = BM_active_face_get(em->bm, FALSE, TRUE);
+ BMFace *f_act = BM_active_face_get(em->bm, false, true);
if (f_act) {
if (f_act != f_dst) {
@@ -1752,12 +1753,12 @@ static int mouse_mesh_shortest_path_face(ViewContext *vc)
BM_active_face_set(em->bm, f_dst);
- EDBM_update_generic(em, FALSE, FALSE);
+ EDBM_update_generic(em, false, false);
- return TRUE;
+ return true;
}
else {
- return FALSE;
+ return false;
}
}
@@ -1827,7 +1828,7 @@ void MESH_OT_select_shortest_path(wmOperatorType *ot)
/* ************************************************** */
/* here actual select happens */
/* gets called via generic mouse select operator */
-int EDBM_select_pick(bContext *C, const int mval[2], short extend, short deselect, short toggle)
+bool EDBM_select_pick(bContext *C, const int mval[2], bool extend, bool deselect, bool toggle)
{
ViewContext vc;
BMVert *eve = NULL;
@@ -1842,7 +1843,7 @@ int EDBM_select_pick(bContext *C, const int mval[2], short extend, short deselec
if (unified_findnearest(&vc, &eve, &eed, &efa)) {
/* Deselect everything */
- if (extend == 0 && deselect == 0 && toggle == 0)
+ if (extend == false && deselect == false && toggle == false)
EDBM_flag_disable_all(vc.em, BM_ELEM_SELECT);
if (efa) {
@@ -1853,13 +1854,13 @@ int EDBM_select_pick(bContext *C, const int mval[2], short extend, short deselec
/* Work-around: deselect first, so we can guarantee it will */
/* be active even if it was already selected */
BM_select_history_remove(vc.em->bm, efa);
- BM_face_select_set(vc.em->bm, efa, FALSE);
+ BM_face_select_set(vc.em->bm, efa, false);
BM_select_history_store(vc.em->bm, efa);
- BM_face_select_set(vc.em->bm, efa, TRUE);
+ BM_face_select_set(vc.em->bm, efa, true);
}
else if (deselect) {
BM_select_history_remove(vc.em->bm, efa);
- BM_face_select_set(vc.em->bm, efa, FALSE);
+ BM_face_select_set(vc.em->bm, efa, false);
}
else {
/* set the last selected face */
@@ -1867,11 +1868,11 @@ int EDBM_select_pick(bContext *C, const int mval[2], short extend, short deselec
if (!BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
BM_select_history_store(vc.em->bm, efa);
- BM_face_select_set(vc.em->bm, efa, TRUE);
+ BM_face_select_set(vc.em->bm, efa, true);
}
else if (toggle) {
BM_select_history_remove(vc.em->bm, efa);
- BM_face_select_set(vc.em->bm, efa, FALSE);
+ BM_face_select_set(vc.em->bm, efa, false);
}
}
}
@@ -1880,22 +1881,22 @@ int EDBM_select_pick(bContext *C, const int mval[2], short extend, short deselec
/* Work-around: deselect first, so we can guarantee it will */
/* be active even if it was already selected */
BM_select_history_remove(vc.em->bm, eed);
- BM_edge_select_set(vc.em->bm, eed, FALSE);
+ BM_edge_select_set(vc.em->bm, eed, false);
BM_select_history_store(vc.em->bm, eed);
- BM_edge_select_set(vc.em->bm, eed, TRUE);
+ BM_edge_select_set(vc.em->bm, eed, true);
}
else if (deselect) {
BM_select_history_remove(vc.em->bm, eed);
- BM_edge_select_set(vc.em->bm, eed, FALSE);
+ BM_edge_select_set(vc.em->bm, eed, false);
}
else {
if (!BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
BM_select_history_store(vc.em->bm, eed);
- BM_edge_select_set(vc.em->bm, eed, TRUE);
+ BM_edge_select_set(vc.em->bm, eed, true);
}
else if (toggle) {
BM_select_history_remove(vc.em->bm, eed);
- BM_edge_select_set(vc.em->bm, eed, FALSE);
+ BM_edge_select_set(vc.em->bm, eed, false);
}
}
}
@@ -1904,22 +1905,22 @@ int EDBM_select_pick(bContext *C, const int mval[2], short extend, short deselec
/* Work-around: deselect first, so we can guarantee it will */
/* be active even if it was already selected */
BM_select_history_remove(vc.em->bm, eve);
- BM_vert_select_set(vc.em->bm, eve, FALSE);
+ BM_vert_select_set(vc.em->bm, eve, false);
BM_select_history_store(vc.em->bm, eve);
- BM_vert_select_set(vc.em->bm, eve, TRUE);
+ BM_vert_select_set(vc.em->bm, eve, true);
}
else if (deselect) {
BM_select_history_remove(vc.em->bm, eve);
- BM_vert_select_set(vc.em->bm, eve, FALSE);
+ BM_vert_select_set(vc.em->bm, eve, false);
}
else {
if (!BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
BM_select_history_store(vc.em->bm, eve);
- BM_vert_select_set(vc.em->bm, eve, TRUE);
+ BM_vert_select_set(vc.em->bm, eve, true);
}
else if (toggle) {
BM_select_history_remove(vc.em->bm, eve);
- BM_vert_select_set(vc.em->bm, eve, FALSE);
+ BM_vert_select_set(vc.em->bm, eve, false);
}
}
}
@@ -1936,10 +1937,10 @@ int EDBM_select_pick(bContext *C, const int mval[2], short extend, short deselec
}
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, vc.obedit);
- return 1;
+ return true;
}
- return 0;
+ return false;
}
static void edbm_strip_selections(BMEditMesh *em)
@@ -1985,38 +1986,57 @@ void EDBM_selectmode_set(BMEditMesh *em)
edbm_strip_selections(em); /* strip BMEditSelections from em->selected that are not relevant to new mode */
+ if (em->bm->totvertsel == 0 &&
+ em->bm->totedgesel == 0 &&
+ em->bm->totfacesel == 0)
+ {
+ return;
+ }
+
if (em->selectmode & SCE_SELECT_VERTEX) {
- EDBM_select_flush(em);
+ if (em->bm->totvertsel) {
+ EDBM_select_flush(em);
+ }
}
else if (em->selectmode & SCE_SELECT_EDGE) {
/* deselect vertices, and select again based on edge select */
- eve = BM_iter_new(&iter, em->bm, BM_VERTS_OF_MESH, NULL);
- for (; eve; eve = BM_iter_step(&iter)) BM_vert_select_set(em->bm, eve, FALSE);
-
- eed = BM_iter_new(&iter, em->bm, BM_EDGES_OF_MESH, NULL);
- for (; eed; eed = BM_iter_step(&iter)) {
- if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
- BM_edge_select_set(em->bm, eed, TRUE);
+ BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+ BM_vert_select_set(em->bm, eve, false);
+ }
+
+ if (em->bm->totedgesel) {
+ BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
+ if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
+ BM_edge_select_set(em->bm, eed, true);
+ }
}
+
+ /* selects faces based on edge status */
+ EDBM_selectmode_flush(em);
}
-
- /* selects faces based on edge status */
- EDBM_selectmode_flush(em);
}
else if (em->selectmode & SCE_SELECT_FACE) {
/* deselect eges, and select again based on face select */
- eed = BM_iter_new(&iter, em->bm, BM_EDGES_OF_MESH, NULL);
- for (; eed; eed = BM_iter_step(&iter)) BM_edge_select_set(em->bm, eed, FALSE);
-
- efa = BM_iter_new(&iter, em->bm, BM_FACES_OF_MESH, NULL);
- for (; efa; efa = BM_iter_step(&iter)) {
- if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
- BM_face_select_set(em->bm, efa, TRUE);
+ BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
+ BM_edge_select_set(em->bm, eed, false);
+ }
+
+ if (em->bm->totfacesel) {
+ efa = BM_iter_new(&iter, em->bm, BM_FACES_OF_MESH, NULL);
+ for (; efa; efa = BM_iter_step(&iter)) {
+ if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
+ BM_face_select_set(em->bm, efa, true);
+ }
}
}
}
}
+/**
+ * Flush the selection up:
+ * - vert -> edge
+ * - edge -> face
+ */
void EDBM_selectmode_convert(BMEditMesh *em, const short selectmode_old, const short selectmode_new)
{
BMEdge *eed;
@@ -2027,7 +2047,10 @@ void EDBM_selectmode_convert(BMEditMesh *em, const short selectmode_old, const s
/* have to find out what the selectionmode was previously */
if (selectmode_old == SCE_SELECT_VERTEX) {
- if (selectmode_new == SCE_SELECT_EDGE) {
+ if (em->bm->totvertsel == 0) {
+ /* pass */
+ }
+ else if (selectmode_new == SCE_SELECT_EDGE) {
/* select all edges associated with every selected vert */
BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
BM_elem_flag_set(eed, BM_ELEM_TAG, BM_edge_is_any_vert_flag_test(eed, BM_ELEM_SELECT));
@@ -2035,7 +2058,7 @@ void EDBM_selectmode_convert(BMEditMesh *em, const short selectmode_old, const s
BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
if (BM_elem_flag_test(eed, BM_ELEM_TAG)) {
- BM_edge_select_set(em->bm, eed, TRUE);
+ BM_edge_select_set(em->bm, eed, true);
}
}
}
@@ -2047,13 +2070,16 @@ void EDBM_selectmode_convert(BMEditMesh *em, const short selectmode_old, const s
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
if (BM_elem_flag_test(efa, BM_ELEM_TAG)) {
- BM_face_select_set(em->bm, efa, TRUE);
+ BM_face_select_set(em->bm, efa, true);
}
}
}
}
else if (selectmode_old == SCE_SELECT_EDGE) {
- if (selectmode_new == SCE_SELECT_FACE) {
+ if (em->bm->totedgesel == 0) {
+ /* pass */
+ }
+ else if (selectmode_new == SCE_SELECT_FACE) {
/* select all faces associated with every selected edge */
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
BM_elem_flag_set(efa, BM_ELEM_TAG, BM_face_is_any_edge_flag_test(efa, BM_ELEM_SELECT));
@@ -2061,7 +2087,7 @@ void EDBM_selectmode_convert(BMEditMesh *em, const short selectmode_old, const s
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
if (BM_elem_flag_test(efa, BM_ELEM_TAG)) {
- BM_face_select_set(em->bm, efa, TRUE);
+ BM_face_select_set(em->bm, efa, true);
}
}
}
@@ -2069,13 +2095,13 @@ void EDBM_selectmode_convert(BMEditMesh *em, const short selectmode_old, const s
}
/* user facing function, does notification and undo push */
-int EDBM_selectmode_toggle(bContext *C, const short selectmode_new,
- const int action, const int use_extend, const int use_expand)
+bool EDBM_selectmode_toggle(bContext *C, const short selectmode_new,
+ const int action, const bool use_extend, const bool use_expand)
{
ToolSettings *ts = CTX_data_tool_settings(C);
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = NULL;
- int ret = FALSE;
+ bool ret = false;
if (obedit && obedit->type == OB_MESH) {
em = BMEdit_FromObject(obedit);
@@ -2092,21 +2118,21 @@ int EDBM_selectmode_toggle(bContext *C, const short selectmode_new,
case 0: /* disable */
/* check we have something to do */
if ((em->selectmode & selectmode_new) == 0) {
- return FALSE;
+ return false;
}
em->selectmode &= ~selectmode_new;
break;
case 1: /* enable */
/* check we have something to do */
if ((em->selectmode & selectmode_new) != 0) {
- return FALSE;
+ return false;
}
em->selectmode |= selectmode_new;
break;
case 2: /* toggle */
/* can't disable this flag if its the only one set */
if (em->selectmode == selectmode_new) {
- return FALSE;
+ return false;
}
em->selectmode ^= selectmode_new;
break;
@@ -2120,7 +2146,7 @@ int EDBM_selectmode_toggle(bContext *C, const short selectmode_new,
em->selectmode = SCE_SELECT_VERTEX;
ts->selectmode = em->selectmode;
EDBM_selectmode_set(em);
- ret = TRUE;
+ ret = true;
break;
case SCE_SELECT_EDGE:
if (use_extend == 0 || em->selectmode == 0) {
@@ -2134,7 +2160,7 @@ int EDBM_selectmode_toggle(bContext *C, const short selectmode_new,
}
ts->selectmode = em->selectmode;
EDBM_selectmode_set(em);
- ret = TRUE;
+ ret = true;
break;
case SCE_SELECT_FACE:
if (use_extend == 0 || em->selectmode == 0) {
@@ -2149,14 +2175,14 @@ int EDBM_selectmode_toggle(bContext *C, const short selectmode_new,
}
ts->selectmode = em->selectmode;
EDBM_selectmode_set(em);
- ret = TRUE;
+ ret = true;
break;
default:
BLI_assert(0);
break;
}
- if (ret == TRUE) {
+ if (ret == true) {
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
WM_main_add_notifier(NC_SCENE | ND_TOOLSETTINGS, NULL);
}
@@ -2164,6 +2190,37 @@ int EDBM_selectmode_toggle(bContext *C, const short selectmode_new,
return ret;
}
+/**
+ * Use to disable a selectmode if its enabled, Using another mode as a fallback
+ * if the disabled mode is the only mode set.
+ *
+ * \return true if the mode is changed.
+ */
+bool EDBM_selectmode_disable(Scene *scene, BMEditMesh *em,
+ const short selectmode_disable,
+ const short selectmode_fallback)
+{
+ /* note essential, but switch out of vertex mode since the
+ * selected regions wont be nicely isolated after flushing */
+ if (em->selectmode & selectmode_disable) {
+ if (em->selectmode == selectmode_disable) {
+ em->selectmode = selectmode_fallback;
+ }
+ else {
+ em->selectmode &= ~selectmode_disable;
+ }
+ scene->toolsettings->selectmode = em->selectmode;
+ EDBM_selectmode_set(em);
+
+ WM_main_add_notifier(NC_SCENE | ND_TOOLSETTINGS, scene);
+
+ return true;
+ }
+ else {
+ return false;
+ }
+}
+
void EDBM_deselect_by_material(BMEditMesh *em, const short index, const short select)
{
BMIter iter;
@@ -2225,25 +2282,25 @@ int EDBM_select_interior_faces(BMEditMesh *em)
BMIter eiter;
BMFace *efa;
BMEdge *eed;
- int ok;
- int change = FALSE;
+ bool ok;
+ bool change = false;
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
if (BM_elem_flag_test(efa, BM_ELEM_HIDDEN))
continue;
- ok = TRUE;
+ ok = true;
BM_ITER_ELEM (eed, &eiter, efa, BM_EDGES_OF_FACE) {
if (BM_edge_face_count(eed) < 3) {
- ok = FALSE;
+ ok = false;
break;
}
}
if (ok) {
- BM_face_select_set(bm, efa, TRUE);
- change = TRUE;
+ BM_face_select_set(bm, efa, true);
+ change = true;
}
}
@@ -2256,9 +2313,9 @@ static void linked_limit_default(bContext *C, wmOperator *op)
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
if (em->selectmode == SCE_SELECT_FACE)
- RNA_boolean_set(op->ptr, "limit", TRUE);
+ RNA_boolean_set(op->ptr, "limit", true);
else
- RNA_boolean_set(op->ptr, "limit", FALSE);
+ RNA_boolean_set(op->ptr, "limit", false);
}
}
@@ -2418,7 +2475,7 @@ static int edbm_select_linked_exec(bContext *C, wmOperator *op)
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
if (BM_elem_flag_test(efa, BM_ELEM_TAG)) {
for (efa = BMW_begin(&walker, efa); efa; efa = BMW_step(&walker)) {
- BM_face_select_set(bm, efa, TRUE);
+ BM_face_select_set(bm, efa, true);
}
}
}
@@ -2600,7 +2657,7 @@ static void walker_deselect_nth(BMEditMesh *em, int nth, int offset, BMHeader *h
if (!BM_elem_flag_test(ele, BM_ELEM_TAG)) {
/* Deselect elements that aren't at "nth" depth from active */
if ((offset + BMW_current_depth(&walker)) % nth) {
- BM_elem_select_set(bm, ele, FALSE);
+ BM_elem_select_set(bm, ele, false);
}
BM_elem_flag_enable(ele, BM_ELEM_TAG);
}
@@ -2659,7 +2716,7 @@ static void deselect_nth_active(BMEditMesh *em, BMVert **r_eve, BMEdge **r_eed,
}
}
else if (em->selectmode & SCE_SELECT_FACE) {
- f = BM_active_face_get(em->bm, TRUE, FALSE);
+ f = BM_active_face_get(em->bm, true, false);
if (f) {
*r_efa = f;
return;
@@ -2695,7 +2752,7 @@ static int edbm_select_nth_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
- int nth = RNA_int_get(op->ptr, "nth");
+ const int nth = RNA_int_get(op->ptr, "nth");
int offset = RNA_int_get(op->ptr, "offset");
/* so input of offset zero ends up being (nth - 1) */
@@ -2706,7 +2763,7 @@ static int edbm_select_nth_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- EDBM_update_generic(em, FALSE, FALSE);
+ EDBM_update_generic(em, false, false);
return OPERATOR_FINISHED;
}
@@ -2763,14 +2820,14 @@ static int edbm_select_sharp_edges_exec(bContext *C, wmOperator *op)
const float sharp = RNA_float_get(op->ptr, "sharpness");
BM_ITER_MESH (e, &iter, em->bm, BM_EDGES_OF_MESH) {
- if (BM_elem_flag_test(e, BM_ELEM_HIDDEN) == FALSE &&
+ if (BM_elem_flag_test(e, BM_ELEM_HIDDEN) == false &&
BM_edge_loop_pair(e, &l1, &l2))
{
/* edge has exactly two neighboring faces, check angle */
const float angle = angle_normalized_v3v3(l1->f->no, l2->f->no);
if (fabsf(angle) > sharp) {
- BM_edge_select_set(em->bm, e, TRUE);
+ BM_edge_select_set(em->bm, e, true);
}
}
}
@@ -2810,7 +2867,7 @@ static int edbm_select_linked_flat_faces_exec(bContext *C, wmOperator *op)
BMFace *f, **stack = NULL;
BLI_array_declare(stack);
BMLoop *l, *l2;
- float sharp = RNA_float_get(op->ptr, "sharpness");
+ const float sharp = RNA_float_get(op->ptr, "sharpness");
int i;
BM_ITER_MESH (f, &iter, em->bm, BM_FACES_OF_MESH) {
@@ -2831,7 +2888,7 @@ static int edbm_select_linked_flat_faces_exec(bContext *C, wmOperator *op)
f = stack[i - 1];
i--;
- BM_face_select_set(em->bm, f, TRUE);
+ BM_face_select_set(em->bm, f, true);
BM_elem_flag_enable(f, BM_ELEM_TAG);
@@ -2907,13 +2964,13 @@ static int edbm_select_non_manifold_exec(bContext *C, wmOperator *op)
BM_ITER_MESH (v, &iter, em->bm, BM_VERTS_OF_MESH) {
if (!BM_elem_flag_test(v, BM_ELEM_HIDDEN) && !BM_vert_is_manifold(v)) {
- BM_vert_select_set(em->bm, v, TRUE);
+ BM_vert_select_set(em->bm, v, true);
}
}
BM_ITER_MESH (e, &iter, em->bm, BM_EDGES_OF_MESH) {
if (!BM_elem_flag_test(e, BM_ELEM_HIDDEN) && !BM_edge_is_manifold(e)) {
- BM_edge_select_set(em->bm, e, TRUE);
+ BM_edge_select_set(em->bm, e, true);
}
}
@@ -2948,7 +3005,7 @@ static int edbm_select_random_exec(bContext *C, wmOperator *op)
BMEdge *eed;
BMFace *efa;
BMIter iter;
- float randfac = RNA_float_get(op->ptr, "percent") / 100.0f;
+ const float randfac = RNA_float_get(op->ptr, "percent") / 100.0f;
BLI_srand(BLI_rand()); /* random seed */
@@ -2958,7 +3015,7 @@ static int edbm_select_random_exec(bContext *C, wmOperator *op)
if (em->selectmode & SCE_SELECT_VERTEX) {
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN) && BLI_frand() < randfac) {
- BM_vert_select_set(em->bm, eve, TRUE);
+ BM_vert_select_set(em->bm, eve, true);
}
}
EDBM_selectmode_flush(em);
@@ -2966,7 +3023,7 @@ static int edbm_select_random_exec(bContext *C, wmOperator *op)
else if (em->selectmode & SCE_SELECT_EDGE) {
BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN) && BLI_frand() < randfac) {
- BM_edge_select_set(em->bm, eed, TRUE);
+ BM_edge_select_set(em->bm, eed, true);
}
}
EDBM_selectmode_flush(em);
@@ -2974,7 +3031,7 @@ static int edbm_select_random_exec(bContext *C, wmOperator *op)
else {
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN) && BLI_frand() < randfac) {
- BM_face_select_set(em->bm, efa, TRUE);
+ BM_face_select_set(em->bm, efa, true);
}
}
EDBM_selectmode_flush(em);
@@ -3012,7 +3069,7 @@ static int edbm_select_ungrouped_exec(bContext *C, wmOperator *op)
BMVert *eve;
BMIter iter;
- if (!em->selectmode == SCE_SELECT_VERTEX) {
+ if ((em->selectmode & SCE_SELECT_VERTEX) == 0) {
BKE_report(op->reports, RPT_ERROR, "Does not work out of vertex selection mode");
return OPERATOR_CANCELLED;
}
@@ -3077,14 +3134,14 @@ static int edbm_select_next_loop_exec(bContext *C, wmOperator *UNUSED(op))
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
if (BM_elem_flag_test(l->v, BM_ELEM_SELECT)) {
BM_elem_flag_enable(l->next->v, BM_ELEM_TAG);
- BM_vert_select_set(em->bm, l->v, FALSE);
+ BM_vert_select_set(em->bm, l->v, false);
}
}
}
BM_ITER_MESH (v, &iter, em->bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(v, BM_ELEM_TAG)) {
- BM_vert_select_set(em->bm, v, TRUE);
+ BM_vert_select_set(em->bm, v, true);
}
}
@@ -3116,7 +3173,7 @@ static int edbm_region_to_loop_exec(bContext *C, wmOperator *UNUSED(op))
BMEdge *e;
BMIter iter;
- BM_mesh_elem_hflag_disable_all(em->bm, BM_EDGE, BM_ELEM_TAG, FALSE);
+ BM_mesh_elem_hflag_disable_all(em->bm, BM_EDGE, BM_ELEM_TAG, false);
BM_ITER_MESH (f, &iter, em->bm, BM_FACES_OF_MESH) {
BMLoop *l1, *l2;
@@ -3139,7 +3196,7 @@ static int edbm_region_to_loop_exec(bContext *C, wmOperator *UNUSED(op))
BM_ITER_MESH (e, &iter, em->bm, BM_EDGES_OF_MESH) {
if (BM_elem_flag_test(e, BM_ELEM_TAG)) {
- BM_edge_select_set(em->bm, e, TRUE);
+ BM_edge_select_set(em->bm, e, true);
}
}
@@ -3315,22 +3372,22 @@ static int edbm_loop_to_region_exec(bContext *C, wmOperator *op)
BMEditMesh *em = BMEdit_FromObject(obedit);
BMIter iter;
BMFace *f;
- int selbigger = RNA_boolean_get(op->ptr, "select_bigger");
+ const bool select_bigger = RNA_boolean_get(op->ptr, "select_bigger");
int a, b;
/* find the set of regions with smallest number of total faces */
- a = loop_find_regions(em, selbigger);
- b = loop_find_regions(em, !selbigger);
+ a = loop_find_regions(em, select_bigger);
+ b = loop_find_regions(em, !select_bigger);
- if ((a <= b) ^ selbigger) {
- loop_find_regions(em, selbigger);
+ if ((a <= b) ^ select_bigger) {
+ loop_find_regions(em, select_bigger);
}
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
BM_ITER_MESH (f, &iter, em->bm, BM_FACES_OF_MESH) {
if (BM_elem_flag_test(f, BM_ELEM_TAG) && !BM_elem_flag_test(f, BM_ELEM_HIDDEN)) {
- BM_face_select_set(em->bm, f, TRUE);
+ BM_face_select_set(em->bm, f, true);
}
}
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 36a1d30c85e..13660a47248 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -97,10 +97,10 @@ static int edbm_subdivide_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
- int cuts = RNA_int_get(op->ptr, "number_cuts");
+ const int cuts = RNA_int_get(op->ptr, "number_cuts");
float smooth = 0.292f * RNA_float_get(op->ptr, "smoothness");
- float fractal = RNA_float_get(op->ptr, "fractal") / 2.5f;
- float along_normal = RNA_float_get(op->ptr, "fractal_along_normal");
+ const float fractal = RNA_float_get(op->ptr, "fractal") / 2.5f;
+ const float along_normal = RNA_float_get(op->ptr, "fractal_along_normal");
if (RNA_boolean_get(op->ptr, "quadtri") &&
RNA_enum_get(op->ptr, "quadcorner") == SUBD_STRAIGHT_CUT)
@@ -112,10 +112,10 @@ static int edbm_subdivide_exec(bContext *C, wmOperator *op)
smooth, fractal, along_normal,
cuts,
SUBDIV_SELECT_ORIG, RNA_enum_get(op->ptr, "quadcorner"),
- RNA_boolean_get(op->ptr, "quadtri"), TRUE, FALSE,
+ RNA_boolean_get(op->ptr, "quadtri"), true, false,
RNA_int_get(op->ptr, "seed"));
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
return OPERATOR_FINISHED;
}
@@ -168,14 +168,14 @@ static int edbm_unsubdivide_exec(bContext *C, wmOperator *op)
BMEditMesh *em = BMEdit_FromObject(obedit);
BMOperator bmop;
- int iterations = RNA_int_get(op->ptr, "iterations");
+ const int iterations = RNA_int_get(op->ptr, "iterations");
EDBM_op_init(em, &bmop, op,
"unsubdivide verts=%hv iterations=%i", BM_ELEM_SELECT, iterations);
BMO_op_exec(em->bm, &bmop);
- if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ if (!EDBM_op_finish(em, &bmop, op, true)) {
return 0;
}
@@ -184,7 +184,7 @@ static int edbm_unsubdivide_exec(bContext *C, wmOperator *op)
}
EDBM_selectmode_flush(em);
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
return OPERATOR_FINISHED;
}
@@ -247,7 +247,7 @@ static short edbm_extrude_discrete_faces(BMEditMesh *em, wmOperator *op, const c
BMO_op_exec(em->bm, &bmop);
BMO_ITER (f, &siter, bmop.slots_out, "faces.out", BM_FACE) {
- BM_face_select_set(em->bm, f, TRUE);
+ BM_face_select_set(em->bm, f, true);
/* set face vertex normals to face normal */
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
@@ -255,7 +255,7 @@ static short edbm_extrude_discrete_faces(BMEditMesh *em, wmOperator *op, const c
}
}
- if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ if (!EDBM_op_finish(em, &bmop, op, true)) {
return 0;
}
@@ -273,9 +273,9 @@ static short edbm_extrude_edges_indiv(BMEditMesh *em, wmOperator *op, const char
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
BMO_op_exec(em->bm, &bmop);
- BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "geom.out", BM_VERT | BM_EDGE, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "geom.out", BM_VERT | BM_EDGE, BM_ELEM_SELECT, true);
- if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ if (!EDBM_op_finish(em, &bmop, op, true)) {
return 0;
}
@@ -290,12 +290,12 @@ static short edbm_extrude_verts_indiv(BMEditMesh *em, wmOperator *op, const char
EDBM_op_init(em, &bmop, op, "extrude_vert_indiv verts=%hv", hflag);
/* deselect original verts */
- BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_in, "verts", BM_VERT, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_in, "verts", BM_VERT, BM_ELEM_SELECT, true);
BMO_op_exec(em->bm, &bmop);
- BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "verts.out", BM_VERT, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "verts.out", BM_VERT, BM_ELEM_SELECT, true);
- if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ if (!EDBM_op_finish(em, &bmop, op, true)) {
return 0;
}
@@ -384,7 +384,7 @@ static short edbm_extrude_edge(Object *obedit, BMEditMesh *em, const char hflag,
zero_v3(nor);
BMO_ITER (ele, &siter, extop.slots_out, "geom.out", BM_ALL) {
- BM_elem_select_set(bm, ele, TRUE);
+ BM_elem_select_set(bm, ele, true);
if (ele->head.htype == BM_FACE) {
f = (BMFace *)ele;
@@ -409,8 +409,8 @@ static short edbm_extrude_vert(Object *obedit, BMEditMesh *em, const char hflag,
BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
if (BM_elem_flag_test(eed, hflag)) {
if (hflag & BM_ELEM_SELECT) {
- BM_vert_select_set(em->bm, eed->v1, TRUE);
- BM_vert_select_set(em->bm, eed->v2, TRUE);
+ BM_vert_select_set(em->bm, eed->v1, true);
+ BM_vert_select_set(em->bm, eed->v2, true);
}
BM_elem_flag_enable(eed->v1, hflag & ~BM_ELEM_SELECT);
@@ -419,7 +419,7 @@ static short edbm_extrude_vert(Object *obedit, BMEditMesh *em, const char hflag,
else {
if (BM_elem_flag_test(eed->v1, hflag) && BM_elem_flag_test(eed->v2, hflag)) {
if (hflag & BM_ELEM_SELECT) {
- BM_edge_select_set(em->bm, eed, TRUE);
+ BM_edge_select_set(em->bm, eed, true);
}
BM_elem_flag_enable(eed, hflag & ~BM_ELEM_SELECT);
@@ -436,9 +436,9 @@ static int edbm_extrude_repeat_exec(bContext *C, wmOperator *op)
BMEditMesh *em = BMEdit_FromObject(obedit);
RegionView3D *rv3d = CTX_wm_region_view3d(C);
- int steps = RNA_int_get(op->ptr, "steps");
+ const int steps = RNA_int_get(op->ptr, "steps");
- float offs = RNA_float_get(op->ptr, "offset");
+ const float offs = RNA_float_get(op->ptr, "offset");
float dvec[3], tmat[3][3], bmat[3][3], nor[3] = {0.0, 0.0, 0.0};
short a;
@@ -463,7 +463,7 @@ static int edbm_extrude_repeat_exec(bContext *C, wmOperator *op)
EDBM_mesh_normals_update(em);
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
return OPERATOR_FINISHED;
}
@@ -585,7 +585,7 @@ static int edbm_extrude_region_exec(bContext *C, wmOperator *op)
* done.*/
EDBM_mesh_normals_update(em);
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
return OPERATOR_FINISHED;
}
@@ -616,7 +616,7 @@ static int edbm_extrude_verts_exec(bContext *C, wmOperator *op)
edbm_extrude_verts_indiv(em, op, BM_ELEM_SELECT, nor);
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
return OPERATOR_FINISHED;
}
@@ -647,7 +647,7 @@ static int edbm_extrude_edges_exec(bContext *C, wmOperator *op)
edbm_extrude_edges_indiv(em, op, BM_ELEM_SELECT, nor);
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
return OPERATOR_FINISHED;
}
@@ -678,7 +678,7 @@ static int edbm_extrude_faces_exec(bContext *C, wmOperator *op)
edbm_extrude_discrete_faces(em, op, BM_ELEM_SELECT, nor);
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
return OPERATOR_FINISHED;
}
@@ -706,7 +706,7 @@ static int edbm_select_all_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
- int action = RNA_enum_get(op->ptr, "action");
+ const int action = RNA_enum_get(op->ptr, "action");
switch (action) {
case SEL_TOGGLE:
@@ -784,8 +784,8 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w
BMVert *v1;
BMIter iter;
float min[3], max[3];
- int done = FALSE;
- short use_proj;
+ bool done = false;
+ bool use_proj;
em_setup_viewcontext(C, &vc);
@@ -800,13 +800,13 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w
BM_ITER_MESH (v1, &iter, vc.em->bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(v1, BM_ELEM_SELECT)) {
minmax_v3v3_v3(min, max, v1->co);
- done = TRUE;
+ done = true;
}
}
/* call extrude? */
if (done) {
- const short rot_src = RNA_boolean_get(op->ptr, "rotate_source");
+ const bool rot_src = RNA_boolean_get(op->ptr, "rotate_source");
BMEdge *eed;
float vec[3], cent[3], mat[3][3];
float nor[3] = {0.0, 0.0, 0.0};
@@ -816,7 +816,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w
(float)event->mval[1]};
/* check for edges that are half selected, use for rotation */
- done = FALSE;
+ done = false;
BM_ITER_MESH (eed, &iter, vc.em->bm, BM_EDGES_OF_MESH) {
if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
float co1[2], co2[2];
@@ -837,7 +837,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w
nor[0] += (co2[1] - co1[1]);
nor[1] += -(co2[0] - co1[0]);
}
- done = TRUE;
+ done = true;
}
}
}
@@ -920,10 +920,10 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w
BMO_op_exec(vc.em->bm, &bmop);
BMO_ITER (v1, &oiter, bmop.slots_out, "vert.out", BM_VERT) {
- BM_vert_select_set(vc.em->bm, v1, TRUE);
+ BM_vert_select_set(vc.em->bm, v1, true);
}
- if (!EDBM_op_finish(vc.em, &bmop, op, TRUE)) {
+ if (!EDBM_op_finish(vc.em, &bmop, op, true)) {
return OPERATOR_CANCELLED;
}
}
@@ -936,7 +936,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w
* done. */
EDBM_mesh_normals_update(vc.em);
- EDBM_update_generic(vc.em, TRUE, TRUE);
+ EDBM_update_generic(vc.em, true, true);
return OPERATOR_FINISHED;
}
@@ -972,7 +972,7 @@ static int edbm_delete_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
- int type = RNA_enum_get(op->ptr, "type");
+ const int type = RNA_enum_get(op->ptr, "type");
if (type == 0) {
if (!EDBM_op_callf(em, op, "delete geom=%hv context=%i", BM_ELEM_SELECT, DEL_VERTS)) /* Erase Vertices */
@@ -1001,7 +1001,7 @@ static int edbm_delete_exec(bContext *C, wmOperator *op)
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
return OPERATOR_FINISHED;
}
@@ -1034,7 +1034,7 @@ static int edbm_collapse_edge_exec(bContext *C, wmOperator *op)
if (!EDBM_op_callf(em, op, "collapse edges=%he", BM_ELEM_SELECT))
return OPERATOR_CANCELLED;
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
return OPERATOR_FINISHED;
}
@@ -1062,7 +1062,7 @@ static int edbm_collapse_edge_loop_exec(bContext *C, wmOperator *op)
if (!EDBM_op_callf(em, op, "dissolve_edge_loop edges=%he", BM_ELEM_SELECT))
return OPERATOR_CANCELLED;
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
return OPERATOR_FINISHED;
}
@@ -1274,11 +1274,11 @@ static int edbm_add_edge_face_exec(bContext *C, wmOperator *op)
BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "edges.out", BM_EDGE, BM_ELEM_SELECT, true);
}
- if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ if (!EDBM_op_finish(em, &bmop, op, true)) {
return OPERATOR_CANCELLED;
}
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
return OPERATOR_FINISHED;
}
@@ -1309,7 +1309,7 @@ static int edbm_mark_seam(bContext *C, wmOperator *op)
BMesh *bm = em->bm;
BMEdge *eed;
BMIter iter;
- int clear = RNA_boolean_get(op->ptr, "clear");
+ const bool clear = RNA_boolean_get(op->ptr, "clear");
/* auto-enable seams drawing */
if (clear == 0) {
@@ -1333,7 +1333,7 @@ static int edbm_mark_seam(bContext *C, wmOperator *op)
}
ED_uvedit_live_unwrap(scene, obedit);
- EDBM_update_generic(em, TRUE, FALSE);
+ EDBM_update_generic(em, true, false);
return OPERATOR_FINISHED;
}
@@ -1363,7 +1363,7 @@ static int edbm_mark_sharp(bContext *C, wmOperator *op)
BMesh *bm = em->bm;
BMEdge *eed;
BMIter iter;
- int clear = RNA_boolean_get(op->ptr, "clear");
+ const bool clear = RNA_boolean_get(op->ptr, "clear");
/* auto-enable sharp edge drawing */
if (clear == 0) {
@@ -1387,7 +1387,7 @@ static int edbm_mark_sharp(bContext *C, wmOperator *op)
}
}
- EDBM_update_generic(em, TRUE, FALSE);
+ EDBM_update_generic(em, true, false);
return OPERATOR_FINISHED;
}
@@ -1423,13 +1423,13 @@ static int edbm_vert_connect(bContext *C, wmOperator *op)
}
BMO_op_exec(bm, &bmop);
len = BMO_slot_get(bmop.slots_out, "edges.out")->len;
- if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ if (!EDBM_op_finish(em, &bmop, op, true)) {
return OPERATOR_CANCELLED;
}
else {
EDBM_selectmode_flush(em); /* so newly created edges get the selection state from the vertex */
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
return len ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
}
@@ -1463,11 +1463,11 @@ static int edbm_edge_split_exec(bContext *C, wmOperator *op)
}
BMO_op_exec(bm, &bmop);
len = BMO_slot_get(bmop.slots_out, "edges.out")->len;
- if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ if (!EDBM_op_finish(em, &bmop, op, true)) {
return OPERATOR_CANCELLED;
}
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
return len ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
}
@@ -1500,13 +1500,13 @@ static int edbm_duplicate_exec(bContext *C, wmOperator *op)
BMO_op_exec(em->bm, &bmop);
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
- BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "geom.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "geom.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, true);
- if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ if (!EDBM_op_finish(em, &bmop, op, true)) {
return OPERATOR_CANCELLED;
}
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
return OPERATOR_FINISHED;
}
@@ -1545,7 +1545,7 @@ static int edbm_flip_normals_exec(bContext *C, wmOperator *op)
if (!EDBM_op_callf(em, op, "reverse_faces faces=%hf", BM_ELEM_SELECT))
return OPERATOR_CANCELLED;
- EDBM_update_generic(em, TRUE, FALSE);
+ EDBM_update_generic(em, true, false);
return OPERATOR_FINISHED;
}
@@ -1566,8 +1566,8 @@ void MESH_OT_flip_normals(wmOperatorType *ot)
}
static const EnumPropertyItem direction_items[] = {
- {FALSE, "CW", 0, "Clockwise", ""},
- {TRUE, "CCW", 0, "Counter Clockwise", ""},
+ {false, "CW", 0, "Clockwise", ""},
+ {true, "CCW", 0, "Counter Clockwise", ""},
{0, NULL, 0, NULL, NULL}
};
@@ -1579,7 +1579,7 @@ static int edbm_edge_rotate_selected_exec(bContext *C, wmOperator *op)
BMOperator bmop;
BMEdge *eed;
BMIter iter;
- const int use_ccw = RNA_boolean_get(op->ptr, "use_ccw");
+ const bool use_ccw = RNA_boolean_get(op->ptr, "use_ccw");
int tot = 0;
if (em->bm->totedgesel == 0) {
@@ -1614,19 +1614,19 @@ static int edbm_edge_rotate_selected_exec(bContext *C, wmOperator *op)
/* avoids leaving old verts selected which can be a problem running multiple times,
* since this means the edges become selected around the face which then attempt to rotate */
- BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_in, "edges", BM_EDGE, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_in, "edges", BM_EDGE, BM_ELEM_SELECT, true);
BMO_op_exec(em->bm, &bmop);
/* edges may rotate into hidden vertices, if this does _not_ run we get an ilogical state */
- BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_out, "edges.out", BM_EDGE, BM_ELEM_HIDDEN, TRUE);
- BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "edges.out", BM_EDGE, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_out, "edges.out", BM_EDGE, BM_ELEM_HIDDEN, true);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "edges.out", BM_EDGE, BM_ELEM_SELECT, true);
EDBM_selectmode_flush(em);
- if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ if (!EDBM_op_finish(em, &bmop, op, true)) {
return OPERATOR_CANCELLED;
}
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
return OPERATOR_FINISHED;
}
@@ -1646,7 +1646,7 @@ void MESH_OT_edge_rotate(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* props */
- RNA_def_boolean(ot->srna, "use_ccw", FALSE, "Counter Clockwise", "");
+ RNA_def_boolean(ot->srna, "use_ccw", false, "Counter Clockwise", "");
}
@@ -1657,7 +1657,7 @@ static int edbm_hide_exec(bContext *C, wmOperator *op)
EDBM_mesh_hide(em, RNA_boolean_get(op->ptr, "unselected"));
- EDBM_update_generic(em, TRUE, FALSE);
+ EDBM_update_generic(em, true, false);
return OPERATOR_FINISHED;
}
@@ -1687,7 +1687,7 @@ static int edbm_reveal_exec(bContext *C, wmOperator *UNUSED(op))
EDBM_mesh_reveal(em);
- EDBM_update_generic(em, TRUE, FALSE);
+ EDBM_update_generic(em, true, false);
return OPERATOR_FINISHED;
}
@@ -1714,13 +1714,13 @@ static int edbm_normals_make_consistent_exec(bContext *C, wmOperator *op)
/* doflip has to do with bmesh_rationalize_normals, it's an internal
* thing */
- if (!EDBM_op_callf(em, op, "recalc_face_normals faces=%hf use_flip=%b", BM_ELEM_SELECT, TRUE))
+ if (!EDBM_op_callf(em, op, "recalc_face_normals faces=%hf use_flip=%b", BM_ELEM_SELECT, true))
return OPERATOR_CANCELLED;
if (RNA_boolean_get(op->ptr, "inside"))
EDBM_op_callf(em, op, "reverse_faces faces=%hf", BM_ELEM_SELECT);
- EDBM_update_generic(em, TRUE, FALSE);
+ EDBM_update_generic(em, true, false);
return OPERATOR_FINISHED;
}
@@ -1749,17 +1749,17 @@ static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op)
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
ModifierData *md;
- int mirrx = FALSE, mirry = FALSE, mirrz = FALSE;
+ int mirrx = false, mirry = false, mirrz = false;
int i, repeat;
float clip_dist = 0.0f;
- int xaxis = RNA_boolean_get(op->ptr, "xaxis");
- int yaxis = RNA_boolean_get(op->ptr, "yaxis");
- int zaxis = RNA_boolean_get(op->ptr, "zaxis");
+ const bool xaxis = RNA_boolean_get(op->ptr, "xaxis");
+ const bool yaxis = RNA_boolean_get(op->ptr, "yaxis");
+ const bool zaxis = RNA_boolean_get(op->ptr, "zaxis");
/* mirror before smooth */
if (((Mesh *)obedit->data)->editflag & ME_EDIT_MIRROR_X) {
- EDBM_verts_mirror_cache_begin(em, TRUE);
+ EDBM_verts_mirror_cache_begin(em, true);
}
/* if there is a mirror modifier with clipping, flag the verts that
@@ -1771,11 +1771,11 @@ static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op)
if (mmd->flag & MOD_MIR_CLIPPING) {
if (mmd->flag & MOD_MIR_AXIS_X)
- mirrx = TRUE;
+ mirrx = true;
if (mmd->flag & MOD_MIR_AXIS_Y)
- mirry = TRUE;
+ mirry = true;
if (mmd->flag & MOD_MIR_AXIS_Z)
- mirrz = TRUE;
+ mirrz = true;
clip_dist = mmd->tolerance;
}
@@ -1802,7 +1802,7 @@ static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op)
EDBM_verts_mirror_cache_end(em);
}
- EDBM_update_generic(em, TRUE, FALSE);
+ EDBM_update_generic(em, true, false);
return OPERATOR_FINISHED;
}
@@ -1831,7 +1831,7 @@ static int edbm_do_smooth_laplacian_vertex_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
- int usex = TRUE, usey = TRUE, usez = TRUE, preserve_volume = TRUE;
+ int usex = true, usey = true, usez = true, preserve_volume = true;
int i, repeat;
float lambda_factor;
float lambda_border;
@@ -1850,7 +1850,7 @@ static int edbm_do_smooth_laplacian_vertex_exec(bContext *C, wmOperator *op)
/* mirror before smooth */
if (((Mesh *)obedit->data)->editflag & ME_EDIT_MIRROR_X) {
- EDBM_verts_mirror_cache_begin(em, TRUE);
+ EDBM_verts_mirror_cache_begin(em, true);
}
repeat = RNA_int_get(op->ptr, "repeat");
@@ -1878,7 +1878,7 @@ static int edbm_do_smooth_laplacian_vertex_exec(bContext *C, wmOperator *op)
EDBM_verts_mirror_cache_end(em);
}
- EDBM_update_generic(em, TRUE, FALSE);
+ EDBM_update_generic(em, true, false);
return OPERATOR_FINISHED;
}
@@ -1932,7 +1932,7 @@ static int edbm_faces_shade_smooth_exec(bContext *C, wmOperator *UNUSED(op))
mesh_set_smooth_faces(em, 1);
- EDBM_update_generic(em, FALSE, FALSE);
+ EDBM_update_generic(em, false, false);
return OPERATOR_FINISHED;
}
@@ -1959,7 +1959,7 @@ static int edbm_faces_shade_flat_exec(bContext *C, wmOperator *UNUSED(op))
mesh_set_smooth_faces(em, 0);
- EDBM_update_generic(em, FALSE, FALSE);
+ EDBM_update_generic(em, false, false);
return OPERATOR_FINISHED;
}
@@ -1989,7 +1989,7 @@ static int edbm_rotate_uvs_exec(bContext *C, wmOperator *op)
BMOperator bmop;
/* get the direction from RNA */
- const int use_ccw = RNA_boolean_get(op->ptr, "use_ccw");
+ const bool use_ccw = RNA_boolean_get(op->ptr, "use_ccw");
/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
EDBM_op_init(em, &bmop, op, "rotate_uvs faces=%hf use_ccw=%b", BM_ELEM_SELECT, use_ccw);
@@ -1998,11 +1998,11 @@ static int edbm_rotate_uvs_exec(bContext *C, wmOperator *op)
BMO_op_exec(em->bm, &bmop);
/* finish the operator */
- if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ if (!EDBM_op_finish(em, &bmop, op, true)) {
return OPERATOR_CANCELLED;
}
- EDBM_update_generic(em, FALSE, FALSE);
+ EDBM_update_generic(em, false, false);
/* we succeeded */
return OPERATOR_FINISHED;
@@ -2021,11 +2021,11 @@ static int edbm_reverse_uvs_exec(bContext *C, wmOperator *op)
BMO_op_exec(em->bm, &bmop);
/* finish the operator */
- if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ if (!EDBM_op_finish(em, &bmop, op, true)) {
return OPERATOR_CANCELLED;
}
- EDBM_update_generic(em, FALSE, FALSE);
+ EDBM_update_generic(em, false, false);
/* we succeeded */
return OPERATOR_FINISHED;
@@ -2038,7 +2038,7 @@ static int edbm_rotate_colors_exec(bContext *C, wmOperator *op)
BMOperator bmop;
/* get the direction from RNA */
- const int use_ccw = RNA_boolean_get(op->ptr, "use_ccw");
+ const bool use_ccw = RNA_boolean_get(op->ptr, "use_ccw");
/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
EDBM_op_init(em, &bmop, op, "rotate_colors faces=%hf use_ccw=%b", BM_ELEM_SELECT, use_ccw);
@@ -2047,12 +2047,12 @@ static int edbm_rotate_colors_exec(bContext *C, wmOperator *op)
BMO_op_exec(em->bm, &bmop);
/* finish the operator */
- if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ if (!EDBM_op_finish(em, &bmop, op, true)) {
return OPERATOR_CANCELLED;
}
/* dependencies graph and notification stuff */
- EDBM_update_generic(em, FALSE, FALSE);
+ EDBM_update_generic(em, false, false);
/* we succeeded */
return OPERATOR_FINISHED;
@@ -2072,11 +2072,11 @@ static int edbm_reverse_colors_exec(bContext *C, wmOperator *op)
BMO_op_exec(em->bm, &bmop);
/* finish the operator */
- if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ if (!EDBM_op_finish(em, &bmop, op, true)) {
return OPERATOR_CANCELLED;
}
- EDBM_update_generic(em, FALSE, FALSE);
+ EDBM_update_generic(em, false, false);
/* we succeeded */
return OPERATOR_FINISHED;
@@ -2097,7 +2097,7 @@ void MESH_OT_uvs_rotate(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* props */
- RNA_def_boolean(ot->srna, "use_ccw", FALSE, "Counter Clockwise", "");
+ RNA_def_boolean(ot->srna, "use_ccw", false, "Counter Clockwise", "");
}
//void MESH_OT_uvs_mirror(wmOperatorType *ot)
@@ -2134,7 +2134,7 @@ void MESH_OT_colors_rotate(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* props */
- RNA_def_boolean(ot->srna, "use_ccw", FALSE, "Counter Clockwise", "");
+ RNA_def_boolean(ot->srna, "use_ccw", false, "Counter Clockwise", "");
}
void MESH_OT_colors_reverse(wmOperatorType *ot)
@@ -2156,7 +2156,7 @@ void MESH_OT_colors_reverse(wmOperatorType *ot)
}
-static int merge_firstlast(BMEditMesh *em, int first, int uvmerge, wmOperator *wmop)
+static bool merge_firstlast(BMEditMesh *em, const bool use_first, const bool use_uvmerge, wmOperator *wmop)
{
BMVert *mergevert;
BMEditSelection *ese;
@@ -2166,44 +2166,44 @@ static int merge_firstlast(BMEditMesh *em, int first, int uvmerge, wmOperator *w
*/
/* do sanity check in mergemenu in edit.c ?*/
- if (first == 0) {
+ if (use_first == false) {
if (!em->bm->selected.last || ((BMEditSelection *)em->bm->selected.last)->htype != BM_VERT)
- return OPERATOR_CANCELLED;
+ return false;
ese = em->bm->selected.last;
mergevert = (BMVert *)ese->ele;
}
else {
if (!em->bm->selected.first || ((BMEditSelection *)em->bm->selected.first)->htype != BM_VERT)
- return OPERATOR_CANCELLED;
+ return false;
ese = em->bm->selected.first;
mergevert = (BMVert *)ese->ele;
}
if (!BM_elem_flag_test(mergevert, BM_ELEM_SELECT))
- return OPERATOR_CANCELLED;
+ return false;
- if (uvmerge) {
+ if (use_uvmerge) {
if (!EDBM_op_callf(em, wmop, "pointmerge_facedata verts=%hv vert_snap=%e", BM_ELEM_SELECT, mergevert))
- return OPERATOR_CANCELLED;
+ return false;
}
if (!EDBM_op_callf(em, wmop, "pointmerge verts=%hv merge_co=%v", BM_ELEM_SELECT, mergevert->co))
- return OPERATOR_CANCELLED;
+ return false;
- return OPERATOR_FINISHED;
+ return true;
}
-static int merge_target(BMEditMesh *em, Scene *scene, View3D *v3d, Object *ob,
- int target, int uvmerge, wmOperator *wmop)
+static bool merge_target(BMEditMesh *em, Scene *scene, View3D *v3d, Object *ob,
+ const bool use_cursor, const bool use_uvmerge, wmOperator *wmop)
{
BMIter iter;
BMVert *v;
float co[3], cent[3] = {0.0f, 0.0f, 0.0f};
const float *vco = NULL;
- if (target) {
+ if (use_cursor) {
vco = give_cursor(scene, v3d);
copy_v3_v3(co, vco);
mul_m4_v3(ob->imat, co);
@@ -2219,7 +2219,7 @@ static int merge_target(BMEditMesh *em, Scene *scene, View3D *v3d, Object *ob,
}
if (!i)
- return OPERATOR_CANCELLED;
+ return false;
fac = 1.0f / (float)i;
mul_v3_fl(cent, fac);
@@ -2228,17 +2228,17 @@ static int merge_target(BMEditMesh *em, Scene *scene, View3D *v3d, Object *ob,
}
if (!vco)
- return OPERATOR_CANCELLED;
+ return false;
- if (uvmerge) {
+ if (use_uvmerge) {
if (!EDBM_op_callf(em, wmop, "average_vert_facedata verts=%hv", BM_ELEM_SELECT))
- return OPERATOR_CANCELLED;
+ return false;
}
if (!EDBM_op_callf(em, wmop, "pointmerge verts=%hv merge_co=%v", BM_ELEM_SELECT, co))
- return OPERATOR_CANCELLED;
+ return false;
- return OPERATOR_FINISHED;
+ return true;
}
static int edbm_merge_exec(bContext *C, wmOperator *op)
@@ -2247,32 +2247,37 @@ static int edbm_merge_exec(bContext *C, wmOperator *op)
View3D *v3d = CTX_wm_view3d(C);
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
- int status = 0, uvs = RNA_boolean_get(op->ptr, "uvs");
+ const int type = RNA_enum_get(op->ptr, "type");
+ const bool uvs = RNA_boolean_get(op->ptr, "uvs");
+ bool ok = false;
- switch (RNA_enum_get(op->ptr, "type")) {
+ switch (type) {
case 3:
- status = merge_target(em, scene, v3d, obedit, 0, uvs, op);
+ ok = merge_target(em, scene, v3d, obedit, false, uvs, op);
break;
case 4:
- status = merge_target(em, scene, v3d, obedit, 1, uvs, op);
+ ok = merge_target(em, scene, v3d, obedit, true, uvs, op);
break;
case 1:
- status = merge_firstlast(em, 0, uvs, op);
+ ok = merge_firstlast(em, false, uvs, op);
break;
case 6:
- status = merge_firstlast(em, 1, uvs, op);
+ ok = merge_firstlast(em, true, uvs, op);
break;
case 5:
- status = 1;
+ ok = true;
if (!EDBM_op_callf(em, op, "collapse edges=%he", BM_ELEM_SELECT))
- status = 0;
+ ok = false;
break;
+ default:
+ BLI_assert(0);
}
- if (!status)
+ if (!ok) {
return OPERATOR_CANCELLED;
+ }
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
return OPERATOR_FINISHED;
}
@@ -2356,8 +2361,8 @@ static int edbm_remove_doubles_exec(bContext *C, wmOperator *op)
BMEditMesh *em = BMEdit_FromObject(obedit);
BMOperator bmop;
const float threshold = RNA_float_get(op->ptr, "threshold");
- int use_unselected = RNA_boolean_get(op->ptr, "use_unselected");
- int totvert_orig = em->bm->totvert;
+ const bool use_unselected = RNA_boolean_get(op->ptr, "use_unselected");
+ const int totvert_orig = em->bm->totvert;
int count;
if (use_unselected) {
@@ -2366,7 +2371,7 @@ static int edbm_remove_doubles_exec(bContext *C, wmOperator *op)
BM_ELEM_SELECT, threshold);
BMO_op_exec(em->bm, &bmop);
- if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ if (!EDBM_op_finish(em, &bmop, op, true)) {
return OPERATOR_CANCELLED;
}
}
@@ -2381,7 +2386,7 @@ static int edbm_remove_doubles_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ if (!EDBM_op_finish(em, &bmop, op, true)) {
return OPERATOR_CANCELLED;
}
}
@@ -2389,7 +2394,7 @@ static int edbm_remove_doubles_exec(bContext *C, wmOperator *op)
count = totvert_orig - em->bm->totvert;
BKE_reportf(op->reports, RPT_INFO, "Removed %d vertices", count);
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
return OPERATOR_FINISHED;
}
@@ -2439,7 +2444,7 @@ static int edbm_select_vertex_path_exec(bContext *C, wmOperator *op)
BMEditSelection *sv, *ev;
/* get the type from RNA */
- int type = RNA_enum_get(op->ptr, "type");
+ const int type = RNA_enum_get(op->ptr, "type");
/* first try to find vertices in edit selection */
sv = em->bm->selected.last;
@@ -2491,16 +2496,16 @@ static int edbm_select_vertex_path_exec(bContext *C, wmOperator *op)
/* EDBM_flag_disable_all(em, BM_ELEM_SELECT); */
/* select the output */
- BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "verts.out", BM_VERT, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "verts.out", BM_VERT, BM_ELEM_SELECT, true);
/* finish the operator */
- if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ if (!EDBM_op_finish(em, &bmop, op, true)) {
return OPERATOR_CANCELLED;
}
EDBM_selectmode_flush(em);
- EDBM_update_generic(em, FALSE, FALSE);
+ EDBM_update_generic(em, false, false);
/* we succeeded */
return OPERATOR_FINISHED;
@@ -2575,7 +2580,7 @@ static int edbm_shape_propagate_to_all_exec(bContext *C, wmOperator *op)
shape_propagate(em, op);
- EDBM_update_generic(em, FALSE, FALSE);
+ EDBM_update_generic(em, false, false);
return OPERATOR_FINISHED;
}
@@ -2607,11 +2612,12 @@ static int edbm_blend_from_shape_exec(bContext *C, wmOperator *op)
BMVert *eve;
BMIter iter;
float co[3], *sco;
- float blend = RNA_float_get(op->ptr, "blend");
- int shape = RNA_enum_get(op->ptr, "shape");
- int add = RNA_boolean_get(op->ptr, "add");
int totshape;
+ const float blend = RNA_float_get(op->ptr, "blend");
+ const int shape = RNA_enum_get(op->ptr, "shape");
+ const bool use_add = RNA_boolean_get(op->ptr, "add");
+
/* sanity check */
totshape = CustomData_number_of_layers(&em->bm->vdata, CD_SHAPEKEY);
if (totshape == 0 || shape < 0 || shape >= totshape)
@@ -2631,7 +2637,7 @@ static int edbm_blend_from_shape_exec(bContext *C, wmOperator *op)
sco = CustomData_bmesh_get_n(&em->bm->vdata, eve->head.data, CD_SHAPEKEY, shape);
copy_v3_v3(co, sco);
- if (add) {
+ if (use_add) {
/* in add mode, we add relative shape key offset */
if (kb) {
float *rco = CustomData_bmesh_get_n(&em->bm->vdata, eve->head.data, CD_SHAPEKEY, kb->relative);
@@ -2646,7 +2652,7 @@ static int edbm_blend_from_shape_exec(bContext *C, wmOperator *op)
}
}
- EDBM_update_generic(em, TRUE, FALSE);
+ EDBM_update_generic(em, true, false);
return OPERATOR_FINISHED;
}
@@ -2730,8 +2736,8 @@ static int edbm_select_axis_exec(bContext *C, wmOperator *op)
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
BMEditSelection *ese = em->bm->selected.last;
- int axis = RNA_enum_get(op->ptr, "axis");
- int mode = RNA_enum_get(op->ptr, "mode"); /* -1 == aligned, 0 == neg, 1 == pos */
+ const int axis = RNA_enum_get(op->ptr, "axis");
+ const int mode = RNA_enum_get(op->ptr, "mode"); /* -1 == aligned, 0 == neg, 1 == pos */
if (ese == NULL || ese->htype != BM_VERT) {
BKE_report(op->reports, RPT_WARNING, "This operator requires an active vertex (last selected)");
@@ -2753,15 +2759,15 @@ static int edbm_select_axis_exec(bContext *C, wmOperator *op)
switch (mode) {
case -1: /* aligned */
if (fabsf(ev->co[axis] - value) < limit)
- BM_vert_select_set(em->bm, ev, TRUE);
+ BM_vert_select_set(em->bm, ev, true);
break;
case 0: /* neg */
if (ev->co[axis] > value)
- BM_vert_select_set(em->bm, ev, TRUE);
+ BM_vert_select_set(em->bm, ev, true);
break;
case 1: /* pos */
if (ev->co[axis] < value)
- BM_vert_select_set(em->bm, ev, TRUE);
+ BM_vert_select_set(em->bm, ev, true);
break;
}
}
@@ -2815,7 +2821,7 @@ static int edbm_solidify_exec(bContext *C, wmOperator *op)
BMesh *bm = em->bm;
BMOperator bmop;
- float thickness = RNA_float_get(op->ptr, "thickness");
+ const float thickness = RNA_float_get(op->ptr, "thickness");
if (!EDBM_op_init(em, &bmop, op, "solidify geom=%hf thickness=%f", BM_ELEM_SELECT, thickness)) {
return OPERATOR_CANCELLED;
@@ -2824,19 +2830,19 @@ static int edbm_solidify_exec(bContext *C, wmOperator *op)
/* deselect only the faces in the region to be solidified (leave wire
* edges and loose verts selected, as there will be no corresponding
* geometry selected below) */
- BMO_slot_buffer_hflag_disable(bm, bmop.slots_in, "geom", BM_FACE, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_disable(bm, bmop.slots_in, "geom", BM_FACE, BM_ELEM_SELECT, true);
/* run the solidify operator */
BMO_op_exec(bm, &bmop);
/* select the newly generated faces */
- BMO_slot_buffer_hflag_enable(bm, bmop.slots_out, "geom.out", BM_FACE, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_enable(bm, bmop.slots_out, "geom.out", BM_FACE, BM_ELEM_SELECT, true);
- if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ if (!EDBM_op_finish(em, &bmop, op, true)) {
return OPERATOR_CANCELLED;
}
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
return OPERATOR_FINISHED;
}
@@ -3061,7 +3067,8 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op)
BMOperator bmop;
float isect = 0.0f;
int len = 0, isected, i;
- short numcuts = 1, mode = RNA_int_get(op->ptr, "type");
+ short numcuts = 1;
+ const short mode = RNA_int_get(op->ptr, "type");
BMOpSlot *slot_edge_percents;
/* allocd vars */
@@ -3119,7 +3126,7 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op)
/* store percentage of edge cut for KNIFE_EXACT here.*/
slot_edge_percents = BMO_slot_get(bmop.slots_in, "edge_percents");
for (be = BM_iter_new(&iter, bm, BM_EDGES_OF_MESH, NULL); be; be = BM_iter_step(&iter)) {
- int is_cut = FALSE;
+ bool is_cut = false;
if (BM_elem_flag_test(be, BM_ELEM_SELECT)) {
const float *sco_a = screen_vert_coords[BM_elem_index_get(be->v1)];
const float *sco_b = screen_vert_coords[BM_elem_index_get(be->v2)];
@@ -3151,17 +3158,17 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op)
BMO_slot_int_set(bmop.slots_in, "cuts", numcuts);
BMO_slot_int_set(bmop.slots_in, "quad_corner_type", SUBD_STRAIGHT_CUT);
- BMO_slot_bool_set(bmop.slots_in, "use_single_edge", FALSE);
- BMO_slot_bool_set(bmop.slots_in, "use_grid_fill", FALSE);
+ BMO_slot_bool_set(bmop.slots_in, "use_single_edge", false);
+ BMO_slot_bool_set(bmop.slots_in, "use_grid_fill", false);
BMO_slot_float_set(bmop.slots_in, "radius", 0);
BMO_op_exec(bm, &bmop);
- if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ if (!EDBM_op_finish(em, &bmop, op, true)) {
return OPERATOR_CANCELLED;
}
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
return OPERATOR_FINISHED;
}
@@ -3226,25 +3233,25 @@ static int mesh_separate_tagged(Main *bmain, Scene *scene, Base *base_old, BMesh
/* deselect loose data - this used to get deleted,
* we could de-select edges and verts only, but this turns out to be less complicated
* since de-selecting all skips selection flushing logic */
- BM_mesh_elem_hflag_disable_all(bm_old, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, FALSE);
+ BM_mesh_elem_hflag_disable_all(bm_old, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, false);
- BM_mesh_normals_update(bm_new, FALSE);
+ BM_mesh_normals_update(bm_new, false);
- BM_mesh_bm_to_me(bm_new, base_new->object->data, FALSE);
+ BM_mesh_bm_to_me(bm_new, base_new->object->data, false);
BM_mesh_free(bm_new);
((Mesh *)base_new->object->data)->edit_btmesh = NULL;
- return TRUE;
+ return true;
}
-static int mesh_separate_selected(Main *bmain, Scene *scene, Base *base_old, BMesh *bm_old)
+static bool mesh_separate_selected(Main *bmain, Scene *scene, Base *base_old, BMesh *bm_old)
{
/* we may have tags from previous operators */
- BM_mesh_elem_hflag_disable_all(bm_old, BM_FACE | BM_EDGE | BM_VERT, BM_ELEM_TAG, FALSE);
+ BM_mesh_elem_hflag_disable_all(bm_old, BM_FACE | BM_EDGE | BM_VERT, BM_ELEM_TAG, false);
/* sel -> tag */
- BM_mesh_elem_hflag_enable_test(bm_old, BM_FACE | BM_EDGE | BM_VERT, BM_ELEM_TAG, TRUE, BM_ELEM_SELECT);
+ BM_mesh_elem_hflag_enable_test(bm_old, BM_FACE | BM_EDGE | BM_VERT, BM_ELEM_TAG, true, BM_ELEM_SELECT);
return mesh_separate_tagged(bmain, scene, base_old, bm_old);
}
@@ -3260,7 +3267,7 @@ static void bm_mesh_hflag_flush_vert(BMesh *bm, const char hflag)
BMIter eiter;
BMIter fiter;
- int ok;
+ bool ok;
BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) {
if (BM_elem_flag_test(e->v1, hflag) &&
@@ -3273,11 +3280,11 @@ static void bm_mesh_hflag_flush_vert(BMesh *bm, const char hflag)
}
}
BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
- ok = TRUE;
+ ok = true;
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
do {
if (!BM_elem_flag_test(l_iter->v, hflag)) {
- ok = FALSE;
+ ok = false;
break;
}
} while ((l_iter = l_iter->next) != l_first);
@@ -3286,17 +3293,17 @@ static void bm_mesh_hflag_flush_vert(BMesh *bm, const char hflag)
}
}
-static int mesh_separate_material(Main *bmain, Scene *scene, Base *base_old, BMesh *bm_old)
+static bool mesh_separate_material(Main *bmain, Scene *scene, Base *base_old, BMesh *bm_old)
{
BMFace *f_cmp, *f;
BMIter iter;
- int result = FALSE;
+ bool result = false;
while ((f_cmp = BM_iter_at_index(bm_old, BM_FACES_OF_MESH, NULL, 0))) {
const short mat_nr = f_cmp->mat_nr;
int tot = 0;
- BM_mesh_elem_hflag_disable_all(bm_old, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_TAG, FALSE);
+ BM_mesh_elem_hflag_disable_all(bm_old, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_TAG, false);
BM_ITER_MESH (f, &iter, bm_old, BM_FACES_OF_MESH) {
if (f->mat_nr == mat_nr) {
@@ -3326,17 +3333,17 @@ static int mesh_separate_material(Main *bmain, Scene *scene, Base *base_old, BMe
return result;
}
-static int mesh_separate_loose(Main *bmain, Scene *scene, Base *base_old, BMesh *bm_old)
+static bool mesh_separate_loose(Main *bmain, Scene *scene, Base *base_old, BMesh *bm_old)
{
int i;
BMEdge *e;
BMVert *v_seed;
BMWalker walker;
- int result = FALSE;
+ bool result = false;
int max_iter = bm_old->totvert;
/* Clear all selected vertices */
- BM_mesh_elem_hflag_disable_all(bm_old, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_TAG, FALSE);
+ BM_mesh_elem_hflag_disable_all(bm_old, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_TAG, false);
/* A "while (true)" loop should work here as each iteration should
* select and remove at least one vertex and when all vertices
@@ -3389,7 +3396,8 @@ static int edbm_separate_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
- int retval = 0, type = RNA_enum_get(op->ptr, "type");
+ const int type = RNA_enum_get(op->ptr, "type");
+ int retval = 0;
if (ED_operator_editmesh(C)) {
Base *base = CTX_data_active_base(C);
@@ -3412,7 +3420,7 @@ static int edbm_separate_exec(bContext *C, wmOperator *op)
else BLI_assert(0);
if (retval) {
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
}
}
else {
@@ -3433,14 +3441,14 @@ static int edbm_separate_exec(bContext *C, wmOperator *op)
bm_old = BM_mesh_create(&bm_mesh_allocsize_default);
- BM_mesh_bm_from_me(bm_old, me, FALSE, 0);
+ BM_mesh_bm_from_me(bm_old, me, false, 0);
if (type == 1) retval_iter = mesh_separate_material(bmain, scene, base_iter, bm_old);
else if (type == 2) retval_iter = mesh_separate_loose(bmain, scene, base_iter, bm_old);
else BLI_assert(0);
if (retval_iter) {
- BM_mesh_bm_to_me(bm_old, me, FALSE);
+ BM_mesh_bm_to_me(bm_old, me, false);
DAG_id_tag_update(&me->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
@@ -3497,7 +3505,7 @@ static int edbm_fill_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
- int use_beauty = RNA_boolean_get(op->ptr, "use_beauty");
+ const bool use_beauty = RNA_boolean_get(op->ptr, "use_beauty");
BMOperator bmop;
if (!EDBM_op_init(em, &bmop, op,
@@ -3510,13 +3518,13 @@ static int edbm_fill_exec(bContext *C, wmOperator *op)
BMO_op_exec(em->bm, &bmop);
/* select new geometry */
- BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "geom.out", BM_FACE | BM_EDGE, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "geom.out", BM_FACE | BM_EDGE, BM_ELEM_SELECT, true);
- if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ if (!EDBM_op_finish(em, &bmop, op, true)) {
return OPERATOR_CANCELLED;
}
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
return OPERATOR_FINISHED;
@@ -3547,7 +3555,7 @@ static int edbm_beautify_fill_exec(bContext *C, wmOperator *op)
if (!EDBM_op_callf(em, op, "beautify_fill faces=%hf edges=ae", BM_ELEM_SELECT))
return OPERATOR_CANCELLED;
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
return OPERATOR_FINISHED;
}
@@ -3574,7 +3582,7 @@ static int edbm_quads_convert_to_tris_exec(bContext *C, wmOperator *op)
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
BMOperator bmop;
- int use_beauty = RNA_boolean_get(op->ptr, "use_beauty");
+ const bool use_beauty = RNA_boolean_get(op->ptr, "use_beauty");
EDBM_op_init(em, &bmop, op, "triangulate faces=%hf use_beauty=%b", BM_ELEM_SELECT, use_beauty);
BMO_op_exec(em->bm, &bmop);
@@ -3586,11 +3594,11 @@ static int edbm_quads_convert_to_tris_exec(bContext *C, wmOperator *op)
&bmop, "faces.out", &bmop, "edges.out");
}
- if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ if (!EDBM_op_finish(em, &bmop, op, true)) {
return OPERATOR_CANCELLED;
}
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
return OPERATOR_FINISHED;
}
@@ -3617,7 +3625,7 @@ static int edbm_tris_convert_to_quads_exec(bContext *C, wmOperator *op)
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
int dosharp, douvs, dovcols, domaterials;
- float limit = RNA_float_get(op->ptr, "limit");
+ const float limit = RNA_float_get(op->ptr, "limit");
dosharp = RNA_boolean_get(op->ptr, "sharp");
douvs = RNA_boolean_get(op->ptr, "uvs");
@@ -3631,7 +3639,7 @@ static int edbm_tris_convert_to_quads_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
return OPERATOR_FINISHED;
}
@@ -3672,7 +3680,7 @@ static int edbm_dissolve_exec(bContext *C, wmOperator *op)
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
- int use_verts = RNA_boolean_get(op->ptr, "use_verts");
+ const bool use_verts = RNA_boolean_get(op->ptr, "use_verts");
if (em->selectmode & SCE_SELECT_FACE) {
if (!EDBM_op_callf(em, op, "dissolve_faces faces=%hf use_verts=%b", BM_ELEM_SELECT, use_verts))
@@ -3687,7 +3695,7 @@ static int edbm_dissolve_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
return OPERATOR_FINISHED;
}
@@ -3717,7 +3725,7 @@ static int edbm_dissolve_limited_exec(bContext *C, wmOperator *op)
BMEditMesh *em = BMEdit_FromObject(obedit);
BMesh *bm = em->bm;
const float angle_limit = RNA_float_get(op->ptr, "angle_limit");
- const int use_dissolve_boundaries = RNA_boolean_get(op->ptr, "use_dissolve_boundaries");
+ const bool use_dissolve_boundaries = RNA_boolean_get(op->ptr, "use_dissolve_boundaries");
char dissolve_flag;
@@ -3759,7 +3767,7 @@ static int edbm_dissolve_limited_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
return OPERATOR_FINISHED;
}
@@ -3793,18 +3801,18 @@ static int edbm_split_exec(bContext *C, wmOperator *op)
BMEditMesh *em = BMEdit_FromObject(ob);
BMOperator bmop;
- EDBM_op_init(em, &bmop, op, "split geom=%hvef use_only_faces=%b", BM_ELEM_SELECT, FALSE);
+ EDBM_op_init(em, &bmop, op, "split geom=%hvef use_only_faces=%b", BM_ELEM_SELECT, false);
BMO_op_exec(em->bm, &bmop);
- BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, FALSE);
- BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "geom.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, TRUE);
- if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, false);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "geom.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, true);
+ if (!EDBM_op_finish(em, &bmop, op, true)) {
return OPERATOR_CANCELLED;
}
/* Geometry has changed, need to recalc normals and looptris */
EDBM_mesh_normals_update(em);
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
return OPERATOR_FINISHED;
}
@@ -3858,12 +3866,12 @@ static int edbm_spin_exec(bContext *C, wmOperator *op)
}
BMO_op_exec(bm, &spinop);
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
- BMO_slot_buffer_hflag_enable(bm, spinop.slots_out, "geom_last.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, TRUE);
- if (!EDBM_op_finish(em, &spinop, op, TRUE)) {
+ BMO_slot_buffer_hflag_enable(bm, spinop.slots_out, "geom_last.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, true);
+ if (!EDBM_op_finish(em, &spinop, op, true)) {
return OPERATOR_CANCELLED;
}
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
return OPERATOR_FINISHED;
}
@@ -3976,18 +3984,18 @@ static int edbm_screw_exec(bContext *C, wmOperator *op)
if (!EDBM_op_init(em, &spinop, op,
"spin geom=%hvef cent=%v axis=%v dvec=%v steps=%i angle=%f use_duplicate=%b",
- BM_ELEM_SELECT, cent, axis, dvec, turns * steps, DEG2RADF(360.0f * turns), FALSE))
+ BM_ELEM_SELECT, cent, axis, dvec, turns * steps, DEG2RADF(360.0f * turns), false))
{
return OPERATOR_CANCELLED;
}
BMO_op_exec(bm, &spinop);
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
- BMO_slot_buffer_hflag_enable(bm, spinop.slots_out, "geom_last.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, TRUE);
- if (!EDBM_op_finish(em, &spinop, op, TRUE)) {
+ BMO_slot_buffer_hflag_enable(bm, spinop.slots_out, "geom_last.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, true);
+ if (!EDBM_op_finish(em, &spinop, op, true)) {
return OPERATOR_CANCELLED;
}
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
return OPERATOR_FINISHED;
}
@@ -4061,12 +4069,12 @@ static int edbm_select_face_by_sides_exec(bContext *C, wmOperator *op)
break;
default:
BLI_assert(0);
- select = FALSE;
+ select = false;
break;
}
if (select) {
- BM_face_select_set(em->bm, efa, TRUE);
+ BM_face_select_set(em->bm, efa, true);
}
}
@@ -4101,7 +4109,7 @@ void MESH_OT_select_face_by_sides(wmOperatorType *ot)
/* properties */
RNA_def_int(ot->srna, "number", 4, 3, INT_MAX, "Number of Vertices", "", 3, INT_MAX);
RNA_def_enum(ot->srna, "type", type_items, 1, "Type", "Type of comparison to make");
- RNA_def_boolean(ot->srna, "extend", TRUE, "Extend", "Extend the selection");
+ RNA_def_boolean(ot->srna, "extend", true, "Extend", "Extend the selection");
}
static int edbm_select_loose_verts_exec(bContext *C, wmOperator *op)
@@ -4117,13 +4125,13 @@ static int edbm_select_loose_verts_exec(bContext *C, wmOperator *op)
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
if (!eve->e) {
- BM_vert_select_set(em->bm, eve, TRUE);
+ BM_vert_select_set(em->bm, eve, true);
}
}
BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
if (!eed->l) {
- BM_edge_select_set(em->bm, eed, TRUE);
+ BM_edge_select_set(em->bm, eed, true);
}
}
@@ -4155,7 +4163,7 @@ static int edbm_select_mirror_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
- int extend = RNA_boolean_get(op->ptr, "extend");
+ bool extend = RNA_boolean_get(op->ptr, "extend");
if (em->bm->totvert && em->bm->totvertsel) {
EDBM_select_mirrored(obedit, em, extend);
@@ -4259,12 +4267,12 @@ static void sort_bmelem_flag(Scene *scene, Object *ob,
float co[3];
mul_v3_m4v3(co, mat, ve->co);
- pb[i] = FALSE;
+ pb[i] = false;
sb[affected[0]].org_idx = i;
sb[affected[0]++].srt = co[coidx] * fact;
}
else {
- pb[i] = TRUE;
+ pb[i] = true;
}
}
}
@@ -4279,12 +4287,12 @@ static void sort_bmelem_flag(Scene *scene, Object *ob,
mid_v3_v3v3(co, ed->v1->co, ed->v2->co);
mul_m4_v3(mat, co);
- pb[i] = FALSE;
+ pb[i] = false;
sb[affected[1]].org_idx = i;
sb[affected[1]++].srt = co[coidx] * fact;
}
else {
- pb[i] = TRUE;
+ pb[i] = true;
}
}
}
@@ -4299,12 +4307,12 @@ static void sort_bmelem_flag(Scene *scene, Object *ob,
BM_face_calc_center_mean(fa, co);
mul_m4_v3(mat, co);
- pb[i] = FALSE;
+ pb[i] = false;
sb[affected[2]].org_idx = i;
sb[affected[2]++].srt = co[coidx] * fact;
}
else {
- pb[i] = TRUE;
+ pb[i] = true;
}
}
}
@@ -4328,12 +4336,12 @@ static void sort_bmelem_flag(Scene *scene, Object *ob,
BM_ITER_MESH_INDEX (ve, &iter, em->bm, BM_VERTS_OF_MESH, i) {
if (BM_elem_flag_test(ve, flag)) {
- pb[i] = FALSE;
+ pb[i] = false;
sb[affected[0]].org_idx = i;
sb[affected[0]++].srt = len_squared_v3v3(cur, ve->co) * fact;
}
else {
- pb[i] = TRUE;
+ pb[i] = true;
}
}
}
@@ -4347,12 +4355,12 @@ static void sort_bmelem_flag(Scene *scene, Object *ob,
float co[3];
mid_v3_v3v3(co, ed->v1->co, ed->v2->co);
- pb[i] = FALSE;
+ pb[i] = false;
sb[affected[1]].org_idx = i;
sb[affected[1]++].srt = len_squared_v3v3(cur, co) * fact;
}
else {
- pb[i] = TRUE;
+ pb[i] = true;
}
}
}
@@ -4366,12 +4374,12 @@ static void sort_bmelem_flag(Scene *scene, Object *ob,
float co[3];
BM_face_calc_center_mean(fa, co);
- pb[i] = FALSE;
+ pb[i] = false;
sb[affected[2]].org_idx = i;
sb[affected[2]++].srt = len_squared_v3v3(cur, co) * fact;
}
else {
- pb[i] = TRUE;
+ pb[i] = true;
}
}
}
@@ -4387,14 +4395,14 @@ static void sort_bmelem_flag(Scene *scene, Object *ob,
/* Reverse materials' order, not order of faces inside each mat! */
/* Note: cannot use totcol, as mat_nr may sometimes be greater... */
float srt = reverse ? (float)(MAXMAT - fa->mat_nr) : (float)fa->mat_nr;
- pb[i] = FALSE;
+ pb[i] = false;
sb[affected[2]].org_idx = i;
/* Multiplying with totface and adding i ensures us we keep current order for all faces of same mat. */
sb[affected[2]++].srt = srt * ((float)totelem[2]) + ((float)i);
/* printf("e: %d; srt: %f; final: %f\n", i, srt, srt * ((float)totface) + ((float)i));*/
}
else {
- pb[i] = TRUE;
+ pb[i] = true;
}
}
}
@@ -4488,12 +4496,12 @@ static void sort_bmelem_flag(Scene *scene, Object *ob,
BM_ITER_MESH_INDEX (ve, &iter, em->bm, BM_VERTS_OF_MESH, i) {
if (BM_elem_flag_test(ve, flag)) {
- pb[i] = FALSE;
+ pb[i] = false;
sb[affected[0]].org_idx = i;
sb[affected[0]++].srt = BLI_frand();
}
else {
- pb[i] = TRUE;
+ pb[i] = true;
}
}
}
@@ -4505,12 +4513,12 @@ static void sort_bmelem_flag(Scene *scene, Object *ob,
BM_ITER_MESH_INDEX (ed, &iter, em->bm, BM_EDGES_OF_MESH, i) {
if (BM_elem_flag_test(ed, flag)) {
- pb[i] = FALSE;
+ pb[i] = false;
sb[affected[1]].org_idx = i;
sb[affected[1]++].srt = BLI_frand();
}
else {
- pb[i] = TRUE;
+ pb[i] = true;
}
}
}
@@ -4522,12 +4530,12 @@ static void sort_bmelem_flag(Scene *scene, Object *ob,
BM_ITER_MESH_INDEX (fa, &iter, em->bm, BM_FACES_OF_MESH, i) {
if (BM_elem_flag_test(fa, flag)) {
- pb[i] = FALSE;
+ pb[i] = false;
sb[affected[2]].org_idx = i;
sb[affected[2]++].srt = BLI_frand();
}
else {
- pb[i] = TRUE;
+ pb[i] = true;
}
}
}
@@ -4540,12 +4548,12 @@ static void sort_bmelem_flag(Scene *scene, Object *ob,
BM_ITER_MESH_INDEX (ve, &iter, em->bm, BM_VERTS_OF_MESH, i) {
if (BM_elem_flag_test(ve, flag)) {
- pb[i] = FALSE;
+ pb[i] = false;
sb[affected[0]].org_idx = i;
sb[affected[0]++].srt = (float)-i;
}
else {
- pb[i] = TRUE;
+ pb[i] = true;
}
}
}
@@ -4556,12 +4564,12 @@ static void sort_bmelem_flag(Scene *scene, Object *ob,
BM_ITER_MESH_INDEX (ed, &iter, em->bm, BM_EDGES_OF_MESH, i) {
if (BM_elem_flag_test(ed, flag)) {
- pb[i] = FALSE;
+ pb[i] = false;
sb[affected[1]].org_idx = i;
sb[affected[1]++].srt = (float)-i;
}
else {
- pb[i] = TRUE;
+ pb[i] = true;
}
}
}
@@ -4572,12 +4580,12 @@ static void sort_bmelem_flag(Scene *scene, Object *ob,
BM_ITER_MESH_INDEX (fa, &iter, em->bm, BM_FACES_OF_MESH, i) {
if (BM_elem_flag_test(fa, flag)) {
- pb[i] = FALSE;
+ pb[i] = false;
sb[affected[2]].org_idx = i;
sb[affected[2]++].srt = (float)-i;
}
else {
- pb[i] = TRUE;
+ pb[i] = true;
}
}
}
@@ -4647,9 +4655,9 @@ static int edbm_sort_elements_exec(bContext *C, wmOperator *op)
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d = ED_view3d_context_rv3d(C);
- int action = RNA_enum_get(op->ptr, "type");
+ const int action = RNA_enum_get(op->ptr, "type");
PropertyRNA *prop_elem_types = RNA_struct_find_property(op->ptr, "elements");
- int reverse = RNA_boolean_get(op->ptr, "reverse");
+ const bool use_reverse = RNA_boolean_get(op->ptr, "reverse");
unsigned int seed = RNA_int_get(op->ptr, "seed");
int elem_types = 0;
@@ -4676,32 +4684,32 @@ static int edbm_sort_elements_exec(bContext *C, wmOperator *op)
}
sort_bmelem_flag(scene, ob, v3d, rv3d,
- elem_types, BM_ELEM_SELECT, action, reverse, seed);
+ elem_types, BM_ELEM_SELECT, action, use_reverse, seed);
return OPERATOR_FINISHED;
}
-static int edbm_sort_elements_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop)
+static bool edbm_sort_elements_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop)
{
const char *prop_id = RNA_property_identifier(prop);
- int action = RNA_enum_get(ptr, "type");
+ const int action = RNA_enum_get(ptr, "type");
/* Only show seed for randomize action! */
if (STREQ(prop_id, "seed")) {
if (action == SRT_RANDOMIZE)
- return TRUE;
+ return true;
else
- return FALSE;
+ return false;
}
/* Hide seed for reverse and randomize actions! */
if (STREQ(prop_id, "reverse")) {
if (ELEM(action, SRT_RANDOMIZE, SRT_REVERSE))
- return FALSE;
+ return false;
else
- return TRUE;
+ return true;
}
- return TRUE;
+ return true;
}
static void edbm_sort_elements_ui(bContext *C, wmOperator *op)
@@ -4760,7 +4768,7 @@ void MESH_OT_sort_elements(wmOperatorType *ot)
ot->prop = RNA_def_enum(ot->srna, "type", type_items, 0, "Type", "Type of re-ordering operation to apply");
RNA_def_enum_flag(ot->srna, "elements", elem_items, 0, "Elements",
"Which elements to affect (vertices, edges and/or faces)");
- RNA_def_boolean(ot->srna, "reverse", FALSE, "Reverse", "Reverse the sorting effect");
+ RNA_def_boolean(ot->srna, "reverse", false, "Reverse", "Reverse the sorting effect");
RNA_def_int(ot->srna, "seed", 0, 0, INT_MAX, "Seed", "Seed for random-based operations", 0, 255);
}
@@ -4774,7 +4782,7 @@ static int edbm_noise_exec(bContext *C, wmOperator *op)
Tex *tex;
BMVert *eve;
BMIter iter;
- float fac = RNA_float_get(op->ptr, "factor");
+ const float fac = RNA_float_get(op->ptr, "factor");
if (em == NULL) {
return OPERATOR_FINISHED;
@@ -4814,7 +4822,7 @@ static int edbm_noise_exec(bContext *C, wmOperator *op)
EDBM_mesh_normals_update(em);
- EDBM_update_generic(em, TRUE, FALSE);
+ EDBM_update_generic(em, true, false);
return OPERATOR_FINISHED;
}
@@ -4899,13 +4907,13 @@ static int edbm_bevel_calc(wmOperator *op)
BevelData *opdata = op->customdata;
BMEditMesh *em = opdata->em;
BMOperator bmop;
- 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");
+ const float offset = RNA_float_get(op->ptr, "offset");
+ const int segments = RNA_int_get(op->ptr, "segments");
+ const bool vertex_only = RNA_boolean_get(op->ptr, "vertex_only");
/* revert to original mesh */
if (opdata->is_modal) {
- EDBM_redo_state_restore(opdata->mesh_backup, em, FALSE);
+ EDBM_redo_state_restore(opdata->mesh_backup, em, false);
}
if (!EDBM_op_init(em, &bmop, op,
@@ -4921,16 +4929,16 @@ static int edbm_bevel_calc(wmOperator *op)
/* not essential, but we may have some loose geometry that
* won't get bevel'd and better not leave it selected */
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
- BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, true);
}
/* no need to de-select existing geometry */
- if (!EDBM_op_finish(em, &bmop, op, TRUE))
+ if (!EDBM_op_finish(em, &bmop, op, true))
return 0;
EDBM_mesh_normals_update(opdata->em);
- EDBM_update_generic(opdata->em, TRUE, TRUE);
+ EDBM_update_generic(opdata->em, true, true);
return 1;
}
@@ -4946,7 +4954,7 @@ static void edbm_bevel_exit(bContext *C, wmOperator *op)
}
if (opdata->is_modal) {
- EDBM_redo_state_free(&opdata->mesh_backup, NULL, FALSE);
+ EDBM_redo_state_free(&opdata->mesh_backup, NULL, false);
}
MEM_freeN(opdata);
op->customdata = NULL;
@@ -4956,8 +4964,8 @@ static int edbm_bevel_cancel(bContext *C, wmOperator *op)
{
BevelData *opdata = op->customdata;
if (opdata->is_modal) {
- EDBM_redo_state_free(&opdata->mesh_backup, opdata->em, TRUE);
- EDBM_update_generic(opdata->em, FALSE, TRUE);
+ EDBM_redo_state_free(&opdata->mesh_backup, opdata->em, true);
+ EDBM_update_generic(opdata->em, false, true);
}
edbm_bevel_exit(C, op);
@@ -4970,7 +4978,7 @@ static int edbm_bevel_cancel(bContext *C, wmOperator *op)
/* bevel! yay!!*/
static int edbm_bevel_exec(bContext *C, wmOperator *op)
{
- if (!edbm_bevel_init(C, op, FALSE)) {
+ if (!edbm_bevel_init(C, op, false)) {
edbm_bevel_exit(C, op);
return OPERATOR_CANCELLED;
}
@@ -4993,7 +5001,7 @@ static int edbm_bevel_invoke(bContext *C, wmOperator *op, const wmEvent *event)
float mlen[2];
float center_3d[3];
- if (!edbm_bevel_init(C, op, TRUE)) {
+ if (!edbm_bevel_init(C, op, true)) {
return OPERATOR_CANCELLED;
}
@@ -5025,7 +5033,7 @@ static int edbm_bevel_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static float edbm_bevel_mval_factor(wmOperator *op, const wmEvent *event)
{
BevelData *opdata = op->customdata;
- int use_dist = TRUE;
+ int use_dist = true;
float mdiff[2];
float factor;
@@ -5147,7 +5155,7 @@ void MESH_OT_bevel(wmOperatorType *ot)
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");
+ RNA_def_boolean(ot->srna, "vertex_only", false, "Vertex only", "Bevel only vertices");
}
static int edbm_bridge_edge_loops_exec(bContext *C, wmOperator *op)
@@ -5155,7 +5163,7 @@ static int edbm_bridge_edge_loops_exec(bContext *C, wmOperator *op)
BMOperator bmop;
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
- const int use_merge = RNA_boolean_get(op->ptr, "use_merge");
+ const bool use_merge = RNA_boolean_get(op->ptr, "use_merge");
const float merge_factor = RNA_float_get(op->ptr, "merge_factor");
EDBM_op_init(em, &bmop, op,
@@ -5165,17 +5173,17 @@ static int edbm_bridge_edge_loops_exec(bContext *C, wmOperator *op)
BMO_op_exec(em->bm, &bmop);
/* when merge is used the edges are joined and remain selected */
- if (use_merge == FALSE) {
+ if (use_merge == false) {
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
- BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, true);
}
- if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ if (!EDBM_op_finish(em, &bmop, op, true)) {
return OPERATOR_CANCELLED;
}
else {
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
return OPERATOR_FINISHED;
}
}
@@ -5196,7 +5204,7 @@ void MESH_OT_bridge_edge_loops(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "inside", 0, "Inside", "");
- RNA_def_boolean(ot->srna, "use_merge", FALSE, "Merge", "Merge rather than creating faces");
+ RNA_def_boolean(ot->srna, "use_merge", false, "Merge", "Merge rather than creating faces");
RNA_def_float(ot->srna, "merge_factor", 0.5f, 0.0f, 1.0f, "Merge Factor", "", 0.0f, 1.0f);
}
@@ -5256,8 +5264,8 @@ static int edbm_inset_init(bContext *C, wmOperator *op, int is_modal)
opdata->old_thickness = 0.01;
opdata->old_depth = 0.0;
- opdata->modify_depth = FALSE;
- opdata->shift = FALSE;
+ opdata->modify_depth = false;
+ opdata->shift = false;
opdata->shift_amount = 0.0f;
opdata->is_modal = is_modal;
opdata->em = em;
@@ -5279,7 +5287,7 @@ static void edbm_inset_exit(bContext *C, wmOperator *op)
opdata = op->customdata;
if (opdata->is_modal)
- EDBM_redo_state_free(&opdata->backup, NULL, FALSE);
+ EDBM_redo_state_free(&opdata->backup, NULL, false);
if (sa) {
ED_area_headerprint(sa, NULL);
@@ -5293,8 +5301,8 @@ static int edbm_inset_cancel(bContext *C, wmOperator *op)
opdata = op->customdata;
if (opdata->is_modal) {
- EDBM_redo_state_free(&opdata->backup, opdata->em, TRUE);
- EDBM_update_generic(opdata->em, FALSE, TRUE);
+ EDBM_redo_state_free(&opdata->backup, opdata->em, true);
+ EDBM_update_generic(opdata->em, false, true);
}
edbm_inset_exit(C, op);
@@ -5310,19 +5318,19 @@ static int edbm_inset_calc(wmOperator *op)
BMEditMesh *em;
BMOperator bmop;
- int use_boundary = RNA_boolean_get(op->ptr, "use_boundary");
- int use_even_offset = RNA_boolean_get(op->ptr, "use_even_offset");
- int use_relative_offset = RNA_boolean_get(op->ptr, "use_relative_offset");
- float thickness = RNA_float_get(op->ptr, "thickness");
- float depth = RNA_float_get(op->ptr, "depth");
- int use_outset = RNA_boolean_get(op->ptr, "use_outset");
- int use_select_inset = RNA_boolean_get(op->ptr, "use_select_inset"); /* not passed onto the BMO */
+ const bool use_boundary = RNA_boolean_get(op->ptr, "use_boundary");
+ const bool use_even_offset = RNA_boolean_get(op->ptr, "use_even_offset");
+ const bool use_relative_offset = RNA_boolean_get(op->ptr, "use_relative_offset");
+ const float thickness = RNA_float_get(op->ptr, "thickness");
+ const float depth = RNA_float_get(op->ptr, "depth");
+ const bool use_outset = RNA_boolean_get(op->ptr, "use_outset");
+ const bool use_select_inset = RNA_boolean_get(op->ptr, "use_select_inset"); /* not passed onto the BMO */
opdata = op->customdata;
em = opdata->em;
if (opdata->is_modal) {
- EDBM_redo_state_restore(opdata->backup, em, FALSE);
+ EDBM_redo_state_restore(opdata->backup, em, false);
}
EDBM_op_init(em, &bmop, op,
@@ -5336,27 +5344,27 @@ static int edbm_inset_calc(wmOperator *op)
if (use_select_inset) {
/* deselect original faces/verts */
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
- BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, true);
}
else {
- BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE, BM_ELEM_SELECT, FALSE);
- BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, FALSE);
+ BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE, BM_ELEM_SELECT, false);
+ BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, false);
/* re-select faces so the verts and edges get selected too */
- BM_mesh_elem_hflag_enable_test(em->bm, BM_FACE, BM_ELEM_SELECT, TRUE, BM_ELEM_SELECT);
+ BM_mesh_elem_hflag_enable_test(em->bm, BM_FACE, BM_ELEM_SELECT, true, BM_ELEM_SELECT);
}
- if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ if (!EDBM_op_finish(em, &bmop, op, true)) {
return 0;
}
else {
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
return 1;
}
}
static int edbm_inset_exec(bContext *C, wmOperator *op)
{
- edbm_inset_init(C, op, FALSE);
+ edbm_inset_init(C, op, false);
if (!edbm_inset_calc(op)) {
edbm_inset_exit(C, op);
@@ -5374,7 +5382,7 @@ static int edbm_inset_invoke(bContext *C, wmOperator *op, const wmEvent *event)
float mlen[2];
float center_3d[3];
- edbm_inset_init(C, op, TRUE);
+ edbm_inset_init(C, op, true);
opdata = op->customdata;
@@ -5476,11 +5484,11 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, const wmEvent *event)
opdata->shift_amount = RNA_float_get(op->ptr, "depth");
else
opdata->shift_amount = RNA_float_get(op->ptr, "thickness");
- opdata->shift = TRUE;
+ opdata->shift = true;
}
else {
opdata->shift_amount = 0.0f;
- opdata->shift = FALSE;
+ opdata->shift = false;
}
break;
@@ -5496,13 +5504,13 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, const wmEvent *event)
opdata->old_thickness = RNA_float_get(op->ptr, "thickness");
if (opdata->shift)
opdata->shift_amount = opdata->old_thickness;
- opdata->modify_depth = TRUE;
+ opdata->modify_depth = true;
}
else {
opdata->old_depth = RNA_float_get(op->ptr, "depth");
if (opdata->shift)
opdata->shift_amount = opdata->old_depth;
- opdata->modify_depth = FALSE;
+ opdata->modify_depth = false;
}
opdata->initial_length = len_v2(mlen);
@@ -5512,7 +5520,7 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, const wmEvent *event)
case OKEY:
if (event->val == KM_PRESS) {
- int use_outset = RNA_boolean_get(op->ptr, "use_outset");
+ const bool use_outset = RNA_boolean_get(op->ptr, "use_outset");
RNA_boolean_set(op->ptr, "use_outset", !use_outset);
if (edbm_inset_calc(op)) {
edbm_inset_update_header(op, C);
@@ -5525,7 +5533,7 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, const wmEvent *event)
break;
case BKEY:
if (event->val == KM_PRESS) {
- int use_boundary = RNA_boolean_get(op->ptr, "use_boundary");
+ const bool use_boundary = RNA_boolean_get(op->ptr, "use_boundary");
RNA_boolean_set(op->ptr, "use_boundary", !use_boundary);
if (edbm_inset_calc(op)) {
edbm_inset_update_header(op, C);
@@ -5562,9 +5570,9 @@ void MESH_OT_inset(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_GRAB_POINTER | OPTYPE_BLOCKING;
/* properties */
- RNA_def_boolean(ot->srna, "use_boundary", TRUE, "Boundary", "Inset face boundaries");
- RNA_def_boolean(ot->srna, "use_even_offset", TRUE, "Offset Even", "Scale the offset to give more even thickness");
- RNA_def_boolean(ot->srna, "use_relative_offset", FALSE, "Offset Relative", "Scale the offset by surrounding geometry");
+ RNA_def_boolean(ot->srna, "use_boundary", true, "Boundary", "Inset face boundaries");
+ RNA_def_boolean(ot->srna, "use_even_offset", true, "Offset Even", "Scale the offset to give more even thickness");
+ RNA_def_boolean(ot->srna, "use_relative_offset", false, "Offset Relative", "Scale the offset by surrounding geometry");
prop = RNA_def_float(ot->srna, "thickness", 0.01f, 0.0f, FLT_MAX, "Thickness", "", 0.0f, 10.0f);
/* use 1 rather then 10 for max else dragging the button moves too far */
@@ -5572,8 +5580,8 @@ void MESH_OT_inset(wmOperatorType *ot)
prop = RNA_def_float(ot->srna, "depth", 0.0f, -FLT_MAX, FLT_MAX, "Depth", "", -10.0f, 10.0f);
RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.01, 4);
- RNA_def_boolean(ot->srna, "use_outset", FALSE, "Outset", "Outset rather than inset");
- RNA_def_boolean(ot->srna, "use_select_inset", TRUE, "Select Outer", "Select the new inset faces");
+ RNA_def_boolean(ot->srna, "use_outset", false, "Outset", "Outset rather than inset");
+ RNA_def_boolean(ot->srna, "use_select_inset", true, "Select Outer", "Select the new inset faces");
}
static int edbm_wireframe_exec(bContext *C, wmOperator *op)
@@ -5581,12 +5589,12 @@ static int edbm_wireframe_exec(bContext *C, wmOperator *op)
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
BMOperator bmop;
- const int use_boundary = RNA_boolean_get(op->ptr, "use_boundary");
- const int use_even_offset = RNA_boolean_get(op->ptr, "use_even_offset");
- const int use_replace = RNA_boolean_get(op->ptr, "use_replace");
- const int use_relative_offset = RNA_boolean_get(op->ptr, "use_relative_offset");
- const int use_crease = RNA_boolean_get(op->ptr, "use_crease");
- const float thickness = RNA_float_get(op->ptr, "thickness");
+ const bool use_boundary = RNA_boolean_get(op->ptr, "use_boundary");
+ const bool use_even_offset = RNA_boolean_get(op->ptr, "use_even_offset");
+ const bool use_replace = RNA_boolean_get(op->ptr, "use_replace");
+ const bool use_relative_offset = RNA_boolean_get(op->ptr, "use_relative_offset");
+ const bool use_crease = RNA_boolean_get(op->ptr, "use_crease");
+ const float thickness = RNA_float_get(op->ptr, "thickness");
EDBM_op_init(em, &bmop, op,
"wireframe faces=%hf use_boundary=%b use_even_offset=%b use_relative_offset=%b use_crease=%b "
@@ -5597,22 +5605,22 @@ static int edbm_wireframe_exec(bContext *C, wmOperator *op)
BMO_op_exec(em->bm, &bmop);
if (use_replace) {
- BM_mesh_elem_hflag_disable_all(em->bm, BM_FACE, BM_ELEM_TAG, FALSE);
- BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_in, "faces", BM_FACE, BM_ELEM_TAG, FALSE);
+ BM_mesh_elem_hflag_disable_all(em->bm, BM_FACE, BM_ELEM_TAG, false);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_in, "faces", BM_FACE, BM_ELEM_TAG, false);
BMO_op_callf(em->bm, BMO_FLAG_DEFAULTS,
"delete geom=%hvef context=%i",
BM_ELEM_TAG, DEL_FACES);
}
- BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, FALSE);
- BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, TRUE);
+ BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, false);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, true);
- if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ if (!EDBM_op_finish(em, &bmop, op, true)) {
return OPERATOR_CANCELLED;
}
else {
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
return OPERATOR_FINISHED;
}
}
@@ -5634,17 +5642,17 @@ void MESH_OT_wireframe(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- RNA_def_boolean(ot->srna, "use_boundary", TRUE, "Boundary", "Inset face boundaries");
- RNA_def_boolean(ot->srna, "use_even_offset", TRUE, "Offset Even", "Scale the offset to give more even thickness");
- RNA_def_boolean(ot->srna, "use_relative_offset", FALSE, "Offset Relative", "Scale the offset by surrounding geometry");
- RNA_def_boolean(ot->srna, "use_crease", FALSE, "Crease", "Crease hub edges for improved subsurf");
+ RNA_def_boolean(ot->srna, "use_boundary", true, "Boundary", "Inset face boundaries");
+ RNA_def_boolean(ot->srna, "use_even_offset", true, "Offset Even", "Scale the offset to give more even thickness");
+ RNA_def_boolean(ot->srna, "use_relative_offset", false, "Offset Relative", "Scale the offset by surrounding geometry");
+ RNA_def_boolean(ot->srna, "use_crease", false, "Crease", "Crease hub edges for improved subsurf");
prop = RNA_def_float(ot->srna, "thickness", 0.01f, 0.0f, FLT_MAX, "Thickness", "", 0.0f, 10.0f);
/* use 1 rather then 10 for max else dragging the button moves too far */
RNA_def_property_ui_range(prop, 0.0, 1.0, 0.01, 4);
- RNA_def_boolean(ot->srna, "use_replace", TRUE, "Replace", "Remove original faces");
+ RNA_def_boolean(ot->srna, "use_replace", true, "Replace", "Remove original faces");
}
#ifdef WITH_BULLET
@@ -5662,7 +5670,7 @@ static int edbm_convex_hull_exec(bContext *C, wmOperator *op)
/* Hull fails if input is coplanar */
if (BMO_error_occurred(em->bm)) {
- EDBM_op_finish(em, &bmop, op, TRUE);
+ EDBM_op_finish(em, &bmop, op, true);
return OPERATOR_CANCELLED;
}
@@ -5672,7 +5680,7 @@ static int edbm_convex_hull_exec(bContext *C, wmOperator *op)
if (!EDBM_op_callf(em, op, "delete geom=%S context=%i",
&bmop, "geom_unused.out", DEL_ONLYTAGGED))
{
- EDBM_op_finish(em, &bmop, op, TRUE);
+ EDBM_op_finish(em, &bmop, op, true);
return OPERATOR_CANCELLED;
}
}
@@ -5682,7 +5690,7 @@ static int edbm_convex_hull_exec(bContext *C, wmOperator *op)
if (!EDBM_op_callf(em, op, "delete geom=%S context=%i",
&bmop, "geom_holes.out", DEL_ONLYTAGGED))
{
- EDBM_op_finish(em, &bmop, op, TRUE);
+ EDBM_op_finish(em, &bmop, op, true);
return OPERATOR_CANCELLED;
}
}
@@ -5693,16 +5701,16 @@ static int edbm_convex_hull_exec(bContext *C, wmOperator *op)
&bmop, "geom.out",
RNA_float_get(op->ptr, "limit")))
{
- EDBM_op_finish(em, &bmop, op, TRUE);
+ EDBM_op_finish(em, &bmop, op, true);
return OPERATOR_CANCELLED;
}
}
- if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ if (!EDBM_op_finish(em, &bmop, op, true)) {
return OPERATOR_CANCELLED;
}
else {
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
EDBM_selectmode_flush(em);
return OPERATOR_FINISHED;
}
@@ -5723,19 +5731,19 @@ void MESH_OT_convex_hull(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* props */
- RNA_def_boolean(ot->srna, "delete_unused", TRUE,
+ RNA_def_boolean(ot->srna, "delete_unused", true,
"Delete Unused",
"Delete selected elements that are not used by the hull");
- RNA_def_boolean(ot->srna, "use_existing_faces", TRUE,
+ RNA_def_boolean(ot->srna, "use_existing_faces", true,
"Use Existing Faces",
"Skip hull triangles that are covered by a pre-existing face");
- RNA_def_boolean(ot->srna, "make_holes", FALSE,
+ RNA_def_boolean(ot->srna, "make_holes", false,
"Make Holes",
"Delete selected faces that are used by the hull");
- RNA_def_boolean(ot->srna, "join_triangles", TRUE,
+ RNA_def_boolean(ot->srna, "join_triangles", true,
"Join Triangles",
"Merge adjacent triangles into quads");
@@ -5753,11 +5761,11 @@ static int mesh_symmetrize_exec(bContext *C, wmOperator *op)
BM_ELEM_SELECT, RNA_enum_get(op->ptr, "direction"));
BMO_op_exec(em->bm, &bmop);
- if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ if (!EDBM_op_finish(em, &bmop, op, true)) {
return OPERATOR_CANCELLED;
}
else {
- EDBM_update_generic(em, TRUE, TRUE);
+ EDBM_update_generic(em, true, true);
EDBM_selectmode_flush(em);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c
index fd90246f791..cb15fdef880 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -114,7 +114,7 @@ void EDBM_mesh_ensure_valid_dm_hack(Scene *scene, BMEditMesh *em)
void EDBM_mesh_normals_update(BMEditMesh *em)
{
- BM_mesh_normals_update(em->bm, TRUE);
+ BM_mesh_normals_update(em->bm, true);
}
void EDBM_mesh_clear(BMEditMesh *em)
@@ -169,7 +169,7 @@ void EDBM_stats_update(BMEditMesh *em)
}
}
-int EDBM_op_init(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const char *fmt, ...)
+bool EDBM_op_init(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const char *fmt, ...)
{
BMesh *bm = em->bm;
va_list list;
@@ -179,7 +179,7 @@ int EDBM_op_init(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const char *f
if (!BMO_op_vinitf(bm, bmop, BMO_FLAG_DEFAULTS, fmt, list)) {
BKE_reportf(op->reports, RPT_ERROR, "Parse error in %s", __func__);
va_end(list);
- return 0;
+ return false;
}
if (!em->emcopy)
@@ -188,12 +188,12 @@ int EDBM_op_init(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const char *f
va_end(list);
- return 1;
+ return true;
}
/* returns 0 on error, 1 on success. executes and finishes a bmesh operator */
-int EDBM_op_finish(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const int report)
+bool EDBM_op_finish(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const bool do_report)
{
const char *errmsg;
@@ -202,7 +202,7 @@ int EDBM_op_finish(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const int r
if (BMO_error_get(em->bm, &errmsg, NULL)) {
BMEditMesh *emcopy = em->emcopy;
- if (report) {
+ if (do_report) {
BKE_report(op->reports, RPT_ERROR, errmsg);
}
@@ -219,7 +219,7 @@ int EDBM_op_finish(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const int r
BMEdit_RecalcTessellation(em);
}
- return FALSE;
+ return false;
}
else {
em->emcopyusers--;
@@ -233,11 +233,11 @@ int EDBM_op_finish(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const int r
em->emcopy = NULL;
}
- return TRUE;
+ return true;
}
}
-int EDBM_op_callf(BMEditMesh *em, wmOperator *op, const char *fmt, ...)
+bool EDBM_op_callf(BMEditMesh *em, wmOperator *op, const char *fmt, ...)
{
BMesh *bm = em->bm;
BMOperator bmop;
@@ -248,7 +248,7 @@ int EDBM_op_callf(BMEditMesh *em, wmOperator *op, const char *fmt, ...)
if (!BMO_op_vinitf(bm, &bmop, BMO_FLAG_DEFAULTS, fmt, list)) {
BKE_reportf(op->reports, RPT_ERROR, "Parse error in %s", __func__);
va_end(list);
- return 0;
+ return false;
}
if (!em->emcopy)
@@ -258,10 +258,10 @@ int EDBM_op_callf(BMEditMesh *em, wmOperator *op, const char *fmt, ...)
BMO_op_exec(bm, &bmop);
va_end(list);
- return EDBM_op_finish(em, &bmop, op, TRUE);
+ return EDBM_op_finish(em, &bmop, op, true);
}
-int EDBM_op_call_and_selectf(BMEditMesh *em, wmOperator *op, const char *select_slot_out, const char *fmt, ...)
+bool EDBM_op_call_and_selectf(BMEditMesh *em, wmOperator *op, const char *select_slot_out, const char *fmt, ...)
{
BMOpSlot *slot_select_out;
BMesh *bm = em->bm;
@@ -274,7 +274,7 @@ int EDBM_op_call_and_selectf(BMEditMesh *em, wmOperator *op, const char *select_
if (!BMO_op_vinitf(bm, &bmop, BMO_FLAG_DEFAULTS, fmt, list)) {
BKE_reportf(op->reports, RPT_ERROR, "Parse error in %s", __func__);
va_end(list);
- return 0;
+ return false;
}
if (!em->emcopy)
@@ -286,15 +286,15 @@ int EDBM_op_call_and_selectf(BMEditMesh *em, wmOperator *op, const char *select_
slot_select_out = BMO_slot_get(bmop.slots_out, select_slot_out);
hflag = slot_select_out->slot_subtype.elem & BM_ALL_NOLOOP;
- BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, FALSE);
+ BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, false);
- BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, select_slot_out, hflag, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, select_slot_out, hflag, BM_ELEM_SELECT, true);
va_end(list);
- return EDBM_op_finish(em, &bmop, op, TRUE);
+ return EDBM_op_finish(em, &bmop, op, true);
}
-int EDBM_op_call_silentf(BMEditMesh *em, const char *fmt, ...)
+bool EDBM_op_call_silentf(BMEditMesh *em, const char *fmt, ...)
{
BMesh *bm = em->bm;
BMOperator bmop;
@@ -304,7 +304,7 @@ int EDBM_op_call_silentf(BMEditMesh *em, const char *fmt, ...)
if (!BMO_op_vinitf(bm, &bmop, BMO_FLAG_DEFAULTS, fmt, list)) {
va_end(list);
- return 0;
+ return false;
}
if (!em->emcopy)
@@ -314,7 +314,7 @@ int EDBM_op_call_silentf(BMEditMesh *em, const char *fmt, ...)
BMO_op_exec(bm, &bmop);
va_end(list);
- return EDBM_op_finish(em, &bmop, NULL, FALSE);
+ return EDBM_op_finish(em, &bmop, NULL, false);
}
void EDBM_selectmode_to_scene(bContext *C)
@@ -352,9 +352,9 @@ void EDBM_mesh_make(ToolSettings *ts, Scene *UNUSED(scene), Object *ob)
/* currently executing operators re-tessellates, so we can avoid doing here
* but at some point it may need to be added back. */
#if 0
- me->edit_btmesh = BMEdit_Create(bm, TRUE);
+ me->edit_btmesh = BMEdit_Create(bm, true);
#else
- me->edit_btmesh = BMEdit_Create(bm, FALSE);
+ me->edit_btmesh = BMEdit_Create(bm, false);
#endif
me->edit_btmesh->selectmode = me->edit_btmesh->bm->selectmode = ts->selectmode;
@@ -368,7 +368,7 @@ void EDBM_mesh_load(Object *ob)
Mesh *me = ob->data;
BMesh *bm = me->edit_btmesh->bm;
- BM_mesh_bm_to_me(bm, me, FALSE);
+ BM_mesh_bm_to_me(bm, me, false);
#ifdef USE_TESSFACE_DEFAULT
BKE_mesh_tessface_calc(me);
@@ -400,7 +400,7 @@ void EDBM_index_arrays_ensure(BMEditMesh *em, const char htype)
BLI_assert((htype & ~BM_ALL_NOLOOP) == 0);
/* in debug mode double check we didn't need to recalculate */
- BLI_assert(EDBM_index_arrays_check(em) == TRUE);
+ BLI_assert(EDBM_index_arrays_check(em) == true);
if (htype_needed & BM_VERT) {
em->vert_index = MEM_mallocN(sizeof(void **) * em->bm->totvert, "em->vert_index");
@@ -465,7 +465,7 @@ void EDBM_index_arrays_free(BMEditMesh *em)
/* debug check only - no need to optimize */
#ifndef NDEBUG
-int EDBM_index_arrays_check(BMEditMesh *em)
+bool EDBM_index_arrays_check(BMEditMesh *em)
{
BMIter iter;
BMElem *ele;
@@ -474,7 +474,7 @@ int EDBM_index_arrays_check(BMEditMesh *em)
if (em->vert_index) {
BM_ITER_MESH_INDEX (ele, &iter, em->bm, BM_VERTS_OF_MESH, i) {
if (ele != (BMElem *)em->vert_index[i]) {
- return FALSE;
+ return false;
}
}
}
@@ -482,7 +482,7 @@ int EDBM_index_arrays_check(BMEditMesh *em)
if (em->edge_index) {
BM_ITER_MESH_INDEX (ele, &iter, em->bm, BM_EDGES_OF_MESH, i) {
if (ele != (BMElem *)em->edge_index[i]) {
- return FALSE;
+ return false;
}
}
}
@@ -490,12 +490,12 @@ int EDBM_index_arrays_check(BMEditMesh *em)
if (em->face_index) {
BM_ITER_MESH_INDEX (ele, &iter, em->bm, BM_FACES_OF_MESH, i) {
if (ele != (BMElem *)em->face_index[i]) {
- return FALSE;
+ return false;
}
}
}
- return TRUE;
+ return true;
}
#endif
@@ -546,10 +546,10 @@ void EDBM_select_more(BMEditMesh *em)
BMO_op_initf(em->bm, &bmop, BMO_FLAG_DEFAULTS,
"region_extend geom=%hvef use_constrict=%b use_faces=%b",
- BM_ELEM_SELECT, FALSE, use_faces);
+ BM_ELEM_SELECT, false, use_faces);
BMO_op_exec(em->bm, &bmop);
/* don't flush selection in edge/vertex mode */
- BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "geom.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, use_faces ? TRUE : FALSE);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "geom.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, use_faces ? true : false);
BMO_op_finish(em->bm, &bmop);
EDBM_selectmode_flush(em);
@@ -562,10 +562,10 @@ void EDBM_select_less(BMEditMesh *em)
BMO_op_initf(em->bm, &bmop, BMO_FLAG_DEFAULTS,
"region_extend geom=%hvef use_constrict=%b use_faces=%b",
- BM_ELEM_SELECT, TRUE, use_faces);
+ BM_ELEM_SELECT, true, use_faces);
BMO_op_exec(em->bm, &bmop);
/* don't flush selection in edge/vertex mode */
- BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_out, "geom.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, use_faces ? TRUE : FALSE);
+ BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_out, "geom.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, use_faces ? true : false);
BMO_op_finish(em->bm, &bmop);
EDBM_selectmode_flush(em);
@@ -573,12 +573,12 @@ void EDBM_select_less(BMEditMesh *em)
void EDBM_flag_disable_all(BMEditMesh *em, const char hflag)
{
- BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, hflag, FALSE);
+ BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, hflag, false);
}
void EDBM_flag_enable_all(BMEditMesh *em, const char hflag)
{
- BM_mesh_elem_hflag_enable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, hflag, TRUE);
+ BM_mesh_elem_hflag_enable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, hflag, true);
}
/**************-------------- Undo ------------*****************/
@@ -623,7 +623,7 @@ static void *editbtMesh_to_undoMesh(void *emv, void *obdata)
/* BM_mesh_validate(em->bm); */ /* for troubleshooting */
- BM_mesh_bm_to_me(em->bm, &um->me, FALSE);
+ BM_mesh_bm_to_me(em->bm, &um->me, false);
um->selectmode = em->selectmode;
um->shapenr = em->bm->shapenr;
@@ -644,12 +644,12 @@ static void undoMesh_to_editbtMesh(void *umv, void *em_v, void *UNUSED(obdata))
bm = BM_mesh_create(&bm_mesh_allocsize_default);
- BM_mesh_bm_from_me(bm, &um->me, FALSE, ob->shapenr);
+ BM_mesh_bm_from_me(bm, &um->me, false, ob->shapenr);
/* face normals need recalculation since we are not calling through an operator */
- BM_mesh_normals_update(bm, TRUE);
+ BM_mesh_normals_update(bm, true);
- em_tmp = BMEdit_Create(bm, TRUE);
+ em_tmp = BMEdit_Create(bm, true);
*em = *em_tmp;
em->selectmode = um->selectmode;
@@ -667,7 +667,7 @@ static void free_undo(void *me_v)
MEM_freeN(me->key);
}
- BKE_mesh_free(me, FALSE);
+ BKE_mesh_free(me, false);
MEM_freeN(me);
}
@@ -1133,7 +1133,7 @@ static BMVert *cache_mirr_intptr_as_bmvert(intptr_t *index_lookup, int index)
* preference */
#define BM_SEARCH_MAXDIST_MIRR 0.00002f
#define BM_CD_LAYER_ID "__mirror_index"
-void EDBM_verts_mirror_cache_begin(BMEditMesh *em, const short use_select)
+void EDBM_verts_mirror_cache_begin(BMEditMesh *em, const bool use_select)
{
Mesh *me = (Mesh *)em->ob->data;
BMesh *bm = em->bm;
@@ -1162,7 +1162,7 @@ void EDBM_verts_mirror_cache_begin(BMEditMesh *em, const short use_select)
BM_mesh_elem_index_ensure(bm, BM_VERT);
if (topo) {
- ED_mesh_mirrtopo_init(me, -1, &mesh_topo_store, TRUE);
+ ED_mesh_mirrtopo_init(me, -1, &mesh_topo_store, true);
}
else {
tree = BMBVH_NewBVH(em, 0, NULL, NULL);
@@ -1283,7 +1283,7 @@ void EDBM_mesh_hide(BMEditMesh *em, int swap)
BM_ITER_MESH (ele, &iter, em->bm, itermode) {
if (BM_elem_flag_test(ele, BM_ELEM_SELECT) ^ swap)
- BM_elem_hide_set(em->bm, ele, TRUE);
+ BM_elem_hide_set(em->bm, ele, true);
}
EDBM_selectmode_flush(em);
@@ -1335,7 +1335,7 @@ void EDBM_mesh_reveal(BMEditMesh *em)
BM_ITER_MESH (ele, &iter, em->bm, iter_types[i]) {
if (BM_elem_flag_test(ele, BM_ELEM_TAG)) {
- BM_elem_select_set(em->bm, ele, TRUE);
+ BM_elem_select_set(em->bm, ele, true);
}
}
}
@@ -1364,6 +1364,6 @@ void EDBM_update_generic(BMEditMesh *em, const bool do_tessface, const bool is_d
}
else {
/* in debug mode double check we didn't need to recalculate */
- BLI_assert(EDBM_index_arrays_check(em) == TRUE);
+ BLI_assert(EDBM_index_arrays_check(em) == true);
}
}
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index 68e93fa22f7..20633aa0c87 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -123,9 +123,8 @@ static CustomData *mesh_customdata_get_type(Mesh *me, const char htype, int *r_t
}
#define GET_CD_DATA(me, data) (me->edit_btmesh ? &me->edit_btmesh->bm->data : &me->data)
-static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *layer)
+static void delete_customdata_layer(Mesh *me, CustomDataLayer *layer)
{
- Mesh *me = ob->data;
CustomData *data;
void *actlayerdata, *rndlayerdata, *clonelayerdata, *stencillayerdata, *layerdata = layer->data;
int type = layer->type;
@@ -162,9 +161,6 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la
BKE_mesh_update_customdata_pointers(me, true);
}
- if (!CustomData_has_layer(data, type) && (type == CD_MLOOPCOL && (ob->mode & OB_MODE_VERTEX_PAINT)))
- ED_object_toggle_modes(C, OB_MODE_VERTEX_PAINT);
-
/* reconstruct active layer */
if (actlayerdata != layerdata) {
/* find index */
@@ -344,12 +340,12 @@ int ED_mesh_uv_loop_reset(struct bContext *C, struct Mesh *me)
}
/* note: keep in sync with ED_mesh_color_add */
-int ED_mesh_uv_texture_add(bContext *C, Mesh *me, const char *name, int active_set)
+int ED_mesh_uv_texture_add(Mesh *me, const char *name, const bool active_set)
{
BMEditMesh *em;
int layernum_dst;
- short is_init = FALSE;
+ bool is_init = false;
if (me->edit_btmesh) {
em = me->edit_btmesh;
@@ -376,7 +372,7 @@ int ED_mesh_uv_texture_add(bContext *C, Mesh *me, const char *name, int active_s
const int layernum_src = CustomData_get_active_layer(&em->bm->ldata, CD_MLOOPUV);
BM_data_layer_copy(em->bm, &em->bm->ldata, CD_MLOOPUV, layernum_src, layernum_dst);
- is_init = TRUE;
+ is_init = true;
}
if (active_set || layernum_dst == 0) {
CustomData_set_layer_active(&em->bm->ldata, CD_MLOOPUV, layernum_dst);
@@ -391,7 +387,7 @@ int ED_mesh_uv_texture_add(bContext *C, Mesh *me, const char *name, int active_s
CustomData_add_layer_named(&me->pdata, CD_MTEXPOLY, CD_DUPLICATE, me->mtpoly, me->totpoly, name);
CustomData_add_layer_named(&me->ldata, CD_MLOOPUV, CD_DUPLICATE, me->mloopuv, me->totloop, name);
CustomData_add_layer_named(&me->fdata, CD_MTFACE, CD_DUPLICATE, me->mtface, me->totface, name);
- is_init = TRUE;
+ is_init = true;
}
else {
CustomData_add_layer_named(&me->pdata, CD_MTEXPOLY, CD_DEFAULT, NULL, me->totpoly, name);
@@ -410,42 +406,73 @@ int ED_mesh_uv_texture_add(bContext *C, Mesh *me, const char *name, int active_s
}
/* don't overwrite our copied coords */
- if (is_init == FALSE) {
+ if (is_init == false) {
ED_mesh_uv_loop_reset_ex(me, layernum_dst);
}
DAG_id_tag_update(&me->id, 0);
- WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, me);
return layernum_dst;
}
-int ED_mesh_uv_texture_remove(bContext *C, Object *ob, Mesh *me)
+bool ED_mesh_uv_texture_remove_index(Mesh *me, const int n)
{
CustomData *pdata = GET_CD_DATA(me, pdata), *ldata = GET_CD_DATA(me, ldata);
CustomDataLayer *cdlp, *cdlu;
int index;
- index = CustomData_get_active_layer_index(pdata, CD_MTEXPOLY);
+ index = CustomData_get_layer_index_n(pdata, CD_MTEXPOLY, n);
cdlp = (index == -1) ? NULL : &pdata->layers[index];
- index = CustomData_get_active_layer_index(ldata, CD_MLOOPUV);
+ index = CustomData_get_layer_index_n(ldata, CD_MLOOPUV, n);
cdlu = (index == -1) ? NULL : &ldata->layers[index];
-
+
if (!cdlp || !cdlu)
- return 0;
+ return false;
+
+ delete_customdata_layer(me, cdlp);
+ delete_customdata_layer(me, cdlu);
- delete_customdata_layer(C, ob, cdlp);
- delete_customdata_layer(C, ob, cdlu);
-
DAG_id_tag_update(&me->id, 0);
- WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, me);
- return 1;
+ return true;
+}
+bool ED_mesh_uv_texture_remove_active(Mesh *me)
+{
+ /* texpoly/uv are assumed to be in sync */
+ CustomData *pdata = GET_CD_DATA(me, pdata);
+ const int n = CustomData_get_active_layer(pdata, CD_MTEXPOLY);
+
+ /* double check active layers align! */
+#ifdef DEBUG
+ CustomData *ldata = GET_CD_DATA(me, ldata);
+ BLI_assert(CustomData_get_active_layer(ldata, CD_MLOOPUV) == n);
+#endif
+
+ if (n != -1) {
+ return ED_mesh_uv_texture_remove_index(me, n);
+ }
+ else {
+ return false;
+ }
+}
+bool ED_mesh_uv_texture_remove_named(Mesh *me, const char *name)
+{
+ /* texpoly/uv are assumed to be in sync */
+ CustomData *pdata = GET_CD_DATA(me, pdata);
+ const int n = CustomData_get_named_layer(pdata, CD_MTEXPOLY, name);
+ if (n != -1) {
+ return ED_mesh_uv_texture_remove_index(me, n);
+ }
+ else {
+ return false;
+ }
}
/* note: keep in sync with ED_mesh_uv_texture_add */
-int ED_mesh_color_add(bContext *C, Scene *UNUSED(scene), Object *UNUSED(ob), Mesh *me, const char *name, int active_set)
+int ED_mesh_color_add(Mesh *me, const char *name, const bool active_set)
{
BMEditMesh *em;
int layernum;
@@ -493,47 +520,50 @@ int ED_mesh_color_add(bContext *C, Scene *UNUSED(scene), Object *UNUSED(ob), Mes
}
DAG_id_tag_update(&me->id, 0);
- WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, me);
return layernum;
}
-int ED_mesh_color_remove(bContext *C, Object *ob, Mesh *me)
+bool ED_mesh_color_remove_index(Mesh *me, const int n)
{
CustomData *ldata = GET_CD_DATA(me, ldata);
CustomDataLayer *cdl;
int index;
- index = CustomData_get_active_layer_index(ldata, CD_MLOOPCOL);
+ index = CustomData_get_layer_index_n(ldata, CD_MLOOPCOL, n);
cdl = (index == -1) ? NULL : &ldata->layers[index];
if (!cdl)
- return 0;
+ return false;
- delete_customdata_layer(C, ob, cdl);
+ delete_customdata_layer(me, cdl);
DAG_id_tag_update(&me->id, 0);
- WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, me);
- return 1;
+ return true;
}
-
-int ED_mesh_color_remove_named(bContext *C, Object *ob, Mesh *me, const char *name)
+bool ED_mesh_color_remove_active(Mesh *me)
{
CustomData *ldata = GET_CD_DATA(me, ldata);
- CustomDataLayer *cdl;
- int index;
-
- index = CustomData_get_named_layer_index(ldata, CD_MLOOPCOL, name);
- cdl = (index == -1) ? NULL : &ldata->layers[index];
-
- if (!cdl)
- return 0;
-
- delete_customdata_layer(C, ob, cdl);
- DAG_id_tag_update(&me->id, 0);
- WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
-
- return 1;
+ const int n = CustomData_get_active_layer(ldata, CD_MLOOPCOL);
+ if (n != -1) {
+ return ED_mesh_color_remove_index(me, n);
+ }
+ else {
+ return false;
+ }
+}
+bool ED_mesh_color_remove_named(Mesh *me, const char *name)
+{
+ CustomData *ldata = GET_CD_DATA(me, ldata);
+ const int n = CustomData_get_named_layer(ldata, CD_MLOOPCOL, name);
+ if (n != -1) {
+ return ED_mesh_color_remove_index(me, n);
+ }
+ else {
+ return false;
+ }
}
/*********************** UV texture operators ************************/
@@ -550,7 +580,7 @@ static int mesh_uv_texture_add_exec(bContext *C, wmOperator *UNUSED(op))
Object *ob = ED_object_context(C);
Mesh *me = ob->data;
- if (ED_mesh_uv_texture_add(C, me, NULL, TRUE) == -1)
+ if (ED_mesh_uv_texture_add(me, NULL, true) == -1)
return OPERATOR_CANCELLED;
return OPERATOR_FINISHED;
@@ -670,7 +700,7 @@ static int mesh_uv_texture_remove_exec(bContext *C, wmOperator *UNUSED(op))
Object *ob = ED_object_context(C);
Mesh *me = ob->data;
- if (!ED_mesh_uv_texture_remove(C, ob, me))
+ if (!ED_mesh_uv_texture_remove_active(me))
return OPERATOR_CANCELLED;
return OPERATOR_FINISHED;
@@ -695,11 +725,10 @@ void MESH_OT_uv_texture_remove(wmOperatorType *ot)
static int mesh_vertex_color_add_exec(bContext *C, wmOperator *UNUSED(op))
{
- Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_context(C);
Mesh *me = ob->data;
- if (ED_mesh_color_add(C, scene, ob, me, NULL, TRUE) == -1)
+ if (ED_mesh_color_add(me, NULL, true) == -1)
return OPERATOR_CANCELLED;
return OPERATOR_FINISHED;
@@ -725,7 +754,7 @@ static int mesh_vertex_color_remove_exec(bContext *C, wmOperator *UNUSED(op))
Object *ob = ED_object_context(C);
Mesh *me = ob->data;
- if (!ED_mesh_color_remove(C, ob, me))
+ if (!ED_mesh_color_remove_active(me))
return OPERATOR_CANCELLED;
return OPERATOR_FINISHED;
@@ -757,7 +786,7 @@ static int mesh_customdata_clear_exec__internal(bContext *C,
int tot;
CustomData *data = mesh_customdata_get_type(me, htype, &tot);
- BLI_assert(CustomData_layertype_is_singleton(type) == TRUE);
+ BLI_assert(CustomData_layertype_is_singleton(type) == true);
if (CustomData_has_layer(data, type)) {
if (me->edit_btmesh) {
@@ -786,21 +815,21 @@ static int mesh_customdata_clear_mask_poll(bContext *C)
/* special case - can't run this if we're in sculpt mode */
if (ob->mode & OB_MODE_SCULPT) {
- return FALSE;
+ return false;
}
if (me->id.lib == NULL) {
CustomData *data = GET_CD_DATA(me, vdata);
if (CustomData_has_layer(data, CD_PAINT_MASK)) {
- return TRUE;
+ return true;
}
data = GET_CD_DATA(me, ldata);
if (CustomData_has_layer(data, CD_GRID_PAINT_MASK)) {
- return TRUE;
+ return true;
}
}
}
- return FALSE;
+ return false;
}
static int mesh_customdata_clear_mask_exec(bContext *C, wmOperator *UNUSED(op))
{
@@ -843,11 +872,11 @@ static int mesh_customdata_clear_skin_poll(bContext *C)
if (me->id.lib == NULL) {
CustomData *data = GET_CD_DATA(me, vdata);
if (CustomData_has_layer(data, CD_MVERT_SKIN)) {
- return TRUE;
+ return true;
}
}
}
- return FALSE;
+ return false;
}
static int mesh_customdata_clear_skin_exec(bContext *C, wmOperator *UNUSED(op))
{
@@ -875,20 +904,20 @@ void ED_mesh_update(Mesh *mesh, bContext *C, int calc_edges, int calc_tessface)
{
int *polyindex = NULL;
float (*face_nors)[3];
- int tessface_input = FALSE;
+ bool tessface_input = false;
if (mesh->totface > 0 && mesh->totpoly == 0) {
BKE_mesh_convert_mfaces_to_mpolys(mesh);
/* would only be converting back again, don't bother */
- tessface_input = TRUE;
+ tessface_input = true;
}
if (calc_edges || ((mesh->totpoly || mesh->totface) && mesh->totedge == 0))
BKE_mesh_calc_edges(mesh, calc_edges, true);
if (calc_tessface) {
- if (tessface_input == FALSE) {
+ if (tessface_input == false) {
BKE_mesh_tessface_calc(mesh);
}
}
@@ -911,7 +940,7 @@ void ED_mesh_update(Mesh *mesh, bContext *C, int calc_edges, int calc_tessface)
mesh->totloop, mesh->totpoly,
NULL /* polyNors_r */,
mesh->mface, mesh->totface,
- polyindex, face_nors, FALSE);
+ polyindex, face_nors, false);
#else
BKE_mesh_calc_normals(mesh->mvert, mesh->totvert,
mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly,
@@ -1239,7 +1268,7 @@ void ED_mesh_calc_normals(Mesh *mesh)
#ifdef USE_BMESH_MPOLY_NORMALS
BKE_mesh_calc_normals_mapping_ex(mesh->mvert, mesh->totvert,
mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly,
- NULL, NULL, 0, NULL, NULL, FALSE);
+ NULL, NULL, 0, NULL, NULL, false);
#else
BKE_mesh_calc_normals(mesh->mvert, mesh->totvert,
mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly,
diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h
index 5dab022dd2f..89a320ca928 100644
--- a/source/blender/editors/mesh/mesh_intern.h
+++ b/source/blender/editors/mesh/mesh_intern.h
@@ -59,24 +59,24 @@ struct LinkNode;
*/
/*calls a bmesh op, reporting errors to the user, etc*/
-int EDBM_op_callf(struct BMEditMesh *em, struct wmOperator *op, const char *fmt, ...);
+bool EDBM_op_callf(struct BMEditMesh *em, struct wmOperator *op, const char *fmt, ...);
-int EDBM_op_call_and_selectf(struct BMEditMesh *em, struct wmOperator *op,
- const char *selectslot, const char *fmt, ...);
+bool EDBM_op_call_and_selectf(struct BMEditMesh *em, struct wmOperator *op,
+ const char *selectslot, const char *fmt, ...);
/* same as above, but doesn't report errors.*/
-int EDBM_op_call_silentf(struct BMEditMesh *em, const char *fmt, ...);
+bool EDBM_op_call_silentf(struct BMEditMesh *em, const char *fmt, ...);
/* these next two functions are the split version of EDBM_op_callf, so you can
* do stuff with a bmesh operator, after initializing it but before executing
* it.
*
* execute the operator with BM_Exec_Op */
-int EDBM_op_init(struct BMEditMesh *em, struct BMOperator *bmop,
- struct wmOperator *op, const char *fmt, ...);
+bool EDBM_op_init(struct BMEditMesh *em, struct BMOperator *bmop,
+ struct wmOperator *op, const char *fmt, ...);
/*cleans up after a bmesh operator*/
-int EDBM_op_finish(struct BMEditMesh *em, struct BMOperator *bmop,
- struct wmOperator *op, const int report);
+bool EDBM_op_finish(struct BMEditMesh *em, struct BMOperator *bmop,
+ struct wmOperator *op, const bool do_report);
void EDBM_stats_update(struct BMEditMesh *em);
diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c
index 8d5bfe624fd..2111b6f3409 100644
--- a/source/blender/editors/mesh/mesh_navmesh.c
+++ b/source/blender/editors/mesh/mesh_navmesh.c
@@ -320,7 +320,7 @@ static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh,
if (createob) {
/* create new object */
- obedit = ED_object_add_type(C, OB_MESH, co, rot, FALSE, lay);
+ obedit = ED_object_add_type(C, OB_MESH, co, rot, false, lay);
}
else {
obedit = base->object;
@@ -330,7 +330,7 @@ static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh,
copy_v3_v3(obedit->rot, rot);
}
- ED_object_enter_editmode(C, EM_DO_UNDO | EM_IGNORE_LAYER);
+ ED_object_editmode_enter(C, EM_DO_UNDO | EM_IGNORE_LAYER);
em = BMEdit_FromObject(obedit);
if (!createob) {
@@ -401,7 +401,7 @@ static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh,
EDBM_vert_at_index(em, face[0]),
EDBM_vert_at_index(em, face[2]),
EDBM_vert_at_index(em, face[1]), NULL,
- NULL, FALSE);
+ NULL, false);
/* set navigation polygon idx to the custom layer */
polygonIdx = (int *)CustomData_bmesh_get(&em->bm->pdata, newFace->head.data, CD_RECAST);
@@ -416,7 +416,7 @@ static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh,
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
- ED_object_exit_editmode(C, EM_FREEDATA);
+ ED_object_editmode_exit(C, EM_FREEDATA);
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obedit);
if (createob) {
@@ -500,7 +500,7 @@ static int navmesh_face_copy_exec(bContext *C, wmOperator *op)
BMEditMesh *em = BMEdit_FromObject(obedit);
/* do work here */
- BMFace *efa_act = BM_active_face_get(em->bm, FALSE, FALSE);
+ BMFace *efa_act = BM_active_face_get(em->bm, false, false);
if (efa_act) {
if (CustomData_has_layer(&em->bm->pdata, CD_RECAST)) {
@@ -633,16 +633,16 @@ static int navmesh_obmode_data_poll(bContext *C)
Mesh *me = ob->data;
return CustomData_has_layer(&me->pdata, CD_RECAST);
}
- return FALSE;
+ return false;
}
static int navmesh_obmode_poll(bContext *C)
{
Object *ob = ED_object_active_context(C);
if (ob && (ob->mode == OB_MODE_OBJECT) && (ob->type == OB_MESH)) {
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
static int navmesh_reset_exec(bContext *C, wmOperator *UNUSED(op))
diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c
index cf3877a8d93..42a139d7961 100644
--- a/source/blender/editors/mesh/mesh_ops.c
+++ b/source/blender/editors/mesh/mesh_ops.c
@@ -212,52 +212,52 @@ void ED_operatormacros_mesh(void)
WM_operatortype_macro_define(ot, "MESH_OT_duplicate");
otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
RNA_enum_set(otmacro->ptr, "proportional", 0);
- RNA_boolean_set(otmacro->ptr, "mirror", FALSE);
+ RNA_boolean_set(otmacro->ptr, "mirror", false);
ot = WM_operatortype_append_macro("MESH_OT_rip_move", "Rip", "Rip polygons and move the result",
OPTYPE_UNDO | OPTYPE_REGISTER);
otmacro = WM_operatortype_macro_define(ot, "MESH_OT_rip");
- RNA_boolean_set(otmacro->ptr, "use_fill", FALSE);
+ RNA_boolean_set(otmacro->ptr, "use_fill", false);
otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
RNA_enum_set(otmacro->ptr, "proportional", 0);
- RNA_boolean_set(otmacro->ptr, "mirror", FALSE);
+ RNA_boolean_set(otmacro->ptr, "mirror", false);
/* annoying we can't pass 'use_fill' through the macro */
ot = WM_operatortype_append_macro("MESH_OT_rip_move_fill", "Rip Fill", "Rip-fill polygons and move the result",
OPTYPE_UNDO | OPTYPE_REGISTER);
otmacro = WM_operatortype_macro_define(ot, "MESH_OT_rip");
- RNA_boolean_set(otmacro->ptr, "use_fill", TRUE);
+ RNA_boolean_set(otmacro->ptr, "use_fill", true);
otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
RNA_enum_set(otmacro->ptr, "proportional", 0);
- RNA_boolean_set(otmacro->ptr, "mirror", FALSE);
+ RNA_boolean_set(otmacro->ptr, "mirror", false);
ot = WM_operatortype_append_macro("MESH_OT_extrude_region_move", "Extrude Region and Move",
"Extrude region and move result", OPTYPE_UNDO | OPTYPE_REGISTER);
otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_region");
otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
RNA_enum_set(otmacro->ptr, "proportional", 0);
- RNA_boolean_set(otmacro->ptr, "mirror", FALSE);
+ RNA_boolean_set(otmacro->ptr, "mirror", false);
ot = WM_operatortype_append_macro("MESH_OT_extrude_faces_move", "Extrude Individual Faces and Move",
"Extrude faces and move result", OPTYPE_UNDO | OPTYPE_REGISTER);
otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_faces_indiv");
otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_shrink_fatten");
RNA_enum_set(otmacro->ptr, "proportional", 0);
- RNA_boolean_set(otmacro->ptr, "mirror", FALSE);
+ RNA_boolean_set(otmacro->ptr, "mirror", false);
ot = WM_operatortype_append_macro("MESH_OT_extrude_edges_move", "Extrude Only Edges and Move",
"Extrude edges and move result", OPTYPE_UNDO | OPTYPE_REGISTER);
otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_edges_indiv");
otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
RNA_enum_set(otmacro->ptr, "proportional", 0);
- RNA_boolean_set(otmacro->ptr, "mirror", FALSE);
+ RNA_boolean_set(otmacro->ptr, "mirror", false);
ot = WM_operatortype_append_macro("MESH_OT_extrude_vertices_move", "Extrude Only Vertices and Move",
"Extrude vertices and move result", OPTYPE_UNDO | OPTYPE_REGISTER);
otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_verts_indiv");
otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
RNA_enum_set(otmacro->ptr, "proportional", 0);
- RNA_boolean_set(otmacro->ptr, "mirror", FALSE);
+ RNA_boolean_set(otmacro->ptr, "mirror", false);
}
/* note mesh keymap also for other space? */
@@ -274,29 +274,29 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "MESH_OT_inset", IKEY, KM_PRESS, 0, 0);
kmi = WM_keymap_add_item(keymap, "MESH_OT_bevel", BKEY, KM_PRESS, KM_CTRL, 0);
- RNA_boolean_set(kmi->ptr, "vertex_only", FALSE);
+ RNA_boolean_set(kmi->ptr, "vertex_only", false);
kmi = WM_keymap_add_item(keymap, "MESH_OT_bevel", BKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
- RNA_boolean_set(kmi->ptr, "vertex_only", TRUE);
+ RNA_boolean_set(kmi->ptr, "vertex_only", true);
/* selecting */
/* standard mouse selection goes via space_view3d */
kmi = WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
- RNA_boolean_set(kmi->ptr, "extend", FALSE);
- RNA_boolean_set(kmi->ptr, "deselect", FALSE);
- RNA_boolean_set(kmi->ptr, "toggle", FALSE);
+ RNA_boolean_set(kmi->ptr, "extend", false);
+ RNA_boolean_set(kmi->ptr, "deselect", false);
+ RNA_boolean_set(kmi->ptr, "toggle", false);
kmi = WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_SHIFT | KM_ALT, 0);
- RNA_boolean_set(kmi->ptr, "extend", FALSE);
- RNA_boolean_set(kmi->ptr, "deselect", FALSE);
- RNA_boolean_set(kmi->ptr, "toggle", TRUE);
+ RNA_boolean_set(kmi->ptr, "extend", false);
+ RNA_boolean_set(kmi->ptr, "deselect", false);
+ RNA_boolean_set(kmi->ptr, "toggle", true);
kmi = WM_keymap_add_item(keymap, "MESH_OT_edgering_select", SELECTMOUSE, KM_PRESS, KM_ALT | KM_CTRL, 0);
- RNA_boolean_set(kmi->ptr, "extend", FALSE);
- RNA_boolean_set(kmi->ptr, "deselect", FALSE);
- RNA_boolean_set(kmi->ptr, "toggle", FALSE);
+ RNA_boolean_set(kmi->ptr, "extend", false);
+ RNA_boolean_set(kmi->ptr, "deselect", false);
+ RNA_boolean_set(kmi->ptr, "toggle", false);
kmi = WM_keymap_add_item(keymap, "MESH_OT_edgering_select", SELECTMOUSE, KM_PRESS, KM_SHIFT | KM_ALT | KM_CTRL, 0);
- RNA_boolean_set(kmi->ptr, "extend", FALSE);
- RNA_boolean_set(kmi->ptr, "deselect", FALSE);
- RNA_boolean_set(kmi->ptr, "toggle", TRUE);
+ RNA_boolean_set(kmi->ptr, "extend", false);
+ RNA_boolean_set(kmi->ptr, "deselect", false);
+ RNA_boolean_set(kmi->ptr, "toggle", true);
WM_keymap_add_item(keymap, "MESH_OT_select_shortest_path", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
@@ -311,9 +311,9 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "MESH_OT_select_linked", LKEY, KM_PRESS, KM_CTRL, 0);
kmi = WM_keymap_add_item(keymap, "MESH_OT_select_linked_pick", LKEY, KM_PRESS, 0, 0);
- RNA_boolean_set(kmi->ptr, "deselect", FALSE);
+ RNA_boolean_set(kmi->ptr, "deselect", false);
kmi = WM_keymap_add_item(keymap, "MESH_OT_select_linked_pick", LKEY, KM_PRESS, KM_SHIFT, 0);
- RNA_boolean_set(kmi->ptr, "deselect", TRUE);
+ RNA_boolean_set(kmi->ptr, "deselect", true);
WM_keymap_add_item(keymap, "MESH_OT_faces_select_linked_flat", FKEY, KM_PRESS, (KM_CTRL | KM_SHIFT | KM_ALT), 0);
@@ -324,16 +324,16 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
/* hide */
kmi = WM_keymap_add_item(keymap, "MESH_OT_hide", HKEY, KM_PRESS, 0, 0);
- RNA_boolean_set(kmi->ptr, "unselected", FALSE);
+ RNA_boolean_set(kmi->ptr, "unselected", false);
kmi = WM_keymap_add_item(keymap, "MESH_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0);
- RNA_boolean_set(kmi->ptr, "unselected", TRUE);
+ RNA_boolean_set(kmi->ptr, "unselected", true);
WM_keymap_add_item(keymap, "MESH_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0);
/* tools */
kmi = WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_CTRL, 0);
- RNA_boolean_set(kmi->ptr, "inside", FALSE);
+ RNA_boolean_set(kmi->ptr, "inside", false);
kmi = WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
- RNA_boolean_set(kmi->ptr, "inside", TRUE);
+ RNA_boolean_set(kmi->ptr, "inside", true);
WM_keymap_add_item(keymap, "VIEW3D_OT_edit_mesh_extrude_move_normal", EKEY, KM_PRESS, 0, 0); /* python operator */
WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_extrude", EKEY, KM_PRESS, KM_ALT, 0);
@@ -346,9 +346,9 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "MESH_OT_beautify_fill", FKEY, KM_PRESS, KM_SHIFT | KM_ALT, 0);
kmi = WM_keymap_add_item(keymap, "MESH_OT_quads_convert_to_tris", TKEY, KM_PRESS, KM_CTRL, 0);
- RNA_boolean_set(kmi->ptr, "use_beauty", TRUE);
+ RNA_boolean_set(kmi->ptr, "use_beauty", true);
kmi = WM_keymap_add_item(keymap, "MESH_OT_quads_convert_to_tris", TKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
- RNA_boolean_set(kmi->ptr, "use_beauty", FALSE);
+ RNA_boolean_set(kmi->ptr, "use_beauty", false);
WM_keymap_add_item(keymap, "MESH_OT_tris_convert_to_quads", JKEY, KM_PRESS, KM_ALT, 0);
@@ -374,20 +374,20 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "TRANSFORM_OT_vert_slide", VKEY, KM_PRESS, KM_SHIFT, 0);
/* use KM_CLICK because same key is used for tweaks */
kmi = WM_keymap_add_item(keymap, "MESH_OT_dupli_extrude_cursor", ACTIONMOUSE, KM_CLICK, KM_CTRL, 0);
- RNA_boolean_set(kmi->ptr, "rotate_source", TRUE);
+ RNA_boolean_set(kmi->ptr, "rotate_source", true);
kmi = WM_keymap_add_item(keymap, "MESH_OT_dupli_extrude_cursor", ACTIONMOUSE, KM_CLICK, KM_SHIFT | KM_CTRL, 0);
- RNA_boolean_set(kmi->ptr, "rotate_source", FALSE);
+ RNA_boolean_set(kmi->ptr, "rotate_source", false);
WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_delete", XKEY, KM_PRESS, 0, 0);
WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_delete", DELKEY, KM_PRESS, 0, 0);
kmi = WM_keymap_add_item(keymap, "MESH_OT_knife_tool", KKEY, KM_PRESS, 0, 0);
- RNA_boolean_set(kmi->ptr, "use_occlude_geometry", TRUE);
- RNA_boolean_set(kmi->ptr, "only_selected", FALSE);
+ RNA_boolean_set(kmi->ptr, "use_occlude_geometry", true);
+ RNA_boolean_set(kmi->ptr, "only_selected", false);
kmi = WM_keymap_add_item(keymap, "MESH_OT_knife_tool", KKEY, KM_PRESS, KM_SHIFT, 0);
- RNA_boolean_set(kmi->ptr, "use_occlude_geometry", FALSE);
- RNA_boolean_set(kmi->ptr, "only_selected", TRUE);
+ RNA_boolean_set(kmi->ptr, "use_occlude_geometry", false);
+ RNA_boolean_set(kmi->ptr, "only_selected", true);
WM_keymap_add_item(keymap, "OBJECT_OT_vertex_parent_set", PKEY, KM_PRESS, KM_CTRL, 0);
@@ -407,7 +407,7 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
}
ED_keymap_proportional_cycle(keyconf, keymap);
- ED_keymap_proportional_editmode(keyconf, keymap, TRUE);
+ ED_keymap_proportional_editmode(keyconf, keymap, true);
knifetool_modal_keymap(keyconf);
}
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index e8f55edddab..562bc4a8e02 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -430,8 +430,8 @@ int join_mesh_exec(bContext *C, wmOperator *op)
multiresModifier_prepare_join(scene, base->object, ob);
- if ((mmd = get_multires_modifier(scene, base->object, TRUE))) {
- ED_object_iter_other(bmain, base->object, TRUE,
+ if ((mmd = get_multires_modifier(scene, base->object, true))) {
+ ED_object_iter_other(bmain, base->object, true,
ED_object_multires_update_totlevels_cb,
&mmd->totlvl);
}
@@ -566,8 +566,8 @@ int join_mesh_exec(bContext *C, wmOperator *op)
DAG_relations_tag_update(bmain); // removed objects, need to rebuild dag
#if 0
- ED_object_enter_editmode(C, EM_WAITCURSOR);
- ED_object_exit_editmode(C, EM_FREEDATA | EM_WAITCURSOR | EM_DO_UNDO);
+ ED_object_editmode_enter(C, EM_WAITCURSOR);
+ ED_object_editmode_exit(C, EM_FREEDATA | EM_WAITCURSOR | EM_DO_UNDO);
#else
/* toggle editmode using lower level functions so this can be called from python */
EDBM_mesh_make(scene->toolsettings, scene, ob);
@@ -724,9 +724,9 @@ static void mesh_octree_add_nodes(MocNode **basetable, const float co[3], const
float fx, fy, fz;
int vx, vy, vz;
- if ((finite(co[0]) == FALSE) ||
- (finite(co[1]) == FALSE) ||
- (finite(co[2]) == FALSE))
+ if ((finite(co[0]) == false) ||
+ (finite(co[1]) == false) ||
+ (finite(co[2]) == false))
{
return;
}
@@ -910,7 +910,7 @@ int mesh_mirrtopo_table(Object *ob, char mode)
}
}
else if (mode == 's') { /* start table */
- ED_mesh_mirrtopo_init(ob->data, ob->mode, &mesh_topo_store, FALSE);
+ ED_mesh_mirrtopo_init(ob->data, ob->mode, &mesh_topo_store, false);
}
else if (mode == 'e') { /* end table */
ED_mesh_mirrtopo_free(&mesh_topo_store);
@@ -957,9 +957,9 @@ static BMVert *editbmesh_get_x_mirror_vert_spatial(Object *ob, BMEditMesh *em, c
intptr_t poinval;
/* ignore nan verts */
- if ((finite(co[0]) == FALSE) ||
- (finite(co[1]) == FALSE) ||
- (finite(co[2]) == FALSE))
+ if ((finite(co[0]) == false) ||
+ (finite(co[1]) == false) ||
+ (finite(co[2]) == false))
{
return NULL;
}
@@ -1174,9 +1174,9 @@ int *mesh_get_x_mirror_faces(Object *ob, BMEditMesh *em)
* Face selection in object mode,
* currently only weight-paint and vertex-paint use this.
*
- * \return boolean TRUE == Found
+ * \return boolean true == Found
*/
-int ED_mesh_pick_face(bContext *C, Object *ob, const int mval[2], unsigned int *index, int size)
+bool ED_mesh_pick_face(bContext *C, Object *ob, const int mval[2], unsigned int *index, int size)
{
ViewContext vc;
Mesh *me = ob->data;
@@ -1184,7 +1184,7 @@ int ED_mesh_pick_face(bContext *C, Object *ob, const int mval[2], unsigned int *
BLI_assert(me && GS(me->id.name) == ID_ME);
if (!me || me->totpoly == 0)
- return 0;
+ return false;
view3d_set_viewcontext(C, &vc);
@@ -1201,17 +1201,17 @@ int ED_mesh_pick_face(bContext *C, Object *ob, const int mval[2], unsigned int *
}
if ((*index) <= 0 || (*index) > (unsigned int)me->totpoly)
- return 0;
+ return false;
(*index)--;
- return 1;
+ return true;
}
/**
* Use when the back buffer stores face index values. but we want a vert.
* This gets the face then finds the closest vertex to mval.
*/
-int ED_mesh_pick_face_vert(bContext *C, Object *ob, const int mval[2], unsigned int *index, int size)
+bool ED_mesh_pick_face_vert(bContext *C, Object *ob, const int mval[2], unsigned int *index, int size)
{
unsigned int poly_index;
Mesh *me = ob->data;
@@ -1257,18 +1257,18 @@ int ED_mesh_pick_face_vert(bContext *C, Object *ob, const int mval[2], unsigned
if (v_idx_best != -1) {
*index = v_idx_best;
- return 1;
+ return true;
}
}
- return 0;
+ return false;
}
/**
* Vertex selection in object mode,
* currently only weight paint uses this.
*
- * \return boolean TRUE == Found
+ * \return boolean true == Found
*/
typedef struct VertPickData {
const MVert *mvert;
@@ -1296,7 +1296,7 @@ static void ed_mesh_pick_vert__mapFunc(void *userData, int index, const float co
}
}
}
-int ED_mesh_pick_vert(bContext *C, Object *ob, const int mval[2], unsigned int *index, int size, int use_zbuf)
+bool ED_mesh_pick_vert(bContext *C, Object *ob, const int mval[2], unsigned int *index, int size, bool use_zbuf)
{
ViewContext vc;
Mesh *me = ob->data;
@@ -1304,7 +1304,7 @@ int ED_mesh_pick_vert(bContext *C, Object *ob, const int mval[2], unsigned int *
BLI_assert(me && GS(me->id.name) == ID_ME);
if (!me || me->totvert == 0)
- return 0;
+ return false;
view3d_set_viewcontext(C, &vc);
@@ -1322,7 +1322,7 @@ int ED_mesh_pick_vert(bContext *C, Object *ob, const int mval[2], unsigned int *
}
if ((*index) <= 0 || (*index) > (unsigned int)me->totvert)
- return 0;
+ return false;
(*index)--;
}
@@ -1341,7 +1341,7 @@ int ED_mesh_pick_vert(bContext *C, Object *ob, const int mval[2], unsigned int *
ED_view3d_init_mats_rv3d(ob, rv3d);
if (dm == NULL) {
- return 0;
+ return false;
}
/* setup data */
@@ -1356,11 +1356,11 @@ int ED_mesh_pick_vert(bContext *C, Object *ob, const int mval[2], unsigned int *
dm->release(dm);
if (data.v_idx_best == -1) {
- return 0;
+ return false;
}
*index = data.v_idx_best;
}
- return 1;
+ return true;
}
diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c
index 6781624aec6..3fe8b93ada3 100644
--- a/source/blender/editors/metaball/mball_edit.c
+++ b/source/blender/editors/metaball/mball_edit.c
@@ -411,7 +411,7 @@ void MBALL_OT_reveal_metaelems(wmOperatorType *ot)
/* Select MetaElement with mouse click (user can select radius circle or
* stiffness circle) */
-int mouse_mball(bContext *C, const int mval[2], int extend, int deselect, int toggle)
+bool mouse_mball(bContext *C, const int mval[2], bool extend, bool deselect, bool toggle)
{
static MetaElem *startelem = NULL;
Object *obedit = CTX_data_edit_object(C);
@@ -487,11 +487,11 @@ int mouse_mball(bContext *C, const int mval[2], int extend, int deselect, int to
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, mb);
- return 1;
+ return true;
}
}
- return 0;
+ return false;
}
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 312cceac77d..63582feadb7 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -372,7 +372,7 @@ Object *ED_object_add_type(bContext *C, int type, const float loc[3], const floa
/* for as long scene has editmode... */
if (CTX_data_edit_object(C))
- ED_object_exit_editmode(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR | EM_DO_UNDO); /* freedata, and undo */
+ ED_object_editmode_exit(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR | EM_DO_UNDO); /* freedata, and undo */
/* deselects all, sets scene->basact */
ob = BKE_object_add(scene, type);
@@ -390,7 +390,7 @@ Object *ED_object_add_type(bContext *C, int type, const float loc[3], const floa
}
if (enter_editmode)
- ED_object_enter_editmode(C, EM_IGNORE_LAYER);
+ ED_object_editmode_enter(C, EM_IGNORE_LAYER);
WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene);
@@ -452,20 +452,20 @@ static int effector_add_exec(bContext *C, wmOperator *op)
if (!ob)
return OPERATOR_CANCELLED;
- rename_id(&ob->id, "CurveGuide");
+ rename_id(&ob->id, DATA_("CurveGuide"));
((Curve *)ob->data)->flag |= CU_PATH | CU_3D;
- ED_object_enter_editmode(C, 0);
+ ED_object_editmode_enter(C, 0);
ED_object_new_primitive_matrix(C, ob, loc, rot, mat, FALSE);
BLI_addtail(object_editcurve_get(ob), add_nurbs_primitive(C, ob, mat, CU_NURBS | CU_PRIM_PATH, 1));
if (!enter_editmode)
- ED_object_exit_editmode(C, EM_FREEDATA);
+ ED_object_editmode_exit(C, EM_FREEDATA);
}
else {
ob = ED_object_add_type(C, OB_EMPTY, loc, rot, FALSE, layer);
if (!ob)
return OPERATOR_CANCELLED;
- rename_id(&ob->id, "Field");
+ rename_id(&ob->id, DATA_("Field"));
if (ELEM(type, PFIELD_WIND, PFIELD_VORTEX))
ob->empty_drawtype = OB_SINGLE_ARROW;
}
@@ -578,7 +578,7 @@ static int object_metaball_add_exec(bContext *C, wmOperator *op)
/* userdef */
if (newob && !enter_editmode) {
- ED_object_exit_editmode(C, EM_FREEDATA);
+ ED_object_editmode_exit(C, EM_FREEDATA);
}
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obedit);
@@ -661,7 +661,7 @@ static int object_armature_add_exec(bContext *C, wmOperator *op)
if ((obedit == NULL) || (obedit->type != OB_ARMATURE)) {
obedit = ED_object_add_type(C, OB_ARMATURE, loc, rot, TRUE, layer);
- ED_object_enter_editmode(C, 0);
+ ED_object_editmode_enter(C, 0);
newob = 1;
}
else {
@@ -678,7 +678,7 @@ static int object_armature_add_exec(bContext *C, wmOperator *op)
/* userdef */
if (newob && !enter_editmode)
- ED_object_exit_editmode(C, EM_FREEDATA);
+ ED_object_editmode_exit(C, EM_FREEDATA);
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obedit);
@@ -822,13 +822,13 @@ void OBJECT_OT_drop_named_image(wmOperatorType *ot)
static const char *get_lamp_defname(int type)
{
switch (type) {
- case LA_LOCAL: return "Point";
- case LA_SUN: return "Sun";
- case LA_SPOT: return "Spot";
- case LA_HEMI: return "Hemi";
- case LA_AREA: return "Area";
+ case LA_LOCAL: return DATA_("Point");
+ case LA_SUN: return DATA_("Sun");
+ case LA_SPOT: return DATA_("Spot");
+ case LA_HEMI: return DATA_("Hemi");
+ case LA_AREA: return DATA_("Area");
default:
- return "Lamp";
+ return DATA_("Lamp");
}
}
@@ -980,7 +980,7 @@ static int object_speaker_add_exec(bContext *C, wmOperator *op)
BKE_nlatrack_add_strip(nlt, strip);
/* auto-name the strip, and give the track an interesting name */
- strcpy(nlt->name, "SoundTrack");
+ strcpy(nlt->name, DATA_("SoundTrack"));
BKE_nlastrip_validate_name(adt, strip);
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
@@ -1707,7 +1707,7 @@ static int convert_exec(bContext *C, wmOperator *op)
DAG_relations_tag_update(bmain);
}
-// XXX ED_object_enter_editmode(C, 0);
+// XXX ED_object_editmode_enter(C, 0);
// XXX exit_editmode(C, EM_FREEDATA|EM_WAITCURSOR); /* freedata, but no undo */
if (basact) {
diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c
index dc54207b4e6..00af771e45d 100644
--- a/source/blender/editors/object/object_bake.c
+++ b/source/blender/editors/object/object_bake.c
@@ -323,7 +323,7 @@ static int multiresbake_image_exec_locked(bContext *C, wmOperator *op)
CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases)
{
- MultiresBakeRender bkr = {0};
+ MultiresBakeRender bkr = {NULL};
ob = base->object;
@@ -419,7 +419,7 @@ static void multiresbake_startjob(void *bkv, short *stop, short *do_update, floa
}
for (data = bkj->data.first; data; data = data->next) {
- MultiresBakeRender bkr = {0};
+ MultiresBakeRender bkr = {NULL};
/* copy data stored in job descriptor */
bkr.bake_filter = bkj->bake_filter;
@@ -572,7 +572,7 @@ static void init_bake_internal(BakeRender *bkr, bContext *C)
bScreen *sc = CTX_wm_screen(C);
/* get editmode results */
- ED_object_exit_editmode(C, 0); /* 0 = does not exit editmode */
+ ED_object_editmode_load(CTX_data_edit_object(C));
bkr->sa = sc ? BKE_screen_find_big_area(sc, SPACE_IMAGE, 10) : NULL; /* can be NULL */
bkr->main = CTX_data_main(C);
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index ca57ab76c57..12400209866 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -312,29 +312,26 @@ void OBJECT_OT_hide_render_set(wmOperatorType *ot)
/* ******************* toggle editmode operator ***************** */
-void ED_object_exit_editmode(bContext *C, int flag)
+/**
+ * Load EditMode data back into the object,
+ * optionally freeing the editmode data.
+ */
+static bool ED_object_editmode_load_ex(Object *obedit, const bool freedata)
{
- /* Note! only in exceptional cases should 'EM_DO_UNDO' NOT be in the flag */
+ if (obedit == NULL) {
+ return false;
+ }
- Scene *scene = CTX_data_scene(C);
- Object *obedit = CTX_data_edit_object(C);
- int freedata = flag & EM_FREEDATA;
-
- if (obedit == NULL) return;
-
- if (flag & EM_WAITCURSOR) waitcursor(1);
if (obedit->type == OB_MESH) {
Mesh *me = obedit->data;
-
-// if (EM_texFaceCheck())
-
+
if (me->edit_btmesh->bm->totvert > MESH_MAX_VERTS) {
error("Too many vertices");
- return;
+ return false;
}
-
+
EDBM_mesh_load(obedit);
-
+
if (freedata) {
EDBM_mesh_free(me->edit_btmesh);
MEM_freeN(me->edit_btmesh);
@@ -367,6 +364,29 @@ void ED_object_exit_editmode(bContext *C, int flag)
if (freedata) free_editMball(obedit);
}
+ return true;
+}
+
+bool ED_object_editmode_load(Object *obedit)
+{
+ return ED_object_editmode_load_ex(obedit, false);
+}
+
+void ED_object_editmode_exit(bContext *C, int flag)
+{
+ /* Note! only in exceptional cases should 'EM_DO_UNDO' NOT be in the flag */
+ /* Note! if 'EM_FREEDATA' isn't in the flag, use ED_object_editmode_load directly */
+ Scene *scene = CTX_data_scene(C);
+ Object *obedit = CTX_data_edit_object(C);
+ const bool freedata = (flag & EM_FREEDATA) != 0;
+
+ if (flag & EM_WAITCURSOR) waitcursor(1);
+
+ if (ED_object_editmode_load_ex(obedit, freedata) == false) {
+ if (flag & EM_WAITCURSOR) waitcursor(0);
+ return;
+ }
+
/* freedata only 0 now on file saves and render */
if (freedata) {
ListBase pidlist;
@@ -390,17 +410,17 @@ void ED_object_exit_editmode(bContext *C, int flag)
if (flag & EM_DO_UNDO)
ED_undo_push(C, "Editmode");
-
- if (flag & EM_WAITCURSOR) waitcursor(0);
-
+
WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, scene);
obedit->mode &= ~OB_MODE_EDIT;
}
+
+ if (flag & EM_WAITCURSOR) waitcursor(0);
}
-void ED_object_enter_editmode(bContext *C, int flag)
+void ED_object_editmode_enter(bContext *C, int flag)
{
Scene *scene = CTX_data_scene(C);
Base *base = NULL;
@@ -537,9 +557,9 @@ static int editmode_toggle_exec(bContext *C, wmOperator *UNUSED(op))
ToolSettings *toolsettings = CTX_data_tool_settings(C);
if (!CTX_data_edit_object(C))
- ED_object_enter_editmode(C, EM_WAITCURSOR);
+ ED_object_editmode_enter(C, EM_WAITCURSOR);
else
- ED_object_exit_editmode(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR); /* had EM_DO_UNDO but op flag calls undo too [#24685] */
+ ED_object_editmode_exit(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR); /* had EM_DO_UNDO but op flag calls undo too [#24685] */
ED_space_image_uv_sculpt_update(CTX_wm_manager(C), toolsettings);
@@ -589,7 +609,7 @@ static int posemode_exec(bContext *C, wmOperator *UNUSED(op))
if (base->object->type == OB_ARMATURE) {
if (base->object == CTX_data_edit_object(C)) {
- ED_object_exit_editmode(C, EM_FREEDATA | EM_DO_UNDO);
+ ED_object_editmode_exit(C, EM_FREEDATA | EM_DO_UNDO);
ED_armature_enter_posemode(C, base);
}
else if (base->object->mode & OB_MODE_POSE)
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h
index 163a869613b..e138d2fe24a 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -40,11 +40,11 @@ struct Mesh;
struct HookModifierData;
/* add hook menu */
-enum {
+enum eObject_Hook_Add_Mode {
OBJECT_ADDHOOK_NEWOB = 1,
OBJECT_ADDHOOK_SELOB,
OBJECT_ADDHOOK_SELOB_BONE
-} eObject_Hook_Add_Mode;
+};
/* internal exports only */
diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c
index 053f1ffabd0..9d3b2b7272d 100644
--- a/source/blender/editors/object/object_lattice.c
+++ b/source/blender/editors/object/object_lattice.c
@@ -638,7 +638,7 @@ static BPoint *findnearestLattvert(ViewContext *vc, const int mval[2], int sel)
return data.bp;
}
-int mouse_lattice(bContext *C, const int mval[2], int extend, int deselect, int toggle)
+bool mouse_lattice(bContext *C, const int mval[2], bool extend, bool deselect, bool toggle)
{
ViewContext vc;
BPoint *bp = NULL;
@@ -663,10 +663,10 @@ int mouse_lattice(bContext *C, const int mval[2], int extend, int deselect, int
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, vc.obedit->data);
- return 1;
+ return true;
}
- return 0;
+ return false;
}
/******************************** Undo *************************/
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index c9070dc6205..2239148ca1c 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -198,7 +198,7 @@ static int object_has_modifier(const Object *ob, const ModifierData *exclude,
* If the callback ever returns TRUE, iteration will stop and the
* function value will be TRUE. Otherwise the function returns FALSE.
*/
-int ED_object_iter_other(Main *bmain, Object *orig_ob, int include_orig,
+int ED_object_iter_other(Main *bmain, Object *orig_ob, const bool include_orig,
int (*callback)(Object *ob, void *callback_data),
void *callback_data)
{
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 6039ff6d34b..34a6d359f6b 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -843,20 +843,20 @@ static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent
return OPERATOR_CANCELLED;
}
-static int parent_set_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop)
+static bool parent_set_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop)
{
const char *prop_id = RNA_property_identifier(prop);
int type = RNA_enum_get(ptr, "type");
/* Only show XMirror for PAR_ARMATURE_ENVELOPE and PAR_ARMATURE_AUTO! */
- if (strcmp(prop_id, "xmirror") == 0) {
+ if (STREQ(prop_id, "xmirror")) {
if (ELEM(type, PAR_ARMATURE_ENVELOPE, PAR_ARMATURE_AUTO))
- return TRUE;
+ return true;
else
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
static void parent_set_ui(bContext *C, wmOperator *op)
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c
index baa0199baf7..b7303b2af51 100644
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@ -439,7 +439,7 @@ static int object_select_linked_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
else if (nr == OBJECT_SELECT_LINKED_OBDATA) {
- if (ob->data == 0)
+ if (ob->data == NULL)
return OPERATOR_CANCELLED;
changed = object_select_all_by_obdata(C, ob->data);
@@ -894,13 +894,13 @@ void OBJECT_OT_select_grouped(wmOperatorType *ot)
static int object_select_by_layer_exec(bContext *C, wmOperator *op)
{
unsigned int layernum;
- short extend, match;
+ bool extend, match;
extend = RNA_boolean_get(op->ptr, "extend");
layernum = RNA_int_get(op->ptr, "layers");
match = RNA_enum_get(op->ptr, "match");
- if (extend == 0) {
+ if (extend == false) {
CTX_DATA_BEGIN (C, Base *, base, visible_bases)
{
ED_base_object_select(base, BA_DESELECT);
@@ -910,12 +910,12 @@ static int object_select_by_layer_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN (C, Base *, base, visible_bases)
{
- int ok = 0;
+ bool ok = false;
- if (match == 1) /* exact */
+ if (match == true) /* exact */
ok = (base->lay == (1 << (layernum - 1)));
else /* shared layers */
- ok = (base->lay & (1 << (layernum - 1)));
+ ok = (base->lay & (1 << (layernum - 1))) != 0;
if (ok)
ED_base_object_select(base, BA_SELECT);
@@ -1072,7 +1072,7 @@ void OBJECT_OT_select_same_group(wmOperatorType *ot)
static int object_select_mirror_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
- short extend;
+ bool extend;
extend = RNA_boolean_get(op->ptr, "extend");
@@ -1093,7 +1093,7 @@ static int object_select_mirror_exec(bContext *C, wmOperator *op)
}
}
- if (extend == 0) ED_base_object_select(primbase, BA_DESELECT);
+ if (extend == false) ED_base_object_select(primbase, BA_DESELECT);
}
CTX_DATA_END;
@@ -1128,11 +1128,11 @@ void OBJECT_OT_select_mirror(wmOperatorType *ot)
static int object_select_random_exec(bContext *C, wmOperator *op)
{
float percent;
- short extend;
+ bool extend;
extend = RNA_boolean_get(op->ptr, "extend");
- if (extend == 0) {
+ if (extend == false) {
CTX_DATA_BEGIN (C, Base *, base, visible_bases)
{
ED_base_object_select(base, BA_DESELECT);
diff --git a/source/blender/editors/physics/dynamicpaint_ops.c b/source/blender/editors/physics/dynamicpaint_ops.c
index 48316cfccb7..aa4652af0ba 100644
--- a/source/blender/editors/physics/dynamicpaint_ops.c
+++ b/source/blender/editors/physics/dynamicpaint_ops.c
@@ -202,7 +202,6 @@ void DPAINT_OT_type_toggle(wmOperatorType *ot)
static int output_toggle_exec(bContext *C, wmOperator *op)
{
Object *ob = ED_object_context(C);
- Scene *scene = CTX_data_scene(C);
DynamicPaintSurface *surface;
DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)modifiers_findByType(ob, eModifierType_DynamicPaint);
int output = RNA_enum_get(op->ptr, "output"); /* currently only 1/0 */
@@ -223,9 +222,9 @@ static int output_toggle_exec(bContext *C, wmOperator *op)
/* Vertex Color Layer */
if (surface->type == MOD_DPAINT_SURFACE_T_PAINT) {
if (!exists)
- ED_mesh_color_add(C, scene, ob, ob->data, name, 1);
+ ED_mesh_color_add(ob->data, name, true);
else
- ED_mesh_color_remove_named(C, ob, ob->data, name);
+ ED_mesh_color_remove_named(ob->data, name);
}
/* Vertex Weight Layer */
else if (surface->type == MOD_DPAINT_SURFACE_T_WEIGHT) {
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 329f1f67c4a..e972b7d6620 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -1403,7 +1403,7 @@ void PARTICLE_OT_select_all(wmOperatorType *ot)
/************************ pick select operator ************************/
-int PE_mouse_particles(bContext *C, const int mval[2], int extend, int deselect, int toggle)
+int PE_mouse_particles(bContext *C, const int mval[2], bool extend, bool deselect, bool toggle)
{
PEData data;
Scene *scene= CTX_data_scene(C);
@@ -1584,7 +1584,7 @@ void PE_deselect_all_visible(PTCacheEdit *edit)
}
}
-int PE_border_select(bContext *C, rcti *rect, int select, int extend)
+int PE_border_select(bContext *C, rcti *rect, bool select, bool extend)
{
Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_active_object(C);
@@ -1636,7 +1636,7 @@ int PE_circle_select(bContext *C, int selecting, const int mval[2], float rad)
/************************ lasso select operator ************************/
-int PE_lasso_select(bContext *C, const int mcords[][2], const short moves, short extend, short select)
+int PE_lasso_select(bContext *C, const int mcords[][2], const short moves, bool extend, bool select)
{
Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_active_object(C);
diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c
index b138bc63a68..1268d577f44 100644
--- a/source/blender/editors/render/render_internal.c
+++ b/source/blender/editors/render/render_internal.c
@@ -542,7 +542,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *even
BKE_sequencer_cache_cleanup();
/* get editmode results */
- ED_object_exit_editmode(C, 0); /* 0 = does not exit editmode */
+ ED_object_editmode_load(CTX_data_edit_object(C));
// store spare
// get view3d layer, local layer, make this nice api call to render
diff --git a/source/blender/editors/render/render_ops.c b/source/blender/editors/render/render_ops.c
index ebd2cc941d0..7c52b7d0d39 100644
--- a/source/blender/editors/render/render_ops.c
+++ b/source/blender/editors/render/render_ops.c
@@ -27,14 +27,14 @@
* \ingroup edrend
*/
-
#include <stdlib.h>
-
-#include "WM_api.h"
+#include "BLI_utildefines.h"
#include "ED_render.h"
+#include "WM_api.h"
+
#include "render_intern.h" // own include
#if (defined(WITH_QUICKTIME) && !defined(USE_QTKIT))
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index 948e272eca0..b851dc3be94 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -304,7 +304,17 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
sce->r.alphamode = R_ADDSKY;
sce->r.cfra = scene->r.cfra;
- BLI_strncpy(sce->r.engine, scene->r.engine, sizeof(sce->r.engine));
+
+ if (id_type == ID_TE && sp->pr_method == PR_ICON_RENDER) {
+ /* force blender internal for texture icons render,
+ * seems commonly used render engines does not support
+ * such kind of rendering
+ */
+ BLI_strncpy(sce->r.engine, "BLENDER_RENDER", sizeof(sce->r.engine));
+ }
+ else {
+ BLI_strncpy(sce->r.engine, scene->r.engine, sizeof(sce->r.engine));
+ }
if (id_type == ID_MA) {
Material *mat = NULL, *origmat = (Material *)id;
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index 6045bdfebfe..bf458290b09 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -1458,7 +1458,7 @@ void ED_screen_set_scene(bContext *C, bScreen *screen, Scene *scene)
return;
if (ed_screen_used(CTX_wm_manager(C), screen))
- ED_object_exit_editmode(C, EM_FREEDATA | EM_DO_UNDO);
+ ED_object_editmode_exit(C, EM_FREEDATA | EM_DO_UNDO);
for (sc = CTX_data_main(C)->screen.first; sc; sc = sc->id.next) {
if ((U.flag & USER_SCENEGLOBAL) || sc == screen) {
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 8b69e6e831d..d5d5add215c 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -254,7 +254,7 @@ int ED_operator_node_active(bContext *C)
{
SpaceNode *snode = CTX_wm_space_node(C);
- if (snode && ntreeIsValid(snode->edittree))
+ if (snode && snode->edittree)
return 1;
return 0;
diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c
index 0fbb4c25e78..20edd3d32e7 100644
--- a/source/blender/editors/screen/screendump.c
+++ b/source/blender/editors/screen/screendump.c
@@ -232,11 +232,11 @@ static int screenshot_cancel(bContext *UNUSED(C), wmOperator *op)
return OPERATOR_CANCELLED;
}
-static int screenshot_draw_check_prop(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
+static bool screenshot_draw_check_prop(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
{
const char *prop_id = RNA_property_identifier(prop);
- return !(strcmp(prop_id, "filepath") == 0);
+ return !(STREQ(prop_id, "filepath"));
}
static void screenshot_draw(bContext *UNUSED(C), wmOperator *op)
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 92a55151b66..4f935ebdd8c 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -398,7 +398,6 @@ typedef struct PaintOperation {
double starttime;
ViewContext vc;
- wmTimer *timer;
} PaintOperation;
void paint_brush_init_tex(Brush *brush)
@@ -531,9 +530,6 @@ static void paint_stroke_done(const bContext *C, struct PaintStroke *stroke)
paint_redraw(C, pop, 1);
- if (pop->timer)
- WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), pop->timer);
-
settings->imapaint.flag &= ~IMAGEPAINT_DRAWING;
if (pop->mode == PAINT_MODE_3D_PROJECT) {
diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c
index 921ef6c2879..90a2c8037c4 100644
--- a/source/blender/editors/sculpt_paint/paint_image_2d.c
+++ b/source/blender/editors/sculpt_paint/paint_image_2d.c
@@ -79,9 +79,9 @@ BLI_INLINE unsigned char f_to_char(const float val)
} (void)0
#define IMAPAINT_CHAR_RGB_TO_FLOAT(f, c) { \
- (f)[0] = IMAPAINT_CHAR_TO_FLOAT((c)[0]); \
- (f)[1] = IMAPAINT_CHAR_TO_FLOAT((c)[1]); \
- (f)[2] = IMAPAINT_CHAR_TO_FLOAT((c)[2]); \
+ (f)[0] = IMAPAINT_CHAR_TO_FLOAT((c)[0]); \
+ (f)[1] = IMAPAINT_CHAR_TO_FLOAT((c)[1]); \
+ (f)[2] = IMAPAINT_CHAR_TO_FLOAT((c)[2]); \
} (void)0
#define IMAPAINT_FLOAT_RGB_COPY(a, b) copy_v3_v3(a, b)
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index a90e9150345..7a0f7b817b3 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -116,10 +116,10 @@ BLI_INLINE unsigned char f_to_char(const float val)
} (void)0
#define IMAPAINT_CHAR_RGBA_TO_FLOAT(f, c) { \
- (f)[0] = IMAPAINT_CHAR_TO_FLOAT((c)[0]); \
- (f)[1] = IMAPAINT_CHAR_TO_FLOAT((c)[1]); \
- (f)[2] = IMAPAINT_CHAR_TO_FLOAT((c)[2]); \
- (f)[3] = IMAPAINT_CHAR_TO_FLOAT((c)[3]); \
+ (f)[0] = IMAPAINT_CHAR_TO_FLOAT((c)[0]); \
+ (f)[1] = IMAPAINT_CHAR_TO_FLOAT((c)[1]); \
+ (f)[2] = IMAPAINT_CHAR_TO_FLOAT((c)[2]); \
+ (f)[3] = IMAPAINT_CHAR_TO_FLOAT((c)[3]); \
} (void)0
#define IMAPAINT_FLOAT_RGB_TO_CHAR(c, f) { \
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 9ba50e95d81..197231124fc 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -293,7 +293,7 @@ static void do_shared_vertexcol(Mesh *me, int do_tessface)
/* if no mloopcol: do not do */
/* if mtexpoly: only the involved faces, otherwise all */
- if (me->mloopcol == 0 || me->totvert == 0 || me->totpoly == 0) return;
+ if (me->mloopcol == NULL || me->totvert == 0 || me->totpoly == 0) return;
scol = MEM_callocN(sizeof(float) * me->totvert * 5, "scol");
diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c
index 3aee9a5e31e..0cb0a3d6e5c 100644
--- a/source/blender/editors/sound/sound_ops.c
+++ b/source/blender/editors/sound/sound_ops.c
@@ -449,7 +449,7 @@ static int sound_mixdown_invoke(bContext *C, wmOperator *op, const wmEvent *even
#ifdef WITH_AUDASPACE
-static int sound_mixdown_draw_check_prop(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
+static bool sound_mixdown_draw_check_prop(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
{
const char *prop_id = RNA_property_identifier(prop);
return !(strcmp(prop_id, "filepath") == 0 ||
diff --git a/source/blender/editors/space_action/action_intern.h b/source/blender/editors/space_action/action_intern.h
index 10085d8a149..8f39a38157a 100644
--- a/source/blender/editors/space_action/action_intern.h
+++ b/source/blender/editors/space_action/action_intern.h
@@ -60,19 +60,19 @@ void ACTION_OT_select_leftright(struct wmOperatorType *ot);
void ACTION_OT_clickselect(struct wmOperatorType *ot);
/* defines for left-right select tool */
-enum {
+enum eActKeys_LeftRightSelect_Mode {
ACTKEYS_LRSEL_TEST = 0,
ACTKEYS_LRSEL_LEFT,
ACTKEYS_LRSEL_RIGHT
-} eActKeys_LeftRightSelect_Mode;
+};
/* defines for column-select mode */
-enum {
+enum eActKeys_ColumnSelect_Mode {
ACTKEYS_COLUMNSEL_KEYS = 0,
ACTKEYS_COLUMNSEL_CFRA,
ACTKEYS_COLUMNSEL_MARKERS_COLUMN,
ACTKEYS_COLUMNSEL_MARKERS_BETWEEN,
-} eActKeys_ColumnSelect_Mode;
+};
/* ***************************************** */
/* action_edit.c */
@@ -107,22 +107,22 @@ void ACTION_OT_markers_make_local(struct wmOperatorType *ot);
/* defines for snap keyframes
* NOTE: keep in sync with eEditKeyframes_Snap (in ED_keyframes_edit.h)
*/
-enum {
+enum eActKeys_Snap_Mode {
ACTKEYS_SNAP_CFRA = 1,
ACTKEYS_SNAP_NEAREST_FRAME,
ACTKEYS_SNAP_NEAREST_SECOND,
ACTKEYS_SNAP_NEAREST_MARKER,
-} eActKeys_Snap_Mode;
+};
/* defines for mirror keyframes
* NOTE: keep in sync with eEditKeyframes_Mirror (in ED_keyframes_edit.h)
*/
-enum {
+enum eActKeys_Mirror_Mode {
ACTKEYS_MIRROR_CFRA = 1,
ACTKEYS_MIRROR_YAXIS,
ACTKEYS_MIRROR_XAXIS,
ACTKEYS_MIRROR_MARKER,
-} eActKeys_Mirror_Mode;
+};
/* ***************************************** */
/* action_ops.c */
diff --git a/source/blender/editors/space_buttons/buttons_texture.c b/source/blender/editors/space_buttons/buttons_texture.c
index bb1310d486a..b108f9fa4b5 100644
--- a/source/blender/editors/space_buttons/buttons_texture.c
+++ b/source/blender/editors/space_buttons/buttons_texture.c
@@ -113,15 +113,15 @@ static void buttons_texture_users_find_nodetree(ListBase *users, ID *id,
{
bNode *node;
- if (ntreeIsValid(ntree)) {
+ if (ntree) {
for (node = ntree->nodes.first; node; node = node->next) {
if (node->typeinfo->nclass == NODE_CLASS_TEXTURE) {
PointerRNA ptr;
/* PropertyRNA *prop; */ /* UNUSED */
-
+
RNA_pointer_create(&ntree->id, &RNA_Node, node, &ptr);
/* prop = RNA_struct_find_property(&ptr, "texture"); */ /* UNUSED */
-
+
buttons_texture_user_node_add(users, id, ntree, node,
category, RNA_struct_ui_icon(ptr.type), node->name);
}
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index 58626c79363..2d3dc9127c3 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -269,8 +269,18 @@ static void draw_movieclip_buffer(const bContext *C, SpaceClip *sc, ARegion *ar,
if (display_buffer) {
int need_fallback = 1;
+ /* checkerboard for case alpha */
+ if (ibuf->planes == 32) {
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ fdrawcheckerboard(x, y, x + zoomx * ibuf->x, y + zoomy * ibuf->y);
+ }
+
if (ED_space_clip_texture_buffer_supported(sc)) {
if (ED_space_clip_load_movieclip_buffer(sc, ibuf, display_buffer)) {
+ glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+
glPushMatrix();
glTranslatef(x, y, 0.0f);
glScalef(zoomx, zoomy, 1.0f);
@@ -296,11 +306,14 @@ static void draw_movieclip_buffer(const bContext *C, SpaceClip *sc, ARegion *ar,
/* set zoom */
glPixelZoom(zoomx * width / ibuf->x, zoomy * height / ibuf->y);
- glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, display_buffer);
+ glaDrawPixelsAuto(x, y, ibuf->x, ibuf->y, GL_UNSIGNED_BYTE, GL_NEAREST, display_buffer);
/* reset zoom */
glPixelZoom(1.0f, 1.0f);
}
+
+ if (ibuf->planes == 32)
+ glDisable(GL_BLEND);
}
IMB_display_buffer_release(cache_handle);
@@ -1471,6 +1484,8 @@ void clip_draw_main(const bContext *C, SpaceClip *sc, ARegion *ar)
if (ibuf) {
draw_movieclip_buffer(C, sc, ar, ibuf, width, height, zoomx, zoomy);
IMB_freeImBuf(ibuf);
+
+ clip_start_prefetch_job(C);
}
else {
ED_region_grid_draw(ar, zoomx, zoomy);
diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c
index 728110dfeee..6d9c5b4ba46 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -30,6 +30,15 @@
*/
#include <stddef.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <fcntl.h>
+
+#ifndef WIN32
+# include <unistd.h>
+#else
+# include <io.h>
+#endif
#include "MEM_guardedalloc.h"
@@ -37,10 +46,13 @@
#include "DNA_object_types.h" /* SELECT */
#include "BLI_utildefines.h"
+#include "BLI_fileops.h"
#include "BLI_math.h"
#include "BLI_string.h"
#include "BLI_rect.h"
+#include "BLI_threads.h"
+#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_mask.h"
#include "BKE_movieclip.h"
@@ -617,6 +629,8 @@ int ED_space_clip_load_movieclip_buffer(SpaceClip *sc, ImBuf *ibuf, const unsign
context->last_texture = glaGetOneInteger(GL_TEXTURE_2D);
+ glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+
/* image texture need to be rebinded if displaying another image buffer
* assuming displaying happens of footage frames only on which painting doesn't happen.
* so not changed image buffer pointer means unchanged image content */
@@ -722,3 +736,380 @@ void ED_space_clip_free_texture_buffer(SpaceClip *sc)
MEM_freeN(context);
}
}
+
+/* ******** pre-fetching functions ******** */
+
+typedef struct PrefetchJob {
+ MovieClip *clip;
+ int start_frame, end_frame;
+ short render_size, render_flag;
+} PrefetchJob;
+
+typedef struct PrefetchQueue {
+ int current_frame, start_frame, end_frame;
+ short render_size, render_flag;
+
+ SpinLock spin;
+
+ short *stop;
+ short *do_update;
+ float *progress;
+} PrefetchQueue;
+
+typedef struct PrefetchThread {
+ MovieClip *clip;
+ PrefetchQueue *queue;
+} PrefetchThread;
+
+/* check whether pre-fetching is allowed */
+static bool check_prefetch_allowed(void)
+{
+ wmWindowManager *wm;
+
+ /* if there's any job started, better to leave all CPU and
+ * HDD bandwidth to it
+ *
+ * also, display transform could be needed during playback,
+ * so better to avoid prefetching in this case and reserve
+ * all the power for display transform
+ */
+ for (wm = G.main->wm.first; wm; wm = wm->id.next) {
+ if (WM_jobs_has_running_except(wm, WM_JOB_TYPE_CLIP_PREFETCH))
+ return false;
+
+ if (ED_screen_animation_playing(wm))
+ return false;
+ }
+
+ return true;
+}
+
+/* read file for specified frame number to the memory */
+static unsigned char *prefetch_read_file_to_memory(MovieClip *clip, int current_frame, short render_size,
+ short render_flag, size_t *size_r)
+{
+ MovieClipUser user = {0};
+ char name[FILE_MAX];
+ size_t size;
+ int file;
+ unsigned char *mem;
+
+ user.framenr = current_frame;
+ user.render_size = render_size;
+ user.render_flag = render_flag;
+
+ BKE_movieclip_filename_for_frame(clip, &user, name);
+
+ file = open(name, O_BINARY | O_RDONLY, 0);
+ if (file < 0) {
+ return NULL;
+ }
+
+ size = BLI_file_descriptor_size(file);
+ if (size < 1) {
+ close(file);
+ return NULL;
+ }
+
+ mem = MEM_mallocN(size, "movieclip prefetch memory file");
+
+ if (read(file, mem, size) != size) {
+ close(file);
+ MEM_freeN(mem);
+ return NULL;
+ }
+
+ *size_r = size;
+
+ close(file);
+
+ return mem;
+}
+
+/* find first uncached frame within prefetching frame range */
+static int prefetch_find_uncached_frame(MovieClip *clip, int from_frame, int end_frame,
+ short render_size, short render_flag)
+{
+ int current_frame;
+
+ for (current_frame = from_frame; current_frame <= end_frame; current_frame++) {
+ MovieClipUser user = {0};
+
+ user.framenr = current_frame;
+ user.render_size = render_size;
+ user.render_flag = render_flag;
+
+ if (!BKE_movieclip_has_cached_frame(clip, &user))
+ break;
+ }
+
+ return current_frame;
+}
+
+/* get memory buffer for first uncached frame within prefetch frame range */
+static unsigned char *prefetch_thread_next_frame(PrefetchQueue *queue, MovieClip *clip,
+ size_t *size_r, int *current_frame_r)
+{
+ unsigned char *mem = NULL;
+
+ BLI_spin_lock(&queue->spin);
+ if (!*queue->stop && queue->current_frame <= queue->end_frame && check_prefetch_allowed()) {
+ int current_frame;
+ current_frame = prefetch_find_uncached_frame(clip, queue->current_frame + 1, queue->end_frame,
+ queue->render_size, queue->render_flag);
+
+ if (current_frame <= queue->end_frame) {
+ mem = prefetch_read_file_to_memory(clip, current_frame, queue->render_size,
+ queue->render_flag, size_r);
+
+ *current_frame_r = current_frame;
+
+ queue->current_frame = current_frame;
+
+ *queue->do_update = 1;
+ *queue->progress = (float)(queue->current_frame - queue->start_frame) /
+ (queue->end_frame - queue->start_frame);
+ }
+ }
+ BLI_spin_unlock(&queue->spin);
+
+ return mem;
+}
+
+static void *do_prefetch_thread(void *data_v)
+{
+ PrefetchThread *data = (PrefetchThread *) data_v;
+ unsigned char *mem;
+ size_t size;
+ int current_frame;
+
+ while ((mem = prefetch_thread_next_frame(data->queue, data->clip, &size, &current_frame))) {
+ ImBuf *ibuf;
+ MovieClipUser user = {0};
+ int flag = IB_rect | IB_alphamode_detect;
+ int result;
+
+ user.framenr = current_frame;
+ user.render_size = data->queue->render_size;
+ user.render_flag = data->queue->render_flag;
+
+ ibuf = IMB_ibImageFromMemory(mem, size, flag, NULL, "prefetch frame");
+
+ result = BKE_movieclip_put_frame_if_possible(data->clip, &user, ibuf);
+
+ IMB_freeImBuf(ibuf);
+
+ MEM_freeN(mem);
+
+ if (!result) {
+ /* no more space in the cache, stop reading frames */
+ *data->queue->stop = 1;
+ break;
+ }
+ }
+
+ return NULL;
+}
+
+static void start_prefetch_threads(MovieClip *clip, int start_frame, int end_frame, short render_size,
+ short render_flag, short *stop, short *do_update, float *progress)
+{
+ ListBase threads;
+ PrefetchQueue queue;
+ PrefetchThread *handles;
+ int tot_thread = BLI_system_thread_count();
+ int i;
+
+ /* reserve one thread for the interface */
+ if (tot_thread > 1)
+ tot_thread--;
+
+ /* initialize queue */
+ BLI_spin_init(&queue.spin);
+
+ queue.current_frame = start_frame;
+ queue.start_frame = start_frame;
+ queue.end_frame = end_frame;
+ queue.render_size = render_size;
+ queue.render_flag = render_flag;
+
+ queue.stop = stop;
+ queue.do_update = do_update;
+ queue.progress = progress;
+
+ /* fill in thread handles */
+ handles = MEM_callocN(sizeof(PrefetchThread) * tot_thread, "prefetch threaded handles");
+
+ if (tot_thread > 1)
+ BLI_init_threads(&threads, do_prefetch_thread, tot_thread);
+
+ for (i = 0; i < tot_thread; i++) {
+ PrefetchThread *handle = &handles[i];
+
+ handle->clip = clip;
+ handle->queue = &queue;
+
+ if (tot_thread > 1)
+ BLI_insert_thread(&threads, handle);
+ }
+
+ /* run the threads */
+ if (tot_thread > 1)
+ BLI_end_threads(&threads);
+ else
+ do_prefetch_thread(handles);
+
+ MEM_freeN(handles);
+}
+
+static void do_prefetch_movie(MovieClip *clip, int start_frame, int end_frame, short render_size,
+ short render_flag, short *stop, short *do_update, float *progress)
+{
+ int current_frame;
+
+ for (current_frame = start_frame; current_frame <= end_frame; current_frame++) {
+ MovieClipUser user = {0};
+ ImBuf *ibuf;
+
+ if (!check_prefetch_allowed() || *stop)
+ break;
+
+ user.framenr = current_frame;
+ user.render_size = render_size;
+ user.render_flag = render_flag;
+
+ if (!BKE_movieclip_has_cached_frame(clip, &user)) {
+ ibuf = BKE_movieclip_anim_ibuf_for_frame(clip, &user);
+
+ if (ibuf) {
+ int result;
+
+ result = BKE_movieclip_put_frame_if_possible(clip, &user, ibuf);
+
+ if (!result) {
+ /* no more space in the cache, we could stop prefetching here */
+ *stop = 1;
+ }
+
+ IMB_freeImBuf(ibuf);
+ }
+ else {
+ /* error reading frame, fair enough stop attempting further reading */
+ *stop = 1;
+ }
+ }
+
+ *do_update = 1;
+ *progress = (float)(current_frame - start_frame) / (end_frame - start_frame);
+ }
+}
+
+static void prefetch_startjob(void *pjv, short *stop, short *do_update, float *progress)
+{
+ PrefetchJob *pj = pjv;
+
+ if (pj->clip->source == MCLIP_SRC_SEQUENCE) {
+ /* read sequence files in multiple threads */
+ start_prefetch_threads(pj->clip, pj->start_frame, pj->end_frame,
+ pj->render_size, pj->render_flag,
+ stop, do_update, progress);
+ }
+ else if (pj->clip->source == MCLIP_SRC_MOVIE) {
+ /* read movie in a single thread */
+ do_prefetch_movie(pj->clip, pj->start_frame, pj->end_frame,
+ pj->render_size, pj->render_flag,
+ stop, do_update, progress);
+ }
+ else {
+ BLI_assert(!"Unknown movie clip source when prefetching frames");
+ }
+}
+
+static void prefetch_freejob(void *pjv)
+{
+ PrefetchJob *pj = pjv;
+
+ MEM_freeN(pj);
+}
+
+static int prefetch_get_final_frame(const bContext *C)
+{
+ Scene *scene = CTX_data_scene(C);
+ SpaceClip *sc = CTX_wm_space_clip(C);
+ MovieClip *clip = ED_space_clip_get_clip(sc);
+ int end_frame;
+
+ /* check whether all the frames from prefetch range are cached */
+ end_frame = EFRA;
+
+ if (clip->len)
+ end_frame = min_ii(end_frame, clip->len);
+
+ return end_frame;
+}
+
+/* returns true if early out is possible */
+static bool prefetch_check_early_out(const bContext *C)
+{
+ SpaceClip *sc = CTX_wm_space_clip(C);
+ MovieClip *clip = ED_space_clip_get_clip(sc);
+ int first_uncached_frame, end_frame;
+ int clip_len;
+
+ if (clip->prefetch_ok)
+ return true;
+
+ clip_len = BKE_movieclip_get_duration(clip);
+
+ /* check whether all the frames from prefetch range are cached */
+ end_frame = prefetch_get_final_frame(C);
+
+ first_uncached_frame =
+ prefetch_find_uncached_frame(clip, sc->user.framenr, end_frame,
+ sc->user.render_size, sc->user.render_flag);
+
+ if (first_uncached_frame > end_frame || first_uncached_frame == clip_len)
+ return true;
+
+ return false;
+}
+
+void clip_start_prefetch_job(const bContext *C)
+{
+ wmJob *wm_job;
+ PrefetchJob *pj;
+ SpaceClip *sc = CTX_wm_space_clip(C);
+ MovieClip *clip = ED_space_clip_get_clip(sc);
+
+ if (prefetch_check_early_out(C))
+ return;
+
+ wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), CTX_wm_area(C), "Prefetching",
+ WM_JOB_PROGRESS, WM_JOB_TYPE_CLIP_PREFETCH);
+
+ if (WM_jobs_is_running(wm_job)) {
+ /* if job is already running, it'll call clip editor redraw when
+ * it's finished, so cache line is nicely updated
+ * this will also trigger call of this function, which will ensure
+ * all needed frames are prefetched
+ */
+ return;
+ }
+
+ clip->prefetch_ok = true;
+
+ /* create new job */
+ pj = MEM_callocN(sizeof(PrefetchJob), "prefetch job");
+ pj->clip = ED_space_clip_get_clip(sc);
+ pj->start_frame = sc->user.framenr;
+ pj->end_frame = prefetch_get_final_frame(C);
+ pj->render_size = sc->user.render_size;
+ pj->render_flag = sc->user.render_flag;
+
+ WM_jobs_customdata_set(wm_job, pj, prefetch_freejob);
+ WM_jobs_timer(wm_job, 0.2, NC_MOVIECLIP, 0);
+ WM_jobs_callbacks(wm_job, prefetch_startjob, NULL, NULL, NULL);
+
+ /* and finally start the job */
+ WM_jobs_start(CTX_wm_manager(C), wm_job);
+}
diff --git a/source/blender/editors/space_clip/clip_intern.h b/source/blender/editors/space_clip/clip_intern.h
index cd7da4229d2..99222ec63ac 100644
--- a/source/blender/editors/space_clip/clip_intern.h
+++ b/source/blender/editors/space_clip/clip_intern.h
@@ -74,6 +74,9 @@ void clip_draw_main(const struct bContext *C, struct SpaceClip *sc, struct ARegi
void clip_draw_grease_pencil(struct bContext *C, int onlyv2d);
void clip_draw_curfra_label(const int framenr, const float x, const float y);
+/* clip_editor.c */
+void clip_start_prefetch_job(const struct bContext *C);
+
/* clip_graph_draw.c */
void clip_draw_graph(struct SpaceClip *sc, struct ARegion *ar, struct Scene *scene);
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index 914eb9526a8..8e03691e64f 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -1064,11 +1064,14 @@ static unsigned char *proxy_thread_next_frame(ProxyQueue *queue, MovieClip *clip
BLI_spin_lock(&queue->spin);
if (!*queue->stop && queue->cfra <= queue->efra) {
+ MovieClipUser user = {0};
char name[FILE_MAX];
size_t size;
int file;
- BKE_movieclip_filename_for_frame(clip, queue->cfra, name);
+ user.framenr = queue->cfra;
+
+ BKE_movieclip_filename_for_frame(clip, &user, name);
file = open(name, O_BINARY | O_RDONLY, 0);
if (file < 0) {
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index 4f9757a6640..ced19020034 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -236,6 +236,16 @@ static void clip_stabilization_tag_refresh(ScrArea *sa)
}
}
+static void clip_prefetch_tag_refresh(ScrArea *sa)
+{
+ SpaceClip *sc = (SpaceClip *) sa->spacedata.first;
+ MovieClip *clip = ED_space_clip_get_clip(sc);
+
+ if (clip) {
+ clip->prefetch_ok = FALSE;
+ }
+}
+
/* ******************** default callbacks for clip space ***************** */
static SpaceLink *clip_new(const bContext *C)
@@ -351,6 +361,7 @@ static void clip_listener(ScrArea *sa, wmNotifier *wmn)
switch (wmn->data) {
case ND_FRAME:
clip_scopes_tag_refresh(sa);
+ clip_prefetch_tag_refresh(sa);
/* no break! */
case ND_FRAME_RANGE:
@@ -359,11 +370,19 @@ static void clip_listener(ScrArea *sa, wmNotifier *wmn)
}
break;
case NC_MOVIECLIP:
+ if (wmn->data == 0 && wmn->action == 0) {
+ /* a nit funky, happens from prefetch job to update
+ * cache line and job progress
+ */
+ ED_area_tag_redraw(sa);
+ }
+
switch (wmn->data) {
case ND_DISPLAY:
case ND_SELECT:
clip_scopes_tag_refresh(sa);
ED_area_tag_redraw(sa);
+ clip_prefetch_tag_refresh(sa);
break;
}
switch (wmn->action) {
@@ -407,6 +426,7 @@ static void clip_listener(ScrArea *sa, wmNotifier *wmn)
case NC_SCREEN:
switch (wmn->data) {
case ND_ANIMPLAY:
+ clip_prefetch_tag_refresh(sa);
ED_area_tag_redraw(sa);
break;
}
@@ -415,6 +435,7 @@ static void clip_listener(ScrArea *sa, wmNotifier *wmn)
if (wmn->data == ND_SPACE_CLIP) {
clip_scopes_tag_refresh(sa);
clip_stabilization_tag_refresh(sa);
+ clip_prefetch_tag_refresh(sa);
ED_area_tag_redraw(sa);
}
break;
@@ -424,6 +445,10 @@ static void clip_listener(ScrArea *sa, wmNotifier *wmn)
ED_area_tag_redraw(sa);
}
break;
+ case NC_WM:
+ if (wmn->data == ND_FILEREAD)
+ clip_prefetch_tag_refresh(sa);
+ break;
}
}
diff --git a/source/blender/editors/space_console/console_intern.h b/source/blender/editors/space_console/console_intern.h
index 1e79e4b9714..00f1f8c21c9 100644
--- a/source/blender/editors/space_console/console_intern.h
+++ b/source/blender/editors/space_console/console_intern.h
@@ -45,8 +45,8 @@ void console_scrollback_prompt_end(struct SpaceConsole *sc, ConsoleLine *cl_dumm
/* console_ops.c */
void console_history_free(SpaceConsole *sc, ConsoleLine *cl);
void console_scrollback_free(SpaceConsole *sc, ConsoleLine *cl);
-ConsoleLine *console_history_add_str(struct SpaceConsole *sc, char *str, int own);
-ConsoleLine *console_scrollback_add_str(struct SpaceConsole *sc, char *str, int own);
+ConsoleLine *console_history_add_str(struct SpaceConsole *sc, char *str, bool own);
+ConsoleLine *console_scrollback_add_str(struct SpaceConsole *sc, char *str, bool own);
ConsoleLine *console_history_verify(const struct bContext *C);
diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c
index b735dee5bdf..74f776549e9 100644
--- a/source/blender/editors/space_console/console_ops.c
+++ b/source/blender/editors/space_console/console_ops.c
@@ -116,7 +116,7 @@ static ConsoleLine *console_history_find(SpaceConsole *sc, const char *str, Cons
}
/* return 0 if no change made, clamps the range */
-static int console_line_cursor_set(ConsoleLine *cl, int cursor)
+static bool console_line_cursor_set(ConsoleLine *cl, int cursor)
{
int cursor_new;
@@ -125,11 +125,11 @@ static int console_line_cursor_set(ConsoleLine *cl, int cursor)
else cursor_new = cursor;
if (cursor_new == cl->cursor) {
- return FALSE;
+ return false;
}
cl->cursor = cursor_new;
- return TRUE;
+ return true;
}
#if 0 // XXX unused
@@ -188,7 +188,7 @@ static ConsoleLine *console_scrollback_add(const bContext *C, ConsoleLine *from)
}
#endif
-static ConsoleLine *console_lb_add_str__internal(ListBase *lb, char *str, int own)
+static ConsoleLine *console_lb_add_str__internal(ListBase *lb, char *str, bool own)
{
ConsoleLine *ci = MEM_callocN(sizeof(ConsoleLine), "ConsoleLine Add");
if (own) ci->line = str;
@@ -199,11 +199,11 @@ static ConsoleLine *console_lb_add_str__internal(ListBase *lb, char *str, int ow
BLI_addtail(lb, ci);
return ci;
}
-ConsoleLine *console_history_add_str(SpaceConsole *sc, char *str, int own)
+ConsoleLine *console_history_add_str(SpaceConsole *sc, char *str, bool own)
{
return console_lb_add_str__internal(&sc->history, str, own);
}
-ConsoleLine *console_scrollback_add_str(SpaceConsole *sc, char *str, int own)
+ConsoleLine *console_scrollback_add_str(SpaceConsole *sc, char *str, bool own)
{
ConsoleLine *ci = console_lb_add_str__internal(&sc->scrollback, str, own);
console_select_offset(sc, ci->len + 1);
@@ -276,7 +276,7 @@ static int console_move_exec(bContext *C, wmOperator *op)
ConsoleLine *ci = console_history_verify(C);
int type = RNA_enum_get(op->ptr, "type");
- int done = FALSE;
+ bool done = false;
int pos;
switch (type) {
diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c
index a159c88221e..9a7f528be78 100644
--- a/source/blender/editors/space_file/file_panels.c
+++ b/source/blender/editors/space_file/file_panels.c
@@ -190,12 +190,12 @@ static void file_panel_operator_header(const bContext *C, Panel *pa)
BLI_strncpy(pa->drawname, RNA_struct_ui_name(op->type->srna), sizeof(pa->drawname));
}
-static int file_panel_check_prop(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
+static bool file_panel_check_prop(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
{
const char *prop_id = RNA_property_identifier(prop);
- return !(strcmp(prop_id, "filepath") == 0 ||
- strcmp(prop_id, "directory") == 0 ||
- strcmp(prop_id, "filename") == 0
+ return !(STREQ(prop_id, "filepath") ||
+ STREQ(prop_id, "directory") ||
+ STREQ(prop_id, "filename")
);
}
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index 256c90a1f1a..bdf93b98f22 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -712,7 +712,7 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2
v1[1] = prevbezt->vec[1][1];
v2[0] = prevbezt->vec[2][0];
v2[1] = prevbezt->vec[2][1];
-
+
v3[0] = bezt->vec[0][0];
v3[1] = bezt->vec[0][1];
v4[0] = bezt->vec[1][0];
@@ -772,6 +772,111 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2
glEnd();
}
+/* Debugging -------------------------------- */
+
+/* Draw indicators which show the value calculated from the driver,
+ * and how this is mapped to the value that comes out of it. This
+ * is handy for helping users better understand how to interpret
+ * the graphs, and also facilitates debugging.
+ */
+static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu)
+{
+ ChannelDriver *driver = fcu->driver;
+ View2D *v2d = &ac->ar->v2d;
+ float unitfac = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, false);
+
+ /* for now, only show when debugging driver... */
+ //if ((driver->flag & DRIVER_FLAG_SHOWDEBUG) == 0)
+ // return;
+
+ /* No curve to modify/visualise the result?
+ * => We still want to show the 1-1 default...
+ */
+ if ((fcu->totvert == 0) && (fcu->modifiers.first == NULL)) {
+ float t;
+
+ /* draw with thin dotted lines in style of what curve would have been */
+ glColor3fv(fcu->color);
+
+ setlinestyle(20);
+ glLineWidth(2.0f);
+
+ /* draw 1-1 line, stretching just past the screen limits
+ * NOTE: we need to scale the y-values to be valid for the units
+ */
+ glBegin(GL_LINES);
+ t = v2d->cur.xmin;
+ glVertex2f(t, t * unitfac);
+
+ t = v2d->cur.xmax;
+ glVertex2f(t, t * unitfac);
+ glEnd();
+
+ /* cleanup line drawing */
+ setlinestyle(0);
+ glLineWidth(1.0f);
+ }
+
+ /* draw driver only if actually functional */
+ if ((driver->flag & DRIVER_FLAG_INVALID) == 0) {
+ /* grab "coordinates" for driver outputs */
+ float x = driver->curval;
+ float y = fcu->curval * unitfac;
+
+ /* only draw indicators if the point is in range*/
+ if (x >= v2d->cur.xmin) {
+ float co[2];
+
+ /* draw dotted lines leading towards this point from both axes ....... */
+ glColor3f(0.9f, 0.9f, 0.9f);
+ setlinestyle(5);
+
+ glBegin(GL_LINES);
+ /* x-axis lookup */
+ co[0] = x;
+
+ if (y >= v2d->cur.ymin) {
+ co[1] = v2d->cur.ymin - 1.0f;
+ glVertex2fv(co);
+
+ co[1] = y;
+ glVertex2fv(co);
+ }
+
+ /* y-axis lookup */
+ co[1] = y;
+
+ co[0] = v2d->cur.xmin - 1.0f;
+ glVertex2fv(co);
+
+ co[0] = x;
+ glVertex2fv(co);
+ glEnd();
+
+ setlinestyle(0);
+
+ /* x marks the spot .................................................... */
+ /* -> outer frame */
+ glColor3f(0.9f, 0.9f, 0.9f);
+ glPointSize(7.0);
+
+ glBegin(GL_POINTS);
+ glVertex2f(x, y);
+ glEnd();
+
+ /* inner frame */
+ glColor3f(0.9f, 0.0f, 0.0f);
+ glPointSize(3.0);
+
+ glBegin(GL_POINTS);
+ glVertex2f(x, y);
+ glEnd();
+
+ glPointSize(1.0f);
+ }
+ }
+}
+
/* Public Curve-Drawing API ---------------- */
/* Draw the 'ghost' F-Curves (i.e. snapshots of the curve)
@@ -934,6 +1039,11 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid
}
}
+ /* 3) draw driver debugging stuff */
+ if ((ac->datatype == ANIMCONT_DRIVERS) && (fcu->flag & FCURVE_ACTIVE)) {
+ graph_draw_driver_debug(ac, ale->id, fcu);
+ }
+
/* undo mapping of keyframes for drawing if scaled F-Curve */
if (adt)
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 0);
diff --git a/source/blender/editors/space_graph/graph_intern.h b/source/blender/editors/space_graph/graph_intern.h
index b2dbf764c1d..8dc5e9a441d 100644
--- a/source/blender/editors/space_graph/graph_intern.h
+++ b/source/blender/editors/space_graph/graph_intern.h
@@ -69,19 +69,19 @@ void GRAPH_OT_select_leftright(struct wmOperatorType *ot);
void GRAPH_OT_clickselect(struct wmOperatorType *ot);
/* defines for left-right select tool */
-enum {
+enum eGraphKeys_LeftRightSelect_Mode {
GRAPHKEYS_LRSEL_TEST = 0,
GRAPHKEYS_LRSEL_LEFT,
GRAPHKEYS_LRSEL_RIGHT
-} eGraphKeys_LeftRightSelect_Mode;
+};
/* defines for column-select mode */
-enum {
+enum eGraphKeys_ColumnSelect_Mode {
GRAPHKEYS_COLUMNSEL_KEYS = 0,
GRAPHKEYS_COLUMNSEL_CFRA,
GRAPHKEYS_COLUMNSEL_MARKERS_COLUMN,
GRAPHKEYS_COLUMNSEL_MARKERS_BETWEEN,
-} eGraphKeys_ColumnSelect_Mode;
+};
/* ***************************************** */
/* graph_edit.c */
@@ -119,25 +119,25 @@ void GRAPH_OT_mirror(struct wmOperatorType *ot);
/* defines for snap keyframes
* NOTE: keep in sync with eEditKeyframes_Snap (in ED_keyframes_edit.h)
*/
-enum {
+enum eGraphKeys_Snap_Mode {
GRAPHKEYS_SNAP_CFRA = 1,
GRAPHKEYS_SNAP_NEAREST_FRAME,
GRAPHKEYS_SNAP_NEAREST_SECOND,
GRAPHKEYS_SNAP_NEAREST_MARKER,
GRAPHKEYS_SNAP_HORIZONTAL,
GRAPHKEYS_SNAP_VALUE,
-} eGraphKeys_Snap_Mode;
+};
/* defines for mirror keyframes
* NOTE: keep in sync with eEditKeyframes_Mirror (in ED_keyframes_edit.h)
*/
-enum {
+enum eGraphKeys_Mirror_Mode {
GRAPHKEYS_MIRROR_CFRA = 1,
GRAPHKEYS_MIRROR_YAXIS,
GRAPHKEYS_MIRROR_XAXIS,
GRAPHKEYS_MIRROR_MARKER,
GRAPHKEYS_MIRROR_VALUE,
-} eGraphKeys_Mirror_Mode;
+};
/* ----------- */
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 7c016cdf3bf..7e0767bfcfb 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -1483,15 +1483,15 @@ static int image_save_as_cancel(bContext *UNUSED(C), wmOperator *op)
return OPERATOR_CANCELLED;
}
-static int image_save_as_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop)
+static bool image_save_as_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop)
{
const char *prop_id = RNA_property_identifier(prop);
- return !(strcmp(prop_id, "filepath") == 0 ||
- strcmp(prop_id, "directory") == 0 ||
- strcmp(prop_id, "filename") == 0 ||
+ return !(STREQ(prop_id, "filepath") ||
+ STREQ(prop_id, "directory") ||
+ STREQ(prop_id, "filename") ||
/* when saving a copy, relative path has no effect */
- ((strcmp(prop_id, "relative_path") == 0) && RNA_boolean_get(ptr, "copy"))
+ ((STREQ(prop_id, "relative_path")) && RNA_boolean_get(ptr, "copy"))
);
}
diff --git a/source/blender/editors/space_nla/nla_intern.h b/source/blender/editors/space_nla/nla_intern.h
index 450b85738ad..98c66d70a75 100644
--- a/source/blender/editors/space_nla/nla_intern.h
+++ b/source/blender/editors/space_nla/nla_intern.h
@@ -54,12 +54,12 @@ void draw_nla_channel_list(bContext *C, bAnimContext *ac, ARegion *ar);
/* nla_select.c */
/* defines for left-right select tool */
-enum {
+enum eNlaEdit_LeftRightSelect_Mode {
NLAEDIT_LRSEL_TEST = -1,
NLAEDIT_LRSEL_NONE,
NLAEDIT_LRSEL_LEFT,
NLAEDIT_LRSEL_RIGHT
-} eNlaEdit_LeftRightSelect_Mode;
+};
/* --- */
@@ -73,12 +73,12 @@ void NLA_OT_click_select(wmOperatorType *ot);
/* defines for snap strips
*/
-enum {
+enum eNlaEdit_Snap_Mode {
NLAEDIT_SNAP_CFRA = 1,
NLAEDIT_SNAP_NEAREST_FRAME,
NLAEDIT_SNAP_NEAREST_SECOND,
NLAEDIT_SNAP_NEAREST_MARKER
-} eNlaEdit_Snap_Mode;
+};
/* --- */
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 0b02aef2fab..a413eb47140 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -114,18 +114,18 @@ static void node_add_menu_class(bContext *C, uiLayout *layout, void *arg_nodecla
continue;
switch (ntree->type) {
- case NTREE_COMPOSIT:
- ngroup_type = "CompositorNodeTree";
- node_type = "CompositorNodeGroup";
- break;
- case NTREE_SHADER:
- ngroup_type = "ShaderNodeTree";
- node_type = "ShaderNodeGroup";
- break;
- case NTREE_TEXTURE:
- ngroup_type = "TextureNodeTree";
- node_type = "TextureNodeGroup";
- break;
+ case NTREE_COMPOSIT:
+ ngroup_type = "CompositorNodeTree";
+ node_type = "CompositorNodeGroup";
+ break;
+ case NTREE_SHADER:
+ ngroup_type = "ShaderNodeTree";
+ node_type = "ShaderNodeGroup";
+ break;
+ case NTREE_TEXTURE:
+ ngroup_type = "TextureNodeTree";
+ node_type = "TextureNodeGroup";
+ break;
}
ptr = uiItemFullO(layout, "NODE_OT_group_make", "New Group", ntype->ui_icon, NULL, WM_OP_INVOKE_DEFAULT, UI_ITEM_O_RETURN_PROPS);
@@ -1165,7 +1165,7 @@ static void node_composit_buts_renderlayers(uiLayout *layout, bContext *C, Point
if (!node->id) return;
col = uiLayoutColumn(layout, FALSE);
- row = uiLayoutRow(col, FALSE);
+ row = uiLayoutRow(col, TRUE);
uiItemR(row, ptr, "layer", 0, "", ICON_NONE);
prop = RNA_struct_find_property(ptr, "layer");
@@ -2708,8 +2708,57 @@ static void node_template_properties_update(bNodeType *ntype)
}
}
+static void node_socket_undefined_draw(bContext *UNUSED(C), uiLayout *layout, PointerRNA *UNUSED(ptr), PointerRNA *UNUSED(node_ptr))
+{
+ uiItemL(layout, "Undefined Socket Type", ICON_ERROR);
+}
+
+static void node_socket_undefined_draw_color(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PointerRNA *UNUSED(node_ptr), float *r_color)
+{
+ r_color[0] = 1.0f;
+ r_color[1] = 0.0f;
+ r_color[2] = 0.0f;
+ r_color[3] = 1.0f;
+}
+
+static void node_socket_undefined_interface_draw(bContext *UNUSED(C), uiLayout *layout, PointerRNA *UNUSED(ptr))
+{
+ uiItemL(layout, "Undefined Socket Type", ICON_ERROR);
+}
+
+static void node_socket_undefined_interface_draw_color(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), float *r_color)
+{
+ r_color[0] = 1.0f;
+ r_color[1] = 0.0f;
+ r_color[2] = 0.0f;
+ r_color[3] = 1.0f;
+}
+
void ED_node_init_butfuncs(void)
{
+ /* Fallback types for undefined tree, nodes, sockets
+ * Defined in blenkernel, but not registered in type hashes.
+ */
+ /*extern bNodeTreeType NodeTreeTypeUndefined;*/
+ extern bNodeType NodeTypeUndefined;
+ extern bNodeSocketType NodeSocketTypeUndefined;
+
+ /* default ui functions */
+ NodeTypeUndefined.drawfunc = node_draw_default;
+ NodeTypeUndefined.drawupdatefunc = node_update_default;
+ NodeTypeUndefined.select_area_func = node_select_area_default;
+ NodeTypeUndefined.tweak_area_func = node_tweak_area_default;
+ NodeTypeUndefined.uifunc = NULL;
+ NodeTypeUndefined.uifuncbut = NULL;
+ NodeTypeUndefined.drawinputfunc = node_draw_input_default;
+ NodeTypeUndefined.drawoutputfunc = node_draw_output_default;
+ NodeTypeUndefined.resize_area_func = node_resize_area_default;
+
+ NodeSocketTypeUndefined.draw = node_socket_undefined_draw;
+ NodeSocketTypeUndefined.draw_color = node_socket_undefined_draw_color;
+ NodeSocketTypeUndefined.interface_draw = node_socket_undefined_interface_draw;
+ NodeSocketTypeUndefined.interface_draw_color = node_socket_undefined_interface_draw_color;
+
/* node type ui functions */
NODE_TYPES_BEGIN(ntype)
/* default ui functions */
@@ -2762,14 +2811,14 @@ void ED_init_custom_node_socket_type(bNodeSocketType *stype)
/* maps standard socket integer type to a color */
static const float std_node_socket_colors[][4] = {
- {0.63, 0.63, 0.63, 1.0}, /* SOCK_FLOAT */
- {0.39, 0.39, 0.78, 1.0}, /* SOCK_VECTOR */
- {0.78, 0.78, 0.16, 1.0}, /* SOCK_RGBA */
- {0.39, 0.78, 0.39, 1.0}, /* SOCK_SHADER */
- {0.70, 0.65, 0.19, 1.0}, /* SOCK_BOOLEAN */
- {0.0, 0.0, 0.0, 1.0}, /*__SOCK_MESH (deprecated) */
- {0.06, 0.52, 0.15, 1.0}, /* SOCK_INT */
- {1.0, 1.0, 1.0, 1.0}, /* SOCK_STRING */
+ {0.63, 0.63, 0.63, 1.0}, /* SOCK_FLOAT */
+ {0.39, 0.39, 0.78, 1.0}, /* SOCK_VECTOR */
+ {0.78, 0.78, 0.16, 1.0}, /* SOCK_RGBA */
+ {0.39, 0.78, 0.39, 1.0}, /* SOCK_SHADER */
+ {0.70, 0.65, 0.19, 1.0}, /* SOCK_BOOLEAN */
+ {0.0, 0.0, 0.0, 1.0}, /*__SOCK_MESH (deprecated) */
+ {0.06, 0.52, 0.15, 1.0}, /* SOCK_INT */
+ {1.0, 1.0, 1.0, 1.0}, /* SOCK_STRING */
};
/* common color callbacks for standard types */
@@ -2786,7 +2835,7 @@ static void std_node_socket_interface_draw_color(bContext *UNUSED(C), PointerRNA
copy_v4_v4(r_color, std_node_socket_colors[type]);
}
-static void std_node_socket_draw(bContext *UNUSED(C), uiLayout *layout, PointerRNA *ptr, PointerRNA *UNUSED(node_ptr))
+static void std_node_socket_draw(bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *node_ptr)
{
bNodeSocket *sock = ptr->data;
int type = sock->typeinfo->type;
@@ -2816,6 +2865,10 @@ static void std_node_socket_draw(bContext *UNUSED(C), uiLayout *layout, PointerR
uiItemL(row, sock->name, 0);
break;
}
+
+ default:
+ node_socket_button_label(C, layout, ptr, node_ptr);
+ break;
}
}
@@ -2911,7 +2964,7 @@ void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glPixelZoom(snode->zoom, snode->zoom);
- glaDrawPixelsAuto(x, y, ibuf->x, ibuf->y, GL_UNSIGNED_BYTE, GL_LINEAR, display_buffer);
+ glaDrawPixelsAuto(x, y, ibuf->x, ibuf->y, GL_UNSIGNED_BYTE, GL_NEAREST, display_buffer);
glPixelZoom(1.0f, 1.0f);
glDisable(GL_BLEND);
@@ -2919,7 +2972,7 @@ void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode)
else {
glPixelZoom(snode->zoom, snode->zoom);
- glaDrawPixelsAuto(x, y, ibuf->x, ibuf->y, GL_UNSIGNED_BYTE, GL_LINEAR, display_buffer);
+ glaDrawPixelsAuto(x, y, ibuf->x, ibuf->y, GL_UNSIGNED_BYTE, GL_NEAREST, display_buffer);
glPixelZoom(1.0f, 1.0f);
}
diff --git a/source/blender/editors/space_node/node_add.c b/source/blender/editors/space_node/node_add.c
index 765f2b67549..fb9e1221c38 100644
--- a/source/blender/editors/space_node/node_add.c
+++ b/source/blender/editors/space_node/node_add.c
@@ -110,6 +110,9 @@ bNode *node_add_node(const bContext *C, const char *idname, int type, float locx
if (node->id)
id_us_plus(node->id);
+ if (snode->flag & SNODE_USE_HIDDEN_PREVIEW)
+ node->flag &= ~NODE_PREVIEW;
+
snode_update(snode, node);
if (snode->nodetree->type == NTREE_TEXTURE) {
diff --git a/source/blender/editors/space_node/node_buttons.c b/source/blender/editors/space_node/node_buttons.c
index 688377c7f3b..efdb7c0d85d 100644
--- a/source/blender/editors/space_node/node_buttons.c
+++ b/source/blender/editors/space_node/node_buttons.c
@@ -62,7 +62,7 @@ static int active_nodetree_poll(const bContext *C, PanelType *UNUSED(pt))
{
SpaceNode *snode = CTX_wm_space_node(C);
- return (snode && ntreeIsValid(snode->nodetree));
+ return (snode && snode->nodetree);
}
/* poll callback for active node */
@@ -70,7 +70,7 @@ static int active_node_poll(const bContext *C, PanelType *UNUSED(pt))
{
SpaceNode *snode = CTX_wm_space_node(C);
- return (snode && ntreeIsValid(snode->edittree) && nodeGetActive(snode->edittree));
+ return (snode && snode->edittree && nodeGetActive(snode->edittree));
}
/* active node */
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 0636dee9bc5..f1915a82f69 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -148,7 +148,7 @@ static int has_nodetree(bNodeTree *ntree, bNodeTree *lookup)
void ED_node_tag_update_nodetree(Main *bmain, bNodeTree *ntree)
{
- if (!ntreeIsValid(ntree))
+ if (!ntree)
return;
/* look through all datablocks, to support groups */
@@ -359,7 +359,10 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
nsock->locx = locx + NODE_WIDTH(node);
/* place the socket circle in the middle of the layout */
nsock->locy = 0.5f * (dy + buty);
+
dy = buty;
+ if (nsock->next)
+ dy -= NODE_SOCKDY;
}
node->prvr.xmin = locx + NODE_DYS;
@@ -443,7 +446,10 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
nsock->locx = locx;
/* place the socket circle in the middle of the layout */
nsock->locy = 0.5f * (dy + buty);
+
dy = buty;
+ if (nsock->next)
+ dy -= NODE_SOCKDY;
}
/* little bit space in end */
@@ -861,7 +867,9 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
NULL, 0, 0, 0, 0, "");
/* body */
- if (node->flag & NODE_CUSTOM_COLOR)
+ if (!nodeIsRegistered(node))
+ UI_ThemeColor4(TH_REDALERT); /* use warning color to indicate undefined types */
+ else if (node->flag & NODE_CUSTOM_COLOR)
glColor3fv(node->color);
else
UI_ThemeColor4(TH_NODE);
@@ -967,7 +975,19 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
}
-
+
+ /* custom color inline */
+ if (node->flag & NODE_CUSTOM_COLOR) {
+ glEnable(GL_BLEND);
+ glEnable(GL_LINE_SMOOTH);
+
+ glColor3fv(node->color);
+ uiDrawBox(GL_LINE_LOOP, rct->xmin + 1, rct->ymin + 1, rct->xmax -1, rct->ymax - 1, hiddenrad);
+
+ glDisable(GL_LINE_SMOOTH);
+ glDisable(GL_BLEND);
+ }
+
/* title */
if (node->flag & SELECT)
UI_ThemeColor(TH_SELECT);
@@ -1057,7 +1077,7 @@ void node_set_cursor(wmWindow *win, SpaceNode *snode)
bNodeSocket *sock;
int cursor = CURSOR_STD;
- if (ntreeIsValid(ntree)) {
+ if (ntree) {
if (node_find_indicated_socket(snode, &node, &sock, SOCK_IN | SOCK_OUT)) {
/* pass */
}
@@ -1112,7 +1132,6 @@ static void node_draw(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeTre
void node_draw_nodetree(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeTree *ntree, bNodeInstanceKey parent_key)
{
bNode *node;
- bNodeInstanceKey key;
bNodeLink *link;
int a;
@@ -1126,6 +1145,7 @@ void node_draw_nodetree(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeT
/* draw background nodes, last nodes in front */
for (a = 0, node = ntree->nodes.first; node; node = node->next, a++) {
+ bNodeInstanceKey key;
#ifdef USE_DRAW_TOT_UPDATE
/* unrelated to background nodes, update the v2d->tot,
@@ -1153,7 +1173,7 @@ void node_draw_nodetree(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeT
/* draw foreground nodes, last nodes in front */
for (a = 0, node = ntree->nodes.first; node; node = node->next, a++) {
- bNodeInstanceKey key = BKE_node_instance_key(parent_key, ntree, node);
+ bNodeInstanceKey key;
if (node->flag & NODE_BACKGROUND)
continue;
@@ -1271,7 +1291,7 @@ void drawnodespace(const bContext *C, ARegion *ar)
for (curdepth = depth; curdepth >= 0; path = path->next, --curdepth) {
ntree = path->nodetree;
- if (ntreeIsValid(ntree)) {
+ if (ntree) {
snode_setup_v2d(snode, ar, ntree->view_center[0], ntree->view_center[1]);
if (curdepth == 0) {
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index 256b02d3288..c74c160080c 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -90,6 +90,11 @@
/* ***************** composite job manager ********************** */
+enum {
+ COM_RECALC_COMPOSITE = 1,
+ COM_RECALC_VIEWER = 2
+};
+
typedef struct CompoJob {
Scene *scene;
bNodeTree *ntree;
@@ -98,8 +103,55 @@ typedef struct CompoJob {
short *do_update;
float *progress;
short need_sync;
+ int recalc_flags;
} CompoJob;
+static void compo_tag_output_nodes(bNodeTree *nodetree, int recalc_flags)
+{
+ bNode *node;
+
+ for (node = nodetree->nodes.first; node; node = node->next) {
+ if (node->type == CMP_NODE_COMPOSITE) {
+ if (recalc_flags & COM_RECALC_COMPOSITE)
+ node->flag |= NODE_DO_OUTPUT_RECALC;
+ }
+ else if (node->type == CMP_NODE_VIEWER) {
+ if (recalc_flags & COM_RECALC_VIEWER)
+ node->flag |= NODE_DO_OUTPUT_RECALC;
+ }
+ else if (node->type == NODE_GROUP) {
+ if (node->id)
+ compo_tag_output_nodes((bNodeTree *)node->id, recalc_flags);
+ }
+ }
+}
+
+static int compo_get_recalc_flags(const bContext *C)
+{
+ bScreen *sc = CTX_wm_screen(C);
+ ScrArea *sa;
+ int recalc_flags = 0;
+
+ for (sa = sc->areabase.first; sa; sa = sa->next) {
+ if (sa->spacetype == SPACE_IMAGE) {
+ SpaceImage *sima = sa->spacedata.first;
+ if (sima->image) {
+ if (sima->image->type == IMA_TYPE_R_RESULT)
+ recalc_flags |= COM_RECALC_COMPOSITE;
+ else if (sima->image->type == IMA_TYPE_COMPOSITE)
+ recalc_flags |= COM_RECALC_VIEWER;
+ }
+ }
+ else if (sa->spacetype == SPACE_NODE) {
+ SpaceNode *snode = sa->spacedata.first;
+ if (snode->flag & SNODE_BACKDRAW)
+ recalc_flags |= COM_RECALC_VIEWER;
+ }
+ }
+
+ return recalc_flags;
+}
+
/* called by compo, only to check job 'stop' value */
static int compo_breakjob(void *cjv)
{
@@ -148,6 +200,9 @@ static void compo_initjob(void *cjv)
CompoJob *cj = cjv;
cj->localtree = ntreeLocalize(cj->ntree);
+
+ if (cj->recalc_flags)
+ compo_tag_output_nodes(cj->localtree, cj->recalc_flags);
}
/* called before redraw notifiers, it moves finished previews over */
@@ -234,6 +289,7 @@ void ED_node_composite_job(const bContext *C, struct bNodeTree *nodetree, Scene
/* customdata for preview thread */
cj->scene = CTX_data_scene(C);
cj->ntree = nodetree;
+ cj->recalc_flags = compo_get_recalc_flags(C);
/* setup job */
WM_jobs_customdata_set(wm_job, cj, compo_freejob);
@@ -329,15 +385,11 @@ void ED_node_shader_default(const bContext *C, ID *id)
bNode *in, *out;
bNodeSocket *fromsock, *tosock, *sock;
bNodeTree *ntree;
- PointerRNA ptr;
int output_type, shader_type;
float color[4] = { 0.0f, 0.0f, 0.0f, 1.0f }, strength = 1.0f;
ntree = ntreeAddTree(NULL, "Shader Nodetree", ntreeType_Shader->idname);
- RNA_id_pointer_create((ID *)ntree, &ptr);
- RNA_boolean_set(&ptr, "is_local_tree", TRUE);
-
switch (GS(id->name)) {
case ID_MA:
{
@@ -425,7 +477,6 @@ void ED_node_composit_default(const bContext *C, struct Scene *sce)
{
bNode *in, *out;
bNodeSocket *fromsock, *tosock;
- PointerRNA ptr;
/* but lets check it anyway */
if (sce->nodetree) {
@@ -436,9 +487,6 @@ void ED_node_composit_default(const bContext *C, struct Scene *sce)
sce->nodetree = ntreeAddTree(NULL, "Compositing Nodetree", ntreeType_Composite->idname);
- RNA_id_pointer_create((ID *)sce->nodetree, &ptr);
- RNA_boolean_set(&ptr, "is_local_tree", TRUE);
-
sce->nodetree->chunksize = 256;
sce->nodetree->edit_quality = NTREE_QUALITY_HIGH;
sce->nodetree->render_quality = NTREE_QUALITY_HIGH;
@@ -470,7 +518,6 @@ void ED_node_texture_default(const bContext *C, Tex *tx)
{
bNode *in, *out;
bNodeSocket *fromsock, *tosock;
- PointerRNA ptr;
/* but lets check it anyway */
if (tx->nodetree) {
@@ -481,9 +528,6 @@ void ED_node_texture_default(const bContext *C, Tex *tx)
tx->nodetree = ntreeAddTree(NULL, "Texture Nodetree", ntreeType_Texture->idname);
- RNA_id_pointer_create((ID *)tx->nodetree, &ptr);
- RNA_boolean_set(&ptr, "is_local_tree", TRUE);
-
out = nodeAddStaticNode(C, tx->nodetree, TEX_NODE_OUTPUT);
out->locx = 300.0f; out->locy = 300.0f;
@@ -530,11 +574,17 @@ void snode_set_context(const bContext *C)
}
if (!(snode->flag & SNODE_PIN) || ntree == NULL) {
- if (treetype->get_from_context)
+ if (treetype->get_from_context) {
+ /* reset and update from context */
+ ntree = NULL;
+ id = NULL;
+ from = NULL;
+
treetype->get_from_context(C, treetype, &ntree, &id, &from);
+ }
}
- if (snode->nodetree != ntree || snode->id != id || snode->from != snode->from) {
+ if (snode->nodetree != ntree || snode->id != id || snode->from != from) {
ED_node_tree_start(snode, ntree, id, from);
}
}
diff --git a/source/blender/editors/space_node/node_group.c b/source/blender/editors/space_node/node_group.c
index 10f9718f1b6..30ba4108143 100644
--- a/source/blender/editors/space_node/node_group.c
+++ b/source/blender/editors/space_node/node_group.c
@@ -552,7 +552,7 @@ typedef enum eNodeGroupSeparateType {
} eNodeGroupSeparateType;
/* Operator Property */
-EnumPropertyItem node_group_separate_types[] = {
+static EnumPropertyItem node_group_separate_types[] = {
{NODE_GS_COPY, "COPY", 0, "Copy", "Copy to parent node tree, keep group intact"},
{NODE_GS_MOVE, "MOVE", 0, "Move", "Move to parent node tree, remove from group"},
{0, NULL, 0, NULL, NULL}
@@ -730,7 +730,7 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree,
float min[2], max[2], center[2];
int totselect;
int expose_all = FALSE;
- bNode *input_node = NULL, *output_node = NULL; /* lazy initialized, in case there are no external links */
+ bNode *input_node, *output_node;
/* XXX rough guess, not nice but we don't have access to UI constants here ... */
static const float offsetx = 200;
@@ -797,6 +797,16 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree,
/* node groups don't use internal cached data */
ntreeFreeCache(ngroup);
+ /* create input node */
+ input_node = nodeAddStaticNode(C, ngroup, NODE_GROUP_INPUT);
+ input_node->locx = min[0] - center[0] - offsetx;
+ input_node->locy = -offsety;
+
+ /* create output node */
+ output_node = nodeAddStaticNode(C, ngroup, NODE_GROUP_OUTPUT);
+ output_node->locx = max[0] - center[0] + offsetx;
+ output_node->locy = -offsety;
+
/* relink external sockets */
for (link = ntree->links.first; link; link = linkn) {
int fromselect = node_group_make_use_node(link->fromnode, gnode);
@@ -818,13 +828,6 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree,
bNodeSocket *iosock = ntreeAddSocketInterfaceFromSocket(ngroup, link->tonode, link->tosock);
bNodeSocket *input_sock;
- /* lazy init */
- if (!input_node) {
- input_node = nodeAddStaticNode(C, ngroup, NODE_GROUP_INPUT);
-
- input_node->locx = min[0] - center[0] - offsetx;
- input_node->locy = -offsety;
- }
/* update the group node and interface node sockets,
* so the new interface socket can be linked.
*/
@@ -843,13 +846,6 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree,
bNodeSocket *iosock = ntreeAddSocketInterfaceFromSocket(ngroup, link->fromnode, link->fromsock);
bNodeSocket *output_sock;
- /* lazy init */
- if (!output_node) {
- output_node = nodeAddStaticNode(C, ngroup, NODE_GROUP_OUTPUT);
-
- output_node->locx = max[0] - center[0] + offsetx;
- output_node->locy = -offsety;
- }
/* update the group node and interface node sockets,
* so the new interface socket can be linked.
*/
@@ -892,13 +888,6 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree,
iosock = ntreeAddSocketInterfaceFromSocket(ngroup, node, sock);
- /* lazy init */
- if (!input_node) {
- input_node = nodeAddStaticNode(C, ngroup, NODE_GROUP_INPUT);
-
- input_node->locx = min[0] - center[0] - offsetx;
- input_node->locy = -offsety;
- }
node_group_input_verify(ngroup, input_node, (ID *)ngroup);
/* create new internal link */
@@ -917,14 +906,6 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree,
iosock = ntreeAddSocketInterfaceFromSocket(ngroup, node, sock);
- /* lazy init */
- if (!output_node) {
- output_node = nodeAddStaticNode(C, ngroup, NODE_GROUP_OUTPUT);
-
- output_node->locx = max[0] - center[0] + offsetx;
- output_node->locy = -offsety;
- }
-
node_group_output_verify(ngroup, output_node, (ID *)ngroup);
/* create new internal link */
diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h
index a24da7143f9..2f6090d67ce 100644
--- a/source/blender/editors/space_node/node_intern.h
+++ b/source/blender/editors/space_node/node_intern.h
@@ -230,13 +230,14 @@ extern const char *node_context_dir[];
#define BASIS_RAD (0.4f * U.widget_unit)
#define NODE_DYS (U.widget_unit / 2)
#define NODE_DY U.widget_unit
+#define NODE_SOCKDY (0.08f * U.widget_unit)
#define NODE_WIDTH(node) (node->width * UI_DPI_FAC)
#define NODE_MARGIN_X (0.75f * U.widget_unit)
#define NODE_SOCKSIZE (0.25f * U.widget_unit)
#define NODE_LINK_RESOL 12
// XXX button events (butspace)
-enum {
+enum eNodeSpace_ButEvents {
B_NOP = 0,
B_REDR = 1,
B_NODE_USEMAT,
@@ -253,6 +254,6 @@ enum {
B_MATPRV,
B_NODE_LOADIMAGE,
B_NODE_SETIMAGE,
-} eNodeSpace_ButEvents;
+};
#endif /* __NODE_INTERN_H__ */
diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.c
index 0bc2fba0d0b..527defb1f07 100644
--- a/source/blender/editors/space_node/node_templates.c
+++ b/source/blender/editors/space_node/node_templates.c
@@ -606,7 +606,7 @@ void uiTemplateNodeView(uiLayout *layout, bContext *C, bNodeTree *ntree, bNode *
{
bNode *tnode;
- if (!ntreeIsValid(ntree))
+ if (!ntree)
return;
/* clear for cycle check */
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index 2d5207e69db..2075cc055e1 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -479,7 +479,7 @@ static void node_area_refresh(const struct bContext *C, ScrArea *sa)
snode_set_context(C);
- if (ntreeIsValid(snode->nodetree)) {
+ if (snode->nodetree) {
if (snode->nodetree->type == NTREE_SHADER) {
if (GS(snode->id->name) == ID_MA) {
Material *ma = (Material *)snode->id;
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index 6fcfb457615..29f1b3fb5a3 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -237,7 +237,7 @@ static int tree_element_set_active_object(bContext *C, Scene *scene, SpaceOops
}
if (ob != scene->obedit)
- ED_object_exit_editmode(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR | EM_DO_UNDO);
+ ED_object_editmode_exit(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR | EM_DO_UNDO);
return 1;
}
@@ -643,7 +643,7 @@ static int tree_element_active_pose(bContext *C, Scene *scene, TreeElement *UNUS
if (set) {
if (scene->obedit)
- ED_object_exit_editmode(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR | EM_DO_UNDO);
+ ED_object_editmode_exit(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR | EM_DO_UNDO);
if (ob->mode & OB_MODE_POSE)
ED_armature_exit_posemode(C, base);
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index 258f0338d1e..9b9e7bef42c 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -300,7 +300,7 @@ static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te,
if (base) {
// check also library later
if (scene->obedit == base->object)
- ED_object_exit_editmode(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR | EM_DO_UNDO);
+ ED_object_editmode_exit(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR | EM_DO_UNDO);
ED_base_object_free_and_unlink(CTX_data_main(C), scene, base);
te->directdata = NULL;
diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c
index 3269e772be6..254d15341cd 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -320,10 +320,10 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, const wmEvent *e
View2D *v2d = UI_view2d_fromcontext(C);
Scene *scene = CTX_data_scene(C);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
- short extend = RNA_boolean_get(op->ptr, "extend");
- short linked_handle = RNA_boolean_get(op->ptr, "linked_handle");
- short left_right = RNA_boolean_get(op->ptr, "left_right");
- short linked_time = RNA_boolean_get(op->ptr, "linked_time");
+ const bool extend = RNA_boolean_get(op->ptr, "extend");
+ const bool linked_handle = RNA_boolean_get(op->ptr, "linked_handle");
+ const bool linked_time = RNA_boolean_get(op->ptr, "linked_time");
+ bool left_right = RNA_boolean_get(op->ptr, "left_right");
Sequence *seq, *neighbor, *act_orig;
int hand, sel_side;
@@ -673,7 +673,7 @@ static int sequencer_select_linked_pick_invoke(bContext *C, wmOperator *op, cons
Scene *scene = CTX_data_scene(C);
View2D *v2d = UI_view2d_fromcontext(C);
- short extend = RNA_boolean_get(op->ptr, "extend");
+ bool extend = RNA_boolean_get(op->ptr, "extend");
Sequence *mouse_seq;
int selected, hand;
diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c
index 110e0ab5bc4..58e45bc766f 100644
--- a/source/blender/editors/space_text/space_text.c
+++ b/source/blender/editors/space_text/space_text.c
@@ -504,10 +504,13 @@ static void text_properties_area_init(wmWindowManager *wm, ARegion *ar)
{
wmKeyMap *keymap;
+ ar->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE;
+ ED_region_panels_init(wm, ar);
+
+ /* own keymaps */
keymap = WM_keymap_find(wm->defaultconf, "Text Generic", SPACE_TEXT, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
- ED_region_panels_init(wm, ar);
}
static void text_properties_area_draw(const bContext *C, ARegion *ar)
diff --git a/source/blender/editors/space_text/text_format_lua.c b/source/blender/editors/space_text/text_format_lua.c
index f74d1cf8e8b..9972c570db7 100644
--- a/source/blender/editors/space_text/text_format_lua.c
+++ b/source/blender/editors/space_text/text_format_lua.c
@@ -307,7 +307,7 @@ static void txtfmt_lua_format_line(SpaceText *st, TextLine *line, const int do_n
void ED_text_format_register_lua(void)
{
- static TextFormatType tft = {0};
+ static TextFormatType tft = {NULL};
static const char *ext[] = {"lua", NULL};
tft.format_identifier = txtfmt_lua_format_identifier;
diff --git a/source/blender/editors/space_text/text_format_osl.c b/source/blender/editors/space_text/text_format_osl.c
index c95929a720f..a4322fb310e 100644
--- a/source/blender/editors/space_text/text_format_osl.c
+++ b/source/blender/editors/space_text/text_format_osl.c
@@ -325,7 +325,7 @@ static void txtfmt_osl_format_line(SpaceText *st, TextLine *line, const int do_n
void ED_text_format_register_osl(void)
{
- static TextFormatType tft = {0};
+ static TextFormatType tft = {NULL};
static const char *ext[] = {"osl", NULL};
tft.format_identifier = txtfmt_osl_format_identifier;
diff --git a/source/blender/editors/space_text/text_format_py.c b/source/blender/editors/space_text/text_format_py.c
index 9562d57041f..a401e5dcdac 100644
--- a/source/blender/editors/space_text/text_format_py.c
+++ b/source/blender/editors/space_text/text_format_py.c
@@ -314,7 +314,7 @@ static void txtfmt_py_format_line(SpaceText *st, TextLine *line, const int do_ne
void ED_text_format_register_py(void)
{
- static TextFormatType tft = {0};
+ static TextFormatType tft = {NULL};
static const char *ext[] = {"py", NULL};
tft.format_identifier = txtfmt_py_format_identifier;
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index f37437b159d..cb685b59b64 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -144,7 +144,7 @@ static void cp_shade_color3ub(unsigned char cp[3], const int offset)
}
/* This function sets the gl-color for coloring a certain bone (based on bcolor) */
-static short set_pchan_glColor(short colCode, int boneflag, short constflag)
+static bool set_pchan_glColor(short colCode, int boneflag, short constflag)
{
switch (colCode) {
case PCHAN_COLOR_NORMAL:
@@ -184,7 +184,7 @@ static short set_pchan_glColor(short colCode, int boneflag, short constflag)
}
}
- return 1;
+ return true;
}
break;
@@ -196,7 +196,7 @@ static short set_pchan_glColor(short colCode, int boneflag, short constflag)
else
UI_ThemeColor(TH_BONE_SOLID);
- return 1;
+ return true;
}
break;
@@ -208,7 +208,7 @@ static short set_pchan_glColor(short colCode, int boneflag, short constflag)
else if (constflag & PCHAN_HAS_SPLINEIK) glColor4ub(200, 255, 0, 80);
else if (constflag & PCHAN_HAS_CONST) glColor4ub(0, 255, 120, 80);
- return 1;
+ return true;
}
else
return 0;
@@ -238,7 +238,7 @@ static short set_pchan_glColor(short colCode, int boneflag, short constflag)
else UI_ThemeColor(TH_BONE_SOLID);
}
- return 1;
+ return true;
}
break;
case PCHAN_COLOR_SPHEREBONE_END:
@@ -288,12 +288,12 @@ static short set_pchan_glColor(short colCode, int boneflag, short constflag)
UI_ThemeColorShade(TH_BACK, -30);
}
- return 1;
+ return true;
}
break;
}
- return 0;
+ return false;
}
static void set_ebone_glColor(const unsigned int boneflag)
@@ -1660,7 +1660,7 @@ static void bone_matrix_translate_y(float mat[4][4], float y)
/* assumes object is Armature with pose */
static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
const short dt, const unsigned char ob_wire_col[4],
- const short do_const_color, const short is_outline)
+ const bool do_const_color, const bool is_outline)
{
RegionView3D *rv3d = ar->regiondata;
Object *ob = base->object;
@@ -1670,7 +1670,8 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
GLfloat tmp;
float smat[4][4], imat[4][4], bmat[4][4];
int index = -1;
- short do_dashed = 3, draw_wire = FALSE;
+ short do_dashed = 3;
+ bool draw_wire = false;
int flag;
/* being set below */
@@ -1736,7 +1737,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
((G.f & G_PICKSEL) == 0 || (bone->flag & BONE_UNSELECTABLE) == 0))
{
if (bone->layer & arm->layer) {
- int use_custom = (pchan->custom) && !(arm->flag & ARM_NO_CUSTOM);
+ const bool use_custom = (pchan->custom) && !(arm->flag & ARM_NO_CUSTOM);
glPushMatrix();
if (use_custom && pchan->custom_tx) {
@@ -1767,7 +1768,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
if (use_custom) {
/* if drawwire, don't try to draw in solid */
if (pchan->bone->flag & BONE_DRAWWIRE) {
- draw_wire = 1;
+ draw_wire = true;
}
else {
draw_custom_bone(scene, v3d, rv3d, pchan->custom,
@@ -1801,7 +1802,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
/* very very confusing... but in object mode, solid draw, we cannot do glLoadName yet,
* stick bones and/or wire custom-shapes are drawn in next loop
*/
- if (ELEM(arm->drawtype, ARM_LINE, ARM_WIRE) == 0 && (draw_wire == 0)) {
+ if (ELEM(arm->drawtype, ARM_LINE, ARM_WIRE) == 0 && (draw_wire == false)) {
/* object tag, for bordersel optim */
glLoadName(index & 0xFFFF);
index = -1;
@@ -1810,7 +1811,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
/* draw custom bone shapes as wireframes */
if (!(arm->flag & ARM_NO_CUSTOM) &&
- ((draw_wire) || (dt <= OB_WIRE)) )
+ (draw_wire || (dt <= OB_WIRE)) )
{
if (arm->flag & ARM_POSEMODE)
index = base->selcol;
@@ -2384,7 +2385,7 @@ static void draw_ghost_poses_range(Scene *scene, View3D *v3d, ARegion *ar, Base
BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL);
BKE_pose_where_is(scene, ob);
- draw_pose_bones(scene, v3d, ar, base, OB_WIRE, NULL, TRUE, FALSE);
+ draw_pose_bones(scene, v3d, ar, base, OB_WIRE, NULL, true, false);
}
glDisable(GL_BLEND);
if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
@@ -2466,7 +2467,7 @@ static void draw_ghost_poses_keys(Scene *scene, View3D *v3d, ARegion *ar, Base *
BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL);
BKE_pose_where_is(scene, ob);
- draw_pose_bones(scene, v3d, ar, base, OB_WIRE, NULL, TRUE, FALSE);
+ draw_pose_bones(scene, v3d, ar, base, OB_WIRE, NULL, true, false);
}
glDisable(GL_BLEND);
if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
@@ -2539,7 +2540,7 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
if (CFRA != cfrao) {
BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL);
BKE_pose_where_is(scene, ob);
- draw_pose_bones(scene, v3d, ar, base, OB_WIRE, NULL, TRUE, FALSE);
+ draw_pose_bones(scene, v3d, ar, base, OB_WIRE, NULL, true, false);
}
}
@@ -2554,7 +2555,7 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
if (CFRA != cfrao) {
BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL);
BKE_pose_where_is(scene, ob);
- draw_pose_bones(scene, v3d, ar, base, OB_WIRE, NULL, TRUE, FALSE);
+ draw_pose_bones(scene, v3d, ar, base, OB_WIRE, NULL, true, false);
}
}
}
@@ -2579,16 +2580,16 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
/* called from drawobject.c, return 1 if nothing was drawn
* (ob_wire_col == NULL) when drawing ghost */
-int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
- const short dt, const short dflag, const unsigned char ob_wire_col[4],
- const short is_outline)
+bool draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
+ const short dt, const short dflag, const unsigned char ob_wire_col[4],
+ const bool is_outline)
{
Object *ob = base->object;
bArmature *arm = ob->data;
- int retval = 0;
+ bool retval = false;
if (v3d->flag2 & V3D_RENDER_OVERRIDE)
- return 1;
+ return true;
if (dt > OB_WIRE && !ELEM(arm->drawtype, ARM_LINE, ARM_WIRE)) {
/* we use color for solid lighting */
@@ -2652,7 +2653,7 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
UI_ThemeColor(TH_WIRE); /* restore, for extra draw stuff */
}
else {
- retval = 1;
+ retval = true;
}
}
/* restore */
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index 9000ccbf324..b13f395b80b 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -240,13 +240,13 @@ static struct TextureDrawState {
unsigned char obcol[4];
} 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)
+static bool set_draw_settings_cached(int clearcache, MTFace *texface, Material *ma, struct TextureDrawState gtexdraw)
{
static Material *c_ma;
static int c_textured;
static MTFace c_texface;
static int c_backculled;
- static int c_badtex;
+ static bool c_badtex;
static int c_lit;
static int c_has_texface;
@@ -256,12 +256,12 @@ static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *m
int textured = 0;
int lit = 0;
int has_texface = texface != NULL;
- int need_set_tpage = FALSE;
+ bool need_set_tpage = false;
if (clearcache) {
c_textured = c_lit = c_backculled = -1;
memset(&c_texface, 0, sizeof(MTFace));
- c_badtex = 0;
+ c_badtex = false;
c_has_texface = -1;
}
else {
@@ -307,7 +307,7 @@ static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *m
}
else {
GPU_set_tpage(NULL, 0, 0);
- c_badtex = 0;
+ c_badtex = false;
}
c_textured = textured;
c_has_texface = has_texface;
@@ -345,7 +345,7 @@ static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *m
static void draw_textured_begin(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob)
{
unsigned char obcol[4];
- int is_tex, solidtex;
+ bool is_tex, solidtex;
Mesh *me = ob->data;
/* XXX scene->obedit warning */
@@ -353,24 +353,24 @@ static void draw_textured_begin(Scene *scene, View3D *v3d, RegionView3D *rv3d, O
/* texture draw is abused for mask selection mode, do this so wire draw
* with face selection in weight paint is not lit. */
if ((v3d->drawtype <= OB_WIRE) && (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT))) {
- solidtex = FALSE;
+ solidtex = false;
Gtexdraw.is_lit = 0;
}
else if (v3d->drawtype == OB_SOLID || ((ob->mode & OB_MODE_EDIT) && v3d->drawtype != OB_TEXTURE)) {
/* draw with default lights in solid draw mode and edit mode */
- solidtex = TRUE;
+ solidtex = true;
Gtexdraw.is_lit = -1;
}
else {
/* draw with lights in the scene otherwise */
- solidtex = FALSE;
+ solidtex = false;
Gtexdraw.is_lit = GPU_scene_object_lights(scene, ob, v3d->lay, rv3d->viewmat, !rv3d->is_persp);
}
rgba_float_to_uchar(obcol, ob->col);
- if (solidtex || v3d->drawtype == OB_TEXTURE) is_tex = 1;
- else is_tex = 0;
+ if (solidtex || v3d->drawtype == OB_TEXTURE) is_tex = true;
+ else is_tex = false;
Gtexdraw.ob = ob;
Gtexdraw.is_tex = is_tex;
@@ -412,7 +412,7 @@ static void draw_textured_end(void)
static DMDrawOption draw_tface__set_draw_legacy(MTFace *tface, int has_mcol, int matnr)
{
Material *ma = give_current_material(Gtexdraw.ob, matnr + 1);
- int invalidtexture = 0;
+ bool invalidtexture = false;
if (ma && (ma->game.flag & GEMAT_INVISIBLE))
return DM_DRAW_OPTION_SKIP;
@@ -867,7 +867,7 @@ static void tex_mat_set_texture_cb(void *userData, int mat_nr, void *attribs)
if (ED_object_get_active_image(data->ob, mat_nr, &ima, &iuser, &node)) {
/* get openl texture */
int mipmap = 1;
- int bindcode = (ima) ? GPU_verify_image(ima, iuser, 0, 0, mipmap, FALSE) : 0;
+ int bindcode = (ima) ? GPU_verify_image(ima, iuser, 0, 0, mipmap, false) : 0;
float zero[4] = {0.0f, 0.0f, 0.0f, 0.0f};
if (bindcode) {
@@ -1020,7 +1020,7 @@ void draw_mesh_paint(View3D *v3d, RegionView3D *rv3d,
{
DMSetDrawOptions facemask = NULL;
Mesh *me = ob->data;
- const short do_light = (v3d->drawtype >= OB_SOLID);
+ const bool do_light = (v3d->drawtype >= OB_SOLID);
/* hide faces in face select mode */
if (me->editflag & (ME_EDIT_PAINT_VERT_SEL | ME_EDIT_PAINT_FACE_SEL))
@@ -1070,7 +1070,7 @@ void draw_mesh_paint(View3D *v3d, RegionView3D *rv3d,
if (draw_flags & DRAW_FACE_SELECT) {
draw_mesh_face_select(rv3d, me, dm);
}
- else if ((do_light == FALSE) || (ob->dtx & OB_DRAWWIRE)) {
+ else if ((do_light == false) || (ob->dtx & OB_DRAWWIRE)) {
const int use_depth = (v3d->flag & V3D_ZBUF_SELECT) || !(ob->mode & OB_MODE_WEIGHT_PAINT);
/* weight paint in solid mode, special case. focus on making the weights clear
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 15c3385f67c..8eae1571933 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -195,61 +195,61 @@ static bool check_object_draw_texture(Scene *scene, View3D *v3d, int drawtype)
return false;
}
-static int check_ob_drawface_dot(Scene *sce, View3D *vd, char dt)
+static bool check_ob_drawface_dot(Scene *sce, View3D *vd, char dt)
{
if ((sce->toolsettings->selectmode & SCE_SELECT_FACE) == 0)
- return 0;
+ return false;
if (G.f & G_BACKBUFSEL)
- return 0;
+ return false;
if ((vd->flag & V3D_ZBUF_SELECT) == 0)
- return 1;
+ return true;
/* if its drawing textures with zbuf sel, then don't draw dots */
if (dt == OB_TEXTURE && vd->drawtype == OB_TEXTURE)
- return 0;
+ return false;
if ((vd->drawtype >= OB_SOLID) && (vd->flag2 & V3D_SOLID_TEX))
- return 0;
+ return false;
- return 1;
+ return true;
}
/* ************************ */
/* check for glsl drawing */
-int draw_glsl_material(Scene *scene, Object *ob, View3D *v3d, const char dt)
+bool draw_glsl_material(Scene *scene, Object *ob, View3D *v3d, const char dt)
{
if (!GPU_glsl_support())
- return 0;
+ return false;
if (G.f & G_PICKSEL)
- return 0;
+ return false;
if (!check_object_draw_texture(scene, v3d, dt))
- return 0;
+ return false;
if (ob == OBACT && (ob && ob->mode & OB_MODE_WEIGHT_PAINT))
- return 0;
+ return false;
if (v3d->flag2 & V3D_SHOW_SOLID_MATCAP)
- return 1;
+ return true;
if (BKE_scene_use_new_shading_nodes(scene))
- return 0;
+ return false;
return (scene->gm.matmode == GAME_MAT_GLSL) && (dt > OB_SOLID);
}
-static int check_alpha_pass(Base *base)
+static bool check_alpha_pass(Base *base)
{
if (base->flag & OB_FROMDUPLI)
- return 0;
+ return false;
if (G.f & G_PICKSEL)
- return 0;
+ return false;
if (base->object->mode & OB_MODE_ALL_PAINT)
- return 0;
+ return false;
return (base->object->dtx & OB_DRAWTRANSP);
}
@@ -607,10 +607,16 @@ static void draw_empty_image(Object *ob, const short dflag, const unsigned char
glScalef(scale * sca_x, scale * sca_y, 1.0f);
if (ibuf && ibuf->rect) {
+ const bool use_clip = (U.glalphaclip != 1.0f);
/* Setup GL params */
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ if (use_clip) {
+ glEnable(GL_ALPHA_TEST);
+ glAlphaFunc(GL_GREATER, U.glalphaclip);
+ }
+
/* Use the object color and alpha */
glColor4fv(ob->col);
@@ -619,6 +625,11 @@ static void draw_empty_image(Object *ob, const short dflag, const unsigned char
glPixelTransferf(GL_ALPHA_SCALE, 1.0f);
glDisable(GL_BLEND);
+
+ if (use_clip) {
+ glDisable(GL_ALPHA_TEST);
+ glAlphaFunc(GL_GREATER, 0.0f);
+ }
}
if ((dflag & DRAW_CONSTCOLOR) == 0) {
@@ -758,7 +769,7 @@ void view3d_cached_text_draw_add(const float co[3],
memcpy(++vos, str, alloc_len);
}
-void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, float mat[4][4])
+void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, bool depth_write, float mat[4][4])
{
RegionView3D *rv3d = ar->regiondata;
ListBase *strings = &CachedText[CachedTextLevel - 1];
@@ -1098,13 +1109,13 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
unsigned char col[4];
/* cone can't be drawn for duplicated lamps, because duplilist would be freed to */
/* the moment of view3d_draw_transp() call */
- const short is_view = (rv3d->persp == RV3D_CAMOB && v3d->camera == base->object);
- const short drawcone = ((dt > OB_WIRE) &&
- !(G.f & G_PICKSEL) &&
- (la->type == LA_SPOT) &&
- (la->mode & LA_SHOW_CONE) &&
- !(base->flag & OB_FROMDUPLI) &&
- !is_view);
+ const bool is_view = (rv3d->persp == RV3D_CAMOB && v3d->camera == base->object);
+ const bool drawcone = ((dt > OB_WIRE) &&
+ !(G.f & G_PICKSEL) &&
+ (la->type == LA_SPOT) &&
+ (la->mode & LA_SHOW_CONE) &&
+ !(base->flag & OB_FROMDUPLI) &&
+ !is_view);
if (drawcone && !v3d->transp) {
/* in this case we need to draw delayed */
@@ -1370,7 +1381,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
setlinestyle(0);
- if ((la->type == LA_SPOT) && (la->mode & LA_SHAD_BUF) && (is_view == FALSE)) {
+ if ((la->type == LA_SPOT) && (la->mode & LA_SHAD_BUF) && (is_view == false)) {
drawshadbuflimits(la, ob->obmat);
}
@@ -1402,20 +1413,22 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
}
}
-static void draw_limit_line(float sta, float end, unsigned int col)
+static void draw_limit_line(float sta, float end, const short dflag, unsigned int col)
{
glBegin(GL_LINES);
glVertex3f(0.0, 0.0, -sta);
glVertex3f(0.0, 0.0, -end);
glEnd();
- glPointSize(3.0);
- glBegin(GL_POINTS);
- cpack(col);
- glVertex3f(0.0, 0.0, -sta);
- glVertex3f(0.0, 0.0, -end);
- glEnd();
- glPointSize(1.0);
+ if (!(dflag & DRAW_PICKING)) {
+ glPointSize(3.0);
+ glBegin(GL_POINTS);
+ cpack(col);
+ glVertex3f(0.0, 0.0, -sta);
+ glVertex3f(0.0, 0.0, -end);
+ glEnd();
+ glPointSize(1.0);
+ }
}
@@ -1433,7 +1446,7 @@ static void draw_focus_cross(float dist, float size)
#ifdef VIEW3D_CAMERA_BORDER_HACK
unsigned char view3d_camera_border_hack_col[3];
-short view3d_camera_border_hack_test = FALSE;
+bool view3d_camera_border_hack_test = false;
#endif
/* ****************** draw clip data *************** */
@@ -1464,7 +1477,7 @@ static void draw_bundle_sphere(void)
static void draw_viewport_object_reconstruction(Scene *scene, Base *base, View3D *v3d,
MovieClip *clip, MovieTrackingObject *tracking_object,
const short dflag, const unsigned char ob_wire_col[4],
- int *global_track_index, int draw_selected)
+ int *global_track_index, bool draw_selected)
{
MovieTracking *tracking = &clip->tracking;
MovieTrackingTrack *track;
@@ -1619,7 +1632,7 @@ static void draw_viewport_object_reconstruction(Scene *scene, Base *base, View3D
static void draw_viewport_reconstruction(Scene *scene, Base *base, View3D *v3d, MovieClip *clip,
const short dflag, const unsigned char ob_wire_col[4],
- int draw_selected)
+ const bool draw_selected)
{
MovieTracking *tracking = &clip->tracking;
MovieTrackingObject *tracking_object;
@@ -1668,13 +1681,13 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base
float vec[4][3], asp[2], shift[2], scale[3];
int i;
float drawsize;
- const short is_view = (rv3d->persp == RV3D_CAMOB && ob == v3d->camera);
+ const bool is_view = (rv3d->persp == RV3D_CAMOB && ob == v3d->camera);
MovieClip *clip = BKE_object_movieclip_get(scene, base->object, 0);
/* draw data for movie clip set as active for scene */
if (clip) {
- draw_viewport_reconstruction(scene, base, v3d, clip, dflag, ob_wire_col, FALSE);
- draw_viewport_reconstruction(scene, base, v3d, clip, dflag, ob_wire_col, TRUE);
+ draw_viewport_reconstruction(scene, base, v3d, clip, dflag, ob_wire_col, false);
+ draw_viewport_reconstruction(scene, base, v3d, clip, dflag, ob_wire_col, true);
}
#ifdef VIEW3D_CAMERA_BORDER_HACK
@@ -1689,7 +1702,7 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base
glGetFloatv(GL_CURRENT_COLOR, col);
rgb_float_to_uchar(view3d_camera_border_hack_col, col);
}
- view3d_camera_border_hack_test = TRUE;
+ view3d_camera_border_hack_test = true;
return;
}
#endif
@@ -1756,10 +1769,9 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base
glEnd();
}
- if (dflag == 0) {
- if (cam->flag & (CAM_SHOWLIMITS + CAM_SHOWMIST)) {
+ if ((dflag & DRAW_SCENESET) == 0) {
+ if (cam->flag & (CAM_SHOWLIMITS | CAM_SHOWMIST)) {
float nobmat[4][4];
- World *wrld;
/* draw in normalized object matrix space */
copy_m4_m4(nobmat, ob->obmat);
@@ -1770,15 +1782,17 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base
glMultMatrixf(nobmat);
if (cam->flag & CAM_SHOWLIMITS) {
- draw_limit_line(cam->clipsta, cam->clipend, 0x77FFFF);
+ draw_limit_line(cam->clipsta, cam->clipend, dflag, 0x77FFFF);
/* qdn: was yafray only, now also enabled for Blender to be used with defocus composite node */
draw_focus_cross(BKE_camera_object_dof_distance(ob), cam->drawsize);
}
- wrld = scene->world;
- if (cam->flag & CAM_SHOWMIST)
- if (wrld) draw_limit_line(wrld->miststa, wrld->miststa + wrld->mistdist, 0xFFFFFF);
-
+ if (cam->flag & CAM_SHOWMIST) {
+ World *world = scene->world;
+ if (world) {
+ draw_limit_line(world->miststa, world->miststa + world->mistdist, dflag, 0xFFFFFF);
+ }
+ }
glPopMatrix();
}
}
@@ -1857,13 +1871,13 @@ static void lattice_draw_verts(Lattice *lt, DispList *dl, short sel)
bglEnd();
}
-static void drawlattice__point(Lattice *lt, DispList *dl, int u, int v, int w, int use_wcol)
+static void drawlattice__point(Lattice *lt, DispList *dl, int u, int v, int w, int actdef_wcol)
{
int index = ((w * lt->pntsv + v) * lt->pntsu) + u;
- if (use_wcol) {
+ if (actdef_wcol) {
float col[3];
- MDeformWeight *mdw = defvert_find_index(lt->dvert + index, use_wcol - 1);
+ MDeformWeight *mdw = defvert_find_index(lt->dvert + index, actdef_wcol - 1);
weight_to_rgb(col, mdw ? mdw->weight : 0.0f);
glColor3fv(col);
@@ -1884,7 +1898,8 @@ static void drawlattice(Scene *scene, View3D *v3d, Object *ob)
Lattice *lt = ob->data;
DispList *dl;
int u, v, w;
- int use_wcol = FALSE, is_edit = (lt->editlatt != NULL);
+ int actdef_wcol = 0;
+ const bool is_edit = (lt->editlatt != NULL);
/* now we default make displist, this will modifiers work for non animated case */
if (ob->disp.first == NULL)
@@ -1897,7 +1912,7 @@ static void drawlattice(Scene *scene, View3D *v3d, Object *ob)
cpack(0x004000);
if (ob->defbase.first && lt->dvert) {
- use_wcol = ob->actdef;
+ actdef_wcol = ob->actdef;
glShadeModel(GL_SMOOTH);
}
}
@@ -1911,16 +1926,16 @@ static void drawlattice(Scene *scene, View3D *v3d, Object *ob)
int uxt = (u == 0 || u == lt->pntsu - 1);
if (w && ((uxt || vxt) || !(lt->flag & LT_OUTSIDE))) {
- drawlattice__point(lt, dl, u, v, w - 1, use_wcol);
- drawlattice__point(lt, dl, u, v, w, use_wcol);
+ drawlattice__point(lt, dl, u, v, w - 1, actdef_wcol);
+ drawlattice__point(lt, dl, u, v, w, actdef_wcol);
}
if (v && ((uxt || wxt) || !(lt->flag & LT_OUTSIDE))) {
- drawlattice__point(lt, dl, u, v - 1, w, use_wcol);
- drawlattice__point(lt, dl, u, v, w, use_wcol);
+ drawlattice__point(lt, dl, u, v - 1, w, actdef_wcol);
+ drawlattice__point(lt, dl, u, v, w, actdef_wcol);
}
if (u && ((vxt || wxt) || !(lt->flag & LT_OUTSIDE))) {
- drawlattice__point(lt, dl, u - 1, v, w, use_wcol);
- drawlattice__point(lt, dl, u, v, w, use_wcol);
+ drawlattice__point(lt, dl, u - 1, v, w, actdef_wcol);
+ drawlattice__point(lt, dl, u, v, w, actdef_wcol);
}
}
}
@@ -1928,7 +1943,7 @@ static void drawlattice(Scene *scene, View3D *v3d, Object *ob)
glEnd();
/* restoration for weight colors */
- if (use_wcol)
+ if (actdef_wcol)
glShadeModel(GL_FLAT);
if (is_edit) {
@@ -2422,7 +2437,7 @@ static void draw_dm_faces_sel(BMEditMesh *em, DerivedMesh *dm, unsigned char *ba
/* double lookup */
data.orig_index_mf_to_mpoly = DM_get_tessface_data_layer(dm, CD_ORIGINDEX);
data.orig_index_mp_to_orig = DM_get_poly_data_layer(dm, CD_ORIGINDEX);
- if ((data.orig_index_mf_to_mpoly && data.orig_index_mp_to_orig) == FALSE) {
+ if ((data.orig_index_mf_to_mpoly && data.orig_index_mp_to_orig) == false) {
data.orig_index_mf_to_mpoly = data.orig_index_mp_to_orig = NULL;
}
@@ -2685,7 +2700,7 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS
if (unit->system) {
bUnit_AsString(numstr, sizeof(numstr), len_v3v3(v1, v2) * unit->scale_length, 3,
- unit->system, B_UNIT_LENGTH, do_split, FALSE);
+ unit->system, B_UNIT_LENGTH, do_split, false);
}
else {
sprintf(numstr, conv_float, len_v3v3(v1, v2));
@@ -2708,7 +2723,7 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS
if (unit->system) { \
bUnit_AsString(numstr, sizeof(numstr), \
(double)(area * unit->scale_length * unit->scale_length), \
- 3, unit->system, B_UNIT_AREA, do_split, FALSE); \
+ 3, unit->system, B_UNIT_AREA, do_split, false); \
view3d_cached_text_draw_add(vmid, numstr, 0, \
/* Metric system uses unicode "squared" sign! */ \
txt_flag ^ V3D_CACHE_TEXT_ASCII, col); \
@@ -2769,7 +2784,7 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS
if (is_face_sel || do_moving) {
BMIter liter;
BMLoop *loop;
- int is_first = TRUE;
+ bool is_first = true;
BM_ITER_ELEM (loop, &liter, efa, BM_LOOPS_OF_FACE) {
if (is_face_sel || (do_moving && BM_elem_flag_test(loop->v, BM_ELEM_SELECT))) {
@@ -2785,7 +2800,7 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS
mul_mat3_m4_v3(ob->obmat, v1);
mul_mat3_m4_v3(ob->obmat, v2);
}
- is_first = FALSE;
+ is_first = false;
}
if (do_global) {
@@ -2892,7 +2907,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d,
{
Mesh *me = ob->data;
- BMFace *efa_act = BM_active_face_get(em->bm, FALSE, FALSE); /* annoying but active faces is stored differently */
+ BMFace *efa_act = BM_active_face_get(em->bm, false, false); /* annoying but active faces is stored differently */
BMEdge *eed_act = NULL;
BMVert *eve_act = NULL;
@@ -3100,8 +3115,8 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d,
static void draw_mesh_object_outline(View3D *v3d, Object *ob, DerivedMesh *dm)
{
- if ((v3d->transp == FALSE) && /* not when we draw the transparent pass */
- (ob->mode & OB_MODE_ALL_PAINT) == FALSE) /* not when painting (its distracting) - campbell */
+ if ((v3d->transp == false) && /* not when we draw the transparent pass */
+ (ob->mode & OB_MODE_ALL_PAINT) == false) /* not when painting (its distracting) - campbell */
{
glLineWidth(UI_GetThemeValuef(TH_OUTLINE_WIDTH) * 2.0f);
glDepthMask(0);
@@ -3358,14 +3373,15 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
}
/* returns 1 if nothing was drawn, for detecting to draw an object center */
-static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, Base *base,
- const char dt, const unsigned char ob_wire_col[4], const short dflag)
+static bool draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, Base *base,
+ const char dt, const unsigned char ob_wire_col[4], const short dflag)
{
Object *ob = base->object;
Object *obedit = scene->obedit;
Mesh *me = ob->data;
BMEditMesh *em = me->edit_btmesh;
- int do_alpha_after = FALSE, drawlinked = 0, retval = 0, glsl, check_alpha, i;
+ int i;
+ bool do_alpha_after = false, drawlinked = false, retval = false;
/* If we are drawing shadows and any of the materials don't cast a shadow,
* then don't draw the object */
@@ -3373,7 +3389,7 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
for (i = 0; i < ob->totcol; ++i) {
Material *ma = give_current_material(ob, i);
if (ma && !(ma->mode & MA_SHADBUF)) {
- return 1;
+ return true;
}
}
}
@@ -3381,7 +3397,7 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
if (obedit && ob != obedit && ob->data == obedit->data) {
if (BKE_key_from_object(ob) || BKE_key_from_object(obedit)) {}
else if (ob->modifiers.first || obedit->modifiers.first) {}
- else drawlinked = 1;
+ else drawlinked = true;
}
/* backface culling */
@@ -3400,7 +3416,7 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
scene->customdata_mask);
if (dt > OB_WIRE) {
- glsl = draw_glsl_material(scene, ob, v3d, dt);
+ const bool glsl = draw_glsl_material(scene, ob, v3d, dt);
GPU_begin_object_materials(v3d, rv3d, scene, ob, glsl, NULL);
}
@@ -3415,8 +3431,8 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
else {
/* ob->bb was set by derived mesh system, do NULL check just to be sure */
if (me->totpoly <= 4 || (!ob->bb || ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb))) {
- glsl = draw_glsl_material(scene, ob, v3d, dt);
- check_alpha = check_alpha_pass(base);
+ const bool glsl = draw_glsl_material(scene, ob, v3d, dt);
+ const bool check_alpha = check_alpha_pass(base);
if (dt == OB_SOLID || glsl) {
GPU_begin_object_materials(v3d, rv3d, scene, ob, glsl,
@@ -3427,7 +3443,7 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
GPU_end_object_materials();
- if (me->totvert == 0) retval = 1;
+ if (me->totvert == 0) retval = true;
}
}
@@ -3457,11 +3473,11 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
/* ************** DRAW DISPLIST ****************** */
-static int draw_index_wire = 1;
-static int index3_nors_incr = 1;
+static bool draw_index_wire = true;
+static bool index3_nors_incr = true;
/* returns 1 when nothing was drawn */
-static int drawDispListwire(ListBase *dlbase)
+static bool drawDispListwire(ListBase *dlbase)
{
DispList *dl;
int parts, nr;
@@ -3551,11 +3567,11 @@ static int drawDispListwire(ListBase *dlbase)
glDisableClientState(GL_VERTEX_ARRAY);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- return 0;
+ return false;
}
static void drawDispListsolid(ListBase *lb, Object *ob, const short dflag,
- const unsigned char ob_wire_col[4], int use_glsl)
+ const unsigned char ob_wire_col[4], const bool use_glsl)
{
DispList *dl;
GPUVertexAttribs gattribs;
@@ -3680,14 +3696,14 @@ static void drawCurveDMWired(Object *ob)
dm->drawEdges(dm, 1, 0);
}
-/* return 1 when nothing was drawn */
-static int drawCurveDerivedMesh(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, const char dt)
+/* return true when nothing was drawn */
+static bool drawCurveDerivedMesh(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, const char dt)
{
Object *ob = base->object;
DerivedMesh *dm = ob->derivedFinal;
if (!dm) {
- return 1;
+ return true;
}
if (dt > OB_WIRE && dm->getNumTessFaces(dm)) {
@@ -3709,15 +3725,15 @@ static int drawCurveDerivedMesh(Scene *scene, View3D *v3d, RegionView3D *rv3d, B
drawCurveDMWired(ob);
}
- return 0;
+ return false;
}
/**
* Only called by #drawDispList
* \return 1 when nothing was drawn
*/
-static int drawDispList_nobackface(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
- const char dt, const short dflag, const unsigned char ob_wire_col[4])
+static bool drawDispList_nobackface(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
+ const char dt, const short dflag, const unsigned char ob_wire_col[4])
{
Object *ob = base->object;
ListBase *lb = NULL;
@@ -3726,8 +3742,8 @@ static int drawDispList_nobackface(Scene *scene, View3D *v3d, RegionView3D *rv3d
const short render_only = (v3d->flag2 & V3D_RENDER_OVERRIDE);
const short solid = (dt > OB_WIRE);
- if (drawCurveDerivedMesh(scene, v3d, rv3d, base, dt) == 0) {
- return FALSE;
+ if (drawCurveDerivedMesh(scene, v3d, rv3d, base, dt) == false) {
+ return false;
}
switch (ob->type) {
@@ -3740,45 +3756,45 @@ static int drawDispList_nobackface(Scene *scene, View3D *v3d, RegionView3D *rv3d
if (solid) {
dl = lb->first;
if (dl == NULL) {
- return TRUE;
+ return true;
}
if (dl->nors == NULL) BKE_displist_normals_add(lb);
- index3_nors_incr = 0;
+ index3_nors_incr = false;
- if (BKE_displist_has_faces(lb) == 0) {
+ if (BKE_displist_has_faces(lb) == false) {
if (!render_only) {
- draw_index_wire = 0;
+ draw_index_wire = false;
drawDispListwire(lb);
- draw_index_wire = 1;
+ draw_index_wire = true;
}
}
else {
if (draw_glsl_material(scene, ob, v3d, dt)) {
GPU_begin_object_materials(v3d, rv3d, scene, ob, 1, NULL);
- drawDispListsolid(lb, ob, dflag, ob_wire_col, TRUE);
+ drawDispListsolid(lb, ob, dflag, ob_wire_col, true);
GPU_end_object_materials();
}
else {
GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL);
- drawDispListsolid(lb, ob, dflag, ob_wire_col, FALSE);
+ drawDispListsolid(lb, ob, dflag, ob_wire_col, false);
GPU_end_object_materials();
}
if (cu->editnurb && cu->bevobj == NULL && cu->taperobj == NULL && cu->ext1 == 0.0f && cu->ext2 == 0.0f) {
cpack(0);
- draw_index_wire = 0;
+ draw_index_wire = false;
drawDispListwire(lb);
- draw_index_wire = 1;
+ draw_index_wire = true;
}
}
- index3_nors_incr = 1;
+ index3_nors_incr = true;
}
else {
if (!render_only || (render_only && BKE_displist_has_faces(lb))) {
int retval;
- draw_index_wire = 0;
+ draw_index_wire = false;
retval = drawDispListwire(lb);
- draw_index_wire = 1;
+ draw_index_wire = true;
return retval;
}
}
@@ -3790,19 +3806,19 @@ static int drawDispList_nobackface(Scene *scene, View3D *v3d, RegionView3D *rv3d
if (solid) {
dl = lb->first;
if (dl == NULL) {
- return TRUE;
+ return true;
}
if (dl->nors == NULL) BKE_displist_normals_add(lb);
if (draw_glsl_material(scene, ob, v3d, dt)) {
GPU_begin_object_materials(v3d, rv3d, scene, ob, 1, NULL);
- drawDispListsolid(lb, ob, dflag, ob_wire_col, TRUE);
+ drawDispListsolid(lb, ob, dflag, ob_wire_col, true);
GPU_end_object_materials();
}
else {
GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL);
- drawDispListsolid(lb, ob, dflag, ob_wire_col, FALSE);
+ drawDispListsolid(lb, ob, dflag, ob_wire_col, false);
GPU_end_object_materials();
}
}
@@ -3816,19 +3832,19 @@ static int drawDispList_nobackface(Scene *scene, View3D *v3d, RegionView3D *rv3d
lb = &ob->disp;
if (lb->first == NULL) BKE_displist_make_mball(scene, ob);
if (lb->first == NULL) {
- return TRUE;
+ return true;
}
if (solid) {
if (draw_glsl_material(scene, ob, v3d, dt)) {
GPU_begin_object_materials(v3d, rv3d, scene, ob, 1, NULL);
- drawDispListsolid(lb, ob, dflag, ob_wire_col, TRUE);
+ drawDispListsolid(lb, ob, dflag, ob_wire_col, true);
GPU_end_object_materials();
}
else {
GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL);
- drawDispListsolid(lb, ob, dflag, ob_wire_col, FALSE);
+ drawDispListsolid(lb, ob, dflag, ob_wire_col, false);
GPU_end_object_materials();
}
}
@@ -3842,10 +3858,10 @@ static int drawDispList_nobackface(Scene *scene, View3D *v3d, RegionView3D *rv3d
return FALSE;
}
-static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
- const char dt, const short dflag, const unsigned char ob_wire_col[4])
+static bool drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
+ const char dt, const short dflag, const unsigned char ob_wire_col[4])
{
- int retval;
+ bool retval;
/* backface culling */
if (v3d->flag2 & V3D_BACKFACE_CULLING) {
@@ -5532,11 +5548,11 @@ static void drawspiral(const float cent[3], float rad, float tmat[4][4], int sta
float vec[3], vx[3], vy[3];
const float tot_inv = (1.0f / (float)CIRCLE_RESOL);
int a;
- char inverse = FALSE;
+ bool inverse = false;
float x, y, fac;
if (start < 0) {
- inverse = TRUE;
+ inverse = true;
start = -start;
}
@@ -5660,9 +5676,9 @@ static void drawcone(const float vec[3], float radius, float height, float tmat[
glEnd();
}
-/* return TRUE if nothing was drawn */
-static int drawmball(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
- const char dt, const short dflag, const unsigned char ob_wire_col[4])
+/* return true if nothing was drawn */
+static bool drawmball(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
+ const char dt, const short dflag, const unsigned char ob_wire_col[4])
{
Object *ob = base->object;
MetaBall *mb;
@@ -5690,11 +5706,11 @@ static int drawmball(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
}
if (ml == NULL) {
- return TRUE;
+ return true;
}
if (v3d->flag2 & V3D_RENDER_OVERRIDE) {
- return FALSE;
+ return false;
}
invert_m4_m4(imat, rv3d->viewmatob);
@@ -5738,7 +5754,7 @@ static int drawmball(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
ml = ml->next;
}
- return FALSE;
+ return false;
}
static void draw_forcefield(Object *ob, RegionView3D *rv3d,
@@ -6090,24 +6106,24 @@ static void drawObjectSelect(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
if (ELEM3(ob->type, OB_FONT, OB_CURVE, OB_SURF)) {
Curve *cu = ob->data;
DerivedMesh *dm = ob->derivedFinal;
- int hasfaces = 0;
+ bool has_faces = false;
if (dm) {
- hasfaces = dm->getNumTessFaces(dm);
+ has_faces = dm->getNumTessFaces(dm);
}
else {
- hasfaces = BKE_displist_has_faces(&ob->disp);
+ has_faces = BKE_displist_has_faces(&ob->disp);
}
- if (hasfaces && ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) {
- draw_index_wire = 0;
+ if (has_faces && ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) {
+ draw_index_wire = false;
if (dm) {
draw_mesh_object_outline(v3d, ob, dm);
}
else {
drawDispListwire(&ob->disp);
}
- draw_index_wire = 1;
+ draw_index_wire = true;
}
}
else if (ob->type == OB_MBALL) {
@@ -6118,7 +6134,7 @@ static void drawObjectSelect(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
}
else if (ob->type == OB_ARMATURE) {
if (!(ob->mode & OB_MODE_POSE && base == scene->basact))
- draw_armature(scene, v3d, ar, base, OB_WIRE, FALSE, ob_wire_col, TRUE);
+ draw_armature(scene, v3d, ar, base, OB_WIRE, 0, ob_wire_col, true);
}
glLineWidth(1.0);
@@ -6143,7 +6159,7 @@ static void draw_wire_extra(Scene *scene, RegionView3D *rv3d, Object *ob, unsign
Curve *cu = ob->data;
if (ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) {
if (ob->type == OB_CURVE)
- draw_index_wire = 0;
+ draw_index_wire = false;
if (ob->derivedFinal) {
drawCurveDMWired(ob);
@@ -6153,7 +6169,7 @@ static void draw_wire_extra(Scene *scene, RegionView3D *rv3d, Object *ob, unsign
}
if (ob->type == OB_CURVE)
- draw_index_wire = 1;
+ draw_index_wire = true;
}
}
else if (ob->type == OB_MBALL) {
@@ -6657,7 +6673,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
else {
if (dt > OB_WIRE)
GPU_enable_material(0, NULL); /* we use default material */
- empty_object = draw_armature(scene, v3d, ar, base, dt, dflag, ob_wire_col, FALSE);
+ empty_object = draw_armature(scene, v3d, ar, base, dt, dflag, ob_wire_col, false);
if (dt > OB_WIRE)
GPU_disable_material();
}
diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c
index 70d3857601f..3933d8e4753 100644
--- a/source/blender/editors/space_view3d/drawvolume.c
+++ b/source/blender/editors/space_view3d/drawvolume.c
@@ -105,7 +105,7 @@ static int intersect_edges(float *points, float a, float b, float c, float d, fl
return numpoints;
}
-static int convex(const float p0[3], const float up[3], const float a[3], const float b[3])
+static bool convex(const float p0[3], const float up[3], const float a[3], const float b[3])
{
/* Vec3 va = a-p0, vb = b-p0; */
float va[3], vb[3], tmp[3];
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 340744839d2..ef16090c39d 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -159,7 +159,7 @@ RegionView3D *ED_view3d_context_rv3d(bContext *C)
/* ideally would return an rv3d but in some cases the region is needed too
* so return that, the caller can then access the ar->regiondata */
-int ED_view3d_context_user_region(bContext *C, View3D **r_v3d, ARegion **r_ar)
+bool ED_view3d_context_user_region(bContext *C, View3D **r_v3d, ARegion **r_ar)
{
ScrArea *sa = CTX_wm_area(C);
@@ -175,7 +175,7 @@ int ED_view3d_context_user_region(bContext *C, View3D **r_v3d, ARegion **r_ar)
if (rv3d && rv3d->viewlock == 0) {
*r_v3d = v3d;
*r_ar = ar;
- return 1;
+ return true;
}
else {
ARegion *ar_unlock_user = NULL;
@@ -198,19 +198,19 @@ int ED_view3d_context_user_region(bContext *C, View3D **r_v3d, ARegion **r_ar)
if (ar_unlock_user) {
*r_v3d = v3d;
*r_ar = ar_unlock_user;
- return 1;
+ return true;
}
if (ar_unlock) {
*r_v3d = v3d;
*r_ar = ar_unlock;
- return 1;
+ return true;
}
}
}
}
- return 0;
+ return false;
}
/* Most of the time this isn't needed since you could assume the view matrix was
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index bb286194992..533bb30d8d1 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -158,7 +158,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
TransformProperties *tfp;
float median[NBR_TRANSFORM_PROPERTIES], ve_median[NBR_TRANSFORM_PROPERTIES];
int tot, totedgedata, totcurvedata, totlattdata, totskinradius, totcurvebweight;
- int meshdata = FALSE;
+ bool has_meshdata = false;
char defstr[320];
PointerRNA data_ptr;
@@ -253,7 +253,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
}
}
- meshdata = totedgedata || totskinradius;
+ has_meshdata = (totedgedata || totskinradius);
}
else if (ob->type == OB_CURVE || ob->type == OB_SURF) {
Curve *cu = ob->data;
@@ -360,7 +360,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
if (v3d->flag & V3D_GLOBAL_STATS)
mul_m4_v3(ob->obmat, &median[LOC_X]);
- if (meshdata) {
+ if (has_meshdata) {
if (totedgedata) {
median[M_CREASE] /= (float)totedgedata;
median[M_WEIGHT] /= (float)totedgedata;
@@ -428,7 +428,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
uiBlockEndAlign(block);
/* Meshes... */
- if (meshdata) {
+ if (has_meshdata) {
if (totedgedata) {
/* customdata layer added on demand */
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN,
@@ -808,8 +808,8 @@ static void editvert_mirror_update(Object *ob, BMVert *eve, int def_nr, int inde
if (def_nr == -1) {
/* all vgroups, add groups where neded */
int flip_map_len;
- int *flip_map = defgroup_flip_map(ob, &flip_map_len, TRUE);
- defvert_sync_mapped(dvert_dst, dvert_src, flip_map, flip_map_len, TRUE);
+ int *flip_map = defgroup_flip_map(ob, &flip_map_len, true);
+ defvert_sync_mapped(dvert_dst, dvert_src, flip_map, flip_map_len, true);
MEM_freeN(flip_map);
}
else {
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index e27f00de748..66047b6e8f4 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -219,20 +219,20 @@ void ED_view3d_clipping_enable(void)
}
}
-static int view3d_clipping_test(const float co[3], float clip[6][4])
+static bool view3d_clipping_test(const float co[3], float clip[6][4])
{
if (0.0f < clip[0][3] + dot_v3v3(co, clip[0]))
if (0.0f < clip[1][3] + dot_v3v3(co, clip[1]))
if (0.0f < clip[2][3] + dot_v3v3(co, clip[2]))
if (0.0f < clip[3][3] + dot_v3v3(co, clip[3]))
- return 0;
+ return false;
- return 1;
+ return true;
}
/* for 'local' ED_view3d_clipping_local must run first
* then all comparisons can be done in localspace */
-int ED_view3d_clipping_test(RegionView3D *rv3d, const float co[3], const bool is_local)
+bool ED_view3d_clipping_test(RegionView3D *rv3d, const float co[3], const bool is_local)
{
return view3d_clipping_test(co, is_local ? rv3d->clip_local : rv3d->clip);
}
@@ -1002,7 +1002,7 @@ void ED_view3d_calc_camera_border_size(Scene *scene, ARegion *ar, View3D *v3d, R
{
rctf viewborder;
- view3d_camera_border(scene, ar, v3d, rv3d, &viewborder, TRUE, TRUE);
+ view3d_camera_border(scene, ar, v3d, rv3d, &viewborder, true, true);
r_size[0] = BLI_rctf_size_x(&viewborder);
r_size[1] = BLI_rctf_size_y(&viewborder);
}
@@ -1099,7 +1099,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
if (v3d->camera->type == OB_CAMERA)
ca = v3d->camera->data;
- ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &viewborder, FALSE);
+ ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &viewborder, false);
/* the offsets */
x1 = viewborder.xmin;
y1 = viewborder.ymin;
@@ -1150,10 +1150,10 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
glRectf(x1i, y1i, x2i, y2i);
#ifdef VIEW3D_CAMERA_BORDER_HACK
- if (view3d_camera_border_hack_test == TRUE) {
+ if (view3d_camera_border_hack_test == true) {
glColor3ubv(view3d_camera_border_hack_col);
glRectf(x1i + 1, y1i + 1, x2i - 1, y2i - 1);
- view3d_camera_border_hack_test = FALSE;
+ view3d_camera_border_hack_test = false;
}
#endif
@@ -1433,6 +1433,13 @@ void view3d_opengl_read_pixels(ARegion *ar, int x, int y, int w, int h, int form
}
}
+/* XXX depth reading exception, for code not using gpu offscreen */
+static void view3d_opengl_read_Z_pixels(ARegion *ar, int x, int y, int w, int h, int format, int type, void *data)
+{
+
+ glReadPixels(ar->winrct.xmin + x, ar->winrct.ymin + y, w, h, format, type, data);
+}
+
void view3d_validate_backbuf(ViewContext *vc)
{
if (vc->v3d->flag & V3D_INVALID_BACKBUF)
@@ -1590,7 +1597,7 @@ exit:
/* ************************************************************* */
static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d,
- const short do_foreground, const short do_camera_frame)
+ const bool do_foreground, const bool do_camera_frame)
{
RegionView3D *rv3d = ar->regiondata;
BGpic *bgpic;
@@ -1688,7 +1695,7 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d,
if (do_camera_frame) {
rctf vb;
- ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &vb, FALSE);
+ ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &vb, false);
x1 = vb.xmin;
y1 = vb.ymin;
x2 = vb.xmax;
@@ -1819,7 +1826,12 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d,
glPixelZoom(zoomx, zoomy);
glColor4f(1.0f, 1.0f, 1.0f, 1.0f - bgpic->blend);
- glaDrawPixelsAuto(x1, y1, ibuf->x, ibuf->y, GL_UNSIGNED_BYTE, GL_LINEAR, ibuf->rect);
+
+ /* could not use glaDrawPixelsAuto because it could fallback to
+ * glaDrawPixelsSafe in some cases, which will end up in misssing
+ * alpha transparency for the background image (sergey)
+ */
+ glaDrawPixelsTex(x1, y1, ibuf->x, ibuf->y, GL_UNSIGNED_BYTE, GL_NEAREST, ibuf->rect);
glPixelZoom(1.0, 1.0);
glPixelTransferf(GL_ALPHA_SCALE, 1.0f);
@@ -1843,7 +1855,7 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d,
}
static void view3d_draw_bgpic_test(Scene *scene, ARegion *ar, View3D *v3d,
- const short do_foreground, const short do_camera_frame)
+ const bool do_foreground, const bool do_camera_frame)
{
RegionView3D *rv3d = ar->regiondata;
@@ -1990,7 +2002,7 @@ static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Bas
if (base->object->restrictflag & OB_RESTRICT_VIEW) return;
tbase.flag = OB_FROMDUPLI | base->flag;
- lb = object_duplilist(scene, base->object, FALSE);
+ lb = object_duplilist(scene, base->object, false);
// BLI_sortlist(lb, dupli_ob_sort); /* might be nice to have if we have a dupli list with mixed objects. */
dob = dupli_step(lb->first);
@@ -2020,7 +2032,7 @@ static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Bas
/* generate displist, test for new object */
if (dob_prev && dob_prev->ob != dob->ob) {
- if (use_displist == TRUE)
+ if (use_displist == true)
glDeleteLists(displist, 1);
use_displist = -1;
@@ -2042,7 +2054,7 @@ static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Bas
!(bb_tmp = BKE_object_boundbox_get(dob->ob)))
{
// printf("draw_dupli_objects_color: skipping displist for %s\n", dob->ob->id.name + 2);
- use_displist = FALSE;
+ use_displist = false;
}
else {
// printf("draw_dupli_objects_color: using displist for %s\n", dob->ob->id.name + 2);
@@ -2058,7 +2070,7 @@ static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Bas
draw_object(scene, ar, v3d, &tbase, DRAW_CONSTCOLOR);
glEndList();
- use_displist = TRUE;
+ use_displist = true;
BKE_object_boundbox_flag(dob->ob, OB_BB_DISABLED, 0);
}
}
@@ -2099,6 +2111,7 @@ static void draw_dupli_objects(Scene *scene, ARegion *ar, View3D *v3d, Base *bas
draw_dupli_objects_color(scene, ar, v3d, base, color);
}
+/* XXX warning, not using gpu offscreen here */
void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect)
{
int x, y, w, h;
@@ -2125,7 +2138,7 @@ void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect)
MEM_freeN(d->depths);
d->depths = NULL;
- d->damaged = FALSE;
+ d->damaged = false;
}
else if (d->w != w ||
d->h != h ||
@@ -2144,13 +2157,14 @@ void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect)
d->depths = MEM_mallocN(sizeof(float) * d->w * d->h, "View depths Subset");
- d->damaged = TRUE;
+ d->damaged = true;
}
if (d->damaged) {
- view3d_opengl_read_pixels(ar, d->x, d->y, d->w, d->h, GL_DEPTH_COMPONENT, GL_FLOAT, d->depths);
+ /* XXX using special function here, it doesn't use the gpu offscreen system */
+ view3d_opengl_read_Z_pixels(ar, d->x, d->y, d->w, d->h, GL_DEPTH_COMPONENT, GL_FLOAT, d->depths);
glGetDoublev(GL_DEPTH_RANGE, d->depth_range);
- d->damaged = FALSE;
+ d->damaged = false;
}
}
@@ -2172,14 +2186,14 @@ void ED_view3d_depth_update(ARegion *ar)
if (d->depths)
MEM_freeN(d->depths);
d->depths = MEM_mallocN(sizeof(float) * d->w * d->h, "View depths");
- d->damaged = 1;
+ d->damaged = true;
}
if (d->damaged) {
view3d_opengl_read_pixels(ar, 0, 0, d->w, d->h, GL_DEPTH_COMPONENT, GL_FLOAT, d->depths);
glGetDoublev(GL_DEPTH_RANGE, d->depth_range);
- d->damaged = 0;
+ d->damaged = false;
}
}
}
@@ -2228,7 +2242,7 @@ void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d)
glEnable(GL_DEPTH_TEST);
if (v3d->flag2 & V3D_SHOW_GPENCIL) {
- draw_gpencil_view3d(scene, v3d, ar, TRUE);
+ draw_gpencil_view3d(scene, v3d, ar, true);
}
v3d->zbuf = zbuf;
@@ -2410,7 +2424,7 @@ static void gpu_update_lamps_shadows(Scene *scene, View3D *v3d)
if (ob->transflag & OB_DUPLI) {
DupliObject *dob;
- ListBase *lb = object_duplilist(scene, ob, FALSE);
+ ListBase *lb = object_duplilist(scene, ob, false);
for (dob = lb->first; dob; dob = dob->next)
if (dob->ob->type == OB_LAMP)
@@ -2449,7 +2463,7 @@ static void gpu_update_lamps_shadows(Scene *scene, View3D *v3d)
invert_m4_m4(rv3d.persinv, rv3d.viewinv);
/* no need to call ED_view3d_draw_offscreen_init since shadow buffers were already updated */
- ED_view3d_draw_offscreen(scene, v3d, &ar, winsize, winsize, viewmat, winmat, FALSE);
+ ED_view3d_draw_offscreen(scene, v3d, &ar, winsize, winsize, viewmat, winmat, false);
GPU_lamp_shadow_buffer_unbind(shadow->lamp);
v3d->drawtype = drawtype;
@@ -2597,7 +2611,7 @@ void ED_view3d_draw_offscreen_init(Scene *scene, View3D *v3d)
* stuff like shadow buffers
*/
void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx, int winy,
- float viewmat[4][4], float winmat[4][4], int do_bgpic)
+ float viewmat[4][4], float winmat[4][4], bool do_bgpic)
{
RegionView3D *rv3d = ar->regiondata;
Base *base;
@@ -2648,7 +2662,7 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
/* important to do before clipping */
if (do_bgpic) {
- view3d_draw_bgpic_test(scene, ar, v3d, FALSE, FALSE);
+ view3d_draw_bgpic_test(scene, ar, v3d, false, false);
}
if (rv3d->rflag & RV3D_CLIPPING)
@@ -2682,7 +2696,7 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
/* must be before xray draw which clears the depth buffer */
if (v3d->flag2 & V3D_SHOW_GPENCIL) {
if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
- draw_gpencil_view3d(scene, v3d, ar, TRUE);
+ draw_gpencil_view3d(scene, v3d, ar, true);
if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
}
@@ -2696,7 +2710,7 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
/* important to do after clipping */
if (do_bgpic) {
- view3d_draw_bgpic_test(scene, ar, v3d, TRUE, FALSE);
+ view3d_draw_bgpic_test(scene, ar, v3d, true, false);
}
/* cleanup */
@@ -2711,7 +2725,7 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
if (v3d->flag2 & V3D_SHOW_GPENCIL) {
/* draw grease-pencil stuff - needed to get paint-buffer shown too (since it's 2D) */
- draw_gpencil_view3d(scene, v3d, ar, FALSE);
+ draw_gpencil_view3d(scene, v3d, ar, false);
}
/* freeing the images again here could be done after the operator runs, leaving for now */
@@ -2753,7 +2767,7 @@ static void offscreen_imbuf_add_sky(ImBuf *ibuf, Scene *scene)
/* utility func for ED_view3d_draw_offscreen */
ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, int sizex, int sizey, unsigned int flag,
- int draw_background, int alpha_mode, char err_out[256])
+ bool draw_background, int alpha_mode, char err_out[256])
{
RegionView3D *rv3d = ar->regiondata;
ImBuf *ibuf;
@@ -2811,7 +2825,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in
/* creates own 3d views, used by the sequencer */
ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, Object *camera, int width, int height, unsigned int flag, int drawtype,
- int use_solid_tex, int draw_background, int alpha_mode, char err_out[256])
+ bool use_solid_tex, bool draw_background, int alpha_mode, char err_out[256])
{
View3D v3d = {NULL};
ARegion ar = {NULL};
@@ -2917,7 +2931,7 @@ static void draw_viewport_fps(Scene *scene, rcti *rect)
static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const char **grid_unit);
-static int view3d_main_area_do_render_draw(const bContext *C)
+static bool view3d_main_area_do_render_draw(const bContext *C)
{
Scene *scene = CTX_data_scene(C);
RenderEngineType *type = RE_engines_find(scene->r.engine);
@@ -2925,7 +2939,7 @@ static int view3d_main_area_do_render_draw(const bContext *C)
return (type && type->view_update && type->view_draw);
}
-static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw_border)
+static bool view3d_main_area_draw_engine(const bContext *C, ARegion *ar, const bool draw_border)
{
Scene *scene = CTX_data_scene(C);
View3D *v3d = CTX_wm_view3d(C);
@@ -2940,9 +2954,9 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw
type = RE_engines_find(scene->r.engine);
if (!(type->view_update && type->view_draw))
- return 0;
+ return false;
- engine = RE_engine_create_ex(type, TRUE);
+ engine = RE_engine_create_ex(type, true);
engine->tile_x = scene->r.tilex;
engine->tile_y = scene->r.tiley;
@@ -2964,7 +2978,7 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw
rcti cliprct;
if (rv3d->persp == RV3D_CAMOB) {
- ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &viewborder, FALSE);
+ ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &viewborder, false);
cliprct.xmin = viewborder.xmin + scene->r.border.xmin * BLI_rctf_size_x(&viewborder);
cliprct.ymin = viewborder.ymin + scene->r.border.ymin * BLI_rctf_size_y(&viewborder);
@@ -2992,15 +3006,16 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw
glGetIntegerv(GL_SCISSOR_BOX, scissor);
glScissor(cliprct.xmin, cliprct.ymin, BLI_rcti_size_x(&cliprct), BLI_rcti_size_y(&cliprct));
}
- else
- return 0;
+ else {
+ return false;
+ }
}
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if (v3d->flag & V3D_DISPBGPICS)
- view3d_draw_bgpic(scene, ar, v3d, FALSE, TRUE);
+ view3d_draw_bgpic(scene, ar, v3d, false, true);
else
fdrawcheckerboard(0, 0, ar->winx, ar->winy);
@@ -3009,14 +3024,14 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw
type->view_draw(rv3d->render_engine, C);
if (v3d->flag & V3D_DISPBGPICS)
- view3d_draw_bgpic(scene, ar, v3d, TRUE, TRUE);
+ view3d_draw_bgpic(scene, ar, v3d, true, true);
if (draw_border) {
/* restore scissor as it was before */
glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
}
- return 1;
+ return true;
}
static void view3d_main_area_draw_engine_info(RegionView3D *rv3d, ARegion *ar)
@@ -3045,7 +3060,7 @@ static void view3d_main_area_clear(Scene *scene, View3D *v3d, ARegion *ar)
GLubyte grid_col[VIEWGRAD_RES_X][VIEWGRAD_RES_Y][4];
static float grid_pos[VIEWGRAD_RES_X][VIEWGRAD_RES_Y][3];
static GLushort indices[VIEWGRAD_RES_X - 1][VIEWGRAD_RES_X - 1][4];
- static char buf_calculated = FALSE;
+ static bool buf_calculated = false;
IMB_colormanagement_pixel_to_display_space_v3(col_hor, &scene->world->horr, &scene->view_settings,
&scene->display_settings);
@@ -3084,7 +3099,7 @@ static void view3d_main_area_clear(Scene *scene, View3D *v3d, ARegion *ar)
}
}
- buf_calculated = TRUE;
+ buf_calculated = true;
}
for (x = 0; x < VIEWGRAD_RES_X; x++) {
@@ -3238,7 +3253,6 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const
/* enables anti-aliasing for 3D view drawing */
if (U.ogl_multisamples != USER_MULTISAMPLE_NONE) {
- // if (!(U.gameflags & USER_DISABLE_AA))
glEnable(GL_MULTISAMPLE_ARB);
}
@@ -3271,7 +3285,7 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const
}
}
- view3d_draw_bgpic_test(scene, ar, v3d, FALSE, TRUE);
+ view3d_draw_bgpic_test(scene, ar, v3d, false, true);
if (rv3d->rflag & RV3D_CLIPPING)
ED_view3d_clipping_set(rv3d);
@@ -3335,7 +3349,7 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const
if (v3d->flag2 & V3D_SHOW_GPENCIL) {
/* must be before xray draw which clears the depth buffer */
if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
- draw_gpencil_view3d(scene, v3d, ar, TRUE);
+ draw_gpencil_view3d(scene, v3d, ar, true);
if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
}
@@ -3350,13 +3364,12 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const
ED_view3d_clipping_disable();
/* important to do after clipping */
- view3d_draw_bgpic_test(scene, ar, v3d, TRUE, TRUE);
+ view3d_draw_bgpic_test(scene, ar, v3d, true, true);
BIF_draw_manipulator(C);
/* Disable back anti-aliasing */
if (U.ogl_multisamples != USER_MULTISAMPLE_NONE) {
- // if (!(U.gameflags & USER_DISABLE_AA))
glDisable(GL_MULTISAMPLE_ARB);
}
@@ -3404,7 +3417,7 @@ static void view3d_main_area_draw_info(const bContext *C, ARegion *ar, const cha
if (v3d->flag2 & V3D_SHOW_GPENCIL) {
/* draw grease-pencil stuff - needed to get paint-buffer shown too (since it's 2D) */
- draw_gpencil_view3d(scene, v3d, ar, FALSE);
+ draw_gpencil_view3d(scene, v3d, ar, false);
}
if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
@@ -3456,12 +3469,12 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d = CTX_wm_region_view3d(C);
const char *grid_unit = NULL;
- int draw_border = FALSE;
+ bool draw_border = false;
if (rv3d->persp == RV3D_CAMOB)
- draw_border = scene->r.mode & R_BORDER;
+ draw_border = (scene->r.mode & R_BORDER) != 0;
else
- draw_border = v3d->flag2 & V3D_RENDER_BORDER;
+ draw_border = (v3d->flag2 & V3D_RENDER_BORDER) != 0;
/* draw viewport using opengl */
if (v3d->drawtype != OB_RENDER || !view3d_main_area_do_render_draw(C) || draw_border) {
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index a8e9c8b6cba..9d9dd0535ff 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -88,7 +88,7 @@
/* ********************** view3d_edit: view manipulations ********************* */
-int ED_view3d_camera_lock_check(View3D *v3d, RegionView3D *rv3d)
+bool ED_view3d_camera_lock_check(View3D *v3d, RegionView3D *rv3d)
{
return ((v3d->camera) &&
(v3d->camera->id.lib == NULL) &&
@@ -105,8 +105,8 @@ void ED_view3d_camera_lock_init(View3D *v3d, RegionView3D *rv3d)
}
}
-/* return TRUE if the camera is moved */
-int ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d)
+/* return true if the camera is moved */
+bool ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d)
{
if (ED_view3d_camera_lock_check(v3d, rv3d)) {
ObjectTfmProtectedChannels obtfm;
@@ -130,7 +130,7 @@ int ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d)
mult_m4_m4m4(parent_mat, diff_mat, root_parent->obmat);
BKE_object_tfm_protected_backup(root_parent, &obtfm);
- BKE_object_apply_mat4(root_parent, parent_mat, TRUE, FALSE);
+ BKE_object_apply_mat4(root_parent, parent_mat, true, false);
BKE_object_tfm_protected_restore(root_parent, &obtfm, root_parent->protectflag);
ob_update = v3d->camera;
@@ -149,10 +149,10 @@ int ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d)
WM_main_add_notifier(NC_OBJECT | ND_TRANSFORM, v3d->camera);
}
- return TRUE;
+ return true;
}
else {
- return FALSE;
+ return false;
}
}
@@ -309,7 +309,7 @@ void view3d_boxview_copy(ScrArea *sa, ARegion *ar)
}
/* 'clip' is used to know if our clip setting has changed */
-void ED_view3d_quadview_update(ScrArea *sa, ARegion *ar, short do_clip)
+void ED_view3d_quadview_update(ScrArea *sa, ARegion *ar, bool do_clip)
{
ARegion *ar_sync = NULL;
RegionView3D *rv3d = ar->regiondata;
@@ -323,7 +323,7 @@ void ED_view3d_quadview_update(ScrArea *sa, ARegion *ar, short do_clip)
viewlock = 0;
else if ((viewlock & RV3D_BOXVIEW) == 0) {
viewlock &= ~RV3D_BOXCLIP;
- do_clip = TRUE;
+ do_clip = true;
}
for (; ar; ar = ar->prev) {
@@ -367,12 +367,12 @@ typedef struct ViewOpsData {
float mousevec[3]; /* dolly only */
float reverse, dist0, camzoom0;
float grid, far;
- short axis_snap; /* view rotate only */
+ bool axis_snap; /* view rotate only */
float zfac;
/* use for orbit selection and auto-dist */
float ofs[3], dyn_ofs[3];
- short use_dyn_ofs;
+ bool use_dyn_ofs;
int origx, origy, oldx, oldy;
int origkey; /* the key that triggered the operator */
@@ -432,7 +432,7 @@ static void viewops_data_create(bContext *C, wmOperator *op, const wmEvent *even
vod->origx = vod->oldx = event->x;
vod->origy = vod->oldy = event->y;
vod->origkey = event->type; /* the key that triggered the operator. */
- vod->use_dyn_ofs = (U.uiflag & USER_ORBIT_SELECTION) ? 1 : 0;
+ vod->use_dyn_ofs = (U.uiflag & USER_ORBIT_SELECTION) != 0;
copy_v3_v3(vod->ofs, rv3d->ofs);
if (vod->use_dyn_ofs) {
@@ -454,10 +454,11 @@ static void viewops_data_create(bContext *C, wmOperator *op, const wmEvent *even
negate_v3_v3(vod->dyn_ofs, lastofs);
}
else if (U.uiflag & USER_ZBUF_ORBIT) {
+ Scene *scene = CTX_data_scene(C);
view3d_operator_needs_opengl(C); /* needed for zbuf drawing */
- if ((vod->use_dyn_ofs = ED_view3d_autodist(CTX_data_scene(C), vod->ar, vod->v3d, event->mval, vod->dyn_ofs, true))) {
+ if ((vod->use_dyn_ofs = ED_view3d_autodist(scene, vod->ar, vod->v3d, event->mval, vod->dyn_ofs, true))) {
if (rv3d->is_persp) {
float my_origin[3]; /* original G.vd->ofs */
float my_pivot[3]; /* view */
@@ -856,11 +857,11 @@ static int viewrotate_modal(bContext *C, wmOperator *op, const wmEvent *event)
event_code = VIEW_CONFIRM;
break;
case VIEWROT_MODAL_AXIS_SNAP_ENABLE:
- vod->axis_snap = TRUE;
+ vod->axis_snap = true;
event_code = VIEW_APPLY;
break;
case VIEWROT_MODAL_AXIS_SNAP_DISABLE:
- vod->axis_snap = FALSE;
+ vod->axis_snap = false;
event_code = VIEW_APPLY;
break;
case VIEWROT_MODAL_SWITCH_ZOOM:
@@ -1703,7 +1704,7 @@ static void view_zoom_mouseloc(ARegion *ar, float dfac, int mx, int my)
static void viewzoom_apply(ViewOpsData *vod, const int x, const int y, const short viewzoom, const short zoom_invert)
{
float zfac = 1.0;
- short use_cam_zoom;
+ bool use_cam_zoom;
use_cam_zoom = (vod->rv3d->persp == RV3D_CAMOB) && !(vod->rv3d->is_persp && ED_view3d_camera_lock_check(vod->v3d, vod->rv3d));
@@ -1845,9 +1846,9 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
RegionView3D *rv3d;
ScrArea *sa;
ARegion *ar;
- short use_cam_zoom;
+ bool use_cam_zoom;
- int delta = RNA_int_get(op->ptr, "delta");
+ const int delta = RNA_int_get(op->ptr, "delta");
int mx, my;
if (op->customdata) {
@@ -2108,7 +2109,7 @@ static int viewdolly_exec(bContext *C, wmOperator *op)
ARegion *ar;
float mousevec[3];
- int delta = RNA_int_get(op->ptr, "delta");
+ const int delta = RNA_int_get(op->ptr, "delta");
if (op->customdata) {
ViewOpsData *vod = op->customdata;
@@ -2176,7 +2177,7 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, const wmEvent *event)
}
if (event->type == MOUSEZOOM) {
- /* Bypass Zoom invert flag for track pads (pass FALSE always) */
+ /* Bypass Zoom invert flag for track pads (pass false always) */
if (U.uiflag & USER_ZOOM_HORIZ) {
vod->origx = vod->oldx = event->x;
@@ -2253,7 +2254,7 @@ void VIEW3D_OT_dolly(wmOperatorType *ot)
static void view3d_from_minmax(bContext *C, View3D *v3d, ARegion *ar,
const float min[3], const float max[3],
- int ok_dist)
+ bool ok_dist)
{
RegionView3D *rv3d = ar->regiondata;
float afm[3];
@@ -2292,7 +2293,7 @@ static void view3d_from_minmax(bContext *C, View3D *v3d, ARegion *ar,
else { /* ortho */
if (size < 0.0001f) {
/* bounding box was a single point so do not zoom */
- ok_dist = 0;
+ ok_dist = false;
}
else {
/* adjust zoom so it looks nicer */
@@ -2327,7 +2328,7 @@ static void view3d_from_minmax(bContext *C, View3D *v3d, ARegion *ar,
/* same as view3d_from_minmax but for all regions (except cameras) */
static void view3d_from_minmax_multi(bContext *C, View3D *v3d,
const float min[3], const float max[3],
- const int ok_dist)
+ const bool ok_dist)
{
ScrArea *sa = CTX_wm_area(C);
ARegion *ar;
@@ -2350,14 +2351,14 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in
Scene *scene = CTX_data_scene(C);
Base *base;
float *curs;
- const short use_all_regions = RNA_boolean_get(op->ptr, "use_all_regions");
- const short skip_camera = (ED_view3d_camera_lock_check(v3d, ar->regiondata) ||
- /* any one of the regions may be locked */
- (use_all_regions && v3d->flag2 & V3D_LOCK_CAMERA));
- int center = RNA_boolean_get(op->ptr, "center");
+ const bool use_all_regions = RNA_boolean_get(op->ptr, "use_all_regions");
+ const bool skip_camera = (ED_view3d_camera_lock_check(v3d, ar->regiondata) ||
+ /* any one of the regions may be locked */
+ (use_all_regions && v3d->flag2 & V3D_LOCK_CAMERA));
+ const bool center = RNA_boolean_get(op->ptr, "center");
float min[3], max[3];
- int ok = 1, onedone = FALSE;
+ bool change = false;
if (center) {
/* in 2.4x this also move the cursor to (0, 0, 0) (with shift+c). */
@@ -2372,16 +2373,16 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in
for (base = scene->base.first; base; base = base->next) {
if (BASE_VISIBLE(v3d, base)) {
- onedone = TRUE;
+ change = true;
if (skip_camera && base->object == v3d->camera) {
continue;
}
- BKE_object_minmax(base->object, min, max, FALSE);
+ BKE_object_minmax(base->object, min, max, false);
}
}
- if (!onedone) {
+ if (!change) {
ED_region_tag_redraw(ar);
/* TODO - should this be cancel?
* I think no, because we always move the cursor, with or without
@@ -2393,15 +2394,11 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in
return OPERATOR_FINISHED;
}
- if (ok == 0) {
- return OPERATOR_FINISHED;
- }
-
if (use_all_regions) {
- view3d_from_minmax_multi(C, v3d, min, max, TRUE);
+ view3d_from_minmax_multi(C, v3d, min, max, true);
}
else {
- view3d_from_minmax(C, v3d, ar, min, max, TRUE);
+ view3d_from_minmax(C, v3d, ar, min, max, true);
}
return OPERATOR_FINISHED;
@@ -2438,11 +2435,11 @@ static int viewselected_exec(bContext *C, wmOperator *op)
Object *ob = OBACT;
Object *obedit = CTX_data_edit_object(C);
float min[3], max[3];
- int ok = 0, ok_dist = 1;
- const short use_all_regions = RNA_boolean_get(op->ptr, "use_all_regions");
- const short skip_camera = (ED_view3d_camera_lock_check(v3d, ar->regiondata) ||
- /* any one of the regions may be locked */
- (use_all_regions && v3d->flag2 & V3D_LOCK_CAMERA));
+ bool ok = false, ok_dist = true;
+ const bool use_all_regions = RNA_boolean_get(op->ptr, "use_all_regions");
+ const bool skip_camera = (ED_view3d_camera_lock_check(v3d, ar->regiondata) ||
+ /* any one of the regions may be locked */
+ (use_all_regions && v3d->flag2 & V3D_LOCK_CAMERA));
INIT_MINMAX(min, max);
@@ -2505,8 +2502,8 @@ static int viewselected_exec(bContext *C, wmOperator *op)
}
/* account for duplis */
- if (BKE_object_minmax_dupli(scene, base->object, min, max, FALSE) == 0)
- BKE_object_minmax(base->object, min, max, FALSE); /* use if duplis not found */
+ if (BKE_object_minmax_dupli(scene, base->object, min, max, false) == 0)
+ BKE_object_minmax(base->object, min, max, false); /* use if duplis not found */
ok = 1;
}
@@ -2726,7 +2723,7 @@ static int render_border_exec(bContext *C, wmOperator *op)
rcti rect;
rctf vb, border;
- int camera_only = RNA_boolean_get(op->ptr, "camera_only");
+ const bool camera_only = RNA_boolean_get(op->ptr, "camera_only");
if (camera_only && rv3d->persp != RV3D_CAMOB)
return OPERATOR_PASS_THROUGH;
@@ -2737,7 +2734,7 @@ static int render_border_exec(bContext *C, wmOperator *op)
/* calculate range */
if (rv3d->persp == RV3D_CAMOB) {
- ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &vb, FALSE);
+ ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &vb, false);
}
else {
vb.xmin = 0;
@@ -3040,7 +3037,7 @@ void VIEW3D_OT_zoom_border(wmOperatorType *ot)
ot->flag = 0;
/* rna */
- WM_operator_properties_gesture_border(ot, FALSE);
+ WM_operator_properties_gesture_border(ot, false);
}
/* sets the view to 1:1 camera/render-pixel */
@@ -3106,7 +3103,7 @@ static EnumPropertyItem prop_view_items[] = {
static void axis_set_view(bContext *C, View3D *v3d, ARegion *ar,
float q1, float q2, float q3, float q4,
- short view, int perspo, int align_active)
+ short view, int perspo, bool align_active)
{
RegionView3D *rv3d = ar->regiondata; /* no NULL check is needed, poll checks */
float new_quat[4];
@@ -3120,14 +3117,14 @@ static void axis_set_view(bContext *C, View3D *v3d, ARegion *ar,
Object *obact = CTX_data_active_object(C);
if (obact == NULL) {
/* no active object, ignore this option */
- align_active = FALSE;
+ align_active = false;
}
else {
float obact_quat[4];
float twmat[3][3];
/* same as transform manipulator when normal is set */
- ED_getTransformOrientationMatrix(C, twmat, FALSE);
+ ED_getTransformOrientationMatrix(C, twmat, false);
mat3_to_quat(obact_quat, twmat);
invert_qt(obact_quat);
@@ -3137,7 +3134,7 @@ static void axis_set_view(bContext *C, View3D *v3d, ARegion *ar,
}
}
- if (align_active == FALSE) {
+ if (align_active == false) {
/* normal operation */
if (rv3d->viewlock) {
/* only pass on if */
@@ -3186,7 +3183,8 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
RegionView3D *rv3d;
Scene *scene = CTX_data_scene(C);
static int perspo = RV3D_PERSP;
- int viewnum, align_active, nextperspo;
+ int viewnum, nextperspo;
+ bool align_active;
/* no NULL check is needed, poll checks */
ED_view3d_context_user_region(C, &v3d, &ar);
@@ -3197,7 +3195,7 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
/* set this to zero, gets handled in axis_set_view */
if (rv3d->viewlock)
- align_active = 0;
+ align_active = false;
/* Use this to test if we started out with a camera */
@@ -3584,7 +3582,7 @@ void VIEW3D_OT_background_image_add(wmOperatorType *ot)
static int background_image_remove_exec(bContext *C, wmOperator *op)
{
View3D *v3d = CTX_wm_view3d(C);
- int index = RNA_int_get(op->ptr, "index");
+ const int index = RNA_int_get(op->ptr, "index");
BGpic *bgpic_rem = BLI_findlink(&v3d->bgpicbase, index);
if (bgpic_rem) {
@@ -3741,15 +3739,15 @@ void ED_view3d_cursor3d_position(bContext *C, float fp[3], const int mval[2])
}
if (ED_view3d_project_float_global(ar, fp, mval_fl, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
- short depth_used = FALSE;
+ bool depth_used = false;
if (U.uiflag & USER_ZBUF_CURSOR) { /* maybe this should be accessed some other way */
view3d_operator_needs_opengl(C);
if (ED_view3d_autodist(scene, ar, v3d, mval, fp, true))
- depth_used = TRUE;
+ depth_used = true;
}
- if (depth_used == FALSE) {
+ if (depth_used == false) {
float dvec[3];
VECSUB2D(mval_fl, mval_fl, mval);
ED_view3d_win_to_delta(ar, mval_fl, dvec, zfac);
@@ -3917,7 +3915,7 @@ static float view_autodist_depth_margin(ARegion *ar, const int mval[2], int marg
}
/* XXX todo Zooms in on a border drawn by the user */
-int ED_view3d_autodist(Scene *scene, ARegion *ar, View3D *v3d, const int mval[2], float mouse_worldloc[3], bool alphaoverride)
+bool ED_view3d_autodist(Scene *scene, ARegion *ar, View3D *v3d, const int mval[2], float mouse_worldloc[3], bool alphaoverride)
{
bglMats mats; /* ZBuffer depth vars */
float depth_close = FLT_MAX;
@@ -3930,7 +3928,7 @@ int ED_view3d_autodist(Scene *scene, ARegion *ar, View3D *v3d, const int mval[2]
depth_close = view_autodist_depth_margin(ar, mval, 4);
if (depth_close == FLT_MAX)
- return 0;
+ return false;
cent[0] = (double)mval[0];
cent[1] = (double)mval[1];
@@ -3938,16 +3936,16 @@ int ED_view3d_autodist(Scene *scene, ARegion *ar, View3D *v3d, const int mval[2]
if (!gluUnProject(cent[0], cent[1], depth_close,
mats.modelview, mats.projection, (GLint *)mats.viewport, &p[0], &p[1], &p[2]))
{
- return 0;
+ return false;
}
mouse_worldloc[0] = (float)p[0];
mouse_worldloc[1] = (float)p[1];
mouse_worldloc[2] = (float)p[2];
- return 1;
+ return true;
}
-int ED_view3d_autodist_init(Scene *scene, ARegion *ar, View3D *v3d, int mode)
+void ED_view3d_autodist_init(Scene *scene, ARegion *ar, View3D *v3d, int mode)
{
/* Get Z Depths, needed for perspective, nice for ortho */
switch (mode) {
@@ -3958,13 +3956,11 @@ int ED_view3d_autodist_init(Scene *scene, ARegion *ar, View3D *v3d, int mode)
draw_depth_gpencil(scene, ar, v3d);
break;
}
-
- return 1;
}
-/* no 4x4 sampling, run view_autodist_init first */
-int ED_view3d_autodist_simple(ARegion *ar, const int mval[2], float mouse_worldloc[3],
- int margin, float *force_depth)
+/* no 4x4 sampling, run #ED_view3d_autodist_init first */
+bool ED_view3d_autodist_simple(ARegion *ar, const int mval[2], float mouse_worldloc[3],
+ int margin, float *force_depth)
{
bglMats mats; /* ZBuffer depth vars, could cache? */
float depth;
@@ -3977,7 +3973,7 @@ int ED_view3d_autodist_simple(ARegion *ar, const int mval[2], float mouse_worldl
depth = view_autodist_depth_margin(ar, mval, margin);
if (depth == FLT_MAX)
- return 0;
+ return false;
cent[0] = (double)mval[0];
cent[1] = (double)mval[1];
@@ -3987,23 +3983,23 @@ int ED_view3d_autodist_simple(ARegion *ar, const int mval[2], float mouse_worldl
if (!gluUnProject(cent[0], cent[1], depth,
mats.modelview, mats.projection, (GLint *)mats.viewport, &p[0], &p[1], &p[2]))
{
- return 0;
+ return false;
}
mouse_worldloc[0] = (float)p[0];
mouse_worldloc[1] = (float)p[1];
mouse_worldloc[2] = (float)p[2];
- return 1;
+ return true;
}
-int ED_view3d_autodist_depth(ARegion *ar, const int mval[2], int margin, float *depth)
+bool ED_view3d_autodist_depth(ARegion *ar, const int mval[2], int margin, float *depth)
{
*depth = view_autodist_depth_margin(ar, mval, margin);
- return (*depth == FLT_MAX) ? 0 : 1;
+ return (*depth != FLT_MAX);
}
-static int depth_segment_cb(int x, int y, void *userData)
+static bool depth_segment_cb(int x, int y, void *userData)
{
struct { ARegion *ar; int margin; float depth; } *data = userData;
int mval[2];
@@ -4023,8 +4019,8 @@ static int depth_segment_cb(int x, int y, void *userData)
}
}
-int ED_view3d_autodist_depth_seg(ARegion *ar, const int mval_sta[2], const int mval_end[2],
- int margin, float *depth)
+bool ED_view3d_autodist_depth_seg(ARegion *ar, const int mval_sta[2], const int mval_end[2],
+ int margin, float *depth)
{
struct { ARegion *ar; int margin; float depth; } data = {NULL};
int p1[2];
@@ -4041,7 +4037,7 @@ int ED_view3d_autodist_depth_seg(ARegion *ar, const int mval_sta[2], const int m
*depth = data.depth;
- return (*depth == FLT_MAX) ? 0 : 1;
+ return (*depth != FLT_MAX);
}
/* problem - ofs[3] can be on same location as camera itself.
@@ -4155,7 +4151,7 @@ void ED_view3d_to_object(Object *ob, const float ofs[3], const float quat[4], co
{
float mat[4][4];
ED_view3d_to_m4(mat, ofs, quat, dist);
- BKE_object_apply_mat4(ob, mat, TRUE, TRUE);
+ BKE_object_apply_mat4(ob, mat, true, true);
}
BGpic *ED_view3D_background_image_new(View3D *v3d)
@@ -4198,6 +4194,6 @@ void ED_view3D_lock_clear(View3D *v3d)
{
v3d->ob_centre = NULL;
v3d->ob_centre_bone[0] = '\0';
- v3d->ob_centre_cursor = FALSE;
+ v3d->ob_centre_cursor = false;
v3d->flag2 &= ~V3D_LOCK_CAMERA;
}
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index 700027d62a2..2cedf7da725 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -78,9 +78,21 @@ enum {
FLY_MODAL_FREELOOK_ENABLE,
FLY_MODAL_FREELOOK_DISABLE,
FLY_MODAL_SPEED, /* mousepan typically */
-
};
+/* relative view axis locking - xlock, zlock */
+typedef enum eFlyPanState {
+ /* disabled */
+ FLY_AXISLOCK_STATE_OFF = 0,
+
+ /* enabled but not checking because mouse hasn't moved outside the margin since locking was checked an not needed
+ * when the mouse moves, locking is set to 2 so checks are done. */
+ FLY_AXISLOCK_STATE_IDLE = 1,
+
+ /* mouse moved and checking needed, if no view altering is done its changed back to #FLY_AXISLOCK_STATE_IDLE */
+ FLY_AXISLOCK_STATE_ACTIVE = 2
+} eFlyPanState;
+
/* called in transform_ops.c, on each regeneration of keymaps */
void fly_modal_keymap(wmKeyConfig *keyconf)
{
@@ -170,11 +182,11 @@ typedef struct FlyInfo {
wmTimer *timer; /* needed for redraws */
short state;
- short redraw;
- unsigned char use_precision;
+ bool redraw;
+ bool use_precision;
/* if the user presses shift they can look about
* without moving the direction there looking */
- unsigned char use_freelook;
+ bool use_freelook;
int mval[2]; /* latest 2D mouse values */
wmNDOFMotionData *ndof; /* latest 3D mouse values */
@@ -182,14 +194,9 @@ typedef struct FlyInfo {
/* fly state state */
float speed; /* the speed the view is moving per redraw */
short axis; /* Axis index to move along by default Z to move along the view */
- short pan_view; /* when true, pan the view instead of rotating */
-
- /* relative view axis locking - xlock, zlock
- * 0) disabled
- * 1) enabled but not checking because mouse hasn't moved outside the margin since locking was checked an not needed
- * when the mouse moves, locking is set to 2 so checks are done.
- * 2) mouse moved and checking needed, if no view altering is done its changed back to 1 */
- short xlock, zlock;
+ bool pan_view; /* when true, pan the view instead of rotating */
+
+ eFlyPanState xlock, zlock;
float xlock_momentum, zlock_momentum; /* nicer dynamics */
float grid; /* world scale 1.0 default */
@@ -208,7 +215,7 @@ typedef struct FlyInfo {
/* are we flying an ortho camera in perspective view,
* which was originall in ortho view?
* could probably figure it out but better be explicit */
- short is_ortho_cam;
+ bool is_ortho_cam;
void *obtfm; /* backup the objects transform */
/* compare between last state */
@@ -272,7 +279,7 @@ static void drawFlyPixel(const struct bContext *UNUSED(C), ARegion *UNUSED(ar),
#define FLY_CANCEL 1
#define FLY_CONFIRM 2
-static int initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, const wmEvent *event)
+static bool initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, const wmEvent *event)
{
wmWindow *win = CTX_wm_window(C);
float upvec[3]; /* tmp */
@@ -294,30 +301,30 @@ static int initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, const wmEvent
if (fly->rv3d->persp == RV3D_CAMOB && fly->v3d->camera->id.lib) {
BKE_report(op->reports, RPT_ERROR, "Cannot fly a camera from an external library");
- return FALSE;
+ return false;
}
if (fly->v3d->ob_centre) {
BKE_report(op->reports, RPT_ERROR, "Cannot fly when the view is locked to an object");
- return FALSE;
+ return false;
}
if (fly->rv3d->persp == RV3D_CAMOB && fly->v3d->camera->constraints.first) {
BKE_report(op->reports, RPT_ERROR, "Cannot fly an object with constraints");
- return FALSE;
+ return false;
}
fly->state = FLY_RUNNING;
fly->speed = 0.0f;
fly->axis = 2;
- fly->pan_view = FALSE;
- fly->xlock = FALSE;
- fly->zlock = FALSE;
+ fly->pan_view = false;
+ fly->xlock = FLY_AXISLOCK_STATE_OFF;
+ fly->zlock = FLY_AXISLOCK_STATE_OFF;
fly->xlock_momentum = 0.0f;
fly->zlock_momentum = 0.0f;
fly->grid = 1.0f;
- fly->use_precision = FALSE;
- fly->use_freelook = FALSE;
+ fly->use_precision = false;
+ fly->use_freelook = false;
#ifdef NDOF_FLY_DRAW_TOOMUCH
fly->redraw = 1;
@@ -342,7 +349,7 @@ static int initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, const wmEvent
copy_m3_m4(mat, fly->rv3d->viewinv);
mul_m3_v3(mat, upvec);
if (fabsf(upvec[2]) < 0.1f) {
- fly->zlock = 1;
+ fly->zlock = FLY_AXISLOCK_STATE_IDLE;
}
upvec[0] = 0;
upvec[1] = 0;
@@ -354,10 +361,10 @@ static int initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, const wmEvent
/* check for flying ortho camera - which we cant support well
* we _could_ also check for an ortho camera but this is easier */
if ((fly->rv3d->persp == RV3D_CAMOB) &&
- (fly->rv3d->is_persp == FALSE))
+ (fly->rv3d->is_persp == false))
{
((Camera *)fly->v3d->camera->data)->type = CAM_PERSP;
- fly->is_ortho_cam = TRUE;
+ fly->is_ortho_cam = true;
}
if (fly->rv3d->persp == RV3D_CAMOB) {
@@ -601,11 +608,11 @@ static void flyEvent(FlyInfo *fly, const wmEvent *event)
break;
}
case FLY_MODAL_PAN_ENABLE:
- fly->pan_view = TRUE;
+ fly->pan_view = true;
break;
case FLY_MODAL_PAN_DISABLE:
//XXX2.5 WM_cursor_warp(CTX_wm_window(C), cent_orig[0], cent_orig[1]);
- fly->pan_view = FALSE;
+ fly->pan_view = false;
break;
/* implement WASD keys,
@@ -677,40 +684,41 @@ static void flyEvent(FlyInfo *fly, const wmEvent *event)
break;
case FLY_MODAL_AXIS_LOCK_X:
- if (fly->xlock)
- fly->xlock = 0;
+ if (fly->xlock != FLY_AXISLOCK_STATE_OFF)
+ fly->xlock = FLY_AXISLOCK_STATE_OFF;
else {
- fly->xlock = 2;
+ fly->xlock = FLY_AXISLOCK_STATE_ACTIVE;
fly->xlock_momentum = 0.0;
}
break;
case FLY_MODAL_AXIS_LOCK_Z:
- if (fly->zlock)
- fly->zlock = 0;
+ if (fly->zlock != FLY_AXISLOCK_STATE_OFF)
+ fly->zlock = FLY_AXISLOCK_STATE_OFF;
else {
- fly->zlock = 2;
+ fly->zlock = FLY_AXISLOCK_STATE_ACTIVE;
fly->zlock_momentum = 0.0;
}
break;
case FLY_MODAL_PRECISION_ENABLE:
- fly->use_precision = TRUE;
+ fly->use_precision = true;
break;
case FLY_MODAL_PRECISION_DISABLE:
- fly->use_precision = FALSE;
+ fly->use_precision = false;
break;
case FLY_MODAL_FREELOOK_ENABLE:
- fly->use_freelook = TRUE;
+ fly->use_freelook = true;
break;
case FLY_MODAL_FREELOOK_DISABLE:
- fly->use_freelook = FALSE;
+ fly->use_freelook = false;
break;
}
}
}
-static void move_camera(bContext *C, RegionView3D *rv3d, FlyInfo *fly, int orientationChanged, int positionChanged)
+static void flyMoveCamera(bContext *C, RegionView3D *rv3d, FlyInfo *fly,
+ const bool do_rotate, const bool do_translate)
{
/* we are in camera view so apply the view ofs and quat to the view matrix and set the camera to the view */
@@ -733,7 +741,7 @@ static void move_camera(bContext *C, RegionView3D *rv3d, FlyInfo *fly, int orien
ED_view3d_to_m4(view_mat, rv3d->ofs, rv3d->viewquat, rv3d->dist);
mult_m4_m4m4(diff_mat, view_mat, prev_view_imat);
mult_m4_m4m4(parent_mat, diff_mat, fly->root_parent->obmat);
- BKE_object_apply_mat4(fly->root_parent, parent_mat, TRUE, FALSE);
+ BKE_object_apply_mat4(fly->root_parent, parent_mat, true, false);
// BKE_object_where_is_calc(scene, fly->root_parent);
@@ -748,7 +756,7 @@ static void move_camera(bContext *C, RegionView3D *rv3d, FlyInfo *fly, int orien
else {
float view_mat[4][4];
ED_view3d_to_m4(view_mat, rv3d->ofs, rv3d->viewquat, rv3d->dist);
- BKE_object_apply_mat4(v3d->camera, view_mat, TRUE, FALSE);
+ BKE_object_apply_mat4(v3d->camera, view_mat, true, false);
id_key = &v3d->camera->id;
}
@@ -764,11 +772,11 @@ static void move_camera(bContext *C, RegionView3D *rv3d, FlyInfo *fly, int orien
* 2) on each subsequent frame
* TODO: need to check in future that frame changed before doing this
*/
- if (orientationChanged) {
+ if (do_rotate) {
KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_ROTATION_ID);
ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA);
}
- if (positionChanged) {
+ if (do_translate) {
KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_LOCATION_ID);
ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA);
}
@@ -851,7 +859,8 @@ static int flyApply(bContext *C, FlyInfo *fly)
/* Should we redraw? */
if ((fly->speed != 0.0f) ||
moffset[0] || moffset[1] ||
- fly->zlock || fly->xlock ||
+ (fly->zlock != FLY_AXISLOCK_STATE_OFF) ||
+ (fly->xlock != FLY_AXISLOCK_STATE_OFF) ||
dvec[0] || dvec[1] || dvec[2])
{
float dvec_tmp[3];
@@ -876,7 +885,7 @@ static int flyApply(bContext *C, FlyInfo *fly)
copy_m3_m4(mat, rv3d->viewinv);
- if (fly->pan_view == TRUE) {
+ if (fly->pan_view == true) {
/* pan only */
dvec_tmp[0] = -moffset[0];
dvec_tmp[1] = -moffset[1];
@@ -904,10 +913,10 @@ static int flyApply(bContext *C, FlyInfo *fly)
axis_angle_to_quat(tmp_quat, upvec, (float)moffset[1] * time_redraw * -FLY_ROTATE_FAC);
mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, tmp_quat);
- if (fly->xlock)
- fly->xlock = 2; /* check for rotation */
- if (fly->zlock)
- fly->zlock = 2;
+ if (fly->xlock != FLY_AXISLOCK_STATE_OFF)
+ fly->xlock = FLY_AXISLOCK_STATE_ACTIVE; /* check for rotation */
+ if (fly->zlock != FLY_AXISLOCK_STATE_OFF)
+ fly->zlock = FLY_AXISLOCK_STATE_ACTIVE;
fly->xlock_momentum = 0.0f;
}
@@ -940,13 +949,13 @@ static int flyApply(bContext *C, FlyInfo *fly)
axis_angle_to_quat(tmp_quat, upvec, (float)moffset[0] * time_redraw * FLY_ROTATE_FAC);
mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, tmp_quat);
- if (fly->xlock)
- fly->xlock = 2; /* check for rotation */
- if (fly->zlock)
- fly->zlock = 2;
+ if (fly->xlock != FLY_AXISLOCK_STATE_OFF)
+ fly->xlock = FLY_AXISLOCK_STATE_ACTIVE; /* check for rotation */
+ if (fly->zlock != FLY_AXISLOCK_STATE_OFF)
+ fly->zlock = FLY_AXISLOCK_STATE_ACTIVE;
}
- if (fly->zlock == 2) {
+ if (fly->zlock == FLY_AXISLOCK_STATE_ACTIVE) {
upvec[0] = 1.0f;
upvec[1] = 0.0f;
upvec[2] = 0.0f;
@@ -968,12 +977,13 @@ static int flyApply(bContext *C, FlyInfo *fly)
fly->zlock_momentum += FLY_ZUP_CORRECT_ACCEL;
}
else {
- fly->zlock = 1; /* don't check until the view rotates again */
+ fly->zlock = FLY_AXISLOCK_STATE_IDLE; /* don't check until the view rotates again */
fly->zlock_momentum = 0.0f;
}
}
- if (fly->xlock == 2 && moffset[1] == 0) { /* only apply xcorrect when mouse isn't applying x rot */
+ /* only apply xcorrect when mouse isn't applying x rot */
+ if (fly->xlock == FLY_AXISLOCK_STATE_ACTIVE && moffset[1] == 0) {
upvec[0] = 0;
upvec[1] = 0;
upvec[2] = 1;
@@ -995,7 +1005,7 @@ static int flyApply(bContext *C, FlyInfo *fly)
fly->xlock_momentum += 0.05f;
}
else {
- fly->xlock = 1; /* see above */
+ fly->xlock = FLY_AXISLOCK_STATE_IDLE; /* see above */
fly->xlock_momentum = 0.0f;
}
}
@@ -1035,8 +1045,13 @@ static int flyApply(bContext *C, FlyInfo *fly)
add_v3_v3(rv3d->ofs, dvec);
- if (rv3d->persp == RV3D_CAMOB)
- move_camera(C, rv3d, fly, (fly->xlock || fly->zlock || moffset[0] || moffset[1]), fly->speed);
+ if (rv3d->persp == RV3D_CAMOB) {
+ const bool do_rotate = ((fly->xlock != FLY_AXISLOCK_STATE_OFF) ||
+ (fly->zlock != FLY_AXISLOCK_STATE_OFF) ||
+ ((moffset[0] || moffset[1]) && !fly->pan_view));
+ const bool do_translate = (fly->speed != 0.0f || fly->pan_view);
+ flyMoveCamera(C, rv3d, fly, do_rotate, do_translate);
+ }
}
else {
@@ -1059,19 +1074,19 @@ static int flyApply_ndof(bContext *C, FlyInfo *fly)
const int flag = U.ndof_flag;
#if 0
- int shouldRotate = (flag & NDOF_SHOULD_ROTATE) && (fly->pan_view == FALSE);
- int shouldTranslate = (flag & (NDOF_SHOULD_PAN | NDOF_SHOULD_ZOOM));
+ bool do_rotate = (flag & NDOF_SHOULD_ROTATE) && (fly->pan_view == false);
+ bool do_translate = (flag & (NDOF_SHOULD_PAN | NDOF_SHOULD_ZOOM));
#endif
- int shouldRotate = (fly->pan_view == FALSE);
- int shouldTranslate = TRUE;
+ bool do_rotate = (fly->pan_view == false);
+ bool do_translate = true;
float view_inv[4];
invert_qt_qt(view_inv, rv3d->viewquat);
rv3d->rot_angle = 0.0f; /* disable onscreen rotation doo-dad */
- if (shouldTranslate) {
+ if (do_translate) {
const float forward_sensitivity = 1.0f;
const float vertical_sensitivity = 0.4f;
const float lateral_sensitivity = 0.6f;
@@ -1107,14 +1122,14 @@ static int flyApply_ndof(bContext *C, FlyInfo *fly)
if (!is_zero_v3(trans)) {
/* move center of view opposite of hand motion (this is camera mode, not object mode) */
sub_v3_v3(rv3d->ofs, trans);
- shouldTranslate = TRUE;
+ do_translate = true;
}
else {
- shouldTranslate = FALSE;
+ do_translate = false;
}
}
- if (shouldRotate) {
+ if (do_rotate) {
const float turn_sensitivity = 1.0f;
float rotation[4];
@@ -1122,7 +1137,7 @@ static int flyApply_ndof(bContext *C, FlyInfo *fly)
float angle = turn_sensitivity * ndof_to_axis_angle(ndof, axis);
if (fabsf(angle) > 0.0001f) {
- shouldRotate = TRUE;
+ do_rotate = true;
if (fly->use_precision)
angle *= 0.2f;
@@ -1164,15 +1179,15 @@ static int flyApply_ndof(bContext *C, FlyInfo *fly)
rv3d->view = RV3D_VIEW_USER;
}
else {
- shouldRotate = FALSE;
+ do_rotate = false;
}
}
- if (shouldTranslate || shouldRotate) {
- fly->redraw = TRUE;
+ if (do_translate || do_rotate) {
+ fly->redraw = true;
if (rv3d->persp == RV3D_CAMOB) {
- move_camera(C, rv3d, fly, shouldRotate, shouldTranslate);
+ flyMoveCamera(C, rv3d, fly, do_rotate, do_translate);
}
}
@@ -1191,7 +1206,7 @@ static int fly_invoke(bContext *C, wmOperator *op, const wmEvent *event)
op->customdata = fly;
- if (initFlyInfo(C, fly, op, event) == FALSE) {
+ if (initFlyInfo(C, fly, op, event) == false) {
MEM_freeN(op->customdata);
return OPERATOR_CANCELLED;
}
@@ -1217,7 +1232,7 @@ static int fly_cancel(bContext *C, wmOperator *op)
static int fly_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
int exit_code;
- short do_draw = FALSE;
+ bool do_draw = false;
FlyInfo *fly = op->customdata;
RegionView3D *rv3d = fly->rv3d;
Object *fly_object = fly->root_parent ? fly->root_parent : fly->v3d->camera;
@@ -1240,7 +1255,7 @@ static int fly_modal(bContext *C, wmOperator *op, const wmEvent *event)
exit_code = flyEnd(C, fly);
if (exit_code != OPERATOR_RUNNING_MODAL)
- do_draw = TRUE;
+ do_draw = true;
if (do_draw) {
if (rv3d->persp == RV3D_CAMOB) {
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index 430ed8698d7..854bd9f6cf8 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -147,7 +147,7 @@ static int view3d_layers_exec(bContext *C, wmOperator *op)
ScrArea *sa = CTX_wm_area(C);
View3D *v3d = sa->spacedata.first;
int nr = RNA_int_get(op->ptr, "nr");
- int toggle = RNA_boolean_get(op->ptr, "toggle");
+ const bool toggle = RNA_boolean_get(op->ptr, "toggle");
if (nr < 0)
return OPERATOR_CANCELLED;
@@ -198,7 +198,7 @@ static int view3d_layers_exec(bContext *C, wmOperator *op)
if (v3d->scenelock) handle_view3d_lock(C);
- DAG_on_visible_update(CTX_data_main(C), FALSE);
+ DAG_on_visible_update(CTX_data_main(C), false);
ED_area_tag_redraw(sa);
@@ -215,10 +215,10 @@ static int view3d_layers_invoke(bContext *C, wmOperator *op, const wmEvent *even
if (event->shift)
RNA_boolean_set(op->ptr, "extend", TRUE);
else
- RNA_boolean_set(op->ptr, "extend", FALSE);
+ RNA_boolean_set(op->ptr, "extend", false);
if (event->alt) {
- int nr = RNA_int_get(op->ptr, "nr") + 10;
+ const int nr = RNA_int_get(op->ptr, "nr") + 10;
RNA_int_set(op->ptr, "nr", nr);
}
view3d_layers_exec(C, op);
diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index 8bce8cd3e01..11cd0fdb1d7 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -122,14 +122,14 @@ void draw_motion_paths_cleanup(View3D *v3d);
/* drawobject.c */
void draw_object(Scene *scene, struct ARegion *ar, View3D *v3d, Base *base, const short dflag);
-int draw_glsl_material(Scene *scene, struct Object *ob, View3D *v3d, const char dt);
+bool draw_glsl_material(Scene *scene, struct Object *ob, View3D *v3d, const char dt);
void draw_object_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob, const char dt, int outline);
void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob);
void drawaxes(float size, char drawtype);
void view3d_cached_text_draw_begin(void);
void view3d_cached_text_draw_add(const float co[3], const char *str, short xoffs, short flag, const unsigned char col[4]);
-void view3d_cached_text_draw_end(View3D * v3d, ARegion * ar, int depth_write, float mat[4][4]);
+void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, bool depth_write, float mat[4][4]);
enum {
V3D_CACHE_TEXT_ZBUF = (1 << 0),
@@ -140,9 +140,9 @@ enum {
};
/* drawarmature.c */
-int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
- const short dt, const short dflag, const unsigned char ob_wire_col[4],
- const short is_outline);
+bool draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
+ const short dt, const short dflag, const unsigned char ob_wire_col[4],
+ const bool is_outline);
/* drawmesh.c */
void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d,
@@ -176,7 +176,7 @@ void VIEW3D_OT_localview(struct wmOperatorType *ot);
void VIEW3D_OT_game_start(struct wmOperatorType *ot);
-int ED_view3d_boundbox_clip(RegionView3D * rv3d, float obmat[4][4], struct BoundBox *bb);
+bool ED_view3d_boundbox_clip(RegionView3D *rv3d, float obmat[4][4], const struct BoundBox *bb);
void view3d_smooth_view(struct bContext *C, struct View3D *v3d, struct ARegion *ar, struct Object *, struct Object *,
float *ofs, float *quat, float *dist, float *lens);
@@ -200,7 +200,7 @@ void view3d_toolshelf_register(struct ARegionType *art);
void view3d_tool_props_register(struct ARegionType *art);
/* view3d_snap.c */
-int ED_view3d_minmax_verts(struct Object *obedit, float min[3], float max[3]);
+bool ED_view3d_minmax_verts(struct Object *obedit, float min[3], float max[3]);
void VIEW3D_OT_snap_selected_to_grid(struct wmOperatorType *ot);
void VIEW3D_OT_snap_selected_to_cursor(struct wmOperatorType *ot);
@@ -239,7 +239,7 @@ void draw_smoke_heat(struct SmokeDomainSettings *domain, struct Object *ob);
#define VIEW3D_CAMERA_BORDER_HACK
#ifdef VIEW3D_CAMERA_BORDER_HACK
extern unsigned char view3d_camera_border_hack_col[3];
-extern short view3d_camera_border_hack_test;
+extern bool view3d_camera_border_hack_test;
#endif
#endif /* __VIEW3D_INTERN_H__ */
diff --git a/source/blender/editors/space_view3d/view3d_project.c b/source/blender/editors/space_view3d/view3d_project.c
index 30a100283cc..7d728234c92 100644
--- a/source/blender/editors/space_view3d/view3d_project.c
+++ b/source/blender/editors/space_view3d/view3d_project.c
@@ -110,8 +110,8 @@ eV3DProjStatus ED_view3d_project_base(const struct ARegion *ar, struct Base *bas
}
/* perspmat is typically...
- * - 'rv3d->perspmat', is_local == FALSE
- * - 'rv3d->persmatob', is_local == TRUE
+ * - 'rv3d->perspmat', is_local == false
+ * - 'rv3d->persmatob', is_local == true
*/
static eV3DProjStatus ed_view3d_project__internal(const ARegion *ar,
float perspmat[4][4], const bool is_local, /* normally hidden */
@@ -231,39 +231,39 @@ eV3DProjStatus ED_view3d_project_float_ex(const ARegion *ar, float perspmat[4][4
eV3DProjStatus ED_view3d_project_short_global(const ARegion *ar, const float co[3], short r_co[2], const eV3DProjTest flag)
{
RegionView3D *rv3d = ar->regiondata;
- return ED_view3d_project_short_ex(ar, rv3d->persmat, FALSE, co, r_co, flag);
+ return ED_view3d_project_short_ex(ar, rv3d->persmat, false, co, r_co, flag);
}
/* object space, use ED_view3d_init_mats_rv3d before calling */
eV3DProjStatus ED_view3d_project_short_object(const ARegion *ar, const float co[3], short r_co[2], const eV3DProjTest flag)
{
RegionView3D *rv3d = ar->regiondata;
- return ED_view3d_project_short_ex(ar, rv3d->persmatob, TRUE, co, r_co, flag);
+ return ED_view3d_project_short_ex(ar, rv3d->persmatob, true, co, r_co, flag);
}
/* --- int --- */
eV3DProjStatus ED_view3d_project_int_global(const ARegion *ar, const float co[3], int r_co[2], const eV3DProjTest flag)
{
RegionView3D *rv3d = ar->regiondata;
- return ED_view3d_project_int_ex(ar, rv3d->persmat, FALSE, co, r_co, flag);
+ return ED_view3d_project_int_ex(ar, rv3d->persmat, false, co, r_co, flag);
}
/* object space, use ED_view3d_init_mats_rv3d before calling */
eV3DProjStatus ED_view3d_project_int_object(const ARegion *ar, const float co[3], int r_co[2], const eV3DProjTest flag)
{
RegionView3D *rv3d = ar->regiondata;
- return ED_view3d_project_int_ex(ar, rv3d->persmatob, TRUE, co, r_co, flag);
+ return ED_view3d_project_int_ex(ar, rv3d->persmatob, true, co, r_co, flag);
}
/* --- float --- */
eV3DProjStatus ED_view3d_project_float_global(const ARegion *ar, const float co[3], float r_co[2], const eV3DProjTest flag)
{
RegionView3D *rv3d = ar->regiondata;
- return ED_view3d_project_float_ex(ar, rv3d->persmat, FALSE, co, r_co, flag);
+ return ED_view3d_project_float_ex(ar, rv3d->persmat, false, co, r_co, flag);
}
/* object space, use ED_view3d_init_mats_rv3d before calling */
eV3DProjStatus ED_view3d_project_float_object(const ARegion *ar, const float co[3], float r_co[2], const eV3DProjTest flag)
{
RegionView3D *rv3d = ar->regiondata;
- return ED_view3d_project_float_ex(ar, rv3d->persmatob, TRUE, co, r_co, flag);
+ return ED_view3d_project_float_ex(ar, rv3d->persmatob, true, co, r_co, flag);
}
@@ -367,7 +367,7 @@ void ED_view3d_win_to_3d(const ARegion *ar, const float depth_pt[3], const float
ED_view3d_win_to_vector(ar, mval, mousevec);
add_v3_v3v3(line_end, line_sta, mousevec);
- if (isect_line_plane_v3(out, line_sta, line_end, depth_pt, rv3d->viewinv[2], TRUE) == 0) {
+ if (isect_line_plane_v3(out, line_sta, line_end, depth_pt, rv3d->viewinv[2], true) == 0) {
/* highly unlikely to ever happen, mouse vec paralelle with view plane */
zero_v3(out);
}
@@ -435,7 +435,8 @@ void ED_view3d_win_to_vector(const ARegion *ar, const float mval[2], float out[3
normalize_v3(out);
}
-void ED_view3d_win_to_segment(const ARegion *ar, View3D *v3d, const float mval[2], float ray_start[3], float ray_end[3])
+void ED_view3d_win_to_segment(const ARegion *ar, View3D *v3d, const float mval[2],
+ float ray_start[3], float ray_end[3])
{
RegionView3D *rv3d = ar->regiondata;
@@ -472,9 +473,10 @@ void ED_view3d_win_to_segment(const ARegion *ar, View3D *v3d, const float mval[2
* \param mval The area relative 2d location (such as event->mval, converted into float[2]).
* \param ray_start The world-space starting point of the segment.
* \param ray_end The world-space end point of the segment.
- * \return success, FALSE if the segment is totally clipped.
+ * \return success, false if the segment is totally clipped.
*/
-int ED_view3d_win_to_segment_clip(const ARegion *ar, View3D *v3d, const float mval[2], float ray_start[3], float ray_end[3])
+bool ED_view3d_win_to_segment_clip(const ARegion *ar, View3D *v3d, const float mval[2],
+ float ray_start[3], float ray_end[3])
{
RegionView3D *rv3d = ar->regiondata;
ED_view3d_win_to_segment(ar, v3d, mval, ray_start, ray_end);
@@ -482,14 +484,14 @@ int ED_view3d_win_to_segment_clip(const ARegion *ar, View3D *v3d, const float mv
/* clipping */
if (rv3d->rflag & RV3D_CLIPPING) {
/* if the ray is totally clipped,
- * restore the original values but return FALSE
+ * restore the original values but return false
* caller can choose what to do */
float tray_start[3] = {UNPACK3(ray_start)};
float tray_end[3] = {UNPACK3(ray_end)};
int a;
for (a = 0; a < 4; a++) {
- if (clip_line_plane(tray_start, tray_end, rv3d->clip[a]) == FALSE) {
- return FALSE;
+ if (clip_line_plane(tray_start, tray_end, rv3d->clip[a]) == false) {
+ return false;
}
}
@@ -498,7 +500,7 @@ int ED_view3d_win_to_segment_clip(const ARegion *ar, View3D *v3d, const float mv
copy_v3_v3(ray_end, tray_end);
}
- return TRUE;
+ return true;
}
diff --git a/source/blender/editors/space_view3d/view3d_ruler.c b/source/blender/editors/space_view3d/view3d_ruler.c
index 410d20a1dc0..d6cc218e266 100644
--- a/source/blender/editors/space_view3d/view3d_ruler.c
+++ b/source/blender/editors/space_view3d/view3d_ruler.c
@@ -924,7 +924,7 @@ static int view3d_ruler_modal(bContext *C, wmOperator *op, const wmEvent *event)
void VIEW3D_OT_ruler(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "3D Ruler & Protractor";
+ ot->name = "Ruler/Protractor";
ot->description = "Interactive ruler";
ot->idname = "VIEW3D_OT_ruler";
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index b441e48f59d..a84075fb60e 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -127,7 +127,7 @@ bool view3d_get_view_aligned_coordinate(ARegion *ar, float fp[3], const int mval
ED_view3d_win_to_delta(ar, mval_f, dvec, zfac);
sub_v3_v3(fp, dvec);
- return TRUE;
+ return true;
}
else {
/* fallback to the view center */
@@ -262,17 +262,17 @@ typedef struct LassoSelectUserData {
rctf _rect_fl;
const int (*mcords)[2];
int moves;
- int select;
+ bool select;
/* runtime */
int pass;
- int is_done;
- int is_change;
+ bool is_done;
+ bool is_change;
} LassoSelectUserData;
static void view3d_userdata_lassoselect_init(LassoSelectUserData *r_data,
ViewContext *vc, const rcti *rect, const int (*mcords)[2],
- const int moves, const int select)
+ const int moves, const bool select)
{
r_data->vc = vc;
@@ -286,8 +286,8 @@ static void view3d_userdata_lassoselect_init(LassoSelectUserData *r_data,
/* runtime */
r_data->pass = 0;
- r_data->is_done = FALSE;
- r_data->is_change = FALSE;
+ r_data->is_done = false;
+ r_data->is_change = false;
}
static int view3d_selectable_data(bContext *C)
@@ -356,7 +356,7 @@ static void do_lasso_select_pose__doSelectBone(void *userData, struct bPoseChann
bArmature *arm = data->vc->obact->data;
if (PBONE_SELECTABLE(arm, pchan->bone)) {
- int is_point_done = FALSE;
+ bool is_point_done = false;
int points_proj_tot = 0;
const int x0 = screen_co_a[0];
@@ -370,7 +370,7 @@ static void do_lasso_select_pose__doSelectBone(void *userData, struct bPoseChann
if (BLI_rcti_isect_pt(data->rect, x0, y0) &&
BLI_lasso_is_point_inside(data->mcords, data->moves, x0, y0, INT_MAX))
{
- is_point_done = TRUE;
+ is_point_done = true;
}
}
@@ -380,23 +380,23 @@ static void do_lasso_select_pose__doSelectBone(void *userData, struct bPoseChann
if (BLI_rcti_isect_pt(data->rect, x1, y1) &&
BLI_lasso_is_point_inside(data->mcords, data->moves, x1, y1, INT_MAX))
{
- is_point_done = TRUE;
+ is_point_done = true;
}
}
/* if one of points selected, we skip the bone itself */
- if ((is_point_done == TRUE) ||
- ((is_point_done == FALSE) && (points_proj_tot == 2) &&
+ if ((is_point_done == true) ||
+ ((is_point_done == false) && (points_proj_tot == 2) &&
BLI_lasso_is_edge_inside(data->mcords, data->moves, x0, y0, x1, y1, INT_MAX)))
{
if (data->select) pchan->bone->flag |= BONE_SELECTED;
else pchan->bone->flag &= ~BONE_SELECTED;
- data->is_change = TRUE;
+ data->is_change = true;
}
data->is_change |= is_point_done;
}
}
-static void do_lasso_select_pose(ViewContext *vc, Object *ob, const int mcords[][2], short moves, short select)
+static void do_lasso_select_pose(ViewContext *vc, Object *ob, const int mcords[][2], short moves, bool select)
{
ViewContext vc_tmp;
LassoSelectUserData data;
@@ -437,11 +437,11 @@ static void object_deselect_all_visible(Scene *scene, View3D *v3d)
}
}
-static void do_lasso_select_objects(ViewContext *vc, const int mcords[][2], const short moves, short extend, short select)
+static void do_lasso_select_objects(ViewContext *vc, const int mcords[][2], const short moves, bool extend, bool select)
{
Base *base;
- if (extend == 0 && select)
+ if (extend == false && select)
object_deselect_all_visible(vc->scene, vc->v3d);
for (base = vc->scene->base.first; base; base = base->next) {
@@ -486,7 +486,7 @@ static void do_lasso_select_mesh__doSelectEdge(void *userData, BMEdge *eed, cons
BLI_lasso_is_point_inside(data->mcords, data->moves, x1, y1, IS_CLIPPED))
{
BM_edge_select_set(data->vc->em->bm, eed, data->select);
- data->is_done = TRUE;
+ data->is_done = true;
}
}
else {
@@ -507,7 +507,7 @@ static void do_lasso_select_mesh__doSelectFace(void *userData, BMFace *efa, cons
}
}
-static void do_lasso_select_mesh(ViewContext *vc, const int mcords[][2], short moves, short extend, short select)
+static void do_lasso_select_mesh(ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select)
{
LassoSelectUserData data;
ToolSettings *ts = vc->scene->toolsettings;
@@ -521,7 +521,7 @@ static void do_lasso_select_mesh(ViewContext *vc, const int mcords[][2], short m
view3d_userdata_lassoselect_init(&data, vc, &rect, mcords, moves, select);
- if (extend == 0 && select)
+ if (extend == false && select)
EDBM_flag_disable_all(vc->em, BM_ELEM_SELECT);
/* for non zbuf projections, don't change the GL state */
@@ -543,7 +543,7 @@ static void do_lasso_select_mesh(ViewContext *vc, const int mcords[][2], short m
data.pass = 0;
mesh_foreachScreenEdge(vc, do_lasso_select_mesh__doSelectEdge, &data, V3D_PROJ_TEST_CLIP_NEAR);
- if (data.is_done == 0) {
+ if (data.is_done == false) {
data.pass = 1;
mesh_foreachScreenEdge(vc, do_lasso_select_mesh__doSelectEdge, &data, V3D_PROJ_TEST_CLIP_NEAR);
}
@@ -595,7 +595,7 @@ static void do_lasso_select_curve__doSelect(void *userData, Nurb *UNUSED(nu), BP
}
}
-static void do_lasso_select_curve(ViewContext *vc, const int mcords[][2], short moves, short extend, short select)
+static void do_lasso_select_curve(ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select)
{
LassoSelectUserData data;
rcti rect;
@@ -604,7 +604,7 @@ static void do_lasso_select_curve(ViewContext *vc, const int mcords[][2], short
view3d_userdata_lassoselect_init(&data, vc, &rect, mcords, moves, select);
- if (extend == 0 && select)
+ if (extend == false && select)
CU_deselect_all(vc->obedit);
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
@@ -621,7 +621,7 @@ static void do_lasso_select_lattice__doSelect(void *userData, BPoint *bp, const
bp->f1 = data->select ? (bp->f1 | SELECT) : (bp->f1 & ~SELECT);
}
}
-static void do_lasso_select_lattice(ViewContext *vc, const int mcords[][2], short moves, short extend, short select)
+static void do_lasso_select_lattice(ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select)
{
LassoSelectUserData data;
rcti rect;
@@ -630,7 +630,7 @@ static void do_lasso_select_lattice(ViewContext *vc, const int mcords[][2], shor
view3d_userdata_lassoselect_init(&data, vc, &rect, mcords, moves, select);
- if (extend == 0 && select)
+ if (extend == false && select)
ED_setflagsLatt(vc->obedit, 0);
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
@@ -643,7 +643,7 @@ static void do_lasso_select_armature__doSelectBone(void *userData, struct EditBo
bArmature *arm = data->vc->obedit->data;
if (EBONE_SELECTABLE(arm, ebone)) {
- int is_point_done = FALSE;
+ bool is_point_done = false;
int points_proj_tot = 0;
const int x0 = screen_co_a[0];
@@ -657,7 +657,7 @@ static void do_lasso_select_armature__doSelectBone(void *userData, struct EditBo
if (BLI_rcti_isect_pt(data->rect, x0, y0) &&
BLI_lasso_is_point_inside(data->mcords, data->moves, x0, y0, INT_MAX))
{
- is_point_done = TRUE;
+ is_point_done = true;
if (data->select) ebone->flag |= BONE_ROOTSEL;
else ebone->flag &= ~BONE_ROOTSEL;
}
@@ -669,26 +669,26 @@ static void do_lasso_select_armature__doSelectBone(void *userData, struct EditBo
if (BLI_rcti_isect_pt(data->rect, x1, y1) &&
BLI_lasso_is_point_inside(data->mcords, data->moves, x1, y1, INT_MAX))
{
- is_point_done = TRUE;
+ is_point_done = true;
if (data->select) ebone->flag |= BONE_TIPSEL;
else ebone->flag &= ~BONE_TIPSEL;
}
}
/* if one of points selected, we skip the bone itself */
- if ((is_point_done == FALSE) && (points_proj_tot == 2) &&
+ if ((is_point_done == false) && (points_proj_tot == 2) &&
BLI_lasso_is_edge_inside(data->mcords, data->moves, x0, y0, x1, y1, INT_MAX))
{
if (data->select) ebone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
else ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
- data->is_change = TRUE;
+ data->is_change = true;
}
data->is_change |= is_point_done;
}
}
-static void do_lasso_select_armature(ViewContext *vc, const int mcords[][2], short moves, short extend, short select)
+static void do_lasso_select_armature(ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select)
{
LassoSelectUserData data;
rcti rect;
@@ -699,7 +699,7 @@ static void do_lasso_select_armature(ViewContext *vc, const int mcords[][2], sho
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
- if (extend == 0 && select)
+ if (extend == false && select)
ED_armature_deselect_all_visible(vc->obedit);
armature_foreachScreenBone(vc, do_lasso_select_armature__doSelectBone, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
@@ -721,17 +721,17 @@ static void do_lasso_select_mball__doSelectElem(void *userData, struct MetaElem
{
if (data->select) ml->flag |= SELECT;
else ml->flag &= ~SELECT;
- data->is_change = TRUE;
+ data->is_change = true;
}
}
-static void do_lasso_select_meta(ViewContext *vc, const int mcords[][2], short moves, short extend, short select)
+static void do_lasso_select_meta(ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select)
{
LassoSelectUserData data;
rcti rect;
MetaBall *mb = (MetaBall *)vc->obedit->data;
- if (extend == 0 && select)
+ if (extend == false && select)
BKE_mball_deselect_all(mb);
BLI_lasso_boundbox(&rect, mcords, moves);
@@ -753,7 +753,7 @@ static void do_lasso_select_meshobject__doSelectVert(void *userData, MVert *mv,
BKE_BIT_TEST_SET(mv->flag, data->select, SELECT);
}
}
-static void do_lasso_select_paintvert(ViewContext *vc, const int mcords[][2], short moves, short extend, short select)
+static void do_lasso_select_paintvert(ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select)
{
const int use_zbuf = (vc->v3d->flag & V3D_ZBUF_SELECT);
Object *ob = vc->obact;
@@ -763,8 +763,8 @@ static void do_lasso_select_paintvert(ViewContext *vc, const int mcords[][2], sh
if (me == NULL || me->totvert == 0)
return;
- if (extend == 0 && select)
- paintvert_deselect_all_visible(ob, SEL_DESELECT, FALSE); /* flush selection at the end */
+ if (extend == false && select)
+ paintvert_deselect_all_visible(ob, SEL_DESELECT, false); /* flush selection at the end */
BLI_lasso_boundbox(&rect, mcords, moves);
@@ -790,7 +790,7 @@ static void do_lasso_select_paintvert(ViewContext *vc, const int mcords[][2], sh
paintvert_flush_flags(ob);
}
-static void do_lasso_select_paintface(ViewContext *vc, const int mcords[][2], short moves, short extend, short select)
+static void do_lasso_select_paintface(ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select)
{
Object *ob = vc->obact;
Mesh *me = ob ? ob->data : NULL;
@@ -799,8 +799,8 @@ static void do_lasso_select_paintface(ViewContext *vc, const int mcords[][2], sh
if (me == NULL || me->totpoly == 0)
return;
- if (extend == 0 && select)
- paintface_deselect_all_visible(ob, SEL_DESELECT, FALSE); /* flush selection at the end */
+ if (extend == false && select)
+ paintface_deselect_all_visible(ob, SEL_DESELECT, false); /* flush selection at the end */
bm_vertoffs = me->totpoly + 1; /* max index array */
@@ -847,7 +847,7 @@ static void do_lasso_select_node(int mcords[][2], short moves, short select)
static void view3d_lasso_select(bContext *C, ViewContext *vc,
const int mcords[][2], short moves,
- short extend, short select)
+ bool extend, bool select)
{
Object *ob = CTX_data_active_object(C);
@@ -902,7 +902,7 @@ static int view3d_lasso_select_exec(bContext *C, wmOperator *op)
const int (*mcords)[2] = WM_gesture_lasso_path_to_array(C, op, &mcords_tot);
if (mcords) {
- short extend, select;
+ bool extend, select;
view3d_operator_needs_opengl(C);
/* setup view context for argument to callbacks */
@@ -1031,9 +1031,9 @@ static EnumPropertyItem *object_select_menu_enum_itemf(bContext *C, PointerRNA *
static int object_select_menu_exec(bContext *C, wmOperator *op)
{
- int name_index = RNA_enum_get(op->ptr, "name");
- short toggle = RNA_boolean_get(op->ptr, "toggle");
- short changed = 0;
+ const int name_index = RNA_enum_get(op->ptr, "name");
+ const bool toggle = RNA_boolean_get(op->ptr, "toggle");
+ bool change = false;
const char *name = object_mouse_select_menu_data[name_index].idname;
if (!toggle) {
@@ -1041,7 +1041,7 @@ static int object_select_menu_exec(bContext *C, wmOperator *op)
{
if (base->flag & SELECT) {
ED_base_object_select(base, BA_DESELECT);
- changed = 1;
+ change = true;
}
}
CTX_DATA_END;
@@ -1053,7 +1053,7 @@ static int object_select_menu_exec(bContext *C, wmOperator *op)
if (STREQ(name, base->object->id.name + 2)) {
ED_base_object_activate(C, base);
ED_base_object_select(base, BA_SELECT);
- changed = 1;
+ change = true;
}
}
CTX_DATA_END;
@@ -1062,7 +1062,7 @@ static int object_select_menu_exec(bContext *C, wmOperator *op)
memset(object_mouse_select_menu_data, 0, sizeof(object_mouse_select_menu_data));
/* undo? */
- if (changed) {
+ if (change) {
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
return OPERATOR_FINISHED;
}
@@ -1112,12 +1112,12 @@ static void deselectall_except(Scene *scene, Base *b) /* deselect all except b
static Base *object_mouse_select_menu(bContext *C, ViewContext *vc, unsigned int *buffer, int hits, const int mval[2], short toggle)
{
short baseCount = 0;
- short ok;
+ bool ok;
LinkNode *linklist = NULL;
CTX_DATA_BEGIN (C, Base *, base, selectable_bases)
{
- ok = FALSE;
+ ok = false;
/* two selection methods, the CTRL select uses max dist of 15 */
if (buffer) {
@@ -1125,7 +1125,7 @@ static Base *object_mouse_select_menu(bContext *C, ViewContext *vc, unsigned int
for (a = 0; a < hits; a++) {
/* index was converted */
if (base->selcol == buffer[(4 * a) + 3])
- ok = TRUE;
+ ok = true;
}
}
else {
@@ -1134,7 +1134,7 @@ static Base *object_mouse_select_menu(bContext *C, ViewContext *vc, unsigned int
temp = abs(base->sx - mval[0]) + abs(base->sy - mval[1]);
if (temp < dist)
- ok = TRUE;
+ ok = true;
}
if (ok) {
@@ -1185,15 +1185,15 @@ static Base *object_mouse_select_menu(bContext *C, ViewContext *vc, unsigned int
}
}
-static int selectbuffer_has_bones(const unsigned int *buffer, const unsigned int hits)
+static bool selectbuffer_has_bones(const unsigned int *buffer, const unsigned int hits)
{
unsigned int i;
for (i = 0; i < hits; i++) {
if (buffer[(4 * i) + 3] & 0xFFFF0000) {
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
/* we want a select buffer with bones, if there are... */
@@ -1203,7 +1203,7 @@ static short mixed_bones_object_selectbuffer(ViewContext *vc, unsigned int *buff
rcti rect;
int offs;
short hits15, hits9 = 0, hits5 = 0;
- short has_bones15 = FALSE, has_bones9 = FALSE, has_bones5 = FALSE;
+ bool has_bones15 = false, has_bones9 = false, has_bones5 = false;
BLI_rcti_init(&rect, mval[0] - 14, mval[0] + 14, mval[1] - 14, mval[1] + 14);
hits15 = view3d_opengl_select(vc, buffer, MAXPICKBUF, &rect);
@@ -1255,20 +1255,22 @@ static short mixed_bones_object_selectbuffer(ViewContext *vc, unsigned int *buff
}
/* returns basact */
-static Base *mouse_select_eval_buffer(ViewContext *vc, unsigned int *buffer, int hits, const int mval[2], Base *startbase, int has_bones)
+static Base *mouse_select_eval_buffer(ViewContext *vc, unsigned int *buffer, int hits, const int mval[2],
+ Base *startbase, bool has_bones)
{
Scene *scene = vc->scene;
View3D *v3d = vc->v3d;
Base *base, *basact = NULL;
static int lastmval[2] = {-100, -100};
- int a, do_nearest = FALSE;
+ int a;
+ bool do_nearest = false;
/* define if we use solid nearest select or not */
if (v3d->drawtype > OB_WIRE) {
- do_nearest = TRUE;
+ do_nearest = true;
if (ABS(mval[0] - lastmval[0]) < 3 && ABS(mval[1] - lastmval[1]) < 3) {
if (!has_bones) /* hrms, if theres bones we always do nearest */
- do_nearest = FALSE;
+ do_nearest = false;
}
}
lastmval[0] = mval[0]; lastmval[1] = mval[1];
@@ -1362,7 +1364,7 @@ Base *ED_view3d_give_base_under_cursor(bContext *C, const int mval[2])
hits = mixed_bones_object_selectbuffer(&vc, buffer, mval);
if (hits > 0) {
- const int has_bones = selectbuffer_has_bones(buffer, hits);
+ const bool has_bones = selectbuffer_has_bones(buffer, hits);
basact = mouse_select_eval_buffer(&vc, buffer, hits, mval, vc.scene->base.first, has_bones);
}
@@ -1389,7 +1391,7 @@ static void deselect_all_tracks(MovieTracking *tracking)
}
/* mval is region coords */
-static int mouse_select(bContext *C, const int mval[2], short extend, short deselect, short toggle, short obcenter, short enumerate)
+static bool mouse_select(bContext *C, const int mval[2], bool extend, bool deselect, bool toggle, bool obcenter, short enumerate)
{
ViewContext vc;
ARegion *ar = CTX_wm_region(C);
@@ -1397,7 +1399,7 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short dese
Scene *scene = CTX_data_scene(C);
Base *base, *startbase = NULL, *basact = NULL, *oldbasact = NULL;
float dist = 100.0f;
- int retval = 0;
+ int retval = false;
short hits;
const float mval_fl[2] = {(float)mval[0], (float)mval[1]};
@@ -1449,7 +1451,7 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short dese
if (hits > 0) {
/* note: bundles are handling in the same way as bones */
- const int has_bones = selectbuffer_has_bones(buffer, hits);
+ const bool has_bones = selectbuffer_has_bones(buffer, hits);
/* note; shift+alt goes to group-flush-selecting */
if (has_bones == 0 && enumerate) {
@@ -1502,7 +1504,7 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short dese
basact->flag |= SELECT;
basact->object->flag = basact->flag;
- retval = 1;
+ retval = true;
WM_event_add_notifier(C, NC_MOVIECLIP | ND_SELECT, track);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
@@ -1526,7 +1528,7 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short dese
basact->flag |= SELECT;
basact->object->flag = basact->flag;
- retval = 1;
+ retval = true;
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, basact->object);
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_ACTIVE, basact->object);
@@ -1546,7 +1548,7 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short dese
/* so, do we have something selected? */
if (basact) {
- retval = 1;
+ retval = true;
if (vc.obedit) {
/* only do select */
@@ -1601,8 +1603,8 @@ typedef struct BoxSelectUserData {
/* runtime */
int pass;
- int is_done;
- int is_change;
+ bool is_done;
+ bool is_change;
} BoxSelectUserData;
static void view3d_userdata_boxselect_init(BoxSelectUserData *r_data,
@@ -1618,29 +1620,29 @@ static void view3d_userdata_boxselect_init(BoxSelectUserData *r_data,
/* runtime */
r_data->pass = 0;
- r_data->is_done = FALSE;
- r_data->is_change = FALSE;
+ r_data->is_done = false;
+ r_data->is_change = false;
}
-int edge_inside_circle(const float cent[2], float radius, const float screen_co_a[2], const float screen_co_b[2])
+bool edge_inside_circle(const float cent[2], float radius, const float screen_co_a[2], const float screen_co_b[2])
{
int radius_squared = radius * radius;
/* check points in circle itself */
if (len_squared_v2v2(cent, screen_co_a) <= radius_squared) {
- return TRUE;
+ return true;
}
if (len_squared_v2v2(cent, screen_co_b) <= radius_squared) {
- return TRUE;
+ return true;
}
else {
/* pointdistline */
if (dist_squared_to_line_segment_v2(cent, screen_co_a, screen_co_b) < (float)radius_squared) {
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
static void do_paintvert_box_select__doSelectVert(void *userData, MVert *mv, const float screen_co[2], int UNUSED(index))
@@ -1651,7 +1653,7 @@ static void do_paintvert_box_select__doSelectVert(void *userData, MVert *mv, con
BKE_BIT_TEST_SET(mv->flag, data->select, SELECT);
}
}
-static int do_paintvert_box_select(ViewContext *vc, rcti *rect, int select, int extend)
+static int do_paintvert_box_select(ViewContext *vc, rcti *rect, bool select, bool extend)
{
const int use_zbuf = (vc->v3d->flag & V3D_ZBUF_SELECT);
Mesh *me;
@@ -1669,8 +1671,8 @@ static int do_paintvert_box_select(ViewContext *vc, rcti *rect, int select, int
return OPERATOR_CANCELLED;
- if (extend == 0 && select)
- paintvert_deselect_all_visible(vc->obact, SEL_DESELECT, FALSE);
+ if (extend == false && select)
+ paintvert_deselect_all_visible(vc->obact, SEL_DESELECT, false);
if (use_zbuf) {
selar = MEM_callocN(me->totvert + 1, "selar");
@@ -1754,13 +1756,13 @@ static void do_nurbs_box_select__doSelect(void *userData, Nurb *UNUSED(nu), BPoi
}
}
}
-static int do_nurbs_box_select(ViewContext *vc, rcti *rect, int select, int extend)
+static int do_nurbs_box_select(ViewContext *vc, rcti *rect, bool select, bool extend)
{
BoxSelectUserData data;
view3d_userdata_boxselect_init(&data, vc, rect, select);
- if (extend == 0 && select)
+ if (extend == false && select)
CU_deselect_all(vc->obedit);
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
@@ -1777,13 +1779,13 @@ static void do_lattice_box_select__doSelect(void *userData, BPoint *bp, const fl
bp->f1 = data->select ? (bp->f1 | SELECT) : (bp->f1 & ~SELECT);
}
}
-static int do_lattice_box_select(ViewContext *vc, rcti *rect, int select, int extend)
+static int do_lattice_box_select(ViewContext *vc, rcti *rect, bool select, bool extend)
{
BoxSelectUserData data;
view3d_userdata_boxselect_init(&data, vc, rect, select);
- if (extend == 0 && select)
+ if (extend == false && select)
ED_setflagsLatt(vc->obedit, 0);
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
@@ -1808,7 +1810,7 @@ static void do_mesh_box_select__doSelectEdge(void *userData, BMEdge *eed, const
if (data->pass == 0) {
if (edge_fully_inside_rect(data->rect_fl, screen_co_a, screen_co_b)) {
BM_edge_select_set(data->vc->em->bm, eed, data->select);
- data->is_done = TRUE;
+ data->is_done = true;
}
}
else {
@@ -1826,7 +1828,7 @@ static void do_mesh_box_select__doSelectFace(void *userData, BMFace *efa, const
BM_face_select_set(data->vc->em->bm, efa, data->select);
}
}
-static int do_mesh_box_select(ViewContext *vc, rcti *rect, int select, int extend)
+static int do_mesh_box_select(ViewContext *vc, rcti *rect, bool select, bool extend)
{
BoxSelectUserData data;
ToolSettings *ts = vc->scene->toolsettings;
@@ -1834,7 +1836,7 @@ static int do_mesh_box_select(ViewContext *vc, rcti *rect, int select, int exten
view3d_userdata_boxselect_init(&data, vc, rect, select);
- if (extend == 0 && select)
+ if (extend == false && select)
EDBM_flag_disable_all(vc->em, BM_ELEM_SELECT);
/* for non zbuf projections, don't change the GL state */
@@ -1879,7 +1881,7 @@ static int do_mesh_box_select(ViewContext *vc, rcti *rect, int select, int exten
return OPERATOR_FINISHED;
}
-static int do_meta_box_select(ViewContext *vc, rcti *rect, int select, int extend)
+static int do_meta_box_select(ViewContext *vc, rcti *rect, bool select, bool extend)
{
MetaBall *mb = (MetaBall *)vc->obedit->data;
MetaElem *ml;
@@ -1890,7 +1892,7 @@ static int do_meta_box_select(ViewContext *vc, rcti *rect, int select, int exten
hits = view3d_opengl_select(vc, buffer, MAXPICKBUF, rect);
- if (extend == 0 && select)
+ if (extend == false && select)
BKE_mball_deselect_all(mb);
for (ml = mb->editelems->first; ml; ml = ml->next) {
@@ -1913,7 +1915,7 @@ static int do_meta_box_select(ViewContext *vc, rcti *rect, int select, int exten
return OPERATOR_FINISHED;
}
-static int do_armature_box_select(ViewContext *vc, rcti *rect, short select, short extend)
+static int do_armature_box_select(ViewContext *vc, rcti *rect, bool select, bool extend)
{
bArmature *arm = vc->obedit->data;
EditBone *ebone;
@@ -1928,7 +1930,7 @@ static int do_armature_box_select(ViewContext *vc, rcti *rect, short select, sho
for (ebone = arm->edbo->first; ebone; ebone = ebone->next)
ebone->flag &= ~BONE_DONE;
- if (extend == 0 && select)
+ if (extend == false && select)
ED_armature_deselect_all_visible(vc->obedit);
/* first we only check points inside the border */
@@ -1983,7 +1985,7 @@ static int do_armature_box_select(ViewContext *vc, rcti *rect, short select, sho
return OPERATOR_CANCELLED;
}
-static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, int select, int extend)
+static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, bool select, bool extend)
{
Bone *bone;
Object *ob = vc->obact;
@@ -1999,7 +2001,7 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, i
else
bone_only = 0;
- if (extend == 0 && select) {
+ if (extend == false && select) {
if (bone_only) {
CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones)
{
@@ -2091,8 +2093,8 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op)
{
ViewContext vc;
rcti rect;
- short extend;
- short select;
+ bool extend;
+ bool select;
int ret = OPERATOR_CANCELLED;
@@ -2187,12 +2189,12 @@ void VIEW3D_OT_select_border(wmOperatorType *ot)
ot->flag = OPTYPE_UNDO;
/* rna */
- WM_operator_properties_gesture_border(ot, TRUE);
+ WM_operator_properties_gesture_border(ot, true);
}
/* mouse selection in weight paint */
/* gets called via generic mouse select operator */
-static int mouse_weight_paint_vertex_select(bContext *C, const int mval[2], short extend, short deselect, short toggle, Object *obact)
+static bool mouse_weight_paint_vertex_select(bContext *C, const int mval[2], bool extend, bool deselect, bool toggle, Object *obact)
{
View3D *v3d = CTX_wm_view3d(C);
const int use_zbuf = (v3d->flag & V3D_ZBUF_SELECT);
@@ -2213,14 +2215,14 @@ static int mouse_weight_paint_vertex_select(bContext *C, const int mval[2], shor
mv->flag ^= SELECT;
}
else {
- paintvert_deselect_all_visible(obact, SEL_DESELECT, FALSE);
+ paintvert_deselect_all_visible(obact, SEL_DESELECT, false);
mv->flag |= SELECT;
}
paintvert_flush_flags(obact);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obact->data);
- return 1;
+ return true;
}
- return 0;
+ return false;
}
/* ****** Mouse Select ****** */
@@ -2230,13 +2232,13 @@ static int view3d_select_invoke(bContext *C, wmOperator *op, const wmEvent *even
{
Object *obedit = CTX_data_edit_object(C);
Object *obact = CTX_data_active_object(C);
- short extend = RNA_boolean_get(op->ptr, "extend");
- short deselect = RNA_boolean_get(op->ptr, "deselect");
- short toggle = RNA_boolean_get(op->ptr, "toggle");
- short center = RNA_boolean_get(op->ptr, "center");
- short enumerate = RNA_boolean_get(op->ptr, "enumerate");
- short object = RNA_boolean_get(op->ptr, "object");
- int retval = 0;
+ bool extend = RNA_boolean_get(op->ptr, "extend");
+ bool deselect = RNA_boolean_get(op->ptr, "deselect");
+ bool toggle = RNA_boolean_get(op->ptr, "toggle");
+ bool center = RNA_boolean_get(op->ptr, "center");
+ bool enumerate = RNA_boolean_get(op->ptr, "enumerate");
+ bool object = RNA_boolean_get(op->ptr, "object");
+ bool retval = false;
view3d_operator_needs_opengl(C);
@@ -2247,10 +2249,10 @@ static int view3d_select_invoke(bContext *C, wmOperator *op, const wmEvent *even
/* ack, this is incorrect but to do this correctly we would need an
* alternative editmode/objectmode keymap, this copies the functionality
* from 2.4x where Ctrl+Select in editmode does object select only */
- center = FALSE;
+ center = false;
}
- if (obedit && object == FALSE) {
+ if (obedit && object == false) {
if (obedit->type == OB_MESH)
retval = EDBM_select_pick(C, event->mval, extend, deselect, toggle);
else if (obedit->type == OB_ARMATURE)
@@ -2317,7 +2319,7 @@ typedef struct CircleSelectUserData {
float radius_squared;
/* runtime */
- int is_change;
+ bool is_change;
} CircleSelectUserData;
static void view3d_userdata_circleselect_init(CircleSelectUserData *r_data,
@@ -2333,7 +2335,7 @@ static void view3d_userdata_circleselect_init(CircleSelectUserData *r_data,
r_data->radius_squared = rad * rad;
/* runtime */
- r_data->is_change = FALSE;
+ r_data->is_change = false;
}
static void mesh_circle_doSelectVert(void *userData, BMVert *eve, const float screen_co[2], int UNUSED(index))
@@ -2540,14 +2542,14 @@ static void do_circle_select_pose__doSelectBone(void *userData, struct bPoseChan
bArmature *arm = data->vc->obact->data;
if (PBONE_SELECTABLE(arm, pchan->bone)) {
- int is_point_done = FALSE;
+ bool is_point_done = false;
int points_proj_tot = 0;
/* project head location to screenspace */
if (screen_co_a[0] != IS_CLIPPED) {
points_proj_tot++;
if (pchan_circle_doSelectJoint(data, pchan, screen_co_a)) {
- is_point_done = TRUE;
+ is_point_done = true;
}
}
@@ -2555,7 +2557,7 @@ static void do_circle_select_pose__doSelectBone(void *userData, struct bPoseChan
if (screen_co_b[0] != IS_CLIPPED) {
points_proj_tot++;
if (pchan_circle_doSelectJoint(data, pchan, screen_co_a)) {
- is_point_done = TRUE;
+ is_point_done = true;
}
}
@@ -2566,12 +2568,12 @@ static void do_circle_select_pose__doSelectBone(void *userData, struct bPoseChan
/* only if the endpoints didn't get selected, deal with the middle of the bone too
* It works nicer to only do this if the head or tail are not in the circle,
* otherwise there is no way to circle select joints alone */
- if ((is_point_done == FALSE) && (points_proj_tot == 2) &&
+ if ((is_point_done == false) && (points_proj_tot == 2) &&
edge_inside_circle(data->mval_fl, data->radius, screen_co_a, screen_co_b))
{
if (data->select) pchan->bone->flag |= BONE_SELECTED;
else pchan->bone->flag &= ~BONE_SELECTED;
- data->is_change = TRUE;
+ data->is_change = true;
}
data->is_change |= is_point_done;
@@ -2626,22 +2628,22 @@ static void do_circle_select_armature__doSelectBone(void *userData, struct EditB
bArmature *arm = data->vc->obedit->data;
if (EBONE_SELECTABLE(arm, ebone)) {
- int is_point_done = FALSE;
+ bool is_point_done = false;
int points_proj_tot = 0;
/* project head location to screenspace */
if (screen_co_a[0] != IS_CLIPPED) {
points_proj_tot++;
- if (armature_circle_doSelectJoint(data, ebone, screen_co_a, TRUE)) {
- is_point_done = TRUE;
+ if (armature_circle_doSelectJoint(data, ebone, screen_co_a, true)) {
+ is_point_done = true;
}
}
/* project tail location to screenspace */
if (screen_co_b[0] != IS_CLIPPED) {
points_proj_tot++;
- if (armature_circle_doSelectJoint(data, ebone, screen_co_b, FALSE)) {
- is_point_done = TRUE;
+ if (armature_circle_doSelectJoint(data, ebone, screen_co_b, false)) {
+ is_point_done = true;
}
}
@@ -2652,12 +2654,12 @@ static void do_circle_select_armature__doSelectBone(void *userData, struct EditB
/* only if the endpoints didn't get selected, deal with the middle of the bone too
* It works nicer to only do this if the head or tail are not in the circle,
* otherwise there is no way to circle select joints alone */
- if ((is_point_done == FALSE) && (points_proj_tot == 2) &&
+ if ((is_point_done == false) && (points_proj_tot == 2) &&
edge_inside_circle(data->mval_fl, data->radius, screen_co_a, screen_co_b))
{
if (data->select) ebone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
else ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
- data->is_change = TRUE;
+ data->is_change = true;
}
data->is_change |= is_point_done;
@@ -2688,7 +2690,7 @@ static void do_circle_select_mball__doSelectElem(void *userData, struct MetaElem
if (len_squared_v2v2(data->mval_fl, screen_co) <= data->radius_squared) {
if (data->select) ml->flag |= SELECT;
else ml->flag &= ~SELECT;
- data->is_change = TRUE;
+ data->is_change = true;
}
}
static void mball_circle_select(ViewContext *vc, int select, const int mval[2], float rad)
@@ -2728,12 +2730,12 @@ static void obedit_circle_select(ViewContext *vc, short select, const int mval[2
}
}
-static int object_circle_select(ViewContext *vc, int select, const int mval[2], float rad)
+static bool object_circle_select(ViewContext *vc, int select, const int mval[2], float rad)
{
Scene *scene = vc->scene;
const float radius_squared = rad * rad;
const float mval_fl[2] = {mval[0], mval[1]};
- int is_change = FALSE;
+ bool is_change = false;
int select_flag = select ? SELECT : 0;
Base *base;
@@ -2746,7 +2748,7 @@ static int object_circle_select(ViewContext *vc, int select, const int mval[2],
{
if (len_squared_v2v2(mval_fl, screen_co) <= radius_squared) {
ED_base_object_select(base, select);
- is_change = TRUE;
+ is_change = true;
}
}
}
@@ -2760,8 +2762,8 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Object *obact = CTX_data_active_object(C);
- int radius = RNA_int_get(op->ptr, "radius");
- int gesture_mode = RNA_int_get(op->ptr, "gesture_mode");
+ const int radius = RNA_int_get(op->ptr, "radius");
+ const int gesture_mode = RNA_int_get(op->ptr, "gesture_mode");
int select;
const int mval[2] = {RNA_int_get(op->ptr, "x"),
RNA_int_get(op->ptr, "y")};
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c
index 6edcf980d58..eb32baf4c3f 100644
--- a/source/blender/editors/space_view3d/view3d_snap.c
+++ b/source/blender/editors/space_view3d/view3d_snap.c
@@ -101,7 +101,7 @@ static void special_transvert_update(Object *obedit)
if (obedit->type == OB_MESH) {
BMEditMesh *em = BMEdit_FromObject(obedit);
- BM_mesh_normals_update(em->bm, TRUE); /* does face centers too */
+ BM_mesh_normals_update(em->bm, true); /* does face centers too */
}
else if (ELEM(obedit->type, OB_CURVE, OB_SURF)) {
Curve *cu = obedit->data;
@@ -1075,7 +1075,7 @@ void VIEW3D_OT_snap_cursor_to_center(wmOperatorType *ot)
/* **************************************************** */
-int ED_view3d_minmax_verts(Object *obedit, float min[3], float max[3])
+bool ED_view3d_minmax_verts(Object *obedit, float min[3], float max[3])
{
TransVert *tv;
float centroid[3], vec[3], bmat[3][3];
@@ -1085,7 +1085,7 @@ int ED_view3d_minmax_verts(Object *obedit, float min[3], float max[3])
if (ELEM5(obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE))
make_trans_verts(obedit, bmat[0], bmat[1], TM_ALL_JOINTS);
- if (tottrans == 0) return 0;
+ if (tottrans == 0) return false;
copy_m3_m4(bmat, obedit->obmat);
@@ -1101,5 +1101,5 @@ int ED_view3d_minmax_verts(Object *obedit, float min[3], float max[3])
MEM_freeN(transvmain);
transvmain = NULL;
- return 1;
+ return true;
}
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index b2e10fa8457..b227d32d987 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -460,7 +460,7 @@ static int view3d_camera_to_view_selected_exec(bContext *C, wmOperator *UNUSED(o
/* only touch location */
BKE_object_tfm_protected_backup(camera_ob, &obtfm);
- BKE_object_apply_mat4(camera_ob, obmat_new, TRUE, TRUE);
+ BKE_object_apply_mat4(camera_ob, obmat_new, true, true);
BKE_object_tfm_protected_restore(camera_ob, &obtfm, OB_LOCK_SCALE | OB_LOCK_ROT4D);
/* notifiers */
@@ -479,7 +479,7 @@ static int view3d_camera_to_view_selected_poll(bContext *C)
if (v3d && v3d->camera && v3d->camera->id.lib == NULL) {
RegionView3D *rv3d = CTX_wm_region_view3d(C);
if (rv3d) {
- if (rv3d->is_persp == FALSE) {
+ if (rv3d->is_persp == false) {
CTX_wm_operator_poll_msg_set(C, "Only valid for a perspective camera view");
}
else if (!rv3d->viewlock) {
@@ -612,7 +612,7 @@ void ED_view3d_clipping_calc(BoundBox *bb, float planes[4][4], bglMats *mats, co
}
-int ED_view3d_boundbox_clip(RegionView3D *rv3d, float obmat[4][4], BoundBox *bb)
+bool ED_view3d_boundbox_clip(RegionView3D *rv3d, float obmat[4][4], const BoundBox *bb)
{
/* return 1: draw */
@@ -620,8 +620,8 @@ int ED_view3d_boundbox_clip(RegionView3D *rv3d, float obmat[4][4], BoundBox *bb)
float vec[4], min, max;
int a, flag = -1, fl;
- if (bb == NULL) return 1;
- if (bb->flag & OB_BB_DISABLED) return 1;
+ if (bb == NULL) return true;
+ if (bb->flag & OB_BB_DISABLED) return true;
mult_m4_m4m4(mat, rv3d->persmat, obmat);
@@ -641,10 +641,10 @@ int ED_view3d_boundbox_clip(RegionView3D *rv3d, float obmat[4][4], BoundBox *bb)
if (vec[2] > max) fl += 32;
flag &= fl;
- if (flag == 0) return 1;
+ if (flag == 0) return true;
}
- return 0;
+ return false;
}
float ED_view3d_depth_read_cached(ViewContext *vc, int x, int y)
@@ -663,7 +663,7 @@ float ED_view3d_depth_read_cached(ViewContext *vc, int x, int y)
void ED_view3d_depth_tag_update(RegionView3D *rv3d)
{
if (rv3d->depths)
- rv3d->depths->damaged = 1;
+ rv3d->depths->damaged = true;
}
/* copies logic of get_view3d_viewplane(), keep in sync */
@@ -951,7 +951,7 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b
Base tbase;
tbase.flag = OB_FROMDUPLI;
- lb = object_duplilist(scene, base->object, FALSE);
+ lb = object_duplilist(scene, base->object, false);
for (dob = lb->first; dob; dob = dob->next) {
tbase.object = dob->ob;
@@ -975,7 +975,7 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b
}
}
}
- v3d->xray = FALSE; /* restore */
+ v3d->xray = false; /* restore */
}
glPopName(); /* see above (pushname) */
@@ -1073,14 +1073,14 @@ int ED_view3d_scene_layer_set(int lay, const int *values, int *active)
return lay;
}
-static int view3d_localview_init(Main *bmain, Scene *scene, ScrArea *sa, ReportList *reports)
+static bool view3d_localview_init(Main *bmain, Scene *scene, ScrArea *sa, ReportList *reports)
{
View3D *v3d = sa->spacedata.first;
Base *base;
float min[3], max[3], box[3];
float size = 0.0f, size_persp = 0.0f, size_ortho = 0.0f;
unsigned int locallay;
- int ok = FALSE;
+ bool ok = false;
if (v3d->localvd) {
return ok;
@@ -1092,13 +1092,13 @@ static int view3d_localview_init(Main *bmain, Scene *scene, ScrArea *sa, ReportL
if (locallay == 0) {
BKE_report(reports, RPT_ERROR, "No more than 8 local views");
- ok = FALSE;
+ ok = false;
}
else {
if (scene->obedit) {
- BKE_object_minmax(scene->obedit, min, max, FALSE);
+ BKE_object_minmax(scene->obedit, min, max, false);
- ok = TRUE;
+ ok = true;
BASACT->lay |= locallay;
scene->obedit->lay = BASACT->lay;
@@ -1106,10 +1106,10 @@ static int view3d_localview_init(Main *bmain, Scene *scene, ScrArea *sa, ReportL
else {
for (base = FIRSTBASE; base; base = base->next) {
if (TESTBASE(v3d, base)) {
- BKE_object_minmax(base->object, min, max, FALSE);
+ BKE_object_minmax(base->object, min, max, false);
base->lay |= locallay;
base->object->lay = base->lay;
- ok = TRUE;
+ ok = true;
}
}
}
@@ -1125,7 +1125,7 @@ static int view3d_localview_init(Main *bmain, Scene *scene, ScrArea *sa, ReportL
size_ortho = ED_view3d_radius_to_ortho_dist(v3d->lens, size / 2.0f) * VIEW3D_MARGIN;
}
- if (ok == TRUE) {
+ if (ok == true) {
ARegion *ar;
v3d->localvd = MEM_mallocN(sizeof(View3D), "localview");
@@ -1220,7 +1220,7 @@ static void restore_localviewdata(ScrArea *sa, int free)
}
}
-static int view3d_localview_exit(Main *bmain, Scene *scene, ScrArea *sa)
+static bool view3d_localview_exit(Main *bmain, Scene *scene, ScrArea *sa)
{
View3D *v3d = sa->spacedata.first;
struct Base *base;
@@ -1247,12 +1247,12 @@ static int view3d_localview_exit(Main *bmain, Scene *scene, ScrArea *sa)
}
}
- DAG_on_visible_update(bmain, FALSE);
+ DAG_on_visible_update(bmain, false);
- return TRUE;
+ return true;
}
else {
- return FALSE;
+ return false;
}
}
@@ -1262,7 +1262,7 @@ static int localview_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
ScrArea *sa = CTX_wm_area(C);
View3D *v3d = CTX_wm_view3d(C);
- int change;
+ bool change;
if (v3d->localvd) {
change = view3d_localview_exit(bmain, scene, sa);
@@ -1403,7 +1403,7 @@ static int game_engine_poll(bContext *C)
return 1;
}
-int ED_view3d_context_activate(bContext *C)
+bool ED_view3d_context_activate(bContext *C)
{
bScreen *sc = CTX_wm_screen(C);
ScrArea *sa = CTX_wm_area(C);
@@ -1416,20 +1416,20 @@ int ED_view3d_context_activate(bContext *C)
break;
if (!sa)
- return 0;
+ return false;
for (ar = sa->regionbase.first; ar; ar = ar->next)
if (ar->regiontype == RGN_TYPE_WINDOW)
break;
if (!ar)
- return 0;
+ return false;
/* bad context switch .. */
CTX_wm_area_set(C, sa);
CTX_wm_region_set(C, ar);
- return 1;
+ return true;
}
static int game_engine_exec(bContext *C, wmOperator *op)
@@ -1466,7 +1466,7 @@ static int game_engine_exec(bContext *C, wmOperator *op)
{
/* Letterbox */
rctf cam_framef;
- ED_view3d_calc_camera_border(startscene, ar, CTX_wm_view3d(C), rv3d, &cam_framef, FALSE);
+ ED_view3d_calc_camera_border(startscene, ar, CTX_wm_view3d(C), rv3d, &cam_framef, false);
cam_frame.xmin = cam_framef.xmin + ar->winrct.xmin;
cam_frame.xmax = cam_framef.xmax + ar->winrct.xmin;
cam_frame.ymin = cam_framef.ymin + ar->winrct.ymin;
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 43c73fd46fc..cf960c953c3 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -5742,10 +5742,10 @@ static void createTransNodeData(bContext *UNUSED(C), TransInfo *t)
/* * motion tracking * */
-enum {
+enum transDataTracking_Mode {
transDataTracking_ModeTracks = 0,
- transDataTracking_ModeCurves = 1,
-} transDataTracking_Mode;
+ transDataTracking_ModeCurves = 1
+};
typedef struct TransDataTracking {
int mode, flag;
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index 4fe36a15802..b12c0906fa0 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -884,7 +884,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
return result;
}
-void ED_getTransformOrientationMatrix(const bContext *C, float orientation_mat[3][3], int activeOnly)
+void ED_getTransformOrientationMatrix(const bContext *C, float orientation_mat[3][3], const bool activeOnly)
{
float normal[3] = {0.0, 0.0, 0.0};
float plane[3] = {0.0, 0.0, 0.0};
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index 6ea37644533..a3a1e6534bf 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -1013,7 +1013,7 @@ static int select_edgeloop_uv_edge_tag_faces(BMEditMesh *em, UvMapVert *first1,
}
static int select_edgeloop(Scene *scene, Image *ima, BMEditMesh *em, NearestHit *hit,
- float limit[2], const short extend)
+ float limit[2], const bool extend)
{
BMFace *efa;
BMIter iter, liter;
@@ -1124,7 +1124,7 @@ static int select_edgeloop(Scene *scene, Image *ima, BMEditMesh *em, NearestHit
/*********************** linked select ***********************/
-static void select_linked(Scene *scene, Image *ima, BMEditMesh *em, const float limit[2], NearestHit *hit, int extend)
+static void select_linked(Scene *scene, Image *ima, BMEditMesh *em, const float limit[2], NearestHit *hit, bool extend)
{
BMFace *efa;
BMLoop *l;
@@ -1909,7 +1909,7 @@ static int sticky_select(float *limit, int hitv[4], int v, float *hituv[4], floa
return 0;
}
-static int mouse_select(bContext *C, const float co[2], int extend, int loop)
+static int mouse_select(bContext *C, const float co[2], bool extend, bool loop)
{
SpaceImage *sima = CTX_wm_space_image(C);
Scene *scene = CTX_data_scene(C);
@@ -2227,11 +2227,11 @@ static int mouse_select(bContext *C, const float co[2], int extend, int loop)
static int select_exec(bContext *C, wmOperator *op)
{
float co[2];
- int extend, loop;
+ bool extend, loop;
RNA_float_get_array(op->ptr, "location", co);
extend = RNA_boolean_get(op->ptr, "extend");
- loop = 0;
+ loop = false;
return mouse_select(C, co, extend, loop);
}
@@ -2272,11 +2272,11 @@ static void UV_OT_select(wmOperatorType *ot)
static int select_loop_exec(bContext *C, wmOperator *op)
{
float co[2];
- int extend, loop;
+ bool extend, loop;
RNA_float_get_array(op->ptr, "location", co);
extend = RNA_boolean_get(op->ptr, "extend");
- loop = 1;
+ loop = true;
return mouse_select(C, co, extend, loop);
}
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index 9de43fc9d6b..b80862d4db5 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -121,7 +121,7 @@ static int ED_uvedit_ensure_uvs(bContext *C, Scene *scene, Object *obedit)
return 1;
if (em && em->bm->totface && !CustomData_has_layer(&em->bm->pdata, CD_MTEXPOLY))
- ED_mesh_uv_texture_add(C, obedit->data, NULL, TRUE);
+ ED_mesh_uv_texture_add(obedit->data, NULL, true);
if (!ED_uvedit_test(obedit))
return 0;
diff --git a/source/blender/gpu/GPU_draw.h b/source/blender/gpu/GPU_draw.h
index 974865db1c0..959c5126305 100644
--- a/source/blender/gpu/GPU_draw.h
+++ b/source/blender/gpu/GPU_draw.h
@@ -69,7 +69,7 @@ void GPU_state_print(void);
* - after drawing, the material must be disabled again */
void GPU_begin_object_materials(struct View3D *v3d, struct RegionView3D *rv3d,
- struct Scene *scene, struct Object *ob, int glsl, int *do_alpha_after);
+ struct Scene *scene, struct Object *ob, bool glsl, bool *do_alpha_after);
void GPU_end_object_materials(void);
int GPU_enable_material(int nr, void *attribs);
@@ -124,7 +124,7 @@ void GPU_set_gpu_mipmapping(int gpu_mipmap);
void GPU_paint_update_image(struct Image *ima, int x, int y, int w, int h);
void GPU_update_images_framechange(void);
int GPU_update_image_time(struct Image *ima, double time);
-int GPU_verify_image(struct Image *ima, struct ImageUser *iuser, int tftile, int compare, int mipmap, int isdata);
+int GPU_verify_image(struct Image *ima, struct ImageUser *iuser, int tftile, int compare, int mipmap, bool is_data);
void GPU_create_gl_tex(unsigned int *bind, unsigned int *pix, float *frect, int rectw, int recth, int mipmap, int use_hight_bit_depth, struct Image *ima);
void GPU_create_gl_tex_compressed(unsigned int *bind, unsigned int *pix, int x, int y, int mipmap, struct Image *ima, struct ImBuf *ibuf);
int GPU_upload_dxt_texture(struct ImBuf *ibuf);
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index e153651caca..33402426b62 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -439,7 +439,7 @@ static void gpu_verify_reflection(Image *ima)
}
}
-int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int mipmap, int is_data)
+int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int mipmap, bool is_data)
{
ImBuf *ibuf = NULL;
unsigned int *bind = NULL;
@@ -1275,7 +1275,7 @@ static Material *gpu_active_node_material(Material *ma)
return ma;
}
-void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, Object *ob, int glsl, int *do_alpha_after)
+void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, Object *ob, bool glsl, bool *do_alpha_after)
{
Material *ma;
GPUMaterial *gpumat;
@@ -1308,7 +1308,7 @@ void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, O
GMS.use_alpha_pass = (do_alpha_after != NULL);
GMS.is_alpha_pass = (v3d->transp != FALSE);
if (GMS.use_alpha_pass)
- *do_alpha_after = FALSE;
+ *do_alpha_after = false;
if (GMS.totmat > FIXEDMAT) {
GMS.matbuf= MEM_callocN(sizeof(GPUMaterialFixed)*GMS.totmat, "GMS.matbuf");
@@ -1381,7 +1381,7 @@ void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, O
* drawn in a second alpha pass for improved blending */
if (do_alpha_after && !GMS.is_alpha_pass)
if (ELEM3(alphablend, GPU_BLEND_ALPHA, GPU_BLEND_ADD, GPU_BLEND_ALPHA_SORT))
- *do_alpha_after = TRUE;
+ *do_alpha_after = true;
GMS.alphablend[a]= alphablend;
}
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index 636c44d3e80..999e3b5c20e 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -278,6 +278,7 @@ void GPU_material_bind(GPUMaterial *material, int oblay, int viewlay, double tim
}
GPU_pass_bind(material->pass, time, mipmap);
+ GPU_pass_update_uniforms(material->pass);
material->bound = 1;
}
}
@@ -338,8 +339,6 @@ void GPU_material_bind_uniforms(GPUMaterial *material, float obmat[4][4], float
mult_m4_m4m4(lamp->dynpersmat, lamp->persmat, viewinv);
}
}
-
- GPU_pass_update_uniforms(material->pass);
}
}
diff --git a/source/blender/gpu/intern/gpu_simple_shader.c b/source/blender/gpu/intern/gpu_simple_shader.c
index b29d6c2e681..88f768d6cf8 100644
--- a/source/blender/gpu/intern/gpu_simple_shader.c
+++ b/source/blender/gpu/intern/gpu_simple_shader.c
@@ -56,7 +56,7 @@
/* State */
-#define NUM_OPENGL_LIGHTS 8
+// #define NUM_OPENGL_LIGHTS 8
static struct {
GPUShader *cached_shaders[GPU_SHADER_OPTION_COMBINATIONS];
diff --git a/source/blender/imbuf/IMB_moviecache.h b/source/blender/imbuf/IMB_moviecache.h
index 4588c2bcee5..1c569712968 100644
--- a/source/blender/imbuf/IMB_moviecache.h
+++ b/source/blender/imbuf/IMB_moviecache.h
@@ -58,7 +58,9 @@ void IMB_moviecache_set_priority_callback(struct MovieCache *cache, MovieCacheGe
MovieCachePriorityDeleterFP prioritydeleterfp);
void IMB_moviecache_put(struct MovieCache *cache, void *userkey, struct ImBuf *ibuf);
+int IMB_moviecache_put_if_possible(struct MovieCache *cache, void *userkey, struct ImBuf *ibuf);
struct ImBuf *IMB_moviecache_get(struct MovieCache *cache, void *userkey);
+int IMB_moviecache_has_frame(struct MovieCache *cache, void *userkey);
void IMB_moviecache_free(struct MovieCache *cache);
void IMB_moviecache_cleanup(struct MovieCache *cache, int (cleanup_check_cb) (void *userkey, void *userdata), void *userdata);
diff --git a/source/blender/imbuf/intern/cineon/cineon_dpx.c b/source/blender/imbuf/intern/cineon/cineon_dpx.c
index 48bda418d82..255af7dc039 100644
--- a/source/blender/imbuf/intern/cineon/cineon_dpx.c
+++ b/source/blender/imbuf/intern/cineon/cineon_dpx.c
@@ -63,24 +63,24 @@ static struct ImBuf *imb_load_dpx_cineon(unsigned char *mem, size_t size, int us
image = logImageOpenFromMemory(mem, size);
- if (image == 0) {
+ if (image == NULL) {
printf("DPX/Cineon: error opening image.\n");
- return 0;
+ return NULL;
}
logImageGetSize(image, &width, &height, &depth);
ibuf = IMB_allocImBuf(width, height, 32, IB_rectfloat | flags);
- if (ibuf == 0) {
+ if (ibuf == NULL) {
logImageClose(image);
- return 0;
+ return NULL;
}
if (!(flags & IB_test)) {
if (logImageGetDataRGBA(image, ibuf->rect_float, 1) != 0) {
logImageClose(image);
IMB_freeImBuf(ibuf);
- return 0;
+ return NULL;
}
IMB_flipy(ibuf);
}
@@ -127,12 +127,12 @@ static int imb_save_dpx_cineon(ImBuf *ibuf, const char *filename, int use_cineon
logImage = logImageCreate(filename, use_cineon, ibuf->x, ibuf->y, bitspersample, (depth == 4),
(ibuf->ftype & CINEON_LOG), -1, -1, -1, "Blender");
- if (logImage == 0) {
+ if (logImage == NULL) {
printf("DPX/Cineon: error creating file.\n");
return 0;
}
- if (ibuf->rect_float != 0 && bitspersample != 8) {
+ if (ibuf->rect_float != NULL && bitspersample != 8) {
/* don't use the float buffer to save 8 bpp picture to prevent color banding
* (there's no dithering algorithm behing the logImageSetDataRGBA function) */
@@ -150,11 +150,11 @@ static int imb_save_dpx_cineon(ImBuf *ibuf, const char *filename, int use_cineon
MEM_freeN(fbuf);
}
else {
- if (ibuf->rect == 0)
+ if (ibuf->rect == NULL)
IMB_rect_from_float(ibuf);
fbuf = (float *)MEM_mallocN(ibuf->x * ibuf->y * 4 * sizeof(float), "fbuf in imb_save_dpx_cineon");
- if (fbuf == 0) {
+ if (fbuf == NULL) {
printf("DPX/Cineon: error allocating memory.\n");
logImageClose(logImage);
return 0;
@@ -191,7 +191,7 @@ ImBuf *imb_load_cineon(unsigned char *mem, size_t size, int flags, char colorspa
{
if (imb_is_cineon(mem))
return imb_load_dpx_cineon(mem, size, 1, flags, colorspace);
- return 0;
+ return NULL;
}
int imb_save_dpx(struct ImBuf *buf, const char *myfile, int flags)
@@ -208,5 +208,5 @@ ImBuf *imb_load_dpx(unsigned char *mem, size_t size, int flags, char colorspace[
{
if (imb_is_dpx(mem))
return imb_load_dpx_cineon(mem, size, 0, flags, colorspace);
- return 0;
+ return NULL;
}
diff --git a/source/blender/imbuf/intern/cineon/cineonlib.c b/source/blender/imbuf/intern/cineon/cineonlib.c
index 4b9ca1dd539..1481b2aaa66 100644
--- a/source/blender/imbuf/intern/cineon/cineonlib.c
+++ b/source/blender/imbuf/intern/cineon/cineonlib.c
@@ -75,7 +75,7 @@ static void fillCineonMainHeader(LogImageFile *cineon, CineonMainHeader *header,
strcpy(header->fileHeader.version, "v4.5");
strncpy(header->fileHeader.file_name, filename, 99);
header->fileHeader.file_name[99] = 0;
- fileClock = time(0);
+ fileClock = time(NULL);
fileTime = localtime(&fileClock);
strftime(header->fileHeader.creation_date, 12, "%Y:%m:%d", fileTime);
strftime(header->fileHeader.creation_time, 12, "%H:%M:%S%Z", fileTime);
@@ -142,28 +142,28 @@ LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t
int i;
unsigned int dataOffset;
- if (cineon == 0) {
+ if (cineon == NULL) {
if (verbose) printf("Cineon: Failed to malloc cineon file structure.\n");
- return 0;
+ return NULL;
}
/* zero the header */
memset(&header, 0, sizeof(CineonMainHeader));
/* for close routine */
- cineon->file = 0;
+ cineon->file = NULL;
if (fromMemory == 0) {
/* byteStuff is then the filename */
cineon->file = BLI_fopen(filename, "rb");
- if (cineon->file == 0) {
+ if (cineon->file == NULL) {
if (verbose) printf("Cineon: Failed to open file \"%s\".\n", filename);
logImageClose(cineon);
- return 0;
+ return NULL;
}
/* not used in this case */
- cineon->memBuffer = 0;
- cineon->memCursor = 0;
+ cineon->memBuffer = NULL;
+ cineon->memCursor = NULL;
cineon->memBufferSize = 0;
}
else {
@@ -175,7 +175,7 @@ LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t
if (logimage_fread(&header, sizeof(header), 1, cineon) == 0) {
if (verbose) printf("Cineon: Not enough data for header in \"%s\".\n", byteStuff);
logImageClose(cineon);
- return 0;
+ return NULL;
}
/* endianness determination */
@@ -191,7 +191,7 @@ LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t
if (verbose) printf("Cineon: Bad magic number %lu in \"%s\".\n",
(unsigned long)header.fileHeader.magic_num, byteStuff);
logImageClose(cineon);
- return 0;
+ return NULL;
}
cineon->width = swap_uint(header.imageHeader.element[0].pixels_per_line, cineon->isMSB);
@@ -200,7 +200,7 @@ LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t
if (cineon->width == 0 || cineon->height == 0) {
if (verbose) printf("Cineon: Wrong image dimension: %dx%d\n", cineon->width, cineon->height);
logImageClose(cineon);
- return 0;
+ return NULL;
}
cineon->depth = header.imageHeader.elements_per_image;
@@ -213,7 +213,7 @@ LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t
else {
if (verbose) printf("Cineon: Data interleave not supported: %d\n", header.imageHeader.interleave);
logImageClose(cineon);
- return 0;
+ return NULL;
}
if (cineon->depth == 1) {
@@ -244,7 +244,7 @@ LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t
else {
if (verbose) printf("Cineon: Cineon image depth unsupported: %d\n", cineon->depth);
logImageClose(cineon);
- return 0;
+ return NULL;
}
dataOffset = swap_uint(header.fileHeader.offset, cineon->isMSB);
@@ -274,7 +274,7 @@ LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t
/* Not supported */
if (verbose) printf("Cineon: packing unsupported: %d\n", header.imageHeader.packing);
logImageClose(cineon);
- return 0;
+ return NULL;
}
if (cineon->element[i].refLowData == CINEON_UNDEFINED_U32 || isnan(cineon->element[i].refLowData))
@@ -329,20 +329,20 @@ LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t
LogImageFile *cineonCreate(const char *filename, int width, int height, int bitsPerSample, const char *creator)
{
CineonMainHeader header;
- const char *shortFilename = 0;
+ const char *shortFilename = NULL;
/* unsigned char pad[6044]; */
LogImageFile *cineon = (LogImageFile *)MEM_mallocN(sizeof(LogImageFile), __func__);
- if (cineon == 0) {
+ if (cineon == NULL) {
if (verbose) printf("cineon: Failed to malloc cineon file structure.\n");
- return 0;
+ return NULL;
}
/* Only 10 bits Cineon are supported */
if (bitsPerSample != 10) {
if (verbose) printf("cineon: Only 10 bits Cineon are supported.\n");
logImageClose(cineon);
- return 0;
+ return NULL;
}
cineon->width = width;
@@ -366,16 +366,16 @@ LogImageFile *cineonCreate(const char *filename, int width, int height, int bits
cineon->gamma = 1.7f;
shortFilename = strrchr(filename, '/');
- if (shortFilename == 0)
+ if (shortFilename == NULL)
shortFilename = filename;
else
shortFilename++;
cineon->file = BLI_fopen(filename, "wb");
- if (cineon->file == 0) {
+ if (cineon->file == NULL) {
if (verbose) printf("cineon: Couldn't open file %s\n", filename);
logImageClose(cineon);
- return 0;
+ return NULL;
}
fillCineonMainHeader(cineon, &header, shortFilename, creator);
@@ -383,7 +383,7 @@ LogImageFile *cineonCreate(const char *filename, int width, int height, int bits
if (fwrite(&header, sizeof(header), 1, cineon->file) == 0) {
if (verbose) printf("cineon: Couldn't write image header\n");
logImageClose(cineon);
- return 0;
+ return NULL;
}
return cineon;
diff --git a/source/blender/imbuf/intern/cineon/dpxlib.c b/source/blender/imbuf/intern/cineon/dpxlib.c
index 10c90b1b891..5a4371d84ba 100644
--- a/source/blender/imbuf/intern/cineon/dpxlib.c
+++ b/source/blender/imbuf/intern/cineon/dpxlib.c
@@ -76,7 +76,7 @@ static void fillDpxMainHeader(LogImageFile *dpx, DpxMainHeader *header, const ch
header->fileHeader.user_data_size = DPX_UNDEFINED_U32;
strncpy(header->fileHeader.file_name, filename, 99);
header->fileHeader.file_name[99] = 0;
- fileClock = time(0);
+ fileClock = time(NULL);
fileTime = localtime(&fileClock);
strftime(header->fileHeader.creation_date, 24, "%Y:%m:%d:%H:%M:%S%Z", fileTime);
header->fileHeader.creation_date[23] = 0;
@@ -138,28 +138,28 @@ LogImageFile *dpxOpen(const unsigned char *byteStuff, int fromMemory, size_t buf
char *filename = (char *)byteStuff;
int i;
- if (dpx == 0) {
+ if (dpx == NULL) {
if (verbose) printf("DPX: Failed to malloc dpx file structure.\n");
- return 0;
+ return NULL;
}
/* zero the header */
memset(&header, 0, sizeof(DpxMainHeader));
/* for close routine */
- dpx->file = 0;
+ dpx->file = NULL;
if (fromMemory == 0) {
/* byteStuff is then the filename */
dpx->file = BLI_fopen(filename, "rb");
- if (dpx->file == 0) {
+ if (dpx->file == NULL) {
if (verbose) printf("DPX: Failed to open file \"%s\".\n", filename);
logImageClose(dpx);
- return 0;
+ return NULL;
}
/* not used in this case */
- dpx->memBuffer = 0;
- dpx->memCursor = 0;
+ dpx->memBuffer = NULL;
+ dpx->memCursor = NULL;
dpx->memBufferSize = 0;
}
else {
@@ -171,7 +171,7 @@ LogImageFile *dpxOpen(const unsigned char *byteStuff, int fromMemory, size_t buf
if (logimage_fread(&header, sizeof(header), 1, dpx) == 0) {
if (verbose) printf("DPX: Not enough data for header in \"%s\".\n", byteStuff);
logImageClose(dpx);
- return 0;
+ return NULL;
}
/* endianness determination */
@@ -187,7 +187,7 @@ LogImageFile *dpxOpen(const unsigned char *byteStuff, int fromMemory, size_t buf
if (verbose) printf("DPX: Bad magic number %lu in \"%s\".\n",
(uintptr_t)header.fileHeader.magic_num, byteStuff);
logImageClose(dpx);
- return 0;
+ return NULL;
}
dpx->srcFormat = format_DPX;
@@ -195,7 +195,7 @@ LogImageFile *dpxOpen(const unsigned char *byteStuff, int fromMemory, size_t buf
if (dpx->numElements == 0) {
if (verbose) printf("DPX: Wrong number of elements: %d\n", dpx->numElements);
logImageClose(dpx);
- return 0;
+ return NULL;
}
dpx->width = swap_uint(header.imageHeader.pixels_per_line, dpx->isMSB);
@@ -204,7 +204,7 @@ LogImageFile *dpxOpen(const unsigned char *byteStuff, int fromMemory, size_t buf
if (dpx->width == 0 || dpx->height == 0) {
if (verbose) printf("DPX: Wrong image dimension: %dx%d\n", dpx->width, dpx->height);
logImageClose(dpx);
- return 0;
+ return NULL;
}
dpx->depth = 0;
@@ -251,7 +251,7 @@ LogImageFile *dpxOpen(const unsigned char *byteStuff, int fromMemory, size_t buf
if (dpx->depth == 0 || dpx->depth > 4) {
if (verbose) printf("DPX: Unsupported image depth: %d\n", dpx->depth);
logImageClose(dpx);
- return 0;
+ return NULL;
}
dpx->element[i].bitsPerSample = header.imageHeader.element[i].bits_per_sample;
@@ -261,7 +261,7 @@ LogImageFile *dpxOpen(const unsigned char *byteStuff, int fromMemory, size_t buf
{
if (verbose) printf("DPX: Unsupported bitsPerSample for elements %d: %d\n", i, dpx->element[i].bitsPerSample);
logImageClose(dpx);
- return 0;
+ return NULL;
}
dpx->element[i].maxValue = powf(2, dpx->element[i].bitsPerSample) - 1.0f;
@@ -270,7 +270,7 @@ LogImageFile *dpxOpen(const unsigned char *byteStuff, int fromMemory, size_t buf
if (dpx->element[i].packing > 2) {
if (verbose) printf("DPX: Unsupported packing for element %d: %d\n", i, dpx->element[i].packing);
logImageClose(dpx);
- return 0;
+ return NULL;
}
/* Sometimes, the offset is not set correctly in the header */
@@ -281,7 +281,7 @@ LogImageFile *dpxOpen(const unsigned char *byteStuff, int fromMemory, size_t buf
if (dpx->element[i].dataOffset == 0) {
if (verbose) printf("DPX: Image header is corrupted.\n");
logImageClose(dpx);
- return 0;
+ return NULL;
}
dpx->element[i].transfer = header.imageHeader.element[i].transfer;
@@ -386,13 +386,13 @@ LogImageFile *dpxCreate(const char *filename, int width, int height, int bitsPer
const char *creator)
{
DpxMainHeader header;
- const char *shortFilename = 0;
+ const char *shortFilename = NULL;
unsigned char pad[6044];
LogImageFile *dpx = (LogImageFile *)MEM_mallocN(sizeof(LogImageFile), __func__);
- if (dpx == 0) {
+ if (dpx == NULL) {
if (verbose) printf("DPX: Failed to malloc dpx file structure.\n");
- return 0;
+ return NULL;
}
dpx->width = width;
@@ -418,7 +418,7 @@ LogImageFile *dpxCreate(const char *filename, int width, int height, int bitsPer
default:
if (verbose) printf("DPX: bitsPerSample not supported: %d\n", bitsPerSample);
logImageClose(dpx);
- return 0;
+ return NULL;
}
if (hasAlpha == 0) {
@@ -463,17 +463,17 @@ LogImageFile *dpxCreate(const char *filename, int width, int height, int bitsPer
shortFilename = strrchr(filename, '/');
- if (shortFilename == 0)
+ if (shortFilename == NULL)
shortFilename = filename;
else
shortFilename++;
dpx->file = BLI_fopen(filename, "wb");
- if (dpx->file == 0) {
+ if (dpx->file == NULL) {
if (verbose) printf("DPX: Couldn't open file %s\n", filename);
logImageClose(dpx);
- return 0;
+ return NULL;
}
fillDpxMainHeader(dpx, &header, shortFilename, creator);
@@ -481,7 +481,7 @@ LogImageFile *dpxCreate(const char *filename, int width, int height, int bitsPer
if (fwrite(&header, sizeof(header), 1, dpx->file) == 0) {
if (verbose) printf("DPX: Couldn't write image header\n");
logImageClose(dpx);
- return 0;
+ return NULL;
}
/* Header should be rounded to next 8k block
@@ -490,7 +490,7 @@ LogImageFile *dpxCreate(const char *filename, int width, int height, int bitsPer
if (fwrite(&pad, 6044, 1, dpx->file) == 0) {
if (verbose) printf("DPX: Couldn't write image header\n");
logImageClose(dpx);
- return 0;
+ return NULL;
}
return dpx;
diff --git a/source/blender/imbuf/intern/cineon/logImageCore.c b/source/blender/imbuf/intern/cineon/logImageCore.c
index 332ad913d19..c10f201fb55 100644
--- a/source/blender/imbuf/intern/cineon/logImageCore.c
+++ b/source/blender/imbuf/intern/cineon/logImageCore.c
@@ -97,12 +97,12 @@ LogImageFile *logImageOpenFromFile(const char *filename, int cineon)
(void)cineon;
- if (f == 0)
- return 0;
+ if (f == NULL)
+ return NULL;
if (fread(&magicNum, sizeof(unsigned int), 1, f) != 1) {
fclose(f);
- return 0;
+ return NULL;
}
fclose(f);
@@ -112,7 +112,7 @@ LogImageFile *logImageOpenFromFile(const char *filename, int cineon)
else if (logImageIsCineon(&magicNum))
return cineonOpen((const unsigned char *)filename, 0, 0);
- return 0;
+ return NULL;
}
LogImageFile *logImageOpenFromMemory(const unsigned char *buffer, unsigned int size)
@@ -122,7 +122,7 @@ LogImageFile *logImageOpenFromMemory(const unsigned char *buffer, unsigned int s
else if (logImageIsCineon(buffer))
return cineonOpen(buffer, 1, size);
- return 0;
+ return NULL;
}
LogImageFile *logImageCreate(const char *filename, int cineon, int width, int height, int bitsPerSample,
@@ -136,15 +136,15 @@ LogImageFile *logImageCreate(const char *filename, int cineon, int width, int he
return dpxCreate(filename, width, height, bitsPerSample, isLogarithmic, hasAlpha,
referenceWhite, referenceBlack, gamma, creator);
- return 0;
+ return NULL;
}
void logImageClose(LogImageFile *logImage)
{
- if (logImage != 0) {
+ if (logImage != NULL) {
if (logImage->file) {
fclose(logImage->file);
- logImage->file = 0;
+ logImage->file = NULL;
}
MEM_freeN(logImage);
}
@@ -203,7 +203,7 @@ int logImageSetDataRGBA(LogImageFile *logImage, float *data, int dataIsLinearRGB
int returnValue;
elementData = (float *)MEM_mallocN(logImage->width * logImage->height * logImage->depth * sizeof(float), __func__);
- if (elementData == 0)
+ if (elementData == NULL)
return 1;
if (convertRGBAToLogElement(data, elementData, logImage, logImage->element[0], dataIsLinearRGB) != 0) {
@@ -244,7 +244,7 @@ static int logImageSetData8(LogImageFile *logImage, LogImageElement logElement,
int x, y;
row = (unsigned char *)MEM_mallocN(rowLength, __func__);
- if (row == 0) {
+ if (row == NULL) {
if (verbose) printf("DPX/Cineon: Cannot allocate row.\n");
return 1;
}
@@ -272,7 +272,7 @@ static int logImageSetData10(LogImageFile *logImage, LogImageElement logElement,
int x, y, offset;
row = (unsigned int *)MEM_mallocN(rowLength, __func__);
- if (row == 0) {
+ if (row == NULL) {
if (verbose) printf("DPX/Cineon: Cannot allocate row.\n");
return 1;
}
@@ -313,7 +313,7 @@ static int logImageSetData12(LogImageFile *logImage, LogImageElement logElement,
int x, y;
row = (unsigned short *)MEM_mallocN(rowLength, __func__);
- if (row == 0) {
+ if (row == NULL) {
if (verbose) printf("DPX/Cineon: Cannot allocate row.\n");
return 1;
}
@@ -339,7 +339,7 @@ static int logImageSetData16(LogImageFile *logImage, LogImageElement logElement,
int x, y;
row = (unsigned short *)MEM_mallocN(rowLength, __func__);
- if (row == 0) {
+ if (row == NULL) {
if (verbose) printf("DPX/Cineon: Cannot allocate row.\n");
return 1;
}
@@ -383,10 +383,10 @@ int logImageGetDataRGBA(LogImageFile *logImage, float *data, int dataIsLinearRGB
if (logImage->element[i].descriptor != descriptor_Depth && logImage->element[i].descriptor != descriptor_Composite) {
/* Allocate memory */
elementData[i] = (float *)MEM_mallocN(logImage->width * logImage->height * logImage->element[i].depth * sizeof(float), __func__);
- if (elementData[i] == 0) {
+ if (elementData[i] == NULL) {
if (verbose) printf("DPX/Cineon: Cannot allocate memory for elementData[%d]\n.", i);
for (j = 0; j < i; j++)
- if (elementData[j] != 0)
+ if (elementData[j] != NULL)
MEM_freeN(elementData[j]);
return 1;
}
@@ -396,7 +396,7 @@ int logImageGetDataRGBA(LogImageFile *logImage, float *data, int dataIsLinearRGB
if (logImageElementGetData(logImage, logImage->element[i], elementData[i]) != 0) {
if (verbose) printf("DPX/Cineon: Cannot read elementData[%d]\n.", i);
for (j = 0; j < i; j++)
- if (elementData[j] != 0)
+ if (elementData[j] != NULL)
MEM_freeN(elementData[j]);
return 1;
}
@@ -531,10 +531,10 @@ int logImageGetDataRGBA(LogImageFile *logImage, float *data, int dataIsLinearRGB
}
mergedData = (float *)MEM_mallocN(logImage->width * logImage->height * mergedElement.depth * sizeof(float), __func__);
- if (mergedData == 0) {
+ if (mergedData == NULL) {
if (verbose) printf("DPX/Cineon: Cannot allocate mergedData.\n");
for (i = 0; i < logImage->numElements; i++)
- if (elementData[i] != 0)
+ if (elementData[i] != NULL)
MEM_freeN(elementData[i]);
return 1;
}
@@ -548,7 +548,7 @@ int logImageGetDataRGBA(LogImageFile *logImage, float *data, int dataIsLinearRGB
/* Done with elements data, clean-up */
for (i = 0; i < logImage->numElements; i++)
- if (elementData[i] != 0)
+ if (elementData[i] != NULL)
MEM_freeN(elementData[i]);
returnValue = convertLogElementToRGBA(mergedData, data, logImage, mergedElement, dataIsLinearRGB);
@@ -1383,7 +1383,7 @@ static int convertRGBAToLogElement(float *src, float *dst, LogImageFile *logImag
if (srcIsLinearRGB != 0) {
/* we need to convert src to sRGB */
srgbSrc = (float *)MEM_mallocN(4 * logImage->width * logImage->height * sizeof(float), __func__);
- if (srgbSrc == 0)
+ if (srgbSrc == NULL)
return 1;
memcpy(srgbSrc, src, 4 * logImage->width * logImage->height * sizeof(float));
diff --git a/source/blender/imbuf/intern/moviecache.c b/source/blender/imbuf/intern/moviecache.c
index a168c9c3051..94fe1f44d91 100644
--- a/source/blender/imbuf/intern/moviecache.c
+++ b/source/blender/imbuf/intern/moviecache.c
@@ -306,7 +306,7 @@ void IMB_moviecache_set_priority_callback(struct MovieCache *cache, MovieCacheGe
cache->prioritydeleterfp = prioritydeleterfp;
}
-void IMB_moviecache_put(MovieCache *cache, void *userkey, ImBuf *ibuf)
+static void do_moviecache_put(MovieCache *cache, void *userkey, ImBuf *ibuf, int need_lock)
{
MovieCacheKey *key;
MovieCacheItem *item;
@@ -341,7 +341,8 @@ void IMB_moviecache_put(MovieCache *cache, void *userkey, ImBuf *ibuf)
memcpy(cache->last_userkey, userkey, cache->keysize);
}
- BLI_mutex_lock(&limitor_lock);
+ if (need_lock)
+ BLI_mutex_lock(&limitor_lock);
item->c_handle = MEM_CacheLimiter_insert(limitor, item);
@@ -349,7 +350,8 @@ void IMB_moviecache_put(MovieCache *cache, void *userkey, ImBuf *ibuf)
MEM_CacheLimiter_enforce_limits(limitor);
MEM_CacheLimiter_unref(item->c_handle);
- BLI_mutex_unlock(&limitor_lock);
+ if (need_lock)
+ BLI_mutex_unlock(&limitor_lock);
/* cache limiter can't remove unused keys which points to destoryed values */
check_unused_keys(cache);
@@ -360,6 +362,32 @@ void IMB_moviecache_put(MovieCache *cache, void *userkey, ImBuf *ibuf)
}
}
+void IMB_moviecache_put(MovieCache *cache, void *userkey, ImBuf *ibuf)
+{
+ do_moviecache_put(cache, userkey, ibuf, TRUE);
+}
+
+int IMB_moviecache_put_if_possible(MovieCache *cache, void *userkey, ImBuf *ibuf)
+{
+ size_t mem_in_use, mem_limit, elem_size;
+ int result = FALSE;
+
+ elem_size = IMB_get_size_in_memory(ibuf);
+ mem_limit = MEM_CacheLimiter_get_maximum();
+
+ BLI_mutex_lock(&limitor_lock);
+ mem_in_use = MEM_CacheLimiter_get_memory_in_use(limitor);
+
+ if (mem_in_use + elem_size <= mem_limit) {
+ do_moviecache_put(cache, userkey, ibuf, FALSE);
+ result = TRUE;
+ }
+
+ BLI_mutex_unlock(&limitor_lock);
+
+ return result;
+}
+
ImBuf *IMB_moviecache_get(MovieCache *cache, void *userkey)
{
MovieCacheKey key;
@@ -384,6 +412,18 @@ ImBuf *IMB_moviecache_get(MovieCache *cache, void *userkey)
return NULL;
}
+int IMB_moviecache_has_frame(MovieCache *cache, void *userkey)
+{
+ MovieCacheKey key;
+ MovieCacheItem *item;
+
+ key.cache_owner = cache;
+ key.userkey = userkey;
+ item = (MovieCacheItem *)BLI_ghash_lookup(cache->hash, &key);
+
+ return item != NULL;
+}
+
void IMB_moviecache_free(MovieCache *cache)
{
PRINT("%s: cache '%s' free\n", __func__, cache->name);
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index 043bb8da83c..defbfcd3e99 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -1105,11 +1105,29 @@ static int exr_is_multilayer(InputFile *file)
const ChannelList &channels = file->header().channels();
std::set <std::string> layerNames;
+ /* will not include empty layer names */
channels.layers(layerNames);
if (comments || layerNames.size() > 1)
return 1;
+ if (layerNames.size()) {
+ /* if layerNames is not empty, it means at least one layer is non-empty,
+ * but it also could be layers without names in the file and such case
+ * shall be considered a multilayer exr
+ *
+ * that's what we do here: test whether there're empty layer names together
+ * with non-empty ones in the file
+ */
+ for (ChannelList::ConstIterator i = channels.begin(); i != channels.end(); i++) {
+ std::string layerName = i.name();
+ size_t pos = layerName.rfind ('.');
+
+ if (pos == std::string::npos)
+ return 1;
+ }
+ }
+
return 0;
}
diff --git a/source/blender/imbuf/intern/rectop.c b/source/blender/imbuf/intern/rectop.c
index 446833ccf3b..958070c1479 100644
--- a/source/blender/imbuf/intern/rectop.c
+++ b/source/blender/imbuf/intern/rectop.c
@@ -138,7 +138,7 @@ static void blend_color_add_alpha(char cp[4], const char cp1[4], const char cp2[
cp[0] = cp1[0];
cp[1] = cp1[1];
cp[2] = cp1[2];
- cp[3] = (temp < 0) ? 0 : temp;
+ cp[3] = (temp > 255)? 255 : ((temp < 0) ? 0 : temp);
}
@@ -269,6 +269,7 @@ static void blend_color_add_alpha_float(float cp[4], const float cp1[4], const f
cp[3] = (cp1[3] + fac * cp2[3]);
if (cp[3] < 0.0f) cp[3] = 0.0f;
+ if (cp[3] > 1.0f) cp[3] = 1.0f;
}
void IMB_blend_color_float(float *dst, float *src1, float *src2, float fac, IMB_BlendMode mode)
diff --git a/source/blender/imbuf/intern/scaling.c b/source/blender/imbuf/intern/scaling.c
index 51619e18980..553a530ecf4 100644
--- a/source/blender/imbuf/intern/scaling.c
+++ b/source/blender/imbuf/intern/scaling.c
@@ -1681,7 +1681,7 @@ static void *do_scale_thread(void *data_v)
void IMB_scaleImBuf_threaded(ImBuf *ibuf, unsigned int newx, unsigned int newy)
{
- ScaleTreadInitData init_data = {0};
+ ScaleTreadInitData init_data = {NULL};
/* prepare initialization data */
init_data.ibuf = ibuf;
diff --git a/source/blender/makesdna/DNA_movieclip_types.h b/source/blender/makesdna/DNA_movieclip_types.h
index 499f1c50155..119d2cdfdf7 100644
--- a/source/blender/makesdna/DNA_movieclip_types.h
+++ b/source/blender/makesdna/DNA_movieclip_types.h
@@ -98,6 +98,11 @@ typedef struct MovieClip {
/* color management */
ColorManagedColorspaceSettings colorspace_settings;
+
+ /* runtime prefetching stuff */
+ char prefetch_ok;
+
+ char pad[7];
} MovieClip;
typedef struct MovieClipScopes {
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index 5ccdd5c6ac2..b6a5c758dc0 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -257,6 +257,11 @@ typedef struct bNode {
*/
#define NODE_INIT (1<<16)
+ /* do recalc of output, used to skip recalculation of unwanted
+ * composite out nodes when editing tree
+ */
+#define NODE_DO_OUTPUT_RECALC (1<<17)
+
/* node->update */
/* XXX NODE_UPDATE is a generic update flag. More fine-grained updates
* might be used in the future, but currently all work the same way.
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index c70433eeea3..1d7658d974e 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -607,12 +607,13 @@ typedef enum eAutokey_Flag {
typedef enum eUserpref_Translation_Flags {
USER_TR_TOOLTIPS = (1 << 0),
USER_TR_IFACE = (1 << 1),
-/* USER_TR_MENUS = (1 << 2) deprecated */
-/* USER_TR_FILESELECT = (1 << 3) deprecated */
-/* USER_TR_TEXTEDIT = (1 << 4) deprecated */
+/* USER_TR_MENUS = (1 << 2), deprecated */
+/* USER_TR_FILESELECT = (1 << 3), deprecated */
+/* USER_TR_TEXTEDIT = (1 << 4), deprecated */
USER_DOTRANSLATE = (1 << 5),
USER_USETEXTUREFONT = (1 << 6),
-/* CONVERT_TO_UTF8 = (1 << 7) deprecated */
+/* CONVERT_TO_UTF8 = (1 << 7), deprecated */
+ USER_TR_NEWDATANAME = (1 << 8),
} eUserpref_Translation_Flags;
/* dupflag */
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 92ce8122597..b9ee9b6ad1c 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -554,7 +554,7 @@ const char *RNA_struct_ui_description_raw(StructRNA *type)
const char *RNA_struct_translation_context(StructRNA *type)
{
- return type->translation_context ? type->translation_context : BLF_I18NCONTEXT_DEFAULT;
+ return type->translation_context;
}
PropertyRNA *RNA_struct_name_property(StructRNA *type)
@@ -1283,7 +1283,6 @@ void RNA_property_enum_items_gettexted(bContext *C, PointerRNA *ptr, PropertyRNA
for (i = 0; nitem[i].identifier; i++) {
if (nitem[i].name && do_iface) {
- /* note: prop->translation_context may be NULL, this just means we use the default "" context */
nitem[i].name = BLF_pgettext(prop->translation_context, nitem[i].name);
}
if (nitem[i].description && do_tooltip) {
@@ -1446,7 +1445,7 @@ const char *RNA_property_ui_description_raw(PropertyRNA *prop)
const char *RNA_property_translation_context(PropertyRNA *_prop)
{
PropertyRNA *prop = rna_ensure_property(_prop);
- return prop->translation_context ? prop->translation_context : BLF_I18NCONTEXT_DEFAULT;
+ return prop->translation_context;
}
int RNA_property_ui_icon(PropertyRNA *prop)
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index 4ced8326560..c96ea72fee2 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -48,8 +48,8 @@
EnumPropertyItem constraint_type_items[] = {
{0, "", 0, N_("Motion Tracking"), ""},
{CONSTRAINT_TYPE_CAMERASOLVER, "CAMERA_SOLVER", ICON_CONSTRAINT_DATA, "Camera Solver", ""},
- {CONSTRAINT_TYPE_OBJECTSOLVER, "OBJECT_SOLVER", ICON_CONSTRAINT_DATA, "Object Solver", ""},
{CONSTRAINT_TYPE_FOLLOWTRACK, "FOLLOW_TRACK", ICON_CONSTRAINT_DATA, "Follow Track", ""},
+ {CONSTRAINT_TYPE_OBJECTSOLVER, "OBJECT_SOLVER", ICON_CONSTRAINT_DATA, "Object Solver", ""},
{0, "", 0, N_("Transform"), ""},
{CONSTRAINT_TYPE_LOCLIKE, "COPY_LOCATION", ICON_CONSTRAINT_DATA, "Copy Location",
"Copy the location of a target (with an optional offset), so that they move together"},
@@ -99,8 +99,8 @@ EnumPropertyItem constraint_type_items[] = {
"Change pivot point for transforms (buggy)"},
{CONSTRAINT_TYPE_RIGIDBODYJOINT, "RIGID_BODY_JOINT", ICON_CONSTRAINT_DATA, "Rigid Body Joint",
"Use to define a Rigid Body Constraint (for Game Engine use only)"},
- {CONSTRAINT_TYPE_PYTHON, "SCRIPT", ICON_CONSTRAINT_DATA, "Script",
- "Custom constraint(s) written in Python (Not yet implemented)"},
+ /* {CONSTRAINT_TYPE_PYTHON, "SCRIPT", ICON_CONSTRAINT_DATA, "Script",
+ "Custom constraint(s) written in Python (Not yet implemented)"}, */
{CONSTRAINT_TYPE_SHRINKWRAP, "SHRINKWRAP", ICON_CONSTRAINT_DATA, "Shrinkwrap",
"Restrict movements to surface of target mesh"},
{0, NULL, 0, NULL, NULL}
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c
index dba33bb9ab5..479af956591 100644
--- a/source/blender/makesrna/intern/rna_curve.c
+++ b/source/blender/makesrna/intern/rna_curve.c
@@ -281,7 +281,7 @@ static int rna_Nurb_length(PointerRNA *ptr)
static void rna_Nurb_type_set(PointerRNA *ptr, int value)
{
Nurb *nu = (Nurb *)ptr->data;
- ED_nurb_set_spline_type(nu, value);
+ BKE_nurb_type_convert(nu, value, true);
}
static void rna_BPoint_array_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index 02cacb00bec..6649d58d718 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -741,6 +741,8 @@ StructRNA *RNA_def_struct_ptr(BlenderRNA *brna, const char *identifier, StructRN
srna->identifier = identifier;
srna->name = identifier; /* may be overwritten later RNA_def_struct_ui_text */
srna->description = "";
+ /* may be overwritten later RNA_def_struct_translation_context */
+ srna->translation_context = BLF_I18NCONTEXT_DEFAULT_BPYRNA;
srna->flag |= STRUCT_UNDO;
if (!srnafrom)
srna->icon = ICON_DOT;
@@ -984,7 +986,7 @@ void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
void RNA_def_struct_translation_context(StructRNA *srna, const char *context)
{
- srna->translation_context = context;
+ srna->translation_context = context ? context : BLF_I18NCONTEXT_DEFAULT_BPYRNA;
}
/* Property Definition */
@@ -1113,6 +1115,7 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier
prop->subtype = subtype;
prop->name = identifier;
prop->description = "";
+ prop->translation_context = BLF_I18NCONTEXT_DEFAULT_BPYRNA;
/* a priori not raw editable */
prop->rawtype = -1;
@@ -2057,7 +2060,7 @@ void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname,
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
{
- prop->translation_context = context;
+ prop->translation_context = context ? context : BLF_I18NCONTEXT_DEFAULT_BPYRNA;
}
/* Functions */
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index e488bedca8a..aed0e49cf7e 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -1268,12 +1268,12 @@ static int rna_Mesh_tot_face_get(PointerRNA *ptr)
return me->edit_btmesh ? me->edit_btmesh->bm->totfacesel : 0;
}
-static PointerRNA rna_Mesh_vertex_color_new(struct Mesh *me, struct bContext *C, const char *name)
+static PointerRNA rna_Mesh_vertex_color_new(struct Mesh *me, const char *name)
{
PointerRNA ptr;
CustomData *ldata;
CustomDataLayer *cdl = NULL;
- int index = ED_mesh_color_add(C, NULL, NULL, me, name, FALSE);
+ int index = ED_mesh_color_add(me, name, false);
if (index != -1) {
ldata = rna_mesh_ldata_helper(me);
@@ -1284,8 +1284,14 @@ static PointerRNA rna_Mesh_vertex_color_new(struct Mesh *me, struct bContext *C,
return ptr;
}
-static PointerRNA rna_Mesh_tessface_vertex_color_new(struct Mesh *me, struct bContext *C, ReportList *reports,
- const char *name)
+static void rna_Mesh_vertex_color_remove(struct Mesh *me, ReportList *reports, CustomDataLayer *layer)
+{
+ if (ED_mesh_color_remove_named(me, layer->name) == false) {
+ BKE_reportf(reports, RPT_ERROR, "vertex color '%s' not found", layer->name);
+ }
+}
+
+static PointerRNA rna_Mesh_tessface_vertex_color_new(struct Mesh *me, ReportList *reports, const char *name)
{
PointerRNA ptr;
CustomData *fdata;
@@ -1302,7 +1308,7 @@ static PointerRNA rna_Mesh_tessface_vertex_color_new(struct Mesh *me, struct bCo
return PointerRNA_NULL;
}
- index = ED_mesh_color_add(C, NULL, NULL, me, name, FALSE);
+ index = ED_mesh_color_add(me, name, false);
if (index != -1) {
fdata = rna_mesh_fdata_helper(me);
@@ -1358,12 +1364,12 @@ static PointerRNA rna_Mesh_polygon_string_property_new(struct Mesh *me, struct b
return ptr;
}
-static PointerRNA rna_Mesh_uv_texture_new(struct Mesh *me, struct bContext *C, const char *name)
+static PointerRNA rna_Mesh_uv_texture_new(struct Mesh *me, const char *name)
{
PointerRNA ptr;
CustomData *pdata;
CustomDataLayer *cdl = NULL;
- int index = ED_mesh_uv_texture_add(C, me, name, FALSE);
+ int index = ED_mesh_uv_texture_add(me, name, false);
if (index != -1) {
pdata = rna_mesh_pdata_helper(me);
@@ -1374,11 +1380,17 @@ static PointerRNA rna_Mesh_uv_texture_new(struct Mesh *me, struct bContext *C, c
return ptr;
}
+static void rna_Mesh_uv_texture_layers_remove(struct Mesh *me, ReportList *reports, CustomDataLayer *layer)
+{
+ if (ED_mesh_uv_texture_remove_named(me, layer->name) == false) {
+ BKE_reportf(reports, RPT_ERROR, "texture layer '%s' not found", layer->name);
+ }
+}
+
/* while this is supposed to be readonly,
* keep it to support importers that only make tessfaces */
-static PointerRNA rna_Mesh_tessface_uv_texture_new(struct Mesh *me, struct bContext *C, ReportList *reports,
- const char *name)
+static PointerRNA rna_Mesh_tessface_uv_texture_new(struct Mesh *me, ReportList *reports, const char *name)
{
PointerRNA ptr;
CustomData *fdata;
@@ -1395,7 +1407,7 @@ static PointerRNA rna_Mesh_tessface_uv_texture_new(struct Mesh *me, struct bCont
return PointerRNA_NULL;
}
- index = ED_mesh_uv_texture_add(C, me, name, FALSE);
+ index = ED_mesh_uv_texture_add(me, name, false);
if (index != -1) {
fdata = rna_mesh_fdata_helper(me);
@@ -2385,7 +2397,7 @@ static void rna_def_tessface_vertex_colors(BlenderRNA *brna, PropertyRNA *cprop)
/* eventually deprecate this */
func = RNA_def_function(srna, "new", "rna_Mesh_tessface_vertex_color_new");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Add a vertex color layer to Mesh");
RNA_def_string(func, "name", "Col", 0, "", "Vertex color name");
parm = RNA_def_pointer(func, "layer", "MeshColorLayer", "", "The newly created layer");
@@ -2420,21 +2432,18 @@ static void rna_def_loop_colors(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_struct_ui_text(srna, "Loop Colors", "Collection of vertex colors");
func = RNA_def_function(srna, "new", "rna_Mesh_vertex_color_new");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
RNA_def_function_ui_description(func, "Add a vertex color layer to Mesh");
RNA_def_string(func, "name", "Col", 0, "", "Vertex color name");
parm = RNA_def_pointer(func, "layer", "MeshLoopColorLayer", "", "The newly created layer");
RNA_def_property_flag(parm, PROP_RNAPTR);
RNA_def_function_return(func, parm);
-#if 0
func = RNA_def_function(srna, "remove", "rna_Mesh_vertex_color_remove");
RNA_def_function_ui_description(func, "Remove a vertex color layer");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "layer", "Layer", "", "The layer to remove");
- RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+ parm = RNA_def_pointer(func, "layer", "MeshLoopColorLayer", "", "The layer to remove");
+ RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
-#endif
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "MeshLoopColorLayer");
@@ -2561,7 +2570,7 @@ static void rna_def_tessface_uv_textures(BlenderRNA *brna, PropertyRNA *cprop)
/* eventually deprecate this */
func = RNA_def_function(srna, "new", "rna_Mesh_tessface_uv_texture_new");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Add a UV tessface-texture layer to Mesh (only for meshes with no polygons)");
RNA_def_string(func, "name", "UVMap", 0, "", "UV map name");
parm = RNA_def_pointer(func, "layer", "MeshTextureFaceLayer", "", "The newly created layer");
@@ -2598,21 +2607,17 @@ static void rna_def_uv_textures(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_struct_ui_text(srna, "UV Maps", "Collection of UV maps");
func = RNA_def_function(srna, "new", "rna_Mesh_uv_texture_new");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
RNA_def_function_ui_description(func, "Add a UV map layer to Mesh");
RNA_def_string(func, "name", "UVMap", 0, "", "UV map name");
parm = RNA_def_pointer(func, "layer", "MeshTexturePolyLayer", "", "The newly created layer");
RNA_def_property_flag(parm, PROP_RNAPTR);
RNA_def_function_return(func, parm);
-#if 0
func = RNA_def_function(srna, "remove", "rna_Mesh_uv_texture_layers_remove");
RNA_def_function_ui_description(func, "Remove a vertex color layer");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "layer", "Layer", "", "The layer to remove");
- RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
- RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
-#endif
+ parm = RNA_def_pointer(func, "layer", "MeshTexturePolyLayer", "", "The layer to remove");
+ RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "MeshTexturePolyLayer");
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index fa436e30200..185968ded79 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -670,15 +670,6 @@ static void rna_UVProjectModifier_num_projectors_set(PointerRNA *ptr, int value)
md->projectors[a] = NULL;
}
-static int rna_OceanModifier_is_build_enabled_get(PointerRNA *UNUSED(ptr))
-{
-#ifdef WITH_OCEANSIM
- return 1;
-#else /* WITH_OCEANSIM */
- return 0;
-#endif /* WITH_OCEANSIM */
-}
-
static void rna_OceanModifier_init_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
OceanModifierData *omd = (OceanModifierData *)ptr->data;
@@ -3287,12 +3278,6 @@ static void rna_def_modifier_ocean(BlenderRNA *brna)
RNA_def_struct_sdna(srna, "OceanModifierData");
RNA_def_struct_ui_icon(srna, ICON_MOD_OCEAN);
- /* General check if blender was built with OceanSim modifier support */
- prop = RNA_def_property(srna, "is_build_enabled", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_OceanModifier_is_build_enabled_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Build Enabled", "True if the OceanSim modifier is enabled in this build");
-
prop = RNA_def_property(srna, "geometry_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "geometry_mode");
RNA_def_property_enum_items(prop, geometry_items);
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index b558e6d2eeb..d8dd9ff3c33 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -69,15 +69,15 @@ EnumPropertyItem node_socket_in_out_items[] = {
};
EnumPropertyItem node_socket_type_items[] = {
- {SOCK_CUSTOM, "CUSTOM", 0, "Custom", ""},
- {SOCK_FLOAT, "VALUE", 0, "Value", ""},
- {SOCK_INT, "INT", 0, "Int", ""},
- {SOCK_BOOLEAN, "BOOLEAN", 0, "Boolean", ""},
- {SOCK_VECTOR, "VECTOR", 0, "Vector", ""},
- {SOCK_STRING, "STRING", 0, "String", ""},
- {SOCK_RGBA, "RGBA", 0, "RGBA", ""},
- {SOCK_SHADER, "SHADER", 0, "Shader", ""},
- {0, NULL, 0, NULL, NULL}
+ {SOCK_CUSTOM, "CUSTOM", 0, "Custom", ""},
+ {SOCK_FLOAT, "VALUE", 0, "Value", ""},
+ {SOCK_INT, "INT", 0, "Int", ""},
+ {SOCK_BOOLEAN, "BOOLEAN", 0, "Boolean", ""},
+ {SOCK_VECTOR, "VECTOR", 0, "Vector", ""},
+ {SOCK_STRING, "STRING", 0, "String", ""},
+ {SOCK_RGBA, "RGBA", 0, "RGBA", ""},
+ {SOCK_SHADER, "SHADER", 0, "Shader", ""},
+ {0, NULL, 0, NULL, NULL}
};
EnumPropertyItem node_quality_items[] = {
@@ -542,9 +542,6 @@ static void rna_NodeTree_draw_add_menu(const bContext *C, struct uiLayout *layou
ParameterList list;
FunctionRNA *func;
- if (!ntreeIsValid(ntree))
- return;
-
RNA_id_pointer_create(&ntree->id, &ptr);
func = &rna_NodeTree_draw_add_menu_func; /* RNA_struct_find_function(&ptr, "draw_add_menu"); */
@@ -656,6 +653,18 @@ static StructRNA *rna_NodeTree_register(Main *bmain, ReportList *reports, void *
return nt->ext.srna;
}
+static bool rna_NodeTree_check(bNodeTree *ntree, ReportList *reports)
+{
+ if (!ntreeIsRegistered(ntree)) {
+ if (reports)
+ BKE_reportf(reports, RPT_ERROR, "Node tree '%s' has undefined type %s", ntree->id.name + 2, ntree->idname);
+
+ return false;
+ }
+ else
+ return true;
+}
+
static void rna_NodeTree_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
bNodeTree *ntree = (bNodeTree *)ptr->id.data;
@@ -695,10 +704,8 @@ static bNode *rna_NodeTree_node_new(bNodeTree *ntree, bContext *C, ReportList *r
bNodeType *ntype;
bNode *node;
- if (!ntreeIsValid(ntree)) {
- BKE_reportf(reports, RPT_ERROR, "Node tree %s invalid", ntree->id.name + 2);
+ if (!rna_NodeTree_check(ntree, reports))
return NULL;
- }
ntype = nodeTypeFind(type);
if (!ntype) {
@@ -745,10 +752,8 @@ static void rna_NodeTree_node_remove(bNodeTree *ntree, ReportList *reports, Poin
{
bNode *node = node_ptr->data;
- if (!ntreeIsValid(ntree)) {
- BKE_reportf(reports, RPT_ERROR, "Node tree %s invalid", ntree->id.name + 2);
+ if (!rna_NodeTree_check(ntree, reports))
return;
- }
if (BLI_findindex(&ntree->nodes, node) == -1) {
BKE_reportf(reports, RPT_ERROR, "Unable to locate node '%s' in node tree", node->name);
@@ -767,10 +772,8 @@ static void rna_NodeTree_node_clear(bNodeTree *ntree, ReportList *reports)
{
bNode *node = ntree->nodes.first;
- if (!ntreeIsValid(ntree)) {
- BKE_reportf(reports, RPT_ERROR, "Node tree %s invalid", ntree->id.name + 2);
+ if (!rna_NodeTree_check(ntree, reports))
return;
- }
while (node) {
bNode *next_node = node->next;
@@ -800,10 +803,6 @@ static void rna_NodeTree_active_node_set(PointerRNA *ptr, const PointerRNA value
bNodeTree *ntree = (bNodeTree *)ptr->data;
bNode *node = (bNode *)value.data;
- /* activating node might require valid typeinfo */
- if (!ntreeIsValid(ntree))
- return;
-
if (node && BLI_findindex(&ntree->nodes, node) != -1)
nodeSetActive(ntree, node);
else
@@ -817,10 +816,8 @@ static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, ReportList *reports,
bNodeLink *ret;
bNode *fromnode = NULL, *tonode = NULL;
- if (!ntreeIsValid(ntree)) {
- BKE_reportf(reports, RPT_ERROR, "Node tree %s invalid", ntree->id.name + 2);
+ if (!rna_NodeTree_check(ntree, reports))
return NULL;
- }
nodeFindNode(ntree, fromsock, &fromnode, NULL);
nodeFindNode(ntree, tosock, &tonode, NULL);
@@ -832,9 +829,9 @@ static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, ReportList *reports,
if (verify_limits) {
/* remove other socket links if limit is exceeded */
- if (nodeCountSocketLinks(ntree, fromsock) > fromsock->limit)
+ if (nodeCountSocketLinks(ntree, fromsock) + 1 > fromsock->limit)
nodeRemSocketLinks(ntree, fromsock);
- if (nodeCountSocketLinks(ntree, tosock) > tosock->limit)
+ if (nodeCountSocketLinks(ntree, tosock) + 1 > tosock->limit)
nodeRemSocketLinks(ntree, tosock);
}
@@ -855,10 +852,8 @@ static void rna_NodeTree_link_remove(bNodeTree *ntree, ReportList *reports, Poin
{
bNodeLink *link = link_ptr->data;
- if (!ntreeIsValid(ntree)) {
- BKE_reportf(reports, RPT_ERROR, "Node tree %s invalid", ntree->id.name + 2);
+ if (!rna_NodeTree_check(ntree, reports))
return;
- }
if (BLI_findindex(&ntree->links, link) == -1) {
BKE_report(reports, RPT_ERROR, "Unable to locate link in node tree");
@@ -876,10 +871,8 @@ static void rna_NodeTree_link_clear(bNodeTree *ntree, ReportList *reports)
{
bNodeLink *link = ntree->links.first;
- if (!ntreeIsValid(ntree)) {
- BKE_reportf(reports, RPT_ERROR, "Node tree %s invalid", ntree->id.name + 2);
+ if (!rna_NodeTree_check(ntree, reports))
return;
- }
while (link) {
bNodeLink *next_link = link->next;
@@ -971,10 +964,8 @@ static bNodeSocket *rna_NodeTree_inputs_new(bNodeTree *ntree, ReportList *report
{
bNodeSocket *sock;
- if (!ntreeIsValid(ntree)) {
- BKE_reportf(reports, RPT_ERROR, "Node tree %s invalid", ntree->id.name + 2);
+ if (!rna_NodeTree_check(ntree, reports))
return NULL;
- }
sock = ntreeAddSocketInterface(ntree, SOCK_IN, type, name);
@@ -988,10 +979,8 @@ static bNodeSocket *rna_NodeTree_outputs_new(bNodeTree *ntree, ReportList *repor
{
bNodeSocket *sock;
- if (!ntreeIsValid(ntree)) {
- BKE_reportf(reports, RPT_ERROR, "Node tree %s invalid", ntree->id.name + 2);
+ if (!rna_NodeTree_check(ntree, reports))
return NULL;
- }
sock = ntreeAddSocketInterface(ntree, SOCK_OUT, type, name);
@@ -1003,10 +992,8 @@ static bNodeSocket *rna_NodeTree_outputs_new(bNodeTree *ntree, ReportList *repor
static void rna_NodeTree_socket_remove(bNodeTree *ntree, ReportList *reports, bNodeSocket *sock)
{
- if (!ntreeIsValid(ntree)) {
- BKE_reportf(reports, RPT_ERROR, "Node tree %s invalid", ntree->id.name + 2);
+ if (!rna_NodeTree_check(ntree, reports))
return;
- }
if (BLI_findindex(&ntree->inputs, sock) == -1 && BLI_findindex(&ntree->outputs, sock) == -1) {
BKE_reportf(reports, RPT_ERROR, "Unable to locate socket '%s' in node", sock->identifier);
@@ -1023,10 +1010,8 @@ static void rna_NodeTree_inputs_clear(bNodeTree *ntree, ReportList *reports)
{
bNodeSocket *sock, *nextsock;
- if (!ntreeIsValid(ntree)) {
- BKE_reportf(reports, RPT_ERROR, "Node tree %s invalid", ntree->id.name + 2);
+ if (!rna_NodeTree_check(ntree, reports))
return;
- }
for (sock = ntree->inputs.first; sock; sock = nextsock) {
nextsock = sock->next;
@@ -1041,10 +1026,8 @@ static void rna_NodeTree_outputs_clear(bNodeTree *ntree, ReportList *reports)
{
bNodeSocket *sock, *nextsock;
- if (!ntreeIsValid(ntree)) {
- BKE_reportf(reports, RPT_ERROR, "Node tree %s invalid", ntree->id.name + 2);
+ if (!rna_NodeTree_check(ntree, reports))
return;
- }
for (sock = ntree->outputs.first; sock; sock = nextsock) {
nextsock = sock->next;
@@ -1057,9 +1040,6 @@ static void rna_NodeTree_outputs_clear(bNodeTree *ntree, ReportList *reports)
static void rna_NodeTree_interface_update(bNodeTree *ntree, bContext *C)
{
- if (!ntreeIsValid(ntree))
- return;
-
ntree->update |= NTREE_UPDATE_GROUP;
ntreeUpdateTree(ntree);
@@ -2325,7 +2305,7 @@ static void rna_NodeSocketStandard_float_range(PointerRNA *ptr, float *min, floa
static void rna_NodeSocketStandard_int_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
{
bNodeSocket *sock = ptr->data;
- bNodeSocketValueFloat *dval = sock->default_value;
+ bNodeSocketValueInt *dval = sock->default_value;
int subtype = sock->typeinfo->subtype;
*min = (subtype == PROP_UNSIGNED ? 0 : INT_MIN);
@@ -2863,6 +2843,11 @@ static void def_group_output(StructRNA *srna)
RNA_def_property_struct_type(prop, "PropertyGroup");
RNA_def_property_flag(prop, PROP_IDPROPERTY);
RNA_def_property_ui_text(prop, "Interface", "Interface socket data");
+
+ prop = RNA_def_property(srna, "is_active_output", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_DO_OUTPUT);
+ RNA_def_property_ui_text(prop, "Active Output", "True if this node is used as the active group output");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_group(StructRNA *srna)
@@ -6964,11 +6949,6 @@ static void rna_def_composite_nodetree(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Two Pass", "Use two pass execution during editing: first calculate fast nodes, "
"second pass calculate all nodes");
- prop = RNA_def_property(srna, "is_local_tree", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_default(prop, FALSE);
- RNA_def_property_flag(prop, PROP_IDPROPERTY);
- RNA_def_property_ui_text(prop, "Local Scene Tree", "Local scene node tree, eligible for special node types");
-
prop = RNA_def_property(srna, "use_viewer_border", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", NTREE_VIEWER_BORDER);
RNA_def_property_ui_text(prop, "Viewer Border", "Use boundaries for viewer nodes and composite backdrop");
@@ -6978,34 +6958,22 @@ static void rna_def_composite_nodetree(BlenderRNA *brna)
static void rna_def_shader_nodetree(BlenderRNA *brna)
{
StructRNA *srna;
- PropertyRNA *prop;
srna = RNA_def_struct(brna, "ShaderNodeTree", "NodeTree");
RNA_def_struct_ui_text(srna, "Shader Node Tree",
"Node tree consisting of linked nodes used for materials (and other shading datablocks)");
RNA_def_struct_sdna(srna, "bNodeTree");
RNA_def_struct_ui_icon(srna, ICON_MATERIAL);
-
- prop = RNA_def_property(srna, "is_local_tree", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_default(prop, FALSE);
- RNA_def_property_flag(prop, PROP_IDPROPERTY);
- RNA_def_property_ui_text(prop, "Local Material Tree", "Local material node tree, eligible for special node types");
}
static void rna_def_texture_nodetree(BlenderRNA *brna)
{
StructRNA *srna;
- PropertyRNA *prop;
srna = RNA_def_struct(brna, "TextureNodeTree", "NodeTree");
RNA_def_struct_ui_text(srna, "Texture Node Tree", "Node tree consisting of linked nodes used for textures");
RNA_def_struct_sdna(srna, "bNodeTree");
RNA_def_struct_ui_icon(srna, ICON_TEXTURE);
-
- prop = RNA_def_property(srna, "is_local_tree", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_default(prop, FALSE);
- RNA_def_property_flag(prop, PROP_IDPROPERTY);
- RNA_def_property_ui_text(prop, "Local Texture Tree", "Local texture node tree, eligible for special node types");
}
static void define_specific_node(BlenderRNA *brna, const char *struct_name, const char *base_name,
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
index 2b7df1ca317..7715dfa64de 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -76,6 +76,8 @@ static EnumPropertyItem space_items[] = {
#include "BKE_object.h"
#include "BKE_report.h"
+#include "ED_object.h"
+
#include "DNA_curve_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
@@ -393,6 +395,13 @@ void rna_Object_dm_info(struct Object *ob, int type, char *result)
}
#endif /* NDEBUG */
+static int rna_Object_update_from_editmode(Object *ob)
+{
+ if (ob->mode & OB_MODE_EDIT) {
+ return ED_object_editmode_load(ob);
+ }
+ return false;
+}
#else /* RNA_RUNTIME */
void RNA_api_object(StructRNA *srna)
@@ -567,6 +576,11 @@ void RNA_api_object(StructRNA *srna)
RNA_def_property_flag(parm, PROP_THICK_WRAP); /* needed for string return value */
RNA_def_function_output(func, parm);
#endif /* NDEBUG */
+
+ func = RNA_def_function(srna, "update_from_editmode", "rna_Object_update_from_editmode");
+ RNA_def_function_ui_description(func, "Load the objects edit-mode data intp the object data");
+ parm = RNA_def_boolean(func, "result", 0, "", "Success");
+ RNA_def_function_return(func, parm);
}
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index 17b01de1eeb..67fc3056485 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -141,12 +141,12 @@ static int rna_Struct_name_length(PointerRNA *ptr)
static void rna_Struct_translation_context_get(PointerRNA *ptr, char *value)
{
- strcpy(value, ((StructRNA *)ptr->data)->translation_context ? ((StructRNA *)ptr->data)->translation_context : "");
+ strcpy(value, ((StructRNA *)ptr->data)->translation_context);
}
static int rna_Struct_translation_context_length(PointerRNA *ptr)
{
- return ((StructRNA *)ptr->data)->translation_context ? strlen(((StructRNA *)ptr->data)->translation_context) : 0;
+ return strlen(((StructRNA *)ptr->data)->translation_context);
}
static PointerRNA rna_Struct_base_get(PointerRNA *ptr)
@@ -491,14 +491,14 @@ static void rna_Property_translation_context_get(PointerRNA *ptr, char *value)
{
PropertyRNA *prop = (PropertyRNA *)ptr->data;
rna_idproperty_check(&prop, ptr);
- strcpy(value, prop->translation_context ? prop->translation_context : "");
+ strcpy(value, prop->translation_context);
}
static int rna_Property_translation_context_length(PointerRNA *ptr)
{
PropertyRNA *prop = (PropertyRNA *)ptr->data;
rna_idproperty_check(&prop, ptr);
- return prop->translation_context ? strlen(prop->translation_context) : 0;
+ return strlen(prop->translation_context);
}
static int rna_Property_type_get(PointerRNA *ptr)
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 7469aac56ad..ebce22bac79 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -4125,13 +4125,6 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "mode", R_ENVMAP);
RNA_def_property_ui_text(prop, "Environment Maps", "Calculate environment maps while rendering");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
-#if 0
- prop = RNA_def_property(srna, "use_radiosity", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mode", R_RADIO);
- RNA_def_property_ui_text(prop, "Radiosity", "Calculate radiosity in a pre-process before rendering");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-#endif
prop = RNA_def_property(srna, "use_sss", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", R_SSS);
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c
index 05056574a71..9efe3d9f1d6 100644
--- a/source/blender/makesrna/intern/rna_ui.c
+++ b/source/blender/makesrna/intern/rna_ui.c
@@ -199,6 +199,9 @@ static StructRNA *rna_Panel_register(Main *bmain, ReportList *reports, void *dat
dummypanel.type = &dummypt;
RNA_pointer_create(NULL, &RNA_Panel, &dummypanel, &dummyptr);
+ /* We have to set default context! Else we get a void string... */
+ strcpy(dummypt.translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA);
+
/* validate the python class */
if (validate(&dummyptr, data, have_function) != 0)
return NULL;
@@ -544,6 +547,8 @@ static StructRNA *rna_Menu_register(Main *bmain, ReportList *reports, void *data
/* clear in case they are left unset */
_menu_descr[0] = '\0';
+ /* We have to set default context! Else we get a void string... */
+ strcpy(dummymt.translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA);
/* validate the python class */
if (validate(&dummymtr, data, have_function) != 0)
@@ -777,7 +782,7 @@ static void rna_def_panel(BlenderRNA *brna)
RNA_def_struct_sdna(srna, "Panel");
RNA_def_struct_refine_func(srna, "rna_Panel_refine");
RNA_def_struct_register_funcs(srna, "rna_Panel_register", "rna_Panel_unregister", NULL);
- RNA_def_struct_translation_context(srna, BLF_I18NCONTEXT_DEFAULT);
+ RNA_def_struct_translation_context(srna, BLF_I18NCONTEXT_DEFAULT_BPYRNA);
/* poll */
func = RNA_def_function(srna, "poll", NULL);
@@ -827,7 +832,7 @@ static void rna_def_panel(BlenderRNA *brna)
prop = RNA_def_property(srna, "bl_translation_context", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "type->translation_context");
- RNA_def_property_string_default(prop, BLF_I18NCONTEXT_DEFAULT);
+ RNA_def_property_string_default(prop, BLF_I18NCONTEXT_DEFAULT_BPYRNA);
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
RNA_define_verify_sdna(TRUE);
@@ -967,7 +972,7 @@ static void rna_def_menu(BlenderRNA *brna)
RNA_def_struct_sdna(srna, "Menu");
RNA_def_struct_refine_func(srna, "rna_Menu_refine");
RNA_def_struct_register_funcs(srna, "rna_Menu_register", "rna_Menu_unregister", NULL);
- RNA_def_struct_translation_context(srna, BLF_I18NCONTEXT_DEFAULT);
+ RNA_def_struct_translation_context(srna, BLF_I18NCONTEXT_DEFAULT_BPYRNA);
/* poll */
func = RNA_def_function(srna, "poll", NULL);
@@ -1008,7 +1013,7 @@ static void rna_def_menu(BlenderRNA *brna)
prop = RNA_def_property(srna, "bl_translation_context", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "type->translation_context");
- RNA_def_property_string_default(prop, BLF_I18NCONTEXT_DEFAULT);
+ RNA_def_property_string_default(prop, BLF_I18NCONTEXT_DEFAULT_BPYRNA);
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 9e4583b84ee..c9a9cca3147 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -3376,12 +3376,17 @@ static void rna_def_userdef_system(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_translate_tooltips", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "transopts", USER_TR_TOOLTIPS);
- RNA_def_property_ui_text(prop, "Translate Tooltips", "Translate Tooltips");
+ RNA_def_property_ui_text(prop, "Translate Tooltips", "Translate tooltips");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "use_translate_interface", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "transopts", USER_TR_IFACE);
- RNA_def_property_ui_text(prop, "Translate Interface", "Translate Interface");
+ RNA_def_property_ui_text(prop, "Translate Interface", "Translate interface");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop = RNA_def_property(srna, "use_translate_new_dataname", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "transopts", USER_TR_NEWDATANAME);
+ RNA_def_property_ui_text(prop, "Translate New Names", "Translate new data names (when adding/creating some)");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "use_textured_fonts", PROP_BOOLEAN, PROP_NONE);
@@ -3435,7 +3440,8 @@ static void rna_def_userdef_system(BlenderRNA *brna)
prop = RNA_def_property(srna, "prefetch_frames", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "prefetchframes");
- RNA_def_property_range(prop, 0, 500);
+ RNA_def_property_range(prop, 0, INT_MAX);
+ RNA_def_property_ui_range(prop, 0, 500, 1, 0);
RNA_def_property_ui_text(prop, "Prefetch Frames", "Number of frames to render ahead during playback (sequencer only)");
prop = RNA_def_property(srna, "memory_cache_limit", PROP_INT, PROP_NONE);
@@ -3485,13 +3491,6 @@ static void rna_def_userdef_system(BlenderRNA *brna)
/* this isn't essential but nice to check if VBO draws any differently */
RNA_def_property_update(prop, NC_WINDOW, NULL);
-#if 0
- prop = RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflags", USER_DISABLE_AA);
- RNA_def_property_ui_text(prop, "Anti-aliasing",
- "Use anti-aliasing for the 3D view (may impact redraw performance)");
-#endif
-
prop = RNA_def_property(srna, "anisotropic_filter", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "anisotropic_filter");
RNA_def_property_enum_items(prop, anisotropic_items);
diff --git a/source/blender/modifiers/intern/MOD_boolean_util.c b/source/blender/modifiers/intern/MOD_boolean_util.c
index a3d93b5437e..c9a7dc9a73d 100644
--- a/source/blender/modifiers/intern/MOD_boolean_util.c
+++ b/source/blender/modifiers/intern/MOD_boolean_util.c
@@ -76,7 +76,7 @@ static void VertexIt_Destruct(CSG_VertexIteratorDescriptor *iterator)
if (iterator->it) {
/* deallocate memory for iterator */
MEM_freeN(iterator->it);
- iterator->it = 0;
+ iterator->it = NULL;
}
iterator->Done = NULL;
iterator->Fill = NULL;
@@ -127,11 +127,11 @@ static void VertexIt_Construct(CSG_VertexIteratorDescriptor *output, DerivedMesh
{
VertexIt *it;
- if (output == 0) return;
+ if (output == NULL) return;
/* allocate some memory for blender iterator */
it = (VertexIt *)(MEM_mallocN(sizeof(VertexIt), "Boolean_VIt"));
- if (it == 0) {
+ if (it == NULL) {
return;
}
/* assign blender specific variables */
@@ -221,11 +221,11 @@ static void FaceIt_Construct(
CSG_FaceIteratorDescriptor *output, DerivedMesh *dm, int offset, Object *ob)
{
FaceIt *it;
- if (output == 0) return;
+ if (output == NULL) return;
/* allocate some memory for blender iterator */
it = (FaceIt *)(MEM_mallocN(sizeof(FaceIt), "Boolean_FIt"));
- if (it == 0) {
+ if (it == NULL) {
return;
}
/* assign blender specific variables */
diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c
index 808dfbae810..da0758a09d0 100644
--- a/source/blender/modifiers/intern/MOD_cloth.c
+++ b/source/blender/modifiers/intern/MOD_cloth.c
@@ -155,6 +155,7 @@ static void copyData(ModifierData *md, ModifierData *target)
if (clmd->sim_parms->effector_weights)
tclmd->sim_parms->effector_weights = MEM_dupallocN(clmd->sim_parms->effector_weights);
tclmd->coll_parms = MEM_dupallocN(clmd->coll_parms);
+ tclmd->point_cache = BKE_ptcache_add(&tclmd->ptcaches);
tclmd->clothObject = NULL;
}
diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c
index 83c678db7b3..2b29f2afb9a 100644
--- a/source/blender/modifiers/intern/MOD_mirror.c
+++ b/source/blender/modifiers/intern/MOD_mirror.c
@@ -111,7 +111,7 @@ static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd,
MLoop *ml;
MPoly *mp;
float mtx[4][4];
- int i, j;
+ int i;
int a, totshape;
int *vtargetmap = NULL, *vtmap_a = NULL, *vtmap_b = NULL;
@@ -221,7 +221,7 @@ static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd,
ml = CDDM_get_loops(result);
for (i = 0; i < maxPolys; i++, mp++) {
MLoop *ml2;
- int e;
+ int j, e;
/* reverse the loop, but we keep the first vertex in the face the same,
* to ensure that quads are split the same way as on the other side */
@@ -249,8 +249,8 @@ static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd,
/* handle uvs,
* let tessface recalc handle updating the MTFace data */
if (mmd->flag & (MOD_MIR_MIRROR_U | MOD_MIR_MIRROR_V)) {
- const int do_mirr_u = (mmd->flag & MOD_MIR_MIRROR_U) != 0;
- const int do_mirr_v = (mmd->flag & MOD_MIR_MIRROR_V) != 0;
+ const bool do_mirr_u = (mmd->flag & MOD_MIR_MIRROR_U) != 0;
+ const bool do_mirr_v = (mmd->flag & MOD_MIR_MIRROR_V) != 0;
const int totuv = CustomData_number_of_layers(&result->loopData, CD_MLOOPUV);
diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c
index 77250ec4025..338771f7746 100644
--- a/source/blender/modifiers/intern/MOD_ocean.c
+++ b/source/blender/modifiers/intern/MOD_ocean.c
@@ -169,6 +169,7 @@ static void copyData(ModifierData *md, ModifierData *target)
OceanModifierData *omd = (OceanModifierData *) md;
OceanModifierData *tomd = (OceanModifierData *) target;
+ tomd->geometry_mode = omd->geometry_mode;
tomd->resolution = omd->resolution;
tomd->spatial_size = omd->spatial_size;
@@ -191,7 +192,6 @@ static void copyData(ModifierData *md, ModifierData *target)
tomd->refresh = 0;
-
tomd->size = omd->size;
tomd->repeat_x = omd->repeat_x;
tomd->repeat_y = omd->repeat_y;
diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c
index 200e5341868..841dde3302b 100644
--- a/source/blender/nodes/composite/node_composite_tree.c
+++ b/source/blender/nodes/composite/node_composite_tree.c
@@ -162,8 +162,9 @@ static void localize(bNodeTree *localtree, bNodeTree *ntree)
}
}
-static void local_sync(bNodeTree *UNUSED(localtree), bNodeTree *UNUSED(ntree))
+static void local_sync(bNodeTree *localtree, bNodeTree *ntree)
{
+ BKE_node_preview_sync_tree(ntree, localtree);
}
static void local_merge(bNodeTree *localtree, bNodeTree *ntree)
@@ -172,6 +173,8 @@ static void local_merge(bNodeTree *localtree, bNodeTree *ntree)
bNodeSocket *lsock;
/* move over the compbufs and previews */
+ BKE_node_preview_merge_tree(ntree, localtree, true);
+
for (lnode= localtree->nodes.first; lnode; lnode= lnode->next) {
if (ntreeNodeExists(ntree, lnode->new_node)) {
if (ELEM(lnode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
diff --git a/source/blender/nodes/composite/node_composite_util.c b/source/blender/nodes/composite/node_composite_util.c
index 6209ca6aa4f..02a5f410d83 100644
--- a/source/blender/nodes/composite/node_composite_util.c
+++ b/source/blender/nodes/composite/node_composite_util.c
@@ -41,7 +41,7 @@ void cmp_node_update_default(bNodeTree *UNUSED(ntree), bNode *node)
{
bNodeSocket *sock;
for (sock= node->outputs.first; sock; sock= sock->next) {
- if(sock->cache) {
+ if (sock->cache) {
//free_compbuf(sock->cache);
//sock->cache= NULL;
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c
index aa218252472..c09903ad6c5 100644
--- a/source/blender/nodes/composite/nodes/node_composite_image.c
+++ b/source/blender/nodes/composite/nodes/node_composite_image.c
@@ -31,6 +31,9 @@
#include "node_composite_util.h"
+#include "BKE_global.h"
+#include "BKE_main.h"
+
/* **************** IMAGE (and RenderResult, multilayer image) ******************** */
static bNodeSocketTemplate cmp_node_rlayers_out[] = {
@@ -333,11 +336,20 @@ void register_node_type_cmp_image(void)
static int node_composit_poll_rlayers(bNodeType *UNUSED(ntype), bNodeTree *ntree)
{
- PointerRNA ptr;
-
- /* render layers node can only be used in local scene->nodetree, since it directly links to the scene */
- RNA_id_pointer_create((ID *)ntree, &ptr);
- return (strcmp(ntree->idname, "CompositorNodeTree")==0 && RNA_boolean_get(&ptr, "is_local_tree"));
+ if (strcmp(ntree->idname, "CompositorNodeTree")==0) {
+ Scene *scene;
+
+ /* XXX ugly: check if ntree is a local scene node tree.
+ * Render layers node can only be used in local scene->nodetree,
+ * since it directly links to the scene.
+ */
+ for (scene = G.main->scene.first; scene; scene = scene->id.next)
+ if (scene->nodetree == ntree)
+ break;
+
+ return (scene != NULL);
+ }
+ return false;
}
void register_node_type_cmp_rlayers(void)
diff --git a/source/blender/nodes/composite/nodes/node_composite_movieclip.c b/source/blender/nodes/composite/nodes/node_composite_movieclip.c
index 34d7eeb570d..2369bf221e6 100644
--- a/source/blender/nodes/composite/nodes/node_composite_movieclip.c
+++ b/source/blender/nodes/composite/nodes/node_composite_movieclip.c
@@ -35,6 +35,7 @@
static bNodeSocketTemplate cmp_node_movieclip_out[] = {
{ SOCK_RGBA, 0, N_("Image")},
+ { SOCK_FLOAT, 0, N_("Alpha")},
{ SOCK_FLOAT, 1, N_("Offset X")},
{ SOCK_FLOAT, 1, N_("Offset Y")},
{ SOCK_FLOAT, 1, N_("Scale")},
diff --git a/source/blender/nodes/intern/node_exec.c b/source/blender/nodes/intern/node_exec.c
index f6bf1db5254..62a937b106c 100644
--- a/source/blender/nodes/intern/node_exec.c
+++ b/source/blender/nodes/intern/node_exec.c
@@ -47,7 +47,7 @@
/* supported socket types in old nodes */
int node_exec_socket_use_stack(bNodeSocket *sock)
{
- return ELEM3(sock->type, SOCK_FLOAT, SOCK_VECTOR, SOCK_RGBA);
+ return ELEM4(sock->type, SOCK_FLOAT, SOCK_VECTOR, SOCK_RGBA, SOCK_SHADER);
}
/* for a given socket, find the actual stack entry */
@@ -156,8 +156,6 @@ bNodeTreeExec *ntree_exec_begin(bNodeExecContext *context, bNodeTree *ntree, bNo
bNode **nodelist;
int totnodes, n;
- BLI_assert(ntreeIsValid(ntree));
-
/* ensure all sock->link pointers and node levels are correct */
ntreeUpdateTree(ntree);
diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c
index 68846255983..50ef122fe60 100644
--- a/source/blender/nodes/shader/node_shader_tree.c
+++ b/source/blender/nodes/shader/node_shader_tree.c
@@ -80,15 +80,14 @@ static void shader_get_from_context(const bContext *C, bNodeTreeType *UNUSED(tre
if (snode->shaderfrom == SNODE_SHADER_OBJECT) {
if (ob) {
+ *r_from = &ob->id;
if (ob->type == OB_LAMP) {
- *r_from = &ob->id;
*r_id = ob->data;
*r_ntree = ((Lamp *)ob->data)->nodetree;
}
else {
Material *ma = give_current_material(ob, ob->actcol);
if (ma) {
- *r_from = &ob->id;
*r_id = &ma->id;
*r_ntree = ma->nodetree;
}
@@ -138,8 +137,14 @@ static void localize(bNodeTree *localtree, bNodeTree *UNUSED(ntree))
}
}
-static void local_sync(bNodeTree *UNUSED(localtree), bNodeTree *UNUSED(ntree))
+static void local_sync(bNodeTree *localtree, bNodeTree *ntree)
{
+ BKE_node_preview_sync_tree(ntree, localtree);
+}
+
+static void local_merge(bNodeTree *localtree, bNodeTree *ntree)
+{
+ BKE_node_preview_merge_tree(ntree, localtree, true);
}
static void update(bNodeTree *ntree)
@@ -169,6 +174,7 @@ void register_node_tree_type_sh(void)
tt->foreach_nodeclass = foreach_nodeclass;
tt->localize = localize;
tt->local_sync = local_sync;
+ tt->local_merge = local_merge;
tt->update = update;
tt->poll = shader_tree_poll;
tt->get_from_context = shader_get_from_context;
diff --git a/source/blender/nodes/shader/nodes/node_shader_mix_shader.c b/source/blender/nodes/shader/nodes/node_shader_mix_shader.c
index 077fd71d191..f1415dcac1b 100644
--- a/source/blender/nodes/shader/nodes/node_shader_mix_shader.c
+++ b/source/blender/nodes/shader/nodes/node_shader_mix_shader.c
@@ -30,7 +30,7 @@
/* **************** OUTPUT ******************** */
static bNodeSocketTemplate sh_node_mix_shader_in[] = {
- { SOCK_FLOAT, 1, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+ { SOCK_FLOAT, 1, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
{ SOCK_SHADER, 1, N_("Shader")},
{ SOCK_SHADER, 1, N_("Shader")},
{ -1, 0, "" }
diff --git a/source/blender/nodes/shader/nodes/node_shader_value.c b/source/blender/nodes/shader/nodes/node_shader_value.c
index f4aef926f64..642b5061a76 100644
--- a/source/blender/nodes/shader/nodes/node_shader_value.c
+++ b/source/blender/nodes/shader/nodes/node_shader_value.c
@@ -34,7 +34,7 @@
/* **************** VALUE ******************** */
static bNodeSocketTemplate sh_node_value_out[] = {
- { SOCK_FLOAT, 0, N_("Value"), 0.5f, 0, 0, 0, -FLT_MAX, FLT_MAX, PROP_NONE},
+ { SOCK_FLOAT, 0, N_("Value"), 0.5f, 0, 0, 0, -FLT_MAX, FLT_MAX, PROP_NONE},
{ -1, 0, "" }
};
diff --git a/source/blender/nodes/texture/node_texture_tree.c b/source/blender/nodes/texture/node_texture_tree.c
index e1a29a67446..bab8ef0c631 100644
--- a/source/blender/nodes/texture/node_texture_tree.c
+++ b/source/blender/nodes/texture/node_texture_tree.c
@@ -83,11 +83,13 @@ static void texture_get_from_context(const bContext *C, bNodeTreeType *UNUSED(tr
}
}
else if (snode->texfrom == SNODE_TEX_WORLD) {
- tx = give_current_world_texture(scene->world);
- if (tx) {
+ if (scene->world) {
*r_from = (ID *)scene->world;
- *r_id = &tx->id;
- *r_ntree = tx->nodetree;
+ tx = give_current_world_texture(scene->world);
+ if (tx) {
+ *r_id = &tx->id;
+ *r_ntree = tx->nodetree;
+ }
}
}
else {
@@ -138,8 +140,14 @@ static void localize(bNodeTree *localtree, bNodeTree *UNUSED(ntree))
}
}
-static void local_sync(bNodeTree *UNUSED(localtree), bNodeTree *UNUSED(ntree))
+static void local_sync(bNodeTree *localtree, bNodeTree *ntree)
+{
+ BKE_node_preview_sync_tree(ntree, localtree);
+}
+
+static void local_merge(bNodeTree *localtree, bNodeTree *ntree)
{
+ BKE_node_preview_merge_tree(ntree, localtree, true);
}
static void update(bNodeTree *ntree)
@@ -168,6 +176,7 @@ void register_node_tree_type_tex(void)
tt->update = update;
tt->localize = localize;
tt->local_sync = local_sync;
+ tt->local_merge = local_merge;
tt->get_from_context = texture_get_from_context;
tt->ext.srna = &RNA_TextureNodeTree;
diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
index f59676252d4..64435792ae2 100644
--- a/source/blender/python/bmesh/bmesh_py_types_meshdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
@@ -97,7 +97,7 @@ static PyGetSetDef bpy_bmtexpoly_getseters[] = {
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
-PyTypeObject BPy_BMTexPoly_Type = {{{0}}}; /* bm.loops.layers.uv.active */
+static PyTypeObject BPy_BMTexPoly_Type = {{{0}}}; /* bm.loops.layers.uv.active */
static void bm_init_types_bmtexpoly(void)
{
diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c
index c3845cdb07f..775cce3880b 100644
--- a/source/blender/python/intern/bpy.c
+++ b/source/blender/python/intern/bpy.c
@@ -27,8 +27,6 @@
* to access C defined builtin functions.
* A script writer should never directly access this module.
*/
-
-#define WITH_PYTHON /* for AUD_PyInit.h, possibly others */
#include <Python.h>
diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c
index e5180c58d56..17dafc4ac52 100644
--- a/source/blender/python/intern/bpy_app.c
+++ b/source/blender/python/intern/bpy_app.c
@@ -107,9 +107,10 @@ static PyObject *make_app_info(void)
if (app_info == NULL) {
return NULL;
}
-
+#if 0
#define SetIntItem(flag) \
PyStructSequence_SET_ITEM(app_info, pos++, PyLong_FromLong(flag))
+#endif
#define SetStrItem(str) \
PyStructSequence_SET_ITEM(app_info, pos++, PyUnicode_FromString(str))
#define SetBytesItem(str) \
diff --git a/source/blender/python/intern/bpy_app_translations.c b/source/blender/python/intern/bpy_app_translations.c
index 35c39814124..6f042318de2 100644
--- a/source/blender/python/intern/bpy_app_translations.c
+++ b/source/blender/python/intern/bpy_app_translations.c
@@ -74,7 +74,7 @@ typedef struct GHashKey {
static GHashKey *_ghashutil_keyalloc(const void *msgctxt, const void *msgid)
{
GHashKey *key = MEM_mallocN(sizeof(GHashKey), "Py i18n GHashKey");
- key->msgctxt = BLI_strdup(msgctxt ? msgctxt : BLF_I18NCONTEXT_DEFAULT_BPY);
+ key->msgctxt = BLI_strdup(BLF_is_default_context(msgctxt) ? BLF_I18NCONTEXT_DEFAULT_BPYRNA : msgctxt);
key->msgid = BLI_strdup(msgid);
return key;
}
@@ -195,7 +195,7 @@ static void _build_translations_cache(PyObject *py_messages, const char *locale)
else {
PyObject *tmp = PyTuple_GET_ITEM(pykey, 0);
if (tmp == Py_None) {
- msgctxt = BLF_I18NCONTEXT_DEFAULT_BPY;
+ msgctxt = BLF_I18NCONTEXT_DEFAULT_BPYRNA;
}
else if (PyUnicode_Check(tmp)) {
msgctxt = _PyUnicode_AsString(tmp);
@@ -433,7 +433,7 @@ static PyObject *app_translations_contexts_make(void)
PyDoc_STRVAR(app_translations_contexts_doc,
"A named tuple containing all pre-defined translation contexts.\n"
- "WARNING: Never use a (new) context starting with \"" BLF_I18NCONTEXT_DEFAULT_BPY "\", it would be internally "
+ "WARNING: Never use a (new) context starting with \"" BLF_I18NCONTEXT_DEFAULT_BPYRNA "\", it would be internally "
"assimilated as the default one!\n"
);
@@ -441,7 +441,7 @@ PyDoc_STRVAR(app_translations_contexts_C_to_py_doc,
"A readonly dict mapping contexts' C-identifiers to their py-identifiers."
);
-PyMemberDef app_translations_members[] = {
+static PyMemberDef app_translations_members[] = {
{(char *)"contexts", T_OBJECT_EX, offsetof(BlenderAppTranslations, contexts), READONLY,
app_translations_contexts_doc},
{(char *)"contexts_C_to_py", T_OBJECT_EX, offsetof(BlenderAppTranslations, contexts_C_to_py), READONLY,
@@ -486,7 +486,7 @@ static PyObject *app_translations_locales_get(PyObject *UNUSED(self), void *UNUS
return ret;
}
-PyGetSetDef app_translations_getseters[] = {
+static PyGetSetDef app_translations_getseters[] = {
/* {name, getter, setter, doc, userdata} */
{(char *)"locale", (getter)app_translations_locale_get, NULL, app_translations_locale_doc, NULL},
{(char *)"locales", (getter)app_translations_locales_get, NULL, app_translations_locales_doc, NULL},
@@ -570,7 +570,7 @@ static PyObject *app_translations_pgettext_iface(BlenderAppTranslations *UNUSED(
}
PyDoc_STRVAR(app_translations_pgettext_tip_doc,
-".. method:: pgettext(msgid, msgctxt)\n"
+".. method:: pgettext_tip(msgid, msgctxt)\n"
"\n"
" Try to translate the given msgid (with optional msgctxt), if tooltips' translation is enabled.\n"
" NOTE: See pgettext notes.\n"
@@ -588,6 +588,25 @@ static PyObject *app_translations_pgettext_tip(BlenderAppTranslations *UNUSED(se
return _py_pgettext(args, kw, BLF_translate_do_tooltip);
}
+PyDoc_STRVAR(app_translations_pgettext_data_doc,
+".. method:: pgettext_data(msgid, msgctxt)\n"
+"\n"
+" Try to translate the given msgid (with optional msgctxt), if new data name's translation is enabled.\n"
+" NOTE: See pgettext notes.\n"
+"\n"
+" :arg msgid: The string to translate.\n"
+" :type msgid: string\n"
+" :arg msgctxt: The translation context.\n"
+" :type msgctxt: string or None\n"
+" :default msgctxt: BLF_I18NCONTEXT_DEFAULT value.\n"
+" :return: The translated string (or msgid if no translation was found).\n"
+"\n"
+);
+static PyObject *app_translations_pgettext_data(BlenderAppTranslations *UNUSED(self), PyObject *args, PyObject *kw)
+{
+ return _py_pgettext(args, kw, BLF_translate_do_new_dataname);
+}
+
PyDoc_STRVAR(app_translations_locale_explode_doc,
".. method:: locale_explode(locale)\n"
"\n"
@@ -618,20 +637,22 @@ static PyObject *app_translations_locale_explode(BlenderAppTranslations *UNUSED(
return Py_BuildValue("sssss", language, country, variant, language_country, language_variant);
}
-PyMethodDef app_translations_methods[] = {
+static PyMethodDef app_translations_methods[] = {
/* Can't use METH_KEYWORDS alone, see http://bugs.python.org/issue11587 */
- {(char *)"register", (PyCFunction)app_translations_py_messages_register, METH_VARARGS | METH_KEYWORDS,
- app_translations_py_messages_register_doc},
- {(char *)"unregister", (PyCFunction)app_translations_py_messages_unregister, METH_VARARGS | METH_KEYWORDS,
- app_translations_py_messages_unregister_doc},
- {(char *)"pgettext", (PyCFunction)app_translations_pgettext, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
- app_translations_pgettext_doc},
- {(char *)"pgettext_iface", (PyCFunction)app_translations_pgettext_iface, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
- app_translations_pgettext_iface_doc},
- {(char *)"pgettext_tip", (PyCFunction)app_translations_pgettext_tip, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
- app_translations_pgettext_tip_doc},
- {(char *)"locale_explode", (PyCFunction)app_translations_locale_explode, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
- app_translations_locale_explode_doc},
+ {"register", (PyCFunction)app_translations_py_messages_register, METH_VARARGS | METH_KEYWORDS,
+ app_translations_py_messages_register_doc},
+ {"unregister", (PyCFunction)app_translations_py_messages_unregister, METH_VARARGS | METH_KEYWORDS,
+ app_translations_py_messages_unregister_doc},
+ {"pgettext", (PyCFunction)app_translations_pgettext, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
+ app_translations_pgettext_doc},
+ {"pgettext_iface", (PyCFunction)app_translations_pgettext_iface, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
+ app_translations_pgettext_iface_doc},
+ {"pgettext_tip", (PyCFunction)app_translations_pgettext_tip, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
+ app_translations_pgettext_tip_doc},
+ {"pgettext_data", (PyCFunction)app_translations_pgettext_data, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
+ app_translations_pgettext_data_doc},
+ {"locale_explode", (PyCFunction)app_translations_locale_explode, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
+ app_translations_locale_explode_doc},
{NULL}
};
@@ -697,7 +718,7 @@ PyDoc_STRVAR(app_translations_doc,
static PyTypeObject BlenderAppTranslationsType = {
PyVarObject_HEAD_INIT(NULL, 0)
/* tp_name */
- (char *)"bpy.app._translations_type",
+ "bpy.app._translations_type",
/* tp_basicsize */
sizeof(BlenderAppTranslations),
0, /* tp_itemsize */
diff --git a/source/blender/python/intern/bpy_operator_wrap.c b/source/blender/python/intern/bpy_operator_wrap.c
index 1c722243424..65b7bf62032 100644
--- a/source/blender/python/intern/bpy_operator_wrap.c
+++ b/source/blender/python/intern/bpy_operator_wrap.c
@@ -31,11 +31,11 @@
#include <Python.h>
+#include "BLI_utildefines.h"
+
#include "WM_api.h"
#include "WM_types.h"
-#include "BLI_utildefines.h"
-
#include "RNA_access.h"
#include "RNA_define.h"
@@ -45,7 +45,7 @@
static void operator_properties_init(wmOperatorType *ot)
{
- PyObject *py_class = ot->ext.data;
+ PyTypeObject *py_class = ot->ext.data;
RNA_struct_blender_type_set(ot->ext.srna, ot);
/* only call this so pyrna_deferred_register_class gives a useful error
@@ -62,7 +62,6 @@ static void operator_properties_init(wmOperatorType *ot)
{
/* picky developers will notice that 'bl_property' won't work with inheritance
* get direct from the dict to avoid raising a load of attribute errors (yes this isnt ideal) - campbell */
- PyTypeObject *py_class = ot->ext.data;
PyObject *py_class_dict = py_class->tp_dict;
PyObject *bl_property = PyDict_GetItem(py_class_dict, bpy_intern_str_bl_property);
const char *prop_id;
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index ebd38e672da..735df7aeb10 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -4339,7 +4339,7 @@ static int foreach_parse_args(BPy_PropertyRNA *self, PyObject *args,
if (!PySequence_Check(*seq) && PyObject_CheckBuffer(*seq)) {
PyErr_Format(PyExc_TypeError,
"foreach_get/set expected second argument to be a sequence or buffer, not a %.200s",
- Py_TYPE(seq)->tp_name);
+ Py_TYPE(*seq)->tp_name);
return -1;
}
@@ -6823,14 +6823,14 @@ static int pyrna_deferred_register_class_recursive(StructRNA *srna, PyTypeObject
return pyrna_deferred_register_props(srna, py_class->tp_dict); /* getattr(..., "__dict__") returns a proxy */
}
-int pyrna_deferred_register_class(StructRNA *srna, PyObject *py_class)
+int pyrna_deferred_register_class(StructRNA *srna, PyTypeObject *py_class)
{
/* Panels and Menus don't need this
* save some time and skip the checks here */
if (!RNA_struct_idprops_register_check(srna))
return 0;
- return pyrna_deferred_register_class_recursive(srna, (PyTypeObject *)py_class);
+ return pyrna_deferred_register_class_recursive(srna, py_class);
}
/*-------------------- Type Registration ------------------------*/
@@ -7524,7 +7524,7 @@ static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class
*
* item = PyObject_GetAttrString(py_class, "__dict__");
*/
- if (pyrna_deferred_register_class(srna_new, py_class) != 0)
+ if (pyrna_deferred_register_class(srna_new, (PyTypeObject *)py_class) != 0)
return NULL;
/* call classed register method () */
diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h
index 424452ef6fe..f546c2955e5 100644
--- a/source/blender/python/intern/bpy_rna.h
+++ b/source/blender/python/intern/bpy_rna.h
@@ -189,7 +189,7 @@ int pyrna_set_to_enum_bitfield(EnumPropertyItem *items, PyObject *value, int *r_
int pyrna_enum_value_from_id(EnumPropertyItem *item, const char *identifier, int *value, const char *error_prefix);
-int pyrna_deferred_register_class(struct StructRNA *srna, PyObject *py_class);
+int pyrna_deferred_register_class(struct StructRNA *srna, PyTypeObject *py_class);
/* called before stopping python */
void pyrna_alloc_types(void);
diff --git a/source/blender/python/intern/gpu.c b/source/blender/python/intern/gpu.c
index 69fe0c48a41..747390abd0d 100644
--- a/source/blender/python/intern/gpu.c
+++ b/source/blender/python/intern/gpu.c
@@ -131,6 +131,7 @@ static PyObject *PyInit_gpu(void)
PyDict_SetItemString(d, # f, val); \
Py_DECREF(val)
+#if 0 /* UNUSED */
#define PY_OBJ_ADD_ID(d, s, f) \
val = PyUnicode_FromString(&s->f->id.name[2]); \
PyObject_SetAttrString(d, # f, val); \
@@ -145,6 +146,7 @@ static PyObject *PyInit_gpu(void)
val = PyUnicode_FromString(s->f); \
PyObject_SetAttrString(d, # f, val); \
Py_DECREF(val)
+#endif
PyDoc_STRVAR(GPU_export_shader_doc,
"export_shader(scene, material)\n"
diff --git a/source/blender/render/CMakeLists.txt b/source/blender/render/CMakeLists.txt
index f284f80df96..4f1d0d234fc 100644
--- a/source/blender/render/CMakeLists.txt
+++ b/source/blender/render/CMakeLists.txt
@@ -170,7 +170,7 @@ if(WITH_INTERNATIONAL)
endif()
if(APPLE)
- # SSE math is enabled by default on x86_64
+ # SSE math is enabled by default on x86_64
if(CMAKE_OSX_ARCHITECTURES MATCHES "i386")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -mfpmath=sse")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mfpmath=sse")
diff --git a/source/blender/render/extern/include/RE_engine.h b/source/blender/render/extern/include/RE_engine.h
index 5df860750fc..cb35b0045f7 100644
--- a/source/blender/render/extern/include/RE_engine.h
+++ b/source/blender/render/extern/include/RE_engine.h
@@ -108,7 +108,7 @@ typedef struct RenderEngine {
} RenderEngine;
RenderEngine *RE_engine_create(RenderEngineType *type);
-RenderEngine *RE_engine_create_ex(RenderEngineType *type, int use_for_viewport);
+RenderEngine *RE_engine_create_ex(RenderEngineType *type, bool use_for_viewport);
void RE_engine_free(RenderEngine *engine);
void RE_layer_load_from_file(struct RenderLayer *layer, struct ReportList *reports, const char *filename, int x, int y);
diff --git a/source/blender/render/intern/source/external_engine.c b/source/blender/render/intern/source/external_engine.c
index 4a48b6cc5f4..90528fddc85 100644
--- a/source/blender/render/intern/source/external_engine.c
+++ b/source/blender/render/intern/source/external_engine.c
@@ -132,7 +132,7 @@ RenderEngine *RE_engine_create(RenderEngineType *type)
return RE_engine_create_ex(type, FALSE);
}
-RenderEngine *RE_engine_create_ex(RenderEngineType *type, int use_for_viewport)
+RenderEngine *RE_engine_create_ex(RenderEngineType *type, bool use_for_viewport)
{
RenderEngine *engine = MEM_callocN(sizeof(RenderEngine), "RenderEngine");
engine->type = type;
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index 4cb1297798e..721bfa01a92 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -882,7 +882,7 @@ static void *do_render_thread(void *thread_v)
do_part_thread(pa);
BLI_thread_queue_push(thread->donequeue, pa);
- if(R.test_break(R.tbh))
+ if (R.test_break(R.tbh))
break;
}
diff --git a/source/blender/render/intern/source/render_result.c b/source/blender/render/intern/source/render_result.c
index 10c83d19c4b..751d141a8be 100644
--- a/source/blender/render/intern/source/render_result.c
+++ b/source/blender/render/intern/source/render_result.c
@@ -1094,7 +1094,7 @@ ImBuf *render_result_rect_to_ibuf(RenderResult *rr, RenderData *rd)
if (BKE_imtype_valid_depths(rd->im_format.imtype) & (R_IMF_CHAN_DEPTH_12 | R_IMF_CHAN_DEPTH_16 | R_IMF_CHAN_DEPTH_24 | R_IMF_CHAN_DEPTH_32)) {
IMB_float_from_rect(ibuf);
}
- else {
+ else {
/* ensure no float buffer remained from previous frame */
ibuf->rect_float = NULL;
}
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 4cac73b4cf6..2fd80d17bb7 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -234,9 +234,9 @@ void WM_operator_properties_free(struct PointerRNA *ptr);
void WM_operator_properties_filesel(struct wmOperatorType *ot, int filter, short type, short action, short flag, short display);
void WM_operator_properties_border(struct wmOperatorType *ot);
void WM_operator_properties_border_to_rcti(struct wmOperator *op, struct rcti *rect);
-void WM_operator_properties_gesture_border(struct wmOperatorType *ot, int extend);
+void WM_operator_properties_gesture_border(struct wmOperatorType *ot, bool extend);
void WM_operator_properties_mouse_select(struct wmOperatorType *ot);
-void WM_operator_properties_gesture_straightline(struct wmOperatorType *ot, int cursor);
+void WM_operator_properties_gesture_straightline(struct wmOperatorType *ot, bool cursor);
void WM_operator_properties_select_all(struct wmOperatorType *ot);
int WM_operator_check_ui_enabled(const struct bContext *C, const char *idname);
@@ -356,6 +356,7 @@ enum {
WM_JOB_TYPE_CLIP_BUILD_PROXY,
WM_JOB_TYPE_CLIP_TRACK_MARKERS,
WM_JOB_TYPE_CLIP_SOLVE_CAMERA,
+ WM_JOB_TYPE_CLIP_PREFETCH,
WM_JOB_TYPE_SEQ_BUILD_PROXY,
/* add as needed, screencast, seq proxy build
* if having hard coded values is a problem */
@@ -385,6 +386,7 @@ void WM_jobs_kill_all_except(struct wmWindowManager *wm, void *owner);
void WM_jobs_kill_type(struct wmWindowManager *wm, int job_type);
int WM_jobs_has_running(struct wmWindowManager *wm);
+int WM_jobs_has_running_except(struct wmWindowManager *wm, int job_type);
/* clipboard */
char *WM_clipboard_text_get(int selection);
diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c
index 794bfdde114..2e15d6158e8 100644
--- a/source/blender/windowmanager/intern/wm_cursors.c
+++ b/source/blender/windowmanager/intern/wm_cursors.c
@@ -35,6 +35,8 @@
#include "GHOST_C-api.h"
+#include "BLI_utildefines.h"
+
#include "BLO_sys_types.h"
#include "DNA_listBase.h"
@@ -44,8 +46,8 @@
#include "BKE_global.h"
#include "BKE_main.h"
-#include "WM_api.h"
#include "WM_types.h"
+#include "WM_api.h"
#include "wm_cursors.h"
/* XXX this still is mess from old code */
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 66f6dc7de92..7152adb4a11 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -829,8 +829,8 @@ int wm_file_write(bContext *C, const char *target, int fileflags, ReportList *re
if (G.fileflags & G_AUTOPACK) {
packAll(G.main, reports);
}
-
- ED_object_exit_editmode(C, EM_DO_UNDO);
+
+ ED_object_editmode_load(CTX_data_edit_object(C));
ED_sculpt_force_update(C);
/* don't forget not to return without! */
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index d908a33c706..532404cf218 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -125,7 +125,7 @@ static void wm_free_reports(bContext *C)
BKE_reports_clear(CTX_wm_reports(C));
}
-int wm_start_with_console = 0; /* used in creator.c */
+bool wm_start_with_console = false; /* used in creator.c */
/* only called once, for startup */
void WM_init(bContext *C, int argc, const char **argv)
diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c
index c637b77738e..e5963840261 100644
--- a/source/blender/windowmanager/intern/wm_jobs.c
+++ b/source/blender/windowmanager/intern/wm_jobs.c
@@ -591,3 +591,16 @@ int WM_jobs_has_running(wmWindowManager *wm)
return FALSE;
}
+
+int WM_jobs_has_running_except(wmWindowManager *wm, int job_type)
+{
+ wmJob *wm_job;
+
+ for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next) {
+ if (wm_job->running && wm_job->job_type != job_type) {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 530d3bd90c1..b27f014ccb3 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1183,7 +1183,7 @@ void WM_operator_properties_border_to_rcti(struct wmOperator *op, rcti *rect)
rect->ymax = RNA_int_get(op->ptr, "ymax");
}
-void WM_operator_properties_gesture_border(wmOperatorType *ot, int extend)
+void WM_operator_properties_gesture_border(wmOperatorType *ot, bool extend)
{
RNA_def_int(ot->srna, "gesture_mode", 0, INT_MIN, INT_MAX, "Gesture Mode", "", INT_MIN, INT_MAX);
@@ -1201,7 +1201,7 @@ void WM_operator_properties_mouse_select(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "toggle", 0, "Toggle Selection", "Toggle the selection");
}
-void WM_operator_properties_gesture_straightline(wmOperatorType *ot, int cursor)
+void WM_operator_properties_gesture_straightline(wmOperatorType *ot, bool cursor)
{
RNA_def_int(ot->srna, "xstart", 0, INT_MIN, INT_MAX, "X Start", "", INT_MIN, INT_MAX);
RNA_def_int(ot->srna, "xend", 0, INT_MIN, INT_MAX, "X End", "", INT_MIN, INT_MAX);
@@ -3542,7 +3542,7 @@ static int radial_control_get_properties(bContext *C, wmOperator *op)
{
RadialControl *rc = op->customdata;
PointerRNA ctx_ptr, use_secondary_ptr;
- PropertyRNA *use_secondary_prop;
+ PropertyRNA *use_secondary_prop = NULL;
const char *data_path;
RNA_pointer_create(NULL, &RNA_Context, C, &ctx_ptr);
diff --git a/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt b/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt
index 702210d1c5f..e8e7ee6ea0a 100644
--- a/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt
+++ b/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt
@@ -29,6 +29,7 @@ remove_strict_flags()
set(INC
.
..
+ ../../blender/blenlib
../../blender/blenkernel
../../blender/blenloader
../../blender/makesdna
diff --git a/source/blenderplayer/bad_level_call_stubs/SConscript b/source/blenderplayer/bad_level_call_stubs/SConscript
index 41c84051fdf..2dbb0e00eb0 100644
--- a/source/blenderplayer/bad_level_call_stubs/SConscript
+++ b/source/blenderplayer/bad_level_call_stubs/SConscript
@@ -27,21 +27,22 @@
Import ('env')
-sources = 'stubs.c'
+sources = ['stubs.c']
-incs = '#/intern/guardedalloc'
-incs += ' #/source/blender/makesdna'
-incs += ' #/source/blender/makesrna'
-incs += ' #/source/blender/blenloader'
+incs = [
+ '#/intern/guardedalloc',
+ '#/source/blender/makesdna',
+ '#/source/blender/makesrna',
+ '#/source/blender/blenloader',
+ '#/source/blender/blenlib',
+ ]
-defs = ''
-if env['WITH_BF_INTERNATIONAL']:
- defs += 'WITH_FREETYPE2'
+defs = []
if env['WITH_BF_GAMEENGINE']:
- defs += ' WITH_GAMEENGINE'
+ defs.append('WITH_GAMEENGINE')
if env['WITH_BF_FREESTYLE']:
- defs += ' WITH_FREESTYLE'
+ defs.append(' WITH_FREESTYLE')
-env.BlenderLib ('blenkernel_blc', sources = Split(sources), includes=Split(incs), defines=Split(defs), libtype=['player'],priority=[220] )
+env.BlenderLib('blenkernel_blc', sources=sources, includes=incs, defines=defs, libtype=['player'], priority=[220])
diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c
index fb877bda694..6004eb57000 100644
--- a/source/blenderplayer/bad_level_call_stubs/stubs.c
+++ b/source/blenderplayer/bad_level_call_stubs/stubs.c
@@ -34,6 +34,7 @@
#ifdef WITH_GAMEENGINE
#include <stdlib.h>
#include "DNA_listBase.h"
+#include "BLI_utildefines.h"
#include "RNA_types.h"
struct ARegion;
@@ -345,8 +346,9 @@ void ED_base_object_select(struct Base *base, short mode) {}
int ED_object_modifier_remove(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct ModifierData *md) {return 0;}
int ED_object_modifier_add(struct ReportList *reports, struct Scene *scene, struct Object *ob, char *name, int type) {return 0;}
void ED_object_modifier_clear(struct Main *bmain, struct Object *ob) {}
-void ED_object_enter_editmode(struct bContext *C, int flag) {}
-void ED_object_exit_editmode(struct bContext *C, int flag) {}
+void ED_object_editmode_enter(struct bContext *C, int flag) {}
+void ED_object_editmode_exit(struct bContext *C, int flag) {}
+bool ED_object_editmode_load(struct Object *obedit) { return false; }
int uiLayoutGetActive(struct uiLayout *layout) {return 0;}
int uiLayoutGetOperatorContext(struct uiLayout *layout) {return 0;}
int uiLayoutGetAlignment(struct uiLayout *layout) {return 0;}
@@ -375,8 +377,10 @@ void ED_mesh_vertices_remove(struct Mesh *mesh, struct ReportList *reports, int
void ED_mesh_edges_remove(struct Mesh *mesh, struct ReportList *reports, int count) {}
void ED_mesh_faces_remove(struct Mesh *mesh, struct ReportList *reports, int count) {}
void ED_mesh_material_link(struct Mesh *mesh, struct Material *ma) {}
-int ED_mesh_color_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me) {return 0;}
-int ED_mesh_uv_texture_add(struct bContext *C, struct Mesh *me) {return 0;}
+int ED_mesh_color_add(struct Mesh *me, const char *name, const bool active_set) { return -1; }
+int ED_mesh_uv_texture_add(struct Mesh *me, const char *name, const bool active_set) { return -1; }
+bool ED_mesh_color_remove_named(struct Mesh *me, const char *name) { return false; }
+bool ED_mesh_uv_texture_remove_named(struct Mesh *me, const char *name) { return false; }
void ED_object_constraint_dependency_update(struct Scene *scene, struct Object *ob) {}
void ED_object_constraint_update(struct Object *ob) {}
struct bDeformGroup *ED_vgroup_add_name(struct Object *ob, char *name) {return (struct bDeformGroup *) NULL;}
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index 551579dcf65..141eb04727a 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -486,7 +486,7 @@ elseif(WIN32)
if(WITH_PYTHON)
set_lib_path(PYLIB "python")
- STRING(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
+ string(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
install(
FILES ${PYLIB}/lib/python${_PYTHON_VERSION_NO_DOTS}.dll
diff --git a/source/creator/creator.c b/source/creator/creator.c
index 57915770d47..7abb653e9b8 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -84,6 +84,7 @@
#include "BLI_blenlib.h"
#include "BKE_blender.h"
+#include "BKE_brush.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h" /* for DAG_on_visible_update */
#include "BKE_font.h"
@@ -675,10 +676,10 @@ static int without_borders(int UNUSED(argc), const char **UNUSED(argv), void *UN
return 0;
}
-extern int wm_start_with_console; /* wm_init_exit.c */
+extern bool wm_start_with_console; /* wm_init_exit.c */
static int start_with_console(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
{
- wm_start_with_console = 1;
+ wm_start_with_console = true;
return 0;
}
@@ -1495,6 +1496,8 @@ int main(int argc, const char **argv)
IMB_init();
BKE_images_init();
+ BKE_brush_system_init();
+
#ifdef WITH_FFMPEG
IMB_ffmpeg_init();
#endif
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index 6262f8e48ce..c5dea5d0b43 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -426,63 +426,74 @@ static void SetDefaultLightMode(Scene* scene)
}
+static bool GetMaterialUseVColor(Material *ma, const bool glslmat)
+{
+ if (ma) {
+ /* glsl uses vertex colors, otherwise use material setting
+ * defmaterial doesn't have VERTEXCOLP as default [#34505] */
+ return (glslmat || ma == &defmaterial || (ma->mode & MA_VERTEXCOLP) != 0);
+ }
+ else {
+ /* no material, use vertex colors */
+ return true;
+ }
+}
+
// --
-static void GetRGB(short type,
- MFace* mface,
- MCol* mmcol,
- Material *mat,
- unsigned int c[4])
+static void GetRGB(
+ const bool use_vcol,
+ MFace* mface,
+ MCol* mmcol,
+ Material *mat,
+ unsigned int c[4])
{
unsigned int color = 0xFFFFFFFFL;
- switch (type) {
- case 0: // vertex colors
- {
- if (mmcol) {
- c[0] = KX_Mcol2uint_new(mmcol[0]);
- c[1] = KX_Mcol2uint_new(mmcol[1]);
- c[2] = KX_Mcol2uint_new(mmcol[2]);
- if (mface->v4)
- c[3] = KX_Mcol2uint_new(mmcol[3]);
- }
- else { // backup white
- c[0] = KX_rgbaint2uint_new(color);
- c[1] = KX_rgbaint2uint_new(color);
- c[2] = KX_rgbaint2uint_new(color);
- if (mface->v4)
- c[3] = KX_rgbaint2uint_new( color );
- }
- } break;
-
-
- case 1: // material rgba
- {
- if (mat) {
- union {
- unsigned char cp[4];
- unsigned int integer;
- } col_converter;
- col_converter.cp[3] = (unsigned char) (mat->r * 255.0f);
- col_converter.cp[2] = (unsigned char) (mat->g * 255.0f);
- col_converter.cp[1] = (unsigned char) (mat->b * 255.0f);
- col_converter.cp[0] = (unsigned char) (mat->alpha * 255.0f);
- color = col_converter.integer;
- }
- c[0] = KX_rgbaint2uint_new(color);
- c[1] = KX_rgbaint2uint_new(color);
- c[2] = KX_rgbaint2uint_new(color);
+ if (use_vcol == true) {
+ if (mmcol) {
+ c[0] = KX_Mcol2uint_new(mmcol[0]);
+ c[1] = KX_Mcol2uint_new(mmcol[1]);
+ c[2] = KX_Mcol2uint_new(mmcol[2]);
if (mface->v4)
- c[3] = KX_rgbaint2uint_new(color);
- } break;
-
- default: // white
- {
+ c[3] = KX_Mcol2uint_new(mmcol[3]);
+ }
+ else { // backup white
c[0] = KX_rgbaint2uint_new(color);
c[1] = KX_rgbaint2uint_new(color);
c[2] = KX_rgbaint2uint_new(color);
if (mface->v4)
- c[3] = KX_rgbaint2uint_new(color);
- } break;
+ c[3] = KX_rgbaint2uint_new( color );
+ }
+ }
+ else {
+ /* material rgba */
+ if (mat) {
+ union {
+ unsigned char cp[4];
+ unsigned int integer;
+ } col_converter;
+ col_converter.cp[3] = (unsigned char) (mat->r * 255.0f);
+ col_converter.cp[2] = (unsigned char) (mat->g * 255.0f);
+ col_converter.cp[1] = (unsigned char) (mat->b * 255.0f);
+ col_converter.cp[0] = (unsigned char) (mat->alpha * 255.0f);
+ color = col_converter.integer;
+ }
+ c[0] = KX_rgbaint2uint_new(color);
+ c[1] = KX_rgbaint2uint_new(color);
+ c[2] = KX_rgbaint2uint_new(color);
+ if (mface->v4) {
+ c[3] = KX_rgbaint2uint_new(color);
+ }
}
+
+#if 0 /* white, unused */
+ {
+ c[0] = KX_rgbaint2uint_new(color);
+ c[1] = KX_rgbaint2uint_new(color);
+ c[2] = KX_rgbaint2uint_new(color);
+ if (mface->v4)
+ c[3] = KX_rgbaint2uint_new(color);
+ }
+#endif
}
typedef struct MTF_localLayer {
@@ -570,24 +581,17 @@ static bool ConvertMaterial(
{
material->Initialize();
int texalpha = 0;
- bool validmat = (mat!=0);
- bool validface = (tface!=0);
-
- short type = 0;
- if ( validmat )
- type = 1; // material color
+ const bool validmat = (mat != NULL);
+ const bool validface = (tface != NULL);
+ const bool use_vcol = GetMaterialUseVColor(mat, glslmat);
material->IdMode = DEFAULT_BLENDER;
- material->glslmat = (validmat)? glslmat: false;
+ material->glslmat = (validmat) ? glslmat: false;
material->materialindex = mface->mat_nr;
// --------------------------------
if (validmat) {
- // use vertex colors by explicitly setting
- if (mat->mode &MA_VERTEXCOLP || glslmat)
- type = 0;
-
// use lighting?
material->ras_mode |= ( mat->mode & MA_SHLESS )?0:USE_LIGHT;
material->ras_mode |= ( mat->game.flag & GEMAT_BACKCULL )?0:TWOSIDED;
@@ -859,10 +863,10 @@ static bool ConvertMaterial(
// XXX The RGB values here were meant to be temporary storage for the conversion process,
// but fonts now make use of them too, so we leave them in for now.
unsigned int rgb[4];
- GetRGB(type,mface,mmcol,mat,rgb);
+ GetRGB(use_vcol, mface, mmcol, mat, rgb);
// swap the material color, so MCol on bitmap font works
- if (validmat && type==1 && (mat->game.flag & GEMAT_TEXT))
+ if (validmat && (use_vcol == false) && (mat->game.flag & GEMAT_TEXT))
{
rgb[0] = KX_rgbaint2uint_new(rgb[0]);
rgb[1] = KX_rgbaint2uint_new(rgb[1]);
@@ -904,9 +908,8 @@ static RAS_MaterialBucket *material_from_mesh(Material *ma, MFace *mface, MTFace
converter->CacheBlenderMaterial(ma, bl_mat);
}
-
- short type = (ma) ? ((ma->mode & MA_VERTEXCOLP || bl_mat->glslmat) ? 0 : 1) : 0;
- GetRGB(type,mface,mcol,ma,rgb);
+ const bool use_vcol = GetMaterialUseVColor(ma, bl_mat->glslmat);
+ GetRGB(use_vcol, mface, mcol, ma, rgb);
GetUVs(bl_mat, layers, mface, tface, uvs);
@@ -1021,9 +1024,9 @@ static RAS_MaterialBucket *material_from_mesh(Material *ma, MFace *mface, MTFace
}
// only zsort alpha + add
- bool alpha = ELEM3(alpha_blend, GEMAT_ALPHA, GEMAT_ADD, GEMAT_ALPHA_SORT);
- bool zsort = (alpha_blend == GEMAT_ALPHA_SORT);
- bool light = (ma)?(ma->mode & MA_SHLESS)==0:default_light_mode;
+ const bool alpha = ELEM3(alpha_blend, GEMAT_ALPHA, GEMAT_ADD, GEMAT_ALPHA_SORT);
+ const bool zsort = (alpha_blend == GEMAT_ALPHA_SORT);
+ const bool light = (ma)?(ma->mode & MA_SHLESS)==0:default_light_mode;
// don't need zort anymore, deal as if it it's alpha blend
if (alpha_blend == GEMAT_ALPHA_SORT) alpha_blend = GEMAT_ALPHA;
@@ -1137,6 +1140,11 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene,
tan[i].setValue(zero_vec);
}
+ /* we need to manually initialize the uvs (MoTo doesn't do that) [#34550] */
+ for (unsigned int i = 0; i < RAS_TexVert::MAX_UNIT; i++) {
+ uvs[0][i] = uvs[1][i] = uvs[2][i] = uvs[3][i] = MT_Point2(0.f, 0.f);
+ }
+
for (int f=0;f<totface;f++,mface++)
{
/* get coordinates, normals and tangents */
diff --git a/source/gameengine/Converter/BL_ModifierDeformer.cpp b/source/gameengine/Converter/BL_ModifierDeformer.cpp
index 53755deefe1..ec52eaac637 100644
--- a/source/gameengine/Converter/BL_ModifierDeformer.cpp
+++ b/source/gameengine/Converter/BL_ModifierDeformer.cpp
@@ -67,10 +67,6 @@ extern "C"{
#include "BLI_blenlib.h"
#include "BLI_math.h"
-#define __NLA_DEFNORMALS
-//#undef __NLA_DEFNORMALS
-
-
BL_ModifierDeformer::~BL_ModifierDeformer()
{
if (m_dm) {
diff --git a/source/gameengine/Expressions/Value.cpp b/source/gameengine/Expressions/Value.cpp
index bcfb7e92d71..706cfc13ca3 100644
--- a/source/gameengine/Expressions/Value.cpp
+++ b/source/gameengine/Expressions/Value.cpp
@@ -18,6 +18,7 @@
*
*/
#include "Value.h"
+#include "BoolValue.h"
#include "FloatValue.h"
#include "IntValue.h"
#include "VectorValue.h"
@@ -573,6 +574,11 @@ CValue* CValue::ConvertPythonToValue(PyObject *pyobj, const char *error_prefix)
} else
#endif
+ /* note: Boolean check should go before Int check [#34677] */
+ if (PyBool_Check(pyobj))
+ {
+ vallie = new CBoolValue( (bool)PyLong_AsLongLong(pyobj) );
+ } else
if (PyFloat_Check(pyobj))
{
vallie = new CFloatValue( (float)PyFloat_AsDouble(pyobj) );
diff --git a/source/gameengine/Ketsji/KX_CameraActuator.cpp b/source/gameengine/Ketsji/KX_CameraActuator.cpp
index 792a0759b59..acf30b4866c 100644
--- a/source/gameengine/Ketsji/KX_CameraActuator.cpp
+++ b/source/gameengine/Ketsji/KX_CameraActuator.cpp
@@ -36,7 +36,6 @@
#include "BLI_math_vector.h"
#include "KX_CameraActuator.h"
-#include <iostream>
#include <math.h>
#include <float.h>
#include "KX_GameObject.h"
@@ -197,7 +196,7 @@ bool KX_CameraActuator::Update(double curtime, bool frame)
MT_Point3 lookat = ((KX_GameObject*)m_ob)->NodeGetWorldPosition();
MT_Matrix3x3 actormat = ((KX_GameObject*)m_ob)->NodeGetWorldOrientation();
- float fp1[3], fp2[3], rc[3];
+ float fp1[3]={0}, fp2[3]={0}, rc[3];
float inp, fac; //, factor = 0.0; /* some factor... */
float mindistsq, maxdistsq, distsq;
float mat[3][3];
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
index 23419f11cd5..fab19008b25 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
@@ -184,7 +184,10 @@ KX_KetsjiEngine::KX_KetsjiEngine(KX_ISystem* system)
for (int i = tc_first; i < tc_numCategories; i++)
m_logger->AddCategory((KX_TimeCategory)i);
-
+
+#ifdef WITH_PYTHON
+ m_pyprofiledict = PyDict_New();
+#endif
}
@@ -197,6 +200,10 @@ KX_KetsjiEngine::~KX_KetsjiEngine()
delete m_logger;
if (m_usedome)
delete m_dome;
+
+#ifdef WITH_PYTHON
+ Py_CLEAR(m_pyprofiledict);
+#endif
}
@@ -256,6 +263,12 @@ void KX_KetsjiEngine::SetPyNamespace(PyObject *pythondictionary)
MT_assert(pythondictionary);
m_pythondictionary = pythondictionary;
}
+
+PyObject* KX_KetsjiEngine::GetPyProfileDict()
+{
+ Py_INCREF(m_pyprofiledict);
+ return m_pyprofiledict;
+}
#endif
@@ -297,7 +310,7 @@ void KX_KetsjiEngine::RenderDome()
return;
KX_SceneList::iterator sceneit;
- KX_Scene* scene;
+ KX_Scene* scene = NULL;
int n_renders=m_dome->GetNumberRenders();// usually 4 or 6
for (int i=0;i<n_renders;i++) {
@@ -1513,6 +1526,15 @@ void KX_KetsjiEngine::RenderDebugProperties()
m_rendertools->RenderBox2D(xcoord + (int)(2.2 * profile_indent), ycoord, m_canvas->GetWidth(), m_canvas->GetHeight(), time/tottime);
ycoord += const_ysize;
+
+#ifdef WITH_PYTHON
+ PyObject *val = PyTuple_New(2);
+ PyTuple_SetItem(val, 0, PyFloat_FromDouble(time*1000.f));
+ PyTuple_SetItem(val, 1, PyFloat_FromDouble(time/tottime * 100.f));
+
+ PyDict_SetItemString(m_pyprofiledict, m_profileLabels[j], val);
+ Py_DECREF(val);
+#endif
}
}
// Add the ymargin for titles below the other section of debug info
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.h b/source/gameengine/Ketsji/KX_KetsjiEngine.h
index 92ffaf47aa4..fdfe0551d18 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.h
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.h
@@ -81,6 +81,7 @@ private:
#ifdef WITH_PYTHON
/* borrowed from sys.modules["__main__"], don't manage ref's */
PyObject* m_pythondictionary;
+ PyObject* m_pyprofiledict;
#endif
class SCA_IInputDevice* m_keyboarddevice;
class SCA_IInputDevice* m_mousedevice;
@@ -222,6 +223,7 @@ public:
#ifdef WITH_PYTHON
void SetPyNamespace(PyObject *pythondictionary);
PyObject* GetPyNamespace() { return m_pythondictionary; }
+ PyObject* GetPyProfileDict();
#endif
void SetSceneConverter(KX_ISceneConverter* sceneconverter);
void SetAnimRecordMode(bool animation_record, int startFrame);
diff --git a/source/gameengine/Ketsji/KX_NavMeshObject.cpp b/source/gameengine/Ketsji/KX_NavMeshObject.cpp
index 33656e9fd52..24400398f03 100644
--- a/source/gameengine/Ketsji/KX_NavMeshObject.cpp
+++ b/source/gameengine/Ketsji/KX_NavMeshObject.cpp
@@ -96,7 +96,7 @@ CValue* KX_NavMeshObject::GetReplica()
void KX_NavMeshObject::ProcessReplica()
{
KX_GameObject::ProcessReplica();
-
+ m_navMesh = NULL; /* without this, building frees the navmesh we copied from */
BuildNavMesh();
KX_Scene* scene = KX_GetActiveScene();
KX_ObstacleSimulation* obssimulation = scene->GetObstacleSimulation();
diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.cpp b/source/gameengine/Ketsji/KX_ObjectActuator.cpp
index b4ee339568c..d02554e185e 100644
--- a/source/gameengine/Ketsji/KX_ObjectActuator.cpp
+++ b/source/gameengine/Ketsji/KX_ObjectActuator.cpp
@@ -215,8 +215,8 @@ bool KX_ObjectActuator::Update()
m_previous_error = e;
m_error_accumulator = I;
parent->ApplyForce(m_force,(m_bitLocalFlag.LinearVelocity) != 0);
- } else if(m_bitLocalFlag.CharacterMotion)
- {
+ }
+ else if (m_bitLocalFlag.CharacterMotion) {
MT_Vector3 dir = m_dloc;
if (m_bitLocalFlag.AddOrSetCharLoc) {
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index 66333a061c5..06abc755a9a 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -371,6 +371,15 @@ static PyObject *gPyLoadGlobalDict(PyObject *)
Py_RETURN_NONE;
}
+static char gPyGetProfileInfo_doc[] =
+"getProfileInfo()\n"
+"returns a dictionary with profiling information";
+
+static PyObject *gPyGetProfileInfo(PyObject *)
+{
+ return gp_KetsjiEngine->GetPyProfileDict();
+}
+
static char gPySendMessage_doc[] =
"sendMessage(subject, [body, to, from])\n\
sends a message in same manner as a message actuator\
@@ -858,6 +867,7 @@ static struct PyMethodDef game_methods[] = {
{"PrintGLInfo", (PyCFunction)pyPrintExt, METH_NOARGS, (const char *)"Prints GL Extension Info"},
{"PrintMemInfo", (PyCFunction)pyPrintStats, METH_NOARGS, (const char *)"Print engine statistics"},
{"NextFrame", (PyCFunction)gPyNextFrame, METH_NOARGS, (const char *)"Render next frame (if Python has control)"},
+ {"getProfileInfo", (PyCFunction)gPyGetProfileInfo, METH_NOARGS, gPyGetProfileInfo_doc},
/* library functions */
{"LibLoad", (PyCFunction)gLibLoad, METH_VARARGS|METH_KEYWORDS, (const char *)""},
{"LibNew", (PyCFunction)gLibNew, METH_VARARGS, (const char *)""},
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp
index fec275322e9..3e1a81c2f4f 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -1172,9 +1172,8 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj, bool use_gfx, bool u
);
}
newobj->SetDeformer(modifierDeformer);
- }
- else if (bHasShapeKey)
- {
+ }
+ else if (bHasShapeKey) {
BL_ShapeDeformer* shapeDeformer;
if (bHasArmature)
{
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
index 9fb86dec569..d5ceba0ec57 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
@@ -1576,7 +1576,7 @@ struct OcclusionBuffer
}
}
}
- else if (width == 1) {
+ else if (width == 1) {
// Degenerated in at least 2 vertical lines
// The algorithm below doesn't work when face has a single pixel width
// We cannot use general formulas because the plane is degenerated.
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.cpp
index d45365dde04..72af3852cf6 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.cpp
@@ -119,7 +119,7 @@ void RAS_StorageVA::IndexPrimitives(RAS_MeshSlot& ms)
void RAS_StorageVA::IndexPrimitivesMulti(class RAS_MeshSlot& ms)
{
static const GLsizei stride = sizeof(RAS_TexVert);
- bool wireframe = m_drawingmode <= RAS_IRasterizer::KX_WIREFRAME, use_color_array;
+ bool wireframe = m_drawingmode <= RAS_IRasterizer::KX_WIREFRAME, use_color_array = true;
RAS_MeshSlot::iterator it;
GLenum drawmode;