[Bf-committers] Performance Patch for Blender
Thomas H. Hendrick
thomas.hendrick at vistagy.com
Mon Jul 18 16:28:54 CEST 2005
Hey. Love the program, outstanding work, etc, etc.
I'm new to the Blender code, but I was noticing serious slowdown
problems with 2.36, 2.37, and 2.37a when I was deleting an action strip
from an armature. Using my profiler and some other tools, I think I may
have found something which will speed things up (if I understand this
section of code at all).
Attached please find a small patchfile for one file
(source/blender/src/space.c).
If I read the code correctly:
for each Screen of G.main
for each ScrArea of Screen.areabase
for each SpaceLink of ScrArea.spacedata
if event is REMAKEALLIPO
for each ipo in G.main->ipo
for each curve in ipo->curve
testhandles_ipocurve
However, as far as I know, IPO Data blocks are not related to Screens,
ScrAreas, or SpaceLinks. So, each time you go through this process,
you're going to be recalculating the same IPO Data, and getting the same
result. At least, I think so.
--
------------------------------------------------------------------------
Tom Hendrick<thomas.hendrick at vistagy.com> Technical Staff
[W] 1-(781)-290-0506 x252 [M] 1-(617) 448-2585 [H] 1-(978)-244-1149
Vistagy, Inc. http://www.vistagy.com/
-------------- next part --------------
Index: source/blender/src/space.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/space.c,v
retrieving revision 1.266
diff -B -w -u -r1.266 space.c
--- source/blender/src/space.c 11 Jun 2005 16:30:36 -0000 1.266
+++ source/blender/src/space.c 8 Jul 2005 18:31:42 -0000
@@ -4780,27 +4780,32 @@
{
bScreen *sc;
- sc= G.main->screen.first;
- while(sc) {
- ScrArea *sa= sc->areabase.first;
- while(sa) {
- SpaceLink *sl= sa->spacedata.first;
- while(sl) {
- switch(event) {
- case REMAKEALLIPO:
- {
+ /* -------------------------------------------------------
+ * Since IPOs are not relative or related to Screens, Screen Areas, or
+ * SpaceLinks, recalculating all of the IPOs for every screen, screen
+ * area, and space link is really unnecessary, isn't it?
+ * ------------------------------------------------------- */
+ if( REMAKEALLIPO == event ){
Ipo *ipo;
IpoCurve *icu;
/* Go to each ipo */
for (ipo=G.main->ipo.first; ipo; ipo=ipo->id.next){
+ /* fprintf( stderr, "Beginning recalc of ipo : %s\n", ipo->id.name ); */
for (icu = ipo->curve.first; icu; icu=icu->next){
sort_time_ipocurve(icu);
testhandles_ipocurve(icu);
}
}
}
- break;
+ else{
+ sc= G.main->screen.first;
+ while(sc) {
+ ScrArea *sa= sc->areabase.first;
+ while(sa) {
+ SpaceLink *sl= sa->spacedata.first;
+ while(sl) {
+ switch(event) {
case REMAKEIPO:
if(sl->spacetype==SPACE_IPO) {
SpaceIpo *si= (SpaceIpo *)sl;
@@ -4826,6 +4831,7 @@
}
sc= sc->id.next;
}
+ }
}
/* if header==1, then draw header for curarea too. Excepption for headerprint()... */
-------------- next part --------------
A non-text attachment was scrubbed...
Name: thomas.hendrick.vcf
Type: text/x-vcard
Size: 312 bytes
Desc: not available
Url : http://projects.blender.org/pipermail/bf-committers/attachments/20050718/a7e942ba/thomas.hendrick-0001.vcf
More information about the Bf-committers
mailing list