4 class IMAGE_MT_view(bpy.types.Menu):
7 def draw(self, context):
10 sima = context.space_data
12 settings = context.tool_settings
14 show_uvedit = sima.show_uvedit
16 layout.itemO("image.properties", icon='ICON_MENU_PANEL')
20 layout.itemR(sima, "update_automatically")
22 layout.itemR(settings, "uv_local_view") # Numpad /
26 layout.itemO("image.view_zoom_in")
27 layout.itemO("image.view_zoom_out")
31 ratios = [[1, 8], [1, 4], [1, 2], [1, 1], [2, 1], [4, 1], [8, 1]];
34 text = "Zoom %d:%d" % (a, b)
35 layout.item_floatO("image.view_zoom_ratio", "ratio", a/float(b), text=text)
40 layout.itemO("image.view_selected")
42 layout.itemO("image.view_all")
43 layout.itemO("screen.screen_full_area")
45 class IMAGE_MT_select(bpy.types.Menu):
48 def draw(self, context):
51 layout.itemO("uv.select_border")
52 layout.item_booleanO("uv.select_border", "pinned", True)
56 layout.itemO("uv.select_all_toggle")
57 layout.itemO("uv.select_inverse")
58 layout.itemO("uv.unlink_selection")
62 layout.itemO("uv.select_pinned")
63 layout.itemO("uv.select_linked")
65 class IMAGE_MT_image(bpy.types.Menu):
68 def draw(self, context):
71 sima = context.space_data
74 layout.itemO("image.new")
75 layout.itemO("image.open")
77 show_render = sima.show_render
81 layout.itemO("image.replace")
82 layout.itemO("image.reload")
84 layout.itemO("image.save")
85 layout.itemO("image.save_as")
87 if ima.source == 'SEQUENCE':
88 layout.itemO("image.save_sequence")
94 layout.itemO("image.unpack")
96 layout.itemO("image.pack")
98 # only for dirty && specific image types, perhaps
99 # this could be done in operator poll too
101 if ima.source in ('FILE', 'GENERATED') and ima.type != 'MULTILAYER':
102 layout.item_booleanO("image.pack", "as_png", True, text="Pack As PNG")
106 layout.itemR(sima, "image_painting")
108 class IMAGE_MT_uvs_showhide(bpy.types.Menu):
109 __label__ = "Show/Hide Faces"
111 def draw(self, context):
114 layout.itemO("uv.reveal")
115 layout.itemO("uv.hide")
116 layout.item_booleanO("uv.hide", "unselected", True)
118 class IMAGE_MT_uvs_transform(bpy.types.Menu):
119 __label__ = "Transform"
121 def draw(self, context):
124 layout.itemO("tfm.translate")
125 layout.itemO("tfm.rotate")
126 layout.itemO("tfm.resize")
128 class IMAGE_MT_uvs_mirror(bpy.types.Menu):
131 def draw(self, context):
133 layout.operator_context = "EXEC_REGION_WIN"
135 props= layout.itemO("tfm.mirror", text="X Axis", properties=True)
136 props.constraint_axis[0]= True
138 props= layout.itemO("tfm.mirror", text="Y Axis", properties=True)
139 props.constraint_axis[1]= True
141 class IMAGE_MT_uvs_weldalign(bpy.types.Menu):
142 __label__ = "Weld/Align"
144 def draw(self, context):
147 layout.itemO("uv.weld") # W, 1
148 layout.items_enumO("uv.align", "axis") # W, 2/3/4
150 class IMAGE_MT_uvs(bpy.types.Menu):
153 def draw(self, context):
156 sima = context.space_data
158 settings = context.tool_settings
160 layout.itemR(uv, "snap_to_pixels")
161 layout.itemR(uv, "constrain_to_image_bounds")
165 layout.itemR(uv, "live_unwrap")
166 layout.itemO("uv.unwrap")
167 layout.item_booleanO("uv.pin", "clear", True, text="Unpin")
168 layout.itemO("uv.pin")
172 layout.itemO("uv.pack_islands")
173 layout.itemO("uv.average_islands_scale")
174 layout.itemO("uv.minimize_stretch")
175 layout.itemO("uv.stitch")
179 layout.itemM("IMAGE_MT_uvs_transform")
180 layout.itemM("IMAGE_MT_uvs_mirror")
181 layout.itemM("IMAGE_MT_uvs_weldalign")
185 layout.itemR(settings, "proportional_editing")
186 layout.item_menu_enumR(settings, "proportional_editing_falloff")
190 layout.itemM("IMAGE_MT_uvs_showhide")
192 class IMAGE_HT_header(bpy.types.Header):
193 __space_type__ = 'IMAGE_EDITOR'
195 def draw(self, context):
198 sima = context.space_data
200 iuser = sima.image_user
201 settings = context.tool_settings
203 show_render = sima.show_render
204 show_paint = sima.show_paint
205 show_uvedit = sima.show_uvedit
207 row = layout.row(align=True)
208 row.template_header()
211 if context.area.show_menus:
212 sub = row.row(align=True)
213 sub.itemM("IMAGE_MT_view")
216 sub.itemM("IMAGE_MT_select")
218 if ima and ima.dirty:
219 sub.itemM("IMAGE_MT_image", text="Image*")
221 sub.itemM("IMAGE_MT_image", text="Image")
224 sub.itemM("IMAGE_MT_uvs")
226 layout.template_ID(sima, "image", new="image.new")
230 uvedit = sima.uv_editor
232 layout.itemR(uvedit, "pivot", text="", icon_only=True)
233 layout.itemR(settings, "uv_sync_selection", text="")
235 if settings.uv_sync_selection:
236 layout.itemR(settings, "mesh_selection_mode", text="", expand=True)
238 layout.itemR(settings, "uv_selection_mode", text="", expand=True)
239 layout.itemR(uvedit, "sticky_selection_mode", text="", icon_only=True)
242 row = layout.row(align=True)
243 row.itemR(settings, "snap", text="")
245 row.itemR(settings, "snap_mode", text="")
248 mesh = context.edit_object.data
249 row.item_pointerR(mesh, "active_uv_layer", mesh, "uv_textures")
254 layout.template_image_layers(ima, iuser)
257 layout.itemR(sima, "image_painting", text="")
260 row = layout.row(align=True)
261 row.itemR(sima, "draw_channels", text="", expand=True)
263 row = layout.row(align=True)
264 if ima.type == 'COMPOSITE':
265 row.itemO("image.record_composite", icon='ICON_REC')
266 if ima.type == 'COMPOSITE' and ima.source in ('MOVIE', 'SEQUENCE'):
267 row.itemO("image.play_composite", icon='ICON_PLAY')
269 if show_uvedit or sima.image_painting:
270 layout.itemR(sima, "update_automatically", text="")
272 class IMAGE_PT_image_properties(bpy.types.Panel):
273 __space_type__ = 'IMAGE_EDITOR'
274 __region_type__ = 'UI'
277 def poll(self, context):
278 sima = context.space_data
281 def draw(self, context):
284 sima = context.space_data
286 iuser = sima.image_user
288 layout.template_image(sima, "image", iuser, compact=True)
290 class IMAGE_PT_game_properties(bpy.types.Panel):
291 __space_type__ = 'IMAGE_EDITOR'
292 __region_type__ = 'UI'
293 __label__ = "Game Properties"
295 def poll(self, context):
296 rd = context.scene.render_data
297 sima = context.space_data
298 return (sima and sima.image) and (rd.engine == 'BLENDER_GAME')
300 def draw(self, context):
303 sima = context.space_data
306 split = layout.split()
310 sub = col.column(align=True)
311 sub.itemR(ima, "animated")
313 subsub = sub.column()
314 subsub.active = ima.animated
315 subsub.itemR(ima, "animation_start", text="Start")
316 subsub.itemR(ima, "animation_end", text="End")
317 subsub.itemR(ima, "animation_speed", text="Speed")
319 col.itemR(ima, "tiles")
320 sub = col.column(align=True)
321 sub.active = ima.tiles or ima.animated
322 sub.itemR(ima, "tiles_x", text="X")
323 sub.itemR(ima, "tiles_y", text="Y")
326 col.itemL(text="Clamp:")
327 col.itemR(ima, "clamp_x", text="X")
328 col.itemR(ima, "clamp_y", text="Y")
330 col.itemR(ima, "mapping", expand=True)
334 class IMAGE_PT_view_properties(bpy.types.Panel):
335 __space_type__ = 'IMAGE_EDITOR'
336 __region_type__ = 'UI'
337 __label__ = "Display"
339 def poll(self, context):
340 sima = context.space_data
341 return (sima and (sima.image or sima.show_uvedit))
343 def draw(self, context):
346 sima = context.space_data
348 show_uvedit = sima.show_uvedit
349 uvedit = sima.uv_editor
351 split = layout.split()
355 col.itemR(ima, "display_aspect", text="Aspect Ratio")
358 col.itemL(text="Coordinates:")
359 col.itemR(sima, "draw_repeated", text="Repeat")
361 col.itemR(uvedit, "normalized_coordinates", text="Normalized")
363 col.itemL(text="Coordinates:")
364 col.itemR(uvedit, "normalized_coordinates", text="Normalized")
368 col = layout.column()
369 col.itemL(text="UVs:")
371 row.itemR(uvedit, "edge_draw_type", expand=True)
373 split = layout.split()
376 col.itemR(uvedit, "draw_stretch", text="Stretch")
378 sub.active = uvedit.draw_stretch
379 sub.row().itemR(uvedit, "draw_stretch_type", expand=True)
382 col.itemR(uvedit, "draw_smooth_edges", text="Smooth")
383 col.itemR(uvedit, "draw_modified_edges", text="Modified")
384 #col.itemR(uvedit, "draw_edges")
385 #col.itemR(uvedit, "draw_faces")
387 class IMAGE_PT_paint(bpy.types.Panel):
388 __space_type__ = 'IMAGE_EDITOR'
389 __region_type__ = 'UI'
392 def poll(self, context):
393 sima = context.space_data
394 return sima.show_paint
396 def draw(self, context):
399 settings = context.tool_settings.image_paint
400 brush = settings.brush
402 col = layout.split().column()
404 row.template_list(settings, "brushes", settings, "active_brush_index", rows=2)
406 col.template_ID(settings, "brush", new="brush.add")
408 row = layout.row(align=True)
409 row.item_enumR(settings, "tool", 'DRAW')
410 row.item_enumR(settings, "tool", 'SOFTEN')
411 row.item_enumR(settings, "tool", 'CLONE')
412 row.item_enumR(settings, "tool", 'SMEAR')
415 col = layout.column()
416 col.itemR(brush, "color", text="")
418 row = col.row(align=True)
419 row.itemR(brush, "size", slider=True)
420 row.itemR(brush, "use_size_pressure", toggle=True, text="")
422 row = col.row(align=True)
423 row.itemR(brush, "strength", slider=True)
424 row.itemR(brush, "use_strength_pressure", toggle=True, text="")
426 row = col.row(align=True)
427 row.itemR(brush, "jitter", slider=True)
428 row.itemR(brush, "use_jitter_pressure", toggle=True, text="")
430 col.itemR(brush, "blend", text="Blend")
432 class IMAGE_PT_paint_stroke(bpy.types.Panel):
433 __space_type__ = 'IMAGE_EDITOR'
434 __region_type__ = 'UI'
435 __label__ = "Paint Stroke"
436 __default_closed__ = True
438 def poll(self, context):
439 sima = context.space_data
440 settings = context.tool_settings.image_paint
441 return sima.show_paint and settings.brush
443 def draw(self, context):
446 settings = context.tool_settings.image_paint
447 brush = settings.brush
449 layout.itemR(brush, "use_airbrush")
450 col = layout.column()
451 col.active = brush.use_airbrush
452 col.itemR(brush, "rate", slider=True)
454 layout.itemR(brush, "use_space")
455 row = layout.row(align=True)
456 row.active = brush.use_space
457 row.itemR(brush, "spacing", text="Distance", slider=True)
458 row.itemR(brush, "use_spacing_pressure", toggle=True, text="")
460 class IMAGE_PT_paint_curve(bpy.types.Panel):
461 __space_type__ = 'IMAGE_EDITOR'
462 __region_type__ = 'UI'
463 __label__ = "Paint Curve"
464 __default_closed__ = True
466 def poll(self, context):
467 sima = context.space_data
468 settings = context.tool_settings.image_paint
469 return sima.show_paint and settings.brush
471 def draw(self, context):
474 settings = context.tool_settings.image_paint
475 brush = settings.brush
477 layout.template_curve_mapping(brush, "curve")
478 layout.item_menu_enumO("brush.curve_preset", property="shape")
480 bpy.types.register(IMAGE_MT_view)
481 bpy.types.register(IMAGE_MT_select)
482 bpy.types.register(IMAGE_MT_image)
483 bpy.types.register(IMAGE_MT_uvs_showhide)
484 bpy.types.register(IMAGE_MT_uvs_transform)
485 bpy.types.register(IMAGE_MT_uvs_mirror)
486 bpy.types.register(IMAGE_MT_uvs_weldalign)
487 bpy.types.register(IMAGE_MT_uvs)
488 bpy.types.register(IMAGE_HT_header)
489 bpy.types.register(IMAGE_PT_image_properties)
490 bpy.types.register(IMAGE_PT_paint)
491 bpy.types.register(IMAGE_PT_paint_stroke)
492 bpy.types.register(IMAGE_PT_paint_curve)
493 bpy.types.register(IMAGE_PT_game_properties)
494 bpy.types.register(IMAGE_PT_view_properties)