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:
Diffstat (limited to 'release/scripts/ui/space_image.py')
-rw-r--r--release/scripts/ui/space_image.py304
1 files changed, 173 insertions, 131 deletions
diff --git a/release/scripts/ui/space_image.py b/release/scripts/ui/space_image.py
index 1c48b99939d..bd59aaa42fa 100644
--- a/release/scripts/ui/space_image.py
+++ b/release/scripts/ui/space_image.py
@@ -19,7 +19,16 @@
# <pep8 compliant>
import bpy
-narrowui = 180
+
+class BrushButtonsPanel():
+ bl_space_type = 'IMAGE_EDITOR'
+ bl_region_type = 'UI'
+
+ @classmethod
+ def poll(cls, context):
+ sima = context.space_data
+ toolsettings = context.tool_settings.image_paint
+ return sima.show_paint and toolsettings.brush
class IMAGE_MT_view(bpy.types.Menu):
@@ -29,7 +38,7 @@ class IMAGE_MT_view(bpy.types.Menu):
layout = self.layout
sima = context.space_data
- # uv = sima.uv_editor
+ uv = sima.uv_editor
toolsettings = context.tool_settings
show_uvedit = sima.show_uvedit
@@ -39,9 +48,10 @@ class IMAGE_MT_view(bpy.types.Menu):
layout.separator()
- layout.prop(sima, "update_automatically")
+ layout.prop(sima, "use_realtime_update")
if show_uvedit:
- layout.prop(toolsettings, "uv_local_view") # Numpad /
+ layout.prop(toolsettings, "show_uv_local_view") # Numpad /
+ layout.prop(uv, "show_other_objects")
layout.separator()
@@ -111,6 +121,7 @@ class IMAGE_MT_image(bpy.types.Menu):
layout.operator("image.save")
layout.operator("image.save_as")
+ layout.operator("image.save_as", text="Save a Copy").copy = True
if ima.source == 'SEQUENCE':
layout.operator("image.save_sequence")
@@ -127,13 +138,13 @@ class IMAGE_MT_image(bpy.types.Menu):
# only for dirty && specific image types, perhaps
# this could be done in operator poll too
- if ima.dirty:
+ if ima.is_dirty:
if ima.source in ('FILE', 'GENERATED') and ima.type != 'MULTILAYER':
layout.operator("image.pack", text="Pack As PNG").as_png = True
layout.separator()
- layout.prop(sima, "image_painting")
+ layout.prop(sima, "use_image_paint")
class IMAGE_MT_uvs_showhide(bpy.types.Menu):
@@ -143,8 +154,8 @@ class IMAGE_MT_uvs_showhide(bpy.types.Menu):
layout = self.layout
layout.operator("uv.reveal")
- layout.operator("uv.hide")
- layout.operator("uv.hide").unselected = True
+ layout.operator("uv.hide", text="Hide Selected")
+ layout.operator("uv.hide", text="Hide Unselected").unselected = True
class IMAGE_MT_uvs_transform(bpy.types.Menu):
@@ -206,12 +217,12 @@ class IMAGE_MT_uvs(bpy.types.Menu):
uv = sima.uv_editor
toolsettings = context.tool_settings
- layout.prop(uv, "snap_to_pixels")
- layout.prop(uv, "constrain_to_image_bounds")
+ layout.prop(uv, "use_snap_to_pixels")
+ layout.prop(uv, "lock_bounds")
layout.separator()
- layout.prop(uv, "live_unwrap")
+ layout.prop(uv, "use_live_unwrap")
layout.operator("uv.unwrap")
layout.operator("uv.pin", text="Unpin").clear = True
layout.operator("uv.pin")
@@ -233,8 +244,8 @@ class IMAGE_MT_uvs(bpy.types.Menu):
layout.separator()
- layout.prop_menu_enum(toolsettings, "proportional_editing")
- layout.prop_menu_enum(toolsettings, "proportional_editing_falloff")
+ layout.prop_menu_enum(toolsettings, "proportional_edit")
+ layout.prop_menu_enum(toolsettings, "proportional_edit_falloff")
layout.separator()
@@ -267,7 +278,7 @@ class IMAGE_HT_header(bpy.types.Header):
if show_uvedit:
sub.menu("IMAGE_MT_select")
- if ima and ima.dirty:
+ if ima and ima.is_dirty:
sub.menu("IMAGE_MT_image", text="Image*")
else:
sub.menu("IMAGE_MT_image", text="Image")
@@ -277,42 +288,42 @@ class IMAGE_HT_header(bpy.types.Header):
layout.template_ID(sima, "image", new="image.new")
if not show_render:
- layout.prop(sima, "image_pin", text="")
+ layout.prop(sima, "use_image_pin", text="")
# uv editing
if show_uvedit:
uvedit = sima.uv_editor
- layout.prop(uvedit, "pivot", text="", icon_only=True)
- layout.prop(toolsettings, "uv_sync_selection", text="")
+ layout.prop(uvedit, "pivot_point", text="", icon_only=True)
+ layout.prop(toolsettings, "use_uv_select_sync", text="")
- if toolsettings.uv_sync_selection:
+ if toolsettings.use_uv_select_sync:
row = layout.row(align=True)
- row.prop(toolsettings, "mesh_selection_mode", text="", index=0, icon='VERTEXSEL')
- row.prop(toolsettings, "mesh_selection_mode", text="", index=1, icon='EDGESEL')
- row.prop(toolsettings, "mesh_selection_mode", text="", index=2, icon='FACESEL')
+ row.prop(toolsettings, "mesh_select_mode", text="", index=0, icon='VERTEXSEL')
+ row.prop(toolsettings, "mesh_select_mode", text="", index=1, icon='EDGESEL')
+ row.prop(toolsettings, "mesh_select_mode", text="", index=2, icon='FACESEL')
else:
- layout.prop(toolsettings, "uv_selection_mode", text="", expand=True)
- layout.prop(uvedit, "sticky_selection_mode", text="", icon_only=True)
+ layout.prop(toolsettings, "uv_select_mode", text="", expand=True)
+ layout.prop(uvedit, "sticky_select_mode", text="", icon_only=True)
row = layout.row(align=True)
- row.prop(toolsettings, "proportional_editing", text="", icon_only=True)
- if toolsettings.proportional_editing != 'DISABLED':
- row.prop(toolsettings, "proportional_editing_falloff", text="", icon_only=True)
+ row.prop(toolsettings, "proportional_edit", text="", icon_only=True)
+ if toolsettings.proportional_edit != 'DISABLED':
+ row.prop(toolsettings, "proportional_edit_falloff", text="", icon_only=True)
row = layout.row(align=True)
- row.prop(toolsettings, "snap", text="")
+ row.prop(toolsettings, "use_snap", text="")
row.prop(toolsettings, "snap_element", text="", icon_only=True)
# mesh = context.edit_object.data
- # row.prop_object(mesh, "active_uv_layer", mesh, "uv_textures")
+ # row.prop_search(mesh.uv_textures, "active", mesh, "uv_textures")
if ima:
# layers
layout.template_image_layers(ima, iuser)
# painting
- layout.prop(sima, "image_painting", text="")
+ layout.prop(sima, "use_image_paint", text="")
# draw options
row = layout.row(align=True)
@@ -324,8 +335,8 @@ class IMAGE_HT_header(bpy.types.Header):
if ima.type == 'COMPOSITE' and ima.source in ('MOVIE', 'SEQUENCE'):
row.operator("image.play_composite", icon='PLAY')
- if show_uvedit or sima.image_painting:
- layout.prop(sima, "update_automatically", text="", icon_only=True, icon='LOCKED')
+ if show_uvedit or sima.use_image_paint:
+ layout.prop(sima, "use_realtime_update", text="", icon_only=True, icon='LOCKED')
class IMAGE_PT_image_properties(bpy.types.Panel):
@@ -333,7 +344,8 @@ class IMAGE_PT_image_properties(bpy.types.Panel):
bl_region_type = 'UI'
bl_label = "Image"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
sima = context.space_data
return (sima.image)
@@ -352,7 +364,8 @@ class IMAGE_PT_game_properties(bpy.types.Panel):
bl_region_type = 'UI'
bl_label = "Game Properties"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
rd = context.scene.render
sima = context.space_data
return (sima and sima.image) and (rd.engine == 'BLENDER_GAME')
@@ -362,32 +375,30 @@ class IMAGE_PT_game_properties(bpy.types.Panel):
sima = context.space_data
ima = sima.image
- wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
sub = col.column(align=True)
- sub.prop(ima, "animated")
+ sub.prop(ima, "use_animation")
subsub = sub.column()
- subsub.active = ima.animated
- subsub.prop(ima, "animation_start", text="Start")
- subsub.prop(ima, "animation_end", text="End")
- subsub.prop(ima, "animation_speed", text="Speed")
+ subsub.active = ima.use_animation
+ subsub.prop(ima, "frame_start", text="Start")
+ subsub.prop(ima, "frame_end", text="End")
+ subsub.prop(ima, "fps", text="Speed")
- col.prop(ima, "tiles")
+ col.prop(ima, "use_tiles")
sub = col.column(align=True)
- sub.active = ima.tiles or ima.animated
+ sub.active = ima.tiles or ima.use_animation
sub.prop(ima, "tiles_x", text="X")
sub.prop(ima, "tiles_y", text="Y")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Clamp:")
- col.prop(ima, "clamp_x", text="X")
- col.prop(ima, "clamp_y", text="Y")
+ col.prop(ima, "use_clamp_x", text="X")
+ col.prop(ima, "use_clamp_y", text="Y")
col.separator()
col.prop(ima, "mapping", expand=True)
@@ -397,7 +408,8 @@ class IMAGE_PT_view_histogram(bpy.types.Panel):
bl_region_type = 'PREVIEW'
bl_label = "Histogram"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
sima = context.space_data
return (sima and sima.image)
@@ -406,7 +418,46 @@ class IMAGE_PT_view_histogram(bpy.types.Panel):
sima = context.space_data
- layout.template_histogram(sima, "histogram")
+ layout.template_histogram(sima.scopes, "histogram")
+ layout.prop(sima.scopes.histogram, "mode", icon_only=True)
+
+
+class IMAGE_PT_view_waveform(bpy.types.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")
+ sub = layout.row().split(percentage=0.75)
+ sub.prop(sima.scopes, "waveform_alpha")
+ sub.prop(sima.scopes, "waveform_mode", text="", icon_only=True)
+
+
+class IMAGE_PT_view_vectorscope(bpy.types.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(bpy.types.Panel):
@@ -414,7 +465,8 @@ class IMAGE_PT_sample_line(bpy.types.Panel):
bl_region_type = 'PREVIEW'
bl_label = "Sample Line"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
sima = context.space_data
return (sima and sima.image)
@@ -423,6 +475,28 @@ class IMAGE_PT_sample_line(bpy.types.Panel):
layout.operator("image.sample_line")
sima = context.space_data
layout.template_histogram(sima, "sample_histogram")
+ layout.prop(sima.sample_histogram, "mode")
+
+
+class IMAGE_PT_scope_sample(bpy.types.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
+ split = layout.split()
+ row = split.row()
+ row.prop(sima.scopes, "use_full_resolution")
+ row = split.row()
+ row.active = not sima.scopes.use_full_resolution
+ row.prop(sima.scopes, "accuracy")
class IMAGE_PT_view_properties(bpy.types.Panel):
@@ -430,7 +504,8 @@ class IMAGE_PT_view_properties(bpy.types.Panel):
bl_region_type = 'UI'
bl_label = "Display"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
sima = context.space_data
return (sima and (sima.image or sima.show_uvedit))
@@ -441,7 +516,6 @@ class IMAGE_PT_view_properties(bpy.types.Panel):
ima = sima.image
show_uvedit = sima.show_uvedit
uvedit = sima.uv_editor
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -449,16 +523,15 @@ class IMAGE_PT_view_properties(bpy.types.Panel):
if ima:
col.prop(ima, "display_aspect", text="Aspect Ratio")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Coordinates:")
- col.prop(sima, "draw_repeated", text="Repeat")
+ col.prop(sima, "show_repeat", text="Repeat")
if show_uvedit:
- col.prop(uvedit, "normalized_coordinates", text="Normalized")
+ col.prop(uvedit, "show_normalized_coords", text="Normalized")
elif show_uvedit:
col.label(text="Coordinates:")
- col.prop(uvedit, "normalized_coordinates", text="Normalized")
+ col.prop(uvedit, "show_normalized_coords", text="Normalized")
if show_uvedit:
@@ -468,23 +541,19 @@ class IMAGE_PT_view_properties(bpy.types.Panel):
col = layout.column()
col.label(text="UVs:")
row = col.row()
- if wide_ui:
- row.prop(uvedit, "edge_draw_type", expand=True)
- else:
- row.prop(uvedit, "edge_draw_type", text="")
+ row.prop(uvedit, "edge_draw_type", expand=True)
split = layout.split()
col = split.column()
- col.prop(uvedit, "draw_smooth_edges", text="Smooth")
- col.prop(uvedit, "draw_modified_edges", text="Modified")
- #col.prop(uvedit, "draw_edges")
- #col.prop(uvedit, "draw_faces")
-
- if wide_ui:
- col = split.column()
- col.prop(uvedit, "draw_stretch", text="Stretch")
+ col.prop(uvedit, "show_smooth_edges", text="Smooth")
+ col.prop(uvedit, "show_modified_edges", text="Modified")
+ #col.prop(uvedit, "show_edges")
+ #col.prop(uvedit, "show_faces")
+
+ col = split.column()
+ col.prop(uvedit, "show_stretch", text="Stretch")
sub = col.column()
- sub.active = uvedit.draw_stretch
+ sub.active = uvedit.show_stretch
sub.row().prop(uvedit, "draw_stretch_type", expand=True)
@@ -493,7 +562,8 @@ class IMAGE_PT_paint(bpy.types.Panel):
bl_region_type = 'UI'
bl_label = "Paint"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
sima = context.space_data
return sima.show_paint
@@ -502,22 +572,10 @@ class IMAGE_PT_paint(bpy.types.Panel):
toolsettings = context.tool_settings.image_paint
brush = toolsettings.brush
- wide_ui = context.region.width > narrowui
col = layout.split().column()
row = col.row()
- row.template_list(toolsettings, "brushes", toolsettings, "active_brush_index", rows=2)
-
- col.template_ID(toolsettings, "brush", new="brush.add")
-
- if wide_ui:
- sub = layout.row(align=True)
- else:
- sub = layout.column(align=True)
- sub.prop_enum(brush, "imagepaint_tool", 'DRAW')
- sub.prop_enum(brush, "imagepaint_tool", 'SOFTEN')
- sub.prop_enum(brush, "imagepaint_tool", 'CLONE')
- sub.prop_enum(brush, "imagepaint_tool", 'SMEAR')
+ col.template_ID_preview(toolsettings, "brush", new="brush.add", rows=3, cols=8)
if brush:
col = layout.column()
@@ -526,15 +584,15 @@ class IMAGE_PT_paint(bpy.types.Panel):
row = col.row(align=True)
row.prop(brush, "size", slider=True)
- row.prop(brush, "use_size_pressure", toggle=True, text="")
+ row.prop(brush, "use_pressure_size", toggle=True, text="")
row = col.row(align=True)
row.prop(brush, "strength", slider=True)
- row.prop(brush, "use_strength_pressure", toggle=True, text="")
+ row.prop(brush, "use_pressure_strength", toggle=True, text="")
row = col.row(align=True)
row.prop(brush, "jitter", slider=True)
- row.prop(brush, "use_jitter_pressure", toggle=True, text="")
+ row.prop(brush, "use_pressure_jitter", toggle=True, text="")
col.prop(brush, "blend", text="Blend")
@@ -544,16 +602,26 @@ class IMAGE_PT_paint(bpy.types.Panel):
col.prop(brush, "clone_alpha", text="Alpha")
-class IMAGE_PT_paint_stroke(bpy.types.Panel):
- bl_space_type = 'IMAGE_EDITOR'
- bl_region_type = 'UI'
- bl_label = "Paint Stroke"
- bl_default_closed = True
+class IMAGE_PT_tools_brush_texture(BrushButtonsPanel, bpy.types.Panel):
+ bl_label = "Texture"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ def draw(self, context):
+ layout = self.layout
- def poll(self, context):
- sima = context.space_data
toolsettings = context.tool_settings.image_paint
- return sima.show_paint and toolsettings.brush
+ brush = toolsettings.brush
+
+# tex_slot = brush.texture_slot
+
+ col = layout.column()
+
+ col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8)
+
+
+class IMAGE_PT_paint_stroke(BrushButtonsPanel, bpy.types.Panel):
+ bl_label = "Paint Stroke"
+ bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
layout = self.layout
@@ -570,21 +638,14 @@ class IMAGE_PT_paint_stroke(bpy.types.Panel):
row = layout.row(align=True)
row.active = brush.use_space
row.prop(brush, "spacing", text="Distance", slider=True)
- row.prop(brush, "use_spacing_pressure", toggle=True, text="")
+ row.prop(brush, "use_pressure_spacing", toggle=True, text="")
layout.prop(brush, "use_wrap")
-class IMAGE_PT_paint_curve(bpy.types.Panel):
- bl_space_type = 'IMAGE_EDITOR'
- bl_region_type = 'UI'
+class IMAGE_PT_paint_curve(BrushButtonsPanel, bpy.types.Panel):
bl_label = "Paint Curve"
- bl_default_closed = True
-
- def poll(self, context):
- sima = context.space_data
- toolsettings = context.tool_settings.image_paint
- return sima.show_paint and toolsettings.brush
+ bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
layout = self.layout
@@ -593,40 +654,21 @@ class IMAGE_PT_paint_curve(bpy.types.Panel):
brush = toolsettings.brush
layout.template_curve_mapping(brush, "curve")
- layout.operator_menu_enum("brush.curve_preset", "shape")
-
-
-classes = [
- IMAGE_MT_view,
- IMAGE_MT_select,
- IMAGE_MT_image,
- IMAGE_MT_uvs_showhide,
- IMAGE_MT_uvs_transform,
- IMAGE_MT_uvs_snap,
- IMAGE_MT_uvs_mirror,
- IMAGE_MT_uvs_weldalign,
- IMAGE_MT_uvs,
- IMAGE_HT_header,
- IMAGE_PT_image_properties,
- IMAGE_PT_paint,
- IMAGE_PT_paint_stroke,
- IMAGE_PT_paint_curve,
- IMAGE_PT_game_properties,
- IMAGE_PT_view_properties,
- IMAGE_PT_view_histogram,
- IMAGE_PT_sample_line]
+ row = layout.row(align=True)
+ row.operator("brush.curve_preset", icon="SMOOTHCURVE", text="").shape = 'SMOOTH'
+ row.operator("brush.curve_preset", icon="SPHERECURVE", text="").shape = 'ROUND'
+ 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="LINCURVE", text="").shape = 'LINE'
+ row.operator("brush.curve_preset", icon="NOCURVE", text="").shape = 'MAX'
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()