Revision: 23506
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23506
Author:   campbellbarton
Date:     2009-09-27 10:54:58 +0200 (Sun, 27 Sep 2009)

Log Message:
-----------
updated for changes in readfile.c
demo's run again

Modified Paths:
--------------
    branches/ge_dyn_load/source/blender/blenloader/intern/readfile.c
    
branches/ge_dyn_load/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
    
branches/ge_dyn_load/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp

Modified: branches/ge_dyn_load/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/ge_dyn_load/source/blender/blenloader/intern/readfile.c    
2009-09-27 08:01:57 UTC (rev 23505)
+++ branches/ge_dyn_load/source/blender/blenloader/intern/readfile.c    
2009-09-27 08:54:58 UTC (rev 23506)
@@ -11057,7 +11057,7 @@
 /* this should probably be moved into the Python code anyway */
 /* tentatively removed, Python should be able to use the split functions too: 
*/
 /* BLO_library_append_begin, BLO_library_append_end, 
BLO_library_append_named_part */
-#if 1
+#if 0
 void BLO_script_library_append(BlendHandle **bh, char *dir, char *name, 
                int idcode, short flag, Main *mainvar, Scene *scene, ReportList 
*reports)
 {

Modified: 
branches/ge_dyn_load/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
===================================================================
--- 
branches/ge_dyn_load/source/gameengine/Converter/KX_BlenderSceneConverter.cpp   
    2009-09-27 08:01:57 UTC (rev 23505)
+++ 
branches/ge_dyn_load/source/gameengine/Converter/KX_BlenderSceneConverter.cpp   
    2009-09-27 08:54:58 UTC (rev 23506)
@@ -955,17 +955,12 @@
 }
 
 
-
-
-
-
-
-
 #include "KX_BlenderSceneConverter.h"
 #include "BL_BlenderDataConversion.h"
 #include "KX_MeshProxy.h"
 #include "RAS_MeshObject.h"
 extern "C" {
+       #include "BKE_context.h"
        #include "BLO_readfile.h"
        #include "BKE_report.h"
        #include "DNA_space_types.h"
@@ -997,55 +992,68 @@
 
        BlendHandle *bpy_openlib = NULL;        /* ptr to the open .blend file 
*/
        bpy_openlib = BLO_blendhandle_from_file( (char *)path );
+       ReportList reports;
 
        if(bpy_openlib==NULL) {
                printf( "could not open blendfile\n");
                return false;
        }
 
-       char *group, *name;
+       // XXX - new untested code!!! - after merge
+       LinkNode *l, *n, *names = NULL;
        int blocktype = 0;
-       LinkNode *l, *n, *names = NULL;
-       PyObject *list = NULL;
-
-       ReportList reports;
-       Scene *scene= NULL; /* scene CAN be null, its ok! */
-       //Main *maggie= (Main *)MEM_callocN( sizeof(Main), "Main");
-       //Main *maggie= GetMain();
-
        Main *maggie= (Main *)MEM_callocN( sizeof(Main), "BgeMain");
        GetMainDynamic().push_back(maggie);
+       // --   
+       
+       bContext *C= CTX_create();
+       CTX_data_main_set(C, m_maggie);
+       
+       Main *mainl= 0;
+       char group[GROUP_MAX];
+       int idcode;
+       short flag;
+       
 
-       BKE_reports_init(&reports, RPT_STORE);
+       idcode = BLO_idcode_from_name(group);
 
-       LinkNode *groups = BLO_blendhandle_get_linkable_groups( bpy_openlib );
-       for( l = groups; l; l = l->next ) {
-               blocktype = BLO_idcode_from_name((char *)l->link);
-
+       /* here appending/linking starts */
+       mainl = BLO_library_append_begin(C, &bpy_openlib, (char *)path);
+       {
+               BKE_reports_init(&reports, RPT_STORE);
+       
+               LinkNode *groups = BLO_blendhandle_get_linkable_groups( 
bpy_openlib );
+               for( l = groups; l; l = l->next ) {
+                       blocktype = BLO_idcode_from_name((char *)l->link);
+       
 //if(ID_ME==blocktype) {
 if(ID_SCE==blocktype) {
+       
+                       names = BLO_blendhandle_get_datablock_names( 
bpy_openlib, blocktype);
 
-               names = BLO_blendhandle_get_datablock_names( bpy_openlib, 
blocktype);
-
-
-               int i= 0;
-               for(n= names; n; n= n->next, i++) {
-                       BLO_script_library_append(&bpy_openlib, (char *)path, 
(char *)n->link, blocktype, FILE_LINK, maggie, scene, &reports); /* scene is 
NULL */
+                       int i= 0;
+                       for(n= names; n; n= n->next, i++) {
+                               BLO_library_append_named_part(C, mainl, 
&bpy_openlib, (char *)n->link, idcode, 0);
+                       }
+       
+                       BLI_linklist_free(names, free); /* free linklist *and* 
each node's data */
+}
                }
-
-               BLI_linklist_free(names, free); /* free linklist *and* each 
node's data */
-
-}
-
+               BLI_linklist_free(groups, free);        /* free linklist *and* 
each node's data */
+       
+               BKE_reports_clear(&reports);
        }
-       BLI_linklist_free(groups, free);        /* free linklist *and* each 
node's data */
-
+       BLO_library_append_end(C, mainl, &bpy_openlib, idcode, flag);
+       
+       BLO_blendhandle_close(bpy_openlib);
+       
+       CTX_free(C);
+       
+       /* needed for lookups*/
+       strncpy(maggie->name, path, sizeof(maggie->name));      
+       
        BKE_reports_clear(&reports);
-
-
-       /* needed for lookups*/
-       strncpy(maggie->name, path, sizeof(maggie->name));
-
+               
 #if 0
        ID* mesh;
        KX_Scene *kx_scene= m_currentScene;
@@ -1065,14 +1073,8 @@
 #endif
 
 
+       
 
-
-
-
-
-
-
-
        {
 
                ID *scene;

Modified: 
branches/ge_dyn_load/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
===================================================================
--- 
branches/ge_dyn_load/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp 
    2009-09-27 08:01:57 UTC (rev 23505)
+++ 
branches/ge_dyn_load/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp 
    2009-09-27 08:54:58 UTC (rev 23506)
@@ -433,7 +433,6 @@
                        body->removeConstraintRef(con);
                        //delete con; //might be kept by python 
KX_ConstraintWrapper
                }
-               
                m_dynamicsWorld->removeRigidBody(ctrl->GetRigidBody());
        } else
        {


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to