Skip to content

Commit

Permalink
Added a button to load webpage
Browse files Browse the repository at this point in the history
  • Loading branch information
djmonkeyuk committed Sep 29, 2019
1 parent 9fb09de commit 857b616
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
5 changes: 5 additions & 0 deletions release_notes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
release 1.1.3
-------------

* Added a "Get More Presets..." button that opens the directory web-page for community made presets.

release 1.1.2
-------------

Expand Down
19 changes: 16 additions & 3 deletions src/no_mans_sky_base_builder/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "No Mans Sky Base Builder",
"description": "A tool to assist with base building in No Mans Sky",
"author": "Charlie Banks",
"version": (1, 1, 2),
"version": (1, 1, 3),
"blender": (2, 80, 0),
"location": "3D View > Tools",
"warning": "", # used for warning icon and text in addons panel
Expand All @@ -15,6 +15,7 @@
import json
import os
import sys
import webbrowser

import bpy
import bpy.utils
Expand All @@ -31,7 +32,6 @@
PointerProperty, StringProperty)
from bpy.types import Operator, Panel, PropertyGroup


FILE_PATH = os.path.dirname(os.path.realpath(__file__))
USER_PATH = os.path.join(os.path.expanduser("~"), "NoMansSkyBaseBuilder")
PRESET_PATH = os.path.join(USER_PATH, "presets")
Expand Down Expand Up @@ -796,7 +796,9 @@ def draw(self, context):
scene = context.scene
nms_tool = scene.nms_base_tool
layout.prop(nms_tool, "enum_switch", expand=True)
layout.operator("nms.save_as_preset", icon="SCENE_DATA")
col = layout.column(align=True)
col.operator("nms.save_as_preset", icon="SCENE_DATA")
col.operator("nms.get_more_presets", icon="SCENE_DATA")
part_list = layout.template_list(
"NMS_UL_actions_list",
"compact",
Expand Down Expand Up @@ -1008,6 +1010,7 @@ def execute(self, context):


class SaveAsPreset(bpy.types.Operator):
"""Save the current scene contents as a new Preset"""
bl_idname = "nms.save_as_preset"
bl_label = "Save As Preset"
preset_name: bpy.props.StringProperty(name="Preset Name")
Expand All @@ -1029,6 +1032,15 @@ def invoke(self, context, event):
return wm.invoke_props_dialog(self)


class GetMorePresets(bpy.types.Operator):
"""Load the No Man's Sky Presets web page to find more community presets."""
bl_idname = "nms.get_more_presets"
bl_label = "Get More Presets..."

def execute(self, context):
# Load web page.
webbrowser.open_new("https://charliebanks.github.io/nms-base-builder-presets/")
return {"FINISHED"}


# List Operators ---
Expand Down Expand Up @@ -1426,6 +1438,7 @@ def execute(self, context):
DuplicateAlongCurve,

SaveAsPreset,
GetMorePresets,
ToggleRoom,

NewFile,
Expand Down

0 comments on commit 857b616

Please sign in to comment.