View2D: Presets for Initialising Views
[blender-staging.git] / source / blender / editors / space_outliner / space_outliner.c
1 /**
2  * $Id$
3  *
4  * ***** BEGIN GPL LICENSE BLOCK *****
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version. 
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software Foundation,
18  * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  * The Original Code is Copyright (C) 2008 Blender Foundation.
21  * All rights reserved.
22  *
23  * 
24  * Contributor(s): Blender Foundation
25  *
26  * ***** END GPL LICENSE BLOCK *****
27  */
28
29 #include <string.h>
30 #include <stdio.h>
31
32 #include "DNA_color_types.h"
33 #include "DNA_object_types.h"
34 #include "DNA_oops_types.h"
35 #include "DNA_space_types.h"
36 #include "DNA_scene_types.h"
37 #include "DNA_screen_types.h"
38 #include "DNA_space_types.h"
39 #include "DNA_texture_types.h"
40 #include "DNA_vec_types.h"
41 #include "DNA_windowmanager_types.h"
42
43 #include "MEM_guardedalloc.h"
44
45 #include "BLI_blenlib.h"
46 #include "BLI_arithb.h"
47 #include "BLI_rand.h"
48
49 #include "BKE_colortools.h"
50 #include "BKE_global.h"
51 #include "BKE_screen.h"
52 #include "BKE_texture.h"
53 #include "BKE_utildefines.h"
54
55 #include "ED_space_api.h"
56 #include "ED_screen.h"
57
58 #include "WM_api.h"
59 #include "WM_types.h"
60
61 #include "BIF_gl.h"
62 #include "BIF_glutil.h"
63
64 #include "UI_interface.h"
65 #include "UI_text.h"
66 #include "UI_resources.h"
67 #include "UI_view2d.h"
68
69 #include "RNA_access.h"
70 #include "RNA_types.h"
71
72 #include "outliner_intern.h"
73
74 #define SET_INT_IN_POINTER(i) ((void*)(intptr_t)(i))
75 #define GET_INT_FROM_POINTER(i) ((int)(intptr_t)(i))
76
77 #define ROW_HEIGHT              19
78 #define COLUMN_WIDTH    150
79
80 typedef void (*uiTableCellFunc)(void *userdata, int row, int col, struct rcti *rct, struct uiBlock *block);
81
82 typedef struct uiTable {
83         rcti rct;
84         int rows, cols;
85
86         uiTableCellFunc cellfunc;
87         void *userdata;
88 } uiTable;
89
90 uiTable *UI_table_create(int rows, int cols, rcti *rct, uiTableCellFunc cellfunc, void *userdata)
91 {
92         uiTable *table;
93
94         table= MEM_callocN(sizeof(uiTable), "uiTable");
95         table->rct= *rct;
96         table->cellfunc= cellfunc;
97         table->rows= rows;
98         table->cols= cols;
99         table->userdata= userdata;
100
101         return table;
102 }
103
104 void UI_table_free(uiTable *table)
105 {
106         MEM_freeN(table);
107 }
108
109 void UI_table_draw(const bContext *C, uiTable *table)
110 {
111         uiBlock *block;
112         View2D *v2d;
113         rcti *rct, cellrct;
114         int y, row, col;
115         
116         v2d= &C->region->v2d;
117         rct= &table->rct;
118         
119         block= uiBeginBlock(C, C->region, "table outliner", UI_EMBOSST, UI_HELV);
120         
121         for(y=rct->ymax, row=0; y>rct->ymin; y-=ROW_HEIGHT, row++) {
122                 if(row%2 == 0) {
123                         UI_ThemeColorShade(TH_BACK, 6);
124                         glRecti(v2d->cur.xmin, y-ROW_HEIGHT, v2d->cur.xmax, y);
125                 }
126
127                 if(row >= table->rows)
128                         continue;
129
130                 for(col=0; col<table->cols; col++) {
131                         cellrct.xmin= rct->xmin+COLUMN_WIDTH*col + 1;
132                         cellrct.xmax= rct->xmin+COLUMN_WIDTH*(col+1);
133                         cellrct.ymin= y-ROW_HEIGHT;
134                         cellrct.ymax= y;
135
136                         table->cellfunc(table->userdata, row, col, &cellrct, block);
137                 }
138         }
139
140         UI_ThemeColorShadeAlpha(TH_BACK, -15, -200);
141
142         for(col=0; col<table->cols; col++)
143                 fdrawline(rct->xmin+COLUMN_WIDTH*(col+1), rct->ymin, rct->xmin+COLUMN_WIDTH*(col+1), rct->ymax);
144
145         uiEndBlock(C, block);
146         uiDrawBlock(block);
147 }
148
149
150 /* ************************ main outliner area region *********************** */
151
152 typedef struct CellRNA {
153         SpaceOops *space;
154         StructRNA *srna;
155         PropertyRNA *prop;
156         PointerRNA ptr;
157         int lastrow, index;
158
159         CollectionPropertyIterator iter;
160 } CellRNA;
161
162 static void rna_back_cb(bContext *C, void *arg_unused, void *arg_unused2)
163 {
164         SpaceOops *soutliner= C->area->spacedata.first;
165         char *newpath;
166
167         newpath= RNA_path_back(soutliner->rnapath);
168         if(soutliner->rnapath)
169                 MEM_freeN(soutliner->rnapath);
170         soutliner->rnapath= newpath;
171 }
172
173 static void rna_pointer_cb(bContext *C, void *arg_prop, void *arg_index)
174 {
175         SpaceOops *soutliner= C->area->spacedata.first;
176         PropertyRNA *prop= arg_prop;
177         char *newpath;
178         int index= GET_INT_FROM_POINTER(arg_index);;
179
180         newpath= RNA_path_append(soutliner->rnapath, NULL, prop, index, NULL);
181         if(soutliner->rnapath)
182                 MEM_freeN(soutliner->rnapath);
183         soutliner->rnapath= newpath;
184 }
185
186 static void rna_label(CellRNA *cell, rcti *rct, uiBlock *block)
187 {
188         PropertySubType subtype;
189         PropertyType type;
190         PropertyRNA *prop;
191         char *vectoritem[4]= {"x", "y", "z", "w"};
192         char *quatitem[4]= {"w", "x", "y", "z"};
193         char *coloritem[4]= {"r", "g", "b", "a"};
194         char item[32];
195         int arraylength;
196
197         prop= cell->prop;
198         type= RNA_property_type(&cell->ptr, prop);
199         subtype= RNA_property_subtype(&cell->ptr, prop);
200         arraylength= RNA_property_array_length(&cell->ptr, prop);
201
202         if(cell->index == -1) {
203                 uiDefBut(block, LABEL, 0, (char*)RNA_property_ui_name(&cell->ptr, prop), rct->xmin, rct->ymin, rct->xmax-rct->xmin, rct->ymax-rct->ymin, 0, 0, 0, 0, 0, (char*)RNA_property_ui_description(&cell->ptr, prop));
204         }
205         else if (type != PROP_COLLECTION) {
206                 if(arraylength == 4 && subtype == PROP_ROTATION)
207                         sprintf(item, "    %s", quatitem[cell->index]);
208                 else if(arraylength <= 4 && (subtype == PROP_VECTOR || subtype == PROP_ROTATION))
209                         sprintf(item, "    %s", vectoritem[cell->index]);
210                 else if(arraylength <= 4 && subtype == PROP_COLOR)
211                         sprintf(item, "    %s", coloritem[cell->index]);
212                 else
213                         sprintf(item, "    %d", cell->index+1);
214
215                 uiDefBut(block, LABEL, 0, item, rct->xmin, rct->ymin, rct->xmax-rct->xmin, rct->ymax-rct->ymin, 0, 0, 0, 0, 0, "");
216         }
217 }
218
219 static void rna_collection_but(CellRNA *cell, rcti *rct, uiBlock *block)
220 {
221         uiBut *but;
222         PointerRNA lookup;
223         PropertyRNA *nameprop;
224         char name[256]= "", *nameptr= name;
225
226         RNA_property_collection_lookup_int(&cell->ptr, cell->prop, cell->index, &lookup);
227
228         if(lookup.data) {
229                 nameprop= RNA_struct_name_property(&lookup);
230
231                 if(nameprop)
232                         nameptr= RNA_property_string_get_alloc(&lookup, nameprop, name, sizeof(name));
233
234                 if(!nameprop || strlen(nameptr) == 0)
235                         sprintf(nameptr, "%d", cell->index+1);
236         }
237
238         but= uiDefBut(block, BUT, 0, nameptr, rct->xmin, rct->ymin, rct->xmax-rct->xmin, rct->ymax-rct->ymin, 0, 0, 0, 0, 0, "");
239         uiButSetFlag(but, UI_TEXT_LEFT);
240
241         if(nameptr != name)
242                 MEM_freeN(nameptr);
243
244         uiButSetFunc(but, rna_pointer_cb, cell->prop, SET_INT_IN_POINTER(cell->index));
245 }
246
247 static uiBut *rna_auto_but(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int index, int x1, int y1, int x2, int y2)
248 {
249         uiBut *but;
250         const char *propname= RNA_property_identifier(ptr, prop);
251
252         switch(RNA_property_type(ptr, prop)) {
253                 case PROP_BOOLEAN: {
254                         int value, length;
255
256                         length= RNA_property_array_length(ptr, prop);
257
258                         if(length)
259                                 value= RNA_property_boolean_get_array(ptr, prop, index);
260                         else
261                                 value= RNA_property_boolean_get(ptr, prop);
262
263                         but= uiDefButR(block, TOG, 0, (value)? "True": "False", x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
264                         break;
265                 }
266                 case PROP_INT:
267                 case PROP_FLOAT:
268                         but= uiDefButR(block, NUM, 0, "", x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
269                         break;
270                 case PROP_ENUM:
271                         but= uiDefButR(block, MENU, 0, NULL, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
272                         break;
273                 case PROP_STRING:
274                         but= uiDefButR(block, TEX, 0, "", x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
275                         break;
276                 case PROP_POINTER: {
277                         PointerRNA pptr;
278                         PropertyRNA *nameprop;
279                         char name[256]= "", *nameptr= name;
280
281                         RNA_property_pointer_get(ptr, prop, &pptr);
282
283                         if(pptr.data) {
284                                 nameprop= RNA_struct_name_property(&pptr);
285                                 if(pptr.type && nameprop)
286                                         nameptr= RNA_property_string_get_alloc(&pptr, nameprop, name, sizeof(name));
287                                 else
288                                         strcpy(nameptr, "->");
289                         }
290
291                         but= uiDefButR(block, BUT, 0, nameptr, x1, y1, x2, y2, ptr, propname, index, 0, 0, 0, 0, NULL);
292                         uiButSetFlag(but, UI_TEXT_LEFT);
293
294                         if(nameptr != name)
295                                 MEM_freeN(nameptr);
296
297                         break;
298                 }
299                 default:
300                         but= NULL;
301                         break;
302         }
303
304         return but;
305 }
306
307 static void rna_but(CellRNA *cell, rcti *rct, uiBlock *block)
308 {
309         uiBut *but;
310         PropertyRNA *prop;
311         PropertyType type;
312         int arraylength, index;
313
314         prop= cell->prop;
315         type= RNA_property_type(&cell->ptr, prop);
316         arraylength= RNA_property_array_length(&cell->ptr, prop);
317
318         if(type == PROP_COLLECTION) {
319                 /* item in a collection */
320                 if(cell->index >= 0)
321                         rna_collection_but(cell, rct, block);
322         }
323         else {
324                 /* other cases */
325                 index= (arraylength)? cell->index: 0;
326
327                 if(index >= 0) {
328                         but= rna_auto_but(block, &cell->ptr, prop, index, rct->xmin, rct->ymin, rct->xmax-rct->xmin, rct->ymax-rct->ymin);
329
330                         if(type == PROP_POINTER)
331                                 uiButSetFunc(but, rna_pointer_cb, prop, SET_INT_IN_POINTER(0));
332                 }
333         }
334 }
335
336 static void rna_path_but(CellRNA *cell, rcti *rct, uiBlock *block)
337 {
338         uiBut *but;
339
340         but= uiDefBut(block, BUT, 0, (cell->space->rnapath)? "..": ".", rct->xmin, rct->ymin, rct->xmax-rct->xmin, rct->ymax-rct->ymin, 0, 0, 0, 0, 0, "");
341         uiButSetFlag(but, UI_TEXT_LEFT);
342         uiButSetFunc(but, rna_back_cb, cell->space, NULL);
343 }
344
345 static void rna_table_cell_func(void *userdata, int row, int col, rcti *rct, uiBlock *block)
346 {
347         CellRNA *cell= userdata;
348         PropertyType type;
349         int length;
350
351         /* path button */
352         if(row == 0) {
353                 if(col == 0)
354                         rna_path_but(cell, rct, block);
355
356                 return;
357         }
358
359         /* set next property for new row */
360         if(row != cell->lastrow) {
361                 if(cell->prop) {
362                         cell->index++;
363
364                         type= RNA_property_type(&cell->ptr, cell->prop);
365                         if(type == PROP_COLLECTION)
366                                 length= RNA_property_collection_length(&cell->ptr, cell->prop);
367                         else
368                                 length= RNA_property_array_length(&cell->ptr, cell->prop);
369
370                         /* verify if we need to go to the next property */
371                         if(type == PROP_COLLECTION && cell->index < length);
372                         else if(length && cell->index < length);
373                         else {
374                                 RNA_property_collection_next(&cell->iter);
375                                 cell->prop= cell->iter.ptr.data;
376                                 cell->index= -1;
377                         }
378                 }
379                 else {
380                         /* initialize */
381                         cell->prop= cell->iter.ptr.data;
382                         cell->index= -1;
383                 }
384
385                 cell->lastrow= row;
386         }
387
388         /* make button */
389         if(col == 0)
390                 rna_label(cell, rct, block);
391         else if(col == 1)
392                 rna_but(cell, rct, block);
393 }
394
395 static void outliner_main_area_init(wmWindowManager *wm, ARegion *ar)
396 {
397         UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
398 }
399
400 static void outliner_main_area_draw(const bContext *C, ARegion *ar)
401 {
402         uiTable *table;
403         rcti rct;
404         CellRNA cell;
405         PropertyRNA *prop, *iterprop;
406         PointerRNA newptr;
407         float col[3];
408         int rows, cols, awidth, aheight, width, height;
409         SpaceOops *soutliner= C->area->spacedata.first;
410         View2D *v2d= &ar->v2d;
411         View2DScrollers *scrollers;
412
413         /* clear */
414         UI_GetThemeColor3fv(TH_BACK, col);
415         glClearColor(col[0], col[1], col[2], 0.0);
416         glClear(GL_COLOR_BUFFER_BIT);
417         
418         awidth= width= ar->winx;
419         aheight= height= ar->winy;
420         
421         /* create table */
422         cell.space= soutliner;
423         cell.lastrow= -1;
424         RNA_main_pointer_create(G.main, &cell.ptr);
425         cell.prop= NULL;
426
427         /* solve RNA path or reset if fails */
428         if(soutliner->rnapath) {
429                 if(!RNA_path_resolve(&cell.ptr, soutliner->rnapath, &newptr, &prop)) {
430                         newptr.data= NULL;
431                         printf("RNA outliner: failed resolving path. (%s)\n", soutliner->rnapath);
432                 }
433
434                 if(newptr.data && newptr.type) {
435                         cell.ptr= newptr;
436                 }
437                 else {
438                         MEM_freeN(soutliner->rnapath);
439                         soutliner->rnapath= NULL;
440                 }
441         }
442
443         /* compute number of rows and columns */
444         rows= 1;
445         cols= 2;
446
447         iterprop= RNA_struct_iterator_property(&cell.ptr);
448         RNA_property_collection_begin(&cell.ptr, iterprop, &cell.iter);
449
450         for(; cell.iter.valid; RNA_property_collection_next(&cell.iter)) {
451                 prop= cell.iter.ptr.data;
452
453                 rows += 1 + RNA_property_array_length(&cell.ptr, prop);
454                 if(RNA_property_type(&cell.ptr, prop) == PROP_COLLECTION)
455                         rows += RNA_property_collection_length(&cell.ptr, prop);
456         }
457
458         RNA_property_collection_end(&cell.iter);
459         
460         /* determine extents of data
461          *      - height must be at least the height of the mask area
462          *      - width is columns + 1, as otherwise, part of last column 
463          *        will be obscured by scrollers
464          */
465         if ((rows*ROW_HEIGHT) > height)
466                 height= rows * ROW_HEIGHT;
467         width= (cols + 1) * COLUMN_WIDTH;
468         
469         /* update size of tot-rect (extents of data/viewable area) */
470         UI_view2d_totRect_set(v2d, width, height);
471         
472         rct.xmin= 0;
473         rct.ymin= -height;
474         rct.xmax= width;
475         rct.ymax= 0;
476         
477         /* set matrix for 2d-view controls */
478         UI_view2d_view_ortho(C, v2d);
479         
480         /* create and draw table */
481         table= UI_table_create(rows, 2, &rct, rna_table_cell_func, &cell);
482
483         RNA_property_collection_begin(&cell.ptr, iterprop, &cell.iter);
484         UI_table_draw(C, table);
485         RNA_property_collection_end(&cell.iter);
486
487         UI_table_free(table);
488         
489         /* reset view matrix */
490         UI_view2d_view_restore(C);
491         
492         /* scrollers */
493         scrollers= UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
494         UI_view2d_scrollers_draw(C, v2d, scrollers);
495         UI_view2d_scrollers_free(scrollers);
496 }
497
498 static void outliner_main_area_free(ARegion *ar)
499 {
500 }
501
502 /* ************************ header outliner area region *********************** */
503
504 /* add handlers, stuff you only do once or on area/region changes */
505 static void outliner_header_area_init(wmWindowManager *wm, ARegion *ar)
506 {
507         UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy);
508 }
509
510 static void outliner_header_area_draw(const bContext *C, ARegion *ar)
511 {
512         float col[3];
513         
514         if(ED_screen_area_active(C))
515                 UI_GetThemeColor3fv(TH_HEADER, col);
516         else
517                 UI_GetThemeColor3fv(TH_HEADERDESEL, col);
518         
519         glClearColor(col[0], col[1], col[2], 0.0);
520         glClear(GL_COLOR_BUFFER_BIT);
521
522         /* set view2d view matrix for scrolling (without scrollers) */
523         UI_view2d_view_ortho(C, &ar->v2d);
524
525         outliner_header_buttons(C, ar);
526 }
527
528 static void outliner_header_area_free(ARegion *ar)
529 {
530 }
531
532 /* ******************** default callbacks for outliner space ***************** */
533
534 static SpaceLink *outliner_new(void)
535 {
536         ARegion *ar;
537         SpaceOops *soutliner;
538
539         soutliner= MEM_callocN(sizeof(SpaceOops), "initoutliner");
540
541         /* header */
542         ar= MEM_callocN(sizeof(ARegion), "header for outliner");
543         
544         BLI_addtail(&soutliner->regionbase, ar);
545         ar->regiontype= RGN_TYPE_HEADER;
546         ar->alignment= RGN_ALIGN_BOTTOM;
547         
548         /* main area */
549         ar= MEM_callocN(sizeof(ARegion), "main area for outliner");
550         
551         BLI_addtail(&soutliner->regionbase, ar);
552         ar->regiontype= RGN_TYPE_WINDOW;
553         
554         ar->v2d.scroll = (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM_O);
555         ar->v2d.align = (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_POS_Y);
556         ar->v2d.keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_KEEPZOOM|V2D_KEEPASPECT);
557         ar->v2d.keeptot= 2;     /* XXX make define */
558         
559         return (SpaceLink*)soutliner;
560 }
561
562 static void free_oops(Oops *oops)       /* also oops itself */
563 {
564         BLI_freelistN(&oops->link);
565         MEM_freeN(oops);
566 }
567
568 static void outliner_free_tree(ListBase *lb)
569 {
570         
571         while(lb->first) {
572                 TreeElement *te= lb->first;
573                 
574                 outliner_free_tree(&te->subtree);
575                 BLI_remlink(lb, te);
576                 MEM_freeN(te);
577         }
578 }
579
580 /* not spacelink itself */
581 static void outliner_free(SpaceLink *sl)
582 {
583         SpaceOops *soutliner= (SpaceOops*)sl;
584         Oops *oops;
585
586         if(soutliner->rnapath) {
587                 MEM_freeN(soutliner->rnapath);
588                 soutliner->rnapath= NULL;
589         }
590         
591         while( (oops= soutliner->oops.first) ) {
592                 BLI_remlink(&soutliner->oops, oops);
593                 free_oops(oops);
594         }
595         
596         outliner_free_tree(&soutliner->tree);
597         if(soutliner->treestore) {
598                 if(soutliner->treestore->data) MEM_freeN(soutliner->treestore->data);
599                 MEM_freeN(soutliner->treestore);
600         }
601         
602 }
603
604 /* spacetype; init callback */
605 static void outliner_init(wmWindowManager *wm, ScrArea *sa)
606 {
607         
608 }
609
610 static SpaceLink *outliner_duplicate(SpaceLink *sl)
611 {
612         SpaceOops *soutliner= (SpaceOops *)sl;
613         SpaceOops *soutlinern= MEM_dupallocN(soutliner);
614
615         if(soutlinern->rnapath)
616                 soutlinern->rnapath= MEM_dupallocN(soutlinern->rnapath);
617         
618         soutlinern->oops.first= soutlinern->oops.last= NULL;
619         soutlinern->tree.first= soutlinern->tree.last= NULL;
620         soutlinern->treestore= NULL;
621         
622         return (SpaceLink *)soutlinern;
623 }
624
625 /* only called once, from space_api/spacetypes.c */
626 void ED_spacetype_outliner(void)
627 {
628         SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype time");
629         ARegionType *art;
630         
631         st->spaceid= SPACE_OOPS;
632         strncpy(st->name, "Outliner", BKE_ST_MAXNAME);
633         
634         st->new= outliner_new;
635         st->free= outliner_free;
636         st->init= outliner_init;
637         st->duplicate= outliner_duplicate;
638         st->operatortypes= outliner_operatortypes;
639         st->keymap= outliner_keymap;
640         
641         /* regions: main window */
642         art= MEM_callocN(sizeof(ARegionType), "spacetype time region");
643         art->regionid = RGN_TYPE_WINDOW;
644         art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
645         
646         art->init= outliner_main_area_init;
647         art->draw= outliner_main_area_draw;
648         art->free= outliner_main_area_free;
649         BLI_addhead(&st->regiontypes, art);
650         
651         /* regions: header */
652         art= MEM_callocN(sizeof(ARegionType), "spacetype time region");
653         art->regionid = RGN_TYPE_HEADER;
654         art->minsizey= HEADERY;
655         art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
656         
657         art->init= outliner_header_area_init;
658         art->draw= outliner_header_area_draw;
659         art->free= outliner_header_area_free;
660         BLI_addhead(&st->regiontypes, art);
661         
662         BKE_spacetype_register(st);
663 }
664