4 class IMAGE_MT_view(bpy.types.Menu):
5 __space_type__ = 'IMAGE_EDITOR'
8 def draw(self, context):
11 sima = context.space_data
13 settings = context.tool_settings
15 show_uvedit = sima.show_uvedit
17 layout.itemO("image.properties", icon='ICON_MENU_PANEL')
21 layout.itemR(sima, "update_automatically")
23 layout.itemR(settings, "uv_local_view") # Numpad /
27 layout.itemO("image.view_zoom_in")
28 layout.itemO("image.view_zoom_out")
32 ratios = [[1, 8], [1, 4], [1, 2], [1, 1], [2, 1], [4, 1], [8, 1]];
35 text = "Zoom %d:%d" % (a, b)
36 layout.item_floatO("image.view_zoom_ratio", "ratio", a/float(b), text=text)
41 layout.itemO("image.view_selected")
43 layout.itemO("image.view_all")
44 layout.itemO("screen.screen_full_area")
46 class IMAGE_MT_select(bpy.types.Menu):
47 __space_type__ = 'IMAGE_EDITOR'
50 def draw(self, context):
53 layout.itemO("uv.select_border")
54 layout.item_booleanO("uv.select_border", "pinned", True)
58 layout.itemO("uv.select_all_toggle")
59 layout.itemO("uv.select_inverse")
60 layout.itemO("uv.unlink_selection")
64 layout.itemO("uv.select_pinned")
65 layout.itemO("uv.select_linked")
67 class IMAGE_MT_image(bpy.types.Menu):
68 __space_type__ = 'IMAGE_EDITOR'
71 def draw(self, context):
74 sima = context.space_data
77 layout.itemO("image.new")
78 layout.itemO("image.open")
80 show_render = sima.show_render
84 layout.itemO("image.replace")
85 layout.itemO("image.reload")
87 layout.itemO("image.save")
88 layout.itemO("image.save_as")
90 if ima.source == 'SEQUENCE':
91 layout.itemO("image.save_sequence")
97 layout.itemO("image.unpack")
99 layout.itemO("image.pack")
101 # only for dirty && specific image types, perhaps
102 # this could be done in operator poll too
104 if ima.source in ('FILE', 'GENERATED') and ima.type != 'MULTILAYER':
105 layout.item_booleanO("image.pack", "as_png", True, text="Pack As PNG")
109 layout.itemR(sima, "image_painting")
111 class IMAGE_MT_uvs_showhide(bpy.types.Menu):
112 __space_type__ = 'IMAGE_EDITOR'
113 __label__ = "Show/Hide Faces"
115 def draw(self, context):
118 layout.itemO("uv.reveal")
119 layout.itemO("uv.hide")
120 layout.item_booleanO("uv.hide", "unselected", True)
122 class IMAGE_MT_uvs_transform(bpy.types.Menu):
123 __space_type__ = 'IMAGE_EDITOR'
124 __label__ = "Transform"
126 def draw(self, context):
129 layout.itemO("tfm.translate")
130 layout.itemO("tfm.rotate")
131 layout.itemO("tfm.resize")
133 class IMAGE_MT_uvs_mirror(bpy.types.Menu):
134 __space_type__ = 'IMAGE_EDITOR'
137 def draw(self, context):
139 layout.operator_context = "EXEC_REGION_WIN"
141 props= layout.itemO("tfm.mirror", text="X Axis", properties=True)
142 props.constraint_axis[0]= True
144 props= layout.itemO("tfm.mirror", text="Y Axis", properties=True)
145 props.constraint_axis[1]= True
147 class IMAGE_MT_uvs_weldalign(bpy.types.Menu):
148 __space_type__ = 'IMAGE_EDITOR'
149 __label__ = "Weld/Align"
151 def draw(self, context):
154 layout.itemO("uv.weld") # W, 1
155 layout.items_enumO("uv.align", "axis") # W, 2/3/4
157 class IMAGE_MT_uvs(bpy.types.Menu):
158 __space_type__ = 'IMAGE_EDITOR'
161 def draw(self, context):
164 sima = context.space_data
166 settings = context.tool_settings
168 layout.itemR(uv, "snap_to_pixels")
169 layout.itemR(uv, "constrain_to_image_bounds")
173 layout.itemR(uv, "live_unwrap")
174 layout.itemO("uv.unwrap")
175 layout.item_booleanO("uv.pin", "clear", True, text="Unpin")
176 layout.itemO("uv.pin")
180 layout.itemO("uv.pack_islands")
181 layout.itemO("uv.average_islands_scale")
182 layout.itemO("uv.minimize_stretch")
183 layout.itemO("uv.stitch")
187 layout.itemM("IMAGE_MT_uvs_transform")
188 layout.itemM("IMAGE_MT_uvs_mirror")
189 layout.itemM("IMAGE_MT_uvs_weldalign")
193 layout.itemR(settings, "proportional_editing")
194 layout.item_menu_enumR(settings, "proportional_editing_falloff")
198 layout.itemM("IMAGE_MT_uvs_showhide")
200 class IMAGE_HT_header(bpy.types.Header):
201 __space_type__ = 'IMAGE_EDITOR'
203 def draw(self, context):
206 sima = context.space_data
208 iuser = sima.image_user
209 settings = context.tool_settings
211 show_render = sima.show_render
212 show_paint = sima.show_paint
213 show_uvedit = sima.show_uvedit
215 row = layout.row(align=True)
216 row.template_header()
219 if context.area.show_menus:
220 sub = row.row(align=True)
221 sub.itemM("IMAGE_MT_view")
224 sub.itemM("IMAGE_MT_select")
226 if ima and ima.dirty:
227 sub.itemM("IMAGE_MT_image", text="Image*")
229 sub.itemM("IMAGE_MT_image", text="Image")
232 sub.itemM("IMAGE_MT_uvs")
234 layout.template_ID(sima, "image", new="image.new")
238 uvedit = sima.uv_editor
240 layout.itemR(uvedit, "pivot", text="", icon_only=True)
241 layout.itemR(settings, "uv_sync_selection", text="")
243 if settings.uv_sync_selection:
244 layout.itemR(settings, "mesh_selection_mode", text="", expand=True)
246 layout.itemR(settings, "uv_selection_mode", text="", expand=True)
247 layout.itemR(uvedit, "sticky_selection_mode", text="", icon_only=True)
250 row = layout.row(align=True)
251 row.itemR(settings, "snap", text="")
253 row.itemR(settings, "snap_mode", text="")
256 mesh = context.edit_object.data
257 row.item_pointerR(mesh, "active_uv_layer", mesh, "uv_textures")
262 layout.template_image_layers(ima, iuser)
265 layout.itemR(sima, "image_painting", text="")
268 row = layout.row(align=True)
269 row.itemR(sima, "draw_channels", text="", expand=True)
271 row = layout.row(align=True)
272 if ima.type == 'COMPOSITE':
273 row.itemO("image.record_composite", icon='ICON_REC')
274 if ima.type == 'COMPOSITE' and ima.source in ('MOVIE', 'SEQUENCE'):
275 row.itemO("image.play_composite", icon='ICON_PLAY')
277 if show_uvedit or sima.image_painting:
278 layout.itemR(sima, "update_automatically", text="")
280 class IMAGE_PT_image_properties(bpy.types.Panel):
281 __space_type__ = 'IMAGE_EDITOR'
282 __region_type__ = 'UI'
285 def poll(self, context):
286 sima = context.space_data
289 def draw(self, context):
292 sima = context.space_data
294 iuser = sima.image_user
296 layout.template_image(sima, "image", iuser, compact=True)
298 class IMAGE_PT_game_properties(bpy.types.Panel):
299 __space_type__ = 'IMAGE_EDITOR'
300 __region_type__ = 'UI'
301 __label__ = "Game Properties"
303 def poll(self, context):
304 rd = context.scene.render_data
305 sima = context.space_data
306 return (sima and sima.image) and (rd.engine == 'BLENDER_GAME')
308 def draw(self, context):
311 sima = context.space_data
314 split = layout.split()
318 sub = col.column(align=True)
319 sub.itemR(ima, "animated")
321 subsub = sub.column()
322 subsub.active = ima.animated
323 subsub.itemR(ima, "animation_start", text="Start")
324 subsub.itemR(ima, "animation_end", text="End")
325 subsub.itemR(ima, "animation_speed", text="Speed")
327 col.itemR(ima, "tiles")
328 sub = col.column(align=True)
329 sub.active = ima.tiles or ima.animated
330 sub.itemR(ima, "tiles_x", text="X")
331 sub.itemR(ima, "tiles_y", text="Y")
334 col.itemL(text="Clamp:")
335 col.itemR(ima, "clamp_x", text="X")
336 col.itemR(ima, "clamp_y", text="Y")
338 col.itemR(ima, "mapping", expand=True)
342 class IMAGE_PT_view_properties(bpy.types.Panel):
343 __space_type__ = 'IMAGE_EDITOR'
344 __region_type__ = 'UI'
345 __label__ = "Display"
347 def poll(self, context):
348 sima = context.space_data
349 return (sima and (sima.image or sima.show_uvedit))
351 def draw(self, context):
354 sima = context.space_data
356 show_uvedit = sima.show_uvedit
357 uvedit = sima.uv_editor
359 split = layout.split()
363 col.itemR(ima, "display_aspect", text="Aspect Ratio")
366 col.itemL(text="Coordinates:")
367 col.itemR(sima, "draw_repeated", text="Repeat")
369 col.itemR(uvedit, "normalized_coordinates", text="Normalized")
371 col.itemL(text="Coordinates:")
372 col.itemR(uvedit, "normalized_coordinates", text="Normalized")
376 col = layout.column()
377 col.itemL(text="UVs:")
379 row.itemR(uvedit, "edge_draw_type", expand=True)
381 split = layout.split()
384 col.itemR(uvedit, "draw_stretch", text="Stretch")
386 sub.active = uvedit.draw_stretch
387 sub.row().itemR(uvedit, "draw_stretch_type", expand=True)
390 col.itemR(uvedit, "draw_smooth_edges", text="Smooth")
391 col.itemR(uvedit, "draw_modified_edges", text="Modified")
392 #col.itemR(uvedit, "draw_edges")
393 #col.itemR(uvedit, "draw_faces")
395 class IMAGE_PT_paint(bpy.types.Panel):
396 __space_type__ = 'IMAGE_EDITOR'
397 __region_type__ = 'UI'
400 def poll(self, context):
401 sima = context.space_data
402 return sima.show_paint
404 def draw(self, context):
407 settings = context.tool_settings.image_paint
408 brush = settings.brush
410 col = layout.split().column()
412 row.template_list(settings, "brushes", settings, "active_brush_index", rows=2)
414 col.template_ID(settings, "brush", new="brush.add")
416 row = layout.row(align=True)
417 row.item_enumR(settings, "tool", 'DRAW')
418 row.item_enumR(settings, "tool", 'SOFTEN')
419 row.item_enumR(settings, "tool", 'CLONE')
420 row.item_enumR(settings, "tool", 'SMEAR')
423 col = layout.column()
424 col.itemR(brush, "color", text="")
426 row = col.row(align=True)
427 row.itemR(brush, "size", slider=True)
428 row.itemR(brush, "use_size_pressure", toggle=True, text="")
430 row = col.row(align=True)
431 row.itemR(brush, "strength", slider=True)
432 row.itemR(brush, "use_strength_pressure", toggle=True, text="")
434 row = col.row(align=True)
435 row.itemR(brush, "jitter", slider=True)
436 row.itemR(brush, "use_jitter_pressure", toggle=True, text="")
438 col.itemR(brush, "blend", text="Blend")
440 class IMAGE_PT_paint_stroke(bpy.types.Panel):
441 __space_type__ = 'IMAGE_EDITOR'
442 __region_type__ = 'UI'
443 __label__ = "Paint Stroke"
444 __default_closed__ = True
446 def poll(self, context):
447 sima = context.space_data
448 settings = context.tool_settings.image_paint
449 return sima.show_paint and settings.brush
451 def draw(self, context):
454 settings = context.tool_settings.image_paint
455 brush = settings.brush
457 layout.itemR(brush, "use_airbrush")
458 col = layout.column()
459 col.active = brush.use_airbrush
460 col.itemR(brush, "rate", slider=True)
462 layout.itemR(brush, "use_space")
463 row = layout.row(align=True)
464 row.active = brush.use_space
465 row.itemR(brush, "spacing", text="Distance", slider=True)
466 row.itemR(brush, "use_spacing_pressure", toggle=True, text="")
468 class IMAGE_PT_paint_curve(bpy.types.Panel):
469 __space_type__ = 'IMAGE_EDITOR'
470 __region_type__ = 'UI'
471 __label__ = "Paint Curve"
472 __default_closed__ = True
474 def poll(self, context):
475 sima = context.space_data
476 settings = context.tool_settings.image_paint
477 return sima.show_paint and settings.brush
479 def draw(self, context):
482 settings = context.tool_settings.image_paint
483 brush = settings.brush
485 layout.template_curve_mapping(brush, "curve")
486 layout.item_menu_enumO("brush.curve_preset", property="shape")
488 bpy.types.register(IMAGE_MT_view)
489 bpy.types.register(IMAGE_MT_select)
490 bpy.types.register(IMAGE_MT_image)
491 bpy.types.register(IMAGE_MT_uvs_showhide)
492 bpy.types.register(IMAGE_MT_uvs_transform)
493 bpy.types.register(IMAGE_MT_uvs_mirror)
494 bpy.types.register(IMAGE_MT_uvs_weldalign)
495 bpy.types.register(IMAGE_MT_uvs)
496 bpy.types.register(IMAGE_HT_header)
497 bpy.types.register(IMAGE_PT_image_properties)
498 bpy.types.register(IMAGE_PT_paint)
499 bpy.types.register(IMAGE_PT_paint_stroke)
500 bpy.types.register(IMAGE_PT_paint_curve)
501 bpy.types.register(IMAGE_PT_game_properties)
502 bpy.types.register(IMAGE_PT_view_properties)