tornavis/source/blender/blenkernel
Bastien Montagne 87cc890aef Support units in modal numinput
Summary:
This completly changes the way modal numinput is handled. Now, edited expression is a string, which then gets unit- and py-evaluated to get a float value.

We gain many power and flexibility, but lose a few "shortcuts" like '-' to negate, or '/' to inverse (if they are really needed, we still can add them with modifiers, like e.g. ctrl-/ or so).

Features:
- units (cm, ", deg, etc.).
- basic operations from python/BKE_unit (+, *, **, etc.), and math constants and functions (pi, sin, etc.).
- you can navigate in edited value (left/right key, ctrl to move by block) and insert/delete chars, e.g. to fix a typo without having to rewrite everything.
- you can go to next/previous value with (ctrl-)TAB key.
- As before, hitting backspace after having deleted all leading chars will first reset the edited value to init state, and on second press, the whole "modal numinput" editing will be cancelled, going back to usual transform with mouse.

Notes:
- Did not touch to how values are shown in header when modal numinput is not enabled (would do that in another commit), so this is still quite inconsistent.
- Added back radian support in BKE_unit.
- Added arcminute/arcsecond to BKE_unit.
(those unit changes affect all angle UI controls, btw, so you can now enter radians or longitude/latitude values when in degrees units).

Related to T37600.

Reviewers: brecht, campbellbarton, carter2422

Reviewed By: brecht, campbellbarton, carter2422
Thanks everybody!

Differential Revision: http://developer.blender.org/D61
2013-12-21 17:44:48 +01:00
..
intern Support units in modal numinput 2013-12-21 17:44:48 +01:00
BKE_DerivedMesh.h code cleanup: headers - doxy comments. 2013-09-12 03:02:50 +00:00
BKE_action.h code cleanup: armature functions 2013-11-17 05:23:05 +11:00
BKE_addon.h code cleanup: headers - doxy comments. 2013-09-12 03:02:50 +00:00
BKE_anim.h Made curves almost thread-safe 2013-08-19 09:36:40 +00:00
BKE_animsys.h Bugfix: Renaming bones now renames the corresponding F-Curves in actions used by 2013-10-22 11:36:48 +00:00
BKE_armature.h Made armatures evaluation safe for threading 2013-08-19 10:14:22 +00:00
BKE_autoexec.h add option to enable auto-execute scripts, but exclude certain directories. 2013-06-18 18:11:52 +00:00
BKE_blender.h Refactoring/cleanup, borrowed from soc-2013-paint branch. 2013-12-09 22:40:02 +02:00
BKE_bmfont.h
BKE_bmfont_types.h
BKE_boids.h Random number generator: replace a bunch of usage of the global random number 2013-04-15 23:12:40 +00:00
BKE_bpath.h remove nan copyrights from code added since blender become opensource (copy paste errors), also remove BKE_script.h 2013-07-02 10:14:59 +00:00
BKE_brush.h Undo the front-facing only commit for clay strips brushes, it adds an 2013-09-16 02:24:41 +00:00
BKE_bullet.h
BKE_bvhutils.h Fix T37445: Crash with snapping and shrink-wrap modifier. 2013-11-19 14:31:26 +11:00
BKE_camera.h Merged changes in the trunk up to revision 55546. 2013-03-24 12:13:13 +00:00
BKE_ccg.h code cleanup: headers - doxy comments. 2013-09-12 03:02:50 +00:00
BKE_cdderivedmesh.h add CDDM_lower_num_loops(), for completeness (currently unused). 2013-11-04 12:01:46 +00:00
BKE_cloth.h cloth was using edgehash not quite correctly: 2013-08-24 16:06:18 +00:00
BKE_collision.h
BKE_colortools.h Better fix for #36688. 2013-09-11 23:28:23 +00:00
BKE_constraint.h Code cleanup: add usual 'BKE_' prefix to 'public' constraint functions from blenkernel... 2012-12-23 11:31:15 +00:00
BKE_context.h fix for reading outside allocated memory when switching to the 3D view. 2013-07-27 10:32:27 +00:00
BKE_curve.h Curve Handle Recalculate (Ctrl+N) 2013-12-14 02:53:19 +11:00
BKE_customdata.h Code Cleanup: style, spelling and pep8 edits 2013-11-20 03:40:10 +11:00
BKE_customdata_file.h
BKE_deform.h code cleanup: rename flip_side_name to BKE_deform_flip_side_name 2013-11-17 05:23:05 +11:00
BKE_depsgraph.h Fix build error in depsgraph refactoring commit. 2013-02-26 20:34:37 +00:00
BKE_displist.h Partial revert of recenr cu->disp merge commit 2013-08-21 07:40:19 +00:00
BKE_dynamicpaint.h Fix #36058: Displace Modifier errors using a baked Image and displace baking inconsistency between 2.67/2.68RC and previous versions 2013-07-15 14:47:58 +00:00
BKE_editmesh.h move bmesh array lookup data and utility functions from editmesh into bmesh, 2013-10-28 02:05:33 +00:00
BKE_editmesh_bvh.h BMesh Refactor: BKE_bmbvh_new can now be created without an EditMesh. 2013-11-18 18:25:47 +11:00
BKE_effect.h style cleanup: 2013-03-26 07:29:01 +00:00
BKE_fcurve.h fix [#36919] Cannot delete keyframe of animated simulation parameter if simulation has been disabled 2013-10-02 16:37:47 +00:00
BKE_fluidsim.h define the size of matrix args for both rows/cols. 2012-12-11 14:29:01 +00:00
BKE_font.h Code Cleanup: remove unused members for editfont (3D text) 2013-11-21 04:16:41 +11:00
BKE_freestyle.h A major code update for making the DNA file specification of Freestyle settings 2013-03-23 03:00:37 +00:00
BKE_global.h Project Pampa request: FCurves normalized display 2013-10-29 18:10:52 +00:00
BKE_gpencil.h UI: remove unnecessary confirmation popups 2013-11-25 12:21:45 +01:00
BKE_group.h code cleanup: use more (blender) conventional naming for group functions. 2013-04-03 11:28:42 +00:00
BKE_icons.h Merging r51923 through r52851 from trunk into soc-2011-tomato 2012-12-10 15:18:00 +00:00
BKE_idcode.h Merged changes in the trunk up to revision 55546. 2013-03-24 12:13:13 +00:00
BKE_idprop.h Fix T37595: Switching modal transform broke with trackball rotation. 2013-12-13 00:35:12 +11:00
BKE_image.h Image cache rewrite to using generic movie cache 2013-12-13 16:30:00 +06:00
BKE_ipo.h
BKE_key.h Optimization and threading fix for shapekeys weights calculation 2013-08-19 10:36:39 +00:00
BKE_lamp.h Move GCC attributes into a centraized defines 2013-09-01 15:01:15 +00:00
BKE_lattice.h Lattice API: add BKE_lattice_index_flip, BKE_lattice_bitmap_from_flag 2013-12-09 15:41:54 +11:00
BKE_library.h Move GCC attributes into a centraized defines 2013-09-01 15:01:15 +00:00
BKE_linestyle.h A major code update for making the DNA file specification of Freestyle settings 2013-03-23 03:00:37 +00:00
BKE_main.h Fix T37488: Crash with --debug reading userpref.blend 2013-11-18 18:13:23 +06:00
BKE_mask.h Don't use with_resol suffix for functions which doesn't get resolution 2013-12-20 16:00:05 +06:00
BKE_material.h Code cleanup: Remove "TexFace to Material Convert", from the file menu. This was used for conversion from older 2.5x files. The do_version() code is still there and functioning though. 2013-12-14 10:48:12 +01:00
BKE_mball.h Merge remained parts of r57520: use use_render argument rather than G.is_rendering 2013-08-19 11:04:32 +00:00
BKE_mesh.h Code Cleanup: move mesh mapping functions into their own file/header 2013-12-12 16:28:52 +11:00
BKE_mesh_mapping.h Mesh API: Add BKE_mesh_origindex_map_create 2013-12-12 17:37:16 +11:00
BKE_modifier.h Interface / Modifiers: Don't show cage placeholder in modifier header, if the current modifier does not support it or the cage is disabled (like Subsurf 0). 2013-12-13 20:57:54 +01:00
BKE_movieclip.h Changes to cache invalidation policy for movie clips 2013-04-04 09:50:51 +00:00
BKE_multires.h Merged changes in the trunk up to revision 55546. 2013-03-24 12:13:13 +00:00
BKE_navmesh_conversion.h code cleanup: headers - doxy comments. 2013-09-12 03:02:50 +00:00
BKE_nla.h Merged changes in the trunk up to revision 55546. 2013-03-24 12:13:13 +00:00
BKE_node.h Compositor node preview: 2013-12-09 20:22:16 +01:00
BKE_object.h Game Engine: Level of detail support and tools 2013-12-17 17:03:27 -08:00
BKE_object_deform.h use bool arrays rather then char for weight paint lock/select arrays 2013-05-15 15:52:48 +00:00
BKE_ocean.h style cleanup 2013-09-18 00:07:17 +00:00
BKE_packedFile.h use 'bool' for BLI_/BKE_ functions. 2013-03-09 05:35:49 +00:00
BKE_paint.h Sculpting: 2013-09-13 23:58:00 +00:00
BKE_particle.h Make lattice deform safe for threading 2013-08-19 10:11:48 +00:00
BKE_pbvh.h Comment fix to previous commit 2013-12-18 18:36:07 +02:00
BKE_pointcache.h Related to #36532: show message in modifier when cloth point cache read fails, 2013-09-03 19:58:09 +00:00
BKE_property.h replace strcpy with BLI_strncpy or memcpy when the size is known. 2012-12-16 08:43:05 +00:00
BKE_report.h Move GCC attributes into a centraized defines 2013-09-01 15:01:15 +00:00
BKE_rigidbody.h code cleanup: spelling 2013-10-31 23:52:44 +00:00
BKE_sca.h Merging r50625 through r51896 from trunk into soc-2011-tomato 2012-11-05 19:42:27 +00:00
BKE_scene.h Fixed more threading issues with metaballs 2013-07-09 08:23:01 +00:00
BKE_screen.h UI: Tabs categories for panels (D75) 2013-12-17 03:55:45 +11:00
BKE_sequencer.h fix [#36570] Changing the filename of a image strip doesnt refresh sequencer 2013-08-29 04:08:44 +00:00
BKE_shrinkwrap.h shrink-wrap constraint, improve and remove some limitations. 2013-09-07 12:59:16 +00:00
BKE_sketch.h style cleanup: 2013-03-26 07:29:01 +00:00
BKE_smoke.h code cleanup: unused functions 2013-04-03 15:04:24 +00:00
BKE_softbody.h style cleanup: 2013-03-26 07:29:01 +00:00
BKE_sound.h Fix #33518: Jack sync doesn't work in 2.64, 2.64 or 2.65 stable versions 2013-03-27 07:19:54 +00:00
BKE_speaker.h remove nan copyrights from code added since blender become opensource (copy paste errors), also remove BKE_script.h 2013-07-02 10:14:59 +00:00
BKE_subsurf.h Mark some CCG funcrions as inlined 2013-10-01 09:17:35 +00:00
BKE_suggestions.h minor updates to text autocomplete api 2012-12-31 14:49:27 +00:00
BKE_text.h text editor cursor motion (left/right arrows) with selected text typically jumps to either side of the selection previously the cursor would move and loose the selection too. 2013-09-02 00:47:27 +00:00
BKE_texture.h Code cleanup: de-duplicate implementation of get_texture_value 2013-10-20 13:01:07 +00:00
BKE_tracking.h Weighted tracks 2013-10-26 13:22:38 +00:00
BKE_treehash.h Fix state losses for recursive outliner trees (e.g. datablocks editor) 2013-08-23 20:35:00 +00:00
BKE_unit.h Support units in modal numinput 2013-12-21 17:44:48 +01:00
BKE_utildefines.h Merging r51923 through r52851 from trunk into soc-2011-tomato 2012-12-10 15:18:00 +00:00
BKE_world.h Fix #34040: Moving Normal Node with enabled Cycles Material Preview crashes 2013-02-05 12:46:15 +00:00
BKE_writeavi.h
BKE_writeffmpeg.h "Render Audio" cleanup: 2013-11-07 13:32:32 +00:00
BKE_writeframeserver.h
CMakeLists.txt Code Cleanup: move mesh mapping functions into their own file/header 2013-12-12 16:28:52 +11:00
SConscript Code cleanup: remove unused include dirs 2013-11-25 15:16:46 +11:00
depsgraph_private.h code cleanup: unused functions 2013-04-03 15:04:24 +00:00
nla_private.h Merged changes in the trunk up to revision 55546. 2013-03-24 12:13:13 +00:00