Migrate to Blender 5.0 API

- Replaced action.fcurves with channelbag system
- Updated EEVEE_NEXT to EEVEE render engine
- Removed deprecated material.use_nodes and use_shadeless
- Fixed bone selection/hide API for Pose mode
This commit is contained in:
Yusarina
2025-11-15 02:45:37 +00:00
parent d2b98716ff
commit f40b2faacb
13 changed files with 132 additions and 62 deletions
+1 -1
View File
@@ -386,7 +386,7 @@ class EdgePreviewSetup(Operator):
return mat
def __make_shader(self, m: Material) -> None:
m.use_nodes = True
# Note: material.use_nodes is deprecated in Blender 5.0 - materials always use nodes
nodes, links = m.node_tree.nodes, m.node_tree.links
node_shader = nodes.get("mmd_edge_preview", None)
+5 -3
View File
@@ -475,7 +475,8 @@ class ViewBoneMorph(bpy.types.Operator):
for morph_data in morph.data:
p_bone: Optional[bpy.types.PoseBone] = armature.pose.bones.get(morph_data.bone, None)
if p_bone:
p_bone.bone.select = True
# Blender 5.0: use pose bone select property directly
p_bone.select = True
mtx = (p_bone.matrix_basis.to_3x3() @ Quaternion(*morph_data.rotation.to_axis_angle()).to_matrix()).to_4x4()
mtx.translation = p_bone.location + morph_data.location
p_bone.matrix_basis = mtx
@@ -521,9 +522,10 @@ class ApplyBoneMorph(bpy.types.Operator):
item.bone = p_bone.name
item.location = p_bone.location
item.rotation = p_bone.rotation_quaternion if p_bone.rotation_mode == "QUATERNION" else p_bone.matrix_basis.to_quaternion()
p_bone.bone.select = True
# Blender 5.0: use pose bone select property directly
p_bone.select = True
else:
p_bone.bone.select = False
p_bone.select = False
logger.info(f"Applied current pose to bone morph: {morph.name}")
return {"FINISHED"}
+6 -8
View File
@@ -32,16 +32,14 @@ class _SetShadingBase:
@staticmethod
def _reset_material_shading(context: Context, use_shadeless: bool = False) -> None:
for i in (x for x in context.scene.objects if x.type == "MESH" and x.mmd_type == "NONE"):
for s in i.material_slots:
if s.material is None:
continue
s.material.use_nodes = False
s.material.use_shadeless = use_shadeless
# Note: material.use_nodes and material.use_shadeless are deprecated in Blender 5.0
# Materials always use nodes now, and shadeless is handled differently
# This method is kept for compatibility but no longer modifies materials
pass
def execute(self, context: Context) -> Dict[str, str]:
context.scene.render.engine = "BLENDER_EEVEE_NEXT"
logger.debug(f"Setting render engine to BLENDER_EEVEE_NEXT")
context.scene.render.engine = "BLENDER_EEVEE"
logger.debug(f"Setting render engine to BLENDER_EEVEE")
shading_mode: Optional[str] = getattr(self, "_shading_mode", None)
for space in self._get_view3d_spaces(context):