OLD | NEW |
1 /* | 1 /* |
2 * ***** BEGIN GPL LICENSE BLOCK ***** | 2 * ***** BEGIN GPL LICENSE BLOCK ***** |
3 * | 3 * |
4 * This program is free software; you can redistribute it and/or | 4 * This program is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU General Public License | 5 * modify it under the terms of the GNU General Public License |
6 * as published by the Free Software Foundation; either version 2 | 6 * as published by the Free Software Foundation; either version 2 |
7 * of the License, or (at your option) any later version. | 7 * of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 #include "BKE_object.h" | 103 #include "BKE_object.h" |
104 #include "BKE_particle.h" | 104 #include "BKE_particle.h" |
105 #include "BKE_packedFile.h" | 105 #include "BKE_packedFile.h" |
106 #include "BKE_speaker.h" | 106 #include "BKE_speaker.h" |
107 #include "BKE_sound.h" | 107 #include "BKE_sound.h" |
108 #include "BKE_screen.h" | 108 #include "BKE_screen.h" |
109 #include "BKE_scene.h" | 109 #include "BKE_scene.h" |
110 #include "BKE_text.h" | 110 #include "BKE_text.h" |
111 #include "BKE_texture.h" | 111 #include "BKE_texture.h" |
112 #include "BKE_world.h" | 112 #include "BKE_world.h" |
| 113 #ifdef WITH_FREESTYLE |
| 114 # include "BKE_linestyle.h" |
| 115 #endif |
113 | 116 |
114 #include "RNA_access.h" | 117 #include "RNA_access.h" |
115 | 118 |
116 #ifdef WITH_PYTHON | 119 #ifdef WITH_PYTHON |
117 #include "BPY_extern.h" | 120 #include "BPY_extern.h" |
118 #endif | 121 #endif |
119 | 122 |
120 #define MAX_IDPUP 60 /* was 24 */ | 123 #define MAX_IDPUP 60 /* was 24 */ |
121 | 124 |
122 /* GS reads the memory pointed at in a specific ordering.· | 125 /* GS reads the memory pointed at in a specific ordering.· |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 case ID_BR: | 272 case ID_BR: |
270 if (!test) BKE_brush_make_local((Brush *)id); | 273 if (!test) BKE_brush_make_local((Brush *)id); |
271 return 1; | 274 return 1; |
272 case ID_PA: | 275 case ID_PA: |
273 if (!test) BKE_particlesettings_make_local((ParticleSett
ings *)id); | 276 if (!test) BKE_particlesettings_make_local((ParticleSett
ings *)id); |
274 return 1; | 277 return 1; |
275 case ID_WM: | 278 case ID_WM: |
276 return 0; /* can't be linked */ | 279 return 0; /* can't be linked */ |
277 case ID_GD: | 280 case ID_GD: |
278 return 0; /* not implemented */ | 281 return 0; /* not implemented */ |
| 282 #ifdef WITH_FREESTYLE |
| 283 case ID_LS: |
| 284 return 0; /* not implemented */ |
| 285 #endif |
279 } | 286 } |
280 | 287 |
281 return 0; | 288 return 0; |
282 } | 289 } |
283 | 290 |
284 int id_copy(ID *id, ID **newid, int test) | 291 int id_copy(ID *id, ID **newid, int test) |
285 { | 292 { |
286 if (!test) *newid = NULL; | 293 if (!test) *newid = NULL; |
287 | 294 |
288 /* conventions: | 295 /* conventions: |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 case ID_PA: | 370 case ID_PA: |
364 if (!test) *newid = (ID *)BKE_particlesettings_copy((Par
ticleSettings *)id); | 371 if (!test) *newid = (ID *)BKE_particlesettings_copy((Par
ticleSettings *)id); |
365 return 1; | 372 return 1; |
366 case ID_WM: | 373 case ID_WM: |
367 return 0; /* can't be copied from here */ | 374 return 0; /* can't be copied from here */ |
368 case ID_GD: | 375 case ID_GD: |
369 return 0; /* not implemented */ | 376 return 0; /* not implemented */ |
370 case ID_MSK: | 377 case ID_MSK: |
371 if (!test) *newid = (ID *)BKE_mask_copy((Mask *)id); | 378 if (!test) *newid = (ID *)BKE_mask_copy((Mask *)id); |
372 return 1; | 379 return 1; |
| 380 #ifdef WITH_FREESTYLE |
| 381 case ID_LS: |
| 382 if(!test) *newid= (ID*)FRS_copy_linestyle((FreestyleLine
Style*)id); |
| 383 return 1; |
| 384 #endif |
373 } | 385 } |
374 ········ | 386 ········ |
375 return 0; | 387 return 0; |
376 } | 388 } |
377 | 389 |
378 int id_unlink(ID *id, int test) | 390 int id_unlink(ID *id, int test) |
379 { | 391 { |
380 Main *mainlib = G.main; | 392 Main *mainlib = G.main; |
381 ListBase *lb; | 393 ListBase *lb; |
382 | 394 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 case ID_PA: | 505 case ID_PA: |
494 return &(mainlib->particle); | 506 return &(mainlib->particle); |
495 case ID_WM: | 507 case ID_WM: |
496 return &(mainlib->wm); | 508 return &(mainlib->wm); |
497 case ID_GD: | 509 case ID_GD: |
498 return &(mainlib->gpencil); | 510 return &(mainlib->gpencil); |
499 case ID_MC: | 511 case ID_MC: |
500 return &(mainlib->movieclip); | 512 return &(mainlib->movieclip); |
501 case ID_MSK: | 513 case ID_MSK: |
502 return &(mainlib->mask); | 514 return &(mainlib->mask); |
| 515 #ifdef WITH_FREESTYLE |
| 516 case ID_LS: |
| 517 return &(mainlib->linestyle); |
| 518 #endif |
503 } | 519 } |
504 return NULL; | 520 return NULL; |
505 } | 521 } |
506 | 522 |
507 /* Flag all ids in listbase */ | 523 /* Flag all ids in listbase */ |
508 void flag_listbase_ids(ListBase *lb, short flag, short value) | 524 void flag_listbase_ids(ListBase *lb, short flag, short value) |
509 { | 525 { |
510 ID *id; | 526 ID *id; |
511 if (value) { | 527 if (value) { |
512 for (id = lb->first; id; id = id->next) id->flag |= flag; | 528 for (id = lb->first; id; id = id->next) id->flag |= flag; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 lb[a++] = &(main->speaker); | 593 lb[a++] = &(main->speaker); |
578 | 594 |
579 lb[a++] = &(main->world); | 595 lb[a++] = &(main->world); |
580 lb[a++] = &(main->screen); | 596 lb[a++] = &(main->screen); |
581 lb[a++] = &(main->object); | 597 lb[a++] = &(main->object); |
582 lb[a++] = &(main->scene); | 598 lb[a++] = &(main->scene); |
583 lb[a++] = &(main->library); | 599 lb[a++] = &(main->library); |
584 lb[a++] = &(main->wm); | 600 lb[a++] = &(main->wm); |
585 lb[a++] = &(main->movieclip); | 601 lb[a++] = &(main->movieclip); |
586 lb[a++] = &(main->mask); | 602 lb[a++] = &(main->mask); |
| 603 #ifdef WITH_FREESTYLE |
| 604 lb[a++] = &(main->linestyle); |
| 605 #endif |
587 ········ | 606 ········ |
588 lb[a] = NULL; | 607 lb[a] = NULL; |
589 | 608 |
590 return a; | 609 return a; |
591 } | 610 } |
592 | 611 |
593 /* *********** ALLOC AND FREE ***************** | 612 /* *********** ALLOC AND FREE ***************** |
594 * | 613 * |
595 * BKE_libblock_free(ListBase *lb, ID *id ) | 614 * BKE_libblock_free(ListBase *lb, ID *id ) |
596 * provide a list-basis and datablock, but only ID is read | 615 * provide a list-basis and datablock, but only ID is read |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 break; | 710 break; |
692 case ID_GD: | 711 case ID_GD: |
693 id = MEM_callocN(sizeof(bGPdata), "Grease Pencil"); | 712 id = MEM_callocN(sizeof(bGPdata), "Grease Pencil"); |
694 break; | 713 break; |
695 case ID_MC: | 714 case ID_MC: |
696 id = MEM_callocN(sizeof(MovieClip), "Movie Clip"); | 715 id = MEM_callocN(sizeof(MovieClip), "Movie Clip"); |
697 break; | 716 break; |
698 case ID_MSK: | 717 case ID_MSK: |
699 id = MEM_callocN(sizeof(Mask), "Mask"); | 718 id = MEM_callocN(sizeof(Mask), "Mask"); |
700 break; | 719 break; |
| 720 #ifdef WITH_FREESTYLE |
| 721 case ID_LS: |
| 722 id = MEM_callocN(sizeof(FreestyleLineStyle), "Freestyle
Line Style"); |
| 723 break; |
| 724 #endif |
701 } | 725 } |
702 return id; | 726 return id; |
703 } | 727 } |
704 | 728 |
705 /* used everywhere in blenkernel and text.c */ | 729 /* used everywhere in blenkernel and text.c */ |
706 void *BKE_libblock_alloc(ListBase *lb, short type, const char *name) | 730 void *BKE_libblock_alloc(ListBase *lb, short type, const char *name) |
707 { | 731 { |
708 ID *id = NULL; | 732 ID *id = NULL; |
709 ········ | 733 ········ |
710 id = alloc_libblock_notest(type); | 734 id = alloc_libblock_notest(type); |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 break; | 945 break; |
922 case ID_GD: | 946 case ID_GD: |
923 BKE_gpencil_free((bGPdata *)id); | 947 BKE_gpencil_free((bGPdata *)id); |
924 break; | 948 break; |
925 case ID_MC: | 949 case ID_MC: |
926 BKE_movieclip_free((MovieClip *)id); | 950 BKE_movieclip_free((MovieClip *)id); |
927 break; | 951 break; |
928 case ID_MSK: | 952 case ID_MSK: |
929 BKE_mask_free(bmain, (Mask *)id); | 953 BKE_mask_free(bmain, (Mask *)id); |
930 break; | 954 break; |
| 955 #ifdef WITH_FREESTYLE |
| 956 case ID_LS: |
| 957 FRS_free_linestyle((FreestyleLineStyle *)id); |
| 958 break; |
| 959 #endif |
931 } | 960 } |
932 | 961 |
933 BLI_remlink(lb, id); | 962 BLI_remlink(lb, id); |
934 | 963 |
935 BKE_libblock_free_data(id); | 964 BKE_libblock_free_data(id); |
936 | 965 |
937 MEM_freeN(id); | 966 MEM_freeN(id); |
938 } | 967 } |
939 | 968 |
940 void BKE_libblock_free_us(ListBase *lb, void *idv) /* test users */ | 969 void BKE_libblock_free_us(ListBase *lb, void *idv) /* test users */ |
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1595 if (BLI_path_is_rel(lib->filepath)) { | 1624 if (BLI_path_is_rel(lib->filepath)) { |
1596 /* note that the file may be unsaved, in this case, setting the | 1625 /* note that the file may be unsaved, in this case, setting the |
1597 * filepath on an indirectly linked path is not allowed from the | 1626 * filepath on an indirectly linked path is not allowed from the |
1598 * outliner, and its not really supported but allow from here fo
r now | 1627 * outliner, and its not really supported but allow from here fo
r now |
1599 * since making local could cause this to be directly linked - c
ampbell | 1628 * since making local could cause this to be directly linked - c
ampbell |
1600 */ | 1629 */ |
1601 const char *basepath = lib->parent ? lib->parent->filepath : G.m
ain->name; | 1630 const char *basepath = lib->parent ? lib->parent->filepath : G.m
ain->name; |
1602 BLI_path_abs(lib->filepath, basepath); | 1631 BLI_path_abs(lib->filepath, basepath); |
1603 } | 1632 } |
1604 } | 1633 } |
OLD | NEW |