2009-11-01 15:21:20 +00:00
|
|
|
# ##### BEGIN GPL LICENSE BLOCK #####
|
|
|
|
#
|
|
|
|
# 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 the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
2009-11-03 07:23:02 +00:00
|
|
|
#
|
2009-11-01 15:21:20 +00:00
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
2009-11-03 07:23:02 +00:00
|
|
|
#
|
2009-11-01 15:21:20 +00:00
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software Foundation,
|
|
|
|
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
#
|
|
|
|
# ##### END GPL LICENSE BLOCK #####
|
2009-10-31 20:16:59 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
# <pep8 compliant>
|
2009-06-16 01:22:56 +00:00
|
|
|
import bpy
|
|
|
|
|
2009-11-17 18:53:53 +00:00
|
|
|
narrowui = 180
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2009-11-21 00:05:43 +00:00
|
|
|
|
2009-06-16 01:22:56 +00:00
|
|
|
class IMAGE_MT_view(bpy.types.Menu):
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_label = "View"
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
sima = context.space_data
|
2009-11-14 13:35:44 +00:00
|
|
|
# uv = sima.uv_editor
|
2009-10-31 19:31:45 +00:00
|
|
|
settings = context.tool_settings
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
show_uvedit = sima.show_uvedit
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-12-10 10:23:53 +00:00
|
|
|
layout.operator("image.properties", icon='MENU_PANEL')
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.separator()
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.prop(sima, "update_automatically")
|
2009-10-31 19:31:45 +00:00
|
|
|
if show_uvedit:
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.prop(settings, "uv_local_view") # Numpad /
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.separator()
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.operator("image.view_zoom_in")
|
|
|
|
layout.operator("image.view_zoom_out")
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.separator()
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
ratios = [[1, 8], [1, 4], [1, 2], [1, 1], [2, 1], [4, 1], [8, 1]]
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
for a, b in ratios:
|
|
|
|
text = "Zoom %d:%d" % (a, b)
|
2009-11-23 11:43:38 +00:00
|
|
|
layout.operator("image.view_zoom_ratio", text=text).ratio = a / b
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.separator()
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
if show_uvedit:
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.operator("image.view_selected")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.operator("image.view_all")
|
2009-12-04 17:54:48 +00:00
|
|
|
|
2009-12-03 16:28:50 +00:00
|
|
|
layout.separator()
|
2009-12-04 17:54:48 +00:00
|
|
|
|
2009-12-03 16:28:50 +00:00
|
|
|
layout.operator("screen.area_dupli")
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.operator("screen.screen_full_area")
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2009-06-16 01:22:56 +00:00
|
|
|
class IMAGE_MT_select(bpy.types.Menu):
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_label = "Select"
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.operator("uv.select_border")
|
2009-11-23 11:43:38 +00:00
|
|
|
layout.operator("uv.select_border").pinned = True
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.separator()
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-11-29 22:16:29 +00:00
|
|
|
layout.operator("uv.select_all")
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.operator("uv.select_inverse")
|
|
|
|
layout.operator("uv.unlink_selection")
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.separator()
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.operator("uv.select_pinned")
|
|
|
|
layout.operator("uv.select_linked")
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2009-06-16 01:22:56 +00:00
|
|
|
class IMAGE_MT_image(bpy.types.Menu):
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_label = "Image"
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2009-09-01 00:33:39 +00:00
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
sima = context.space_data
|
|
|
|
ima = sima.image
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.operator("image.new")
|
|
|
|
layout.operator("image.open")
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
show_render = sima.show_render
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
if ima:
|
|
|
|
if not show_render:
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.operator("image.replace")
|
|
|
|
layout.operator("image.reload")
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.operator("image.save")
|
|
|
|
layout.operator("image.save_as")
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
if ima.source == 'SEQUENCE':
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.operator("image.save_sequence")
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
if not show_render:
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.separator()
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
if ima.packed_file:
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.operator("image.unpack")
|
2009-10-31 19:31:45 +00:00
|
|
|
else:
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.operator("image.pack")
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
# only for dirty && specific image types, perhaps
|
|
|
|
# this could be done in operator poll too
|
|
|
|
if ima.dirty:
|
|
|
|
if ima.source in ('FILE', 'GENERATED') and ima.type != 'MULTILAYER':
|
2009-11-23 11:43:38 +00:00
|
|
|
layout.operator("image.pack", text="Pack As PNG").as_png = True
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.separator()
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.prop(sima, "image_painting")
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2009-06-16 01:22:56 +00:00
|
|
|
class IMAGE_MT_uvs_showhide(bpy.types.Menu):
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_label = "Show/Hide Faces"
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.operator("uv.reveal")
|
|
|
|
layout.operator("uv.hide")
|
2009-11-23 11:43:38 +00:00
|
|
|
layout.operator("uv.hide").unselected = True
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2009-06-16 01:22:56 +00:00
|
|
|
class IMAGE_MT_uvs_transform(bpy.types.Menu):
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_label = "Transform"
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-12-10 10:36:32 +00:00
|
|
|
layout.operator("transform.translate")
|
|
|
|
layout.operator("transform.rotate")
|
|
|
|
layout.operator("transform.resize")
|
2009-11-28 23:37:56 +00:00
|
|
|
|
|
|
|
|
2009-11-26 23:20:31 +00:00
|
|
|
class IMAGE_MT_uvs_snap(bpy.types.Menu):
|
|
|
|
bl_label = "Snap"
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-11-28 23:37:56 +00:00
|
|
|
def draw(self, context):
|
2009-11-26 23:20:31 +00:00
|
|
|
layout = self.layout
|
|
|
|
layout.operator_context = 'EXEC_REGION_WIN'
|
2009-11-28 23:37:56 +00:00
|
|
|
|
2009-11-26 23:20:31 +00:00
|
|
|
layout.operator("uv.snap_selection", text="Selected to Pixels").target = 'PIXELS'
|
|
|
|
layout.operator("uv.snap_selection", text="Selected to Cursor").target = 'CURSOR'
|
|
|
|
layout.operator("uv.snap_selection", text="Selected to Adjacent Unselected").target = 'ADJACENT_UNSELECTED'
|
|
|
|
|
|
|
|
layout.separator()
|
|
|
|
|
|
|
|
layout.operator("uv.snap_cursor", text="Cursor to Pixels").target = 'PIXELS'
|
|
|
|
layout.operator("uv.snap_cursor", text="Cursor to Selection").target = 'SELECTION'
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2009-11-28 23:37:56 +00:00
|
|
|
|
2009-06-16 01:22:56 +00:00
|
|
|
class IMAGE_MT_uvs_mirror(bpy.types.Menu):
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_label = "Mirror"
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2009-11-16 13:59:27 +00:00
|
|
|
layout.operator_context = 'EXEC_REGION_WIN'
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-12-10 10:36:32 +00:00
|
|
|
layout.operator("transform.mirror", text="X Axis").constraint_axis[0] = True
|
|
|
|
layout.operator("transform.mirror", text="Y Axis").constraint_axis[1] = True
|
2009-09-10 14:20:21 +00:00
|
|
|
|
2009-06-16 01:22:56 +00:00
|
|
|
|
|
|
|
class IMAGE_MT_uvs_weldalign(bpy.types.Menu):
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_label = "Weld/Align"
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.operator("uv.weld") # W, 1
|
|
|
|
layout.operator_enums("uv.align", "axis") # W, 2/3/4
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2009-06-16 01:22:56 +00:00
|
|
|
class IMAGE_MT_uvs(bpy.types.Menu):
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_label = "UVs"
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
sima = context.space_data
|
|
|
|
uv = sima.uv_editor
|
|
|
|
settings = context.tool_settings
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.prop(uv, "snap_to_pixels")
|
|
|
|
layout.prop(uv, "constrain_to_image_bounds")
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.separator()
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.prop(uv, "live_unwrap")
|
|
|
|
layout.operator("uv.unwrap")
|
2009-11-23 11:43:38 +00:00
|
|
|
layout.operator("uv.pin", text="Unpin").clear = True
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.operator("uv.pin")
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.separator()
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.operator("uv.pack_islands")
|
|
|
|
layout.operator("uv.average_islands_scale")
|
|
|
|
layout.operator("uv.minimize_stretch")
|
|
|
|
layout.operator("uv.stitch")
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.separator()
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.menu("IMAGE_MT_uvs_transform")
|
|
|
|
layout.menu("IMAGE_MT_uvs_mirror")
|
2009-11-26 23:20:31 +00:00
|
|
|
layout.menu("IMAGE_MT_uvs_snap")
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.menu("IMAGE_MT_uvs_weldalign")
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.separator()
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.prop_menu_enum(settings, "proportional_editing")
|
|
|
|
layout.prop_menu_enum(settings, "proportional_editing_falloff")
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.separator()
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.menu("IMAGE_MT_uvs_showhide")
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2009-06-16 01:22:56 +00:00
|
|
|
class IMAGE_HT_header(bpy.types.Header):
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_space_type = 'IMAGE_EDITOR'
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
sima = context.space_data
|
|
|
|
ima = sima.image
|
|
|
|
iuser = sima.image_user
|
|
|
|
settings = context.tool_settings
|
|
|
|
|
2009-11-14 13:35:44 +00:00
|
|
|
# show_render = sima.show_render
|
|
|
|
# show_paint = sima.show_paint
|
2009-10-31 19:31:45 +00:00
|
|
|
show_uvedit = sima.show_uvedit
|
|
|
|
|
|
|
|
row = layout.row(align=True)
|
|
|
|
row.template_header()
|
|
|
|
|
|
|
|
# menus
|
|
|
|
if context.area.show_menus:
|
|
|
|
sub = row.row(align=True)
|
2009-11-23 00:27:30 +00:00
|
|
|
sub.menu("IMAGE_MT_view")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
if show_uvedit:
|
2009-11-23 00:27:30 +00:00
|
|
|
sub.menu("IMAGE_MT_select")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
if ima and ima.dirty:
|
2009-11-23 00:27:30 +00:00
|
|
|
sub.menu("IMAGE_MT_image", text="Image*")
|
2009-10-31 19:31:45 +00:00
|
|
|
else:
|
2009-11-23 00:27:30 +00:00
|
|
|
sub.menu("IMAGE_MT_image", text="Image")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
if show_uvedit:
|
2009-11-23 00:27:30 +00:00
|
|
|
sub.menu("IMAGE_MT_uvs")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
layout.template_ID(sima, "image", new="image.new")
|
|
|
|
|
|
|
|
# uv editing
|
|
|
|
if show_uvedit:
|
|
|
|
uvedit = sima.uv_editor
|
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.prop(uvedit, "pivot", text="", icon_only=True)
|
|
|
|
layout.prop(settings, "uv_sync_selection", text="")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
if settings.uv_sync_selection:
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.prop(settings, "mesh_selection_mode", text="", expand=True)
|
2009-10-31 19:31:45 +00:00
|
|
|
else:
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.prop(settings, "uv_selection_mode", text="", expand=True)
|
|
|
|
layout.prop(uvedit, "sticky_selection_mode", text="", icon_only=True)
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2009-12-11 14:34:21 +00:00
|
|
|
row = layout.row(align=True)
|
|
|
|
row.prop(settings, "proportional_editing", text="", icon_only=True)
|
|
|
|
if settings.proportional_editing != 'DISABLED':
|
|
|
|
row.prop(settings, "proportional_editing_falloff", text="", icon_only=True)
|
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
row = layout.row(align=True)
|
2009-11-23 00:27:30 +00:00
|
|
|
row.prop(settings, "snap", text="")
|
2009-12-09 17:32:54 +00:00
|
|
|
row.prop(settings, "snap_element", text="", icon_only=True)
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2009-11-14 13:35:44 +00:00
|
|
|
# mesh = context.edit_object.data
|
2009-11-23 11:43:38 +00:00
|
|
|
# row.prop_object(mesh, "active_uv_layer", mesh, "uv_textures")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
if ima:
|
|
|
|
# layers
|
|
|
|
layout.template_image_layers(ima, iuser)
|
|
|
|
|
|
|
|
# painting
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.prop(sima, "image_painting", text="")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
# draw options
|
|
|
|
row = layout.row(align=True)
|
2009-11-23 00:27:30 +00:00
|
|
|
row.prop(sima, "draw_channels", text="", expand=True)
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
row = layout.row(align=True)
|
|
|
|
if ima.type == 'COMPOSITE':
|
2009-12-10 10:23:53 +00:00
|
|
|
row.operator("image.record_composite", icon='REC')
|
2009-10-31 19:31:45 +00:00
|
|
|
if ima.type == 'COMPOSITE' and ima.source in ('MOVIE', 'SEQUENCE'):
|
2009-12-10 10:23:53 +00:00
|
|
|
row.operator("image.play_composite", icon='PLAY')
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
if show_uvedit or sima.image_painting:
|
2009-12-11 01:12:22 +00:00
|
|
|
layout.prop(sima, "update_automatically", text="", icon_only=True, icon='LOCKED')
|
2009-06-16 01:22:56 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2009-09-16 19:27:08 +00:00
|
|
|
class IMAGE_PT_image_properties(bpy.types.Panel):
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_space_type = 'IMAGE_EDITOR'
|
|
|
|
bl_region_type = 'UI'
|
|
|
|
bl_label = "Image"
|
2009-09-16 19:27:08 +00:00
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
def poll(self, context):
|
|
|
|
sima = context.space_data
|
|
|
|
return (sima.image)
|
2009-09-16 19:27:08 +00:00
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2009-09-16 19:27:08 +00:00
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
sima = context.space_data
|
2009-11-14 13:35:44 +00:00
|
|
|
# ima = sima.image
|
2009-10-31 19:31:45 +00:00
|
|
|
iuser = sima.image_user
|
2009-09-16 19:27:08 +00:00
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
layout.template_image(sima, "image", iuser, compact=True)
|
2009-09-16 19:27:08 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2009-06-16 01:22:56 +00:00
|
|
|
class IMAGE_PT_game_properties(bpy.types.Panel):
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_space_type = 'IMAGE_EDITOR'
|
|
|
|
bl_region_type = 'UI'
|
|
|
|
bl_label = "Game Properties"
|
|
|
|
|
|
|
|
def poll(self, context):
|
|
|
|
rd = context.scene.render_data
|
|
|
|
sima = context.space_data
|
|
|
|
return (sima and sima.image) and (rd.engine == 'BLENDER_GAME')
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
sima = context.space_data
|
|
|
|
ima = sima.image
|
2009-11-19 13:26:51 +00:00
|
|
|
wide_ui = context.region.width > narrowui
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
|
|
|
|
|
|
|
sub = col.column(align=True)
|
2009-11-23 00:27:30 +00:00
|
|
|
sub.prop(ima, "animated")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
subsub = sub.column()
|
|
|
|
subsub.active = ima.animated
|
2009-11-23 00:27:30 +00:00
|
|
|
subsub.prop(ima, "animation_start", text="Start")
|
|
|
|
subsub.prop(ima, "animation_end", text="End")
|
|
|
|
subsub.prop(ima, "animation_speed", text="Speed")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
col.prop(ima, "tiles")
|
2009-10-31 19:31:45 +00:00
|
|
|
sub = col.column(align=True)
|
|
|
|
sub.active = ima.tiles or ima.animated
|
2009-11-23 00:27:30 +00:00
|
|
|
sub.prop(ima, "tiles_x", text="X")
|
|
|
|
sub.prop(ima, "tiles_y", text="Y")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2009-11-19 13:26:51 +00:00
|
|
|
if wide_ui:
|
2009-11-17 18:53:53 +00:00
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.label(text="Clamp:")
|
|
|
|
col.prop(ima, "clamp_x", text="X")
|
|
|
|
col.prop(ima, "clamp_y", text="Y")
|
|
|
|
col.separator()
|
|
|
|
col.prop(ima, "mapping", expand=True)
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
|
2009-06-23 00:45:41 +00:00
|
|
|
class IMAGE_PT_view_properties(bpy.types.Panel):
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_space_type = 'IMAGE_EDITOR'
|
|
|
|
bl_region_type = 'UI'
|
|
|
|
bl_label = "Display"
|
|
|
|
|
|
|
|
def poll(self, context):
|
|
|
|
sima = context.space_data
|
|
|
|
return (sima and (sima.image or sima.show_uvedit))
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
sima = context.space_data
|
|
|
|
ima = sima.image
|
|
|
|
show_uvedit = sima.show_uvedit
|
|
|
|
uvedit = sima.uv_editor
|
2009-11-19 13:26:51 +00:00
|
|
|
wide_ui = context.region.width > narrowui
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
|
|
|
if ima:
|
2009-11-23 00:27:30 +00:00
|
|
|
col.prop(ima, "display_aspect", text="Aspect Ratio")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2009-11-19 13:26:51 +00:00
|
|
|
if wide_ui:
|
2009-11-17 18:53:53 +00:00
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.label(text="Coordinates:")
|
|
|
|
col.prop(sima, "draw_repeated", text="Repeat")
|
2009-10-31 19:31:45 +00:00
|
|
|
if show_uvedit:
|
2009-11-23 00:27:30 +00:00
|
|
|
col.prop(uvedit, "normalized_coordinates", text="Normalized")
|
2009-10-31 19:31:45 +00:00
|
|
|
elif show_uvedit:
|
2009-11-23 00:27:30 +00:00
|
|
|
col.label(text="Coordinates:")
|
|
|
|
col.prop(uvedit, "normalized_coordinates", text="Normalized")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
if show_uvedit:
|
|
|
|
|
|
|
|
col = layout.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.label(text="UVs:")
|
2009-10-31 19:31:45 +00:00
|
|
|
row = col.row()
|
2009-11-19 13:26:51 +00:00
|
|
|
if wide_ui:
|
2009-11-23 00:27:30 +00:00
|
|
|
row.prop(uvedit, "edge_draw_type", expand=True)
|
2009-11-17 18:53:53 +00:00
|
|
|
else:
|
2009-11-23 00:27:30 +00:00
|
|
|
row.prop(uvedit, "edge_draw_type", text="")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
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")
|
2009-11-21 00:05:43 +00:00
|
|
|
|
2009-11-19 13:26:51 +00:00
|
|
|
if wide_ui:
|
2009-11-17 18:53:53 +00:00
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.prop(uvedit, "draw_stretch", text="Stretch")
|
2009-11-17 18:53:53 +00:00
|
|
|
sub = col.column()
|
|
|
|
sub.active = uvedit.draw_stretch
|
2009-11-23 00:27:30 +00:00
|
|
|
sub.row().prop(uvedit, "draw_stretch_type", expand=True)
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2009-11-21 00:05:43 +00:00
|
|
|
|
2009-09-16 19:27:08 +00:00
|
|
|
class IMAGE_PT_paint(bpy.types.Panel):
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_space_type = 'IMAGE_EDITOR'
|
|
|
|
bl_region_type = 'UI'
|
|
|
|
bl_label = "Paint"
|
|
|
|
|
|
|
|
def poll(self, context):
|
|
|
|
sima = context.space_data
|
|
|
|
return sima.show_paint
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
settings = context.tool_settings.image_paint
|
|
|
|
brush = settings.brush
|
2009-11-19 13:26:51 +00:00
|
|
|
wide_ui = context.region.width > narrowui
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
col = layout.split().column()
|
|
|
|
row = col.row()
|
|
|
|
row.template_list(settings, "brushes", settings, "active_brush_index", rows=2)
|
|
|
|
|
|
|
|
col.template_ID(settings, "brush", new="brush.add")
|
|
|
|
|
2009-11-19 13:26:51 +00:00
|
|
|
if wide_ui:
|
2009-11-17 18:53:53 +00:00
|
|
|
sub = layout.row(align=True)
|
|
|
|
else:
|
|
|
|
sub = layout.column(align=True)
|
2009-11-23 11:43:38 +00:00
|
|
|
sub.prop_enum(settings, "tool", 'DRAW')
|
|
|
|
sub.prop_enum(settings, "tool", 'SOFTEN')
|
|
|
|
sub.prop_enum(settings, "tool", 'CLONE')
|
|
|
|
sub.prop_enum(settings, "tool", 'SMEAR')
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
if brush:
|
|
|
|
col = layout.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.prop(brush, "color", text="")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
row = col.row(align=True)
|
2009-11-23 00:27:30 +00:00
|
|
|
row.prop(brush, "size", slider=True)
|
|
|
|
row.prop(brush, "use_size_pressure", toggle=True, text="")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
row = col.row(align=True)
|
2009-11-23 00:27:30 +00:00
|
|
|
row.prop(brush, "strength", slider=True)
|
|
|
|
row.prop(brush, "use_strength_pressure", toggle=True, text="")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
row = col.row(align=True)
|
2009-11-23 00:27:30 +00:00
|
|
|
row.prop(brush, "jitter", slider=True)
|
|
|
|
row.prop(brush, "use_jitter_pressure", toggle=True, text="")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
col.prop(brush, "blend", text="Blend")
|
2009-09-16 19:27:08 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2009-09-16 19:27:08 +00:00
|
|
|
class IMAGE_PT_paint_stroke(bpy.types.Panel):
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_space_type = 'IMAGE_EDITOR'
|
|
|
|
bl_region_type = 'UI'
|
|
|
|
bl_label = "Paint Stroke"
|
|
|
|
bl_default_closed = True
|
|
|
|
|
|
|
|
def poll(self, context):
|
|
|
|
sima = context.space_data
|
|
|
|
settings = context.tool_settings.image_paint
|
|
|
|
return sima.show_paint and settings.brush
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
settings = context.tool_settings.image_paint
|
|
|
|
brush = settings.brush
|
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.prop(brush, "use_airbrush")
|
2009-10-31 19:31:45 +00:00
|
|
|
col = layout.column()
|
|
|
|
col.active = brush.use_airbrush
|
2009-11-23 00:27:30 +00:00
|
|
|
col.prop(brush, "rate", slider=True)
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.prop(brush, "use_space")
|
2009-10-31 19:31:45 +00:00
|
|
|
row = layout.row(align=True)
|
|
|
|
row.active = brush.use_space
|
2009-11-23 00:27:30 +00:00
|
|
|
row.prop(brush, "spacing", text="Distance", slider=True)
|
|
|
|
row.prop(brush, "use_spacing_pressure", toggle=True, text="")
|
2009-09-16 19:27:08 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2009-09-16 19:27:08 +00:00
|
|
|
class IMAGE_PT_paint_curve(bpy.types.Panel):
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_space_type = 'IMAGE_EDITOR'
|
|
|
|
bl_region_type = 'UI'
|
|
|
|
bl_label = "Paint Curve"
|
|
|
|
bl_default_closed = True
|
|
|
|
|
|
|
|
def poll(self, context):
|
|
|
|
sima = context.space_data
|
|
|
|
settings = context.tool_settings.image_paint
|
|
|
|
return sima.show_paint and settings.brush
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
settings = context.tool_settings.image_paint
|
|
|
|
brush = settings.brush
|
|
|
|
|
|
|
|
layout.template_curve_mapping(brush, "curve")
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.operator_menu_enum("brush.curve_preset", property="shape")
|
2009-09-16 19:27:08 +00:00
|
|
|
|
2009-06-16 01:22:56 +00:00
|
|
|
bpy.types.register(IMAGE_MT_view)
|
|
|
|
bpy.types.register(IMAGE_MT_select)
|
|
|
|
bpy.types.register(IMAGE_MT_image)
|
|
|
|
bpy.types.register(IMAGE_MT_uvs_showhide)
|
|
|
|
bpy.types.register(IMAGE_MT_uvs_transform)
|
2009-11-26 23:20:31 +00:00
|
|
|
bpy.types.register(IMAGE_MT_uvs_snap)
|
2009-06-16 01:22:56 +00:00
|
|
|
bpy.types.register(IMAGE_MT_uvs_mirror)
|
|
|
|
bpy.types.register(IMAGE_MT_uvs_weldalign)
|
|
|
|
bpy.types.register(IMAGE_MT_uvs)
|
|
|
|
bpy.types.register(IMAGE_HT_header)
|
2009-09-16 19:27:08 +00:00
|
|
|
bpy.types.register(IMAGE_PT_image_properties)
|
|
|
|
bpy.types.register(IMAGE_PT_paint)
|
|
|
|
bpy.types.register(IMAGE_PT_paint_stroke)
|
|
|
|
bpy.types.register(IMAGE_PT_paint_curve)
|
2009-06-16 01:22:56 +00:00
|
|
|
bpy.types.register(IMAGE_PT_game_properties)
|
2009-06-23 00:45:41 +00:00
|
|
|
bpy.types.register(IMAGE_PT_view_properties)
|