0
$\begingroup$

Is it possibile to access walk_speed setting of Walk Navigation mode via python API? (I know how to activate the Walk mode by script, but I want to change the walk speed).

$\endgroup$
1
  • $\begingroup$ Voted to reopen the question. $\endgroup$
    – brockmann
    Jul 19 at 6:16
3
$\begingroup$

Sure, you can access all settings of WalkNavigation via Preferences. Recommend use the python console to figure out:

>>> C.preferences
<bpy_struct, Preferences at 0x1108d8a28>

>>> C.preferences.inputs.walk_navigation.
                                         walk_speed
                                         use_gravity
                                         walk_speed_factor
                                         ...

Demo on how to call bpy.ops.view3d.walk() from a script and set the walk_speed to 23 (default is 2.5) by overriding the context of the operator (the actual area and the region):

import bpy

C = bpy.context

walk_nav = C.preferences.inputs.walk_navigation
walk_nav.walk_speed = 23

for area in C.screen.areas:
    if area.type == 'VIEW_3D':
        override = C.copy()
        override['area'] = area
        override["region"] = area.regions[-1]
        bpy.ops.view3d.walk(override, 'INVOKE_DEFAULT')
        break

Also see: Change Navigation into walk Navigation with scripting

$\endgroup$
3
  • $\begingroup$ Hello! My question was how to access to the walk_speed setting, not how to activate the Walk/Fly Navigation Mode... $\endgroup$
    – igmar
    Jul 19 at 5:32
  • $\begingroup$ See my edits @igmar $\endgroup$
    – brockmann
    Jul 19 at 7:37
  • 1
    $\begingroup$ Really great. This approach helps in a lot of different situations! $\endgroup$
    – igmar
    Jul 20 at 7:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.