2727from  .presets  import  TreePresetLoadMenu , TreePresetRemoveMenu , SaveTreePresetOperator , InstallTreePresetOperator , RemoveTreePresetOperator , LoadTreePresetOperator 
2828from  .logo  import  display_logo 
2929from  .wind_setup_utils  import  WindOperator , MakeControllerOperator , MakeTerrainOperator 
30- from  .check_for_updates  import  CheckForUpdates 
3130from  .addon_name  import  save_addon_name 
3231
32+ # third party add-on updater 
33+ from  . import  addon_updater_ops 
34+ 
3335bl_info  =  {
3436    "name" : "Modular trees" ,
3537    "author" : "Herpin Maxime, Jake Dube" ,
36-     "version" : (2 , 7 ),
38+     "version" : (2 , 7 ,  3 ),
3739    "blender" : (2 , 77 , 0 ),
3840    "location" : "View3D > Tools > Tree > Make Tree" ,
3941    "description" : "Generates an organic tree with correctly modeled branching." ,
@@ -69,6 +71,40 @@ class TreeAddonPrefs(AddonPreferences):
6971        description = "Preset File" ,
7072        subtype = 'FILE_PATH' )
7173
74+     # third party add-on updater 
75+     auto_check_update  =  bpy .props .BoolProperty (
76+         name = "Auto-check for Update" ,
77+         description = "If enabled, auto-check for updates using an interval" ,
78+         default = False ,
79+     )
80+ 
81+     updater_intrval_months  =  bpy .props .IntProperty (
82+         name = 'Months' ,
83+         description = "Number of months between checking for updates" ,
84+         default = 0 ,
85+         min = 0 
86+     )
87+     updater_intrval_days  =  bpy .props .IntProperty (
88+         name = 'Days' ,
89+         description = "Number of days between checking for updates" ,
90+         default = 14 ,
91+         min = 0 ,
92+     )
93+     updater_intrval_hours  =  bpy .props .IntProperty (
94+         name = 'Hours' ,
95+         description = "Number of hours between checking for updates" ,
96+         default = 0 ,
97+         min = 0 ,
98+         max = 23 
99+     )
100+     updater_intrval_minutes  =  bpy .props .IntProperty (
101+         name = 'Minutes' ,
102+         description = "Number of minutes between checking for updates" ,
103+         default = 0 ,
104+         min = 0 ,
105+         max = 59 
106+     )
107+ 
72108    def  draw (self , context ):
73109        layout  =  self .layout 
74110
@@ -83,13 +119,14 @@ def draw(self, context):
83119            "https://github.com/MaximeHerpin/modular_tree/wiki/Roadmap" 
84120        row .operator ("wm.url_open" , text = "Official Discussion Forum" , icon = 'QUESTION' ).url  =  \
85121            "https://blenderartists.org/forum/showthread.php?405377-Addon-Modular-Tree" 
86-         row .operator ("mod_tree.check_for_updates" , icon = 'RADIO' )
87122
88123        box  =  layout .box ()
89124        box .label ("Preset Installer" )
90125        box .prop (self , 'preset_file' )
91126        box .operator ("mod_tree.install_preset" )
92127
128+         addon_updater_ops .update_settings_ui (self , context )
129+ 
93130
94131class  MakeTreePanel (Panel ):
95132    bl_label  =  "Make Tree" 
@@ -122,6 +159,8 @@ def draw(self, context):
122159            if  mtree_props .finish_unwrap :
123160                box .prop (mtree_props , "unwrap_end_iteration" )
124161
162+         addon_updater_ops .update_notice_box_ui (self , context )
163+ 
125164
126165class  BatchTreePanel (Panel ):
127166    bl_label  =  "Batch Tree Generation" 
@@ -131,7 +170,7 @@ class BatchTreePanel(Panel):
131170    bl_context  =  "objectmode" 
132171    bl_category  =  'Tree' 
133172    bl_options  =  {'DEFAULT_CLOSED' }
134-      
173+ 
135174    def  draw (self , context ):
136175        mtree_props  =  context .scene .mtree_props 
137176        layout  =  self .layout 
@@ -143,7 +182,7 @@ def draw(self, context):
143182        box .prop (mtree_props , "batch_radius_randomness" )
144183        box .prop_search (mtree_props , "batch_group_name" , bpy .data , "groups" )
145184        box .prop (mtree_props , "batch_space" )
146-   
185+ 
147186
148187class  RootsAndTrunksPanel (Panel ):
149188    bl_label  =  "Roots and Trunk" 
@@ -285,7 +324,7 @@ def draw(self, context):
285324        row  =  layout .row ()
286325        row .scale_y  =  1.5 
287326        row .operator ("mod_tree.add_twig" , icon = "SCULPTMODE_HLT" )
288-          
327+ 
289328        row  =  layout .row ()
290329        row .scale_y  =  1.5 
291330        row .operator ("mod_tree.update_twig" , icon = "FILE_REFRESH" )
@@ -297,7 +336,7 @@ def draw(self, context):
297336        box .prop (mtree_props , "TwigSeedProp" )
298337        box .prop (mtree_props , "twig_iteration" )
299338        box .prop_search (mtree_props , "twig_bark_material" , bpy .data , "materials" )
300-         box .prop_search (mtree_props , "twig_leaf_material" , bpy .data , "materials" )            
339+         box .prop_search (mtree_props , "twig_leaf_material" , bpy .data , "materials" )
301340
302341
303342class  MakeTreePresetsPanel (Panel ):
@@ -596,8 +635,7 @@ class ModularTreePropertyGroup(PropertyGroup):
596635           MakeControllerOperator , MakeTerrainOperator ,
597636           MakeTreePanel , BatchTreePanel , RootsAndTrunksPanel , TreeBranchesPanel , AdvancedSettingsPanel ,
598637           MakeTwigPanel , TreePresetLoadMenu , TreePresetRemoveMenu , WindAnimationPanel , MakeTreePresetsPanel ,
599-            InstallTreePresetOperator , CheckForUpdates ,
600-            TreeAddonPrefs , ModularTreePropertyGroup ]
638+            InstallTreePresetOperator , TreeAddonPrefs , ModularTreePropertyGroup ]
601639
602640prefix  =  "https://github.com/MaximeHerpin/modular_tree/wiki/" 
603641documentation_mapping  =  (
@@ -688,6 +726,8 @@ def doc_map():
688726def  register ():
689727    save_addon_name (__name__ )
690728
729+     addon_updater_ops .register (bl_info )
730+ 
691731    # register all classes 
692732    for  i  in  classes :
693733        bpy .utils .register_class (i )
@@ -700,6 +740,8 @@ def register():
700740
701741
702742def  unregister ():
743+     addon_updater_ops .unregister ()
744+ 
703745    # unregister all classes 
704746    for  i  in  classes :
705747        bpy .utils .unregister_class (i )
0 commit comments