Skip to content

Commit

Permalink
change copy logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Zode committed Dec 27, 2023
1 parent 9d3fcae commit e2125a9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
bl_info = {
"name" : "Zode's blender utils",
"author" : "Zode",
"version" : (1, 4, 0),
"version" : (1, 4, 1),
"blender" : (4, 0, 0),
"description" : "Adds various utility function(s) to blender",
"warning": "",
Expand Down
2 changes: 1 addition & 1 deletion addon_updater_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def check_for_update(self, now):
# not match and have errors. Must be all lowercase and no spaces! Should also
# be unique among any other addons that could exist (using this updater code),
# to avoid clashes in operator registration.
updater.addon = "addon_updater_demo"
updater.addon = "Zode's blender utils"


# -----------------------------------------------------------------------------
Expand Down
9 changes: 6 additions & 3 deletions vertexbone.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,27 +78,30 @@ def execute(self, context):

#this is dumb why do i have to do it this way blender?
bpy.ops.object.mode_set(mode="POSE")
boneObject = armatureObject.pose.bones["VertexBone_"+str(vert.index)]
boneObject = armatureObject.pose.bones["VertexBone_"+str(vert.index)]
copyloc = boneObject.constraints.new("COPY_LOCATION")
copyloc.target = vertexProxy

bpy.ops.object.mode_set(mode="OBJECT")
#and naturally yeet all existing modifiers
newObject.modifiers.clear()

#newObject.parent = armatureObject
#newObject.parent_type = "ARMATURE"
armModifier = newObject.modifiers.new(name="VertexBoned", type="ARMATURE")
armModifier.object = armatureObject


#original has armature? copy that and join with the newly created armature
originalArmMod = FindModifier(originalObject, bpy.types.ArmatureModifier)
if originalArmMod is not None:
RemoveModifierOfType(newObject, bpy.types.ArmatureModifier)
proxyArmature = originalArmMod.object.copy()
proxyArmature.data = originalArmMod.object.data.copy()
proxyArmature.animation_data_clear()
vertexCollection.objects.link(proxyArmature)

bpy.context.view_layer.objects.active = proxyArmature
bpy.ops.object.mode_set(mode="POSE")
originalRootName = proxyArmature.pose.bones[0].name
for bone in proxyArmature.pose.bones:
bone.matrix_basis = Matrix() #reset to identity otherwise the armature will have whatever pose was in the current frame
originalBone = originalArmMod.object.pose.bones.get(bone.name)
Expand Down

0 comments on commit e2125a9

Please sign in to comment.