Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Riakiotakis <kalast@gmail.com>2014-02-13 21:49:26 +0400
committerAntony Riakiotakis <kalast@gmail.com>2014-02-19 19:22:01 +0400
commiteb7485389b8ae29c0f56c942e800722fe25ebebe (patch)
tree0c4f71c85a75647f1a7d1ca084a1cd4295f88288 /release/scripts/startup/bl_ui/space_image.py
parent6b1a4fc66ef4e3197601318ce4c36db2c8359b98 (diff)
Use tabs for image editor.
For initial discussion see T38371 This commit organized panels for image editor to new tab categories dependent on the image editor mode: View Mode: Tools - contains UV tools (currently only transform and UV Sculpting) Scopes - contains scopes Grease Pencil - contains Grease Pencil operators Paint Mode: Tools - contains brush options Scopes - as above Grease Pencil - as above Mask Mode Mask - contains mask tools Scopes - as above Grease Pencil - as above Grease Pencil panel/tab now includes operators, not view options which have been moved to the UI region on the right. To make this work better, image editor toolbar now is of type TOOLS instead of PREVIEW as was the case previously. A nice version patch makes sure all works predictably, but opening newer files with older blender executables could backfire. This commit does not address which UV Tools will be included in the Tools tab for the view mode, but does include some basic tools (transform) and provides a class to inherit from to avoid conflicts with UV Sculpting. Reviewers: brecht, dingto, sergey Differential Revision: https://developer.blender.org/D315
Diffstat (limited to 'release/scripts/startup/bl_ui/space_image.py')
-rw-r--r--release/scripts/startup/bl_ui/space_image.py316
1 files changed, 179 insertions, 137 deletions
diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py
index fdc5be4db8d..10d292bd8d5 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -24,17 +24,20 @@ from bl_ui.properties_paint_common import (
brush_texture_settings,
brush_mask_texture_settings,
)
+from bl_ui.properties_grease_pencil_common import GreasePencilPanel
from bpy.app.translations import pgettext_iface as iface_
class ImagePaintPanel(UnifiedPaintPanel):
bl_space_type = 'IMAGE_EDITOR'
- bl_region_type = 'UI'
+ bl_region_type = 'TOOLS'
+ bl_category = "Tools"
class BrushButtonsPanel:
bl_space_type = 'IMAGE_EDITOR'
- bl_region_type = 'UI'
+ bl_region_type = 'TOOLS'
+ bl_category = "Tools"
@classmethod
def poll(cls, context):
@@ -42,6 +45,15 @@ class BrushButtonsPanel:
toolsettings = context.tool_settings.image_paint
return sima.show_paint and toolsettings.brush
+class UVToolsPanel:
+ bl_space_type = 'IMAGE_EDITOR'
+ bl_region_type = 'TOOLS'
+ bl_category = "Tools"
+
+ @classmethod
+ def poll(cls, context):
+ sima = context.space_data
+ return sima.show_uvedit and not context.tool_settings.use_uv_sculpt
class IMAGE_MT_view(Menu):
bl_label = "View"
@@ -466,6 +478,42 @@ class MASK_MT_editor_menus(Menu):
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):
bl_space_type = 'IMAGE_EDITOR'
bl_region_type = 'UI'
@@ -494,7 +542,7 @@ class IMAGE_PT_game_properties(Panel):
def poll(cls, context):
sima = context.space_data
# 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):
layout = self.layout
@@ -526,112 +574,6 @@ class IMAGE_PT_game_properties(Panel):
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):
bl_space_type = 'IMAGE_EDITOR'
bl_region_type = 'UI'
@@ -692,11 +634,28 @@ class IMAGE_PT_view_properties(Panel):
sub.row().prop(uvedit, "draw_stretch_type", expand=True)
+class IMAGE_PT_tools_transform_uvs(Panel, UVToolsPanel):
+ bl_label = "Transform"
+
+ @classmethod
+ def poll(cls, context):
+ sima = context.space_data
+ return sima.show_uvedit and not context.tool_settings.use_uv_sculpt
+
+ def draw(self, context):
+ layout = self.layout
+
+ col = layout.column(align=True)
+ col.operator("transform.translate")
+ col.operator("transform.rotate")
+ col.operator("transform.resize", text="Scale")
+ col.separator()
+
+ col.operator("transform.shear")
+
class IMAGE_PT_paint(Panel, ImagePaintPanel):
- bl_space_type = 'IMAGE_EDITOR'
- bl_region_type = 'UI'
bl_label = "Paint"
-
+
@classmethod
def poll(cls, context):
sima = context.space_data
@@ -952,8 +911,9 @@ class IMAGE_PT_tools_brush_appearance(BrushButtonsPanel, Panel):
class IMAGE_UV_sculpt_curve(Panel):
bl_space_type = 'IMAGE_EDITOR'
- bl_region_type = 'UI'
+ bl_region_type = 'TOOLS'
bl_label = "UV Sculpt Curve"
+ bl_category = "Tools"
bl_options = {'DEFAULT_CLOSED'}
@classmethod
@@ -982,7 +942,8 @@ class IMAGE_UV_sculpt_curve(Panel):
class IMAGE_UV_sculpt(Panel, ImagePaintPanel):
bl_space_type = 'IMAGE_EDITOR'
- bl_region_type = 'UI'
+ bl_region_type = 'TOOLS'
+ bl_category = "Tools"
bl_label = "UV Sculpt"
@classmethod
@@ -1018,48 +979,129 @@ class IMAGE_UV_sculpt(Panel, ImagePaintPanel):
col.prop(toolsettings, "uv_relax_method")
-# -----------------------------------------------------------------------------
-# 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_tools_mask(MASK_PT_tools, Panel):
+ bl_space_type = 'IMAGE_EDITOR'
+ bl_region_type = 'TOOLS'
+ bl_category = 'Mask'
+# --- end mask ---
-class IMAGE_PT_mask(MASK_PT_mask, Panel):
+class IMAGE_PT_view_histogram(Panel):
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_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_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)
+ def draw(self, context):
+ layout = self.layout
-class IMAGE_PT_active_mask_spline(MASK_PT_spline, Panel):
+ 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_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_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(GreasePencilPanel, Panel):
bl_space_type = 'IMAGE_EDITOR'
- bl_region_type = 'UI' # is 'TOOLS' in the clip editor
+ bl_region_type = 'TOOLS'
+ bl_category = "Grease Pencil"
-# --- end mask ---
if __name__ == "__main__": # only for live edit.
bpy.utils.register_module(__name__)