Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenkernel/intern/library.c')
-rw-r--r--source/blender/blenkernel/intern/library.c49
1 files changed, 48 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 4d158a6c26c..677a2922666 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -65,6 +65,7 @@
#include "DNA_node_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
+#include "DNA_speaker_types.h"
#include "DNA_sound_types.h"
#include "DNA_text_types.h"
#include "DNA_vfont_types.h"
@@ -108,6 +109,9 @@
#include "BKE_particle.h"
#include "BKE_gpencil.h"
#include "BKE_fcurve.h"
+#include "BKE_speaker.h"
+
+#include "RNA_access.h"
#ifdef WITH_PYTHON
#include "BPY_extern.h"
@@ -205,6 +209,9 @@ int id_make_local(ID *id, int test)
case ID_CA:
if(!test) make_local_camera((Camera*)id);
return 1;
+ case ID_SPK:
+ if(!test) make_local_speaker((Speaker*)id);
+ return 1;
case ID_IP:
return 0; /* deprecated */
case ID_KE:
@@ -287,6 +294,9 @@ int id_copy(ID *id, ID **newid, int test)
case ID_LA:
if(!test) *newid= (ID*)copy_lamp((Lamp*)id);
return 1;
+ case ID_SPK:
+ if(!test) *newid= (ID*)copy_speaker((Speaker*)id);
+ return 1;
case ID_CA:
if(!test) *newid= (ID*)copy_camera((Camera*)id);
return 1;
@@ -368,6 +378,34 @@ int id_unlink(ID *id, int test)
return 0;
}
+int id_single_user(bContext *C, ID *id, PointerRNA *ptr, PropertyRNA *prop)
+{
+ ID *newid = NULL;
+ PointerRNA idptr;
+
+ if (id) {
+ /* if property isn't editable, we're going to have an extra block hanging around until we save */
+ if (RNA_property_editable(ptr, prop)) {
+ if (id_copy(id, &newid, 0) && newid) {
+ /* copy animation actions too */
+ BKE_copy_animdata_id_action(id);
+ /* us is 1 by convention, but RNA_property_pointer_set
+ will also incremement it, so set it to zero */
+ newid->us= 0;
+
+ /* assign copy */
+ RNA_id_pointer_create(newid, &idptr);
+ RNA_property_pointer_set(ptr, prop, idptr);
+ RNA_property_update(C, ptr, prop);
+
+ return 1;
+ }
+ }
+ }
+
+ return 0;
+}
+
ListBase *which_libbase(Main *mainlib, short type)
{
switch( type ) {
@@ -409,6 +447,8 @@ ListBase *which_libbase(Main *mainlib, short type)
return &(mainlib->text);
case ID_SCRIPT:
return &(mainlib->script);
+ case ID_SPK:
+ return &(mainlib->speaker);
case ID_SO:
return &(mainlib->sound);
case ID_GR:
@@ -493,13 +533,14 @@ int set_listbasepointers(Main *main, ListBase **lb)
lb[a++]= &(main->latt);
lb[a++]= &(main->lamp);
lb[a++]= &(main->camera);
-
+
lb[a++]= &(main->text);
lb[a++]= &(main->sound);
lb[a++]= &(main->group);
lb[a++]= &(main->brush);
lb[a++]= &(main->script);
lb[a++]= &(main->particle);
+ lb[a++]= &(main->speaker);
lb[a++]= &(main->world);
lb[a++]= &(main->screen);
@@ -585,6 +626,9 @@ static ID *alloc_libblock_notest(short type)
case ID_SCRIPT:
//XXX id= MEM_callocN(sizeof(Script), "script");
break;
+ case ID_SPK:
+ id= MEM_callocN(sizeof(Speaker), "speaker");
+ break;
case ID_SO:
id= MEM_callocN(sizeof(bSound), "sound");
break;
@@ -788,6 +832,9 @@ void free_libblock(ListBase *lb, void *idv)
case ID_SCRIPT:
//XXX free_script((Script *)id);
break;
+ case ID_SPK:
+ free_speaker((Speaker *)id);
+ break;
case ID_SO:
sound_free((bSound*)id);
break;