def execute(self, context): _LOG.enter() name = IMPORTER_PRESETS_PROPERTIES.get_value("name", entity_reference=context.scene) if not name is None: name = str(name).strip() if name == "" or name is None: self.report({'ERROR'}, "A valid name must be given") return {'FINISHED'} if " " in str(name): self.report({'ERROR'}, "Presets names should not contain spaces") return {'FINISHED'} confdir = LocationService.get_user_config() file_name = os.path.join(confdir, "importer_presets." + name + ".json") if os.path.exists(file_name): self.report({'ERROR'}, "Presets with that name already exist") return {'FINISHED'} excludes = ["available_presets", "name"] IMPORTER_PRESETS_PROPERTIES.serialize_to_json(file_name, entity_reference=context.scene, exclude_keys=excludes) UiService.rebuild_importer_presets_panel_list() UiService.rebuild_importer_panel_list() self.report({'INFO'}, "Presets were written to " + file_name) return {'FINISHED'}
def draw(self, context): _LOG.enter() default_json = LocationService.get_user_config( "importer_presets.default.json") if not os.path.exists(default_json): _LOG.warn( "The default importer presets do not exist. Will create these." ) excludes = ["available_presets", "name"] IMPORTER_PRESETS_PROPERTIES.serialize_to_json( default_json, entity_reference=context, exclude_keys=excludes) else: _LOG.trace("Default presets exist") if UiService.get_importer_presets_panel_list() is None: UiService.rebuild_importer_presets_panel_list() layout = self.layout scene = context.scene self._load_save_box( scene, self._create_box(layout, "Load/save presets", "MODIFIER")) self._what_box(scene, self._create_box(layout, "What to import", "MODIFIER")) self._general_box(scene, self._create_box(layout, "General", "MODIFIER")) self._mesh_and_groups_box( scene, self._create_box(layout, "Mesh and vGroups", "MODIFIER")) self._materials_box(scene, self._create_box(layout, "Materials", "MODIFIER")) self._network_box(scene, self._create_box(layout, "Network", "MODIFIER"))
def draw(self, context): _LOG.enter() # TODO: this section should probably also be present in the importer panel default_json = LocationService.get_user_config( "enhanced_settings.default.json") if not os.path.exists(default_json): _LOG.warn( "The default enhanced settings do not exist. Will create at", default_json) template_settings = LocationService.get_mpfb_data("settings") default_json_template = os.path.join( template_settings, "enhanced_settings.default.json") _LOG.warn("Copying from", default_json_template) shutil.copy(default_json_template, default_json) else: _LOG.trace("Default enhanced settings exist") if UiService.get_enhanced_settings_panel_list() is None: UiService.rebuild_enhanced_settings_panel_list() layout = self.layout scene = context.scene self._load_save_box( scene, self._create_box(layout, "Load/save presets", "MODIFIER"))
def draw(self, context): _LOG.enter() ensure_eye_settings_default_exists() if UiService.get_eye_settings_panel_list() is None: UiService.rebuild_eye_settings_panel_list() layout = self.layout scene = context.scene self._load_save_box( scene, self._create_box(layout, "Load/save presets", "MODIFIER"))
class MPFB_PT_From_Presets_Panel(Abstract_Panel): """Create human from preset main panel.""" bl_label = "From presets" bl_space_type = "VIEW_3D" bl_region_type = "UI" bl_category = UiService.get_value("MODELCATEGORY") bl_options = {'DEFAULT_CLOSED'} bl_parent_id = "MPFB_PT_New_Panel" def _create(self, scene, layout): PRESETS_HUMAN_PROPERTIES.draw_properties(scene, layout, [ "available_presets", "scale_factor", "detailed_helpers", "extra_vertex_groups", "mask_helpers" ]) layout.operator('mpfb.human_from_presets') def draw(self, context): _LOG.enter() layout = self.layout scene = context.scene self._create(scene, layout)
class MPFB_PT_Human_Presets_Panel(Abstract_Panel): bl_label = "Human presets" bl_category = UiService.get_value("MATERIALSCATEGORY") bl_options = {'DEFAULT_CLOSED'} bl_parent_id = "MPFB_PT_Presets_Panel" def _load_save_box(self, scene, layout): _LOG.enter() HUMAN_PRESETS_PROPERTIES.draw_properties(scene, layout, ["available_presets"]) layout.operator('mpfb.overwrite_human_presets') HUMAN_PRESETS_PROPERTIES.draw_properties(scene, layout, ["name"]) layout.operator('mpfb.save_new_human_presets') def draw(self, context): _LOG.enter() layout = self.layout scene = context.scene self._load_save_box(scene, self._create_box(layout, "Load/save presets", "MODIFIER")) @classmethod def poll(cls, context): obj = context.active_object if not obj: return False if ObjectService.object_is_basemesh_or_body_proxy(obj): return True if ObjectService.object_is_skeleton(obj): return True return False
class MPFB_PT_Web_Resources_Panel(Abstract_Panel): """UI for opening web links.""" bl_label = "Web resources" bl_category = UiService.get_value("DEVELOPERCATEGORY") bl_options = {'DEFAULT_CLOSED'} bl_parent_id = "MPFB_PT_System_Panel" def _url(self, layout, label, url): weblink = layout.operator("mpfb.web_resource", text=label) weblink.url = url def draw(self, context): _LOG.enter() layout = self.layout self._url(layout, "Project home", "https://github.com/makehumancommunity/mpfb2") self._url( layout, "Documentation", "https://github.com/makehumancommunity/mpfb2/blob/master/docs/README.md" ) self._url(layout, "Get support", "http://www.makehumancommunity.org/forum/") self._url(layout, "Report a bug", "https://github.com/makehumancommunity/mpfb2/issues") self._url( layout, "Asset packs", "http://download.tuxfamily.org/makehuman/asset_packs/index.html")
class MPFB_PT_Add_Rig_Panel(Abstract_Panel): """Functionality for adding/setting rig""" bl_label = "Add rig" bl_category = UiService.get_value("MODELCATEGORY") bl_parent_id = "MPFB_PT_Rig_Panel" def _standard_rig(self, scene, layout): box = self.create_box(layout, "Add standard rig") props = ["standard_rig", "import_weights"] ADD_RIG_PROPERTIES.draw_properties(scene, box, props) box.operator('mpfb.add_standard_rig') def _rigify_rig(self, scene, layout): box = self.create_box(layout, "Add rigify rig") props = ["import_weights_rigify", "delete_after_generate", "generate"] ADD_RIG_PROPERTIES.draw_properties(scene, box, props) box.operator('mpfb.add_rigify_rig') box.operator('mpfb.generate_rigify_rig') def draw(self, context): _LOG.enter() layout = self.layout scene = context.scene self._standard_rig(scene, layout) self._rigify_rig(scene, layout)
class MPFB_PT_MakeClothes_Panel(Abstract_Panel): """MakeClothes main panel.""" bl_label = "MakeClothes" bl_category = UiService.get_value("CLOTHESCATEGORY") bl_options = {'DEFAULT_CLOSED'} bl_parent_id = "MPFB_PT_Create_Panel" def _setup_clothes(self, scene, layout): box = self._create_box(layout, "Set up clothes", "TOOL_SETTINGS") box.operator('mpfb.extract_makeclothes_clothes') box.operator('mpfb.mark_makeclothes_clothes') def _write_clothes(self, blender_object, scene, layout): box = self._create_box(layout, "Write clothes", "MATERIAL_DATA") props = ["overwrite"] MAKECLOTHES_PROPERTIES.draw_properties(scene, box, props) props = ["name", "description", "tag", "license", "author", "homepage"] MakeClothesObjectProperties.draw_properties(blender_object, box, props) box.operator('mpfb.write_makeclothes_clothes') def draw(self, context): _LOG.enter() layout = self.layout scene = context.scene blender_object = context.active_object #self._setup_clothes(scene, layout) if blender_object is None: return
def _populate_presets(self, context): _LOG.enter() _LOG.trace("Context is scene", isinstance(context, bpy.types.Scene)) available_presets = UiService.get_importer_panel_list() if available_presets is None: available_presets = [] return available_presets
class MPFB_PT_Importer_Panel(Abstract_Panel): bl_label = "From MakeHuman" bl_category = UiService.get_value("IMPORTERCATEGORY") bl_options = {'DEFAULT_CLOSED'} bl_parent_id = "MPFB_PT_New_Panel" def draw(self, context): _LOG.enter() layout = self.layout scn = context.scene from mpfb.ui.eyesettings.eyesettingspanel import ensure_eye_settings_default_exists ensure_eye_settings_default_exists() if UiService.get_importer_panel_list() is None: UiService.rebuild_importer_panel_list() if UiService.get_importer_enhanced_settings_panel_list() is None: UiService.rebuild_importer_enhanced_settings_panel_list() if UiService.get_importer_eye_settings_panel_list() is None: UiService.rebuild_importer_eye_settings_panel_list() IMPORTER_PROPERTIES.draw_properties(scn, layout, [ "presets_for_import", "skin_settings_for_import", "eye_settings_for_import" ]) layout.operator('mpfb.importer_import_body')
def _populate_settings(self, context): _LOG.enter() _LOG.trace("Context is scene", isinstance(context, bpy.types.Scene)) available_settings = UiService.get_enhanced_settings_panel_list() if available_settings is None: available_settings = [] return available_settings
def _save_material(self, context, file_name): body = ObjectService.find_object_of_type_amongst_nearest_relatives( context.object, "Basemesh") if not body: body = ObjectService.find_object_of_type_amongst_nearest_relatives( context.object, "Proxymesh") if not body: self.report( {'ERROR'}, "Could not find basemesh or body proxy amongst nearest relatives") return {'FINISHED'} if not MaterialService.has_materials(body): self.report({'ERROR'}, "Body does not have a material") return {'FINISHED'} material_settings = dict() _LOG.debug("material_slots", body.material_slots) for slot in body.material_slots: material = slot.material group_node = NodeService.find_first_node_by_type_name( material.node_tree, "ShaderNodeGroup") if group_node: values = NodeService.get_socket_default_values(group_node) if "colorMixIn" in values: # This seems to be an enhanced skin material name = material.name if "." in name: (prefix, name) = name.split(".", 2) if "." in name: (name, number) = name.split(".", 2) material_settings[name] = values _LOG.dump("material_settings", material_settings) with open(file_name, "w") as json_file: json.dump(material_settings, json_file, indent=4, sort_keys=True) UiService.rebuild_enhanced_settings_panel_list() #UiService.rebuild_importer_panel_list() self.report({'INFO'}, "Presets were written to " + file_name) return {'FINISHED'}
class MPFB_PT_Materials_Panel(Abstract_Panel): bl_label = "Materials" bl_category = UiService.get_value("MATERIALSCATEGORY") def draw(self, context): _LOG.enter() layout = self.layout scn = context.scene
class MPFB_PT_New_Panel(Abstract_Panel): bl_label = "New human" bl_category = UiService.get_value("MODELCATEGORY") def draw(self, context): _LOG.enter() layout = self.layout scn = context.scene
class MPFB_PT_System_Panel(Abstract_Panel): bl_label = "System and resources" bl_category = UiService.get_value("DEVELOPERCATEGORY") def draw(self, context): _LOG.enter() layout = self.layout scn = context.scene
def _save_material(self, context, file_name): eyes = ObjectService.find_object_of_type_amongst_nearest_relatives( context.object, "Eyes") if not eyes: self.report({'ERROR'}, "Could not find eyes amongst nearest relatives") return {'FINISHED'} if not MaterialService.has_materials(eyes): self.report({'ERROR'}, "Eyes do not have a material") return {'FINISHED'} material_settings = dict() _LOG.debug("material_slots", eyes.material_slots) slot = eyes.material_slots[0] material = slot.material group_node = NodeService.find_first_node_by_type_name( material.node_tree, "ShaderNodeGroup") if group_node: material_settings = NodeService.get_socket_default_values(group_node) if "IrisMinorColor" not in material_settings: self.report({'ERROR'}, "Eyes do not seem to have procedural eyes material") return {'FINISHED'} else: self.report({'ERROR'}, "Eyes do not seem to have procedural eyes material") return {'FINISHED'} _LOG.dump("material_settings", material_settings) with open(file_name, "w") as json_file: json.dump(material_settings, json_file, indent=4, sort_keys=True) UiService.rebuild_eye_settings_panel_list() UiService.rebuild_importer_eye_settings_panel_list() self.report({'INFO'}, "Settings were written to " + file_name) return {'FINISHED'}
class MPFB_PT_Enhanced_Settings_Panel(Abstract_Panel): bl_label = "Skin material presets" bl_category = UiService.get_value("MATERIALSCATEGORY") bl_options = {'DEFAULT_CLOSED'} bl_parent_id = "MPFB_PT_Presets_Panel" def _load_save_box(self, scene, layout): _LOG.enter() ENHANCED_SETTINGS_PROPERTIES.draw_properties(scene, layout, ["available_settings"]) layout.operator('mpfb.enhancedsettings_apply_settings') layout.operator('mpfb.overwrite_enhanced_settings') ENHANCED_SETTINGS_PROPERTIES.draw_properties(scene, layout, ["name"]) layout.operator('mpfb.save_new_enhanced_settings') def draw(self, context): _LOG.enter() # TODO: this section should probably also be present in the importer panel default_json = LocationService.get_user_config( "enhanced_settings.default.json") if not os.path.exists(default_json): _LOG.warn( "The default enhanced settings do not exist. Will create at", default_json) template_settings = LocationService.get_mpfb_data("settings") default_json_template = os.path.join( template_settings, "enhanced_settings.default.json") _LOG.warn("Copying from", default_json_template) shutil.copy(default_json_template, default_json) else: _LOG.trace("Default enhanced settings exist") if UiService.get_enhanced_settings_panel_list() is None: UiService.rebuild_enhanced_settings_panel_list() layout = self.layout scene = context.scene self._load_save_box( scene, self._create_box(layout, "Load/save presets", "MODIFIER")) @classmethod def poll(cls, context): obj = context.active_object if not obj: return False if ObjectService.object_is_basemesh_or_body_proxy(obj): return True if ObjectService.object_is_skeleton(obj): return True return False
class MPFB_PT_Developer_Panel(bpy.types.Panel): """UI for various developer functions.""" bl_label = "Developer" bl_space_type = "VIEW_3D" bl_region_type = "UI" bl_category = UiService.get_value("DEVELOPERCATEGORY") bl_options = {'DEFAULT_CLOSED'} def _create_box(self, layout, box_text): _LOG.enter() box = layout.box() box.label(text=box_text) return box def _log_levels(self, scene, layout): box = self._create_box(layout, "Log levels") box.operator("mpfb.list_log_levels") box.operator("mpfb.reset_log_levels") LOG_LEVELS_PROPERTIES.draw_properties( scene, box, ["available_loggers", "chosen_level"]) box.operator("mpfb.set_log_level") def _export_log_file(self, scene, layout): box = self._create_box(layout, "Export log file") box.label(text="Use default for combined log") LOG_LEVELS_PROPERTIES.draw_properties(scene, box, ["available_loggers"]) box.operator("mpfb.export_log") def _nodes(self, layout): box = self._create_box(layout, "Load/save nodes") box.operator("mpfb.save_nodes") box.operator("mpfb.load_nodes") def _rig(self, layout): box = self._create_box(layout, "Load/Save rig") box.operator("mpfb.load_rig") box.operator("mpfb.save_rig") box.operator("mpfb.load_rigify_layers") box.operator("mpfb.save_rigify_layers") def _weights(self, layout): box = self._create_box(layout, "Load/Save weights") #box.operator("mpfb.load_rig") box.operator("mpfb.save_weights") def draw(self, context): _LOG.enter() layout = self.layout scene = context.scene self._log_levels(scene, layout) self._export_log_file(scene, layout) self._nodes(layout) self._rig(layout) self._weights(layout)
class MPFB_PT_MakeSkin_Panel(Abstract_Panel): """MakeSkin main panel.""" bl_label = "MakeSkin" bl_category = UiService.get_value("MATERIALSCATEGORY") bl_options = {'DEFAULT_CLOSED'} bl_parent_id = "MPFB_PT_Create_Panel" def _create_material(self, scene, layout): box = self._create_box(layout, "Create material", "TOOL_SETTINGS") props = [ "overwrite", #"create_node_visualization" "create_diffusetexture", "create_normalmap", "create_bumpmap", "create_transmissionmap", "create_roughnessmap", "create_metallicmap", "create_displacementmap" ] MAKESKIN_PROPERTIES.draw_properties(scene, box, props) box.operator('mpfb.create_makeskin_material') def _import_material(self, layout): box = self._create_box(layout, "Import", "MATERIAL_DATA") box.operator('mpfb.import_makeskin_material') def _save_material(self, blender_object, layout): box = self._create_box(layout, "Write material", "MATERIAL_DATA") props = [ "name", "description", "tag", "license", "author", "homepage", "backface_culling", "cast_shadows", "receive_shadows", "alpha_to_coverage", "shadeless", "wireframe", "transparent", "depthless", "sss_enable", "auto_blend", "textures", "use_litsphere", "litsphere" ] MakeSkinObjectProperties.draw_properties(blender_object, box, props) box.operator('mpfb.write_makeskin_material') def draw(self, context): _LOG.enter() layout = self.layout scene = context.scene blender_object = context.active_object if blender_object is None: return if blender_object.type == "MESH": self._create_material(scene, layout) self._import_material(layout) self._save_material(blender_object, layout)
class MPFB_PT_Rigify_Panel(Abstract_Panel): """The rigfy functionality panel.""" bl_label = "Convert to rigify" bl_category = UiService.get_value("RIGCATEGORY") bl_options = {'DEFAULT_CLOSED'} bl_parent_id = "MPFB_PT_Rig_Panel" def draw(self, context): _LOG.enter() layout = self.layout scene = context.scene RIGIFY_PROPERTIES.draw_properties(scene, layout, ["produce", "keep_meta"]) layout.operator("mpfb.convert_to_rigify")
def draw(self, context): _LOG.enter() layout = self.layout scn = context.scene from mpfb.ui.eyesettings.eyesettingspanel import ensure_eye_settings_default_exists ensure_eye_settings_default_exists() if UiService.get_importer_panel_list() is None: UiService.rebuild_importer_panel_list() if UiService.get_importer_enhanced_settings_panel_list() is None: UiService.rebuild_importer_enhanced_settings_panel_list() if UiService.get_importer_eye_settings_panel_list() is None: UiService.rebuild_importer_eye_settings_panel_list() IMPORTER_PROPERTIES.draw_properties(scn, layout, [ "presets_for_import", "skin_settings_for_import", "eye_settings_for_import" ]) layout.operator('mpfb.importer_import_body')
class MPFB_PT_NewHuman_Panel(bpy.types.Panel): """Create human from scratch main panel.""" bl_label = "From scratch" bl_space_type = "VIEW_3D" bl_region_type = "UI" bl_category = UiService.get_value("MODELCATEGORY") bl_options = {'DEFAULT_CLOSED'} bl_parent_id = "MPFB_PT_New_Panel" def _create_box(self, layout, box_text): _LOG.enter() box = layout.box() box.label(text=box_text) return box def _create(self, scene, layout): box = self._create_box(layout, "Create") NEW_HUMAN_PROPERTIES.draw_properties(scene, box, [ "scale_factor", "detailed_helpers", "extra_vertex_groups", "mask_helpers" ]) box.operator('mpfb.create_human') def _phenotype(self, scene, layout): box = self._create_box(layout, "Phenotype") NEW_HUMAN_PROPERTIES.draw_properties(scene, box, [ "phenotype_gender", "phenotype_age", "phenotype_muscle", "phenotype_weight", "phenotype_height", "phenotype_race", "add_phenotype", "phenotype_influence" ]) def _breast(self, scene, layout): box = self._create_box(layout, "Breast") NEW_HUMAN_PROPERTIES.draw_properties(scene, box, [ "phenotype_breastsize", "phenotype_breastfirmness", "add_breast", "breast_influence" ]) def draw(self, context): _LOG.enter() layout = self.layout scene = context.scene self._phenotype(scene, layout) self._breast(scene, layout) self._create(scene, layout)
class MPFB_PT_Eye_Settings_Panel(Abstract_Panel): """Panel for saving/loading eye material settings.""" bl_label = "Eye material presets" bl_category = UiService.get_value("MATERIALSCATEGORY") bl_options = {'DEFAULT_CLOSED'} bl_parent_id = "MPFB_PT_Presets_Panel" def _load_save_box(self, scene, layout): _LOG.enter() EYE_SETTINGS_PROPERTIES.draw_properties(scene, layout, ["available_settings"]) layout.operator('mpfb.eyesettings_apply_settings') layout.operator('mpfb.overwrite_eye_settings') EYE_SETTINGS_PROPERTIES.draw_properties(scene, layout, ["name"]) layout.operator('mpfb.save_new_eye_settings') def draw(self, context): _LOG.enter() ensure_eye_settings_default_exists() if UiService.get_eye_settings_panel_list() is None: UiService.rebuild_eye_settings_panel_list() layout = self.layout scene = context.scene self._load_save_box( scene, self._create_box(layout, "Load/save presets", "MODIFIER")) @classmethod def poll(cls, context): obj = context.active_object if not obj: return False if ObjectService.object_is_basemesh_or_body_proxy(obj): return True if ObjectService.object_is_skeleton(obj): return True if ObjectService.object_is_eyes(obj): return True return False
class MPFB_PT_Load_Clothes_Panel(Abstract_Panel): """UI for loading MHCLO files.""" bl_label = "Load MHCLO" bl_category = UiService.get_value("CLOTHESCATEGORY") bl_options = {'DEFAULT_CLOSED'} bl_parent_id = "MPFB_PT_Assets_Panel" def draw(self, context): _LOG.enter() layout = self.layout scene = context.scene LOAD_CLOTHES_PROPERTIES.draw_properties(scene, layout, [ "object_type", "material_type", "fit_to_body", "delete_group", "specific_delete_group", "set_up_rigging", "interpolate_weights", "makeclothes_metadata" ]) layout.operator("mpfb.load_clothes")
class Abstract_Panel(bpy.types.Panel): """Human modeling panel.""" bl_label = "Abstract panel" bl_space_type = "VIEW_3D" bl_region_type = "UI" bl_category = UiService.get_value("DEVELOPERCATEGORY") bl_options = {'DEFAULT_CLOSED'} def create_box(self, layout, box_text, icon=None): _LOG.enter() box = layout.box() box.label(text=box_text) return box def _create_box(self, layout, box_text, icon=None): return self.create_box(layout, box_text, icon)
class MPFB_PT_MakeTarget_Panel(Abstract_Panel): """MakeTarget main panel.""" bl_label = "MakeTarget" bl_category = UiService.get_value("TARGETSCATEGORY") bl_options = {'DEFAULT_CLOSED'} bl_parent_id = "MPFB_PT_Create_Panel" def _initialize_target(self, blender_object, layout): box = self._create_box(layout, "Initialize", "TOOL_SETTINGS") props = ["name"] MakeTargetObjectProperties.draw_properties(blender_object, box, props) box.operator('mpfb.create_maketarget_target') box.operator('mpfb.import_maketarget_target') def _save_target(self, scene, layout): box = self._create_box(layout, "Save target", "TOOL_SETTINGS") box.operator('mpfb.write_maketarget_target') def _symmetrize_target(self, scene, layout): box = self._create_box(layout, "Symmetrize", "TOOL_SETTINGS") box.operator('mpfb.symmetrize_maketarget_left') box.operator('mpfb.symmetrize_maketarget_right') def _debug_target(self, scene, layout): box = self._create_box(layout, "Debug", "TOOL_SETTINGS") box.operator('mpfb.print_maketarget_target') def draw(self, context): _LOG.enter() layout = self.layout scene = context.scene blender_object = context.active_object if blender_object is None: return object_type = GeneralObjectProperties.get_value("object_type", entity_reference=blender_object) if object_type == "Basemesh": if not blender_object.data.shape_keys: self._initialize_target(blender_object, layout) else: self._save_target(scene, layout) self._symmetrize_target(scene, layout) self._debug_target(scene, layout)
class MPFB_PT_Asset_Settings_Panel(Abstract_Panel): """Settings for loading asset files.""" bl_label = "Library Settings" bl_category = UiService.get_value("CLOTHESCATEGORY") bl_options = {'DEFAULT_CLOSED'} bl_parent_id = "MPFB_PT_Assets_Panel" def _draw_mhclo(self, scene, layout): box = layout.box() box.label(text="Clothes, Bodyparts & Proxies") ASSET_SETTINGS_PROPERTIES.draw_properties(scene, box, [ "fit_to_body", "mask_base_mesh", "delete_group", "specific_delete_group", "set_up_rigging", "interpolate_weights", "add_subdiv_modifier", "subdiv_levels", "makeclothes_metadata" ]) def _draw_skin(self, scene, layout): box = layout.box() box.label(text="Skin") ASSET_SETTINGS_PROPERTIES.draw_properties( scene, box, ["skin_type", "material_instances"]) def _draw_eyes(self, scene, layout): box = layout.box() box.label(text="Eyes") ASSET_SETTINGS_PROPERTIES.draw_properties(scene, box, ["procedural_eyes"]) def _packs(self, scene, layout): box = layout.box() box.label(text="Asset packs") box.operator("mpfb.load_pack") def draw(self, context): _LOG.enter() layout = self.layout scene = context.scene self._draw_skin(scene, layout) self._draw_eyes(scene, layout) self._draw_mhclo(scene, layout) self._packs(scene, layout)
class MPFB_PT_Rig_Panel(Abstract_Panel): bl_label = "Rigging" bl_category = UiService.get_value("MODELCATEGORY") def draw(self, context): _LOG.enter() layout = self.layout scn = context.scene @classmethod def poll(cls, context): obj = context.active_object if not obj: return False if ObjectService.object_is_basemesh_or_body_proxy(obj): return True if ObjectService.object_is_skeleton(obj): return True return False
class MPFB_PT_Model_Panel(bpy.types.Panel): """Human modeling panel.""" bl_label = "Model" bl_idname = "MPFB_PT_Model_Panel" bl_space_type = "VIEW_3D" bl_region_type = "UI" bl_category = UiService.get_value("MODELCATEGORY") bl_options = {'DEFAULT_CLOSED'} def _create_box(self, layout, box_text): _LOG.enter() box = layout.box() box.label(text=box_text) return box def _refit(self, scene, layout): box = self._create_box(layout, "Refit") #======================================================================= # NEW_HUMAN_PROPERTIES.draw_properties(scene, box, [ # "scale_factor", # "detailed_helpers", # "extra_vertex_groups", # "mask_helpers" # ]) # box.operator('mpfb.create_human') #======================================================================= def draw(self, context): _LOG.enter() layout = self.layout scene = context.scene self._refit(scene, layout) @classmethod def poll(cls, context): return ObjectService.object_is_basemesh(context.active_object)