From 28e9eb65b555ccc758416081e864c3680c06f7e7 Mon Sep 17 00:00:00 2001
From: Severin <eiseljulian@gmail.com>
Date: Fri, 4 Jan 2019 01:44:03 +0100
Subject: [PATCH] Update contrib Add-ons to changed Preference API

---
 add_dimension.py                          |  8 +--
 amaranth/animation/frame_current.py       |  4 +-
 amaranth/animation/jump_frames.py         | 12 ++---
 amaranth/animation/timeline_extra_info.py |  4 +-
 amaranth/node_editor/display_image.py     |  4 +-
 amaranth/scene/refresh.py                 |  8 +--
 amaranth/scene/save_reload.py             |  4 +-
 amaranth/scene/stats.py                   |  4 +-
 animation_motion_trail.py                 |  8 +--
 cacharanth/util.py                        |  4 +-
 cmu_mocap_browser/__init__.py             |  6 +--
 cmu_mocap_browser/data.py                 |  2 +-
 cmu_mocap_browser/download.py             |  4 +-
 cmu_mocap_browser/makehuman.py            |  4 +-
 curve_tools/__init__.py                   |  2 +-
 data_overrides/util.py                    |  4 +-
 exact_edit/xedit_free_rotate.py           |  8 +--
 exact_edit/xedit_set_meas.py              |  8 +--
 io_import_LRO_Lola_MGS_Mola_img.py        |  4 +-
 lighting_hdri_shortcut/__init__.py        |  8 +--
 mesh_ktools.py                            | 30 +++++------
 mesh_show_vgroup_weights.py               |  2 +-
 node_presets.py                           |  4 +-
 np_station/__init__.py                    |  2 +-
 np_station/np_float_box.py                |  2 +-
 np_station/np_float_poly.py               | 16 +++---
 np_station/np_float_rectangle.py          |  2 +-
 np_station/np_point_array.py              |  4 +-
 np_station/np_point_copy.py               |  4 +-
 np_station/np_point_distance.py           |  8 +--
 np_station/np_point_instance.py           |  4 +-
 np_station/utils_graphics.py              |  4 +-
 oscurart_mesh_cache_tools.py              |  2 +-
 render_renderslot.py                      |  2 +-
 space_view3d_align_tools.py               |  2 +-
 space_view3d_enhanced_3d_cursor.py        | 20 ++++----
 space_view3d_paint_bprojection.py         | 14 +++---
 space_view3d_quickPrefs.py                | 61 ++++++++++++-----------
 space_view3d_toolshelf_menu.py            | 10 ++--
 sun_position/hdr.py                       |  2 +-
 sun_position/ui_sun.py                    |  8 +--
 41 files changed, 157 insertions(+), 156 deletions(-)

diff --git a/add_dimension.py b/add_dimension.py
index 6468d94d..92b29e8e 100644
--- a/add_dimension.py
+++ b/add_dimension.py
@@ -1447,7 +1447,7 @@ def ablength(x1 = 0.0, y1 = 0.0, z1 = 0.0, x2 = 0.0, y2 = 0.0, z2 = 0.0):
 def align_matrix(context, location):
 
     loc = Matrix.Translation(location)
-    obj_align = context.user_preferences.edit.object_align
+    obj_align = context.preferences.edit.object_align
     if (context.space_data.type == 'VIEW_3D'
         and obj_align == 'VIEW'):
         rot = context.space_data.region_3d.view_matrix.to_3x3().inverted().to_4x4()
@@ -2652,15 +2652,15 @@ class Dimension(bpy.types.Operator):
             bpy.context.scene.update()
 
         # turn off undo
-        undo = bpy.context.user_preferences.edit.use_global_undo
-        bpy.context.user_preferences.edit.use_global_undo = False
+        undo = bpy.context.preferences.edit.use_global_undo
+        bpy.context.preferences.edit.use_global_undo = False
 
         # main function
         self.align_matrix = align_matrix(context, self.Dimension_startlocation)
         main(self, self.align_matrix)
 
         # restore pre operator undo state
-        bpy.context.user_preferences.edit.use_global_undo = undo
+        bpy.context.preferences.edit.use_global_undo = undo
 
         return {'FINISHED'}
 
diff --git a/amaranth/animation/frame_current.py b/amaranth/animation/frame_current.py
index 24bd3953..8fc7c085 100644
--- a/amaranth/animation/frame_current.py
+++ b/amaranth/animation/frame_current.py
@@ -25,12 +25,12 @@ import bpy
 
 
 def button_frame_current(self, context):
-    get_addon = "amaranth" in context.user_preferences.addons.keys()
+    get_addon = "amaranth" in context.preferences.addons.keys()
     if not get_addon:
         return
 
     scene = context.scene
-    if context.user_preferences.addons["amaranth"].preferences.use_frame_current:
+    if context.preferences.addons["amaranth"].preferences.use_frame_current:
         self.layout.separator()
         self.layout.prop(scene, "frame_current", text="Set Current Frame")
 
diff --git a/amaranth/animation/jump_frames.py b/amaranth/animation/jump_frames.py
index 2d93e804..022ba03f 100644
--- a/amaranth/animation/jump_frames.py
+++ b/amaranth/animation/jump_frames.py
@@ -123,11 +123,11 @@ class AMTH_SCREEN_OT_frame_jump(Operator):
     def execute(self, context):
         scene = context.scene
 
-        get_addon = "amaranth" in context.user_preferences.addons.keys()
+        get_addon = "amaranth" in context.preferences.addons.keys()
         if not get_addon:
             return {"CANCELLED"}
 
-        preferences = context.user_preferences.addons["amaranth"].preferences
+        preferences = context.preferences.addons["amaranth"].preferences
 
         if preferences.use_framerate:
             framedelta = scene.render.fps
@@ -142,11 +142,11 @@ class AMTH_SCREEN_OT_frame_jump(Operator):
 
 
 def ui_userpreferences_edit(self, context):
-    get_addon = "amaranth" in context.user_preferences.addons.keys()
+    get_addon = "amaranth" in context.preferences.addons.keys()
     if not get_addon:
         return
 
-    preferences = context.user_preferences.addons["amaranth"].preferences
+    preferences = context.preferences.addons["amaranth"].preferences
 
     col = self.layout.column()
     split = col.split(percentage=0.21)
@@ -155,13 +155,13 @@ def ui_userpreferences_edit(self, context):
 
 
 def label(self, context):
-    get_addon = "amaranth" in context.user_preferences.addons.keys()
+    get_addon = "amaranth" in context.preferences.addons.keys()
     if not get_addon:
         return
 
     layout = self.layout
 
-    if context.user_preferences.addons["amaranth"].preferences.use_timeline_extra_info:
+    if context.preferences.addons["amaranth"].preferences.use_timeline_extra_info:
         row = layout.row(align=True)
 
         row.operator(AMTH_SCREEN_OT_keyframe_jump_inbetween.bl_idname,
diff --git a/amaranth/animation/timeline_extra_info.py b/amaranth/animation/timeline_extra_info.py
index 8419345d..0e875b43 100644
--- a/amaranth/animation/timeline_extra_info.py
+++ b/amaranth/animation/timeline_extra_info.py
@@ -23,14 +23,14 @@ import bpy
 
 
 def label_timeline_extra_info(self, context):
-    get_addon = "amaranth" in context.user_preferences.addons.keys()
+    get_addon = "amaranth" in context.preferences.addons.keys()
     if not get_addon:
         return
 
     layout = self.layout
     scene = context.scene
 
-    if context.user_preferences.addons["amaranth"].preferences.use_timeline_extra_info:
+    if context.preferences.addons["amaranth"].preferences.use_timeline_extra_info:
         row = layout.row(align=True)
 
         # Check for preview range
diff --git a/amaranth/node_editor/display_image.py b/amaranth/node_editor/display_image.py
index 5cc2e949..66d2f958 100644
--- a/amaranth/node_editor/display_image.py
+++ b/amaranth/node_editor/display_image.py
@@ -50,11 +50,11 @@ class AMTH_NODE_OT_show_active_node_image(bpy.types.Operator):
         select_node = bpy.ops.node.select(mouse_x=mlocx, mouse_y=mlocy, extend=False)
 
         if 'FINISHED' in select_node:  # Only run if we're clicking on a node
-            get_addon = "amaranth" in context.user_preferences.addons.keys()
+            get_addon = "amaranth" in context.preferences.addons.keys()
             if not get_addon:
                 return {"CANCELLED"}
 
-            preferences = context.user_preferences.addons["amaranth"].preferences
+            preferences = context.preferences.addons["amaranth"].preferences
             if preferences.use_image_node_display:
                 if context.active_node:
                     active_node = context.active_node
diff --git a/amaranth/scene/refresh.py b/amaranth/scene/refresh.py
index 39520789..d50bc199 100644
--- a/amaranth/scene/refresh.py
+++ b/amaranth/scene/refresh.py
@@ -31,11 +31,11 @@ class AMTH_SCENE_OT_refresh(bpy.types.Operator):
     bl_label = "Refresh!"
 
     def execute(self, context):
-        get_addon = "amaranth" in context.user_preferences.addons.keys()
+        get_addon = "amaranth" in context.preferences.addons.keys()
         if not get_addon:
             return {"CANCELLED"}
 
-        preferences = context.user_preferences.addons["amaranth"].preferences
+        preferences = context.preferences.addons["amaranth"].preferences
         scene = context.scene
 
         if preferences.use_scene_refresh:
@@ -47,11 +47,11 @@ class AMTH_SCENE_OT_refresh(bpy.types.Operator):
 
 
 def button_refresh(self, context):
-    get_addon = "amaranth" in context.user_preferences.addons.keys()
+    get_addon = "amaranth" in context.preferences.addons.keys()
     if not get_addon:
         return
 
-    if context.user_preferences.addons["amaranth"].preferences.use_scene_refresh:
+    if context.preferences.addons["amaranth"].preferences.use_scene_refresh:
         self.layout.separator()
         self.layout.operator(AMTH_SCENE_OT_refresh.bl_idname,
                              text="Refresh!",
diff --git a/amaranth/scene/save_reload.py b/amaranth/scene/save_reload.py
index 4f588c3a..7b961b64 100644
--- a/amaranth/scene/save_reload.py
+++ b/amaranth/scene/save_reload.py
@@ -47,11 +47,11 @@ class AMTH_WM_OT_save_reload(bpy.types.Operator):
 
 
 def button_save_reload(self, context):
-    get_addon = "amaranth" in context.user_preferences.addons.keys()
+    get_addon = "amaranth" in context.preferences.addons.keys()
     if not get_addon:
         return
 
-    if context.user_preferences.addons["amaranth"].preferences.use_file_save_reload:
+    if context.preferences.addons["amaranth"].preferences.use_file_save_reload:
         self.layout.separator()
         self.layout.operator(
             AMTH_WM_OT_save_reload.bl_idname,
diff --git a/amaranth/scene/stats.py b/amaranth/scene/stats.py
index 602cc23e..10d8be44 100644
--- a/amaranth/scene/stats.py
+++ b/amaranth/scene/stats.py
@@ -24,11 +24,11 @@ from amaranth import utils
 
 
 def stats_scene(self, context):
-    get_addon = "amaranth" in context.user_preferences.addons.keys()
+    get_addon = "amaranth" in context.preferences.addons.keys()
     if not get_addon:
         return
 
-    if context.user_preferences.addons["amaranth"].preferences.use_scene_stats:
+    if context.preferences.addons["amaranth"].preferences.use_scene_stats:
         scenes_count = str(len(bpy.data.scenes))
         cameras_count = str(len(bpy.data.cameras))
         cameras_selected = 0
diff --git a/animation_motion_trail.py b/animation_motion_trail.py
index d5598c2e..3579367e 100644
--- a/animation_motion_trail.py
+++ b/animation_motion_trail.py
@@ -312,8 +312,8 @@ def calc_callback(self, context):
     self.displayed = objects  # store, so it can be checked next time
     context.window_manager.motion_trail.force_update = False
     try:
-        global_undo = context.user_preferences.edit.use_global_undo
-        context.user_preferences.edit.use_global_undo = False
+        global_undo = context.preferences.edit.use_global_undo
+        context.preferences.edit.use_global_undo = False
 
         for action_ob, child, offset_ob in objects:
             if selection_change:
@@ -606,11 +606,11 @@ def calc_callback(self, context):
             if context.scene.frame_current != frame_old:
                 context.scene.frame_set(frame_old)
 
-        context.user_preferences.edit.use_global_undo = global_undo
+        context.preferences.edit.use_global_undo = global_undo
 
     except:
         # restore global undo in case of failure (see T52524)
-        context.user_preferences.edit.use_global_undo = global_undo
+        context.preferences.edit.use_global_undo = global_undo
 
 
 # draw in 3d-view
diff --git a/cacharanth/util.py b/cacharanth/util.py
index f8386fbd..7a9cd130 100644
--- a/cacharanth/util.py
+++ b/cacharanth/util.py
@@ -37,7 +37,7 @@ def round_sigfigs(num, sig_figs):
 class OperatorCallContext():
     def __enter__(self):
         scene = bpy.context.scene
-        prefs = bpy.context.user_preferences
+        prefs = bpy.context.preferences
 
         # store active/selected state to restore it after operator execution
         self.curact = scene.objects.active
@@ -52,7 +52,7 @@ class OperatorCallContext():
 
     def __exit__(self, exc_type, exc_value, traceback):
         scene = bpy.context.scene
-        prefs = bpy.context.user_preferences
+        prefs = bpy.context.preferences
 
         # restore active/selected state
         scene.objects.active = self.curact
diff --git a/cmu_mocap_browser/__init__.py b/cmu_mocap_browser/__init__.py
index db2b70ef..19912c09 100644
--- a/cmu_mocap_browser/__init__.py
+++ b/cmu_mocap_browser/__init__.py
@@ -62,7 +62,7 @@ class CMUMocapSubjectBrowser(bpy.types.Panel):
     def draw(self, context):
         data.initialize_subjects(context)
         layout = self.layout
-        cml = context.user_preferences.addons['cmu_mocap_browser'].preferences
+        cml = context.preferences.addons['cmu_mocap_browser'].preferences
         layout.template_list("UI_UL_list", "SB", cml, "subject_list",
             cml, "subject_active")
         layout.prop(cml, "subject_import_name")
@@ -100,7 +100,7 @@ class CMUMocapMotionBrowser(bpy.types.Panel):
 
     def draw(self, context):
         layout = self.layout
-        cml = context.user_preferences.addons['cmu_mocap_browser'].preferences
+        cml = context.preferences.addons['cmu_mocap_browser'].preferences
         layout.template_list("UI_UL_list", "MB", cml, "motion_list",
             cml, "motion_active")
         if cml.motion_active == -1:
@@ -153,7 +153,7 @@ class CMUMocapToMakeHuman(bpy.types.Panel):
 
     def draw(self, context):
         layout = self.layout
-        cml = context.user_preferences.addons['cmu_mocap_browser'].preferences
+        cml = context.preferences.addons['cmu_mocap_browser'].preferences
         layout.prop_search(cml, "floor", context.scene, "objects")
         layout.prop(cml, "feet_angle")
         layout.operator("object.cmu_align", text='Align armatures')
diff --git a/cmu_mocap_browser/data.py b/cmu_mocap_browser/data.py
index ddec7a4e..47536f65 100644
--- a/cmu_mocap_browser/data.py
+++ b/cmu_mocap_browser/data.py
@@ -24,7 +24,7 @@ def initialize_subjects(context):
     """
         Initializes the main object and the subject (actor) list
     """
-    cml = context.user_preferences.addons['cmu_mocap_browser'].preferences
+    cml = context.preferences.addons['cmu_mocap_browser'].preferences
     if hasattr(cml, 'initialized'):
         return
     cml.initialized = True
diff --git a/cmu_mocap_browser/download.py b/cmu_mocap_browser/download.py
index 0f30386b..f8d8e18a 100644
--- a/cmu_mocap_browser/download.py
+++ b/cmu_mocap_browser/download.py
@@ -96,13 +96,13 @@ class CMUMocapDownloadImport(bpy.types.Operator):
     def cancel(self, context):
         context.window_manager.event_timer_remove(self.timer)
         bpy.types.SpaceView3D.draw_handler_remove(self.handle, 'WINDOW')
-        cml = context.user_preferences.addons['cmu_mocap_browser'].preferences
+        cml = context.preferences.addons['cmu_mocap_browser'].preferences
         if os.path.exists(self.local_file):
             return self.import_or_open(cml)
         return {'CANCELLED'}
 
     def execute(self, context):
-        cml = context.user_preferences.addons['cmu_mocap_browser'].preferences
+        cml = context.preferences.addons['cmu_mocap_browser'].preferences
         if not os.path.exists(self.local_file):
             try:
                 os.makedirs(os.path.split(self.local_file)[0])
diff --git a/cmu_mocap_browser/makehuman.py b/cmu_mocap_browser/makehuman.py
index 466a40b3..7c8d8432 100644
--- a/cmu_mocap_browser/makehuman.py
+++ b/cmu_mocap_browser/makehuman.py
@@ -85,7 +85,7 @@ class CMUMocapAlignArmatures(bpy.types.Operator):
     bl_options = {'REGISTER', 'UNDO'}
 
     def execute(self, context):
-        cml = context.user_preferences.addons['cmu_mocap_browser'].preferences
+        cml = context.preferences.addons['cmu_mocap_browser'].preferences
         self.src, self.dst = scan_armatures(context)
         context.scene.frame_set(0)
 
@@ -232,7 +232,7 @@ class CMUMocapTransferer(bpy.types.Operator):
         return {'PASS_THROUGH'}
 
     def execute(self, context):
-        cml = context.user_preferences.addons['cmu_mocap_browser'].preferences
+        cml = context.preferences.addons['cmu_mocap_browser'].preferences
         self.src, self.dst = scan_armatures(context)
         DPB = self.dst.pose.bones
         self.set_inverses()
diff --git a/curve_tools/__init__.py b/curve_tools/__init__.py
index bae4300a..33aaa37c 100644
--- a/curve_tools/__init__.py
+++ b/curve_tools/__init__.py
@@ -375,7 +375,7 @@ def update_panel(self, context):
                 bpy.utils.unregister_class(panel)
 
         for panel in panels:
-            panel.bl_category = context.user_preferences.addons[__name__].preferences.category
+            panel.bl_category = context.preferences.addons[__name__].preferences.category
             bpy.utils.register_class(panel)
 
     except Exception as e:
diff --git a/data_overrides/util.py b/data_overrides/util.py
index a22cddbd..5e59d981 100644
--- a/data_overrides/util.py
+++ b/data_overrides/util.py
@@ -79,7 +79,7 @@ def id_data_enum_item(id_data):
 class OperatorCallContext():
     def __enter__(self):
         scene = bpy.context.scene
-        prefs = bpy.context.user_preferences
+        prefs = bpy.context.preferences
 
         # store active/selected state to restore it after operator execution
         self.curact = scene.objects.active
@@ -94,7 +94,7 @@ class OperatorCallContext():
 
     def __exit__(self, exc_type, exc_value, traceback):
         scene = bpy.context.scene
-        prefs = bpy.context.user_preferences
+        prefs = bpy.context.preferences
 
         # restore active/selected state
         scene.objects.active = self.curact
diff --git a/exact_edit/xedit_free_rotate.py b/exact_edit/xedit_free_rotate.py
index 013ada6c..89308175 100644
--- a/exact_edit/xedit_free_rotate.py
+++ b/exact_edit/xedit_free_rotate.py
@@ -151,7 +151,7 @@ class MenuStore:
 
 class MenuHandler:
     def __init__(self, title, tsize, act_colr, dis_colr, toolwid, reg):
-        self.dpi = bpy.context.user_preferences.system.dpi
+        self.dpi = bpy.context.preferences.system.dpi
         self.title = title
         # todo : better solution than None "magic numbers"
         self.menus = [None]  # no menu for 0
@@ -249,7 +249,7 @@ class MenuHandler:
 # === 3D View mouse location and button code ===
 class ViewButton():
     def __init__(self, colr_on, colr_off, txt_sz, txt_colr, offs=(0, 0)):
-        self.dpi = bpy.context.user_preferences.system.dpi
+        self.dpi = bpy.context.preferences.system.dpi
         self.is_drawn = False
         self.ms_over = False  # mouse over button
         self.wid = 0
@@ -979,7 +979,7 @@ def draw_callback_px(self, context):
                 if axis_pts is not None:
                     draw_line_2d(axis_pts[0], axis_pts[1], colr)
 
-                dpi = bpy.context.user_preferences.system.dpi
+                dpi = bpy.context.preferences.system.dpi
                 font_id, txt_sz = 0, 32
                 x_pos, y_pos = self.rtoolsw + 80, 36
                 bgl.glColor4f(*colr)
@@ -1042,7 +1042,7 @@ def exit_addon(self):
 def get_reg_overlap():
     rtoolsw = 0  # region tools (toolbar) width
     #ruiw = 0  # region ui (Number/n-panel) width
-    system = bpy.context.user_preferences.system
+    system = bpy.context.preferences.system
     if system.use_region_overlap:
         area = bpy.context.area
         for r in area.regions:
diff --git a/exact_edit/xedit_set_meas.py b/exact_edit/xedit_set_meas.py
index ea6f8f42..395677df 100644
--- a/exact_edit/xedit_set_meas.py
+++ b/exact_edit/xedit_set_meas.py
@@ -153,7 +153,7 @@ class MenuStore:
 
 class MenuHandler:
     def __init__(self, title, tsize, act_colr, dis_colr, toolwid, reg):
-        self.dpi = bpy.context.user_preferences.system.dpi
+        self.dpi = bpy.context.preferences.system.dpi
         self.title = title
         # todo : better solution than None "magic numbers"
         self.menus = [None, None]  # no menu for 0 or 1
@@ -346,7 +346,7 @@ class XEditMeasureInputPanel(bpy.types.Operator):
 # === 3D View mouse location and button code ===
 class ViewButton():
     def __init__(self, colr_on, colr_off, txt_sz, txt_colr, offs=(0, 0)):
-        self.dpi = bpy.context.user_preferences.system.dpi
+        self.dpi = bpy.context.preferences.system.dpi
         self.is_drawn = False
         self.ms_over = False  # mouse over button
         self.wid = 0
@@ -1470,7 +1470,7 @@ def draw_callback_px(self, context):
                 txt_colr = Colr.green
             elif RotDat.axis_lock == 'Z':
                 txt_colr = Colr.blue
-            dpi = bpy.context.user_preferences.system.dpi
+            dpi = bpy.context.preferences.system.dpi
             font_id, txt_sz = 0, 32
             x_pos, y_pos = self.rtoolsw + 80, 36
             bgl.glColor4f(*txt_colr)
@@ -1521,7 +1521,7 @@ def exit_addon(self):
 def get_reg_overlap():
     rtoolsw = 0  # region tools (toolbar) width
     #ruiw = 0  # region ui (Number/n-panel) width
-    system = bpy.context.user_preferences.system
+    system = bpy.context.preferences.system
     if system.use_region_overlap:
         area = bpy.context.area
         for r in area.regions:
diff --git a/io_import_LRO_Lola_MGS_Mola_img.py b/io_import_LRO_Lola_MGS_Mola_img.py
index 36d97dd4..e198e54c 100644
--- a/io_import_LRO_Lola_MGS_Mola_img.py
+++ b/io_import_LRO_Lola_MGS_Mola_img.py
@@ -65,8 +65,8 @@ from mathutils import *
 TO_RAD = math.pi / 180  # From degrees to radians
 
 # turning off relative path - it causes an error if it was true
-if bpy.context.user_preferences.filepaths.use_relative_paths == True:
-    bpy.context.user_preferences.filepaths.use_relative_paths = False
+if bpy.context.preferences.filepaths.use_relative_paths == True:
+    bpy.context.preferences.filepaths.use_relative_paths = False
 
 
 # A very simple "bridge" tool.
diff --git a/lighting_hdri_shortcut/__init__.py b/lighting_hdri_shortcut/__init__.py
index 8cf848fc..5804812c 100644
--- a/lighting_hdri_shortcut/__init__.py
+++ b/lighting_hdri_shortcut/__init__.py
@@ -553,8 +553,8 @@ class OBJECT_OT_load_img(bpy.types.Operator):
         global folder_path
         folder_path = '//'
         try:
-            user_preferences = bpy.context.user_preferences
-            addon_prefs = user_preferences.addons['lighting_hdri_shortcut'].preferences
+            preferences = bpy.context.preferences
+            addon_prefs = preferences.addons['lighting_hdri_shortcut'].preferences
             folder_path = addon_prefs.folder_path
         except:
             pass
@@ -621,8 +621,8 @@ class OBJECT_OT_addon_prefs(Operator):
     bl_options = {'REGISTER', 'UNDO'}
 
     def execute(self, context):
-        user_preferences = context.user_preferences
-        addon_prefs = user_preferences.addons[__name__].preferences
+        preferences = context.preferences
+        addon_prefs = preferences.addons[__name__].preferences
 
         info = ("Path: %s" %
                 (addon_prefs.folder_path))
diff --git a/mesh_ktools.py b/mesh_ktools.py
index 5b7a6246..cd74a001 100644
--- a/mesh_ktools.py
+++ b/mesh_ktools.py
@@ -1326,7 +1326,7 @@ class drawPoly(bpy.types.Operator):
             # restore selection mode and manipulator
             bpy.context.tool_settings.mesh_select_mode = self.sel_mode
             bpy.context.space_data.show_manipulator = self.manip
-            bpy.context.user_preferences.view.use_mouse_depth_cursor = self.cursor_depth
+            bpy.context.preferences.input.use_mouse_depth_cursor = self.cursor_depth
             bpy.context.scene.tool_settings.use_snap = self.snap
 
 
@@ -1350,7 +1350,7 @@ class drawPoly(bpy.types.Operator):
             # restore selection mode and manipulator
             bpy.context.tool_settings.mesh_select_mode = self.sel_mode
             bpy.context.space_data.show_manipulator = self.manip
-            bpy.context.user_preferences.view.use_mouse_depth_cursor = self.cursor_depth
+            bpy.context.preferences.input.use_mouse_depth_cursor = self.cursor_depth
             bpy.context.scene.tool_settings.use_snap = self.snap
 
 
@@ -1370,11 +1370,11 @@ class drawPoly(bpy.types.Operator):
             return {'PASS_THROUGH'}
 
         elif event.type == 'LEFT_CTRL' or event.type == 'RIGHT_CTRL' :
-            if bpy.context.user_preferences.view.use_mouse_depth_cursor == True:
-                bpy.context.user_preferences.view.use_mouse_depth_cursor = False
+            if bpy.context.preferences.input.use_mouse_depth_cursor == True:
+                bpy.context.preferences.input.use_mouse_depth_cursor = False
                 bpy.context.scene.tool_settings.use_snap = False
             else:
-                bpy.context.user_preferences.view.use_mouse_depth_cursor = True
+                bpy.context.preferences.input.use_mouse_depth_cursor = True
                 bpy.context.scene.tool_settings.use_snap = True
             return {'PASS_THROUGH'}
 
@@ -1413,8 +1413,8 @@ class drawPoly(bpy.types.Operator):
         bpy.context.tool_settings.mesh_select_mode = True, False, False
         self.manip = bpy.context.space_data.show_manipulator
         bpy.context.space_data.show_manipulator = False
-        self.cursor_depth = bpy.context.user_preferences.view.use_mouse_depth_cursor
-        bpy.context.user_preferences.view.use_mouse_depth_cursor = False
+        self.cursor_depth = bpy.context.preferences.input.use_mouse_depth_cursor
+        bpy.context.preferences.input.use_mouse_depth_cursor = False
         self.snap = bpy.context.scene.tool_settings.use_snap
         bpy.context.scene.tool_settings.use_snap = False
 
@@ -1445,28 +1445,28 @@ class toggleSilhouette(bpy.types.Operator):
     def execute(self, context):
 
 
-        light_check = bpy.context.user_preferences.system.solid_lights[0].use
+        light_check = bpy.context.preferences.system.solid_lights[0].use
 
         if light_check == True:
             # Set Lights to Off
-            bpy.context.user_preferences.system.solid_lights[0].use = False
-            bpy.context.user_preferences.system.solid_lights[1].use = False
+            bpy.context.preferences.system.solid_lights[0].use = False
+            bpy.context.preferences.system.solid_lights[1].use = False
 
             # Store variables
-            self.diff_col = bpy.context.user_preferences.system.solid_lights[2].diffuse_color
+            self.diff_col = bpy.context.preferences.system.solid_lights[2].diffuse_color
             self.disp_mode = bpy.context.space_data.viewport_shade
             self.matcap = bpy.context.space_data.use_matcap
             self.only_render = bpy.context.space_data.show_only_render
 
-            bpy.context.user_preferences.system.solid_lights[2].diffuse_color = 0,0,0
+            bpy.context.preferences.system.solid_lights[2].diffuse_color = 0,0,0
             bpy.context.space_data.viewport_shade = 'SOLID'
             bpy.context.space_data.use_matcap = False
             bpy.context.space_data.show_only_render = True
 
         else:
-            bpy.context.user_preferences.system.solid_lights[0].use = True
-            bpy.context.user_preferences.system.solid_lights[1].use = True
-            bpy.context.user_preferences.system.solid_lights[2].diffuse_color = self.diff_col
+            bpy.context.preferences.system.solid_lights[0].use = True
+            bpy.context.preferences.system.solid_lights[1].use = True
+            bpy.context.preferences.system.solid_lights[2].diffuse_color = self.diff_col
             bpy.context.space_data.viewport_shade = self.disp_mode
             bpy.context.space_data.use_matcap = self.matcap
             bpy.context.space_data.show_only_render = self.only_render
diff --git a/mesh_show_vgroup_weights.py b/mesh_show_vgroup_weights.py
index f36b5e49..738b10aa 100644
--- a/mesh_show_vgroup_weights.py
+++ b/mesh_show_vgroup_weights.py
@@ -46,7 +46,7 @@ def calc_callback(self, context):
         return
 
     # get color info from theme
-    acol = context.user_preferences.themes[0].view_3d.editmesh_active
+    acol = context.preferences.themes[0].view_3d.editmesh_active
     tcol = (acol[0] * 0.85, acol[1] * 0.85, acol[2] * 0.85)
 
     # get screen information
diff --git a/node_presets.py b/node_presets.py
index bf34f990..c1c7feff 100644
--- a/node_presets.py
+++ b/node_presets.py
@@ -106,8 +106,8 @@ def node_template_add(context, filepath, node_group, ungroup, report):
 # Node Template Prefs
 
 def node_search_path(context):
-    user_preferences = context.user_preferences
-    addon_prefs = user_preferences.addons[__name__].preferences
+    preferences = context.preferences
+    addon_prefs = preferences.addons[__name__].preferences
     dirpath = addon_prefs.search_path
     return dirpath
 
diff --git a/np_station/__init__.py b/np_station/__init__.py
index 74748440..218b1d1b 100644
--- a/np_station/__init__.py
+++ b/np_station/__init__.py
@@ -131,7 +131,7 @@ def update_panel(self, context):
                 bpy.utils.unregister_class(panel)
 
         for panel in panels:
-            panel.bl_category = context.user_preferences.addons[__package__].preferences.category
+            panel.bl_category = context.preferences.addons[__package__].preferences.category
             bpy.utils.register_class(panel)
 
     except Exception as e:
diff --git a/np_station/np_float_box.py b/np_station/np_float_box.py
index baa7bfc8..2d609d68 100644
--- a/np_station/np_float_box.py
+++ b/np_station/np_float_box.py
@@ -417,7 +417,7 @@ def DRAW_Overlay(self, context):
     np_print('DRAW_Overlay_START',';','NP020FB.flag = ', NP020FB.flag)
 
     '''
-    addon_prefs = context.user_preferences.addons[__package__].preferences
+    addon_prefs = context.preferences.addons[__package__].preferences
     badge = addon_prefs.npfb_badge
     badge_size = addon_prefs.npfb_badge_size
     dist_scale = addon_prefs.npfb_dist_scale
diff --git a/np_station/np_float_poly.py b/np_station/np_float_poly.py
index 81c01909..2f9c70da 100644
--- a/np_station/np_float_poly.py
+++ b/np_station/np_float_poly.py
@@ -268,7 +268,7 @@ def draw_callback_px_TRANS(self, context):
 
     np_print('04_callback_TRANS_START')
 
-    addon_prefs = context.user_preferences.addons[__package__].preferences
+    addon_prefs = context.preferences.addons[__package__].preferences
     point_markers = addon_prefs.npfp_point_markers
     point_size = addon_prefs.npfp_point_size
 
@@ -757,7 +757,7 @@ def draw_callback_px_NAV(self, context):
 
     np_print('05_callback_NAV_START')
 
-    addon_prefs = context.user_preferences.addons[__package__].preferences
+    addon_prefs = context.preferences.addons[__package__].preferences
     point_markers = addon_prefs.npfp_point_markers
     point_size = addon_prefs.npfp_point_size
 
@@ -1275,7 +1275,7 @@ class NPFPMakeSegment(bpy.types.Operator):
     bl_options = {'INTERNAL'}
 
     def execute(self, context):
-        addon_prefs = context.user_preferences.addons[__package__].preferences
+        addon_prefs = context.preferences.addons[__package__].preferences
         wire = addon_prefs.npfp_wire
         smooth = addon_prefs.npfp_smooth  # is this used ?
         material = addon_prefs.npfp_material
@@ -1378,7 +1378,7 @@ class NPFPDeletePoints(bpy.types.Operator):
     bl_options = {'INTERNAL'}
 
     def execute(self, context):
-        addon_prefs = context.user_preferences.addons[__package__].preferences  # is this used ?
+        addon_prefs = context.preferences.addons[__package__].preferences  # is this used ?
         dist = NP020FP.dist  # is this used ?
         polyob = NP020FP.polyob
         np_print('07_delete_points_START')
@@ -1426,7 +1426,7 @@ class NPFPMakeSurface(bpy.types.Operator):
     bl_options = {'INTERNAL'}
 
     def execute(self, context):
-        addon_prefs = context.user_preferences.addons[__package__].preferences
+        addon_prefs = context.preferences.addons[__package__].preferences
         smooth = addon_prefs.npfp_smooth
         dist = NP020FP.dist  # is this used ?
         polyob = NP020FP.polyob
@@ -1452,7 +1452,7 @@ def draw_callback_px_NAVEX(self, context):
 
     np_print('08_callback_NAVEX_START')
 
-    addon_prefs = context.user_preferences.addons[__package__].preferences
+    addon_prefs = context.preferences.addons[__package__].preferences
 
     #scale = addon_prefs.npfp_scale  # is this used ?
     #badge = addon_prefs.npfp_badge
@@ -1847,7 +1847,7 @@ def draw_callback_px_EXTRUDE(self, context):
 
     np_print('10_callback_EXTRUDE_START')
 
-    addon_prefs = context.user_preferences.addons[__package__].preferences
+    addon_prefs = context.preferences.addons[__package__].preferences
     #scale = addon_prefs.npfp_scale
     #badge = addon_prefs.npfp_badge  # is this used ?
     #point_size = addon_prefs.npfp_point_size  # is this used ?
@@ -2332,7 +2332,7 @@ class NPFPRunBevel(bpy.types.Operator):
 
     def invoke(self, context, event):
         np_print('11_run_BEVEL_INVOKE_a')
-        addon_prefs = context.user_preferences.addons[__package__].preferences
+        addon_prefs = context.preferences.addons[__package__].preferences
         bevel = addon_prefs.npfp_bevel
         selob = NP020FP.selob
         flag = NP020FP.flag
diff --git a/np_station/np_float_rectangle.py b/np_station/np_float_rectangle.py
index 509650c0..678884f2 100644
--- a/np_station/np_float_rectangle.py
+++ b/np_station/np_float_rectangle.py
@@ -414,7 +414,7 @@ def DRAW_Overlay(self, context):
     np_print('DRAW_Overlay_START',';','NP020FR.flag = ', NP020FR.flag)
 
     '''
-    addon_prefs = context.user_preferences.addons[__package__].preferences
+    addon_prefs = context.preferences.addons[__package__].preferences
     badge = addon_prefs.npfr_badge
     badge_size = addon_prefs.npfr_badge_size
     dist_scale = addon_prefs.npfr_dist_scale
diff --git a/np_station/np_point_array.py b/np_station/np_point_array.py
index da150fcd..6cfa3dcb 100644
--- a/np_station/np_point_array.py
+++ b/np_station/np_point_array.py
@@ -428,7 +428,7 @@ def DRAW_RunTranslate(self, context):
 
     np_print('04_DRAW_RunTrans_START',';','flag = ', NP020PA.flag)
 
-    addon_prefs = context.user_preferences.addons[__package__].preferences
+    addon_prefs = context.preferences.addons[__package__].preferences
 
     flag = NP020PA.flag
     takeloc3d = NP020PA.takeloc3d
@@ -896,7 +896,7 @@ def DRAW_ArrayTranslate(self, context):
 
     np_print('06a_DRAW_ArrayTrans_START',';','flag = ', NP020PA.flag)
 
-    addon_prefs = context.user_preferences.addons[__package__].preferences
+    addon_prefs = context.preferences.addons[__package__].preferences
 
 
 
diff --git a/np_station/np_point_copy.py b/np_station/np_point_copy.py
index 741dcb95..7e353d31 100644
--- a/np_station/np_point_copy.py
+++ b/np_station/np_point_copy.py
@@ -450,7 +450,7 @@ def DRAW_RunTranslate(self, context):
 
     np_print('04_DRAW_RunTrans_START',';','flag = ', NP020PC.flag)
 
-    addon_prefs = context.user_preferences.addons[__package__].preferences
+    addon_prefs = context.preferences.addons[__package__].preferences
 
     flag = NP020PC.flag
     takeloc3d = NP020PC.takeloc3d
@@ -976,7 +976,7 @@ def DRAW_ArrayTrans(self, context):
 
     np_print('06a_DRAW_ArrayTrans_START',';','flag = ', NP020PC.flag)
 
-    addon_prefs = context.user_preferences.addons[__package__].preferences
+    addon_prefs = context.preferences.addons[__package__].preferences
     badge = addon_prefs.nppc_badge
     badge_size = addon_prefs.nppc_badge_size
 
diff --git a/np_station/np_point_distance.py b/np_station/np_point_distance.py
index 3c22f144..1d85912e 100644
--- a/np_station/np_point_distance.py
+++ b/np_station/np_point_distance.py
@@ -256,7 +256,7 @@ def draw_callback_px_TRANS(self, context):
 
     np_print('04_callback_TRANS_START')
 
-    addon_prefs = context.user_preferences.addons[__package__].preferences
+    addon_prefs = context.preferences.addons[__package__].preferences
 
     scale = addon_prefs.nppd_scale
     badge = addon_prefs.nppd_badge
@@ -997,7 +997,7 @@ def draw_callback_px_NAV(self, context):
 
     np_print('05_callback_NAV_START')
 
-    addon_prefs = context.user_preferences.addons[__package__].preferences
+    addon_prefs = context.preferences.addons[__package__].preferences
 
     scale = addon_prefs.nppd_scale
     badge = addon_prefs.nppd_badge
@@ -1448,7 +1448,7 @@ class NP020PDHoldResult(bpy.types.Operator):
         flag = NP020PD.flag
         np_print('flag=', flag)
         np_print('07_HOLD_INVOKE_a')
-        addon_prefs = context.user_preferences.addons[__package__].preferences
+        addon_prefs = context.preferences.addons[__package__].preferences
         hold = addon_prefs.nppd_hold
         if hold:
             if context.area.type == 'VIEW_3D':
@@ -1479,7 +1479,7 @@ class NP020PDDeletePoints(bpy.types.Operator):
     bl_options = {'INTERNAL'}
 
     def execute(self, context):
-        addon_prefs = context.user_preferences.addons[__package__].preferences
+        addon_prefs = context.preferences.addons[__package__].preferences
         dist = NP020PD.dist
         step = addon_prefs.nppd_step
         info = addon_prefs.nppd_info
diff --git a/np_station/np_point_instance.py b/np_station/np_point_instance.py
index 710a0498..f640ff1d 100644
--- a/np_station/np_point_instance.py
+++ b/np_station/np_point_instance.py
@@ -461,7 +461,7 @@ def DRAW_RunTranslate(self, context):
 
     np_print('04_DRAW_RunTrans_START',';','flag = ', NP020PI.flag)
 
-    addon_prefs = context.user_preferences.addons[__package__].preferences
+    addon_prefs = context.preferences.addons[__package__].preferences
 
 
     flag = NP020PI.flag
@@ -986,7 +986,7 @@ def DRAW_ArrayTrans(self, context):
 
     np_print('06a_DRAW_ArrayTrans_START',';','flag = ', NP020PI.flag)
 
-    addon_prefs = context.user_preferences.addons[__package__].preferences
+    addon_prefs = context.preferences.addons[__package__].preferences
     badge = addon_prefs.nppi_badge
     badge_size = addon_prefs.nppi_badge_size
 
diff --git a/np_station/utils_graphics.py b/np_station/utils_graphics.py
index 24cae784..185ba826 100644
--- a/np_station/utils_graphics.py
+++ b/np_station/utils_graphics.py
@@ -40,7 +40,7 @@ class SettingsStore:
 # Use global SettingsStore class to store dict so it is not recreated each call
 # todo : come up with better way for storing and checking add-on settings
 def addon_settings_graph(key):
-    addon_prefs = bpy.context.user_preferences.addons[__package__].preferences
+    addon_prefs = bpy.context.preferences.addons[__package__].preferences
 
     if SettingsStore.add_set_graph_dict is not None:
         add_set_graph_dict = SettingsStore.add_set_graph_dict
@@ -146,7 +146,7 @@ def addon_settings_graph(key):
 def display_instructions(region, rv3d, instruct, keys_aff, keys_nav, keys_neg):
 
 
-    userpref = bpy.context.user_preferences
+    userpref = bpy.context.preferences
     system = userpref.system
     rwtools = 0
     rwui = 0
diff --git a/oscurart_mesh_cache_tools.py b/oscurart_mesh_cache_tools.py
index 598b6014..097ee5f8 100644
--- a/oscurart_mesh_cache_tools.py
+++ b/oscurart_mesh_cache_tools.py
@@ -384,7 +384,7 @@ def update_panel(self, context):
                 bpy.utils.unregister_class(panel)
 
         for panel in panels:
-            panel.bl_category = context.user_preferences.addons[__name__].preferences.category
+            panel.bl_category = context.preferences.addons[__name__].preferences.category
             bpy.utils.register_class(panel)
 
     except Exception as e:
diff --git a/render_renderslot.py b/render_renderslot.py
index 6aeadf4f..0cd8f5e6 100644
--- a/render_renderslot.py
+++ b/render_renderslot.py
@@ -99,7 +99,7 @@ def ui(self, context):
     row.alignment = 'LEFT'
     try:
         active = bpy.data.images['Render Result'].render_slots.active_index
-        if bpy.context.user_preferences.addons[__name__].preferences.advanced_mode:
+        if bpy.context.preferences.addons[__name__].preferences.advanced_mode:
             row.prop(scn, 'ktx_auto_advance_slot', text='Auto Advance')
         row = layout.row(align=True)
         row.alignment = 'EXPAND'
diff --git a/space_view3d_align_tools.py b/space_view3d_align_tools.py
index f9f24b49..6f8bd564 100644
--- a/space_view3d_align_tools.py
+++ b/space_view3d_align_tools.py
@@ -1104,7 +1104,7 @@ def update_panel(self, context):
                 bpy.utils.unregister_class(panel)
 
         for panel in panels:
-            panel.bl_category = context.user_preferences.addons[__name__].preferences.category
+            panel.bl_category = context.preferences.addons[__name__].preferences.category
             bpy.utils.register_class(panel)
 
     except Exception as e:
diff --git a/space_view3d_enhanced_3d_cursor.py b/space_view3d_enhanced_3d_cursor.py
index 7afa1ad1..c7cbe956 100644
--- a/space_view3d_enhanced_3d_cursor.py
+++ b/space_view3d_enhanced_3d_cursor.py
@@ -545,8 +545,8 @@ class EnhancedSetCursor(bpy.types.Operator):
         if use_snap:
             snap_type = tool_settings.snap_element
         else:
-            userprefs_view = context.user_preferences.view
-            if userprefs_view.use_mouse_depth_cursor:
+            userprefs_input = context.preferences.input
+            if userprefs_input.use_mouse_depth_cursor:
                 # Suggested by Lissanro in the forum
                 use_snap = True
                 snap_type = 'FACE'
@@ -1181,7 +1181,7 @@ class EnhancedSetCursor(bpy.types.Operator):
 
         v3d = context.space_data
 
-        userprefs_view = context.user_preferences.view
+        userprefs_view = context.preferences.view
 
         tool_settings = context.tool_settings
 
@@ -1195,7 +1195,7 @@ class EnhancedSetCursor(bpy.types.Operator):
         font_size = 11
         blf.size(font_id, font_size, 72) # font, point size, dpi
 
-        tet = context.user_preferences.themes[0].text_editor
+        tet = context.preferences.themes[0].text_editor
 
         # Prepare the table...
         if self.transform_mode == 'MOVE':
@@ -2943,7 +2943,7 @@ class ToggleObjectMode:
 
     def __enter__(self):
         if self.mode:
-            edit_preferences = bpy.context.user_preferences.edit
+            edit_preferences = bpy.context.preferences.edit
 
             self.global_undo = edit_preferences.use_global_undo
             self.prev_mode = bpy.context.object.mode
@@ -2956,7 +2956,7 @@ class ToggleObjectMode:
 
     def __exit__(self, type, value, traceback):
         if self.mode:
-            edit_preferences = bpy.context.user_preferences.edit
+            edit_preferences = bpy.context.preferences.edit
 
             if self.prev_mode != self.mode:
                 bpy.ops.object.mode_set(mode=self.prev_mode)
@@ -3965,7 +3965,7 @@ class BookmarkLibraryProp(bpy.types.PropertyGroup):
             smooth_prev = gl_get(bgl.GL_SMOOTH)
 
             pixelsize = 1
-            dpi = context.user_preferences.system.dpi
+            dpi = context.preferences.system.dpi
             widget_unit = (pixelsize * dpi * 20.0 + 36.0) / 72.0
 
             bgl.glShadeModel(bgl.GL_SMOOTH)
@@ -5355,7 +5355,7 @@ def draw_callback_view(self, context):
         rv3d = context.region_data
 
         pixelsize = 1
-        dpi = context.user_preferences.system.dpi
+        dpi = context.preferences.system.dpi
         widget_unit = (pixelsize * dpi * 20.0 + 36.0) / 72.0
 
         cursor_w = widget_unit*2
@@ -5563,7 +5563,7 @@ def update_keymap(activate):
     cur_idname = 'view3d.cursor3d'
 
     wm = bpy.context.window_manager
-    userprefs = bpy.context.user_preferences
+    userprefs = bpy.context.preferences
     settings = find_settings()
 
     auto_register_keymaps = settings.auto_register_keymaps
@@ -5615,7 +5615,7 @@ def scene_update_post_kmreg(scene):
 @bpy.app.handlers.persistent
 def scene_load_post(*args):
     wm = bpy.context.window_manager
-    userprefs = bpy.context.user_preferences
+    userprefs = bpy.context.preferences
     addon_prefs = userprefs.addons[__name__].preferences
     wm.cursor_3d_runtime_settings.use_cursor_monitor = \
         addon_prefs.use_cursor_monitor
diff --git a/space_view3d_paint_bprojection.py b/space_view3d_paint_bprojection.py
index 751f9bc8..2660e56a 100644
--- a/space_view3d_paint_bprojection.py
+++ b/space_view3d_paint_bprojection.py
@@ -1924,17 +1924,17 @@ class RotateView3D(Operator):
             return {'FINISHED'}
 
         if event.type == 'MOUSEMOVE':
-            if context.user_preferences.inputs.view_rotate_method == 'TRACKBALL':
+            if context.preferences.inputs.view_rotate_method == 'TRACKBALL':
                 self.tracball(context, event.mouse_region_x, event.mouse_region_y, ob.location)
             else:
                 self.turnable(context, event.mouse_region_x, event.mouse_region_y, ob.location)
             align_to_view(context)
             # to unlock the camera
             if self.first_time:
-                rot_ang = context.user_preferences.view.rotation_angle
-                context.user_preferences.view.rotation_angle = 0
+                rot_ang = context.preferences.view.rotation_angle
+                context.preferences.view.rotation_angle = 0
                 bpy.ops.view3d.view_orbit(type='ORBITLEFT')
-                context.user_preferences.view.rotation_angle = rot_ang
+                context.preferences.view.rotation_angle = rot_ang
                 bpy.ops.view3d.view_persportho()
                 bpy.ops.view3d.view_persportho()
                 self.first_time = False
@@ -2097,11 +2097,11 @@ class PresetView3D(Operator):
         pos_init = sd.region_3d.view_location - origine
         sd.region_3d.view_location = origine
 
-        tmp = context.user_preferences.view.smooth_view
-        context.user_preferences.view.smooth_view = 0
+        tmp = context.preferences.view.smooth_view
+        context.preferences.view.smooth_view = 0
         bpy.ops.view3d.viewnumpad(type=self.view)
         align_to_view(context)
-        context.user_preferences.view.smooth_view = tmp
+        context.preferences.view.smooth_view = tmp
 
         vr_a = sd.region_3d.view_rotation.copy()
         pos_init.rotate(vr_a * vr_b)
diff --git a/space_view3d_quickPrefs.py b/space_view3d_quickPrefs.py
index 90a2d2a6..4c0b847e 100644
--- a/space_view3d_quickPrefs.py
+++ b/space_view3d_quickPrefs.py
@@ -163,7 +163,7 @@ def gllightpreset_importsingle(filename):
             spec2b=strArray[2]
 
             #set the variables
-            system=bpy.context.user_preferences.system
+            system=bpy.context.preferences.system
             system.solid_lights[0].use=illumination0
             system.solid_lights[1].use=illumination1
             system.solid_lights[2].use=illumination2
@@ -290,7 +290,7 @@ def gllightpreset_exportsingle(index, multiimport):
 
 def gllightpreset_addPresets():
 
-    system=bpy.context.user_preferences.system
+    system=bpy.context.preferences.system
 
     system.solid_lights[0].use=True
     system.solid_lights[1].use=True
@@ -540,42 +540,42 @@ def gllightpreset_save():
     index=bpy.context.scene.quickprefs.gllightpreset_index
     name=bpy.context.scene.quickprefs.gllightpreset[index].name
 
-    bpy.context.scene.quickprefs.gllightpreset[index].illuminated0 = bpy.context.user_preferences.system.solid_lights[0].use
-    bpy.context.scene.quickprefs.gllightpreset[index].illuminated1 = bpy.context.user_preferences.system.solid_lights[1].use
-    bpy.context.scene.quickprefs.gllightpreset[index].illuminated2 = bpy.context.user_preferences.system.solid_lights[2].use
+    bpy.context.scene.quickprefs.gllightpreset[index].illuminated0 = bpy.context.preferences.system.solid_lights[0].use
+    bpy.context.scene.quickprefs.gllightpreset[index].illuminated1 = bpy.context.preferences.system.solid_lights[1].use
+    bpy.context.scene.quickprefs.gllightpreset[index].illuminated2 = bpy.context.preferences.system.solid_lights[2].use
 
-    bpy.context.scene.quickprefs.gllightpreset[index].direction0 = bpy.context.user_preferences.system.solid_lights[0].direction
-    bpy.context.scene.quickprefs.gllightpreset[index].direction1 = bpy.context.user_preferences.system.solid_lights[1].direction
-    bpy.context.scene.quickprefs.gllightpreset[index].direction2 = bpy.context.user_preferences.system.solid_lights[2].direction
+    bpy.context.scene.quickprefs.gllightpreset[index].direction0 = bpy.context.preferences.system.solid_lights[0].direction
+    bpy.context.scene.quickprefs.gllightpreset[index].direction1 = bpy.context.preferences.system.solid_lights[1].direction
+    bpy.context.scene.quickprefs.gllightpreset[index].direction2 = bpy.context.preferences.system.solid_lights[2].direction
 
-    bpy.context.scene.quickprefs.gllightpreset[index].diffuse0 = bpy.context.user_preferences.system.solid_lights[0].diffuse_color
-    bpy.context.scene.quickprefs.gllightpreset[index].diffuse1 = bpy.context.user_preferences.system.solid_lights[1].diffuse_color
-    bpy.context.scene.quickprefs.gllightpreset[index].diffuse2 = bpy.context.user_preferences.system.solid_lights[2].diffuse_color
+    bpy.context.scene.quickprefs.gllightpreset[index].diffuse0 = bpy.context.preferences.system.solid_lights[0].diffuse_color
+    bpy.context.scene.quickprefs.gllightpreset[index].diffuse1 = bpy.context.preferences.system.solid_lights[1].diffuse_color
+    bpy.context.scene.quickprefs.gllightpreset[index].diffuse2 = bpy.context.preferences.system.solid_lights[2].diffuse_color
 
-    bpy.context.scene.quickprefs.gllightpreset[index].specular0 = bpy.context.user_preferences.system.solid_lights[0].specular_color
-    bpy.context.scene.quickprefs.gllightpreset[index].specular1 = bpy.context.user_preferences.system.solid_lights[1].specular_color
-    bpy.context.scene.quickprefs.gllightpreset[index].specular2 = bpy.context.user_preferences.system.solid_lights[2].specular_color
+    bpy.context.scene.quickprefs.gllightpreset[index].specular0 = bpy.context.preferences.system.solid_lights[0].specular_color
+    bpy.context.scene.quickprefs.gllightpreset[index].specular1 = bpy.context.preferences.system.solid_lights[1].specular_color
+    bpy.context.scene.quickprefs.gllightpreset[index].specular2 = bpy.context.preferences.system.solid_lights[2].specular_color
 
 #select the current light
 def gllightpreset_select():
     index=bpy.context.scene.quickprefs.gllightpreset_index
     name=bpy.context.scene.quickprefs.gllightpreset[index].name
 
-    bpy.context.user_preferences.system.solid_lights[0].use=bpy.context.scene.quickprefs.gllightpreset[index].illuminated0
-    bpy.context.user_preferences.system.solid_lights[1].use=bpy.context.scene.quickprefs.gllightpreset[index].illuminated1
-    bpy.context.user_preferences.system.solid_lights[2].use=bpy.context.scene.quickprefs.gllightpreset[index].illuminated2
+    bpy.context.preferences.system.solid_lights[0].use=bpy.context.scene.quickprefs.gllightpreset[index].illuminated0
+    bpy.context.preferences.system.solid_lights[1].use=bpy.context.scene.quickprefs.gllightpreset[index].illuminated1
+    bpy.context.preferences.system.solid_lights[2].use=bpy.context.scene.quickprefs.gllightpreset[index].illuminated2
 
-    bpy.context.user_preferences.system.solid_lights[0].direction=bpy.context.scene.quickprefs.gllightpreset[index].direction0
-    bpy.context.user_preferences.system.solid_lights[1].direction=bpy.context.scene.quickprefs.gllightpreset[index].direction1
-    bpy.context.user_preferences.system.solid_lights[2].direction=bpy.context.scene.quickprefs.gllightpreset[index].direction2
+    bpy.context.preferences.system.solid_lights[0].direction=bpy.context.scene.quickprefs.gllightpreset[index].direction0
+    bpy.context.preferences.system.solid_lights[1].direction=bpy.context.scene.quickprefs.gllightpreset[index].direction1
+    bpy.context.preferences.system.solid_lights[2].direction=bpy.context.scene.quickprefs.gllightpreset[index].direction2
 
-    bpy.context.user_preferences.system.solid_lights[0].diffuse_color=bpy.context.scene.quickprefs.gllightpreset[index].diffuse0
-    bpy.context.user_preferences.system.solid_lights[1].diffuse_color=bpy.context.scene.quickprefs.gllightpreset[index].diffuse1
-    bpy.context.user_preferences.system.solid_lights[2].diffuse_color=bpy.context.scene.quickprefs.gllightpreset[index].diffuse2
+    bpy.context.preferences.system.solid_lights[0].diffuse_color=bpy.context.scene.quickprefs.gllightpreset[index].diffuse0
+    bpy.context.preferences.system.solid_lights[1].diffuse_color=bpy.context.scene.quickprefs.gllightpreset[index].diffuse1
+    bpy.context.preferences.system.solid_lights[2].diffuse_color=bpy.context.scene.quickprefs.gllightpreset[index].diffuse2
 
-    bpy.context.user_preferences.system.solid_lights[0].specular_color=bpy.context.scene.quickprefs.gllightpreset[index].specular0
-    bpy.context.user_preferences.system.solid_lights[1].specular_color=bpy.context.scene.quickprefs.gllightpreset[index].specular1
-    bpy.context.user_preferences.system.solid_lights[2].specular_color=bpy.context.scene.quickprefs.gllightpreset[index].specular2
+    bpy.context.preferences.system.solid_lights[0].specular_color=bpy.context.scene.quickprefs.gllightpreset[index].specular0
+    bpy.context.preferences.system.solid_lights[1].specular_color=bpy.context.scene.quickprefs.gllightpreset[index].specular1
+    bpy.context.preferences.system.solid_lights[2].specular_color=bpy.context.scene.quickprefs.gllightpreset[index].specular2
 
 #sort alphabetically
 def gllightpreset_sort():
@@ -745,9 +745,10 @@ class PANEL(bpy.types.Panel):
 
         #aliases
         scn = bpy.context.scene.quickprefs
-        system = context.user_preferences.system
-        inputs = context.user_preferences.inputs
-        edit = context.user_preferences.edit
+        system = context.preferences.system
+        inputs = context.preferences.inputs
+        edit = context.preferences.edit
+        view = context.preferences.view
         layout = self.layout
         split = layout.split()
 
@@ -846,7 +847,7 @@ class PANEL(bpy.types.Panel):
             boxrow=box.row()
             boxrow.label(text="Color Picker Type")
             boxrow=box.row()
-            boxrow.row().prop(system, "color_picker_type", text="")
+            boxrow.row().prop(view, "color_picker_type", text="")
 
             #Align To
             boxrow=box.row()
diff --git a/space_view3d_toolshelf_menu.py b/space_view3d_toolshelf_menu.py
index 53613242..c594c932 100644
--- a/space_view3d_toolshelf_menu.py
+++ b/space_view3d_toolshelf_menu.py
@@ -2902,7 +2902,7 @@ class SnapCursSelToCenter2(Operator):
 
 # Draw Separator #
 def UseSeparator(operator, context):
-    useSep = bpy.context.user_preferences.addons[__name__].preferences.use_separators
+    useSep = bpy.context.preferences.addons[__name__].preferences.use_separators
     if useSep:
         operator.layout.separator()
 
@@ -2910,7 +2910,7 @@ def UseSeparator(operator, context):
 # Use compact brushes menus #
 def UseBrushesLists():
     # separate function just for more convience
-    useLists = bpy.context.user_preferences.addons[__name__].preferences.use_brushes_lists
+    useLists = bpy.context.preferences.addons[__name__].preferences.use_brushes_lists
 
     return bool(useLists)
 
@@ -2946,12 +2946,12 @@ def update_panel(self, context):
         bpy.utils.unregister_class(VIEW3D_PT_Toolshelf_menu)
     except:
         pass
-    VIEW3D_PT_Toolshelf_menu.bl_category = context.user_preferences.addons[__name__].preferences.category
+    VIEW3D_PT_Toolshelf_menu.bl_category = context.preferences.addons[__name__].preferences.category
     bpy.utils.register_class(VIEW3D_PT_Toolshelf_menu)
 
 # Draw Separator #
 def UseSeparator(operator, context):
-    useSep = bpy.context.user_preferences.addons[__name__].preferences.use_separators
+    useSep = bpy.context.preferences.addons[__name__].preferences.use_separators
     if useSep:
         operator.layout.separator()
 
@@ -2959,7 +2959,7 @@ def UseSeparator(operator, context):
 # Use compact brushes menus #
 def UseBrushesLists():
     # separate function just for more convience
-    useLists = bpy.context.user_preferences.addons[__name__].preferences.use_brushes_lists
+    useLists = bpy.context.preferences.addons[__name__].preferences.use_brushes_lists
 
     return bool(useLists)
 
diff --git a/sun_position/hdr.py b/sun_position/hdr.py
index f497d259..383ba245 100644
--- a/sun_position/hdr.py
+++ b/sun_position/hdr.py
@@ -552,7 +552,7 @@ def Hdr_load_callback(self, context):
             else:
                 envTex.texture_mapping.rotation.z = 0.0
                 projection = envTex.projection
-                prefs = bpy.context.user_preferences
+                prefs = bpy.context.preferences
                 fileName = prefs.filepaths.temporary_directory + "tmpSun.png"
 
                 st = envTex.image.copy()
diff --git a/sun_position/ui_sun.py b/sun_position/ui_sun.py
index faa59e78..cfc31e56 100644
--- a/sun_position/ui_sun.py
+++ b/sun_position/ui_sun.py
@@ -42,10 +42,10 @@ class SunPos_Panel(bpy.types.Panel):
     def disable(self, context, layout):
         p = context.scene.SunPos_pref_property
         if Map.init_zoom_preference:
-            Map.zoom_preferences(bpy.context.user_preferences.inputs.invert_zoom_wheel,
-                                 bpy.context.user_preferences.inputs.invert_mouse_zoom)
-            Hdr.zoom_preferences(bpy.context.user_preferences.inputs.invert_zoom_wheel,
-                                 bpy.context.user_preferences.inputs.invert_mouse_zoom)
+            Map.zoom_preferences(bpy.context.preferences.inputs.invert_zoom_wheel,
+                                 bpy.context.preferences.inputs.invert_mouse_zoom)
+            Hdr.zoom_preferences(bpy.context.preferences.inputs.invert_zoom_wheel,
+                                 bpy.context.preferences.inputs.invert_mouse_zoom)
         row = self.layout.row()
         if p.UseOneColumn:
             col1 = row.column()
-- 
GitLab