Skip to content

Commit

Permalink
Updater (#91)
Browse files Browse the repository at this point in the history
* Unconfigured updater from CGCookie/blender-addon-updater

Using revision b12d8e202b55a4b7191fccc4e74a77f0cbc45a46 from 2021-06-21 (latest as of 2022-04-04).
https://github.com/CGCookie/blender-addon-updater/tree/b12d8e202b55a4b7191fccc4e74a77f0cbc45a46

* Configure and setup updater

* updater really wants a version number to work, welcome to Fast64 1.0.0

* Add updater's folder to .gitignore

* Add .gif files to `overwrite_patterns`

* Revert "Add updater's folder to .gitignore"

This reverts commit f30cd4d.

The updater's folder name depends on the name of the folder fast64 is installed in, which can be anything

* Add updater instructions and notes
  • Loading branch information
Dragorn421 authored Jun 12, 2022
1 parent 764796d commit acba0a8
Show file tree
Hide file tree
Showing 8 changed files with 3,327 additions and 0 deletions.
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,28 @@ There may occur cases where code is formatted differently based on the code use
### Converting To F3D v4 Materials
A new optimized shader graph was introduced to decrease processing times for material creation and exporting. If you have a project that still uses old materials, you may want to convert them to v4. To convert an old project, click the "Recreate F3D Materials As V4" operator near the top of the Fast64 tab in 3D view. This may take a while depending on the number of materials in the project. Then go to the outliner, change the display mode to "Orphan Data" (broken heart icon), then click "Purge" in the top right corner. Purge multiple times until all of the old node groups are gone.

### Updater

Fast64 features an updater ([CGCookie/blender-addon-updater](https://github.com/CGCookie/blender-addon-updater)).

It can be found in the addon preferences:

![How the updater in the addon preferences looks, right after addon install](/images/updater_initially.png)

Click the "Check now for fast64 update" button to check for updates.

![Updater preferences after clicking the "check for updates" button](/images/updater_after_check.png)

Click "Install main / old version" and choose "Main" if it isn't already selected:

![Updater: install main](/images/updater_install_main.png)

Click OK, there should be a message "Addon successfully installed" and prompting you to restart Blender:

![Updater: successful install, must restart](/images/updater_success_restart.png)

Clicking the red button will close Blender. After restarting, fast64 will be up-to-date with the latest main revision.

### Fast64 Development
If you'd like to develop in VSCode, follow this tutorial to get proper autocomplete. Skip the linter for now, we'll need to make sure the entire project gets linted before enabling autosave linting because the changes will be massive.
https://b3d.interplanety.org/en/using-microsoft-visual-studio-code-as-external-ide-for-writing-blender-scripts-add-ons/
Expand All @@ -61,3 +83,13 @@ To make VS Code use it, change the `python.formatting.provider` setting to "blac
To format the whole repo, run `black .` (or `python3 -m black .` depending on how it is installed) from the root of the repo.

The (minimal) configuration for Black is in `/pyproject.toml`.

#### Updater notes

Be careful if testing the updater when using git, it may mess up the .git folder in some cases.

Also see the extensive documentation in the https://github.com/CGCookie/blender-addon-updater README.

The "Update directly to main" button uses `bl_info["version"]` as the current version, and versions parsed from git tags as other versions. This means that to create a new version, the `bl_info` version should be bumped and a corresponding tag should be created (for example `"version": (1, 0, 2),` and a `v1.0.2` tag). This tag will then be available to update to, if it denotes a version that is more recent than the current version.

The "Install main / old version" button will install the latest revision from the `main` branch.
19 changes: 19 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@
import cProfile
import pstats

from . import addon_updater_ops

# info about add on
bl_info = {
"name": "Fast64",
"version": (1, 0, 0),
"author": "kurethedead",
"location": "3DView",
"description": "Plugin for exporting F3D display lists and other game data related to Super Mario 64.",
Expand Down Expand Up @@ -246,6 +249,7 @@ def draw(self, context):
col = self.layout.column()
col.operator(ArmatureApplyWithMesh.bl_idname)
#col.operator(CreateMetarig.bl_idname)
addon_updater_ops.update_notice_box_ui(self, context)

class Fast64Settings_Properties(bpy.types.PropertyGroup):
'''Settings affecting exports for all games found in scene.fast64.settings'''
Expand Down Expand Up @@ -326,6 +330,13 @@ class Fast64_ObjectProperties(bpy.types.PropertyGroup):
#
# scene.currentGameEditorMode = scene.gameEditorMode

class ExampleAddonPreferences(bpy.types.AddonPreferences, addon_updater_ops.AddonUpdaterPreferences):
bl_idname = __package__

def draw(self, context):
addon_updater_ops.update_settings_ui(self, context)


classes = (
Fast64Settings_Properties,
Fast64_Properties,
Expand Down Expand Up @@ -372,6 +383,11 @@ def register():
blender_3_1_0_and_later_unsupported = Exception("\n\n" + msg)
raise blender_3_1_0_and_later_unsupported

# Register addon updater first,
# this way if a broken version fails to register the user can still pick another version.
register_class(ExampleAddonPreferences)
addon_updater_ops.register(bl_info)

mat_register()
render_engine_register()
bsdf_conv_register()
Expand Down Expand Up @@ -435,3 +451,6 @@ def unregister():
unregister_class(cls)

bpy.app.handlers.load_post.remove(after_load)

addon_updater_ops.unregister()
unregister_class(ExampleAddonPreferences)
Loading

0 comments on commit acba0a8

Please sign in to comment.