Skip to content

Commit

Permalink
boneObj.palette to boneObj.color.palette
Browse files Browse the repository at this point in the history
  • Loading branch information
zaher committed Dec 4, 2024
1 parent fef1458 commit 8be863f
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 44 deletions.
12 changes: 6 additions & 6 deletions Onigiri/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40012,7 +40012,7 @@ def execute(self, context):

for boneObj in targetObj.pose.bones:
inactiveCollection.assign(boneObj)
boneObj.palette = mixer_group_target_inactive_theme
boneObj.color.palette = mixer_group_target_inactive_theme

bpy.ops.object.mode_set(mode="OBJECT")

Expand Down Expand Up @@ -40153,7 +40153,7 @@ def execute(self, context):

for boneObj in sourceObj.data.bones:
sourceObj.data.collections[mixer_group_source_inactive_name].assign(boneObj)
boneObj.palette = mixer_group_source_inactive_theme
boneObj.color.palette = mixer_group_source_inactive_theme

bpy.ops.object.mode_set(mode="OBJECT")
sourceObj.select_set(False)
Expand Down Expand Up @@ -40226,7 +40226,7 @@ def execute(self, context):

for bone in sources:
targetObj.data.collections[mixer_group_target_inactive_name].assign(bone)
bone.palette = mixer_group_target_active_theme
bone.color.palette = mixer_group_target_active_theme

constraints = targetObj.pose.bones[bone].constraints
for c in constraints:
Expand Down Expand Up @@ -40379,7 +40379,7 @@ def execute(self, context):
sourceObj = obj[self.name]

targetObj.data.collections[mixer_group_source_active_name].assign(targetObj.pose.bones[bone])
targetObj.pose.bones[bone].palette = mixer_group_source_active_theme
targetObj.pose.bones[bone].color.palette = mixer_group_source_active_theme

obj[self.name].data.collections[mixer_group_source_active_name].assign(obj[self.name].pose.bones[bone])

Expand Down Expand Up @@ -40708,7 +40708,7 @@ def execute(self, context):
for bone in bone_names:
for sourceObj in oni_mixer["sources"]:
sourceObj.data.collections[mixer_group_source_inactive_name].assign(bone)
#bone.palette = mixer_group_source_inactive_theme
#bone.color.palette = mixer_group_source_inactive_theme

targetObj.data.collections[mixer_group_target_inactive_name].assign(bone)

Expand Down Expand Up @@ -61682,7 +61682,7 @@ def execute(self, context):

group_base = sim.props["group_base"]
base_collection.assign(boneObj)
boneObj.palette = sim.props["theme_base"]
boneObj.color.palette = sim.props["theme_base"]

if disable_armatures == True:
print("Disabling armature modifiers")
Expand Down
4 changes: 2 additions & 2 deletions Onigiri/edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ def auto_weight_colors(bone="", state=""):

boneObj = bpy.data.objects[arm].pose.bones[bone]
boneCollection.assign(boneObj)
boneObj.palette = md.cc_rename_selected_color
boneObj.color.palette = md.cc_rename_selected_color

if bone in ccp["remap_stored"]["reskin"]:
for child in ccp["remap_stored"]["reskin"][bone]:
boneObj = bpy.data.objects[arm].pose.bones[child]
bpy.data.objects[arm].data.collections[md.cc_reskin_selected_name].assign(boneObj)
boneObj.palette = md.cc_reskin_selected_color
boneObj.color.palette = md.cc_reskin_selected_color

elif state == "reset":
bpy.data.objects[arm].data.collections[md.cc_rename_group].assign(bpy.data.objects[arm].pose.bones[bone])
Expand Down
2 changes: 1 addition & 1 deletion Onigiri/mod_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,7 @@ def add_bone_to_group(armature="", bone="", group="", theme=""):
boneObj = bpy.data.objects[armature].pose.bones[bone]
bpy.data.objects[armature].data.collections[group].assign(boneObj)
if theme != "":
boneObj.palette = theme
boneObj.color.palette = theme

bpy.ops.object.mode_set(mode="OBJECT")
bpy.ops.object.select_all(action="DESELECT")
Expand Down
12 changes: 6 additions & 6 deletions Onigiri/motion.py
Original file line number Diff line number Diff line change
Expand Up @@ -1146,9 +1146,9 @@ def update_map(inRig=None):

try:
inRig.data.collections[director_group].assign(inRig.data.bones[rename_in_bone])
inRig.data.bones[rename_in_bone].palette = props["themes"]["director"]
inRig.data.bones[rename_in_bone].color.palette = props["themes"]["director"]
outRig.data.collections[actor_group].assign(outRig.data.bones[rename_out_bone])
outRig.data.bones[rename_out_bone].palette = props["themes"]["actor"]
outRig.data.bones[rename_out_bone].color.palette = props["themes"]["actor"]
except:
bad_group = True
pass
Expand All @@ -1159,7 +1159,7 @@ def update_map(inRig=None):
if bone not in inRig.data.bones:
continue
inRig.data.collections[reskin_group].assign(inRig.data.bones[bone])
inRig.data.bones[bone].palette = props["themes"]["reskin"]
inRig.data.bones[bone].color.palette = props["themes"]["reskin"]

utils.set_state(state)

Expand Down Expand Up @@ -1192,10 +1192,10 @@ def apply_map(inRig=None, outRig=None):
actor_group = props["groups"]["actor"]

inRig.data.collections[director_group].assign(inRig.data.bones[rename_in_bone])
inRig.data.bones[rename_in_bone].palette = props["themes"]["director"]
inRig.data.bones[rename_in_bone].color.palette = props["themes"]["director"]

outRig.data.collections[actor_group].assign(outRig.data.bones[rename_out_bone])
outRig.data.bones[rename_out_bone].palette = props["themes"]["actor"]
outRig.data.bones[rename_out_bone].color.palette = props["themes"]["actor"]

reskin_bones = reskin.get(rename_in_bone, [])
reskin_group = props["groups"]["reskin"]
Expand All @@ -1205,6 +1205,6 @@ def apply_map(inRig=None, outRig=None):
if bone not in inRig.pose.bones:
continue
inRig.data.collections[reskin_group].assign(inRig.data.bones[bone])
inRig.data.bones[bone].palette = props["themes"]["reskin"]
inRig.data.bones[bone].color.palette = props["themes"]["reskin"]

return True
30 changes: 15 additions & 15 deletions Onigiri/rigs.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ def create_rig(target="default"):
boneObj = obj[arm].pose.bones[bone]
if rig_target[bone]["type"] == "bone":
obj[arm].data.collections[mod_data.rig_group_mbones].assign(boneObj)
boneObj.palette = mod_data.rig_group_mtheme
boneObj.color.palette = mod_data.rig_group_mtheme
else:
obj[arm].data.collections[mod_data.rig_group_vbones].assign(boneObj)
boneObj.palette = mod_data.rig_group_vtheme
boneObj.color.palette = mod_data.rig_group_vtheme

bpy.ops.object.mode_set(mode="OBJECT")

Expand Down Expand Up @@ -1681,7 +1681,7 @@ def attach_slave_rig(

for boneObj in slaveObj.pose.bones:
colObj.assign(boneObj)
boneObj.palette = mod_data.slave_group_theme
boneObj.color.palette = mod_data.slave_group_theme

lname = "ONI Copy Loc"
rname = "ONI Copy Rot"
Expand Down Expand Up @@ -1790,7 +1790,7 @@ def attach_proxy_rig(armature=None, clean=False):

for boneObj in glueObj.pose.bones:
glueCollection.assign(boneObj)
boneObj.palette = "THEME07"
boneObj.color.palette = "THEME07"

bpy.ops.object.mode_set(mode="OBJECT")

Expand Down Expand Up @@ -1998,10 +1998,10 @@ def build_sl_rig(rig_class="pos", store=True, rotate=False):
boneObj = obj[arm].pose.bones[bone]
if skel.avatar_skeleton[bone]["type"] == "bone":
obj[arm].data.collections[mod_data.rig_group_mbones].assign(boneObj)
boneObj.palette = mod_data.rig_group_mtheme
boneObj.color.palette = mod_data.rig_group_mtheme
else:
obj[arm].data.collections[mod_data.rig_group_vbones].assign(boneObj)
boneObj.palette = mod_data.rig_group_vtheme
boneObj.color.palette = mod_data.rig_group_vtheme

bpy.ops.object.mode_set(mode="OBJECT")

Expand Down Expand Up @@ -2161,17 +2161,17 @@ def build_rig(rig_class="pos", rotate=False, connect=True):
boneObj = obj[arm].pose.bones[bone]
if skel.avatar_skeleton[bone]["type"] == "bone":
obj[arm].data.collections[mod_data.rig_group_mbones].assign(boneObj)
boneObj.palette = mod_data.rig_group_mtheme
boneObj.color.palette = mod_data.rig_group_mtheme
elif skel.avatar_skeleton[bone]["type"] == "attachment":
if " " in bone:
obj[arm].data.collections[mod_data.rig_group_nbones].assign(boneObj)
boneObj.palette = mod_data.rig_group_ntheme
boneObj.color.palette = mod_data.rig_group_ntheme
else:
obj[arm].data.collections[mod_data.rig_group_abones].assign(boneObj)
boneObj.palette = mod_data.rig_group_atheme
boneObj.color.palette = mod_data.rig_group_atheme
else:
obj[arm].data.collections[mod_data.rig_group_vbones].assign(boneObj)
boneObj.palette = mod_data.rig_group_vtheme
boneObj.color.palette = mod_data.rig_group_vtheme

bpy.ops.object.mode_set(mode="OBJECT")

Expand Down Expand Up @@ -2696,7 +2696,7 @@ def freeze(armature=None, bones=[], transforms=True, influence=1):

for boneObj in glueObj.pose.bones:
glueCollection.assign(boneObj)
boneObj.palette = "THEME07"
boneObj.color.palette = "THEME07"

bpy.ops.object.mode_set(mode="OBJECT")

Expand Down Expand Up @@ -3453,17 +3453,17 @@ def set_bone_groups(armObj):
continue
if skel.avatar_skeleton[bone]["type"] == "bone":
armObj.data.collections[mod_data.rig_group_mbones].assign(boneObj)
boneObj.palette = mod_data.rig_group_mtheme
boneObj.color.palette = mod_data.rig_group_mtheme
elif skel.avatar_skeleton[bone]["type"] == "attachment":
if " " in bone:
armObj.data.collections[mod_data.rig_group_nbones].assign(boneObj)
boneObj.palette = mod_data.rig_group_ntheme
boneObj.color.palette = mod_data.rig_group_ntheme
else:
armObj.data.collections[mod_data.rig_group_abones].assign(boneObj)
boneObj.palette = mod_data.rig_group_atheme
boneObj.color.palette = mod_data.rig_group_atheme
else:
armObj.data.collections[mod_data.rig_group_vbones].assign(boneObj)
boneObj.palette = mod_data.rig_group_vtheme
boneObj.color.palette = mod_data.rig_group_vtheme


bpy.ops.object.mode_set(mode="OBJECT")
Expand Down
16 changes: 8 additions & 8 deletions Onigiri/rigutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1787,7 +1787,7 @@ def attach_slave_rig(

for boneObj in slaveObj.data.bones:
slaveCollection.assign(boneObj)
boneObj.palette = mod_data.slave_group_theme
boneObj.color.palette = mod_data.slave_group_theme

lname = "ONI Copy Loc"
rname = "ONI Copy Rot"
Expand Down Expand Up @@ -2109,10 +2109,10 @@ def build_sl_rig(rig_class="pos", store=True, rotate=False):
for bone in skel.avatar_skeleton:
if skel.avatar_skeleton[bone]["type"] == "bone":
obj[arm].data.collections[mod_data.rig_group_mbones].assign(bone)
bone.palette = mod_data.rig_group_mtheme
bone.color.palette = mod_data.rig_group_mtheme
else:
obj[arm].data.collections[mod_data.rig_group_vbones].assign(bone)
bone.palette = mod_data.rig_group_vtheme
bone.color.palette = mod_data.rig_group_vtheme


bpy.ops.object.mode_set(mode="OBJECT")
Expand Down Expand Up @@ -2826,7 +2826,7 @@ def freeze(armature=None, bones=[], transforms=True, influence=1):

for boneObj in glueObj.data.bones:
glueCollection.assign(boneObj)
boneObj.palette = "THEME07"
boneObj.color.palette = "THEME07"

bpy.ops.object.mode_set(mode="OBJECT")

Expand Down Expand Up @@ -3598,17 +3598,17 @@ def set_bone_groups(armObj):
boneObj = armObj.data.bones[bone]
if skel.avatar_skeleton[bone]["type"] == "bone":
armObj.data.collections[mod_data.rig_group_mbones].assign(boneObj)
boneObj.palette = mod_data.rig_group_mtheme
boneObj.color.palette = mod_data.rig_group_mtheme
elif skel.avatar_skeleton[bone]["type"] == "attachment":
if " " in bone:
armObj.data.collections[mod_data.rig_group_nbones].assign(boneObj)
boneObj.palette = mod_data.rig_group_ntheme
boneObj.color.palette = mod_data.rig_group_ntheme
else:
armObj.data.collections[mod_data.rig_group_abones].assign(boneObj)
boneObj.palette = mod_data.rig_group_atheme
boneObj.color.palette = mod_data.rig_group_atheme
else:
armObj.data.collections[mod_data.rig_group_vbones].assign(boneObj)
boneObj.palette = mod_data.rig_group_vtheme
boneObj.color.palette = mod_data.rig_group_vtheme

bpy.ops.object.mode_set(mode="OBJECT")

Expand Down
6 changes: 3 additions & 3 deletions Onigiri/shifter.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def snap(sarm=None, tarms=[], type="rig", source=[]):

for boneObj in glueObj.pose.bones:
glueCollection.assign(boneObj)
boneObj.palette = "THEME07"
boneObj.color.palette = "THEME07"

bpy.ops.object.mode_set(mode="EDIT")
for boneObj in glueObj.data.edit_bones:
Expand Down Expand Up @@ -485,7 +485,7 @@ def morph(

for boneObj in glueObj.pose.bones:
glueCollection.assign(boneObj)
boneObj.palette = "THEME07"
boneObj.color.palette = "THEME07"

bpy.ops.object.mode_set(mode="EDIT")
for boneObj in glueObj.data.edit_bones:
Expand Down Expand Up @@ -817,7 +817,7 @@ def freeze(sarm):

for boneObj in glueObj.pose.bones:
glueCollection.assign(boneObj)
boneObj.palette = "THEME01"
boneObj.color.palette = "THEME01"

bpy.ops.object.mode_set(mode="OBJECT")

Expand Down
4 changes: 2 additions & 2 deletions Onigiri/sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ def build_bone(actor=None, director=None, head=None, tail=None, vertices=[]):

group_base = props["group_base"]
colObj.assign(boneObj)
boneObj.palette = props["theme_base"]
boneObj.color.palette = props["theme_base"]

utils.set_state(new_state)

Expand Down Expand Up @@ -671,6 +671,6 @@ def vertex_constraint(

group_base = sim.props["group_base"]
colObj.assign(boneObj)
boneObj.palette = props["theme_base"]
boneObj.color.palette = props["theme_base"]

return True
2 changes: 1 addition & 1 deletion Onigiri/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1900,7 +1900,7 @@ def vertex_constraint(
coll = armObj.data.collections.new(props["constraint_group_base"])

coll.assign(boneObj)
boneObj.palette = props["constraint_theme_base"]
boneObj.color.palette = props["constraint_theme_base"]
group_base = sim.props["constraint_group_base"]

return True
Expand Down

0 comments on commit 8be863f

Please sign in to comment.