Skip to content

Commit

Permalink
Make compatible with Blender 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
arocull committed Jul 21, 2024
1 parent 318d55b commit 84fa66e
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 36 deletions.
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# BoneJuice
Armature utility plugin for Blender, for niche cases I encounter where it would be a lot nicer to have something do the work for me!

Version 0.1.1 which supports Blender 4.2+
- May be backwards compatible, but the latest changes are untested on previous versions
Version 1.0.0 which supports Blender 4.2, using the extension system. See **Releases** on sidebar for legacy versions.

Feature List (click on the links to see how-to/examples):
- Object Mode
Expand All @@ -23,11 +22,9 @@ Feature List (click on the links to see how-to/examples):
- **[Curl Bones](docs/examples/curl_bones.md)** - Offsets Euler rotations of all selected pose bones by the given rotation. Currently only works in Euler rotation mode.
- Animation
- **Bake All Actions** - Bakes all scene actions for the given armature.
- Rendering
- **(Work In Progress) Batch Render NLA Tracks** - Individually render out each animated NLA track inside of all selected objects. Renders from all selected cameras. Great for game animation previews or spritesheets.

# Installation
Download the zip file from the releases area on GitHub, and then go to `Edit > Preferences > Add-ons` and then click `Install` in the top right, and select the zip file. Make sure the plugin it points to is enabled.
Download the zip file from the releases area on GitHub, and then go to `Edit > Preferences > Add-ons` and then click `Install from Disk` in the top right dropdown, and select the zip file. Make sure the plugin it points to is enabled.

If you want the latest version, use `$ make` (Linux-only) inside this folder to get a zip file, or simply zip up the `src` folder and install that instead.

Expand Down
1 change: 1 addition & 0 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
cd src
REM "C:\Program Files\Blender Foundation\Blender 4.2\blender.exe" --command extension validate
"C:\Program Files\Blender Foundation\Blender 4.2\blender.exe" --command extension build
REM "C:\Program Files\Blender Foundation\Blender 4.2\blender.exe" --command extension validate build/bonejuice-0.1.1.zip
cd ..
move src\*.zip build\
51 changes: 24 additions & 27 deletions src/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import bpy
from .utility import getPreferences
from .registrator import registerClass, unregisterClass, registerMenu, unregisterMenu
from .luchadores import registerLuchadores, unregisterLuchadores
# from .luchadores import registerLuchadores, unregisterLuchadores
from .index import BINDINGS, BINDINGS_EXPERIMENTAL, MENUBINDINGS
from .globals import BoneJuiceGlobals

Expand All @@ -10,19 +10,19 @@
from bpy.props import BoolProperty

class BoneJuicePreferences(AddonPreferences):
bl_idname: str = __name__
bl_idname: str = __package__

def toggleExperimental(self, context: bpy.types.Context):
if self.enableExperimental and (not BoneJuiceGlobals.experimentalRegistered):
registerExperimental()
elif (not self.enableExperimental) and BoneJuiceGlobals.experimentalRegistered:
unregisterExperimental()

def toggleLuchadores(self, context: bpy.types.Context):
if self.enableLuchadores and (not BoneJuiceGlobals.luchadoresRegistered):
registerLuchadoresHelper()
elif (not self.enableLuchadores) and BoneJuiceGlobals.luchadoresRegistered:
unregisterLuchadoresHelper()
# def toggleLuchadores(self, context: bpy.types.Context):
# if self.enableLuchadores and (not BoneJuiceGlobals.luchadoresRegistered):
# registerLuchadoresHelper()
# elif (not self.enableLuchadores) and BoneJuiceGlobals.luchadoresRegistered:
# unregisterLuchadoresHelper()

enableExperimental: BoolProperty(
name="Enable Experimental Tools",
Expand All @@ -31,27 +31,27 @@ def toggleLuchadores(self, context: bpy.types.Context):
update=toggleExperimental
)

enableLuchadores: BoolProperty(
name="Enable Luchadores Workflow",
description="Enables tools for annotating and exporting armatures to the Luchadores engine",
default=False,
update=toggleLuchadores
)
# enableLuchadores: BoolProperty(
# name="Enable Luchadores Workflow",
# description="Enables tools for annotating and exporting armatures to the Luchadores engine",
# default=False,
# update=toggleLuchadores
# )

def draw(self, context):
layout = self.layout
layout.label(text="BoneJuice Preferences")
layout.prop(self, "enableExperimental")
layout.prop(self, "enableLuchadores")
# layout.prop(self, "enableLuchadores")

## REGISTER
def registerLuchadoresHelper():
BoneJuiceGlobals.luchadoresRegistered = True
registerLuchadores()
# def registerLuchadoresHelper():
# BoneJuiceGlobals.luchadoresRegistered = True
# registerLuchadores()

def unregisterLuchadoresHelper():
BoneJuiceGlobals.luchadoresRegistered = False
unregisterLuchadores()
# def unregisterLuchadoresHelper():
# BoneJuiceGlobals.luchadoresRegistered = False
# unregisterLuchadores()

def registerExperimental():
BoneJuiceGlobals.experimentalRegistered = True
Expand All @@ -68,8 +68,8 @@ def register():
registerClass(item[0], item[1], item[2])
if getPreferences(bpy.context).enableExperimental:
registerExperimental()
if getPreferences(bpy.context).enableLuchadores:
registerLuchadoresHelper()
# if getPreferences(bpy.context).enableLuchadores:
# registerLuchadoresHelper()
for item in MENUBINDINGS:
registerMenu(item[0], item[1], item[2])

Expand All @@ -80,9 +80,6 @@ def unregister():
unregisterClass(item[0], item[1], item[2])
if BoneJuiceGlobals.experimentalRegistered:
unregisterExperimental()
if BoneJuiceGlobals.luchadoresRegistered:
unregisterLuchadoresHelper()
# if BoneJuiceGlobals.luchadoresRegistered:
# unregisterLuchadoresHelper()
bpy.utils.unregister_class(BoneJuicePreferences)

if __name__ == "__main__":
register()
2 changes: 1 addition & 1 deletion src/blender_manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ schema_version = "1.0.0"

# TOML template from https://docs.blender.org/manual/en/4.2/extensions/getting_started.html
id = "bonejuice"
version = "0.1.1"
version = "1.0.0"
name = "BoneJuice"
tagline = "Armature utility plugin for Blender"
maintainer = "Alan O'Cull <alanocull.com>"
Expand Down
4 changes: 2 additions & 2 deletions src/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from .mesh.clean_and_combine import *
from .mesh.merge_vertex_groups import *
from .armature.pose_ops import *
from .render.batch import *
# from .render.batch import *
from .armature.reduce_rig import *
from .armature.transer_animations import *
from .armature.spline_from_curve import *
Expand Down Expand Up @@ -34,6 +34,6 @@
]

BINDINGS_EXPERIMENTAL: list = [
(BoneJuice_BatchRenderActions, [bpy.types.TOPBAR_MT_render], []),
# (BoneJuice_BatchRenderActions, [bpy.types.TOPBAR_MT_render], []),
(BoneJuice_TransferAnimations, [bpy.types.VIEW3D_MT_object_animation], []),
]
2 changes: 1 addition & 1 deletion src/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def lerpVector(a: Vector, b: Vector, alpha: float) -> Vector:

def getPreferences(context: bpy.types.Context) -> AddonPreferences:
print(context.preferences.addons)
return context.preferences.addons["BoneJuice"].preferences
return context.preferences.addons[__package__].preferences

def vectorToFloatList(inp: Vector) -> List[float]:
return [inp.x, inp.y, inp.z]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 84fa66e

Please sign in to comment.