Skip to content

Commit

Permalink
feat: update file formats automatically when switching between local …
Browse files Browse the repository at this point in the history
…and community server
  • Loading branch information
ntamas committed Oct 2, 2023
1 parent 618dc6e commit 566f8c0
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
4 changes: 1 addition & 3 deletions src/modules/sbstudio/plugin/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ def call_api_from_blender_operator(
return ``{"CANCELLED"}`` from the operator immediately in response to an
exception.
"""
default_message = (
f"Error while invoking {what} on the Skybrush Studio online service"
)
default_message = f"Error while invoking {what} on the Skybrush Studio server"
try:
yield get_api()
except SkybrushStudioExportWarning as ex:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def execute_on_formation(self, formation, context):
raise
self.report(
{"ERROR"},
"Error while invoking transition planner on the Skybrush Studio online service",
"Error while invoking transition planner on the Skybrush Studio server",
)
return {"CANCELLED"}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ def execute_on_storyboard(self, storyboard: Storyboard, entries, context):
{"ERROR"},
(
"Error while invoking transition planner on the Skybrush "
"Studio online service"
"Studio server"
),
)
return {"CANCELLED"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class RefreshFileFormatsOperator(Operator):
def execute(self, context):
try:
with call_api_from_blender_operator(
self, "Server capabilities query"
self, "server capabilities query"
) as api:
update_supported_file_formats_from_limits(api.get_limits())
except Exception:
Expand Down
6 changes: 6 additions & 0 deletions src/modules/sbstudio/plugin/operators/set_server_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,10 @@ def execute(self, context):

bpy.ops.wm.save_userpref()

try:
bpy.ops.skybrush.refresh_file_formats()
except RuntimeError:
# Maybe the server is not running?
pass

return {"FINISHED"}

0 comments on commit 566f8c0

Please sign in to comment.