@@ -102,15 +102,10 @@ def callMenu(self, context):
102
102
if space_type == "NODE_EDITOR" :
103
103
node_tree = context .space_data .node_tree
104
104
if node_tree :
105
- if (
106
- node_tree .nodes .active is not None
107
- and node_tree .nodes .active .select
108
- ):
105
+ if node_tree .nodes .active is not None and node_tree .nodes .active .select :
109
106
bpy .ops .wm .call_menu (name = "NODE_MT_context_menu" )
110
107
else :
111
- bpy .ops .wm .search_single_menu (
112
- "INVOKE_DEFAULT" , menu_idname = "NODE_MT_add"
113
- )
108
+ bpy .ops .wm .search_single_menu ("INVOKE_DEFAULT" , menu_idname = "NODE_MT_add" )
114
109
else :
115
110
try :
116
111
bpy .ops .wm .call_menu (name = self .menu_by_mode [context .mode ])
@@ -130,21 +125,26 @@ def execute(self, context):
130
125
preferences = context .preferences
131
126
addon_prefs = preferences .addons [__package__ ].preferences
132
127
enable_nodes = addon_prefs .enable_for_node_editors
128
+ disable_camera = addon_prefs .disable_camera_navigation
133
129
134
130
space_type = context .space_data .type
131
+ view = context .space_data .region_3d .view_perspective
135
132
136
133
# Execute is the first thing called in our operator, so we start by
137
134
# calling Blender's built-in Walk Navigation
138
135
if space_type == "VIEW_3D" :
139
- try :
140
- bpy .ops .view3d .walk ("INVOKE_DEFAULT" )
141
- # Adding the timer and starting the loop
142
- wm = context .window_manager
143
- self ._timer = wm .event_timer_add (0.1 , window = context .window )
144
- wm .modal_handler_add (self )
145
- return {"RUNNING_MODAL" }
146
- except RuntimeError :
147
- self .report ({"ERROR" }, "Cannot Navigate an Object with Constraints" )
136
+ if not (view == "CAMERA" and disable_camera ):
137
+ try :
138
+ bpy .ops .view3d .walk ("INVOKE_DEFAULT" )
139
+ # Adding the timer and starting the loop
140
+ wm = context .window_manager
141
+ self ._timer = wm .event_timer_add (0.1 , window = context .window )
142
+ wm .modal_handler_add (self )
143
+ return {"RUNNING_MODAL" }
144
+ except RuntimeError :
145
+ self .report ({"ERROR" }, "Cannot Navigate an Object with Constraints" )
146
+ return {"CANCELLED" }
147
+ else :
148
148
return {"CANCELLED" }
149
149
150
150
elif space_type == "NODE_EDITOR" and enable_nodes :
0 commit comments