diff --git a/.gitignore b/.gitignore index 428597a..8b154be 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ # Editor Files/Folder .vscode/ +__pycache__ \ No newline at end of file diff --git a/README.md b/README.md index b961272..cedef8f 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,17 @@ # Blender Addon Pipeline -Pipeline import/export/open for OBJ, FBX, ZBrushCore, Substance Painter, iClone, Daz3D. +Pipeline import/export/open for ZBrushCore, Substance Painter, iClone, Daz3D. # Features -## Info Toolbar -- Hide Render Engines Selector -- Hide Scene Selector -- Hide Unneeded Applications -## OBJ -- One click OBJ Import (Excluding manual file/path selection) -- One click OBJ Export (Exports selected object to export folder) -## FBX -- One click FBX Import (Excluding manual file/path selection) -- One click FBX Export (Exports scene to export folder) ## ZBrushCore - One click ZBrushCore OBJ Export (Exports selected object to export folder and opens file in ZBrushCore) - One click ZBrushCore OBJ Import (Imports exported obj and replaces vertices co-ordinates on selected object) +\* When exporting from ZBrushCore be sure to export to the same obj file that was used for import. ## Substance Painter -- Application Link to Open Substance Painter (Exports scene to export folder before opening Substance Painter) +- One Click Substance Painter OBJ Export (Exports selected object to export folder and opens file in Substance Painter) +- One Click Substance Painter FBX Export (Exports scene to export folder and opens file in Substance Painter) +\* Creates SPP Project File based on blender filename and passes texture folder for export. ## iClone/Character Creator/3DXchange - One click iClone Base FBX Template Import (Copies "Base.fbxkey" to export folder and renames it to the Blender "filename.fbxkey") - One click iClone Female FBX Template Import (Copies "Base Female.fbxkey" to export folder and renames it to the Blender "filename.fbxkey") @@ -33,20 +26,16 @@ Pipeline import/export/open for OBJ, FBX, ZBrushCore, Substance Painter, iClone, 2.79.0 -\* May work in previous versions but untested, space_info.py will likely cause issues/unexpected behaviour. +\* Will likely work in previous versions but untested. # IMPORTANT USAGE NOTES -\* Make sure you have a saved .blend file before using the auto import/export features, then saving before import/export is then not required. The addon needs the file location to know where to create the export folder used for import/export of the files. +\* Make sure you have a saved .blend file before using the auto import/export features, then saving before import/export is then not required. The addon needs the file location to know where to create the export and textures folder used for import/export of the files. - File Naming Convention File names are derived from the selected object name or your blender file name. -- ZBrushCore - - When exporting from ZBrushCore be sure to export to the same obj file that was used for import. - # Installation Download either the tar.gz or zip from [https://github.com/Digiography/blender_addon_pipeline/releases/latest](https://github.com/Digiography/blender_addon_pipeline/releases/latest) diff --git a/__init__.py b/__init__.py index 41a8b7c..633360a 100644 --- a/__init__.py +++ b/__init__.py @@ -20,9 +20,9 @@ "name": "Pipeline", "description": "3D Pipeline Tools", "author": "Digiography.Studio", - "version": (0, 8, 0), + "version": (0, 9, 0), "blender": (2, 79, 0), - "location": "Properties > Scene, Info Toolbar, 3D View Toolbar", + "location": "Info Toolbar, File -> Import, File -> Export", "wiki_url": "https://github.com/Digiography/blender_addon_pipeline/wiki", "tracker_url": "https://github.com/Digiography/blender_addon_pipeline/issues", "category": "System", @@ -30,61 +30,9 @@ import bpy +from bpy.types import Header, Menu from os import path, makedirs -class ds_render_engine_cycles(bpy.types.Operator): - - bl_idname = "ds_render_engine.cycles" - bl_label = "Set Render Engine to CYCLES" - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - - def execute(self, context): - - bpy.context.scene.render.engine = 'CYCLES' - - return {'FINISHED'} - -class ds_render_engine_game(bpy.types.Operator): - - bl_idname = "ds_render_engine.game" - bl_label = "Set Render Engine to BLENDER_GAME" - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - - def execute(self, context): - - bpy.context.scene.render.engine = 'BLENDER_GAME' - - return {'FINISHED'} - -class ds_scene(bpy.types.Panel): - - bl_idname = "ds.scene" - bl_label = "Pipeline" - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - - @classmethod - def poll(cls, context): - return (context.scene is not None) - - def draw(self, context): - - layout = self.layout - - if bpy.context.blend_data and bpy.context.blend_data.filepath: - - _export_path = bpy.path.abspath('//') + bpy.context.user_preferences.addons[__package__].preferences.option_export_folder + '//' - if not path.exists(_export_path): - makedirs(_export_path) - - if bpy.context.scene.render.engine != 'CYCLES': - layout.operator('ds_render_engine.cycles') - - if bpy.context.scene.render.engine != 'BLENDER_GAME': - layout.operator('ds_render_engine.game') - class ds_pipeline_addon_prefs(bpy.types.AddonPreferences): bl_idname = __package__ @@ -123,31 +71,15 @@ class ds_pipeline_addon_prefs(bpy.types.AddonPreferences): name="Export Folder Name", default="eXport", ) + option_textures_folder = bpy.props.StringProperty( + name="Textures Folder Name", + default="Textures", + ) option_ic_templates_path = bpy.props.StringProperty( name="iClone Templates Path", subtype='DIR_PATH', default="", ) - option_hide_info_screens = bpy.props.BoolProperty( - name="Screens", - default=True, - ) - option_hide_info_engines = bpy.props.BoolProperty( - name="Engines", - default=True, - ) - option_hide_info_scene = bpy.props.BoolProperty( - name="Scene", - default=True, - ) - option_hide_info_switcher = bpy.props.BoolProperty( - name="Toolbar Switcher", - default=True, - ) - option_hide_info_menus = bpy.props.BoolProperty( - name="Menus", - default=True, - ) option_show_zbc = bpy.props.BoolProperty( name="Show ZBrushCore Buttons", default=True, @@ -164,170 +96,33 @@ class ds_pipeline_addon_prefs(bpy.types.AddonPreferences): name="Show Daz3D Button", default=True, ) - option_show_open = bpy.props.BoolProperty( - name="Open Button", - default=True, - ) option_show_file_icons = bpy.props.BoolProperty( name="File Icons Only", default=True, ) - option_show_new = bpy.props.BoolProperty( - name="New Button", - default=True, - ) - option_show_save = bpy.props.BoolProperty( - name="Save Button", - default=True, - ) - option_show_save_as = bpy.props.BoolProperty( - name="Save As Button", - default=True, - ) - option_show_prefs = bpy.props.BoolProperty( - name="Preferences", - default=True, - ) - option_show_screen_3dview = bpy.props.BoolProperty( - name="3D View Full", - default=True, - ) - option_show_screen_anim = bpy.props.BoolProperty( - name="Animation", + option_save_before_export = bpy.props.BoolProperty( + name="Save Before Export", default=True, ) - option_show_screen_compositing = bpy.props.BoolProperty( - name="Compositing", - default=True, - ) - option_show_screen_default = bpy.props.BoolProperty( - name="Default", - default=True, - ) - option_show_screen_game = bpy.props.BoolProperty( - name="Game Logic", - default=True, - ) - option_show_screen_motion = bpy.props.BoolProperty( - name="Motion Tracking", - default=True, - ) - option_show_screen_scripting = bpy.props.BoolProperty( - name="Scripting", - default=False, - ) - option_show_screen_uv = bpy.props.BoolProperty( - name="UV Editing", - default=True, - ) - option_show_screen_video = bpy.props.BoolProperty( - name="Video Editing", - default=True, - ) - option_show_console = bpy.props.BoolProperty( - name="Console Toggle", - default=True, - ) - option_show_fullscreen = bpy.props.BoolProperty( - name="Fullscreen", - default=True, - ) - option_show_menu_toggle = bpy.props.BoolProperty( - name="Menu Toggle", - default=True, - ) - option_show_menu_toggle_state = bpy.props.BoolProperty( - name="Menu Toggle Button State", - default=False, - ) - option_show_screens_toggle = bpy.props.BoolProperty( - name="Screens Toggle", - default=True, - ) - option_show_screens_toggle_state = bpy.props.BoolProperty( - name="Screens Toggle Button State", - default=False, - ) - option_show_quit = bpy.props.BoolProperty( - name="Quit", - default=True, - ) - option_move_blender_left = bpy.props.BoolProperty( - name="Blender Left", - default=True, - ) - option_hide_info_stats = bpy.props.BoolProperty( - name="Stats", - default=False, - ) - option_show_iclone_toggle = bpy.props.BoolProperty( - name="iClone Toggle", - default=True, - ) - option_show_iclone_toggle_state = bpy.props.BoolProperty( - name="iClone Toggle Button State", - default=False, - ) + options_display_types = [('Buttons', "Buttons", "Buttons"),('Menu', "Menu", "Menu"),('Hide', "Hide", "Hide"),] + option_display_type = bpy.props.EnumProperty( + items=options_display_types, + name="Display Type", + default='Buttons', + ) def draw(self, context): layout = self.layout - layout.label('Info toolbar',icon='PREFERENCES') - - row = layout.row(align=True) - - col = row.column() - subrow = col.row() - box=subrow.box() - box.label('Hide',icon='UI') - box.prop(self, 'option_hide_info_switcher') - box.prop(self, 'option_hide_info_menus') - box.prop(self, 'option_hide_info_screens') - box.prop(self, 'option_hide_info_scene') - box.prop(self, 'option_hide_info_engines') - box.prop(self, 'option_hide_info_stats') - - subrow = col.row() - - box=subrow.box() - box.label('Move',icon='UI') - box.prop(self, 'option_move_blender_left') - - col = row.column() - box=col.box() - box.label('Show',icon='UI') - box.prop(self, 'option_show_menu_toggle') - box.prop(self, 'option_show_screens_toggle') - box.prop(self, 'option_show_iclone_toggle') - box.prop(self, 'option_show_file_icons') - box.prop(self, 'option_show_new') - box.prop(self, 'option_show_open') - box.prop(self, 'option_show_save') - box.prop(self, 'option_show_save_as') - box.prop(self, 'option_show_fullscreen') - box.prop(self, 'option_show_prefs') - box.prop(self, 'option_show_console') - box.prop(self, 'option_show_quit') - - col = row.column() - box=col.box() - box.label('Screens',icon='UI') - box.prop(self, 'option_show_screen_3dview') - box.prop(self, 'option_show_screen_anim') - box.prop(self, 'option_show_screen_compositing') - box.prop(self, 'option_show_screen_default') - box.prop(self, 'option_show_screen_game') - box.prop(self, 'option_show_screen_motion') - box.prop(self, 'option_show_screen_scripting') - box.prop(self, 'option_show_screen_uv') - box.prop(self, 'option_show_screen_video') - box=layout.box() - box.label('Export Folder',icon='PREFERENCES') - box.label('* Do NOT include any "\\".',icon='INFO') + box.prop(self, 'option_display_type') + box=layout.box() + box.label("Folders",icon='PREFERENCES') box.prop(self, 'option_export_folder') + box.prop(self, 'option_textures_folder') + box.label('* Do NOT include any "\\".',icon='INFO') box.label('Automatically created as a sub folder relative to the saved .blend file.',icon='INFO') - + box.prop(self, 'option_save_before_export') box=layout.box() box.label('Applications',icon='PREFERENCES') box.prop(self, 'option_show_zbc') @@ -342,168 +137,6 @@ def draw(self, context): box.prop(self, 'option_show_daz3d') box.prop(self, 'option_daz3d_exe') - -class ds_pipeline_console(bpy.types.Operator): - bl_idname = "ds_pipeline.console" - bl_label = "Toggle Console" - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - def execute(self, context): - bpy.ops.wm.console_toggle() - return {'FINISHED'} - -class ds_pipeline_fullscreen(bpy.types.Operator): - bl_idname = "ds_pipeline.fullscreen" - bl_label = "Toggle Fullscreen" - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - def execute(self, context): - bpy.ops.wm.window_fullscreen_toggle() - return {'FINISHED'} - -class ds_pipeline_menu_toggle(bpy.types.Operator): - bl_idname = "ds_pipeline.menu_toggle" - bl_label = "Menu" - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - def execute(self, context): - - if not bpy.context.user_preferences.addons[__package__].preferences.option_show_menu_toggle_state: - bpy.context.user_preferences.addons[__package__].preferences.option_show_menu_toggle_state=True - else: - bpy.context.user_preferences.addons[__package__].preferences.option_show_menu_toggle_state=False - return {'FINISHED'} - -class ds_pipeline_screens_toggle(bpy.types.Operator): - bl_idname = "ds_pipeline.screens_toggle" - bl_label = "Screens" - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - def execute(self, context): - - if not bpy.context.user_preferences.addons[__package__].preferences.option_show_screens_toggle_state: - bpy.context.user_preferences.addons[__package__].preferences.option_show_screens_toggle_state=True - else: - bpy.context.user_preferences.addons[__package__].preferences.option_show_screens_toggle_state=False - return {'FINISHED'} - -class ds_pipeline_iclone_toggle(bpy.types.Operator): - bl_idname = "ds_pipeline.iclone_toggle" - bl_label = "iClone" - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - def execute(self, context): - - if not bpy.context.user_preferences.addons[__package__].preferences.option_show_iclone_toggle_state: - bpy.context.user_preferences.addons[__package__].preferences.option_show_iclone_toggle_state=True - else: - bpy.context.user_preferences.addons[__package__].preferences.option_show_iclone_toggle_state=False - return {'FINISHED'} - -class ds_pipeline_quit(bpy.types.Operator): - bl_idname = "ds_pipeline.quit" - bl_label = "Quit" - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - def execute(self, context): - bpy.ops.wm.quit_blender() - return {'FINISHED'} - -class ds_pipeline_screen_default(bpy.types.Operator): - - bl_idname = "ds_pipeline.screen_default" - bl_label = "Open Preferences" - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - - def execute(self, context): - - bpy.context.window.screen = bpy.data.screens['Default'] - - return {'FINISHED'} - -class ds_pipeline_screen_3dview(bpy.types.Operator): - bl_idname = "ds_pipeline.screen_3dview" - bl_label = "3D View" - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - def execute(self, context): - bpy.context.window.screen = bpy.data.screens['3D View Full'] - bpy.context.user_preferences.addons[__package__].preferences.option_show_screens_toggle_state=False - return {'FINISHED'} -class ds_pipeline_screen_anim(bpy.types.Operator): - bl_idname = "ds_pipeline.screen_anim" - bl_label = "Animation" - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - def execute(self, context): - bpy.context.window.screen = bpy.data.screens['Animation'] - bpy.context.user_preferences.addons[__package__].preferences.option_show_screens_toggle_state=False - return {'FINISHED'} -class ds_pipeline_screen_compositing(bpy.types.Operator): - bl_idname = "ds_pipeline.screen_compositing" - bl_label = "Compositing" - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - def execute(self, context): - bpy.context.window.screen = bpy.data.screens['Compositing'] - bpy.context.user_preferences.addons[__package__].preferences.option_show_screens_toggle_state=False - return {'FINISHED'} -class ds_pipeline_screen_default(bpy.types.Operator): - bl_idname = "ds_pipeline.screen_default" - bl_label = "Default" - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - def execute(self, context): - bpy.context.window.screen = bpy.data.screens['Default'] - bpy.context.user_preferences.addons[__package__].preferences.option_show_screens_toggle_state=False - return {'FINISHED'} -class ds_pipeline_screen_game(bpy.types.Operator): - bl_idname = "ds_pipeline.screen_game" - bl_label = "Game Logic" - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - def execute(self, context): - bpy.context.window.screen = bpy.data.screens['Game Logic'] - bpy.context.user_preferences.addons[__package__].preferences.option_show_screens_toggle_state=False - return {'FINISHED'} -class ds_pipeline_screen_motion(bpy.types.Operator): - bl_idname = "ds_pipeline.screen_motion" - bl_label = "Motion Tracking" - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - def execute(self, context): - bpy.context.window.screen = bpy.data.screens['Motion Tracking'] - bpy.context.user_preferences.addons[__package__].preferences.option_show_screens_toggle_state=False - return {'FINISHED'} -class ds_pipeline_screen_scripting(bpy.types.Operator): - bl_idname = "ds_pipeline.screen_scripting" - bl_label = "Scripting" - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - def execute(self, context): - bpy.context.window.screen = bpy.data.screens['Scripting'] - bpy.context.user_preferences.addons[__package__].preferences.option_show_screens_toggle_state=False - return {'FINISHED'} -class ds_pipeline_screen_uv(bpy.types.Operator): - bl_idname = "ds_pipeline.screen_uv" - bl_label = "UV Editing" - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - def execute(self, context): - bpy.context.window.screen = bpy.data.screens['UV Editing'] - bpy.context.user_preferences.addons[__package__].preferences.option_show_screens_toggle_state=False - return {'FINISHED'} -class ds_pipeline_screen_video(bpy.types.Operator): - bl_idname = "ds_pipeline.screen_video" - bl_label = "Video Editing" - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - def execute(self, context): - bpy.context.window.screen = bpy.data.screens['Video Editing'] - bpy.context.user_preferences.addons[__package__].preferences.option_show_screens_toggle_state=False - return {'FINISHED'} - class ds_pipeline_prefs_open(bpy.types.Operator): bl_idname = "ds_pipeline.prefs_open" @@ -517,142 +150,100 @@ def execute(self, context): return {'FINISHED'} -class ds_new(bpy.types.Operator): +class Pipeline_Menu(bpy.types.Menu): + bl_label = " Pipeline" + bl_idname = "OBJECT_MT_Pipeline_Menu" - bl_idname = "ds.new" - bl_label = "New" - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - - def execute(self, context): + def draw(self, context): + + layout = self.layout - bpy.ops.wm.read_homefile() + if bpy.context.user_preferences.addons[__package__].preferences.option_show_zbc: - return {'FINISHED'} + self.layout.operator('ds_zbc.export',icon="EXPORT") + self.layout.operator('ds_zbc.import',icon="IMPORT") + self.layout.separator() -class ds_open(bpy.types.Operator): + if bpy.context.user_preferences.addons[__package__].preferences.option_show_sp: - bl_idname = "ds.open" - bl_label = "Open" - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - - def execute(self, context): + self.layout.operator('ds_sp.export_all',icon="LINK_BLEND") + self.layout.operator('ds_sp.export_obj',icon="LINK_BLEND") + self.layout.separator() - bpy.ops.wm.open_mainfile() + if bpy.context.user_preferences.addons[__package__].preferences.option_show_ic: - return {'FINISHED'} + layout.operator('ds_ic.import_base',icon="IMPORT") + layout.operator('ds_ic.import_female',icon="IMPORT") + layout.operator('ds_ic.import_male',icon="IMPORT") + self.layout.separator() -class ds_save(bpy.types.Operator): + layout.operator('ds_ic.export_cc',icon="LINK_BLEND") + layout.operator('ds_ic.export_3dx',icon="EXPORT") + layout.operator('ds_ic.export_ic',icon="LINK_BLEND") + self.layout.separator() - bl_idname = "ds.save" - bl_label = "Save" - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - - def execute(self, context): + if bpy.context.user_preferences.addons[__package__].preferences.option_show_daz3d: - bpy.ops.wm.save_mainfile() + layout.operator('ds_daz3d.export',text="Daz3D",icon="LINK_BLEND") - return {'FINISHED'} +def Draw_Pipeline_Menu(self, context): -class ds_save_as(bpy.types.Operator): + layout = self.layout + layout.menu(Pipeline_Menu.bl_idname,icon="EXPORT") - bl_idname = "ds.save_as" - bl_label = "Save As" - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - - def execute(self, context): +def get_export_path(): - bpy.ops.wm.save_as_mainfile() + _export_path = bpy.path.abspath('//') + bpy.context.user_preferences.addons[__package__].preferences.option_export_folder + '\\' - return {'FINISHED'} + if not path.exists(_export_path): + makedirs(_export_path) + + return _export_path def register(): from bpy.utils import register_class - register_class(ds_pipeline_menu_toggle) - register_class(ds_pipeline_screens_toggle) - register_class(ds_pipeline_iclone_toggle) - - register_class(ds_new) - register_class(ds_open) - register_class(ds_save) - register_class(ds_save_as) register_class(ds_pipeline_addon_prefs) register_class(ds_pipeline_prefs_open) - register_class(ds_pipeline_console) - register_class(ds_pipeline_fullscreen) - register_class(ds_pipeline_quit) - register_class(ds_render_engine_cycles) - register_class(ds_render_engine_game) + from . import ds_obj + from . import ds_fbx + + ds_obj.register() + ds_fbx.register() + + if bpy.context.user_preferences.addons[__package__].preferences.option_show_ic: - register_class(ds_pipeline_screen_3dview) - register_class(ds_pipeline_screen_anim) - register_class(ds_pipeline_screen_compositing) - register_class(ds_pipeline_screen_default) - register_class(ds_pipeline_screen_game) - register_class(ds_pipeline_screen_motion) - register_class(ds_pipeline_screen_scripting) - register_class(ds_pipeline_screen_uv) - register_class(ds_pipeline_screen_video) + from . import ds_ic + ds_ic.register() - register_class(ds_scene) + if bpy.context.user_preferences.addons[__package__].preferences.option_show_zbc: + + from . import ds_zbc + ds_zbc.register() - from . import space_info + if bpy.context.user_preferences.addons[__package__].preferences.option_show_sp: - register_class(space_info.INFO_HT_header) + from . import ds_sp + ds_sp.register() - from . import ds_obj - from . import ds_fbx + if bpy.context.user_preferences.addons[__package__].preferences.option_show_daz3d: - ds_obj.register() - ds_fbx.register() + from . import ds_daz3d + ds_daz3d.register() - from . import ds_ic - from . import ds_zbc - from . import ds_sp - from . import ds_daz3d + if bpy.context.user_preferences.addons[__package__].preferences.option_display_type=='Menu': - ds_ic.register() - ds_zbc.register() - ds_sp.register() - ds_daz3d.register() + register_class(Pipeline_Menu) + bpy.types.INFO_HT_header.append(Draw_Pipeline_Menu) def unregister(): from bpy.utils import unregister_class - unregister_class(ds_pipeline_menu_toggle) - unregister_class(ds_pipeline_screens_toggle) - unregister_class(ds_pipeline_iclone_toggle) - - unregister_class(ds_new) - unregister_class(ds_open) - unregister_class(ds_save) - unregister_class(ds_save_as) unregister_class(ds_pipeline_addon_prefs) unregister_class(ds_pipeline_prefs_open) - unregister_class(ds_pipeline_console) - unregister_class(ds_pipeline_fullscreen) - unregister_class(ds_pipeline_quit) - - unregister_class(ds_render_engine_cycles) - unregister_class(ds_render_engine_game) - unregister_class(ds_scene) - - unregister_class(ds_pipeline_screen_3dview) - unregister_class(ds_pipeline_screen_anim) - unregister_class(ds_pipeline_screen_compositing) - unregister_class(ds_pipeline_screen_default) - unregister_class(ds_pipeline_screen_game) - unregister_class(ds_pipeline_screen_motion) - unregister_class(ds_pipeline_screen_scripting) - unregister_class(ds_pipeline_screen_uv) - unregister_class(ds_pipeline_screen_video) from . import ds_obj from . import ds_fbx @@ -660,19 +251,30 @@ def unregister(): ds_obj.unregister() ds_fbx.unregister() - from . import ds_ic - from . import ds_zbc - from . import ds_sp - from . import ds_daz3d + if bpy.context.user_preferences.addons[__package__].preferences.option_show_ic: + + from . import ds_ic + ds_ic.unregister() + + if bpy.context.user_preferences.addons[__package__].preferences.option_show_zbc: + + from . import ds_zbc + ds_zbc.unregister() + + if bpy.context.user_preferences.addons[__package__].preferences.option_show_sp: + + from . import ds_sp + ds_sp.unregister() + + if bpy.context.user_preferences.addons[__package__].preferences.option_show_daz3d: - ds_ic.unregister() - ds_zbc.unregister() - ds_sp.unregister() - ds_daz3d.unregister() + from . import ds_daz3d + ds_daz3d.unregister() - from . import space_info + if bpy.context.user_preferences.addons[__package__].preferences.option_display_type=='Menu': - unregister_class(space_info.INFO_HT_header) + unregister_class(Pipeline_Menu) + bpy.types.INFO_HT_header.remove(Draw_Pipeline_Menu) if __name__ == "__main__": diff --git a/ds_daz3d.py b/ds_daz3d.py index 4a91637..510ee41 100644 --- a/ds_daz3d.py +++ b/ds_daz3d.py @@ -6,7 +6,7 @@ class ds_daz3d_export(bpy.types.Operator): bl_idname = "ds_daz3d.export" - bl_label = "Open Daz3D." + bl_label = "Daz3D (FBX)" def execute(self, context): @@ -16,14 +16,32 @@ def execute(self, context): return {'FINISHED'} +def menu_func_export(self, context): + self.layout.operator(ds_daz3d_export.bl_idname) + +def toolbar_btn_export(self, context): + self.layout.operator('ds_daz3d.export',text="Daz3D",icon="LINK_BLEND") + def register(): from bpy.utils import register_class register_class(ds_daz3d_export) + bpy.types.INFO_MT_file_export.append(menu_func_export) + + if bpy.context.user_preferences.addons[__package__].preferences.option_display_type=='Buttons': + + bpy.types.INFO_HT_header.append(toolbar_btn_export) + def unregister(): from bpy.utils import unregister_class unregister_class(ds_daz3d_export) + + bpy.types.INFO_MT_file_export.remove(menu_func_export) + + if bpy.context.user_preferences.addons[__package__].preferences.option_display_type=='Buttons': + + bpy.types.INFO_HT_header.remove(toolbar_btn_export) diff --git a/ds_fbx.py b/ds_fbx.py index b74d731..a8cbd48 100644 --- a/ds_fbx.py +++ b/ds_fbx.py @@ -1,18 +1,20 @@ import bpy -from os import path, makedirs +from . import ds_pipeline def ds_fbx_export(self, context): - export_name = bpy.path.basename(bpy.context.blend_data.filepath).replace('.blend','') - export_path = bpy.path.abspath('//') + bpy.context.user_preferences.addons[__package__].preferences.option_export_folder + '//' - if not path.exists(export_path): - makedirs(export_path) - export_file = export_path + export_name + '.fbx' + _export_name = bpy.path.basename(bpy.context.blend_data.filepath).replace('.blend','') + _export_path = ds_pipeline.get_export_path() - bpy.ops.export_scene.fbx(filepath=export_file, check_existing=False, axis_forward='-Z', axis_up='Y', filter_glob="*.fbx", version='BIN7400', ui_tab='MAIN', use_selection=False, global_scale=1.0, apply_unit_scale=True, bake_space_transform=False, object_types={'ARMATURE', 'MESH'}, use_mesh_modifiers=True, mesh_smooth_type='OFF', use_mesh_edges=False, use_tspace=False, use_custom_props=False, add_leaf_bones=False, primary_bone_axis='Y', secondary_bone_axis='X', use_armature_deform_only=False, bake_anim=True, bake_anim_use_all_bones=True, bake_anim_use_nla_strips=True, bake_anim_use_all_actions=True, bake_anim_force_startend_keying=True, bake_anim_step=1.0, bake_anim_simplify_factor=1.0, use_anim=True, use_anim_action_all=True, use_default_take=True, use_anim_optimize=True, anim_optimize_precision=6.0, path_mode='AUTO', embed_textures=False, batch_mode='OFF', use_batch_own_dir=True, use_metadata=True) + _export_file = _export_path + _export_name + '.fbx' + + if not bpy.context.user_preferences.addons[__package__].preferences.option_save_before_export: + bpy.ops.wm.save_mainfile() + + bpy.ops.export_scene.fbx(filepath=_export_file, check_existing=False, axis_forward='-Z', axis_up='Y', filter_glob="*.fbx", version='BIN7400', ui_tab='MAIN', use_selection=False, global_scale=1.0, apply_unit_scale=True, bake_space_transform=False, object_types={'ARMATURE', 'MESH'}, use_mesh_modifiers=True, mesh_smooth_type='OFF', use_mesh_edges=False, use_tspace=False, use_custom_props=False, add_leaf_bones=False, primary_bone_axis='Y', secondary_bone_axis='X', use_armature_deform_only=False, bake_anim=True, bake_anim_use_all_bones=True, bake_anim_use_nla_strips=True, bake_anim_use_all_actions=True, bake_anim_force_startend_keying=True, bake_anim_step=1.0, bake_anim_simplify_factor=1.0, use_anim=True, use_anim_action_all=True, use_default_take=True, use_anim_optimize=True, anim_optimize_precision=6.0, path_mode='AUTO', embed_textures=False, batch_mode='OFF', use_batch_own_dir=True, use_metadata=True) - return export_file + return _export_file class ds_fbx_export_execute(bpy.types.Operator): @@ -21,7 +23,7 @@ class ds_fbx_export_execute(bpy.types.Operator): def execute(self, context): - export_file = ds_fbx_export(self, context) + _export_file = ds_fbx_export(self, context) return {'FINISHED'} diff --git a/ds_ic.py b/ds_ic.py index f3b9f2a..d9a6f36 100644 --- a/ds_ic.py +++ b/ds_ic.py @@ -1,57 +1,64 @@ import bpy from subprocess import Popen -from os import system from .ds_fbx import (ds_fbx_export,) +from os import system, path, makedirs +from . import ds_pipeline class ds_ic_import_base(bpy.types.Operator): bl_idname = "ds_ic.import_base" - bl_label = "Import Base FBX." + bl_label = "iClone Base Template (FBX)" def execute(self, context): _export_name = bpy.path.basename(bpy.context.blend_data.filepath).replace('.blend','') - _export_path = bpy.path.abspath('//') + bpy.context.user_preferences.addons[__package__].preferences.option_export_folder + '\\' + _export_path = ds_pipeline.get_export_path() + system('copy "' + bpy.context.user_preferences.addons[__package__].preferences.option_ic_templates_path + "Base.fbxkey" + '" "' + _export_path + _export_name + '.fbxkey"') - bpy.ops.import_scene.fbx(filepath = bpy.context.user_preferences.addons[__package__].preferences.option_ic_templates_path + "Base.fbx", axis_forward='-Z', axis_up='Y') + bpy.ops.import_scene.fbx(filepath = bpy.context.user_preferences.addons[__package__].preferences.option_ic_templates_path + "Base.fbx", axis_forward='-Z', axis_up='Y', global_scale=1.0) + bpy.ops.object.transform_apply( location=True, rotation = True, scale = True ) return {'FINISHED'} class ds_ic_import_female(bpy.types.Operator): bl_idname = "ds_ic.import_female" - bl_label = "Import Base Female FBX." + bl_label = "iClone Female Template (FBX)" def execute(self, context): _export_name = bpy.path.basename(bpy.context.blend_data.filepath).replace('.blend','') - _export_path = bpy.path.abspath('//') + bpy.context.user_preferences.addons[__package__].preferences.option_export_folder + '\\' + _export_path = ds_pipeline.get_export_path() + system('copy "' + bpy.context.user_preferences.addons[__package__].preferences.option_ic_templates_path + "Base Female.fbxkey" + '" "' + _export_path + _export_name + '.fbxkey"') - bpy.ops.import_scene.fbx(filepath = bpy.context.user_preferences.addons[__package__].preferences.option_ic_templates_path + "Base Female.fbx", axis_forward='-Z', axis_up='Y') + bpy.ops.import_scene.fbx(filepath = bpy.context.user_preferences.addons[__package__].preferences.option_ic_templates_path + "Base Female.fbx", axis_forward='-Z', axis_up='Y', global_scale=1.0) + bpy.ops.object.transform_apply( location=True, rotation = True, scale = True ) return {'FINISHED'} class ds_ic_import_male(bpy.types.Operator): bl_idname = "ds_ic.import_male" - bl_label = "Import Base Male FBX." + bl_label = "iClone Male Template (FBX)" def execute(self, context): _export_name = bpy.path.basename(bpy.context.blend_data.filepath).replace('.blend','') - _export_path = bpy.path.abspath('//') + bpy.context.user_preferences.addons[__package__].preferences.option_export_folder + '\\' + _export_path = ds_pipeline.get_export_path() + system('copy "' + bpy.context.user_preferences.addons[__package__].preferences.option_ic_templates_path + "Base Male.fbxkey" + '" "' + _export_path + _export_name + '.fbxkey"') - bpy.ops.import_scene.fbx(filepath = bpy.context.user_preferences.addons[__package__].preferences.option_ic_templates_path + "Base Male.fbx", axis_forward='-Z', axis_up='Y') + bpy.ops.import_scene.fbx(filepath = bpy.context.user_preferences.addons[__package__].preferences.option_ic_templates_path + "Base Male.fbx", axis_forward='-Z', axis_up='Y', global_scale=1.0) + bpy.ops.object.transform_apply( location=True, rotation = True, scale = True ) return {'FINISHED'} class ds_ic_export_3dx(bpy.types.Operator): bl_idname = "ds_ic.export_3dx" - bl_label = "Export FBX and open in 3DXchange." + bl_label = "3DXchange (FBX)" def execute(self, context): @@ -64,7 +71,7 @@ def execute(self, context): class ds_ic_export_ic(bpy.types.Operator): bl_idname = "ds_ic.export_ic" - bl_label = "Open iClone." + bl_label = "Open iClone" def execute(self, context): @@ -75,7 +82,7 @@ def execute(self, context): class ds_ic_export_cc(bpy.types.Operator): bl_idname = "ds_ic.export_cc" - bl_label = "Export FBX and Open Character Creator." + bl_label = "Character Creator (FBX)" def execute(self, context): @@ -85,6 +92,30 @@ def execute(self, context): return {'FINISHED'} +def menu_func_import_base(self, context): + self.layout.operator(ds_ic_import_base.bl_idname) +def menu_func_import_female(self, context): + self.layout.operator(ds_ic_import_female.bl_idname) +def menu_func_import_male(self, context): + self.layout.operator(ds_ic_import_male.bl_idname) +def menu_func_export_cc(self, context): + self.layout.operator(ds_ic_export_cc.bl_idname) +def menu_func_export_3dx(self, context): + self.layout.operator(ds_ic_export_3dx.bl_idname) + +def toolbar_btn_base(self, context): + self.layout.operator('ds_ic.import_base',text="Base",icon="IMPORT") +def toolbar_btn_female(self, context): + self.layout.operator('ds_ic.import_female',text="Female",icon="IMPORT") +def toolbar_btn_male(self, context): + self.layout.operator('ds_ic.import_male',text="Male",icon="IMPORT") +def toolbar_btn_cc(self, context): + self.layout.operator('ds_ic.export_cc',text="CC",icon="LINK_BLEND") +def toolbar_btn_3dx(self, context): + self.layout.operator('ds_ic.export_3dx',text="3DX",icon="EXPORT") +def toolbar_btn_ic(self, context): + self.layout.operator('ds_ic.export_ic',text="IC",icon="LINK_BLEND") + def register(): from bpy.utils import register_class @@ -96,6 +127,21 @@ def register(): register_class(ds_ic_export_3dx) register_class(ds_ic_export_ic) + bpy.types.INFO_MT_file_import.append(menu_func_import_base) + bpy.types.INFO_MT_file_import.append(menu_func_import_female) + bpy.types.INFO_MT_file_import.append(menu_func_import_male) + bpy.types.INFO_MT_file_export.append(menu_func_export_cc) + bpy.types.INFO_MT_file_export.append(menu_func_export_3dx) + + if bpy.context.user_preferences.addons[__package__].preferences.option_display_type=='Buttons': + + bpy.types.INFO_HT_header.append(toolbar_btn_base) + bpy.types.INFO_HT_header.append(toolbar_btn_female) + bpy.types.INFO_HT_header.append(toolbar_btn_male) + bpy.types.INFO_HT_header.append(toolbar_btn_cc) + bpy.types.INFO_HT_header.append(toolbar_btn_3dx) + bpy.types.INFO_HT_header.append(toolbar_btn_ic) + def unregister(): from bpy.utils import unregister_class @@ -106,3 +152,18 @@ def unregister(): unregister_class(ds_ic_export_cc) unregister_class(ds_ic_export_3dx) unregister_class(ds_ic_export_ic) + + bpy.types.INFO_MT_file_import.remove(menu_func_import_base) + bpy.types.INFO_MT_file_import.remove(menu_func_import_female) + bpy.types.INFO_MT_file_import.remove(menu_func_import_male) + bpy.types.INFO_MT_file_export.remove(menu_func_export_cc) + bpy.types.INFO_MT_file_export.remove(menu_func_export_3dx) + + if bpy.context.user_preferences.addons[__package__].preferences.option_display_type=='Buttons': + + bpy.types.INFO_HT_header.remove(toolbar_btn_base) + bpy.types.INFO_HT_header.remove(toolbar_btn_female) + bpy.types.INFO_HT_header.remove(toolbar_btn_male) + bpy.types.INFO_HT_header.remove(toolbar_btn_cc) + bpy.types.INFO_HT_header.remove(toolbar_btn_3dx) + bpy.types.INFO_HT_header.remove(toolbar_btn_ic) \ No newline at end of file diff --git a/ds_obj.py b/ds_obj.py index 6676cf8..466caa9 100644 --- a/ds_obj.py +++ b/ds_obj.py @@ -1,20 +1,25 @@ import bpy -from os import path, makedirs +from . import ds_pipeline def ds_obj_filename(self, context): _object_name = bpy.context.scene.objects.active.name - _export_path = bpy.path.abspath('//') + bpy.context.user_preferences.addons[__package__].preferences.option_export_folder + '//' - _filename = _export_path + _object_name + '.obj' - - return _filename + _export_path = ds_pipeline.get_export_path() + _export_file = _export_path + _object_name + '.obj' + + if not bpy.context.user_preferences.addons[__package__].preferences.option_save_before_export: + bpy.ops.wm.save_mainfile() + + return _export_file def ds_obj_export(self, context): _export_file = ds_obj_filename(self, context) - bpy.ops.export_scene.obj(filepath=_export_file, use_selection=True, axis_forward='-Z', axis_up='Y', global_scale=100.0, keep_vertex_order=True) + bpy.ops.object.transform_apply( location=True, rotation = True, scale = True ) + + bpy.ops.export_scene.obj(filepath=_export_file, use_selection=True, axis_forward='-Z', axis_up='Y', global_scale=1.0, keep_vertex_order=True) return _export_file diff --git a/ds_pipeline.py b/ds_pipeline.py new file mode 100644 index 0000000..0a021e5 --- /dev/null +++ b/ds_pipeline.py @@ -0,0 +1,21 @@ +import bpy + +from os import path, makedirs + +def get_export_path(): + + _export_path = bpy.path.abspath('//') + bpy.context.user_preferences.addons[__package__].preferences.option_export_folder + '\\' + + if not path.exists(_export_path): + makedirs(_export_path) + + return _export_path + +def get_textures_path(): + + _textures_path = bpy.path.abspath('//') + bpy.context.user_preferences.addons[__package__].preferences.option_textures_folder + '\\' + + if not path.exists(_textures_path): + makedirs(_textures_path) + + return _textures_path \ No newline at end of file diff --git a/ds_sp.py b/ds_sp.py index 3ee153b..a3826a6 100644 --- a/ds_sp.py +++ b/ds_sp.py @@ -2,28 +2,80 @@ from subprocess import Popen from .ds_fbx import (ds_fbx_export,) +from .ds_obj import (ds_obj_export,) -class ds_substance_open(bpy.types.Operator): +from . import ds_pipeline - bl_idname = "ds_sp.export" - bl_label = "Open Substance Painter." +class ds_substance_export_obj(bpy.types.Operator): + + bl_idname = "ds_sp.export_obj" + bl_label = "Substance Painter (OBJ)" + + def execute(self, context): + + _object_name = bpy.context.scene.objects.active.name + _export_path = bpy.path.abspath('//') + _export_project = _export_path + _object_name + '.spp' + _textures_path = ds_pipeline.get_textures_path() + _export_file = ds_obj_export(self, context) + + Popen([bpy.context.user_preferences.addons[__package__].preferences.option_sp_exe, "--disable-version-checking", "--mesh", _export_file, "--export-path", _textures_path, _export_project]) + + return {'FINISHED'} + +class ds_substance_export_all(bpy.types.Operator): + + bl_idname = "ds_sp.export_all" + bl_label = "Substance Painter (FBX)" def execute(self, context): - export_file = ds_fbx_export(self, context) + _export_name = bpy.path.basename(bpy.context.blend_data.filepath).replace('.blend','') + _export_path = bpy.path.abspath('//') + _export_project = _export_path + _export_name + '.spp' + _textures_path = ds_pipeline.get_textures_path() + _export_file = ds_fbx_export(self, context) - Popen([bpy.context.user_preferences.addons[__package__].preferences.option_substance_exe]) + Popen([bpy.context.user_preferences.addons[__package__].preferences.option_sp_exe, "--disable-version-checking", "--mesh", _export_file, "--export-path", _textures_path, _export_project]) return {'FINISHED'} +def menu_func_export_all(self, context): + self.layout.operator(ds_substance_export_all.bl_idname) +def menu_func_export_obj(self, context): + self.layout.operator(ds_substance_export_obj.bl_idname) + +def toolbar_btn_export_all(self, context): + self.layout.operator('ds_sp.export_all',text="SP:All",icon="EXPORT") +def toolbar_btn_export_obj(self, context): + self.layout.operator('ds_sp.export_obj',text="SP:OBJ",icon="EXPORT") + def register(): from bpy.utils import register_class - register_class(ds_substance_open) + register_class(ds_substance_export_all) + register_class(ds_substance_export_obj) + + bpy.types.INFO_MT_file_export.append(menu_func_export_all) + bpy.types.INFO_MT_file_export.append(menu_func_export_obj) + + if bpy.context.user_preferences.addons[__package__].preferences.option_display_type=='Buttons': + + bpy.types.INFO_HT_header.append(toolbar_btn_export_all) + bpy.types.INFO_HT_header.append(toolbar_btn_export_obj) def unregister(): from bpy.utils import unregister_class - unregister_class(ds_substance_open) + unregister_class(ds_substance_export_all) + unregister_class(ds_substance_export_obj) + + bpy.types.INFO_MT_file_export.remove(menu_func_export_all) + bpy.types.INFO_MT_file_export.remove(menu_func_export_obj) + + if bpy.context.user_preferences.addons[__package__].preferences.option_display_type=='Buttons': + + bpy.types.INFO_HT_header.remove(toolbar_btn_export_all) + bpy.types.INFO_HT_header.remove(toolbar_btn_export_obj) \ No newline at end of file diff --git a/ds_zbc.py b/ds_zbc.py index cbe8669..69efbdc 100644 --- a/ds_zbc.py +++ b/ds_zbc.py @@ -7,45 +7,55 @@ class ds_zbc_export(bpy.types.Operator): bl_idname = "ds_zbc.export" - bl_label = "Export Selected Object to ZBC." + bl_label = "ZBrushCore (OBJ)" def execute(self, context): - export_file = ds_obj_export(self, context) + _export_file = ds_obj_export(self, context) - Popen([bpy.context.user_preferences.addons[__package__].preferences.option_zbc_exe,export_file]) + Popen([bpy.context.user_preferences.addons[__package__].preferences.option_zbc_exe,_export_file]) return {'FINISHED'} class ds_zbc_import(bpy.types.Operator): bl_idname = "ds_zbc.import" - bl_label = "Import ZBC Object." + bl_label = "ZBrushCore (OBJ)" def execute(self, context): obj_selected = bpy.context.object obj_selected_mesh = obj_selected.data - bpy.ops.import_scene.obj(filepath = ds_obj_filename(self, context), axis_forward='-Z', axis_up='Y',split_mode='OFF', use_image_search=False) + bpy.ops.object.transform_apply( location=True, rotation = True, scale = True ) + + bpy.ops.import_scene.obj(filepath = ds_obj_filename(self, context), axis_forward='-Z', axis_up='Y',split_mode='OFF', use_image_search=False, use_groups_as_vgroups=False, use_smooth_groups=True) obj_imported = bpy.context.selected_objects[0] obj_imported_mesh = obj_imported.data - bpy.ops.object.transform_apply( rotation = True, scale = True ) + bpy.ops.object.transform_apply( location=True, rotation = True, scale = True ) _vertices=obj_selected_mesh.vertices for _vertice in _vertices: _vertice.co=obj_imported_mesh.vertices[_vertice.index].co - + bpy.ops.object.delete() - obj_selected.scale = (1.0, 1.0, 1.0) - obj_selected.select = True - bpy.ops.object.transform_apply( rotation = True, scale = True ) - return {'FINISHED'} +def menu_func_export(self, context): + self.layout.operator(ds_zbc_export.bl_idname) + +def menu_func_import(self, context): + self.layout.operator(ds_zbc_import.bl_idname) + +def toolbar_btn_import(self, context): + self.layout.operator('ds_zbc.import',text="ZBC",icon="IMPORT") + +def toolbar_btn_export(self, context): + self.layout.operator('ds_zbc.export',text="ZBC",icon="EXPORT") + def register(): from bpy.utils import register_class @@ -53,9 +63,25 @@ def register(): register_class(ds_zbc_import) register_class(ds_zbc_export) + bpy.types.INFO_MT_file_export.append(menu_func_export) + bpy.types.INFO_MT_file_import.append(menu_func_import) + + if bpy.context.user_preferences.addons[__package__].preferences.option_display_type=='Buttons': + + bpy.types.INFO_HT_header.append(toolbar_btn_export) + bpy.types.INFO_HT_header.append(toolbar_btn_import) + def unregister(): from bpy.utils import unregister_class unregister_class(ds_zbc_import) unregister_class(ds_zbc_export) + + bpy.types.INFO_MT_file_import.remove(menu_func_import) + bpy.types.INFO_MT_file_export.remove(menu_func_export) + + if bpy.context.user_preferences.addons[__package__].preferences.option_display_type=='Buttons': + + bpy.types.INFO_HT_header.remove(toolbar_btn_import) + bpy.types.INFO_HT_header.remove(toolbar_btn_export) \ No newline at end of file diff --git a/space_info.py b/space_info.py deleted file mode 100644 index fd2e0ed..0000000 --- a/space_info.py +++ /dev/null @@ -1,504 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# -import bpy -from bpy.types import Header, Menu - -class INFO_HT_header(Header): - bl_space_type = 'INFO' - - def draw(self, context): - layout = self.layout - - window = context.window - scene = context.scene - rd = scene.render - - row = layout.row(align=True) - - if not bpy.context.user_preferences.addons[__package__].preferences.option_hide_info_switcher: - - row.template_header() - - if bpy.context.user_preferences.addons[__package__].preferences.option_move_blender_left: - - row.operator("wm.splash", text="", icon='BLENDER', emboss=False) - - if bpy.context.user_preferences.addons[__package__].preferences.option_show_menu_toggle: - layout.operator('ds_pipeline.menu_toggle',icon='TRIA_RIGHT') - - if not bpy.context.user_preferences.addons[__package__].preferences.option_hide_info_menus or bpy.context.user_preferences.addons[__package__].preferences.option_show_menu_toggle_state: - - INFO_MT_editor_menus.draw_collapsible(context, layout) - - if window.screen.show_fullscreen: - layout.operator("screen.back_to_previous", icon='SCREEN_BACK', text="Back to Previous") - layout.separator() - else: - - if not bpy.context.user_preferences.addons[__package__].preferences.option_hide_info_screens: - layout.template_ID(context.window, "screen", new="screen.new", unlink="screen.delete") - - if not bpy.context.user_preferences.addons[__package__].preferences.option_hide_info_scene: - layout.template_ID(context.screen, "scene", new="scene.new", unlink="scene.delete") - layout.separator() - - if not bpy.context.user_preferences.addons[__package__].preferences.option_hide_info_engines: - if rd.has_multiple_engines: - layout.prop(rd, "engine", text="") - layout.separator() - - if bpy.context.user_preferences.addons[__package__].preferences.option_show_screens_toggle: - layout.operator('ds_pipeline.screens_toggle',icon='TRIA_RIGHT') - - if (not bpy.context.user_preferences.addons[__package__].preferences.option_show_screens_toggle and bpy.context.user_preferences.addons[__package__].preferences.option_show_screen_3dview) or(bpy.context.user_preferences.addons[__package__].preferences.option_show_screen_3dview and bpy.context.user_preferences.addons[__package__].preferences.option_show_screens_toggle_state): - layout.operator('ds_pipeline.screen_3dview') - - if (not bpy.context.user_preferences.addons[__package__].preferences.option_show_screens_toggle and bpy.context.user_preferences.addons[__package__].preferences.option_show_screen_anim) or(bpy.context.user_preferences.addons[__package__].preferences.option_show_screen_anim and bpy.context.user_preferences.addons[__package__].preferences.option_show_screens_toggle_state): - layout.operator('ds_pipeline.screen_anim') - - if (not bpy.context.user_preferences.addons[__package__].preferences.option_show_screens_toggle and bpy.context.user_preferences.addons[__package__].preferences.option_show_screen_compositing) or(bpy.context.user_preferences.addons[__package__].preferences.option_show_screen_compositing and bpy.context.user_preferences.addons[__package__].preferences.option_show_screens_toggle_state): - layout.operator('ds_pipeline.screen_compositing') - - if (not bpy.context.user_preferences.addons[__package__].preferences.option_show_screens_toggle and bpy.context.user_preferences.addons[__package__].preferences.option_show_screen_default) or(bpy.context.user_preferences.addons[__package__].preferences.option_show_screen_default and bpy.context.user_preferences.addons[__package__].preferences.option_show_screens_toggle_state): - layout.operator('ds_pipeline.screen_default') - - if (not bpy.context.user_preferences.addons[__package__].preferences.option_show_screens_toggle and bpy.context.user_preferences.addons[__package__].preferences.option_show_screen_game) or(bpy.context.user_preferences.addons[__package__].preferences.option_show_screen_game and bpy.context.user_preferences.addons[__package__].preferences.option_show_screens_toggle_state): - layout.operator('ds_pipeline.screen_game') - - if (not bpy.context.user_preferences.addons[__package__].preferences.option_show_screens_toggle and bpy.context.user_preferences.addons[__package__].preferences.option_show_screen_motion) or(bpy.context.user_preferences.addons[__package__].preferences.option_show_screen_motion and bpy.context.user_preferences.addons[__package__].preferences.option_show_screens_toggle_state): - layout.operator('ds_pipeline.screen_motion') - - if (not bpy.context.user_preferences.addons[__package__].preferences.option_show_screens_toggle and bpy.context.user_preferences.addons[__package__].preferences.option_show_screen_scripting) or(bpy.context.user_preferences.addons[__package__].preferences.option_show_screen_scripting and bpy.context.user_preferences.addons[__package__].preferences.option_show_screens_toggle_state): - layout.operator('ds_pipeline.screen_scripting') - - if (not bpy.context.user_preferences.addons[__package__].preferences.option_show_screens_toggle and bpy.context.user_preferences.addons[__package__].preferences.option_show_screen_uv) or(bpy.context.user_preferences.addons[__package__].preferences.option_show_screen_uv and bpy.context.user_preferences.addons[__package__].preferences.option_show_screens_toggle_state): - layout.operator('ds_pipeline.screen_uv') - - if (not bpy.context.user_preferences.addons[__package__].preferences.option_show_screens_toggle and bpy.context.user_preferences.addons[__package__].preferences.option_show_screen_video) or(bpy.context.user_preferences.addons[__package__].preferences.option_show_screen_video and bpy.context.user_preferences.addons[__package__].preferences.option_show_screens_toggle_state): - layout.operator('ds_pipeline.screen_video') - - if bpy.context.user_preferences.addons[__package__].preferences.option_show_new: - if bpy.context.user_preferences.addons[__package__].preferences.option_show_file_icons: - _text="" - else: - _text="New" - layout.operator('ds.new',text=_text,icon='NEW') - - if bpy.context.user_preferences.addons[__package__].preferences.option_show_open: - if bpy.context.user_preferences.addons[__package__].preferences.option_show_file_icons: - _text="" - else: - _text="Open" - layout.operator('ds.open',text=_text,icon='FILE_FOLDER') - - if bpy.context.user_preferences.addons[__package__].preferences.option_show_save: - if bpy.context.user_preferences.addons[__package__].preferences.option_show_file_icons: - _text="" - else: - _text="Save" - if bpy.data.is_dirty: - layout.operator('ds.save',text=_text,icon='LINK') - else: - layout.operator('ds.save',text=_text,icon='FILE_TICK') - - if bpy.context.user_preferences.addons[__package__].preferences.option_show_save_as: - if bpy.context.user_preferences.addons[__package__].preferences.option_show_file_icons: - _text="" - else: - _text="Save As" - layout.operator('wm.save_as_mainfile',text=_text,icon='SAVE_AS') - - layout.operator('import_scene.fbx',text="FBX",icon="IMPORT") - layout.operator('ds_fbx.export',text="FBX",icon="EXPORT") - - layout.operator('import_scene.obj',text="OBJ",icon="IMPORT") - layout.operator('ds_obj.export',text="OBJ",icon="EXPORT") - - layout.separator() - - if bpy.context.user_preferences.addons[__package__].preferences.option_show_zbc: - - self.layout.operator('ds_zbc.export',text="ZBC",icon="EXPORT") - self.layout.operator('ds_zbc.import',text="ZBC",icon="IMPORT") - - if bpy.context.user_preferences.addons[__package__].preferences.option_show_sp: - - self.layout.operator('ds_sp.export',text="SP",icon="LINK_BLEND") - - if bpy.context.user_preferences.addons[__package__].preferences.option_show_ic and bpy.context.user_preferences.addons[__package__].preferences.option_show_iclone_toggle: - layout.operator('ds_pipeline.iclone_toggle',icon='TRIA_RIGHT') - - if (not bpy.context.user_preferences.addons[__package__].preferences.option_show_iclone_toggle and bpy.context.user_preferences.addons[__package__].preferences.option_show_ic) or (bpy.context.user_preferences.addons[__package__].preferences.option_show_ic and bpy.context.user_preferences.addons[__package__].preferences.option_show_iclone_toggle and bpy.context.user_preferences.addons[__package__].preferences.option_show_iclone_toggle_state): - - layout.operator('ds_ic.import_base',text="Base",icon="IMPORT") - layout.operator('ds_ic.import_female',text="Female",icon="IMPORT") - layout.operator('ds_ic.import_male',text="Male",icon="IMPORT") - - layout.operator('ds_ic.export_cc',text="CC",icon="LINK_BLEND") - layout.operator('ds_ic.export_3dx',text="3DX",icon="EXPORT") - layout.operator('ds_ic.export_ic',text="IC",icon="LINK_BLEND") - - if bpy.context.user_preferences.addons[__package__].preferences.option_show_daz3d: - - self.layout.operator('ds_daz3d.export',text="Daz3D",icon="LINK_BLEND") - - if bpy.context.user_preferences.addons[__package__].preferences.option_show_fullscreen: - - layout.operator('ds_pipeline.fullscreen',text="",icon='FULLSCREEN_ENTER') - - if bpy.context.user_preferences.addons[__package__].preferences.option_show_prefs: - - layout.operator('ds_pipeline.prefs_open',text="",icon='PREFERENCES') - - if bpy.context.user_preferences.addons[__package__].preferences.option_show_console: - - layout.operator('ds_pipeline.console',text="",icon='CONSOLE') - - if bpy.context.user_preferences.addons[__package__].preferences.option_show_quit: - - layout.operator('ds_pipeline.quit',text="",icon='QUIT') - - layout.template_running_jobs() - - layout.template_reports_banner() - - row = layout.row(align=True) - - if bpy.app.autoexec_fail is True and bpy.app.autoexec_fail_quiet is False: - row.label("Auto-run disabled", icon='ERROR') - if bpy.data.is_saved: - props = row.operator("wm.revert_mainfile", icon='SCREEN_BACK', text="Reload Trusted") - props.use_scripts = True - - row.operator("script.autoexec_warn_clear", text="Ignore") - - # include last so text doesn't push buttons out of the header - row.label(bpy.app.autoexec_fail_message) - return - - if not bpy.context.user_preferences.addons[__package__].preferences.option_move_blender_left: - - row.operator("wm.splash", text="", icon='BLENDER', emboss=False) - - if not bpy.context.user_preferences.addons[__package__].preferences.option_hide_info_stats: - - row.label(text=scene.statistics(), translate=False) - - -class INFO_MT_editor_menus(Menu): - bl_idname = "INFO_MT_editor_menus" - bl_label = "" - - def draw(self, context): - self.draw_menus(self.layout, context) - - @staticmethod - def draw_menus(layout, context): - scene = context.scene - rd = scene.render - - layout.menu("INFO_MT_file") - - if rd.use_game_engine: - layout.menu("INFO_MT_game") - else: - layout.menu("INFO_MT_render") - - layout.menu("INFO_MT_window") - layout.menu("INFO_MT_help") - - -class INFO_MT_file(Menu): - bl_label = "File" - - def draw(self, context): - layout = self.layout - - layout.operator_context = 'INVOKE_AREA' - layout.operator("wm.read_homefile", text="New", icon='NEW') - layout.operator("wm.open_mainfile", text="Open...", icon='FILE_FOLDER') - layout.menu("INFO_MT_file_open_recent", icon='OPEN_RECENT') - layout.operator("wm.revert_mainfile", icon='FILE_REFRESH') - layout.operator("wm.recover_last_session", icon='RECOVER_LAST') - layout.operator("wm.recover_auto_save", text="Recover Auto Save...", icon='RECOVER_AUTO') - - layout.separator() - - layout.operator_context = 'EXEC_AREA' if context.blend_data.is_saved else 'INVOKE_AREA' - layout.operator("wm.save_mainfile", text="Save", icon='FILE_TICK') - - layout.operator_context = 'INVOKE_AREA' - layout.operator("wm.save_as_mainfile", text="Save As...", icon='SAVE_AS') - layout.operator_context = 'INVOKE_AREA' - layout.operator("wm.save_as_mainfile", text="Save Copy...", icon='SAVE_COPY').copy = True - - layout.separator() - - layout.operator("screen.userpref_show", text="User Preferences...", icon='PREFERENCES') - - layout.operator_context = 'INVOKE_AREA' - layout.operator("wm.save_homefile", icon='SAVE_PREFS') - layout.operator("wm.read_factory_settings", icon='LOAD_FACTORY') - - if any(bpy.utils.app_template_paths()): - app_template = context.user_preferences.app_template - if app_template: - layout.operator( - "wm.read_factory_settings", - text="Load Factory Template Settings", - icon='LOAD_FACTORY', - ).app_template = app_template - del app_template - - layout.menu("USERPREF_MT_app_templates", icon='FILE_BLEND') - - layout.separator() - - layout.operator_context = 'INVOKE_AREA' - layout.operator("wm.link", text="Link", icon='LINK_BLEND') - layout.operator("wm.append", text="Append", icon='APPEND_BLEND') - layout.menu("INFO_MT_file_previews") - - layout.separator() - - layout.menu("INFO_MT_file_import", icon='IMPORT') - layout.menu("INFO_MT_file_export", icon='EXPORT') - - layout.separator() - - layout.menu("INFO_MT_file_external_data", icon='EXTERNAL_DATA') - - layout.separator() - - layout.operator_context = 'EXEC_AREA' - if bpy.data.is_dirty and context.user_preferences.view.use_quit_dialog: - layout.operator_context = 'INVOKE_SCREEN' # quit dialog - layout.operator("wm.quit_blender", text="Quit", icon='QUIT') - - -class INFO_MT_file_import(Menu): - bl_idname = "INFO_MT_file_import" - bl_label = "Import" - - def draw(self, context): - if bpy.app.build_options.collada: - self.layout.operator("wm.collada_import", text="Collada (Default) (.dae)") - if bpy.app.build_options.alembic: - self.layout.operator("wm.alembic_import", text="Alembic (.abc)") - - -class INFO_MT_file_export(Menu): - bl_idname = "INFO_MT_file_export" - bl_label = "Export" - - def draw(self, context): - if bpy.app.build_options.collada: - self.layout.operator("wm.collada_export", text="Collada (Default) (.dae)") - if bpy.app.build_options.alembic: - self.layout.operator("wm.alembic_export", text="Alembic (.abc)") - - -class INFO_MT_file_external_data(Menu): - bl_label = "External Data" - - def draw(self, context): - layout = self.layout - - icon = 'CHECKBOX_HLT' if bpy.data.use_autopack else 'CHECKBOX_DEHLT' - layout.operator("file.autopack_toggle", icon=icon) - - layout.separator() - - pack_all = layout.row() - pack_all.operator("file.pack_all") - pack_all.active = not bpy.data.use_autopack - - unpack_all = layout.row() - unpack_all.operator("file.unpack_all") - unpack_all.active = not bpy.data.use_autopack - - layout.separator() - - layout.operator("file.make_paths_relative") - layout.operator("file.make_paths_absolute") - layout.operator("file.report_missing_files") - layout.operator("file.find_missing_files") - - -class INFO_MT_file_previews(Menu): - bl_label = "Data Previews" - - def draw(self, context): - layout = self.layout - - layout.operator("wm.previews_ensure") - layout.operator("wm.previews_batch_generate") - - layout.separator() - - layout.operator("wm.previews_clear") - layout.operator("wm.previews_batch_clear") - - -class INFO_MT_game(Menu): - bl_label = "Game" - - def draw(self, context): - layout = self.layout - - gs = context.scene.game_settings - - layout.operator("view3d.game_start") - - layout.separator() - - layout.prop(gs, "show_debug_properties") - layout.prop(gs, "show_framerate_profile") - layout.prop(gs, "show_physics_visualization") - layout.prop(gs, "use_deprecation_warnings") - layout.prop(gs, "use_animation_record") - layout.separator() - layout.prop(gs, "use_auto_start") - - -class INFO_MT_render(Menu): - bl_label = "Render" - - def draw(self, context): - layout = self.layout - - layout.operator("render.render", text="Render Image", icon='RENDER_STILL').use_viewport = True - props = layout.operator("render.render", text="Render Animation", icon='RENDER_ANIMATION') - props.animation = True - props.use_viewport = True - - layout.separator() - - layout.operator("render.opengl", text="OpenGL Render Image") - layout.operator("render.opengl", text="OpenGL Render Animation").animation = True - layout.menu("INFO_MT_opengl_render") - - layout.separator() - - layout.operator("render.view_show") - layout.operator("render.play_rendered_anim", icon='PLAY') - - -class INFO_MT_opengl_render(Menu): - bl_label = "OpenGL Render Options" - - def draw(self, context): - layout = self.layout - - rd = context.scene.render - layout.prop(rd, "use_antialiasing") - layout.prop(rd, "use_full_sample") - - layout.prop_menu_enum(rd, "antialiasing_samples") - layout.prop_menu_enum(rd, "alpha_mode") - - -class INFO_MT_window(Menu): - bl_label = "Window" - - def draw(self, context): - import sys - - layout = self.layout - - layout.operator("wm.window_duplicate") - layout.operator("wm.window_fullscreen_toggle", icon='FULLSCREEN_ENTER') - - layout.separator() - - layout.operator("screen.screenshot") - layout.operator("screen.screencast") - - if sys.platform[:3] == "win": - layout.separator() - layout.operator("wm.console_toggle", icon='CONSOLE') - - if context.scene.render.use_multiview: - layout.separator() - layout.operator("wm.set_stereo_3d", icon='CAMERA_STEREO') - - -class INFO_MT_help(Menu): - bl_label = "Help" - - def draw(self, context): - layout = self.layout - - layout.operator( - "wm.url_open", text="Manual", icon='HELP', - ).url = "https://docs.blender.org/manual/en/dev/" - layout.operator( - "wm.url_open", text="Release Log", icon='URL', - ).url = "http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/%d.%d" % bpy.app.version[:2] - layout.separator() - - layout.operator( - "wm.url_open", text="Blender Website", icon='URL', - ).url = "https://www.blender.org" - layout.operator( - "wm.url_open", text="Blender Store", icon='URL', - ).url = "https://store.blender.org" - layout.operator( - "wm.url_open", text="Developer Community", icon='URL', - ).url = "https://www.blender.org/get-involved/" - layout.operator( - "wm.url_open", text="User Community", icon='URL', - ).url = "https://www.blender.org/support/user-community" - layout.separator() - layout.operator( - "wm.url_open", text="Report a Bug", icon='URL', - ).url = "https://developer.blender.org/maniphest/task/edit/form/1" - layout.separator() - - layout.operator( - "wm.url_open", text="Python API Reference", icon='URL', - ).url = bpy.types.WM_OT_doc_view._prefix - - layout.operator("wm.operator_cheat_sheet", icon='TEXT') - layout.operator("wm.sysinfo", icon='TEXT') - layout.separator() - - layout.operator("wm.splash", icon='BLENDER') - - -classes = ( - INFO_HT_header, - INFO_MT_editor_menus, - INFO_MT_file, - INFO_MT_file_import, - INFO_MT_file_export, - INFO_MT_file_external_data, - INFO_MT_file_previews, - INFO_MT_game, - INFO_MT_render, - INFO_MT_opengl_render, - INFO_MT_window, - INFO_MT_help, -) - -if __name__ == "__main__": # only for live edit. - from bpy.utils import register_class - for cls in classes: - register_class(cls)