Actually. when you told me about how i render over and over those items,i remove SVG's unnecessary thing, shared render and the performance had increased a lots (around hundreds ). But still, i want to go all the way down, and make it as much as i can :3
I will report back when i finished with it :3 On Sun, Apr 7, 2013 at 2:47 PM, Justin Israel <[email protected]>wrote: > Once you design a replacement node, throw like 50 of them in your scene > and drag them around, and report the results back. Interested to see if you > find a significant performance increase. > > > On Apr 7, 2013, at 7:39 PM, Tuan Nguyen wrote: > > Oh wow, thank Justin. It works XD > > > On Sun, Apr 7, 2013 at 1:50 PM, Justin Israel <[email protected]>wrote: > >> 1) Implement boundingRect() to return the appropriate size of your item >> at any given moment. You can return the same size if your widget doesn't >> change, and only the view does the scaling >> >> 2) Check out the method signature for the paint() event of a >> QGraphicsItem. It hands you a QPainter instance that is being passed down >> all of the children in the scene. It also gives you a bunch of options >> about the current state, such as the bounding rect that should be drawn. At >> this point the bounding rect for your item has already been called so you >> shouldn't get it again >> >> http://pastebin.com/cPc2U1YJ >> >> [snip] >> def boundingRect(self): >> return QtCore.QRectF(0,0,100,50) >> ... >> def paint(self, painter, option, widget): >> rect = option.rect >> painter.setRenderHint(painter.Antialiasing) >> [/snip] >> >> >> >> On Apr 7, 2013, at 6:36 PM, Justin Israel wrote: >> >> Don't create a painter. Look at the arguments. It passes you a shared >> painter. >> On Apr 7, 2013 6:09 PM, "Tuan Nguyen" <[email protected]> wrote: >> >>> I try to paint those GraphicsItem by QPainter, but i only get it works >>> when painting on a QWidget, >>> Here is the script >>> >>> https://gist.github.com/illunara/5329248 >>> >>> painter = QtGui.QPainter(self) >>> >>> I think i did something wrong with the PaintDevice? >>> >>> >>> On Sat, Apr 6, 2013 at 5:52 PM, Justin Israel <[email protected]>wrote: >>> >>>> No problem! >>>> On Apr 6, 2013 10:12 PM, "Tuan Nguyen" <[email protected]> wrote: >>>> >>>>> Ah....i think i misunderstand it. Sorry for a vague question. >>>>> >>>>> And as always, thank Justin :3 >>>>> >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Python Programming for Autodesk Maya" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to [email protected]. >>>>> To post to this group, send email to >>>>> [email protected]. >>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>> >>>>> >>>>> >>>> >>>> -- >>>> You received this message because you are subscribed to a topic in the >>>> Google Groups "Python Programming for Autodesk Maya" group. >>>> To unsubscribe from this topic, visit >>>> https://groups.google.com/d/topic/python_inside_maya/KO-lFG2GYMY/unsubscribe?hl=en-US >>>> . >>>> To unsubscribe from this group and all its topics, send an email to >>>> [email protected]. >>>> To post to this group, send email to >>>> [email protected]. >>>> For more options, visit https://groups.google.com/groups/opt_out. >>>> >>>> >>>> >>> >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Python Programming for Autodesk Maya" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To post to this group, send email to [email protected] >>> . >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >>> >>> >> >> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "Python Programming for Autodesk Maya" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/python_inside_maya/KO-lFG2GYMY/unsubscribe?hl=en-US >> . >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> To post to this group, send email to [email protected]. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Python Programming for Autodesk Maya" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/python_inside_maya/KO-lFG2GYMY/unsubscribe?hl=en-US > . > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
