Skip to content
This repository has been archived by the owner on Jul 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #214 from animate1978/dev
Browse files Browse the repository at this point in the history
Merge dev to master
  • Loading branch information
animate1978 authored Dec 13, 2019
2 parents a7e823a + 4e1b9b7 commit e3a0c1f
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 1 deletion.
1 change: 1 addition & 0 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ def start_lab_session():
mblab_humanoid.update_character(mode="update_all")

algorithms.deselect_all_objects()
algorithms.remove_censors()


@persistent
Expand Down
2 changes: 1 addition & 1 deletion addon_updater_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,7 @@ def register(bl_info):
#updater.addon = # define at top of module, MUST be done first

# Website for manual addon download, optional but recommended to set
updater.website = "https://mb-lab-community.github.io/MB-Lab.github.io/"
updater.website = "https://mblab.dev"

# Addon subfolder path
# "sample/path/to/addon"
Expand Down
42 changes: 42 additions & 0 deletions algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -1156,3 +1156,45 @@ def move_down_modifier(obj, modifier):
set_active_object(obj)
for n in range(len(obj.modifiers)):
bpy.ops.object.modifier_move_down(modifier=modifier_name)

def swap_material(old_mat_name, new_mat_name, char_name):

#Get Object if it doesn't exist return none
obj = bpy.data.objects[char_name]
if obj == None:
return None

#Try and get materials if either does not exist return None

try:

mat_old = bpy.data.materials[old_mat_name]
mat_new = bpy.data.materials[new_mat_name]

except:
logger.debug("Material not found")
return None


#Assign new material to old material slot
materialslen = len(obj.data.materials)
for i in range(0,materialslen):
if obj.data.materials[i] == mat_old:
obj.data.materials[i] = mat_new

return None

def remove_censors():

my_prefs = bpy.context.preferences.addons.get(__package__, None)
if (not my_prefs.preferences.use_censors):
is_char = looking_for_humanoid_obj()
if is_char[0] == "FOUND":
char_name = is_char[1]
if char_name in("f_an01","f_an02","m_an01","m_an02"):
swap_material("MBlab_generic", "MBLab_anime_skin",char_name)
else:
swap_material("MBlab_generic", "MBLab_skin2",char_name)


return None
Binary file added data/face_rig/face_rig_lib.blend
Binary file not shown.
Binary file added data/face_rig/facial_rig.blend
Binary file not shown.
8 changes: 8 additions & 0 deletions preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,19 @@ class MBPreferences(bpy.types.AddonPreferences):
max=59
)

use_censors = bpy.props.BoolProperty(
name='censors',
description="Use censors to cover genitals and breasts",
default=True
)

def draw(self, context):
layout = self.layout
# col = layout.column() # works best if a column, or even just self.layout
mainrow = layout.row()
col = mainrow.column()
#add censor preference here
col.prop(self, 'use_censors')

# updater draw function
addon_updater_ops.update_settings_ui(self, context)
Expand Down

0 comments on commit e3a0c1f

Please sign in to comment.