Revision: 15780
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15780
Author:   campbellbarton
Date:     2008-07-26 17:38:05 +0200 (Sat, 26 Jul 2008)

Log Message:
-----------
svn merge -r15774:HEAD https://svn.blender.org/svnroot/bf-blender/trunk/blender

Modified Paths:
--------------
    branches/apricot/source/blender/blenkernel/bad_level_call_stubs/stubs.c
    branches/apricot/source/blender/src/drawgpencil.c
    branches/apricot/source/blender/src/gpencil.c
    branches/apricot/source/blender/src/sequence.c
    branches/apricot/source/gameengine/Converter/BL_BlenderDataConversion.cpp
    branches/apricot/source/gameengine/GameLogic/SCA_LogicManager.cpp
    branches/apricot/source/gameengine/GameLogic/SCA_LogicManager.h
    branches/apricot/source/gameengine/Ketsji/KX_Scene.cpp

Modified: 
branches/apricot/source/blender/blenkernel/bad_level_call_stubs/stubs.c
===================================================================
--- branches/apricot/source/blender/blenkernel/bad_level_call_stubs/stubs.c     
2008-07-26 12:54:03 UTC (rev 15779)
+++ branches/apricot/source/blender/blenkernel/bad_level_call_stubs/stubs.c     
2008-07-26 15:38:05 UTC (rev 15780)
@@ -350,7 +350,6 @@
 
 /* editseq.c */
 Sequence *get_forground_frame_seq(int frame){return 0;};
-void set_last_seq(Sequence *seq){};
 void clear_last_seq(Sequence *seq){};
     
 

Modified: branches/apricot/source/blender/src/drawgpencil.c
===================================================================
--- branches/apricot/source/blender/src/drawgpencil.c   2008-07-26 12:54:03 UTC 
(rev 15779)
+++ branches/apricot/source/blender/src/drawgpencil.c   2008-07-26 15:38:05 UTC 
(rev 15780)
@@ -228,6 +228,10 @@
                        /* stroke thickness */
                        uiDefButS(block, NUMSLI, B_REDR, "Thickness:",  *xco, 
*yco-75, 150, 20, &gpl->thickness, 1, 10, 0, 0, "Thickness of strokes (in 
pixels)");
                        
+                       /* debugging options */
+                       if (G.f & G_DEBUG) {
+                               uiDefButBitI(block, TOG, GP_LAYER_DRAWDEBUG, 
B_REDR, "Show Points", *xco, *yco-95, 150, 20, &gpl->flag, 0, 0, 0, 0, "Show 
points which form the strokes");
+                       }
                        
                        /* onion-skinning */
                        uiBlockBeginAlign(block);
@@ -243,8 +247,6 @@
                                but= uiDefBut(block, BUT, B_REDR, "Del Last 
Stroke", *xco+160, *yco-95, 140, 20, NULL, 0, 0, 0, 0, "Erases the last stroke 
from the active frame (Hotkey = Alt-XKEY/DEL)");
                                uiButSetFunc(but, gp_ui_delstroke_cb, gpd, gpl);
                        uiBlockEndAlign(block);
-                       
-                       //uiDefButBitI(block, TOG, GP_LAYER_DRAWDEBUG, B_REDR, 
"Show Points", *xco+160, *yco-75, 130, 20, &gpl->flag, 0, 0, 0, 0, "Show points 
which form the strokes");
                }
        }
        
@@ -425,32 +427,8 @@
        glColor4f(color[0], color[1], color[2], color[3]);
        
        for (gps= gpf->strokes.first; gps; gps= gps->next) {    
-               /* handle 'eraser' strokes differently */
-               if (gps->flag & GP_STROKE_ERASER) {
-                       // FIXME: this method is a failed experiment
-#if 0
-                       /* draw stroke twice, first time with 'white' to set a 
mask to invert
-                        * contents of framebuffer, then second-time the same 
again but to restore
-                        * the contents
-                        */
-                       glEnable(GL_COLOR_LOGIC_OP); 
-                       glLogicOp(GL_XOR);
-                       
-                       glColor4f(1, 1, 1, 1); /* white */
-                       
-                       gp_draw_stroke(gps->points, gps->totpoints, lthick, 
dflag, gps->flag, 0, winx, winy);
-                       gp_draw_stroke(gps->points, gps->totpoints, lthick, 
dflag, gps->flag, 0, winx, winy);
-                       
-                       glDisable(GL_COLOR_LOGIC_OP);
-                       
-                       /* reset color for drawing next stroke */
-                       glColor4f(color[0], color[1], color[2], color[3]);
-#endif
-               }
-               else {
-                       /* just draw the stroke once */
-                       gp_draw_stroke(gps->points, gps->totpoints, lthick, 
dflag, gps->flag, debug, winx, winy);
-               }
+               /* just draw the stroke once */
+               gp_draw_stroke(gps->points, gps->totpoints, lthick, dflag, 
gps->flag, debug, winx, winy);
        }
 }
 

Modified: branches/apricot/source/blender/src/gpencil.c
===================================================================
--- branches/apricot/source/blender/src/gpencil.c       2008-07-26 12:54:03 UTC 
(rev 15779)
+++ branches/apricot/source/blender/src/gpencil.c       2008-07-26 15:38:05 UTC 
(rev 15780)
@@ -662,8 +662,14 @@
 /* ---------- 'Globals' and Defines ----------------- */
 
 /* maximum sizes of gp-session buffer */
-#define GP_STROKE_BUFFER_MAX   5000    
+#define GP_STROKE_BUFFER_MAX   5000
 
+       /* 'Hardcoded' sensitivity thresholds... */
+/* minimum number of pixels mouse should move before new point created */
+#define MIN_MMOVE_PX           3       
+/* minimum length of new segment before new point can be added */
+#define MIN_MDIST_PX           20
+
 /* ------ */
 
 /* Temporary 'Stroke' Operation data */
@@ -877,8 +883,27 @@
        }
 }
 
+/* check if the current mouse position is suitable for adding a new point */
+static short gp_stroke_filtermval (tGPsdata *p, short mval[2], short pmval[2])
+{
+       short dx= abs(mval[0] - pmval[0]);
+       short dy= abs(mval[1] - pmval[1]);
+       
+       /* check if mouse moved at least certain distance on both axes (best 
case) */
+       if ((dx > MIN_MMOVE_PX) && (dy > MIN_MMOVE_PX))
+               return 1;
+       
+       /* check if the distance since the last point is significant enough */
+       else if (sqrt(dx*dx + dy*dy) > MIN_MDIST_PX)
+               return 1;
+       
+       /* mouse 'didn't move' */
+       else
+               return 0;
+}
+
 /* add current stroke-point to buffer (returns whether point was successfully 
added) */
-static short gp_stroke_addpoint (tGPsdata *p, short mval[], float pressure)
+static short gp_stroke_addpoint (tGPsdata *p, short mval[2], float pressure)
 {
        bGPdata *gpd= p->gpd;
        bGPDspoint *pt;
@@ -913,6 +938,9 @@
        bGPdata *gpd= p->gpd;
        int i=0, cmx=gpd->sbuffer_size;
        
+       // fixme: currently disabled as it damages too much sometimes
+       return;
+       
        /* don't try if less than 2 points in buffer */
        if ((cmx <= 2) || (gpd->sbuffer == NULL))
                return;
@@ -1033,11 +1061,17 @@
 /* finish off a stroke (clears buffer, but doesn't finish the paint operation) 
*/
 static void gp_paint_strokeend (tGPsdata *p)
 {
-       /* sanitize stroke-points in buffer */
+       /* sanitize stroke-points in buffer (remove jitter) */
        gp_stroke_smooth(p);
        
-       /* transfer stroke to frame */
-       gp_stroke_newfrombuffer(p);
+       /* check if doing eraser or not */
+       if (p->gpd->sbuffer_sflag & GP_STROKE_ERASER) {
+               /* get rid of relevant sections of strokes */
+       }
+       else {
+               /* transfer stroke to frame */
+               gp_stroke_newfrombuffer(p);
+       }
        
        /* clean up buffer now */
        gp_session_validatebuffer(p);
@@ -1110,7 +1144,7 @@
                pressure = get_pressure();
                
                /* only add current point to buffer if mouse moved (otherwise 
wait until it does) */
-               if ((mval[0] != prevmval[0]) || (mval[1] != prevmval[1])) {
+               if (gp_stroke_filtermval(&p, mval, prevmval)) {
                        /* try to add point */
                        ok= gp_stroke_addpoint(&p, mval, pressure);
                        

Modified: branches/apricot/source/blender/src/sequence.c
===================================================================
--- branches/apricot/source/blender/src/sequence.c      2008-07-26 12:54:03 UTC 
(rev 15779)
+++ branches/apricot/source/blender/src/sequence.c      2008-07-26 15:38:05 UTC 
(rev 15780)
@@ -1473,8 +1473,8 @@
                dy = sy;
 
                if (seq->flag & SEQ_USE_TRANSFORM) {
-                       dx = seqrectx;
-                       dy = seqrecty;
+                       dx = G.scene->r.xsch;
+                       dy = G.scene->r.ysch;
                }
 
                if (c.top + c.bottom >= se->ibuf->y ||

Modified: 
branches/apricot/source/gameengine/Converter/BL_BlenderDataConversion.cpp
===================================================================
--- branches/apricot/source/gameengine/Converter/BL_BlenderDataConversion.cpp   
2008-07-26 12:54:03 UTC (rev 15779)
+++ branches/apricot/source/gameengine/Converter/BL_BlenderDataConversion.cpp   
2008-07-26 15:38:05 UTC (rev 15780)
@@ -1958,8 +1958,8 @@
                        // needed for python scripting
                        
logicmgr->RegisterGameObjectName(gameobj->GetName(),gameobj);
 
-                       // needed for dynamic object morphing
-                       logicmgr->RegisterGameObj(gameobj, blenderobject);
+                       // needed for group duplication
+                       logicmgr->RegisterGameObj(blenderobject, gameobj);
                        for (int i = 0; i < gameobj->GetMeshCount(); i++)
                                
logicmgr->RegisterGameMeshName(gameobj->GetMesh(i)->GetName(), blenderobject);
        
@@ -1981,8 +1981,6 @@
                                gameobj->NodeUpdateGS(0,true);
                                gameobj->Bucketize();
                
-                               if (gameobj->IsDupliGroup())
-                                       
grouplist.insert(blenderobject->dup_group);
                        }
                        else
                        {
@@ -1990,6 +1988,8 @@
                                //at the end of this function if it is not a 
root object
                                inactivelist->Add(gameobj->AddRef());
                        }
+                       if (gameobj->IsDupliGroup())
+                               grouplist.insert(blenderobject->dup_group);
                        if (converter->addInitFromFrame){
                                gameobj->NodeSetLocalPosition(posPrev);
                                gameobj->NodeSetLocalOrientation(angor);
@@ -2040,7 +2040,7 @@
                                                                                
                                blenderscene);
                                                                                
                                                // this code is copied from 
above except that
-                                               // object from groups are never 
is active layer
+                                               // object from groups are never 
in active layer
                                                bool isInActiveLayer = false;
                                                bool addobj=true;
                                                
@@ -2138,8 +2138,8 @@
                                                        // needed for python 
scripting
                                                        
logicmgr->RegisterGameObjectName(gameobj->GetName(),gameobj);
 
-                                                       // needed for dynamic 
object morphing
-                                                       
logicmgr->RegisterGameObj(gameobj, blenderobject);
+                                                       // needed for group 
duplication
+                                                       
logicmgr->RegisterGameObj(blenderobject, gameobj);
                                                        for (int i = 0; i < 
gameobj->GetMeshCount(); i++)
                                                                
logicmgr->RegisterGameMeshName(gameobj->GetMesh(i)->GetName(), blenderobject);
                                        

Modified: branches/apricot/source/gameengine/GameLogic/SCA_LogicManager.cpp
===================================================================
--- branches/apricot/source/gameengine/GameLogic/SCA_LogicManager.cpp   
2008-07-26 12:54:03 UTC (rev 15779)
+++ branches/apricot/source/gameengine/GameLogic/SCA_LogicManager.cpp   
2008-07-26 15:38:05 UTC (rev 15780)
@@ -127,13 +127,18 @@
 
 
 
-void SCA_LogicManager::RegisterGameObj(CValue* gameobj, void* blendobj) 
+void SCA_LogicManager::RegisterGameObj(void* blendobj, CValue* gameobj) 
 {
-       m_map_gameobj_to_blendobj.insert(CHashedPtr(gameobj), blendobj);
+       m_map_blendobj_to_gameobj.insert(CHashedPtr(blendobj), gameobj);
 }
 
+void SCA_LogicManager::UnregisterGameObj(void* blendobj, CValue* gameobj) 
+{
+       void **obp = m_map_blendobj_to_gameobj[CHashedPtr(blendobj)];
+       if (obp && (CValue*)(*obp) == gameobj)
+               m_map_blendobj_to_gameobj.remove(CHashedPtr(blendobj));
+}
 
-
 CValue* SCA_LogicManager::GetGameObjectByName(const STR_String& gameobjname)
 {
        STR_HashedString mn = "OB"+gameobjname;
@@ -146,10 +151,10 @@
 }
 
 
-void* SCA_LogicManager::FindBlendObjByGameObj(CValue* gameobject) 
+CValue* SCA_LogicManager::FindGameObjByBlendObj(void* blendobj) 
 {
-       void **obp= m_map_gameobj_to_blendobj[CHashedPtr(gameobject)];
-       return obp?*obp:NULL;
+       void **obp= m_map_blendobj_to_gameobj[CHashedPtr(blendobj)];
+       return obp?(CValue*)(*obp):NULL;
 }
 
 

Modified: branches/apricot/source/gameengine/GameLogic/SCA_LogicManager.h
===================================================================
--- branches/apricot/source/gameengine/GameLogic/SCA_LogicManager.h     
2008-07-26 12:54:03 UTC (rev 15779)
+++ branches/apricot/source/gameengine/GameLogic/SCA_LogicManager.h     
2008-07-26 15:38:05 UTC (rev 15780)
@@ -109,7 +109,7 @@
        GEN_Map<STR_HashedString,void*>         m_mapStringToActions;
 
        GEN_Map<STR_HashedString,void*>         m_map_gamemeshname_to_blendobj;

@@ Diff output truncated at 10240 characters. @@

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

Reply via email to