Blender V2.61 - r43446
|
00001 /* 00002 * ***** BEGIN GPL LICENSE BLOCK ***** 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software Foundation, 00016 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 * 00018 * The Original Code is Copyright (C) 2008 Blender Foundation. 00019 * All rights reserved. 00020 * 00021 * 00022 * Contributor(s): Blender Foundation 00023 * 00024 * ***** END GPL LICENSE BLOCK ***** 00025 */ 00026 00032 #include <string.h> 00033 #include <stdio.h> 00034 00035 #include "DNA_anim_types.h" 00036 #include "DNA_scene_types.h" 00037 00038 #include "MEM_guardedalloc.h" 00039 00040 #include "BLI_blenlib.h" 00041 #include "BLI_math.h" 00042 #include "BLI_rand.h" 00043 #include "BLI_utildefines.h" 00044 00045 #include "BKE_context.h" 00046 #include "BKE_global.h" 00047 #include "BKE_main.h" 00048 #include "BKE_fcurve.h" 00049 #include "BKE_screen.h" 00050 00051 #include "ED_space_api.h" 00052 #include "ED_screen.h" 00053 #include "ED_anim_api.h" 00054 #include "ED_markers.h" 00055 00056 #include "BIF_gl.h" 00057 00058 #include "WM_api.h" 00059 #include "WM_types.h" 00060 00061 #include "UI_resources.h" 00062 #include "UI_view2d.h" 00063 00064 #include "graph_intern.h" // own include 00065 00066 /* ******************** manage regions ********************* */ 00067 00068 ARegion *graph_has_buttons_region(ScrArea *sa) 00069 { 00070 ARegion *ar, *arnew; 00071 00072 ar= BKE_area_find_region_type(sa, RGN_TYPE_UI); 00073 if(ar) return ar; 00074 00075 /* add subdiv level; after main */ 00076 ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); 00077 00078 /* is error! */ 00079 if (ar==NULL) return NULL; 00080 00081 arnew= MEM_callocN(sizeof(ARegion), "buttons for graph"); 00082 00083 BLI_insertlinkafter(&sa->regionbase, ar, arnew); 00084 arnew->regiontype= RGN_TYPE_UI; 00085 arnew->alignment= RGN_ALIGN_RIGHT; 00086 00087 arnew->flag = RGN_FLAG_HIDDEN; 00088 00089 return arnew; 00090 } 00091 00092 00093 /* ******************** default callbacks for ipo space ***************** */ 00094 00095 static SpaceLink *graph_new(const bContext *C) 00096 { 00097 Scene *scene= CTX_data_scene(C); 00098 ARegion *ar; 00099 SpaceIpo *sipo; 00100 00101 /* Graph Editor - general stuff */ 00102 sipo= MEM_callocN(sizeof(SpaceIpo), "init graphedit"); 00103 sipo->spacetype= SPACE_IPO; 00104 00105 sipo->autosnap= SACTSNAP_FRAME; 00106 00107 /* allocate DopeSheet data for Graph Editor */ 00108 sipo->ads= MEM_callocN(sizeof(bDopeSheet), "GraphEdit DopeSheet"); 00109 sipo->ads->source= (ID *)scene; 00110 00111 /* settings for making it easier by default to just see what you're interested in tweaking */ 00112 sipo->ads->filterflag |= ADS_FILTER_ONLYSEL; 00113 sipo->flag |= SIPO_SELVHANDLESONLY; 00114 00115 /* header */ 00116 ar= MEM_callocN(sizeof(ARegion), "header for graphedit"); 00117 00118 BLI_addtail(&sipo->regionbase, ar); 00119 ar->regiontype= RGN_TYPE_HEADER; 00120 ar->alignment= RGN_ALIGN_BOTTOM; 00121 00122 /* channels */ 00123 ar= MEM_callocN(sizeof(ARegion), "channels area for graphedit"); 00124 00125 BLI_addtail(&sipo->regionbase, ar); 00126 ar->regiontype= RGN_TYPE_CHANNELS; 00127 ar->alignment= RGN_ALIGN_LEFT; 00128 00129 ar->v2d.scroll = (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM); 00130 00131 /* ui buttons */ 00132 ar= MEM_callocN(sizeof(ARegion), "buttons area for graphedit"); 00133 00134 BLI_addtail(&sipo->regionbase, ar); 00135 ar->regiontype= RGN_TYPE_UI; 00136 ar->alignment= RGN_ALIGN_RIGHT; 00137 ar->flag = RGN_FLAG_HIDDEN; 00138 00139 /* main area */ 00140 ar= MEM_callocN(sizeof(ARegion), "main area for graphedit"); 00141 00142 BLI_addtail(&sipo->regionbase, ar); 00143 ar->regiontype= RGN_TYPE_WINDOW; 00144 00145 ar->v2d.tot.xmin= 0.0f; 00146 ar->v2d.tot.ymin= (float)scene->r.sfra - 10.0f; 00147 ar->v2d.tot.xmax= (float)scene->r.efra; 00148 ar->v2d.tot.ymax= 10.0f; 00149 00150 ar->v2d.cur= ar->v2d.tot; 00151 00152 ar->v2d.min[0]= FLT_MIN; 00153 ar->v2d.min[1]= FLT_MIN; 00154 00155 ar->v2d.max[0]= MAXFRAMEF; 00156 ar->v2d.max[1]= FLT_MAX; 00157 00158 ar->v2d.scroll= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL); 00159 ar->v2d.scroll |= (V2D_SCROLL_LEFT|V2D_SCROLL_SCALE_VERTICAL); 00160 00161 ar->v2d.keeptot= 0; 00162 00163 return (SpaceLink *)sipo; 00164 } 00165 00166 /* not spacelink itself */ 00167 static void graph_free(SpaceLink *sl) 00168 { 00169 SpaceIpo *si= (SpaceIpo *)sl; 00170 00171 if (si->ads) { 00172 BLI_freelistN(&si->ads->chanbase); 00173 MEM_freeN(si->ads); 00174 } 00175 00176 if (si->ghostCurves.first) 00177 free_fcurves(&si->ghostCurves); 00178 } 00179 00180 00181 /* spacetype; init callback */ 00182 static void graph_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa) 00183 { 00184 SpaceIpo *sipo= (SpaceIpo *)sa->spacedata.first; 00185 00186 /* init dopesheet data if non-existant (i.e. for old files) */ 00187 if (sipo->ads == NULL) { 00188 sipo->ads= MEM_callocN(sizeof(bDopeSheet), "GraphEdit DopeSheet"); 00189 sipo->ads->source= (ID *)(G.main->scene.first); // FIXME: this is a really nasty hack here for now... 00190 } 00191 00192 ED_area_tag_refresh(sa); 00193 } 00194 00195 static SpaceLink *graph_duplicate(SpaceLink *sl) 00196 { 00197 SpaceIpo *sipon= MEM_dupallocN(sl); 00198 00199 /* clear or remove stuff from old */ 00200 BLI_duplicatelist(&sipon->ghostCurves, &((SpaceIpo *)sl)->ghostCurves); 00201 sipon->ads= MEM_dupallocN(sipon->ads); 00202 00203 return (SpaceLink *)sipon; 00204 } 00205 00206 /* add handlers, stuff you only do once or on area/region changes */ 00207 static void graph_main_area_init(wmWindowManager *wm, ARegion *ar) 00208 { 00209 wmKeyMap *keymap; 00210 00211 UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy); 00212 00213 /* own keymap */ 00214 keymap= WM_keymap_find(wm->defaultconf, "Graph Editor", SPACE_IPO, 0); 00215 WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); 00216 keymap= WM_keymap_find(wm->defaultconf, "Graph Editor Generic", SPACE_IPO, 0); 00217 WM_event_add_keymap_handler(&ar->handlers, keymap); 00218 } 00219 00220 static void graph_main_area_draw(const bContext *C, ARegion *ar) 00221 { 00222 /* draw entirely, view changes should be handled here */ 00223 SpaceIpo *sipo= CTX_wm_space_graph(C); 00224 bAnimContext ac; 00225 View2D *v2d= &ar->v2d; 00226 View2DGrid *grid; 00227 View2DScrollers *scrollers; 00228 float col[3]; 00229 short unitx=0, unity=V2D_UNIT_VALUES, flag=0; 00230 00231 /* clear and setup matrix */ 00232 UI_GetThemeColor3fv(TH_BACK, col); 00233 glClearColor(col[0], col[1], col[2], 0.0); 00234 glClear(GL_COLOR_BUFFER_BIT); 00235 00236 UI_view2d_view_ortho(v2d); 00237 00238 /* grid */ 00239 unitx= (sipo->flag & SIPO_DRAWTIME)? V2D_UNIT_SECONDS : V2D_UNIT_FRAMESCALE; 00240 grid= UI_view2d_grid_calc(CTX_data_scene(C), v2d, unitx, V2D_GRID_NOCLAMP, unity, V2D_GRID_NOCLAMP, ar->winx, ar->winy); 00241 UI_view2d_grid_draw(v2d, grid, V2D_GRIDLINES_ALL); 00242 00243 /* draw data */ 00244 if (ANIM_animdata_get_context(C, &ac)) { 00245 /* draw ghost curves */ 00246 graph_draw_ghost_curves(&ac, sipo, ar); 00247 00248 /* draw curves twice - unselected, then selected, so that the are fewer occlusion problems */ 00249 graph_draw_curves(&ac, sipo, ar, grid, 0); 00250 graph_draw_curves(&ac, sipo, ar, grid, 1); 00251 00252 /* XXX the slow way to set tot rect... but for nice sliders needed (ton) */ 00253 get_graph_keyframe_extents(&ac, &v2d->tot.xmin, &v2d->tot.xmax, &v2d->tot.ymin, &v2d->tot.ymax, FALSE); 00254 /* extra offset so that these items are visible */ 00255 v2d->tot.xmin -= 10.0f; 00256 v2d->tot.xmax += 10.0f; 00257 } 00258 00259 /* only free grid after drawing data, as we need to use it to determine sampling rate */ 00260 UI_view2d_grid_free(grid); 00261 00262 /* horizontal component of value-cursor (value line before the current frame line) */ 00263 if ((sipo->flag & SIPO_NODRAWCURSOR)==0) { 00264 float vec[2]; 00265 00266 /* Draw a green line to indicate the cursor value */ 00267 vec[1]= sipo->cursorVal; 00268 00269 UI_ThemeColorShadeAlpha(TH_CFRAME, -10, -50); 00270 glLineWidth(2.0); 00271 00272 glEnable(GL_BLEND); 00273 glBegin(GL_LINE_STRIP); 00274 vec[0]= v2d->cur.xmin; 00275 glVertex2fv(vec); 00276 00277 vec[0]= v2d->cur.xmax; 00278 glVertex2fv(vec); 00279 glEnd(); // GL_LINE_STRIP 00280 glDisable(GL_BLEND); 00281 } 00282 00283 /* current frame */ 00284 if (sipo->flag & SIPO_DRAWTIME) flag |= DRAWCFRA_UNIT_SECONDS; 00285 if ((sipo->flag & SIPO_NODRAWCFRANUM)==0) flag |= DRAWCFRA_SHOW_NUMBOX; 00286 ANIM_draw_cfra(C, v2d, flag); 00287 00288 /* markers */ 00289 UI_view2d_view_orthoSpecial(ar, v2d, 1); 00290 draw_markers_time(C, 0); 00291 00292 /* preview range */ 00293 UI_view2d_view_ortho(v2d); 00294 ANIM_draw_previewrange(C, v2d); 00295 00296 /* reset view matrix */ 00297 UI_view2d_view_restore(C); 00298 00299 /* scrollers */ 00300 // FIXME: args for scrollers depend on the type of data being shown... 00301 scrollers= UI_view2d_scrollers_calc(C, v2d, unitx, V2D_GRID_NOCLAMP, unity, V2D_GRID_NOCLAMP); 00302 UI_view2d_scrollers_draw(C, v2d, scrollers); 00303 UI_view2d_scrollers_free(scrollers); 00304 } 00305 00306 static void graph_channel_area_init(wmWindowManager *wm, ARegion *ar) 00307 { 00308 wmKeyMap *keymap; 00309 00310 UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy); 00311 00312 /* own keymap */ 00313 keymap= WM_keymap_find(wm->defaultconf, "Animation Channels", 0, 0); 00314 WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); 00315 keymap= WM_keymap_find(wm->defaultconf, "Graph Editor Generic", SPACE_IPO, 0); 00316 WM_event_add_keymap_handler(&ar->handlers, keymap); 00317 } 00318 00319 static void graph_channel_area_draw(const bContext *C, ARegion *ar) 00320 { 00321 bAnimContext ac; 00322 View2D *v2d= &ar->v2d; 00323 View2DScrollers *scrollers; 00324 float col[3]; 00325 00326 /* clear and setup matrix */ 00327 UI_GetThemeColor3fv(TH_BACK, col); 00328 glClearColor(col[0], col[1], col[2], 0.0); 00329 glClear(GL_COLOR_BUFFER_BIT); 00330 00331 UI_view2d_view_ortho(v2d); 00332 00333 /* draw channels */ 00334 if (ANIM_animdata_get_context(C, &ac)) { 00335 graph_draw_channel_names((bContext*)C, &ac, ar); 00336 } 00337 00338 /* reset view matrix */ 00339 UI_view2d_view_restore(C); 00340 00341 /* scrollers */ 00342 scrollers= UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY); 00343 UI_view2d_scrollers_draw(C, v2d, scrollers); 00344 UI_view2d_scrollers_free(scrollers); 00345 } 00346 00347 /* add handlers, stuff you only do once or on area/region changes */ 00348 static void graph_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) 00349 { 00350 ED_region_header_init(ar); 00351 } 00352 00353 static void graph_header_area_draw(const bContext *C, ARegion *ar) 00354 { 00355 ED_region_header(C, ar); 00356 } 00357 00358 /* add handlers, stuff you only do once or on area/region changes */ 00359 static void graph_buttons_area_init(wmWindowManager *wm, ARegion *ar) 00360 { 00361 wmKeyMap *keymap; 00362 00363 ED_region_panels_init(wm, ar); 00364 00365 keymap= WM_keymap_find(wm->defaultconf, "Graph Editor Generic", SPACE_IPO, 0); 00366 WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); 00367 } 00368 00369 static void graph_buttons_area_draw(const bContext *C, ARegion *ar) 00370 { 00371 ED_region_panels(C, ar, 1, NULL, -1); 00372 } 00373 00374 static void graph_region_listener(ARegion *ar, wmNotifier *wmn) 00375 { 00376 /* context changes */ 00377 switch(wmn->category) { 00378 case NC_ANIMATION: 00379 ED_region_tag_redraw(ar); 00380 break; 00381 case NC_SCENE: 00382 switch(wmn->data) { 00383 case ND_RENDER_OPTIONS: 00384 case ND_OB_ACTIVE: 00385 case ND_FRAME: 00386 case ND_MARKERS: 00387 ED_region_tag_redraw(ar); 00388 break; 00389 case ND_SEQUENCER: 00390 if (wmn->action == NA_SELECTED) 00391 ED_region_tag_redraw(ar); 00392 break; 00393 } 00394 break; 00395 case NC_OBJECT: 00396 switch(wmn->data) { 00397 case ND_BONE_ACTIVE: 00398 case ND_BONE_SELECT: 00399 case ND_KEYS: 00400 ED_region_tag_redraw(ar); 00401 break; 00402 case ND_MODIFIER: 00403 if(wmn->action == NA_RENAME) 00404 ED_region_tag_redraw(ar); 00405 break; 00406 } 00407 break; 00408 case NC_NODE: 00409 switch(wmn->action) { 00410 case NA_EDITED: 00411 case NA_SELECTED: 00412 ED_region_tag_redraw(ar); 00413 break; 00414 } 00415 break; 00416 case NC_ID: 00417 if(wmn->action == NA_RENAME) 00418 ED_region_tag_redraw(ar); 00419 break; 00420 default: 00421 if(wmn->data==ND_KEYS) 00422 ED_region_tag_redraw(ar); 00423 00424 } 00425 } 00426 00427 /* editor level listener */ 00428 static void graph_listener(ScrArea *sa, wmNotifier *wmn) 00429 { 00430 SpaceIpo *sipo= (SpaceIpo *)sa->spacedata.first; 00431 00432 /* context changes */ 00433 switch (wmn->category) { 00434 case NC_ANIMATION: 00435 /* for selection changes of animation data, we can just redraw... otherwise autocolor might need to be done again */ 00436 if (ELEM(wmn->data, ND_KEYFRAME, ND_ANIMCHAN) && (wmn->action == NA_SELECTED)) 00437 ED_area_tag_redraw(sa); 00438 else 00439 ED_area_tag_refresh(sa); 00440 break; 00441 case NC_SCENE: 00442 switch (wmn->data) { 00443 case ND_OB_ACTIVE: /* selection changed, so force refresh to flush (needs flag set to do syncing) */ 00444 case ND_OB_SELECT: 00445 sipo->flag |= SIPO_TEMP_NEEDCHANSYNC; 00446 ED_area_tag_refresh(sa); 00447 break; 00448 00449 default: /* just redrawing the view will do */ 00450 ED_area_tag_redraw(sa); 00451 break; 00452 } 00453 break; 00454 case NC_OBJECT: 00455 switch (wmn->data) { 00456 case ND_BONE_SELECT: /* selection changed, so force refresh to flush (needs flag set to do syncing) */ 00457 case ND_BONE_ACTIVE: 00458 sipo->flag |= SIPO_TEMP_NEEDCHANSYNC; 00459 ED_area_tag_refresh(sa); 00460 break; 00461 case ND_TRANSFORM: 00462 break; /*do nothing*/ 00463 00464 default: /* just redrawing the view will do */ 00465 ED_area_tag_redraw(sa); 00466 break; 00467 } 00468 break; 00469 case NC_NODE: 00470 if (wmn->action == NA_SELECTED) { 00471 /* selection changed, so force refresh to flush (needs flag set to do syncing) */ 00472 sipo->flag |= SIPO_TEMP_NEEDCHANSYNC; 00473 ED_area_tag_refresh(sa); 00474 } 00475 break; 00476 case NC_SPACE: 00477 if(wmn->data == ND_SPACE_GRAPH) 00478 ED_area_tag_redraw(sa); 00479 break; 00480 00481 // XXX: restore the case below if not enough updates occur... 00482 //default: 00483 // if(wmn->data==ND_KEYS) 00484 // ED_area_tag_redraw(sa); 00485 } 00486 } 00487 00488 00489 00490 static void graph_refresh(const bContext *C, ScrArea *sa) 00491 { 00492 SpaceIpo *sipo = (SpaceIpo *)sa->spacedata.first; 00493 bAnimContext ac; 00494 00495 /* updates to data needed depends on Graph Editor mode... */ 00496 switch (sipo->mode) { 00497 case SIPO_MODE_ANIMATION: /* all animation */ 00498 { 00499 00500 } 00501 break; 00502 00503 case SIPO_MODE_DRIVERS: /* drivers only */ 00504 { 00505 00506 } 00507 break; 00508 } 00509 00510 /* region updates? */ 00511 // XXX resizing y-extents of tot should go here? 00512 00513 /* update the state of the animchannels in response to changes from the data they represent 00514 * NOTE: the temp flag is used to indicate when this needs to be done, and will be cleared once handled 00515 */ 00516 if (sipo->flag & SIPO_TEMP_NEEDCHANSYNC) { 00517 ANIM_sync_animchannels_to_data(C); 00518 sipo->flag &= ~SIPO_TEMP_NEEDCHANSYNC; 00519 } 00520 00521 /* init/adjust F-Curve colors */ 00522 if (ANIM_animdata_get_context(C, &ac)) { 00523 ListBase anim_data = {NULL, NULL}; 00524 bAnimListElem *ale; 00525 size_t items; 00526 int filter; 00527 int i; 00528 00529 /* build list of F-Curves which will be visible as channels in channel-region 00530 * - we don't include ANIMFILTER_CURVEVISIBLE filter, as that will result in a 00531 * mismatch between channel-colors and the drawn curves 00532 */ 00533 filter= (ANIMFILTER_DATA_VISIBLE|ANIMFILTER_NODUPLIS); 00534 items= ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); 00535 00536 /* loop over F-Curves, assigning colors */ 00537 for (ale=anim_data.first, i=0; ale; ale= ale->next, i++) { 00538 FCurve *fcu= (FCurve *)ale->data; 00539 00540 /* set color of curve here */ 00541 switch (fcu->color_mode) { 00542 case FCURVE_COLOR_CUSTOM: 00543 /* User has defined a custom color for this curve already (we assume it's not going to cause clashes with text colors), 00544 * which should be left alone... Nothing needs to be done here. 00545 */ 00546 break; 00547 00548 case FCURVE_COLOR_AUTO_RGB: 00549 { 00550 /* F-Curve's array index is automatically mapped to RGB values. This works best of 3-value vectors. 00551 * TODO: find a way to module the hue so that not all curves have same color... 00552 */ 00553 float *col= fcu->color; 00554 00555 switch(fcu->array_index) { 00556 case 0: 00557 col[0]= 1.0f; col[1]= 0.0f; col[2]= 0.0f; 00558 break; 00559 case 1: 00560 col[0]= 0.0f; col[1]= 1.0f; col[2]= 0.0f; 00561 break; 00562 case 2: 00563 col[0]= 0.0f; col[1]= 0.0f; col[2]= 1.0f; 00564 break; 00565 default: 00566 /* 'unknown' color - bluish so as to not conflict with handles */ 00567 col[0]= 0.3f; col[1]= 0.8f; col[2]= 1.0f; 00568 break; 00569 } 00570 } 00571 break; 00572 00573 case FCURVE_COLOR_AUTO_RAINBOW: 00574 default: 00575 { 00576 /* determine color 'automatically' using 'magic function' which uses the given args 00577 * of current item index + total items to determine some RGB color 00578 */ 00579 getcolor_fcurve_rainbow(i, items, fcu->color); 00580 } 00581 break; 00582 } 00583 } 00584 00585 /* free temp list */ 00586 BLI_freelistN(&anim_data); 00587 } 00588 } 00589 00590 /* only called once, from space/spacetypes.c */ 00591 void ED_spacetype_ipo(void) 00592 { 00593 SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype ipo"); 00594 ARegionType *art; 00595 00596 st->spaceid= SPACE_IPO; 00597 strncpy(st->name, "Graph", BKE_ST_MAXNAME); 00598 00599 st->new= graph_new; 00600 st->free= graph_free; 00601 st->init= graph_init; 00602 st->duplicate= graph_duplicate; 00603 st->operatortypes= graphedit_operatortypes; 00604 st->keymap= graphedit_keymap; 00605 st->listener= graph_listener; 00606 st->refresh= graph_refresh; 00607 00608 /* regions: main window */ 00609 art= MEM_callocN(sizeof(ARegionType), "spacetype graphedit region"); 00610 art->regionid = RGN_TYPE_WINDOW; 00611 art->init= graph_main_area_init; 00612 art->draw= graph_main_area_draw; 00613 art->listener= graph_region_listener; 00614 art->keymapflag= ED_KEYMAP_VIEW2D|ED_KEYMAP_MARKERS|ED_KEYMAP_ANIMATION|ED_KEYMAP_FRAMES; 00615 00616 BLI_addhead(&st->regiontypes, art); 00617 00618 /* regions: header */ 00619 art= MEM_callocN(sizeof(ARegionType), "spacetype graphedit region"); 00620 art->regionid = RGN_TYPE_HEADER; 00621 art->prefsizey= HEADERY; 00622 art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER; 00623 art->listener= graph_region_listener; 00624 art->init= graph_header_area_init; 00625 art->draw= graph_header_area_draw; 00626 00627 BLI_addhead(&st->regiontypes, art); 00628 00629 /* regions: channels */ 00630 art= MEM_callocN(sizeof(ARegionType), "spacetype graphedit region"); 00631 art->regionid = RGN_TYPE_CHANNELS; 00632 art->prefsizex= 200+V2D_SCROLL_WIDTH; /* 200 is the 'standard', but due to scrollers, we want a bit more to fit the lock icons in */ 00633 art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES; 00634 art->listener= graph_region_listener; 00635 art->init= graph_channel_area_init; 00636 art->draw= graph_channel_area_draw; 00637 00638 BLI_addhead(&st->regiontypes, art); 00639 00640 /* regions: UI buttons */ 00641 art= MEM_callocN(sizeof(ARegionType), "spacetype graphedit region"); 00642 art->regionid = RGN_TYPE_UI; 00643 art->prefsizex= 200; 00644 art->keymapflag= ED_KEYMAP_UI; 00645 art->listener= graph_region_listener; 00646 art->init= graph_buttons_area_init; 00647 art->draw= graph_buttons_area_draw; 00648 00649 BLI_addhead(&st->regiontypes, art); 00650 00651 graph_buttons_register(art); 00652 00653 BKE_spacetype_register(st); 00654 } 00655