* New users_logic property for Texts to find out which texts are used in a GE logic...
authorJoerg Mueller <nexyon@gmail.com>
Sat, 19 Jun 2010 10:47:24 +0000 (10:47 +0000)
committerJoerg Mueller <nexyon@gmail.com>
Sat, 19 Jun 2010 10:47:24 +0000 (10:47 +0000)
* Fixed a bug in KX_ObjectActuator where the fuzzy flags weren't updated when setting properties from within python.
* Moved do_versions_ipos_to_animato from blender.c to readfile.c, where it should be.
* Fixed a bug on file transitions with the GE when files have different FPS settings.

release/scripts/modules/bpy_types.py
source/blender/blenkernel/intern/blender.c
source/blender/blenloader/intern/readfile.c
source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
source/gameengine/Ketsji/KX_ObjectActuator.cpp

index f6090d76533030ee62c717b54cb3f73fbe28639d..b1c5429d4ba321cf6e272ad436d7e882d4fc1c5b 100644 (file)
@@ -531,6 +531,11 @@ class Text(bpy_types.ID):
         self.clear()
         self.write(string)
 
+    @property
+    def users_logic(self):
+        """Logic bricks that use this text"""
+        import bpy
+        return tuple(obj for obj in bpy.data.objects if self in [cont.text for cont in obj.game.controllers if cont.type == 'PYTHON'])
 
 import collections
 
index 046b8de2431e863c477c58969d0ec46004d9fd98..134d49cdf24e3d27b0eb392fae8c8670147e8b8d 100644 (file)
@@ -65,7 +65,6 @@
 #include "BKE_global.h"
 #include "BKE_idprop.h"
 #include "BKE_library.h"
-#include "BKE_ipo.h"
 #include "BKE_main.h"
 #include "BKE_node.h"
 #include "BKE_report.h"
@@ -287,10 +286,6 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, char *filename)
                //setscreen(G.curscreen);
        }
        
-       // XXX temporarily here
-       if(G.main->versionfile < 250)
-               do_versions_ipos_to_animato(G.main); // XXX fixme... complicated versionpatching
-       
        if(recover && bfd->filename[0] && G.relbase_valid) {
                /* in case of autosave or quit.blend, use original filename instead
                 * use relbase_valid to make sure the file is saved, else we get <memory2> in the filename */
index 3ec253f1003040b517e1ec276e893db0515a45a8..cff93978eff025339eb0585def1aba8b656bfb27 100644 (file)
 #include "BKE_sequencer.h"
 #include "BKE_texture.h" // for open_plugin_tex
 #include "BKE_utildefines.h" // SWITCH_INT DATA ENDB DNA1 O_BINARY GLOB USER TEST REND
-
+#include "BKE_ipo.h"
 #include "BKE_sound.h"
 
 //XXX #include "BIF_butspace.h" // badlevel, for do_versions, patching event codes
@@ -9734,11 +9734,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                        do_versions_gpencil_2_50(main, screen);
                }
                
-               /* old Animation System (using IPO's) needs to be converted to the new Animato system 
-                * (NOTE: conversion code in blenkernel/intern/ipo.c for now)
-                */
-               //do_versions_ipos_to_animato(main);
-               
                /* shader, composit and texture node trees have id.name empty, put something in
                 * to have them show in RNA viewer and accessible otherwise.
                 */
@@ -10930,6 +10925,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
        /* don't forget to set version number in blender.c! */
 }
 
+static void do_versions_after_linking(FileData *fd, Library *lib, Main *main)
+{
+       /* old Animation System (using IPO's) needs to be converted to the new Animato system
+        */
+       if(main->versionfile < 250)
+               do_versions_ipos_to_animato(main);
+}
+
 static void lib_link_all(FileData *fd, Main *main)
 {
        oldnewmap_sort(fd);
@@ -11076,6 +11079,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filename)
        blo_join_main(&fd->mainlist);
 
        lib_link_all(fd, bfd->main);
+       do_versions_after_linking(fd, NULL, bfd->main);
        lib_verify_nodetree(bfd->main, 1);
        fix_relpaths_library(fd->relabase, bfd->main); /* make all relative paths, relative to the open blend file */
        
index c916cdeb67c42f6791df7ea061cb0e8c3efc112f..a83ec7e132ff83103bef477ce6d8464a2aeb3eb5 100644 (file)
@@ -84,6 +84,7 @@ extern "C" {
 #include "BLI_blenlib.h"
 #include "BLO_readfile.h"
 #include "DNA_scene_types.h"
+#include "BKE_ipo.h"
        /***/
 
 #include "AUD_C-API.h"
@@ -120,7 +121,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
 {
        /* context values */
        struct wmWindow *win= CTX_wm_window(C);
-       struct Scene *scene= CTX_data_scene(C);
+       struct Scene *startscene= CTX_data_scene(C);
        struct Main* maggie1= CTX_data_main(C);
 
 
@@ -133,7 +134,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
        int exitrequested = KX_EXIT_REQUEST_NO_REQUEST;
        Main* blenderdata = maggie1;
 
-       char* startscenename = scene->id.name+2;
+       char* startscenename = startscene->id.name+2;
        char pathname[FILE_MAXDIR+FILE_MAXFILE], oldsce[FILE_MAXDIR+FILE_MAXFILE];
        STR_String exitstring = "";
        BlendFileData *bfd= NULL;
@@ -220,12 +221,12 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
 #endif
 
                //lock frame and camera enabled - storing global values
-               int tmp_lay= scene->lay;
-               Object *tmp_camera = scene->camera;
+               int tmp_lay= startscene->lay;
+               Object *tmp_camera = startscene->camera;
 
                if (v3d->scenelock==0){
-                       scene->lay= v3d->lay;
-                       scene->camera= v3d->camera;
+                       startscene->lay= v3d->lay;
+                       startscene->camera= v3d->camera;
                }
 
                // some blender stuff
@@ -246,7 +247,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
                }
                
                if(rv3d->persp==RV3D_CAMOB) {
-                       if(scene->gm.framing.type == SCE_GAMEFRAMING_BARS) { /* Letterbox */
+                       if(startscene->gm.framing.type == SCE_GAMEFRAMING_BARS) { /* Letterbox */
                                camzoom = 1.0f;
                        }
                        else {
@@ -317,22 +318,22 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
                        }
                }
 
-               Scene *blscene= bfd ? bfd->curscene : (Scene *)BLI_findstring(&blenderdata->scene, startscenename, offsetof(ID, name) + 2);
+               Scene *scene= bfd ? bfd->curscene : (Scene *)BLI_findstring(&blenderdata->scene, startscenename, offsetof(ID, name) + 2);
 
-               if (blscene)
+               if (scene)
                {
-                       int startFrame = blscene->r.cfra;
+                       int startFrame = scene->r.cfra;
                        ketsjiengine->SetAnimRecordMode(animation_record, startFrame);
                        
                        // Quad buffered needs a special window.
-                       if(blscene->gm.stereoflag == STEREO_ENABLED){
-                               if (blscene->gm.stereomode != RAS_IRasterizer::RAS_STEREO_QUADBUFFERED)
-                                       rasterizer->SetStereoMode((RAS_IRasterizer::StereoMode) blscene->gm.stereomode);
+                       if(scene->gm.stereoflag == STEREO_ENABLED){
+                               if (scene->gm.stereomode != RAS_IRasterizer::RAS_STEREO_QUADBUFFERED)
+                                       rasterizer->SetStereoMode((RAS_IRasterizer::StereoMode) scene->gm.stereomode);
 
-                               rasterizer->SetEyeSeparation(blscene->gm.eyeseparation);
+                               rasterizer->SetEyeSeparation(scene->gm.eyeseparation);
                        }
 
-                       rasterizer->SetBackColor(blscene->gm.framing.col[0], blscene->gm.framing.col[1], blscene->gm.framing.col[2], 0.0f);
+                       rasterizer->SetBackColor(scene->gm.framing.col[0], scene->gm.framing.col[1], scene->gm.framing.col[2], 0.0f);
                }
                
                if (exitrequested != KX_EXIT_REQUEST_QUIT_GAME)
@@ -361,19 +362,19 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
 
                        if(GPU_glsl_support())
                                useglslmat = true;
-                       else if(blscene->gm.matmode == GAME_MAT_GLSL)
+                       else if(scene->gm.matmode == GAME_MAT_GLSL)
                                usemat = false;
 
-            if(usemat && (blscene->gm.matmode != GAME_MAT_TEXFACE))
+                       if(usemat && (scene->gm.matmode != GAME_MAT_TEXFACE))
                                sceneconverter->SetMaterials(true);
-                       if(useglslmat && (blscene->gm.matmode == GAME_MAT_GLSL))
+                       if(useglslmat && (scene->gm.matmode == GAME_MAT_GLSL))
                                sceneconverter->SetGLSLMaterials(true);
                                        
                        KX_Scene* startscene = new KX_Scene(keyboarddevice,
                                mousedevice,
                                networkdevice,
                                startscenename,
-                               blscene,
+                               scene,
                                canvas);
 
 #ifndef DISABLE_PYTHON
@@ -383,13 +384,13 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
 #endif // DISABLE_PYTHON
 
                        //initialize Dome Settings
-                       if(blscene->gm.stereoflag == STEREO_DOME)
-                               ketsjiengine->InitDome(blscene->gm.dome.res, blscene->gm.dome.mode, blscene->gm.dome.angle, blscene->gm.dome.resbuf, blscene->gm.dome.tilt, blscene->gm.dome.warptext);
+                       if(scene->gm.stereoflag == STEREO_DOME)
+                               ketsjiengine->InitDome(scene->gm.dome.res, scene->gm.dome.mode, scene->gm.dome.angle, scene->gm.dome.resbuf, scene->gm.dome.tilt, scene->gm.dome.warptext);
 
                        // initialize 3D Audio Settings
-                       AUD_set3DSetting(AUD_3DS_SPEED_OF_SOUND, blscene->audio.speed_of_sound);
-                       AUD_set3DSetting(AUD_3DS_DOPPLER_FACTOR, blscene->audio.doppler_factor);
-                       AUD_set3DSetting(AUD_3DS_DISTANCE_MODEL, blscene->audio.distance_model);
+                       AUD_set3DSetting(AUD_3DS_SPEED_OF_SOUND, scene->audio.speed_of_sound);
+                       AUD_set3DSetting(AUD_3DS_DOPPLER_FACTOR, scene->audio.doppler_factor);
+                       AUD_set3DSetting(AUD_3DS_DISTANCE_MODEL, scene->audio.distance_model);
 
                        if (sceneconverter)
                        {
@@ -505,8 +506,8 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
                }
                //lock frame and camera enabled - restoring global values
                if (v3d->scenelock==0){
-                       scene->lay= tmp_lay;
-                       scene->camera= tmp_camera;
+                       startscene->lay= tmp_lay;
+                       startscene->camera= tmp_camera;
                }
 
                // set the cursor back to normal
index df071d50aa2e984df894680781a754f4fee44344..0d0cac3c084f53f9141f481f4b1ee05f800cd91f 100644 (file)
@@ -467,6 +467,8 @@ int KX_ObjectActuator::pyattr_set_linV(void *self_v, const KX_PYATTRIBUTE_DEF *a
        if (!PyVecTo(value, self->m_linear_velocity))
                return PY_SET_ATTR_FAIL;
 
+       self->UpdateFuzzyFlags();
+
        return PY_SET_ATTR_SUCCESS;
 }
 
@@ -481,6 +483,8 @@ int KX_ObjectActuator::pyattr_set_angV(void *self_v, const KX_PYATTRIBUTE_DEF *a
        if (!PyVecTo(value, self->m_angular_velocity))
                return PY_SET_ATTR_FAIL;
 
+       self->UpdateFuzzyFlags();
+
        return PY_SET_ATTR_SUCCESS;
 }