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

Commit

Permalink
Updated code and blend file
Browse files Browse the repository at this point in the history
  • Loading branch information
animate1978 committed Jan 28, 2024
1 parent 94b8719 commit 9edab93
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 70 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ Runblender.bat.lnk
/.vscode
notes.txt
mb-lab_updater/MB-Lab_updater_status.json
data/humanoid_library.blend1
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,22 @@ This fork is an attempt to keep this addon going forward as the original author

## Added

-

## Changed

-
- MBLabSkin3 is a now based off of the 1.7.6 shader
- AutoUpdater is disabled

## Bug Fixes

- Fixed bugs in various files to make it work with Blender 4.0
-

## Known Issues

- MB-Dev tools may contain bugs that are unknown at this time
- Importing BVH animation files is buggy
- Hair presets have the old PrincipledHairBSDF which will result in incorrect rendering
- Skin color and bump mapping change slightly when finalizing

## ManuelBastioniLAB 1.6.1a

Expand Down
79 changes: 41 additions & 38 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1847,7 +1847,7 @@ def execute(self, context):


class ExpDisplacementImage(bpy.types.Operator, ExportHelper):
"""Export texture maps for the character"""
"""Export displacement texture map for the character"""
bl_idname = "mbast.export_dispimage"
bl_label = "Save displacement map"
filename_ext = ".png"
Expand All @@ -1864,9 +1864,9 @@ def execute(self, context):


class ExpDermalImage(bpy.types.Operator, ExportHelper):
"""Export texture maps for the character"""
"""Export albedo texture maps for the character"""
bl_idname = "mbast.export_dermimage"
bl_label = "Save dermal map"
bl_label = "Save albedo map"
filename_ext = ".png"
filter_glob: bpy.props.StringProperty(
default="*.png",
Expand Down Expand Up @@ -1968,9 +1968,9 @@ def execute(self, context):


class LoadDermImage(bpy.types.Operator, ImportHelper):
"""Import texture maps for the character"""
"""Import albedo texture maps for the character"""
bl_idname = "mbast.import_dermal"
bl_label = "Load dermal map"
bl_label = "Load albedo map"
filename_ext = ".png"
filter_glob: bpy.props.StringProperty(
default="*.png",
Expand All @@ -1985,7 +1985,7 @@ def execute(self, context):


class LoadDispImage(bpy.types.Operator, ImportHelper):
"""Import texture maps for the character"""
"""Import displacement texture maps for the character"""
bl_idname = "mbast.import_displacement"
bl_label = "Load displacement map"
filename_ext = ".png"
Expand Down Expand Up @@ -3004,21 +3004,34 @@ def draw(self, context):
for material_data_prop in sorted(mblab_humanoid.character_material_properties.keys()):
box_skin.prop(obj, material_data_prop)

# Finalize character

box_act_tools_sub.label(text="OTHERS", icon="RNA")
box_act_tools_c = box_act_tools_sub.column(align=True)
if gui_active_panel_display != "finalize":
box_act_tools_c.operator('mbast.button_finalize_on', icon=icon_expand)


# Display character

if gui_active_panel_display != "display_opt":
box_act_tools_c.operator('mbast.button_display_on', icon=icon_expand)
else:
box_act_tools_c.operator('mbast.button_finalize_off', icon=icon_collapse)
box_fin = self.layout.box()
box_fin.prop(scn, 'mblab_save_images_and_backup', icon='EXPORT')
box_fin.prop(scn, 'mblab_remove_all_modifiers', icon='CANCEL')
box_fin.prop(scn, 'mblab_final_prefix')
if scn.mblab_save_images_and_backup:
box_fin.operator("mbast.finalize_character_and_images", icon='FREEZE')
box_act_tools_c.operator('mbast.button_display_off', icon=icon_collapse)
box_disp = self.layout.box()

if mblab_humanoid.exists_displace_texture():
if mblab_humanoid.get_disp_visibility() is False:
box_disp.operator("mbast.displacement_enable", icon='MOD_DISPLACE')
else:
box_disp.operator("mbast.displacement_disable", icon='X')
if mblab_humanoid.get_subd_visibility() is False:
box_disp.operator("mbast.subdivision_enable", icon='MOD_SUBSURF')
box_disp.label(text="Subd. preview is very CPU intensive", icon='INFO')
else:
box_fin.operator("mbast.finalize_character", icon='FREEZE')
box_disp.operator("mbast.subdivision_disable", icon='X')
box_disp.label(text="Disable subdivision to increase performance", icon='ERROR')
if mblab_humanoid.get_smooth_visibility() is False:
box_disp.operator("mbast.corrective_enable", icon='MOD_SMOOTH')
else:
box_disp.operator("mbast.corrective_disable", icon='X')

# File tools

Expand Down Expand Up @@ -3053,35 +3066,25 @@ def draw(self, context):
box_file.operator("mbast.export_character", icon='EXPORT')
box_file.operator("mbast.import_character", icon='IMPORT')

# Display character
# Finalize character

if gui_active_panel_display != "display_opt":
box_act_tools_c.operator('mbast.button_display_on', icon=icon_expand)
if gui_active_panel_display != "finalize":
box_act_tools_c.operator('mbast.button_finalize_on', icon=icon_expand)
else:
box_act_tools_c.operator('mbast.button_display_off', icon=icon_collapse)
box_disp = self.layout.box()

if mblab_humanoid.exists_displace_texture():
if mblab_humanoid.get_disp_visibility() is False:
box_disp.operator("mbast.displacement_enable", icon='MOD_DISPLACE')
else:
box_disp.operator("mbast.displacement_disable", icon='X')
if mblab_humanoid.get_subd_visibility() is False:
box_disp.operator("mbast.subdivision_enable", icon='MOD_SUBSURF')
box_disp.label(text="Subd. preview is very CPU intensive", icon='INFO')
else:
box_disp.operator("mbast.subdivision_disable", icon='X')
box_disp.label(text="Disable subdivision to increase performance", icon='ERROR')
if mblab_humanoid.get_smooth_visibility() is False:
box_disp.operator("mbast.corrective_enable", icon='MOD_SMOOTH')
box_act_tools_c.operator('mbast.button_finalize_off', icon=icon_collapse)
box_fin = self.layout.box()
box_fin.prop(scn, 'mblab_save_images_and_backup', icon='EXPORT')
box_fin.prop(scn, 'mblab_remove_all_modifiers', icon='CANCEL')
box_fin.prop(scn, 'mblab_final_prefix')
if scn.mblab_save_images_and_backup:
box_fin.operator("mbast.finalize_character_and_images", icon='FREEZE')
else:
box_disp.operator("mbast.corrective_disable", icon='X')
box_fin.operator("mbast.finalize_character", icon='FREEZE')

self.layout.separator(factor=0.5)
self.layout.label(text="AFTER-CREATION TOOLS", icon="MODIFIER_ON")
layout_sub=self.layout.box()
layout_sub.label(text="FINALIZED characters ONLY", icon="INFO")

else:
gui_status = "NEW_SESSION"

Expand Down
17 changes: 1 addition & 16 deletions algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,7 @@

logger = logging.getLogger(__name__)

DEBUG_LEVEL = 3

# ------------------------------------------------------------------------
# Print Log
# ------------------------------------------------------------------------

def print_log_report(level, text_to_write):
import warnings
warnings.warn("print_log_report deprecated, use python logging", DeprecationWarning)
l = 0
levels = {"INFO": 0, "DEBUG": 1, "WARNING": 2, "ERROR": 3, "CRITICAL": 4,}
if level in levels:
l = levels[level]
if l >= DEBUG_LEVEL:
print(level + ": " + text_to_write)

# Had old debugger code here forever, it has been removed

# ------------------------------------------------------------------------
# Algorithms
Expand Down
5 changes: 2 additions & 3 deletions animationengine.py
Original file line number Diff line number Diff line change
Expand Up @@ -1023,9 +1023,8 @@ def bake_animation(self, target_armat, source_armat):
if source_armat.animation_data:
source_action = source_armat.animation_data.action
f_range = source_action.frame_range
# BUG
bpy.ops.nla.bake(frame_start=f_range[0], frame_end=f_range[1], only_selected=False,
visual_keying=True, clear_constraints=False, use_current_action=True, bake_types={'POSE'})
# Removed f_range, needs work
bpy.ops.nla.bake(only_selected=False, visual_keying=True, clear_constraints=False, use_current_action=True, bake_types={'POSE'})
self.remove_armature_constraints(target_armat)

@staticmethod
Expand Down
Binary file modified data/humanoid_library.blend
Binary file not shown.
8 changes: 4 additions & 4 deletions humanoid.py
Original file line number Diff line number Diff line change
Expand Up @@ -858,15 +858,15 @@ def update_character(self, category_name=None, mode="update_all"):
self.sync_gui_according_measures()
if update_armature:
self.sk_engine.fit_joints()
#
# if update_normals:
# obj.data.normal_update()
# BUG - causes error in console
#if update_normals:
# obj.data.normal_update()
if update_proxy:
self.fit_proxy()

self.set_subd_visibility(subdivision_value)

#logger.error("Character updated in {0} secs".format(time.time()-time1))
logger.error("Character updated in {0} secs".format(time.time()-time1))

def generate_character(self, random_value, prv_face, prv_body, prv_mass, prv_tone, prv_height, prv_phenotype, set_tone_and_mass, body_mass, body_tone, prv_fantasy):
logger.info("Generating character...")
Expand Down
12 changes: 6 additions & 6 deletions materialengine.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def __init__(self, obj_name, character_config):
"freckle_mask": character_config["texture_frecklemask"],
"blush": character_config["texture_blush"],
"sebum": character_config["texture_sebum"],
"roughness": character_config["texture_roughness"],
#"roughness": character_config["texture_roughness"],
"thickness": character_config["texture_thickness"],
"melanin": character_config["texture_melanin"],
"lipmap": character_config["texture_lipmap"],
Expand Down Expand Up @@ -132,9 +132,9 @@ def texture_blush_exist(self):
@property
def texture_sebum_exist(self):
return os.path.isfile(self.image_file_paths["sebum"])
@property
def texture_roughness_exist(self):
return os.path.isfile(self.image_file_paths["roughness"])
#@property
#def texture_roughness_exist(self):
# return os.path.isfile(self.image_file_paths["roughness"])
@property
def texture_melanin_exist(self):
return os.path.isfile(self.image_file_paths["melanin"])
Expand Down Expand Up @@ -252,8 +252,8 @@ def update_shaders(self, material_parameters=[], update_textures_nodes=True):
self.assign_image_to_node(material.name, node.name, self.image_file_names["blush"])
if "_skn_sebum" in node.name:
self.assign_image_to_node(material.name, node.name, self.image_file_names["sebum"])
if "_skn_roughness" in node.name:
self.assign_image_to_node(material.name, node.name, self.image_file_names["roughness"])
#if "_skn_roughness" in node.name:
# self.assign_image_to_node(material.name, node.name, self.image_file_names["roughness"])
if "_skn_melanin" in node.name:
self.assign_image_to_node(material.name, node.name, self.image_file_names["melanin"])
if "_skn_thickness" in node.name:
Expand Down

0 comments on commit 9edab93

Please sign in to comment.