Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_ui/space_image.py
| Show All 23 Lines | from bl_ui.properties_paint_common import ( | ||||
| brush_texture_settings, | brush_texture_settings, | ||||
| brush_mask_texture_settings, | brush_mask_texture_settings, | ||||
| ) | ) | ||||
| from bpy.app.translations import pgettext_iface as iface_ | from bpy.app.translations import pgettext_iface as iface_ | ||||
| class ImagePaintPanel(UnifiedPaintPanel): | class ImagePaintPanel(UnifiedPaintPanel): | ||||
| bl_space_type = 'IMAGE_EDITOR' | bl_space_type = 'IMAGE_EDITOR' | ||||
| bl_region_type = 'UI' | bl_region_type = 'TOOLS' | ||||
| bl_category = "Tools" | |||||
| class BrushButtonsPanel: | class BrushButtonsPanel: | ||||
| bl_space_type = 'IMAGE_EDITOR' | bl_space_type = 'IMAGE_EDITOR' | ||||
| bl_region_type = 'UI' | bl_region_type = 'TOOLS' | ||||
| bl_category = "Tools" | |||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| sima = context.space_data | sima = context.space_data | ||||
| toolsettings = context.tool_settings.image_paint | toolsettings = context.tool_settings.image_paint | ||||
| return sima.show_paint and toolsettings.brush | return sima.show_paint and toolsettings.brush | ||||
| ▲ Show 20 Lines • Show All 415 Lines • ▼ Show 20 Lines | def draw_menus(layout, context): | ||||
| layout.menu("IMAGE_MT_image", text="Image") | layout.menu("IMAGE_MT_image", text="Image") | ||||
| if show_uvedit: | if show_uvedit: | ||||
| layout.menu("IMAGE_MT_uvs") | layout.menu("IMAGE_MT_uvs") | ||||
| if show_maskedit: | if show_maskedit: | ||||
| layout.menu("MASK_MT_mask") | layout.menu("MASK_MT_mask") | ||||
| # ----------------------------------------------------------------------------- | |||||
| # Mask (similar code in space_clip.py, keep in sync) | |||||
| # note! - panel placement does _not_ fit well with image panels... need to fix | |||||
| from bl_ui.properties_mask_common import (MASK_PT_mask, | |||||
| MASK_PT_layers, | |||||
| MASK_PT_spline, | |||||
| MASK_PT_point, | |||||
| MASK_PT_display, | |||||
| MASK_PT_tools) | |||||
| class IMAGE_PT_mask(MASK_PT_mask, Panel): | |||||
| bl_space_type = 'IMAGE_EDITOR' | |||||
| bl_region_type = 'UI' | |||||
| class IMAGE_PT_mask_layers(MASK_PT_layers, Panel): | |||||
| bl_space_type = 'IMAGE_EDITOR' | |||||
| bl_region_type = 'UI' | |||||
| class IMAGE_PT_mask_display(MASK_PT_display, Panel): | |||||
| bl_space_type = 'IMAGE_EDITOR' | |||||
| bl_region_type = 'UI' | |||||
| class IMAGE_PT_active_mask_spline(MASK_PT_spline, Panel): | |||||
| bl_space_type = 'IMAGE_EDITOR' | |||||
| bl_region_type = 'UI' | |||||
| class IMAGE_PT_active_mask_point(MASK_PT_point, Panel): | |||||
| bl_space_type = 'IMAGE_EDITOR' | |||||
| bl_region_type = 'UI' | |||||
| class IMAGE_PT_image_properties(Panel): | class IMAGE_PT_image_properties(Panel): | ||||
| bl_space_type = 'IMAGE_EDITOR' | bl_space_type = 'IMAGE_EDITOR' | ||||
| bl_region_type = 'UI' | bl_region_type = 'UI' | ||||
| bl_label = "Image" | bl_label = "Image" | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| sima = context.space_data | sima = context.space_data | ||||
| Show All 12 Lines | class IMAGE_PT_game_properties(Panel): | ||||
| bl_space_type = 'IMAGE_EDITOR' | bl_space_type = 'IMAGE_EDITOR' | ||||
| bl_region_type = 'UI' | bl_region_type = 'UI' | ||||
| bl_label = "Game Properties" | bl_label = "Game Properties" | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| sima = context.space_data | sima = context.space_data | ||||
| # display even when not in game mode because these settings effect the 3d view | # display even when not in game mode because these settings effect the 3d view | ||||
| return (sima and sima.image) # and (rd.engine == 'BLENDER_GAME') | return (sima and sima.image and not sima.show_maskedit) # and (rd.engine == 'BLENDER_GAME') | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| sima = context.space_data | sima = context.space_data | ||||
| ima = sima.image | ima = sima.image | ||||
| split = layout.split() | split = layout.split() | ||||
| Show All 15 Lines | def draw(self, context): | ||||
| col = split.column() | col = split.column() | ||||
| col.label(text="Clamp:") | col.label(text="Clamp:") | ||||
| col.prop(ima, "use_clamp_x", text="X") | col.prop(ima, "use_clamp_x", text="X") | ||||
| col.prop(ima, "use_clamp_y", text="Y") | col.prop(ima, "use_clamp_y", text="Y") | ||||
| col.separator() | col.separator() | ||||
| col.prop(ima, "mapping", expand=True) | col.prop(ima, "mapping", expand=True) | ||||
| class IMAGE_PT_view_histogram(Panel): | |||||
| bl_space_type = 'IMAGE_EDITOR' | |||||
| bl_region_type = 'PREVIEW' | |||||
| bl_label = "Histogram" | |||||
| @classmethod | |||||
| def poll(cls, context): | |||||
| sima = context.space_data | |||||
| return (sima and sima.image) | |||||
| def draw(self, context): | |||||
| layout = self.layout | |||||
| sima = context.space_data | |||||
| hist = sima.scopes.histogram | |||||
| layout.template_histogram(sima.scopes, "histogram") | |||||
| row = layout.row(align=True) | |||||
| row.prop(hist, "mode", expand=True) | |||||
| row.prop(hist, "show_line", text="") | |||||
| class IMAGE_PT_view_waveform(Panel): | |||||
| bl_space_type = 'IMAGE_EDITOR' | |||||
| bl_region_type = 'PREVIEW' | |||||
| bl_label = "Waveform" | |||||
| @classmethod | |||||
| def poll(cls, context): | |||||
| sima = context.space_data | |||||
| return (sima and sima.image) | |||||
| def draw(self, context): | |||||
| layout = self.layout | |||||
| sima = context.space_data | |||||
| layout.template_waveform(sima, "scopes") | |||||
| row = layout.split(percentage=0.75) | |||||
| row.prop(sima.scopes, "waveform_alpha") | |||||
| row.prop(sima.scopes, "waveform_mode", icon_only=True) | |||||
| class IMAGE_PT_view_vectorscope(Panel): | |||||
| bl_space_type = 'IMAGE_EDITOR' | |||||
| bl_region_type = 'PREVIEW' | |||||
| bl_label = "Vectorscope" | |||||
| @classmethod | |||||
| def poll(cls, context): | |||||
| sima = context.space_data | |||||
| return (sima and sima.image) | |||||
| def draw(self, context): | |||||
| layout = self.layout | |||||
| sima = context.space_data | |||||
| layout.template_vectorscope(sima, "scopes") | |||||
| layout.prop(sima.scopes, "vectorscope_alpha") | |||||
| class IMAGE_PT_sample_line(Panel): | |||||
| bl_space_type = 'IMAGE_EDITOR' | |||||
| bl_region_type = 'PREVIEW' | |||||
| bl_label = "Sample Line" | |||||
| @classmethod | |||||
| def poll(cls, context): | |||||
| sima = context.space_data | |||||
| return (sima and sima.image) | |||||
| def draw(self, context): | |||||
| layout = self.layout | |||||
| sima = context.space_data | |||||
| hist = sima.sample_histogram | |||||
| layout.operator("image.sample_line") | |||||
| layout.template_histogram(sima, "sample_histogram") | |||||
| row = layout.row(align=True) | |||||
| row.prop(hist, "mode", expand=True) | |||||
| row.prop(hist, "show_line", text="") | |||||
| class IMAGE_PT_scope_sample(Panel): | |||||
| bl_space_type = 'IMAGE_EDITOR' | |||||
| bl_region_type = 'PREVIEW' | |||||
| bl_label = "Scope Samples" | |||||
| @classmethod | |||||
| def poll(cls, context): | |||||
| sima = context.space_data | |||||
| return sima | |||||
| def draw(self, context): | |||||
| layout = self.layout | |||||
| sima = context.space_data | |||||
| row = layout.row() | |||||
| row.prop(sima.scopes, "use_full_resolution") | |||||
| sub = row.row() | |||||
| sub.active = not sima.scopes.use_full_resolution | |||||
| sub.prop(sima.scopes, "accuracy") | |||||
| class IMAGE_PT_view_properties(Panel): | class IMAGE_PT_view_properties(Panel): | ||||
| bl_space_type = 'IMAGE_EDITOR' | bl_space_type = 'IMAGE_EDITOR' | ||||
| bl_region_type = 'UI' | bl_region_type = 'UI' | ||||
| bl_label = "Display" | bl_label = "Display" | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| sima = context.space_data | sima = context.space_data | ||||
| ▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | def draw(self, context): | ||||
| col = split.column() | col = split.column() | ||||
| col.prop(uvedit, "show_stretch", text="Stretch") | col.prop(uvedit, "show_stretch", text="Stretch") | ||||
| sub = col.column() | sub = col.column() | ||||
| sub.active = uvedit.show_stretch | sub.active = uvedit.show_stretch | ||||
| sub.row().prop(uvedit, "draw_stretch_type", expand=True) | sub.row().prop(uvedit, "draw_stretch_type", expand=True) | ||||
| class IMAGE_PT_paint(Panel, ImagePaintPanel): | class IMAGE_PT_paint(Panel, ImagePaintPanel): | ||||
| bl_space_type = 'IMAGE_EDITOR' | |||||
| bl_region_type = 'UI' | |||||
| bl_label = "Paint" | bl_label = "Paint" | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| sima = context.space_data | sima = context.space_data | ||||
| return sima.show_paint | return sima.show_paint | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| ▲ Show 20 Lines • Show All 239 Lines • ▼ Show 20 Lines | def draw(self, context): | ||||
| col = layout.column(align=True) | col = layout.column(align=True) | ||||
| col.prop(brush, "use_custom_icon") | col.prop(brush, "use_custom_icon") | ||||
| if brush.use_custom_icon: | if brush.use_custom_icon: | ||||
| col.prop(brush, "icon_filepath", text="") | col.prop(brush, "icon_filepath", text="") | ||||
| class IMAGE_UV_sculpt_curve(Panel): | class IMAGE_UV_sculpt_curve(Panel): | ||||
| bl_space_type = 'IMAGE_EDITOR' | bl_space_type = 'IMAGE_EDITOR' | ||||
| bl_region_type = 'UI' | bl_region_type = 'TOOLS' | ||||
| bl_label = "UV Sculpt Curve" | bl_label = "UV Sculpt Curve" | ||||
| bl_category = "Tools" | |||||
| bl_options = {'DEFAULT_CLOSED'} | bl_options = {'DEFAULT_CLOSED'} | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| sima = context.space_data | sima = context.space_data | ||||
| toolsettings = context.tool_settings.image_paint | toolsettings = context.tool_settings.image_paint | ||||
| return sima.show_uvedit and context.tool_settings.use_uv_sculpt and not (sima.show_paint and toolsettings.brush) | return sima.show_uvedit and context.tool_settings.use_uv_sculpt and not (sima.show_paint and toolsettings.brush) | ||||
| Show All 12 Lines | def draw(self, context): | ||||
| row.operator("brush.curve_preset", icon='ROOTCURVE', text="").shape = 'ROOT' | row.operator("brush.curve_preset", icon='ROOTCURVE', text="").shape = 'ROOT' | ||||
| row.operator("brush.curve_preset", icon='SHARPCURVE', text="").shape = 'SHARP' | row.operator("brush.curve_preset", icon='SHARPCURVE', text="").shape = 'SHARP' | ||||
| row.operator("brush.curve_preset", icon='LINCURVE', text="").shape = 'LINE' | row.operator("brush.curve_preset", icon='LINCURVE', text="").shape = 'LINE' | ||||
| row.operator("brush.curve_preset", icon='NOCURVE', text="").shape = 'MAX' | row.operator("brush.curve_preset", icon='NOCURVE', text="").shape = 'MAX' | ||||
| class IMAGE_UV_sculpt(Panel, ImagePaintPanel): | class IMAGE_UV_sculpt(Panel, ImagePaintPanel): | ||||
| bl_space_type = 'IMAGE_EDITOR' | bl_space_type = 'IMAGE_EDITOR' | ||||
| bl_region_type = 'UI' | bl_region_type = 'TOOLS' | ||||
| bl_category = "Tools" | |||||
| bl_label = "UV Sculpt" | bl_label = "UV Sculpt" | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| sima = context.space_data | sima = context.space_data | ||||
| toolsettings = context.tool_settings.image_paint | toolsettings = context.tool_settings.image_paint | ||||
| return sima.show_uvedit and context.tool_settings.use_uv_sculpt and not (sima.show_paint and toolsettings.brush) | return sima.show_uvedit and context.tool_settings.use_uv_sculpt and not (sima.show_paint and toolsettings.brush) | ||||
| Show All 19 Lines | def draw(self, context): | ||||
| col.prop(toolsettings, "uv_sculpt_lock_borders") | col.prop(toolsettings, "uv_sculpt_lock_borders") | ||||
| col.prop(toolsettings, "uv_sculpt_all_islands") | col.prop(toolsettings, "uv_sculpt_all_islands") | ||||
| col.prop(toolsettings, "uv_sculpt_tool") | col.prop(toolsettings, "uv_sculpt_tool") | ||||
| if toolsettings.uv_sculpt_tool == 'RELAX': | if toolsettings.uv_sculpt_tool == 'RELAX': | ||||
| col.prop(toolsettings, "uv_relax_method") | col.prop(toolsettings, "uv_relax_method") | ||||
| # ----------------------------------------------------------------------------- | class IMAGE_PT_tools_mask(MASK_PT_tools, Panel): | ||||
| # Mask (similar code in space_clip.py, keep in sync) | bl_space_type = 'IMAGE_EDITOR' | ||||
| # note! - panel placement does _not_ fit well with image panels... need to fix | bl_region_type = 'TOOLS' | ||||
| bl_category = 'Mask' | |||||
| from bl_ui.properties_mask_common import (MASK_PT_mask, | |||||
| MASK_PT_layers, | |||||
| MASK_PT_spline, | |||||
| MASK_PT_point, | |||||
| MASK_PT_display, | |||||
| MASK_PT_tools) | |||||
| # --- end mask --- | |||||
| class IMAGE_PT_mask(MASK_PT_mask, Panel): | class IMAGE_PT_view_histogram(Panel): | ||||
| bl_space_type = 'IMAGE_EDITOR' | bl_space_type = 'IMAGE_EDITOR' | ||||
| bl_region_type = 'PREVIEW' | bl_region_type = 'TOOLS' | ||||
| bl_label = "Histogram" | |||||
| bl_category = "Scopes" | |||||
| @classmethod | |||||
| def poll(cls, context): | |||||
| sima = context.space_data | |||||
| return (sima and sima.image) | |||||
| class IMAGE_PT_mask_layers(MASK_PT_layers, Panel): | def draw(self, context): | ||||
| layout = self.layout | |||||
| sima = context.space_data | |||||
| hist = sima.scopes.histogram | |||||
| layout.template_histogram(sima.scopes, "histogram") | |||||
| row = layout.row(align=True) | |||||
| row.prop(hist, "mode", expand=True) | |||||
| row.prop(hist, "show_line", text="") | |||||
| class IMAGE_PT_view_waveform(Panel): | |||||
| bl_space_type = 'IMAGE_EDITOR' | bl_space_type = 'IMAGE_EDITOR' | ||||
| bl_region_type = 'PREVIEW' | bl_region_type = 'TOOLS' | ||||
| bl_label = "Waveform" | |||||
| bl_category = "Scopes" | |||||
| @classmethod | |||||
| def poll(cls, context): | |||||
| sima = context.space_data | |||||
| return (sima and sima.image) | |||||
| def draw(self, context): | |||||
| layout = self.layout | |||||
| class IMAGE_PT_mask_display(MASK_PT_display, Panel): | sima = context.space_data | ||||
| layout.template_waveform(sima, "scopes") | |||||
| row = layout.split(percentage=0.75) | |||||
| row.prop(sima.scopes, "waveform_alpha") | |||||
| row.prop(sima.scopes, "waveform_mode", icon_only=True) | |||||
| class IMAGE_PT_view_vectorscope(Panel): | |||||
| bl_space_type = 'IMAGE_EDITOR' | bl_space_type = 'IMAGE_EDITOR' | ||||
| bl_region_type = 'PREVIEW' | bl_region_type = 'TOOLS' | ||||
| bl_label = "Vectorscope" | |||||
| bl_category = "Scopes" | |||||
| @classmethod | |||||
| def poll(cls, context): | |||||
| sima = context.space_data | |||||
| return (sima and sima.image) | |||||
| class IMAGE_PT_active_mask_spline(MASK_PT_spline, Panel): | def draw(self, context): | ||||
| layout = self.layout | |||||
| sima = context.space_data | |||||
| layout.template_vectorscope(sima, "scopes") | |||||
| layout.prop(sima.scopes, "vectorscope_alpha") | |||||
| class IMAGE_PT_sample_line(Panel): | |||||
| bl_space_type = 'IMAGE_EDITOR' | bl_space_type = 'IMAGE_EDITOR' | ||||
| bl_region_type = 'PREVIEW' | bl_region_type = 'TOOLS' | ||||
| bl_label = "Sample Line" | |||||
| bl_category = "Scopes" | |||||
| @classmethod | |||||
| def poll(cls, context): | |||||
| sima = context.space_data | |||||
| return (sima and sima.image) | |||||
| class IMAGE_PT_active_mask_point(MASK_PT_point, Panel): | def draw(self, context): | ||||
| layout = self.layout | |||||
| sima = context.space_data | |||||
| hist = sima.sample_histogram | |||||
| layout.operator("image.sample_line") | |||||
| layout.template_histogram(sima, "sample_histogram") | |||||
| row = layout.row(align=True) | |||||
| row.prop(hist, "mode", expand=True) | |||||
| row.prop(hist, "show_line", text="") | |||||
| class IMAGE_PT_scope_sample(Panel): | |||||
| bl_space_type = 'IMAGE_EDITOR' | bl_space_type = 'IMAGE_EDITOR' | ||||
| bl_region_type = 'PREVIEW' | bl_region_type = 'TOOLS' | ||||
| bl_label = "Scope Samples" | |||||
| bl_category = "Scopes" | |||||
| @classmethod | |||||
| def poll(cls, context): | |||||
| sima = context.space_data | |||||
| return sima | |||||
| class IMAGE_PT_tools_mask(MASK_PT_tools, Panel): | def draw(self, context): | ||||
| layout = self.layout | |||||
| sima = context.space_data | |||||
| row = layout.row() | |||||
| row.prop(sima.scopes, "use_full_resolution") | |||||
| sub = row.row() | |||||
| sub.active = not sima.scopes.use_full_resolution | |||||
| sub.prop(sima.scopes, "accuracy") | |||||
| class IMAGE_PT_tools_grease_pencil(Panel): | |||||
| bl_space_type = 'IMAGE_EDITOR' | bl_space_type = 'IMAGE_EDITOR' | ||||
| bl_region_type = 'UI' # is 'TOOLS' in the clip editor | bl_region_type = 'TOOLS' | ||||
| bl_label = "Grease Pencil" | |||||
| bl_category = "Grease Pencil" | |||||
| def draw(self, context): | |||||
| layout = self.layout | |||||
| col = layout.column(align=True) | |||||
| row = col.row(align=True) | |||||
| row.operator("gpencil.draw", text="Draw").mode = 'DRAW' | |||||
| row.operator("gpencil.draw", text="Line").mode = 'DRAW_STRAIGHT' | |||||
| row = col.row(align=True) | |||||
| row.operator("gpencil.draw", text="Poly").mode = 'DRAW_POLY' | |||||
| row.operator("gpencil.draw", text="Erase").mode = 'ERASER' | |||||
| row = col.row(align=True) | |||||
| row.prop(context.tool_settings, "use_grease_pencil_sessions") | |||||
| # --- end mask --- | |||||
| if __name__ == "__main__": # only for live edit. | if __name__ == "__main__": # only for live edit. | ||||
| bpy.utils.register_module(__name__) | bpy.utils.register_module(__name__) | ||||