Skip to content

Commit

Permalink
Provide a default instance if none
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo committed Dec 1, 2023
1 parent 4e450f0 commit 595f826
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion addons/io_hubs_addon/debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ def poll(cls, context: Context):
def execute(self, context):
prefs = get_addon_pref(context)
prefs.hubs_instances.remove(prefs.hubs_instance_idx)
prefs.hubs_instances = len(prefs.hubs_instances) - 1
prefs.hubs_instance_idx = len(prefs.hubs_instances) - 1
bpy.ops.wm.save_userpref()

return {'FINISHED'}
Expand Down
6 changes: 6 additions & 0 deletions addons/io_hubs_addon/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,12 @@ def register():
bpy.utils.register_class(UninstallDepsOperator)
bpy.utils.register_class(DeleteProfileOperator)

prefs = get_addon_pref(bpy.context)
if len(prefs.hubs_instances) == 0:
new_instance = prefs.hubs_instances.add()
new_instance.url = "https://hubs.mozilla.com/demo"
prefs.hubs_instance_idx = len(prefs.hubs_instances) - 1


def unregister():
bpy.utils.unregister_class(DeleteProfileOperator)
Expand Down

0 comments on commit 595f826

Please sign in to comment.