99menumodes = []
1010panelmodes = []
1111
12+
1213def draw_cam_lock (self , context ):
1314 preferences = context .preferences
1415 addon_prefs = preferences .addons [__package__ ].preferences
@@ -73,7 +74,7 @@ def update_rebind_3dview_keymap(self, context):
7374def update_rebind_switch_nav_rotate (self , context ):
7475 self .rebind_switch_nav_rotate (context , self .rmb_rotate_switch )
7576
76-
77+
7778class RightMouseNavigationPreferences (AddonPreferences ):
7879 bl_idname = __package__
7980
@@ -128,7 +129,7 @@ class RightMouseNavigationPreferences(AddonPreferences):
128129 default = False ,
129130 update = cam_lock_update ,
130131 )
131-
132+
132133 rmb_pan_rotate : BoolProperty (
133134 name = "Switch MMB and RMB Drag Camera Navigation" ,
134135 description = "Switches Camera Navigation controls to Right Mouse Button." ,
@@ -142,137 +143,151 @@ class RightMouseNavigationPreferences(AddonPreferences):
142143 default = False ,
143144 update = update_rebind_switch_nav_rotate ,
144145 )
145-
146-
146+
147147 def rebind_3dview_keymap (self , context , isActive ):
148148 wm = context .window_manager
149149 active_kc = wm .keyconfigs .active
150150 addon_kc = wm .keyconfigs .addon
151-
152- if ( isActive ) :
151+
152+ if isActive :
153153 for key in active_kc .keymaps ["3D View" ].keymap_items :
154- if ( key .idname == "view3d.cursor3d" and key .type == "RIGHTMOUSE" ) :
154+ if key .idname == "view3d.cursor3d" and key .type == "RIGHTMOUSE" :
155155 key .type = "MIDDLEMOUSE"
156156 key .value = "CLICK"
157157 key .shift = True
158- if ( key .idname == "view3d.rotate" and key .type == "MIDDLEMOUSE" ) :
158+ if key .idname == "view3d.rotate" and key .type == "MIDDLEMOUSE" :
159159 key .type = "RIGHTMOUSE"
160160 key .value = "CLICK_DRAG"
161161 key .alt = True
162- if ( key .idname == "view3d.move" and key .type == "MIDDLEMOUSE" ) :
162+ if key .idname == "view3d.move" and key .type == "MIDDLEMOUSE" :
163163 key .type = "RIGHTMOUSE"
164164 key .value = "CLICK_DRAG"
165165 key .shift = True
166- if ( key .idname == "view3d.zoom" and key .type == "MIDDLEMOUSE" ) :
166+ if key .idname == "view3d.zoom" and key .type == "MIDDLEMOUSE" :
167167 key .type = "RIGHTMOUSE"
168168 key .value = "CLICK_DRAG"
169169 key .ctrl = True
170- if ( key .idname == "view3d.dolly" and key .type == "MIDDLEMOUSE" ) :
170+ if key .idname == "view3d.dolly" and key .type == "MIDDLEMOUSE" :
171171 key .type = "RIGHTMOUSE"
172172 key .value = "CLICK_DRAG"
173173 key .shift = True
174174 key .ctrl = True
175- if (key .idname == "view3d.select_lasso" and key .type == "RIGHTMOUSE" and key .ctrl == True ):
175+ if (
176+ key .idname == "view3d.select_lasso"
177+ and key .type == "RIGHTMOUSE"
178+ and key .ctrl == True
179+ ):
176180 key .type = "MIDDLEMOUSE"
177181 key .value = "CLICK_DRAG"
178182 key .ctrl = True
179- if (key .idname == "view3d.select_lasso" and key .type == "RIGHTMOUSE" and key .ctrl == True and key .shift == True ):
183+ if (
184+ key .idname == "view3d.select_lasso"
185+ and key .type == "RIGHTMOUSE"
186+ and key .ctrl == True
187+ and key .shift == True
188+ ):
180189 key .type = "MIDDLEMOUSE"
181190 key .value = "CLICK_DRAG"
182191 key .shift = True
183192 key .ctrl = True
184- if ( key .idname == "transform.translate" and key .type == "RIGHTMOUSE" ) :
193+ if key .idname == "transform.translate" and key .type == "RIGHTMOUSE" :
185194 key .type = "MIDDLEMOUSE"
186195 else :
187196 for key in active_kc .keymaps ["3D View" ].keymap_items :
188- if ( key .idname == "view3d.cursor3d" and key .type == "MIDDLEMOUSE" ) :
197+ if key .idname == "view3d.cursor3d" and key .type == "MIDDLEMOUSE" :
189198 key .type = "RIGHTMOUSE"
190199 key .value = "CLICK"
191200 key .shift = True
192- if ( key .idname == "view3d.rotate" and key .type == "RIGHTMOUSE" ) :
201+ if key .idname == "view3d.rotate" and key .type == "RIGHTMOUSE" :
193202 key .type = "MIDDLEMOUSE"
194203 key .value = "PRESS"
195204 key .alt = False
196- if ( key .idname == "view3d.move" and key .type == "RIGHTMOUSE" ) :
205+ if key .idname == "view3d.move" and key .type == "RIGHTMOUSE" :
197206 key .type = "MIDDLEMOUSE"
198207 key .value = "PRESS"
199208 key .shift = True
200- if ( key .idname == "view3d.zoom" and key .type == "RIGHTMOUSE" ) :
209+ if key .idname == "view3d.zoom" and key .type == "RIGHTMOUSE" :
201210 key .type = "MIDDLEMOUSE"
202211 key .value = "PRESS"
203212 key .ctrl = True
204- if ( key .idname == "view3d.dolly" and key .type == "RIGHTMOUSE" ) :
213+ if key .idname == "view3d.dolly" and key .type == "RIGHTMOUSE" :
205214 key .type = "MIDDLEMOUSE"
206215 key .value = "PRESS"
207216 key .shift = True
208217 key .ctrl = True
209- if (key .idname == "view3d.select_lasso" and key .type == "MIDDLEMOUSE" and key .ctrl == True ):
218+ if (
219+ key .idname == "view3d.select_lasso"
220+ and key .type == "MIDDLEMOUSE"
221+ and key .ctrl == True
222+ ):
210223 key .type = "RIGHTMOUSE"
211224 key .value = "CLICK_DRAG"
212225 key .ctrl = True
213- if (key .idname == "view3d.select_lasso" and key .type == "MIDDLEMOUSE" and key .ctrl == True and key .shift == True ):
226+ if (
227+ key .idname == "view3d.select_lasso"
228+ and key .type == "MIDDLEMOUSE"
229+ and key .ctrl == True
230+ and key .shift == True
231+ ):
214232 key .type = "RIGHTMOUSE"
215233 key .value = "CLICK_DRAG"
216234 key .shift = True
217235 key .ctrl = True
218- if ( key .idname == "transform.translate" and key .type == "MIDDLEMOUSE" ) :
236+ if key .idname == "transform.translate" and key .type == "MIDDLEMOUSE" :
219237 key .type = "RIGHTMOUSE"
220238
221-
222239 def rebind_switch_nav_rotate (self , context , isActive ):
223240 wm = context .window_manager
224241 active_kc = wm .keyconfigs .active
225242 addon_kc = wm .keyconfigs .addon
226-
227- if ( isActive ) :
243+
244+ if isActive :
228245 for key in addon_kc .keymaps ["3D View" ].keymap_items :
229- if ( key .idname == "rmn.right_mouse_navigation" ) :
246+ if key .idname == "rmn.right_mouse_navigation" :
230247 key .type = "RIGHTMOUSE"
231248 key .value = "PRESS"
232249 key .alt = True
233250 for key in active_kc .keymaps ["3D View" ].keymap_items :
234- if ( key .idname == "view3d.rotate" and key .type == "RIGHTMOUSE" ) :
251+ if key .idname == "view3d.rotate" and key .type == "RIGHTMOUSE" :
235252 key .type = "RIGHTMOUSE"
236253 key .value = "CLICK_DRAG"
237254 key .alt = False
238255 for i in menumodes :
239256 for key in active_kc .keymaps [i ].keymap_items :
240- if (
241- key .idname == "wm.call_menu"
242- and key .type == "RIGHTMOUSE"
243- ):
257+ if key .idname == "wm.call_menu" and key .type == "RIGHTMOUSE" :
244258 key .active = True
245259 key .value = "CLICK"
246260 for i in panelmodes :
247261 for key in active_kc .keymaps [i ].keymap_items :
248- if key .idname == "wm.call_panel" and key .type == "RIGHTMOUSE" and key .active :
262+ if (
263+ key .idname == "wm.call_panel"
264+ and key .type == "RIGHTMOUSE"
265+ and key .active
266+ ):
249267 key .active = False
250268 key .value = "CLICK"
251269 else :
252270 for key in addon_kc .keymaps ["3D View" ].keymap_items :
253- if ( key .idname == "rmn.right_mouse_navigation" ) :
271+ if key .idname == "rmn.right_mouse_navigation" :
254272 key .type = "RIGHTMOUSE"
255273 key .value = "PRESS"
256274 key .alt = False
257275 for key in active_kc .keymaps ["3D View" ].keymap_items :
258- if ( key .idname == "view3d.rotate" and key .type == "RIGHTMOUSE" ) :
276+ if key .idname == "view3d.rotate" and key .type == "RIGHTMOUSE" :
259277 key .type = "RIGHTMOUSE"
260278 key .value = "CLICK_DRAG"
261279 key .alt = True
262280 for i in menumodes :
263281 for key in active_kc .keymaps [i ].keymap_items :
264- if (
265- key .idname == "wm.call_menu"
266- and key .type == "RIGHTMOUSE"
267- ):
282+ if key .idname == "wm.call_menu" and key .type == "RIGHTMOUSE" :
268283 key .active = False
269284 key .value = "PRESS"
270285 for i in panelmodes :
271286 for key in active_kc .keymaps [i ].keymap_items :
272287 if key .idname == "wm.call_panel" and key .type == "RIGHTMOUSE" :
273288 key .active = True
274289 key .value = "PRESS"
275-
290+
276291 def draw (self , context ):
277292 layout = self .layout
278293
@@ -321,14 +336,14 @@ def draw(self, context):
321336 box .label (text = "Shift + Drag MMB to Transform Translate" )
322337 box .label (text = "Ctrl + Drag MMB to Lasso Selection" )
323338 box .label (text = "Shift + Ctrl + Drag MMB to Lasso Deselection" )
324- if ( self .rmb_pan_rotate ) :
339+ if self .rmb_pan_rotate :
325340 box .prop (self , "rmb_rotate_switch" )
326341 if self .rmb_rotate_switch :
327342 box .label (text = "Drag + RMB will now Rotate 3D View" )
328343 box .label (text = "Alt + RMB then WASD for Navigation Mode" )
329- elif ( not self .rmb_pan_rotate and self .rmb_rotate_switch ) :
344+ elif not self .rmb_pan_rotate and self .rmb_rotate_switch :
330345 self .rmb_rotate_switch = False
331-
346+
332347 # Keymap Customization
333348 import rna_keymap_ui
334349
0 commit comments