Hi, Nice work on your game.
Did you know there is a branch for animation by Charbel Jacquin, it has not been changed since more than one year, and so, use old version of mypaint, but at least it works really fine.
There is not the abitity to duplicate frame in this branch, it could be interesting to integrate your patch and this branch together, and perhaps update them with new évolutions of mypaint?
I made two posts on my blog about this (using a local copy of author, Charbel Jacquin videos, for usage demo) and explaining how to get the branch, compile and install it on unix like systems:
http://popolon.org/gblog2/mypaint-animation and after its first and last update: http://popolon.org/gblog2/mypaint-animation-2 regards, Popolon Le 10/09/2011 12:16, ferry jeremie a écrit :
Hi everone, I'm new on this mailing-list and i propose a little patch for my entry... First, i was a simple user of this incredible software and a python webdevelopper. For my spare time, i participate to a free game who name's Plee the Bear : http://plee-the-bear.sourceforge.net When i do animation, i must duplicate a lot of time the same layer. For that, i found the trick : ctr c + add layer + ctr v A more productive solution would be to add a "duplicate layer button" like Gimp (i copy the picture rightly and use it in pixbuf). My patch do this. It's probably perfectible (no shortcut and lack i18n), no pretension but it works. pleased reading your feedback. cordially, Jérémie Ferry From 7c75366acbe9cb8c1a463155fd7b747f51f59bea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferry=20J=C3=A9r=C3=A9mie?= <[email protected]> Date: Sat, 09 Sep 2011 14:53:14 +0200 Subject: [PATCH] mypaint with duplicate layer button --- gui/drawwindow.py | 1 + gui/layerswindow.py | 23 +++++++++++++++++++++++ lib/command.py | 16 ++++++++++++++++ lib/document.py | 3 +++ pixmaps/layer_duplicate.png | Bin 0 -> 482 bytes 5 files changed, 43 insertions(+), 0 deletions(-) create mode 100644 pixmaps/layer_duplicate.png diff --git a/gui/drawwindow.py b/gui/drawwindow.py index 113d832..5b43484 100644 --- a/gui/drawwindow.py +++ b/gui/drawwindow.py @@ -912,6 +912,7 @@ class Window (windowing.MainWindow, layout.MainWindow): u'David Grundberg (%s)' % _('programming'), u"Krzysztof Pasek (%s)" % _('programming'), u"Ben O'Steen (%s)" % _('programming'), + u"Ferry Jérémie (%s)" % _('programming'), ]) d.set_artists([ u"Artis Rozentāls (%s)" % _('brushes'), diff --git a/gui/layerswindow.py b/gui/layerswindow.py index 6494666..2ac242a 100644 --- a/gui/layerswindow.py +++ b/gui/layerswindow.py @@ -68,12 +68,23 @@ class ToolWidget (gtk.VBox): add_button = self.add_button = stock_button(gtk.STOCK_ADD) move_up_button = self.move_up_button = stock_button(gtk.STOCK_GO_UP) move_down_button = self.move_down_button = stock_button(gtk.STOCK_GO_DOWN) + + b = gtk.Button() + img = gtk.Image() + img.set_from_pixbuf(self.app.pixmaps.layer_duplicate) + b.add(img) + tooltip = gtk.Tooltips() + tooltip.set_tip(b, "Duplicate this layer") + duplicate_button = self.duplicate_button = b + + merge_down_button = self.merge_down_button = stock_button(gtk.STOCK_DND_MULTIPLE) # XXX need a better one del_button = self.del_button = stock_button(gtk.STOCK_DELETE) add_button.connect('clicked', self.on_layer_add) move_up_button.connect('clicked', self.move_layer, 'up') move_down_button.connect('clicked', self.move_layer, 'down') + duplicate_button.connect('clicked', self.duplicate_layer) merge_down_button.connect('clicked', self.merge_layer_down) del_button.connect('clicked', self.on_layer_del) @@ -83,6 +94,7 @@ class ToolWidget (gtk.VBox): buttons_hbox.pack_start(add_button) buttons_hbox.pack_start(move_up_button) buttons_hbox.pack_start(move_down_button) + buttons_hbox.pack_start(duplicate_button) buttons_hbox.pack_start(merge_down_button) buttons_hbox.pack_start(del_button) @@ -229,6 +241,17 @@ class ToolWidget (gtk.VBox): if new_layer_pos < len(doc.layers) and new_layer_pos >= 0: doc.move_layer(current_layer_pos, new_layer_pos, select_new=True) + def duplicate_layer(self, widget): + doc = self.app.doc.model + layer = doc.layers[doc.layer_idx] + name = layer.name + if name: + name = "copy of %s" % name + else: + layer_num = self.anon_layer_num.get(id(layer), None) + name = 'copy of %s' % _("Untitled layer #%d" % layer_num) + print name + doc.duplicate_layer(doc.layer_idx, name) def merge_layer_down(self, widget): self.app.doc.model.merge_layer_down() diff --git a/lib/command.py b/lib/command.py index 6cefde6..f22d700 100644 --- a/lib/command.py +++ b/lib/command.py @@ -229,6 +229,22 @@ class MoveLayer(Action): self._notify_canvas_observers([moved_layer]) self._notify_document_observers() +class DuplicateLayer(Action): + def __init__(self, doc, insert_idx=None, name=''): + self.doc = doc + self.insert_idx = insert_idx + snapshot = self.doc.layers[self.insert_idx].save_snapshot() + self.new_layer = layer.Layer(name) + self.new_layer.load_snapshot(snapshot) + self.new_layer.surface.observers.append(self.doc.layer_modified_cb) + def redo(self): + self.doc.layers.insert(self.insert_idx+1, self.new_layer) + self._notify_document_observers() + def undo(self): + moved_layer = self.doc.layers[self.insert_idx+1] + self.doc.layers.remove(moved_layer) + self._notify_document_observers() + class ReorderLayers(Action): def __init__(self, doc, new_order): self.doc = doc diff --git a/lib/document.py b/lib/document.py index 353d605..412d013 100644 --- a/lib/document.py +++ b/lib/document.py @@ -156,6 +156,9 @@ class Document(): def move_layer(self, was_idx, new_idx, select_new=False): self.do(command.MoveLayer(self, was_idx, new_idx, select_new)) + def duplicate_layer(self, insert_idx=None, name=''): + self.do(command.DuplicateLayer(self, insert_idx, name)) + def reorder_layers(self, new_layers): self.do(command.ReorderLayers(self, new_layers)) diff --git a/pixmaps/layer_duplicate.png b/pixmaps/layer_duplicate.png new file mode 100644 index 0000000000000000000000000000000000000000..7245a7cd219bd78c3f0c2dac308dee755d6a9af5 GIT binary patch literal 482 zcmV<80UiE{P)<h;3K|Lk000e1NJLTq000mG000mO1^@s6AM^iV00006VoOIv0RI60 z0RN!9r;`8x010qNS#tmY3labT3lag+-G2N4000McNliru)&m+24;lc|PzC@10dGk} zK~y-)oszvu13?r<&uliXXuzLJiHKT?q!C1I5)cFhpTLmLJ|r<jjAd|LG!LL4DEI;v z1_V)28wCqf_y(I45kV~!k{t`#WmXf3UKp5rhdFod_l+>E!VZw4{V3+L>uE1Dt%7tM zr|o501*y_>04XIKTYH>c-nMKz7o8%XO#G<p073|E?j9MRUO>|{f`JClZ*>|C2Y`A* za&~#%8X%=a4+#2ux)~byU@016=ir^X2XLq;my|Jznp@Oxm<R{y4TQM5)|edaq;`Ku z?f#IFt|wpDY-WvYW(^>vyTzB+H};Q?L44(QrA8$DwJ()Q(9!1s^5(8Lj^>-E!yup= zAao+(cdtI!>z`W{TUQTaGZE~n``lsQCHtY=)E!;5>E!g{R~uUbgb?JDiKaHGVHieJ zz>&4Rx!mqQuGm#SAeUW_198{i)pU;8#T6FkV~QS11jm4Ka}oce#}B|?_4p3>lO90v Y6Qru7Px`?3s{jB107*qoM6N<$f|a<(Q~&?~ literal 0 HcmV?d00001 -- 1.7.0.4 _______________________________________________ Mypaint-discuss mailing list [email protected] https://mail.gna.org/listinfo/mypaint-discuss
_______________________________________________ Mypaint-discuss mailing list [email protected] https://mail.gna.org/listinfo/mypaint-discuss
