def on_add(self,widget,copy=False):
"""
Add new layer to the image and a new frame to the Timeline.
if copy is true them the current layer will be copy.
"""
# starting gimp undo group
self.image.undo_group_start()
name = "Frame " + str(len(self.frames))
# create the layer to add
l = None
if not copy:
l = gimp.Layer(self.image,name, self.image.width,self.image.height,RGBA_IMAGE,100,NORMAL_MODE)
else: # copy current layer to add
l = self.frames[self.active].layer.copy()
l.name = name
# adding layer
self.image.add_layer(l,self.active+1)
if self.new_layer_type == TRANSPARENT_FILL and not copy:
pdb.gimp_edit_clear(l)
self._scan_image_layers()
self.on_goto(None,NEXT,True)
if len(self.frames) == 1 :
self._toggle_enable_buttons(NO_FRAMES)
# ending gimp undo group
self.image.undo_group_end()
评论列表
文章目录