diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2013-12-03 09:14:09 +0400 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2013-12-03 09:14:09 +0400 |
commit | ab494379586034a6844c858324815e3b1ff3cbb2 (patch) | |
tree | 88ee6a460649f4488d72ad0e97e6d8839cc6132f /source/blender/makesrna | |
parent | 2e4601c35629f6b221a9e9fd2eaa2efb4fd092ab (diff) |
View Navigation: Walk and Fly modes
This is a addtion to the dynamic fly mode.
It behaves as the first person navigation system available in most 3d world games nowadays.
You can alternate between the old mode (Fly) and the new mode (Walk) in User Preferences > Inputs
Manual:
-------
http://wiki.blender.org/index.php/Doc:2.6/Manual/3D_interaction/Navigating/3D_View#View_Navigation
http://wiki.blender.org/index.php/Doc:2.6/Manual/3D_interaction/Navigating/3D_View/Navigation_Modes
Shortcuts:
----------
WASD (hold) - Move forward/backward and straft left/right
QE (hold) - Move up and down
Tab - Alternate between Walk and Fly modes
Shift (hold) - Speed up movement
Alt (hold) - Slow down movement
Space or MMB - Teleport
V - Jump
+/- or mouse wheel - speed increase/decrease speed for this Blender session
User Preferences Options:
-------------------------
Navigation Mode - fly/walk navigation systems (fly is the old, walk is the new, next options are for walk mode only)
Gravity - alternate between free navigation and walk with gravity modes
Mouse Sensitivity - sensitivity factor to mouse influence to look around
Teleport Duration - how long the teleport lasts
Camera Height - camera height to use in gravity mode
Jump Height - maximum jump speed in m/s
Move Speed - base move speed in m/s
Boost Factor - multiplication factor when running or going slow (1/boost)
Development Notes:
------------------
* The initial code was based on view3d_fly.c.
* The NDoF code was not touched, so it most likely is not working.
Pending Issues:
---------------
* Draw in the UI the shortcut options, and current values (e.g., Mode: Fly/Walk)
(we need a proper API for that)
* OSX seems to present issues if we re-center the mouse every time. We implemented a workaround for that, but a real fix would be welcome.
Code reviewed and with collaborations from Campbell Barton - @campbellbarton
Differential Revision: http://developer.blender.org/D30
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/RNA_access.h | 1 | ||||
-rw-r--r-- | source/blender/makesrna/RNA_enum_types.h | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 66 |
3 files changed, 68 insertions, 1 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 79e3d7acab6..f7909d23525 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -641,6 +641,7 @@ extern StructRNA RNA_UserPreferencesFilePaths; extern StructRNA RNA_UserPreferencesInput; extern StructRNA RNA_UserPreferencesSystem; extern StructRNA RNA_UserPreferencesView; +extern StructRNA RNA_UserPreferencesWalkNavigation; extern StructRNA RNA_UserSolidLight; extern StructRNA RNA_VectorFont; extern StructRNA RNA_VertexGroup; diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h index f1881c8beba..2fb1af74173 100644 --- a/source/blender/makesrna/RNA_enum_types.h +++ b/source/blender/makesrna/RNA_enum_types.h @@ -135,6 +135,8 @@ extern EnumPropertyItem gameproperty_type_items[]; extern EnumPropertyItem viewport_shade_items[]; +extern EnumPropertyItem navigation_mode_items[]; + int rna_node_tree_type_to_enum(struct bNodeTreeType *typeinfo); int rna_node_tree_idname_to_enum(const char *idname); struct bNodeTreeType *rna_node_tree_type_from_enum(int value); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 0e45d6d4aea..a46d90ca8fd 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -72,6 +72,12 @@ static EnumPropertyItem audio_device_items[] = { {0, NULL, 0, NULL, NULL} }; +EnumPropertyItem navigation_mode_items[] = { + {VIEW_NAVIGATION_WALK, "WALK", 0, "Walk", "Interactively walk or free navigate around the scene"}, + {VIEW_NAVIGATION_FLY, "FLY", 0, "Fly", "Use fly dynamics to navigate the scene"}, + {0, NULL, 0, NULL, NULL} +}; + #ifdef RNA_RUNTIME #include "DNA_object_types.h" @@ -2873,6 +2879,51 @@ static void rna_def_userdef_solidlight(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_UserDef_viewport_lights_update"); } +static void rna_def_userdef_walk_navigation(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "WalkNavigation", NULL); + RNA_def_struct_sdna(srna, "WalkNavigation"); + RNA_def_struct_clear_flag(srna, STRUCT_UNDO); + RNA_def_struct_ui_text(srna, "Walk Navigation", "Walk navigation settings"); + + prop = RNA_def_property(srna, "mouse_speed", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 0.01f, 10.0f); + RNA_def_property_ui_text(prop, "Mouse Sensitivity", "Speed factor for when looking around, high values mean faster mouse movement"); + + prop = RNA_def_property(srna, "walk_speed", PROP_FLOAT, PROP_VELOCITY); + RNA_def_property_range(prop, 0.01f, 100.f); + RNA_def_property_ui_text(prop, "Walk Speed", "Base speed for walking and flying"); + + prop = RNA_def_property(srna, "walk_speed_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 0.01f, 10.f); + RNA_def_property_ui_text(prop, "Speed Factor", "Multiplication factor when using the fast or slow modifiers"); + + prop = RNA_def_property(srna, "view_height", PROP_FLOAT, PROP_UNIT_LENGTH); + RNA_def_property_ui_range(prop, 0.1f, 10.f, 0.1, 2); + RNA_def_property_range(prop, 0.f, 1000.f); + RNA_def_property_ui_text(prop, "View Height", "View distance from the floor when walking"); + + prop = RNA_def_property(srna, "jump_height", PROP_FLOAT, PROP_UNIT_LENGTH); + RNA_def_property_ui_range(prop, 0.1f, 10.f, 0.1, 2); + RNA_def_property_range(prop, 0.1f, 100.f); + RNA_def_property_ui_text(prop, "Jump Height", "Maximum height of a jump"); + + prop = RNA_def_property(srna, "teleport_time", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 0.f, 10.f); + RNA_def_property_ui_text(prop, "Teleport Duration", "Interval of time warp when teleporting in navigation mode"); + + prop = RNA_def_property(srna, "use_gravity", PROP_BOOLEAN, PROP_BOOLEAN); + RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_WALK_GRAVITY); + RNA_def_property_ui_text(prop, "Gravity", "Walks with gravity, or free navigate"); + + prop = RNA_def_property(srna, "use_mouse_reverse", PROP_BOOLEAN, PROP_BOOLEAN); + RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_WALK_MOUSE_REVERSE); + RNA_def_property_ui_text(prop, "Reverse Mouse", "Reverse the mouse look"); +} + static void rna_def_userdef_view(BlenderRNA *brna) { static EnumPropertyItem timecode_styles[] = { @@ -3793,7 +3844,19 @@ static void rna_def_userdef_input(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Continuous Grab", "Allow moving the mouse outside the view on some manipulations " "(transform, ui control drag)"); - + + /* View Navigation */ + prop = RNA_def_property(srna, "navigation_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "navigation_mode"); + RNA_def_property_enum_items(prop, navigation_mode_items); + RNA_def_property_ui_text(prop, "View Navigation", "Which method to use for viewport navigation"); + + prop = RNA_def_property(srna, "walk_navigation", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "walk_navigation"); + RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_struct_type(prop, "WalkNavigation"); + RNA_def_property_ui_text(prop, "Walk Navigation", "Settings for walk navigation mode"); + /* tweak tablet & mouse preset */ prop = RNA_def_property(srna, "drag_threshold", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "dragthreshold"); @@ -4128,6 +4191,7 @@ void RNA_def_userdef(BlenderRNA *brna) rna_def_userdef_dothemes(brna); rna_def_userdef_solidlight(brna); + rna_def_userdef_walk_navigation(brna); srna = RNA_def_struct(brna, "UserPreferences", NULL); RNA_def_struct_sdna(srna, "UserDef"); |