playblast dest

2.0.0

- added: possibility to change playblast destination in preferences
- changed: playblast default is `playblast` folder instead of `images`
- changed: completely disable experimental precise eraser
gpv2
Pullusb 2022-03-24 18:25:56 +01:00
parent bf60370ab0
commit 5574c75769
4 changed files with 40 additions and 21 deletions

View File

@ -3,6 +3,9 @@
2.0.0 2.0.0
- fix: error using playblast (api changes of Blender 3.0+) - fix: error using playblast (api changes of Blender 3.0+)
- added: possibility to change playblast destination in preferences
- changed: playblast default is `playblast` folder instead of `images`
- changed: completely disable experimental precise eraser
1.9.9 1.9.9

View File

@ -126,6 +126,7 @@ class render_with_restore:
def playblast(viewport = False, stamping = True): def playblast(viewport = False, stamping = True):
scn = bpy.context.scene scn = bpy.context.scene
res_factor = scn.gptoolprops.resolution_percentage res_factor = scn.gptoolprops.resolution_percentage
playblast_path = get_addon_prefs().playblast_path
rd = scn.render rd = scn.render
ff = rd.ffmpeg ff = rd.ffmpeg
with render_with_restore(): with render_with_restore():
@ -157,7 +158,12 @@ def playblast(viewport = False, stamping = True):
# mode incermental or just use fulldate (cannot create conflict and filter OK but long name) # mode incermental or just use fulldate (cannot create conflict and filter OK but long name)
blend = Path(bpy.data.filepath) blend = Path(bpy.data.filepath)
date_format = "%Y-%m-%d_%H-%M-%S" date_format = "%Y-%m-%d_%H-%M-%S"
fp = join(blend.parent, "playblast", f'playblast_{blend.stem}_{strftime(date_format)}.mp4')
## old direct place
# fp = join(blend.parent, "playblast", f'playblast_{blend.stem}_{strftime(date_format)}.mp4')
fp = Path(bpy.path.abspath(playblast_path)).resolve() / f'playblast_{blend.stem}_{strftime(date_format)}.mp4'
fp = str(fp)
#may need a properties for choosing location : bpy.types.Scene.qrd_savepath = bpy.props.StringProperty(subtype='DIR_PATH', description="Export location, if not specify, create a 'quick_render' directory aside blend location")#(change defaut name in user_prefernece) #may need a properties for choosing location : bpy.types.Scene.qrd_savepath = bpy.props.StringProperty(subtype='DIR_PATH', description="Export location, if not specify, create a 'quick_render' directory aside blend location")#(change defaut name in user_prefernece)
rd.filepath = fp rd.filepath = fp

View File

@ -309,6 +309,7 @@ def playblast(context, viewport = False, stamping = True):
rd = scn.render rd = scn.render
ff = rd.ffmpeg ff = rd.ffmpeg
playblast_path = get_addon_prefs().playblast_path
prefix = 'tempblast_' prefix = 'tempblast_'
# delete old playblast and blend files # delete old playblast and blend files
@ -351,11 +352,15 @@ def playblast(context, viewport = False, stamping = True):
# rd.is_movie_format# check if its movie mode # rd.is_movie_format# check if its movie mode
## set filepath ## set filepath
# mode incermental or just use fulldate (cannot create conflict and filter OK but long name) # mode incremental or just use fulldate (cannot create conflict and filter OK but long name)
blend = Path(bpy.data.filepath)
date_format = "%Y-%m-%d_%H-%M-%S" date_format = "%Y-%m-%d_%H-%M-%S"
fp = join(blend.parent, "playblast", f'{prefix}{blend.stem}_{strftime(date_format)}.mp4') ## old
blend = Path(bpy.data.filepath)
# fp = blend.parent / "playblast" / f'{prefix}{blend.stem}_{strftime(date_format)}.mp4'
## with path variable
fp = Path(bpy.path.abspath(playblast_path)).resolve() / f'{prefix}{blend.stem}_{strftime(date_format)}.mp4'
fp = str(fp)
#may need a properties for choosing location : bpy.types.Scene.qrd_savepath = bpy.props.StringProperty(subtype='DIR_PATH', description="Export location, if not specify, create a 'quick_render' directory aside blend location")#(change defaut name in user_prefernece) #may need a properties for choosing location : bpy.types.Scene.qrd_savepath = bpy.props.StringProperty(subtype='DIR_PATH', description="Export location, if not specify, create a 'quick_render' directory aside blend location")#(change defaut name in user_prefernece)
rd.filepath = fp rd.filepath = fp
rd.use_stamp = stamping# toolsetting.use_stamp# True for playblast rd.use_stamp = stamping# toolsetting.use_stamp# True for playblast

View File

@ -43,8 +43,8 @@ from . import OP_layer_picker
from . import OP_layer_nav from . import OP_layer_nav
from . import OP_material_picker from . import OP_material_picker
from . import OP_git_update from . import OP_git_update
from . import OP_eraser_brush # from . import OP_eraser_brush
from . import TOOL_eraser_brush # from . import TOOL_eraser_brush
from . import handler_draw_cam from . import handler_draw_cam
from . import keymaps from . import keymaps
@ -97,22 +97,21 @@ def remap_on_save_update(self, context):
bpy.app.handlers.save_pre.remove(remap_relative) bpy.app.handlers.save_pre.remove(remap_relative)
## precise eraser
def update_use_precise_eraser(self, context): # def update_use_precise_eraser(self, context):
# km, kmi = TOOL_eraser_brush.addon_keymaps[0]
km, kmi = TOOL_eraser_brush.addon_keymaps[0] # kmi.active = self.use_precise_eraser
kmi.active = self.use_precise_eraser
class GPTB_prefs(bpy.types.AddonPreferences): class GPTB_prefs(bpy.types.AddonPreferences):
bl_idname = __name__ bl_idname = __name__
use_precise_eraser : BoolProperty( ## precise eraser
name='Precise Eraser', # use_precise_eraser : BoolProperty(
default=False, # name='Precise Eraser',
update=update_use_precise_eraser # default=False,
) # update=update_use_precise_eraser)
## tabs ## tabs
pref_tabs : EnumProperty( pref_tabs : EnumProperty(
@ -166,6 +165,11 @@ class GPTB_prefs(bpy.types.AddonPreferences):
description="Path relative to blend to place render", description="Path relative to blend to place render",
default="//render", maxlen=0, subtype='DIR_PATH') default="//render", maxlen=0, subtype='DIR_PATH')
playblast_path : StringProperty(
name="Playblast Path",
description="Path to folder for playblasts output",
default="//playblast", maxlen=0, subtype='DIR_PATH')
use_env_palettes : BoolProperty( use_env_palettes : BoolProperty(
name="Use Project Palettes", name="Use Project Palettes",
description="Load the palette path in environnement at startup (key 'PALETTES')", description="Load the palette path in environnement at startup (key 'PALETTES')",
@ -409,6 +413,7 @@ class GPTB_prefs(bpy.types.AddonPreferences):
box.label(text='Playblast options:') box.label(text='Playblast options:')
box.prop(self, 'playblast_auto_play') box.prop(self, 'playblast_auto_play')
box.prop(self, 'playblast_auto_open_folder') box.prop(self, 'playblast_auto_open_folder')
box.prop(self, 'playblast_path')
# box.separator()## Keyframe jumper # box.separator()## Keyframe jumper
@ -464,7 +469,7 @@ class GPTB_prefs(bpy.types.AddonPreferences):
row.prop(self, 'nav_fade_in_time', text='Fade Back Time') row.prop(self, 'nav_fade_in_time', text='Fade Back Time')
# row.prop(self, 'nav_interval') # Do not expose refresh rate for now, not usefull to user... # row.prop(self, 'nav_interval') # Do not expose refresh rate for now, not usefull to user...
box.prop(self, 'use_precise_eraser') # box.prop(self, 'use_precise_eraser') # precise eraser
if self.is_git_repo: if self.is_git_repo:
box = layout.box() box = layout.box()
@ -698,12 +703,12 @@ addon_modules = (
OP_depth_move, OP_depth_move,
OP_key_duplicate_send, OP_key_duplicate_send,
OP_layer_manager, OP_layer_manager,
OP_eraser_brush,
OP_material_picker, OP_material_picker,
OP_git_update, OP_git_update,
OP_layer_picker, OP_layer_picker,
OP_layer_nav, OP_layer_nav,
TOOL_eraser_brush, # OP_eraser_brush,
# TOOL_eraser_brush, # experimental eraser brush
handler_draw_cam, handler_draw_cam,
UI_tools, UI_tools,
keymaps, keymaps,