Preview of image filter is no longer updated in real-time
This commit is contained in:
parent
4fdc46460d
commit
1f91a2db6f
464
addon/ui.py
464
addon/ui.py
@ -1,5 +1,5 @@
|
|||||||
'''
|
'''
|
||||||
Copyright (C) 2021 - 2024 Akaneyu
|
Copyright (C) 2021 - 2025 Akaneyu
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -283,30 +283,23 @@ class IMAGE_EDITOR_PLUS_OT_change_canvas_size_dialog(bpy.types.Operator):
|
|||||||
row.column()
|
row.column()
|
||||||
row.prop(self, 'reset', text='Reset', toggle=True)
|
row.prop(self, 'reset', text='Reset', toggle=True)
|
||||||
|
|
||||||
def preview_offset_properties(self, context):
|
|
||||||
if self.preview:
|
|
||||||
update_offset_properties(self, context)
|
|
||||||
else:
|
|
||||||
img = app.get_target_image(context)
|
|
||||||
if img:
|
|
||||||
app.revert_image_cache(img)
|
|
||||||
app.refresh_image(context)
|
|
||||||
|
|
||||||
def reset_offset_properties(self, context):
|
def reset_offset_properties(self, context):
|
||||||
if self.reset:
|
if self.reset:
|
||||||
self.offset_properties.property_unset('offset_x')
|
|
||||||
self.offset_properties.property_unset('offset_y')
|
|
||||||
self.property_unset('offset_edge_behavior')
|
|
||||||
update_offset_properties(self, context)
|
|
||||||
|
|
||||||
self.reset = False
|
self.reset = False
|
||||||
|
|
||||||
|
self.offset_properties.property_unset('offset_x')
|
||||||
|
self.offset_properties.property_unset('offset_y')
|
||||||
|
self.property_unset('offset_edge_behavior')
|
||||||
|
update_offset_properties(self, context)
|
||||||
|
|
||||||
def update_offset_properties(self, context):
|
def update_offset_properties(self, context):
|
||||||
if self.preview:
|
if self.update_preview:
|
||||||
bpy.ops.image_editor_plus.offset('EXEC_DEFAULT', False,
|
self.update_preview = False
|
||||||
offset_x=self.offset_properties.offset_x,
|
|
||||||
offset_y=self.offset_properties.offset_y,
|
bpy.ops.image_editor_plus.offset('EXEC_DEFAULT', False,
|
||||||
offset_edge_behavior=self.offset_edge_behavior)
|
offset_x=self.offset_properties.offset_x,
|
||||||
|
offset_y=self.offset_properties.offset_y,
|
||||||
|
offset_edge_behavior=self.offset_edge_behavior)
|
||||||
|
|
||||||
# wrap these properties to change their attributes dynamically
|
# wrap these properties to change their attributes dynamically
|
||||||
class IMAGE_EDITOR_PLUS_OffsetPropertyGroup(bpy.types.PropertyGroup):
|
class IMAGE_EDITOR_PLUS_OffsetPropertyGroup(bpy.types.PropertyGroup):
|
||||||
@ -317,15 +310,15 @@ class IMAGE_EDITOR_PLUS_OT_offset_dialog(bpy.types.Operator):
|
|||||||
"""Offset the image"""
|
"""Offset the image"""
|
||||||
bl_idname = 'image_editor_plus.offset_dialog'
|
bl_idname = 'image_editor_plus.offset_dialog'
|
||||||
bl_label = "Offset"
|
bl_label = "Offset"
|
||||||
preview: bpy.props.BoolProperty(default=True, options={'SKIP_SAVE'},
|
update_preview: bpy.props.BoolProperty(options={'SKIP_SAVE'},
|
||||||
update=preview_offset_properties)
|
update=update_offset_properties,
|
||||||
|
description='Update preview')
|
||||||
reset: bpy.props.BoolProperty(options={'SKIP_SAVE'}, update=reset_offset_properties)
|
reset: bpy.props.BoolProperty(options={'SKIP_SAVE'}, update=reset_offset_properties)
|
||||||
offset_properties: bpy.props.PointerProperty(options={'SKIP_SAVE'},
|
offset_properties: bpy.props.PointerProperty(options={'SKIP_SAVE'},
|
||||||
type=IMAGE_EDITOR_PLUS_OffsetPropertyGroup)
|
type=IMAGE_EDITOR_PLUS_OffsetPropertyGroup)
|
||||||
offset_edge_behavior: bpy.props.EnumProperty(options={'SKIP_SAVE'}, items=(
|
offset_edge_behavior: bpy.props.EnumProperty(options={'SKIP_SAVE'}, items=(
|
||||||
('wrap', 'Wrap', 'Wrap image around'),
|
('wrap', 'Wrap', 'Wrap image around'),
|
||||||
('edge', 'Edge', 'Repeat edge pixels')),
|
('edge', 'Edge', 'Repeat edge pixels')))
|
||||||
update=update_offset_properties)
|
|
||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
wm = context.window_manager
|
wm = context.window_manager
|
||||||
@ -345,13 +338,11 @@ class IMAGE_EDITOR_PLUS_OT_offset_dialog(bpy.types.Operator):
|
|||||||
|
|
||||||
IMAGE_EDITOR_PLUS_OffsetPropertyGroup.offset_x = \
|
IMAGE_EDITOR_PLUS_OffsetPropertyGroup.offset_x = \
|
||||||
bpy.props.IntProperty(name='Offset X', subtype='FACTOR',
|
bpy.props.IntProperty(name='Offset X', subtype='FACTOR',
|
||||||
min=-width + 1, max=width - 1,
|
min=-width + 1, max=width - 1)
|
||||||
update=(lambda _self, context: update_offset_properties(self, context)))
|
|
||||||
|
|
||||||
IMAGE_EDITOR_PLUS_OffsetPropertyGroup.offset_y = \
|
IMAGE_EDITOR_PLUS_OffsetPropertyGroup.offset_y = \
|
||||||
bpy.props.IntProperty(name='Offset Y', subtype='FACTOR',
|
bpy.props.IntProperty(name='Offset Y', subtype='FACTOR',
|
||||||
min=-width + 1, max=width - 1,
|
min=-width + 1, max=width - 1)
|
||||||
update=(lambda _self, context: update_offset_properties(self, context)))
|
|
||||||
|
|
||||||
update_offset_properties(self, context)
|
update_offset_properties(self, context)
|
||||||
|
|
||||||
@ -379,7 +370,7 @@ class IMAGE_EDITOR_PLUS_OT_offset_dialog(bpy.types.Operator):
|
|||||||
|
|
||||||
row = layout.split(align=True)
|
row = layout.split(align=True)
|
||||||
row.column()
|
row.column()
|
||||||
row.prop(self, 'preview', text='Preview', toggle=True, icon='VIEWZOOM')
|
row.prop(self, 'update_preview', text='Update Preview', toggle=True, icon='FILE_REFRESH')
|
||||||
|
|
||||||
layout.separator()
|
layout.separator()
|
||||||
|
|
||||||
@ -400,48 +391,39 @@ class IMAGE_EDITOR_PLUS_OT_offset_dialog(bpy.types.Operator):
|
|||||||
row.column()
|
row.column()
|
||||||
row.prop(self, 'reset', text='Reset', toggle=True)
|
row.prop(self, 'reset', text='Reset', toggle=True)
|
||||||
|
|
||||||
def preview_adjust_color_properties(self, context):
|
|
||||||
if self.preview:
|
|
||||||
update_adjust_color_properties(self, context)
|
|
||||||
else:
|
|
||||||
img = app.get_target_image(context)
|
|
||||||
if img:
|
|
||||||
app.revert_image_cache(img)
|
|
||||||
app.refresh_image(context)
|
|
||||||
|
|
||||||
def reset_adjust_color_properties(self, context):
|
def reset_adjust_color_properties(self, context):
|
||||||
if self.reset:
|
if self.reset:
|
||||||
self.property_unset('adjust_hue')
|
|
||||||
self.property_unset('adjust_lightness')
|
|
||||||
self.property_unset('adjust_saturation')
|
|
||||||
update_adjust_color_properties(self, context)
|
|
||||||
|
|
||||||
self.reset = False
|
self.reset = False
|
||||||
|
|
||||||
|
self.property_unset('adjust_hue')
|
||||||
|
self.property_unset('adjust_lightness')
|
||||||
|
self.property_unset('adjust_saturation')
|
||||||
|
update_adjust_color_properties(self, context)
|
||||||
|
|
||||||
def update_adjust_color_properties(self, context):
|
def update_adjust_color_properties(self, context):
|
||||||
if self.preview:
|
if self.update_preview:
|
||||||
bpy.ops.image_editor_plus.adjust_color('EXEC_DEFAULT', False,
|
self.update_preview = False
|
||||||
adjust_hue=self.adjust_hue,
|
|
||||||
adjust_lightness=self.adjust_lightness,
|
bpy.ops.image_editor_plus.adjust_color('EXEC_DEFAULT', False,
|
||||||
adjust_saturation=self.adjust_saturation)
|
adjust_hue=self.adjust_hue,
|
||||||
|
adjust_lightness=self.adjust_lightness,
|
||||||
|
adjust_saturation=self.adjust_saturation)
|
||||||
|
|
||||||
class IMAGE_EDITOR_PLUS_OT_adjust_color_dialog(bpy.types.Operator):
|
class IMAGE_EDITOR_PLUS_OT_adjust_color_dialog(bpy.types.Operator):
|
||||||
"""Adjust hue/saturation/lightness of the image"""
|
"""Adjust hue/saturation/lightness of the image"""
|
||||||
bl_idname = 'image_editor_plus.adjust_color_dialog'
|
bl_idname = 'image_editor_plus.adjust_color_dialog'
|
||||||
bl_label = "Hue/Saturation"
|
bl_label = "Hue/Saturation"
|
||||||
preview: bpy.props.BoolProperty(default=True, options={'SKIP_SAVE'},
|
update_preview: bpy.props.BoolProperty(options={'SKIP_SAVE'},
|
||||||
update=preview_adjust_color_properties)
|
update=update_adjust_color_properties,
|
||||||
|
description='Update preview')
|
||||||
reset: bpy.props.BoolProperty(options={'SKIP_SAVE'},
|
reset: bpy.props.BoolProperty(options={'SKIP_SAVE'},
|
||||||
update=reset_adjust_color_properties)
|
update=reset_adjust_color_properties)
|
||||||
adjust_hue: bpy.props.FloatProperty(name='Hue', subtype='FACTOR',
|
adjust_hue: bpy.props.FloatProperty(name='Hue', subtype='FACTOR',
|
||||||
min=-180, max=180, default=0, options={'SKIP_SAVE'},
|
min=-180, max=180, default=0, options={'SKIP_SAVE'})
|
||||||
update=update_adjust_color_properties)
|
|
||||||
adjust_lightness: bpy.props.FloatProperty(name='Lightness', subtype='PERCENTAGE',
|
adjust_lightness: bpy.props.FloatProperty(name='Lightness', subtype='PERCENTAGE',
|
||||||
min=0, max=200, default=100, options={'SKIP_SAVE'},
|
min=0, max=200, default=100, options={'SKIP_SAVE'})
|
||||||
update=update_adjust_color_properties)
|
|
||||||
adjust_saturation: bpy.props.FloatProperty(name='Saturation', subtype='PERCENTAGE',
|
adjust_saturation: bpy.props.FloatProperty(name='Saturation', subtype='PERCENTAGE',
|
||||||
min=0, max=200, default=100, options={'SKIP_SAVE'},
|
min=0, max=200, default=100, options={'SKIP_SAVE'})
|
||||||
update=update_adjust_color_properties)
|
|
||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
wm = context.window_manager
|
wm = context.window_manager
|
||||||
@ -478,7 +460,7 @@ class IMAGE_EDITOR_PLUS_OT_adjust_color_dialog(bpy.types.Operator):
|
|||||||
|
|
||||||
row = layout.split(align=True)
|
row = layout.split(align=True)
|
||||||
row.column()
|
row.column()
|
||||||
row.prop(self, 'preview', text='Preview', toggle=True, icon='VIEWZOOM')
|
row.prop(self, 'update_preview', text='Update Preview', toggle=True, icon='FILE_REFRESH')
|
||||||
|
|
||||||
layout.separator()
|
layout.separator()
|
||||||
|
|
||||||
@ -501,43 +483,35 @@ class IMAGE_EDITOR_PLUS_OT_adjust_color_dialog(bpy.types.Operator):
|
|||||||
row.column()
|
row.column()
|
||||||
row.prop(self, 'reset', text='Reset', toggle=True)
|
row.prop(self, 'reset', text='Reset', toggle=True)
|
||||||
|
|
||||||
def preview_adjust_brightness_properties(self, context):
|
|
||||||
if self.preview:
|
|
||||||
update_adjust_brightness_properties(self, context)
|
|
||||||
else:
|
|
||||||
img = app.get_target_image(context)
|
|
||||||
if img:
|
|
||||||
app.revert_image_cache(img)
|
|
||||||
app.refresh_image(context)
|
|
||||||
|
|
||||||
def reset_adjust_brightness_properties(self, context):
|
def reset_adjust_brightness_properties(self, context):
|
||||||
if self.reset:
|
if self.reset:
|
||||||
self.property_unset('adjust_brightness')
|
|
||||||
self.property_unset('adjust_contrast')
|
|
||||||
update_adjust_brightness_properties(self, context)
|
|
||||||
|
|
||||||
self.reset = False
|
self.reset = False
|
||||||
|
|
||||||
|
self.property_unset('adjust_brightness')
|
||||||
|
self.property_unset('adjust_contrast')
|
||||||
|
update_adjust_brightness_properties(self, context)
|
||||||
|
|
||||||
def update_adjust_brightness_properties(self, context):
|
def update_adjust_brightness_properties(self, context):
|
||||||
if self.preview:
|
if self.update_preview:
|
||||||
bpy.ops.image_editor_plus.adjust_brightness('EXEC_DEFAULT', False,
|
self.update_preview = False
|
||||||
adjust_brightness=self.adjust_brightness,
|
|
||||||
adjust_contrast=self.adjust_contrast)
|
bpy.ops.image_editor_plus.adjust_brightness('EXEC_DEFAULT', False,
|
||||||
|
adjust_brightness=self.adjust_brightness,
|
||||||
|
adjust_contrast=self.adjust_contrast)
|
||||||
|
|
||||||
class IMAGE_EDITOR_PLUS_OT_adjust_brightness_dialog(bpy.types.Operator):
|
class IMAGE_EDITOR_PLUS_OT_adjust_brightness_dialog(bpy.types.Operator):
|
||||||
"""Adjust brightness/contrast of the image"""
|
"""Adjust brightness/contrast of the image"""
|
||||||
bl_idname = 'image_editor_plus.adjust_brightness_dialog'
|
bl_idname = 'image_editor_plus.adjust_brightness_dialog'
|
||||||
bl_label = "Brightness/Contrast"
|
bl_label = "Brightness/Contrast"
|
||||||
preview: bpy.props.BoolProperty(default=True, options={'SKIP_SAVE'},
|
update_preview: bpy.props.BoolProperty(options={'SKIP_SAVE'},
|
||||||
update=preview_adjust_brightness_properties)
|
update=update_adjust_brightness_properties,
|
||||||
|
description='Update preview')
|
||||||
reset: bpy.props.BoolProperty(options={'SKIP_SAVE'},
|
reset: bpy.props.BoolProperty(options={'SKIP_SAVE'},
|
||||||
update=reset_adjust_brightness_properties)
|
update=reset_adjust_brightness_properties)
|
||||||
adjust_brightness: bpy.props.FloatProperty(name='Brightness', subtype='PERCENTAGE',
|
adjust_brightness: bpy.props.FloatProperty(name='Brightness', subtype='PERCENTAGE',
|
||||||
min=0, max=200, default=100, options={'SKIP_SAVE'},
|
min=0, max=200, default=100, options={'SKIP_SAVE'})
|
||||||
update=update_adjust_brightness_properties)
|
|
||||||
adjust_contrast: bpy.props.FloatProperty(name='Contrast', subtype='PERCENTAGE',
|
adjust_contrast: bpy.props.FloatProperty(name='Contrast', subtype='PERCENTAGE',
|
||||||
min=0, max=200, default=100, options={'SKIP_SAVE'},
|
min=0, max=200, default=100, options={'SKIP_SAVE'})
|
||||||
update=update_adjust_brightness_properties)
|
|
||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
wm = context.window_manager
|
wm = context.window_manager
|
||||||
@ -573,7 +547,7 @@ class IMAGE_EDITOR_PLUS_OT_adjust_brightness_dialog(bpy.types.Operator):
|
|||||||
|
|
||||||
row = layout.split(align=True)
|
row = layout.split(align=True)
|
||||||
row.column()
|
row.column()
|
||||||
row.prop(self, 'preview', text='Preview', toggle=True, icon='VIEWZOOM')
|
row.prop(self, 'update_preview', text='Update Preview', toggle=True, icon='FILE_REFRESH')
|
||||||
|
|
||||||
layout.separator()
|
layout.separator()
|
||||||
|
|
||||||
@ -591,38 +565,31 @@ class IMAGE_EDITOR_PLUS_OT_adjust_brightness_dialog(bpy.types.Operator):
|
|||||||
row.column()
|
row.column()
|
||||||
row.prop(self, 'reset', text='Reset', toggle=True)
|
row.prop(self, 'reset', text='Reset', toggle=True)
|
||||||
|
|
||||||
def preview_adjust_gamma_properties(self, context):
|
|
||||||
if self.preview:
|
|
||||||
update_adjust_gamma_properties(self, context)
|
|
||||||
else:
|
|
||||||
img = app.get_target_image(context)
|
|
||||||
if img:
|
|
||||||
app.revert_image_cache(img)
|
|
||||||
app.refresh_image(context)
|
|
||||||
|
|
||||||
def reset_adjust_gamma_properties(self, context):
|
def reset_adjust_gamma_properties(self, context):
|
||||||
if self.reset:
|
if self.reset:
|
||||||
self.property_unset('adjust_gamma')
|
|
||||||
update_adjust_gamma_properties(self, context)
|
|
||||||
|
|
||||||
self.reset = False
|
self.reset = False
|
||||||
|
|
||||||
|
self.property_unset('adjust_gamma')
|
||||||
|
update_adjust_gamma_properties(self, context)
|
||||||
|
|
||||||
def update_adjust_gamma_properties(self, context):
|
def update_adjust_gamma_properties(self, context):
|
||||||
if self.preview:
|
if self.update_preview:
|
||||||
bpy.ops.image_editor_plus.adjust_gamma('EXEC_DEFAULT', False,
|
self.update_preview = False
|
||||||
adjust_gamma=self.adjust_gamma)
|
|
||||||
|
bpy.ops.image_editor_plus.adjust_gamma('EXEC_DEFAULT', False,
|
||||||
|
adjust_gamma=self.adjust_gamma)
|
||||||
|
|
||||||
class IMAGE_EDITOR_PLUS_OT_adjust_gamma_dialog(bpy.types.Operator):
|
class IMAGE_EDITOR_PLUS_OT_adjust_gamma_dialog(bpy.types.Operator):
|
||||||
"""Adjust gamma of the image"""
|
"""Adjust gamma of the image"""
|
||||||
bl_idname = 'image_editor_plus.adjust_gamma_dialog'
|
bl_idname = 'image_editor_plus.adjust_gamma_dialog'
|
||||||
bl_label = "Gamma"
|
bl_label = "Gamma"
|
||||||
preview: bpy.props.BoolProperty(default=True, options={'SKIP_SAVE'},
|
update_preview: bpy.props.BoolProperty(options={'SKIP_SAVE'},
|
||||||
update=preview_adjust_gamma_properties)
|
update=update_adjust_gamma_properties,
|
||||||
|
description='Update preview')
|
||||||
reset: bpy.props.BoolProperty(options={'SKIP_SAVE'},
|
reset: bpy.props.BoolProperty(options={'SKIP_SAVE'},
|
||||||
update=reset_adjust_gamma_properties)
|
update=reset_adjust_gamma_properties)
|
||||||
adjust_gamma: bpy.props.FloatProperty(name='Gamma', subtype='FACTOR',
|
adjust_gamma: bpy.props.FloatProperty(name='Gamma', subtype='FACTOR',
|
||||||
min=0.01, soft_max=3.0, default=1.0, options={'SKIP_SAVE'},
|
min=0.01, soft_max=3.0, default=1.0, options={'SKIP_SAVE'})
|
||||||
update=update_adjust_gamma_properties)
|
|
||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
wm = context.window_manager
|
wm = context.window_manager
|
||||||
@ -657,7 +624,7 @@ class IMAGE_EDITOR_PLUS_OT_adjust_gamma_dialog(bpy.types.Operator):
|
|||||||
|
|
||||||
row = layout.split(align=True)
|
row = layout.split(align=True)
|
||||||
row.column()
|
row.column()
|
||||||
row.prop(self, 'preview', text='Preview', toggle=True, icon='VIEWZOOM')
|
row.prop(self, 'update_preview', text='Update Preview', toggle=True, icon='FILE_REFRESH')
|
||||||
|
|
||||||
layout.separator()
|
layout.separator()
|
||||||
|
|
||||||
@ -670,33 +637,23 @@ class IMAGE_EDITOR_PLUS_OT_adjust_gamma_dialog(bpy.types.Operator):
|
|||||||
row.column()
|
row.column()
|
||||||
row.prop(self, 'reset', text='Reset', toggle=True)
|
row.prop(self, 'reset', text='Reset', toggle=True)
|
||||||
|
|
||||||
def preview_adjust_color_curve_properties(self, context):
|
|
||||||
if not self.preview:
|
|
||||||
img = app.get_target_image(context)
|
|
||||||
if img:
|
|
||||||
app.revert_image_cache(img)
|
|
||||||
app.refresh_image(context)
|
|
||||||
|
|
||||||
def reset_adjust_color_curve_properties(self, context):
|
def reset_adjust_color_curve_properties(self, context):
|
||||||
if self.reset:
|
if self.reset:
|
||||||
app.reset_curve_mapping()
|
|
||||||
|
|
||||||
self.reset = False
|
self.reset = False
|
||||||
|
|
||||||
|
app.reset_curve_mapping()
|
||||||
|
update_adjust_color_curve_properties(self, context)
|
||||||
|
|
||||||
def update_adjust_color_curve_properties(self, context):
|
def update_adjust_color_curve_properties(self, context):
|
||||||
if self.update_preview:
|
if self.update_preview:
|
||||||
self.update_preview = False
|
self.update_preview = False
|
||||||
|
|
||||||
if self.preview:
|
bpy.ops.image_editor_plus.adjust_color_curve('EXEC_DEFAULT', False)
|
||||||
bpy.ops.image_editor_plus.adjust_color_curve('EXEC_DEFAULT', False)
|
|
||||||
|
|
||||||
class IMAGE_EDITOR_PLUS_OT_adjust_color_curve_dialog(bpy.types.Operator):
|
class IMAGE_EDITOR_PLUS_OT_adjust_color_curve_dialog(bpy.types.Operator):
|
||||||
"""Adjust color curve of the image"""
|
"""Adjust color curve of the image"""
|
||||||
bl_idname = 'image_editor_plus.adjust_curve_dialog'
|
bl_idname = 'image_editor_plus.adjust_curve_dialog'
|
||||||
bl_label = "Adjust Color Curve"
|
bl_label = "Adjust Color Curve"
|
||||||
preview: bpy.props.BoolProperty(default=True, options={'SKIP_SAVE'},
|
|
||||||
update=preview_adjust_color_curve_properties,
|
|
||||||
description='Preview manually (Need an update operation)')
|
|
||||||
update_preview: bpy.props.BoolProperty(options={'SKIP_SAVE'},
|
update_preview: bpy.props.BoolProperty(options={'SKIP_SAVE'},
|
||||||
update=update_adjust_color_curve_properties,
|
update=update_adjust_color_curve_properties,
|
||||||
description='Update preview')
|
description='Update preview')
|
||||||
@ -735,8 +692,7 @@ class IMAGE_EDITOR_PLUS_OT_adjust_color_curve_dialog(bpy.types.Operator):
|
|||||||
|
|
||||||
row = layout.split(align=True)
|
row = layout.split(align=True)
|
||||||
row.column()
|
row.column()
|
||||||
row.prop(self, 'preview', text='Preview', toggle=True, icon='VIEWZOOM')
|
row.prop(self, 'update_preview', text='Update Preview', toggle=True, icon='FILE_REFRESH')
|
||||||
row.prop(self, 'update_preview', text='Update', toggle=True, icon='FILE_REFRESH')
|
|
||||||
|
|
||||||
layout.separator()
|
layout.separator()
|
||||||
|
|
||||||
@ -749,48 +705,39 @@ class IMAGE_EDITOR_PLUS_OT_adjust_color_curve_dialog(bpy.types.Operator):
|
|||||||
row.column()
|
row.column()
|
||||||
row.prop(self, 'reset', text='Reset', toggle=True)
|
row.prop(self, 'reset', text='Reset', toggle=True)
|
||||||
|
|
||||||
def preview_replace_color_properties(self, context):
|
|
||||||
if self.preview:
|
|
||||||
update_replace_color_properties(self, context)
|
|
||||||
else:
|
|
||||||
img = app.get_target_image(context)
|
|
||||||
if img:
|
|
||||||
app.revert_image_cache(img)
|
|
||||||
app.refresh_image(context)
|
|
||||||
|
|
||||||
def reset_replace_color_properties(self, context):
|
def reset_replace_color_properties(self, context):
|
||||||
if self.reset:
|
if self.reset:
|
||||||
self.property_unset('source_color')
|
|
||||||
self.property_unset('replace_color')
|
|
||||||
self.property_unset('color_threshold')
|
|
||||||
update_replace_color_properties(self, context)
|
|
||||||
|
|
||||||
self.reset = False
|
self.reset = False
|
||||||
|
|
||||||
|
self.property_unset('source_color')
|
||||||
|
self.property_unset('replace_color')
|
||||||
|
self.property_unset('color_threshold')
|
||||||
|
update_replace_color_properties(self, context)
|
||||||
|
|
||||||
def update_replace_color_properties(self, context):
|
def update_replace_color_properties(self, context):
|
||||||
if self.preview:
|
if self.update_preview:
|
||||||
bpy.ops.image_editor_plus.replace_color('EXEC_DEFAULT', False,
|
self.update_preview = False
|
||||||
source_color=self.source_color,
|
|
||||||
replace_color=self.replace_color,
|
bpy.ops.image_editor_plus.replace_color('EXEC_DEFAULT', False,
|
||||||
color_threshold=self.color_threshold)
|
source_color=self.source_color,
|
||||||
|
replace_color=self.replace_color,
|
||||||
|
color_threshold=self.color_threshold)
|
||||||
|
|
||||||
class IMAGE_EDITOR_PLUS_OT_replace_color_dialog(bpy.types.Operator):
|
class IMAGE_EDITOR_PLUS_OT_replace_color_dialog(bpy.types.Operator):
|
||||||
"""Replace one color in the image with another"""
|
"""Replace one color in the image with another"""
|
||||||
bl_idname = 'image_editor_plus.replace_color_dialog'
|
bl_idname = 'image_editor_plus.replace_color_dialog'
|
||||||
bl_label = "Replace Color"
|
bl_label = "Replace Color"
|
||||||
preview: bpy.props.BoolProperty(default=True, options={'SKIP_SAVE'},
|
update_preview: bpy.props.BoolProperty(options={'SKIP_SAVE'},
|
||||||
update=preview_replace_color_properties)
|
update=update_replace_color_properties,
|
||||||
|
description='Update preview')
|
||||||
reset: bpy.props.BoolProperty(options={'SKIP_SAVE'},
|
reset: bpy.props.BoolProperty(options={'SKIP_SAVE'},
|
||||||
update=reset_replace_color_properties)
|
update=reset_replace_color_properties)
|
||||||
source_color: bpy.props.FloatVectorProperty(name='Source Color', subtype='COLOR_GAMMA',
|
source_color: bpy.props.FloatVectorProperty(name='Source Color', subtype='COLOR_GAMMA',
|
||||||
min=0, max=1.0, size=3, default=(1.0, 1.0, 1.0), options={'SKIP_SAVE'},
|
min=0, max=1.0, size=3, default=(1.0, 1.0, 1.0), options={'SKIP_SAVE'}) # no alpha
|
||||||
update=update_replace_color_properties) # no alpha
|
|
||||||
replace_color: bpy.props.FloatVectorProperty(name='Replace Color', subtype='COLOR_GAMMA',
|
replace_color: bpy.props.FloatVectorProperty(name='Replace Color', subtype='COLOR_GAMMA',
|
||||||
min=0, max=1.0, size=4, default=(0, 0, 0, 1.0), options={'SKIP_SAVE'},
|
min=0, max=1.0, size=4, default=(0, 0, 0, 1.0), options={'SKIP_SAVE'})
|
||||||
update=update_replace_color_properties)
|
|
||||||
color_threshold: bpy.props.FloatProperty(name='Threshold', subtype='FACTOR',
|
color_threshold: bpy.props.FloatProperty(name='Threshold', subtype='FACTOR',
|
||||||
min=0, max=1.0, default=0.1, options={'SKIP_SAVE'},
|
min=0, max=1.0, default=0.1, options={'SKIP_SAVE'})
|
||||||
update=update_replace_color_properties)
|
|
||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
wm = context.window_manager
|
wm = context.window_manager
|
||||||
@ -827,7 +774,7 @@ class IMAGE_EDITOR_PLUS_OT_replace_color_dialog(bpy.types.Operator):
|
|||||||
|
|
||||||
row = layout.split(align=True)
|
row = layout.split(align=True)
|
||||||
row.column()
|
row.column()
|
||||||
row.prop(self, 'preview', text='Preview', toggle=True, icon='VIEWZOOM')
|
row.prop(self, 'update_preview', text='Update Preview', toggle=True, icon='FILE_REFRESH')
|
||||||
|
|
||||||
layout.separator()
|
layout.separator()
|
||||||
|
|
||||||
@ -850,41 +797,33 @@ class IMAGE_EDITOR_PLUS_OT_replace_color_dialog(bpy.types.Operator):
|
|||||||
row.column()
|
row.column()
|
||||||
row.prop(self, 'reset', text='Reset', toggle=True)
|
row.prop(self, 'reset', text='Reset', toggle=True)
|
||||||
|
|
||||||
def preview_blur_properties(self, context):
|
|
||||||
if self.preview:
|
|
||||||
update_blur_properties(self, context)
|
|
||||||
else:
|
|
||||||
img = app.get_target_image(context)
|
|
||||||
if img:
|
|
||||||
app.revert_image_cache(img)
|
|
||||||
app.refresh_image(context)
|
|
||||||
|
|
||||||
def reset_blur_properties(self, context):
|
def reset_blur_properties(self, context):
|
||||||
if self.reset:
|
if self.reset:
|
||||||
self.property_unset('blur_size')
|
|
||||||
self.property_unset('expand_layer')
|
|
||||||
update_blur_properties(self, context)
|
|
||||||
|
|
||||||
self.reset = False
|
self.reset = False
|
||||||
|
|
||||||
|
self.property_unset('blur_size')
|
||||||
|
self.property_unset('expand_layer')
|
||||||
|
update_blur_properties(self, context)
|
||||||
|
|
||||||
def update_blur_properties(self, context):
|
def update_blur_properties(self, context):
|
||||||
if self.preview:
|
if self.update_preview:
|
||||||
bpy.ops.image_editor_plus.blur('EXEC_DEFAULT', False,
|
self.update_preview = False
|
||||||
blur_size=self.blur_size,
|
|
||||||
expand_layer=False)
|
bpy.ops.image_editor_plus.blur('EXEC_DEFAULT', False,
|
||||||
|
blur_size=self.blur_size,
|
||||||
|
expand_layer=False)
|
||||||
|
|
||||||
class IMAGE_EDITOR_PLUS_OT_blur_dialog(bpy.types.Operator):
|
class IMAGE_EDITOR_PLUS_OT_blur_dialog(bpy.types.Operator):
|
||||||
"""Blur the image"""
|
"""Blur the image"""
|
||||||
bl_idname = 'image_editor_plus.blur_dialog'
|
bl_idname = 'image_editor_plus.blur_dialog'
|
||||||
bl_label = "Blur (Gaussian Blur)"
|
bl_label = "Blur (Gaussian Blur)"
|
||||||
preview: bpy.props.BoolProperty(default=True, options={'SKIP_SAVE'},
|
update_preview: bpy.props.BoolProperty(options={'SKIP_SAVE'},
|
||||||
update=preview_blur_properties)
|
update=update_blur_properties,
|
||||||
|
description='Update preview')
|
||||||
reset: bpy.props.BoolProperty(options={'SKIP_SAVE'}, update=reset_blur_properties)
|
reset: bpy.props.BoolProperty(options={'SKIP_SAVE'}, update=reset_blur_properties)
|
||||||
blur_size: bpy.props.FloatProperty(name='Size', subtype='FACTOR',
|
blur_size: bpy.props.FloatProperty(name='Size', subtype='FACTOR',
|
||||||
min=0, soft_max=10.0, default=3.0, options={'SKIP_SAVE'},
|
min=0, soft_max=10.0, default=3.0, options={'SKIP_SAVE'})
|
||||||
update=update_blur_properties)
|
expand_layer: bpy.props.BoolProperty(name='Expand Layer', default=True, options={'SKIP_SAVE'})
|
||||||
expand_layer: bpy.props.BoolProperty(name='Expand Layer', default=True, options={'SKIP_SAVE'},
|
|
||||||
update=update_blur_properties)
|
|
||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
session = app.get_session()
|
session = app.get_session()
|
||||||
@ -926,7 +865,7 @@ class IMAGE_EDITOR_PLUS_OT_blur_dialog(bpy.types.Operator):
|
|||||||
|
|
||||||
row = layout.split(align=True)
|
row = layout.split(align=True)
|
||||||
row.column()
|
row.column()
|
||||||
row.prop(self, 'preview', text='Preview', toggle=True, icon='VIEWZOOM')
|
row.prop(self, 'update_preview', text='Update Preview', toggle=True, icon='FILE_REFRESH')
|
||||||
|
|
||||||
layout.separator()
|
layout.separator()
|
||||||
|
|
||||||
@ -943,47 +882,38 @@ class IMAGE_EDITOR_PLUS_OT_blur_dialog(bpy.types.Operator):
|
|||||||
row.column()
|
row.column()
|
||||||
row.prop(self, 'reset', text='Reset', toggle=True)
|
row.prop(self, 'reset', text='Reset', toggle=True)
|
||||||
|
|
||||||
def preview_sharpen_properties(self, context):
|
|
||||||
if self.preview:
|
|
||||||
update_sharpen_properties(self, context)
|
|
||||||
else:
|
|
||||||
img = app.get_target_image(context)
|
|
||||||
if img:
|
|
||||||
app.revert_image_cache(img)
|
|
||||||
app.refresh_image(context)
|
|
||||||
|
|
||||||
def reset_sharpen_properties(self, context):
|
def reset_sharpen_properties(self, context):
|
||||||
if self.reset:
|
if self.reset:
|
||||||
self.property_unset('sharpen_radius')
|
|
||||||
self.property_unset('sharpen_amount')
|
|
||||||
self.property_unset('sharpen_threshold')
|
|
||||||
update_sharpen_properties(self, context)
|
|
||||||
|
|
||||||
self.reset = False
|
self.reset = False
|
||||||
|
|
||||||
|
self.property_unset('sharpen_radius')
|
||||||
|
self.property_unset('sharpen_amount')
|
||||||
|
self.property_unset('sharpen_threshold')
|
||||||
|
update_sharpen_properties(self, context)
|
||||||
|
|
||||||
def update_sharpen_properties(self, context):
|
def update_sharpen_properties(self, context):
|
||||||
if self.preview:
|
if self.update_preview:
|
||||||
bpy.ops.image_editor_plus.sharpen('EXEC_DEFAULT', False,
|
self.update_preview = False
|
||||||
sharpen_radius=self.sharpen_radius,
|
|
||||||
sharpen_amount=self.sharpen_amount,
|
bpy.ops.image_editor_plus.sharpen('EXEC_DEFAULT', False,
|
||||||
sharpen_threshold=self.sharpen_threshold)
|
sharpen_radius=self.sharpen_radius,
|
||||||
|
sharpen_amount=self.sharpen_amount,
|
||||||
|
sharpen_threshold=self.sharpen_threshold)
|
||||||
|
|
||||||
class IMAGE_EDITOR_PLUS_OT_sharpen_dialog(bpy.types.Operator):
|
class IMAGE_EDITOR_PLUS_OT_sharpen_dialog(bpy.types.Operator):
|
||||||
"""Sharpen the image"""
|
"""Sharpen the image"""
|
||||||
bl_idname = 'image_editor_plus.sharpen_dialog'
|
bl_idname = 'image_editor_plus.sharpen_dialog'
|
||||||
bl_label = "Sharpen (Unsharp Mask)"
|
bl_label = "Sharpen (Unsharp Mask)"
|
||||||
preview: bpy.props.BoolProperty(default=True, options={'SKIP_SAVE'},
|
update_preview: bpy.props.BoolProperty(options={'SKIP_SAVE'},
|
||||||
update=preview_sharpen_properties)
|
update=update_sharpen_properties,
|
||||||
|
description='Update preview')
|
||||||
reset: bpy.props.BoolProperty(update=reset_sharpen_properties, options={'SKIP_SAVE'})
|
reset: bpy.props.BoolProperty(update=reset_sharpen_properties, options={'SKIP_SAVE'})
|
||||||
sharpen_radius: bpy.props.FloatProperty(name='Radius', subtype='FACTOR',
|
sharpen_radius: bpy.props.FloatProperty(name='Radius', subtype='FACTOR',
|
||||||
min=0, soft_max=10.0, default=3.0, options={'SKIP_SAVE'},
|
min=0, soft_max=10.0, default=3.0, options={'SKIP_SAVE'})
|
||||||
update=update_sharpen_properties)
|
|
||||||
sharpen_amount: bpy.props.FloatProperty(name='Amount', subtype='FACTOR',
|
sharpen_amount: bpy.props.FloatProperty(name='Amount', subtype='FACTOR',
|
||||||
min=0, soft_max=10.0, default=0.5, options={'SKIP_SAVE'},
|
min=0, soft_max=10.0, default=0.5, options={'SKIP_SAVE'})
|
||||||
update=update_sharpen_properties)
|
|
||||||
sharpen_threshold: bpy.props.FloatProperty(name='Threshold', subtype='FACTOR',
|
sharpen_threshold: bpy.props.FloatProperty(name='Threshold', subtype='FACTOR',
|
||||||
min=0, soft_max=1.0, default=0, options={'SKIP_SAVE'},
|
min=0, soft_max=1.0, default=0, options={'SKIP_SAVE'})
|
||||||
update=update_sharpen_properties)
|
|
||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
wm = context.window_manager
|
wm = context.window_manager
|
||||||
@ -1020,7 +950,7 @@ class IMAGE_EDITOR_PLUS_OT_sharpen_dialog(bpy.types.Operator):
|
|||||||
|
|
||||||
row = layout.split(align=True)
|
row = layout.split(align=True)
|
||||||
row.column()
|
row.column()
|
||||||
row.prop(self, 'preview', text='Preview', toggle=True, icon='VIEWZOOM')
|
row.prop(self, 'update_preview', text='Update Preview', toggle=True, icon='FILE_REFRESH')
|
||||||
|
|
||||||
layout.separator()
|
layout.separator()
|
||||||
|
|
||||||
@ -1043,37 +973,30 @@ class IMAGE_EDITOR_PLUS_OT_sharpen_dialog(bpy.types.Operator):
|
|||||||
row.column()
|
row.column()
|
||||||
row.prop(self, 'reset', text='Reset', toggle=True)
|
row.prop(self, 'reset', text='Reset', toggle=True)
|
||||||
|
|
||||||
def preview_add_noise_properties(self, context):
|
|
||||||
if self.preview:
|
|
||||||
update_add_noise_properties(self, context)
|
|
||||||
else:
|
|
||||||
img = app.get_target_image(context)
|
|
||||||
if img:
|
|
||||||
app.revert_image_cache(img)
|
|
||||||
app.refresh_image(context)
|
|
||||||
|
|
||||||
def reset_add_noise_properties(self, context):
|
def reset_add_noise_properties(self, context):
|
||||||
if self.reset:
|
if self.reset:
|
||||||
self.property_unset('add_noise_intensity')
|
|
||||||
update_add_noise_properties(self, context)
|
|
||||||
|
|
||||||
self.reset = False
|
self.reset = False
|
||||||
|
|
||||||
|
self.property_unset('add_noise_intensity')
|
||||||
|
update_add_noise_properties(self, context)
|
||||||
|
|
||||||
def update_add_noise_properties(self, context):
|
def update_add_noise_properties(self, context):
|
||||||
if self.preview:
|
if self.update_preview:
|
||||||
bpy.ops.image_editor_plus.add_noise('EXEC_DEFAULT', False,
|
self.update_preview = False
|
||||||
add_noise_intensity=self.add_noise_intensity)
|
|
||||||
|
bpy.ops.image_editor_plus.add_noise('EXEC_DEFAULT', False,
|
||||||
|
add_noise_intensity=self.add_noise_intensity)
|
||||||
|
|
||||||
class IMAGE_EDITOR_PLUS_OT_add_noise_dialog(bpy.types.Operator):
|
class IMAGE_EDITOR_PLUS_OT_add_noise_dialog(bpy.types.Operator):
|
||||||
"""Add some noise to the image"""
|
"""Add some noise to the image"""
|
||||||
bl_idname = 'image_editor_plus.add_noise_dialog'
|
bl_idname = 'image_editor_plus.add_noise_dialog'
|
||||||
bl_label = "Add Noise (Gaussian Noise)"
|
bl_label = "Add Noise (Gaussian Noise)"
|
||||||
preview: bpy.props.BoolProperty(default=True, options={'SKIP_SAVE'},
|
update_preview: bpy.props.BoolProperty(options={'SKIP_SAVE'},
|
||||||
update=preview_add_noise_properties)
|
update=update_add_noise_properties,
|
||||||
|
description='Update preview')
|
||||||
reset: bpy.props.BoolProperty(options={'SKIP_SAVE'}, update=reset_add_noise_properties)
|
reset: bpy.props.BoolProperty(options={'SKIP_SAVE'}, update=reset_add_noise_properties)
|
||||||
add_noise_intensity: bpy.props.FloatProperty(name='Intensity', subtype='FACTOR',
|
add_noise_intensity: bpy.props.FloatProperty(name='Intensity', subtype='FACTOR',
|
||||||
min=0, soft_max=10.0, default=0.1, options={'SKIP_SAVE'},
|
min=0, soft_max=10.0, default=0.1, options={'SKIP_SAVE'})
|
||||||
update=update_add_noise_properties)
|
|
||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
wm = context.window_manager
|
wm = context.window_manager
|
||||||
@ -1108,7 +1031,7 @@ class IMAGE_EDITOR_PLUS_OT_add_noise_dialog(bpy.types.Operator):
|
|||||||
|
|
||||||
row = layout.split(align=True)
|
row = layout.split(align=True)
|
||||||
row.column()
|
row.column()
|
||||||
row.prop(self, 'preview', text='Preview', toggle=True, icon='VIEWZOOM')
|
row.prop(self, 'update_preview', text='Update Preview', toggle=True, icon='FILE_REFRESH')
|
||||||
|
|
||||||
layout.separator()
|
layout.separator()
|
||||||
|
|
||||||
@ -1121,37 +1044,30 @@ class IMAGE_EDITOR_PLUS_OT_add_noise_dialog(bpy.types.Operator):
|
|||||||
row.column()
|
row.column()
|
||||||
row.prop(self, 'reset', text='Reset', toggle=True)
|
row.prop(self, 'reset', text='Reset', toggle=True)
|
||||||
|
|
||||||
def preview_pixelize_properties(self, context):
|
|
||||||
if self.preview:
|
|
||||||
update_pixelize_properties(self, context)
|
|
||||||
else:
|
|
||||||
img = app.get_target_image(context)
|
|
||||||
if img:
|
|
||||||
app.revert_image_cache(img)
|
|
||||||
app.refresh_image(context)
|
|
||||||
|
|
||||||
def reset_pixelize_properties(self, context):
|
def reset_pixelize_properties(self, context):
|
||||||
if self.reset:
|
if self.reset:
|
||||||
self.property_unset('pixelize_pixel_size')
|
|
||||||
update_pixelize_properties(self, context)
|
|
||||||
|
|
||||||
self.reset = False
|
self.reset = False
|
||||||
|
|
||||||
|
self.property_unset('pixelize_pixel_size')
|
||||||
|
update_pixelize_properties(self, context)
|
||||||
|
|
||||||
def update_pixelize_properties(self, context):
|
def update_pixelize_properties(self, context):
|
||||||
if self.preview:
|
if self.update_preview:
|
||||||
bpy.ops.image_editor_plus.pixelize('EXEC_DEFAULT', False,
|
self.update_preview = False
|
||||||
pixelize_pixel_size=self.pixelize_pixel_size)
|
|
||||||
|
bpy.ops.image_editor_plus.pixelize('EXEC_DEFAULT', False,
|
||||||
|
pixelize_pixel_size=self.pixelize_pixel_size)
|
||||||
|
|
||||||
class IMAGE_EDITOR_PLUS_OT_pixelize_dialog(bpy.types.Operator):
|
class IMAGE_EDITOR_PLUS_OT_pixelize_dialog(bpy.types.Operator):
|
||||||
"""Pixelize the image"""
|
"""Pixelize the image"""
|
||||||
bl_idname = 'image_editor_plus.pixelize_dialog'
|
bl_idname = 'image_editor_plus.pixelize_dialog'
|
||||||
bl_label = "Pixelize"
|
bl_label = "Pixelize"
|
||||||
preview: bpy.props.BoolProperty(default=True, options={'SKIP_SAVE'},
|
update_preview: bpy.props.BoolProperty(options={'SKIP_SAVE'},
|
||||||
update=preview_pixelize_properties)
|
update=update_pixelize_properties,
|
||||||
|
description='Update preview')
|
||||||
reset: bpy.props.BoolProperty(options={'SKIP_SAVE'}, update=reset_pixelize_properties)
|
reset: bpy.props.BoolProperty(options={'SKIP_SAVE'}, update=reset_pixelize_properties)
|
||||||
pixelize_pixel_size: bpy.props.IntProperty(name='Pixel Size', subtype='FACTOR',
|
pixelize_pixel_size: bpy.props.IntProperty(name='Pixel Size', subtype='FACTOR',
|
||||||
min=1, soft_max=64, default=16, options={'SKIP_SAVE'},
|
min=1, soft_max=64, default=16, options={'SKIP_SAVE'})
|
||||||
update=update_pixelize_properties)
|
|
||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
wm = context.window_manager
|
wm = context.window_manager
|
||||||
@ -1186,7 +1102,7 @@ class IMAGE_EDITOR_PLUS_OT_pixelize_dialog(bpy.types.Operator):
|
|||||||
|
|
||||||
row = layout.split(align=True)
|
row = layout.split(align=True)
|
||||||
row.column()
|
row.column()
|
||||||
row.prop(self, 'preview', text='Preview', toggle=True, icon='VIEWZOOM')
|
row.prop(self, 'update_preview', text='Update Preview', toggle=True, icon='FILE_REFRESH')
|
||||||
|
|
||||||
layout.separator()
|
layout.separator()
|
||||||
|
|
||||||
@ -1199,25 +1115,13 @@ class IMAGE_EDITOR_PLUS_OT_pixelize_dialog(bpy.types.Operator):
|
|||||||
row.column()
|
row.column()
|
||||||
row.prop(self, 'reset', text='Reset', toggle=True)
|
row.prop(self, 'reset', text='Reset', toggle=True)
|
||||||
|
|
||||||
def preview_make_seamless_properties(self, context):
|
|
||||||
if self.preview:
|
|
||||||
update_make_seamless_properties(self, context)
|
|
||||||
else:
|
|
||||||
img = app.get_target_image(context)
|
|
||||||
if img:
|
|
||||||
app.revert_image_cache(img)
|
|
||||||
app.refresh_image(context)
|
|
||||||
|
|
||||||
def update_make_seamless_properties(self, context):
|
def update_make_seamless_properties(self, context):
|
||||||
if self.preview:
|
bpy.ops.image_editor_plus.make_seamless('EXEC_DEFAULT', False)
|
||||||
bpy.ops.image_editor_plus.make_seamless('EXEC_DEFAULT', False)
|
|
||||||
|
|
||||||
class IMAGE_EDITOR_PLUS_OT_make_seamless_dialog(bpy.types.Operator):
|
class IMAGE_EDITOR_PLUS_OT_make_seamless_dialog(bpy.types.Operator):
|
||||||
"""Turn the image into seamless tile"""
|
"""Turn the image into seamless tile"""
|
||||||
bl_idname = 'image_editor_plus.make_seamless_dialog'
|
bl_idname = 'image_editor_plus.make_seamless_dialog'
|
||||||
bl_label = "Make Seamless"
|
bl_label = "Make Seamless"
|
||||||
preview: bpy.props.BoolProperty(default=True, options={'SKIP_SAVE'},
|
|
||||||
update=preview_make_seamless_properties)
|
|
||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
wm = context.window_manager
|
wm = context.window_manager
|
||||||
@ -1247,55 +1151,41 @@ class IMAGE_EDITOR_PLUS_OT_make_seamless_dialog(bpy.types.Operator):
|
|||||||
app.refresh_image(context)
|
app.refresh_image(context)
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
layout = self.layout
|
pass
|
||||||
|
|
||||||
row = layout.split(align=True)
|
|
||||||
row.column()
|
|
||||||
row.prop(self, 'preview', text='Preview', toggle=True, icon='VIEWZOOM')
|
|
||||||
|
|
||||||
def preview_normal_map_properties(self, context):
|
|
||||||
if self.preview:
|
|
||||||
update_normal_map_properties(self, context)
|
|
||||||
else:
|
|
||||||
img = app.get_target_image(context)
|
|
||||||
if img:
|
|
||||||
app.revert_image_cache(img)
|
|
||||||
app.refresh_image(context)
|
|
||||||
|
|
||||||
def reset_normal_map_properties(self, context):
|
def reset_normal_map_properties(self, context):
|
||||||
if self.reset:
|
if self.reset:
|
||||||
self.property_unset('scale')
|
|
||||||
self.property_unset('flip_x')
|
|
||||||
self.property_unset('flip_y')
|
|
||||||
self.property_unset('full_z')
|
|
||||||
update_normal_map_properties(self, context)
|
|
||||||
|
|
||||||
self.reset = False
|
self.reset = False
|
||||||
|
|
||||||
|
self.property_unset('scale')
|
||||||
|
self.property_unset('flip_x')
|
||||||
|
self.property_unset('flip_y')
|
||||||
|
self.property_unset('full_z')
|
||||||
|
update_normal_map_properties(self, context)
|
||||||
|
|
||||||
def update_normal_map_properties(self, context):
|
def update_normal_map_properties(self, context):
|
||||||
if self.preview:
|
if self.update_preview:
|
||||||
bpy.ops.image_editor_plus.normal_map('EXEC_DEFAULT', False,
|
self.update_preview = False
|
||||||
scale=self.scale,
|
|
||||||
flip_x=self.flip_x,
|
bpy.ops.image_editor_plus.normal_map('EXEC_DEFAULT', False,
|
||||||
flip_y=self.flip_y,
|
scale=self.scale,
|
||||||
full_z=self.full_z)
|
flip_x=self.flip_x,
|
||||||
|
flip_y=self.flip_y,
|
||||||
|
full_z=self.full_z)
|
||||||
|
|
||||||
class IMAGE_EDITOR_PLUS_OT_normal_map_dialog(bpy.types.Operator):
|
class IMAGE_EDITOR_PLUS_OT_normal_map_dialog(bpy.types.Operator):
|
||||||
"""Generate a normal map"""
|
"""Generate a normal map"""
|
||||||
bl_idname = 'image_editor_plus.normal_map_dialog'
|
bl_idname = 'image_editor_plus.normal_map_dialog'
|
||||||
bl_label = "Normal Map"
|
bl_label = "Normal Map"
|
||||||
preview: bpy.props.BoolProperty(default=True, options={'SKIP_SAVE'},
|
update_preview: bpy.props.BoolProperty(options={'SKIP_SAVE'},
|
||||||
update=preview_normal_map_properties)
|
update=update_normal_map_properties,
|
||||||
|
description='Update preview')
|
||||||
reset: bpy.props.BoolProperty(options={'SKIP_SAVE'}, update=reset_normal_map_properties)
|
reset: bpy.props.BoolProperty(options={'SKIP_SAVE'}, update=reset_normal_map_properties)
|
||||||
scale: bpy.props.FloatProperty(name='Scale', subtype='FACTOR',
|
scale: bpy.props.FloatProperty(name='Scale', subtype='FACTOR',
|
||||||
min=0, soft_max=250.0, default=10.0, options={'SKIP_SAVE'},
|
min=0, soft_max=250.0, default=10.0, options={'SKIP_SAVE'})
|
||||||
update=update_normal_map_properties)
|
flip_x: bpy.props.BoolProperty(name='Flip X', default=False, options={'SKIP_SAVE'})
|
||||||
flip_x: bpy.props.BoolProperty(name='Flip X', default=False, options={'SKIP_SAVE'},
|
flip_y: bpy.props.BoolProperty(name='Flip Y', default=False, options={'SKIP_SAVE'})
|
||||||
update=update_normal_map_properties)
|
full_z: bpy.props.BoolProperty(name='Full Range for Z', default=False, options={'SKIP_SAVE'})
|
||||||
flip_y: bpy.props.BoolProperty(name='Flip Y', default=False, options={'SKIP_SAVE'},
|
|
||||||
update=update_normal_map_properties)
|
|
||||||
full_z: bpy.props.BoolProperty(name='Full Range for Z', default=False, options={'SKIP_SAVE'},
|
|
||||||
update=update_normal_map_properties)
|
|
||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
session = app.get_session()
|
session = app.get_session()
|
||||||
@ -1339,7 +1229,7 @@ class IMAGE_EDITOR_PLUS_OT_normal_map_dialog(bpy.types.Operator):
|
|||||||
|
|
||||||
row = layout.split(align=True)
|
row = layout.split(align=True)
|
||||||
row.column()
|
row.column()
|
||||||
row.prop(self, 'preview', text='Preview', toggle=True, icon='VIEWZOOM')
|
row.prop(self, 'update_preview', text='Update Preview', toggle=True, icon='FILE_REFRESH')
|
||||||
|
|
||||||
layout.separator()
|
layout.separator()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user