Revision: 15622
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15622
Author:   campbellbarton
Date:     2008-07-18 15:06:49 +0200 (Fri, 18 Jul 2008)

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

Modified Paths:
--------------
    branches/apricot/source/blender/python/api2_2x/doc/Render.py
    branches/apricot/source/blender/python/api2_2x/sceneRender.c
    branches/apricot/source/blender/src/editmesh.c
    branches/apricot/source/blender/src/editmesh_lib.c
    branches/apricot/source/blender/src/interface.c
    branches/apricot/source/gameengine/Ketsji/KX_Scene.cpp

Modified: branches/apricot/source/blender/python/api2_2x/doc/Render.py
===================================================================
--- branches/apricot/source/blender/python/api2_2x/doc/Render.py        
2008-07-18 13:05:15 UTC (rev 15621)
+++ branches/apricot/source/blender/python/api2_2x/doc/Render.py        
2008-07-18 13:06:49 UTC (rev 15622)
@@ -833,9 +833,7 @@
 
   def enableCropping(toggle):
     """
-    Enable/disable exclusion of border rendering from total image.
-    @type toggle: int
-    @param toggle: pass 1 for on / 0 for off
+    Deprecated: see the L{crop} attribute.
     """
 
   def setImageType(type):

Modified: branches/apricot/source/blender/python/api2_2x/sceneRender.c
===================================================================
--- branches/apricot/source/blender/python/api2_2x/sceneRender.c        
2008-07-18 13:05:15 UTC (rev 15621)
+++ branches/apricot/source/blender/python/api2_2x/sceneRender.c        
2008-07-18 13:06:49 UTC (rev 15622)
@@ -985,7 +985,7 @@
 /*     return M_Render_BitToggleInt( args, R_MOVIECROP,
                                      &self->renderContext->mode );
 */
-       printf("cropping option is now default, obsolete\n");
+       printf("obsolete: movie cropping option is now default\n");
        Py_RETURN_NONE;
 }
 

Modified: branches/apricot/source/blender/src/editmesh.c
===================================================================
--- branches/apricot/source/blender/src/editmesh.c      2008-07-18 13:05:15 UTC 
(rev 15621)
+++ branches/apricot/source/blender/src/editmesh.c      2008-07-18 13:06:49 UTC 
(rev 15622)
@@ -340,8 +340,9 @@
 #endif
        EM_remove_selection(efa, EDITFACE);
        
-       if (G.editMesh->act_face==efa)
-               EM_set_actFace(NULL);
+       if (G.editMesh->act_face==efa) {
+               EM_set_actFace( G.editMesh->faces.first == efa ? NULL : 
G.editMesh->faces.first);
+       }
                
        CustomData_em_free_block(&G.editMesh->fdata, &efa->data);
        if(efa->fast==0)
@@ -1062,7 +1063,7 @@
        EM_fgon_flags();
        
        if (EM_get_actFace(0)==NULL) {
-               EM_set_actFace(NULL); /* will use the first face, this is so we 
alwats have an active face */
+               EM_set_actFace( G.editMesh->faces.first ); /* will use the 
first face, this is so we alwats have an active face */
        }
                
        /* vertex coordinates change with cache edit, need to recalc */

Modified: branches/apricot/source/blender/src/editmesh_lib.c
===================================================================
--- branches/apricot/source/blender/src/editmesh_lib.c  2008-07-18 13:05:15 UTC 
(rev 15621)
+++ branches/apricot/source/blender/src/editmesh_lib.c  2008-07-18 13:06:49 UTC 
(rev 15622)
@@ -72,12 +72,7 @@
 /* this replaces the active flag used in uv/face mode */
 void EM_set_actFace(EditFace *efa)
 {
-       if (efa) {
-               G.editMesh->act_face = efa;
-       } else {
-               /* True or NULL if we have no faces, so we always have an 
active face */
-               G.editMesh->act_face = G.editMesh->faces.first;
-       }
+       G.editMesh->act_face = efa;
 }
 
 EditFace * EM_get_actFace(int sloppy)

Modified: branches/apricot/source/blender/src/interface.c
===================================================================
--- branches/apricot/source/blender/src/interface.c     2008-07-18 13:05:15 UTC 
(rev 15621)
+++ branches/apricot/source/blender/src/interface.c     2008-07-18 13:06:49 UTC 
(rev 15622)
@@ -5405,7 +5405,9 @@
                int getsizex, getsizey;
 
                bwin_getsize(win, &getsizex, &getsizey);
-               block->aspect= 2.0/( (getsizex)*block->winmat[0][0]);
+               /* TODO - investigate why block->winmat[0][0] is negative
+                * in the image view when viewRedrawForce is called */
+               block->aspect= 2.0/fabs( (getsizex)*block->winmat[0][0]);
        }
 
        uiSetCurFont(block, font);

Modified: branches/apricot/source/gameengine/Ketsji/KX_Scene.cpp
===================================================================
--- branches/apricot/source/gameengine/Ketsji/KX_Scene.cpp      2008-07-18 
13:05:15 UTC (rev 15621)
+++ branches/apricot/source/gameengine/Ketsji/KX_Scene.cpp      2008-07-18 
13:06:49 UTC (rev 15622)
@@ -509,6 +509,11 @@
 // hierarchy that's because first ALL bricks must exist in the new
 // replica of the hierarchy in order to make cross-links work properly
 // !
+// It is VERY important that the order of sensors and actuators in
+// the replicated object is preserved: it is is used to reconnect the logic.
+// This method is more robust then using the bricks name in case of complex 
+// group replication. The replication of logic bricks is done in 
+// SCA_IObject::ReParentLogic(), make sure it preserves the order of the 
bricks.
 void KX_Scene::ReplicateLogic(KX_GameObject* newobj)
 {
        // also relink the controller to sensors/actuators
@@ -531,37 +536,36 @@
                for (vector<SCA_ISensor*>::iterator its = 
linkedsensors.begin();!(its==linkedsensors.end());its++)
                {
                        SCA_ISensor* oldsensor = (*its);
-                       STR_String name = oldsensor->GetName();
-                       //find this name in the list
-                       SCA_ISensor* newsensor = newobj->FindSensor(name);
+                       SCA_IObject* oldsensorobj = oldsensor->GetParent();
+                       SCA_IObject* newsensorobj = NULL;
                
-                       if (newsensor)
+                       // the original owner of the sensor has been replicated?
+                       void **h_obj = 
m_map_gameobject_to_replica[oldsensorobj];
+                       if (h_obj)
+                               newsensorobj = (SCA_IObject*)(*h_obj);
+                       if (!newsensorobj)
                        {
-                               // relink this newsensor to the controller
-                               m_logicmgr->RegisterToSensor(cont,newsensor);
+                               // no, then the sensor points outside the 
hierachy, keep it the same
+                               m_logicmgr->RegisterToSensor(cont,oldsensor);
                        }
                        else
                        {
-                               // it can be linked somewhere in the hierarchy 
or...
-                               for (vector<KX_GameObject*>::iterator git = 
m_logicHierarchicalGameObjects.begin();
-                               
!(git==m_logicHierarchicalGameObjects.end());++git)
+                               // yes, then the new sensor has the same 
position
+                               SCA_SensorList& sensorlist = 
oldsensorobj->GetSensors();
+                               SCA_SensorList::iterator sit;
+                               SCA_ISensor* newsensor = NULL;
+                               int sensorpos;
+
+                               for (sensorpos=0, sit=sensorlist.begin(); 
sit!=sensorlist.end(); sit++, sensorpos++)
                                {
-                                       newsensor = (*git)->FindSensor(name);
-                                       if (newsensor)
+                                       if ((*sit) == oldsensor) 
+                                       {
+                                               newsensor = 
newsensorobj->GetSensors().at(sensorpos);
                                                break;
-                               } 
-
-                               if (newsensor)
-                               {
-                                       // relink this newsensor to the 
controller somewhere else within this
-                                       // hierarchy
-                                       
m_logicmgr->RegisterToSensor(cont,newsensor);
+                                       }
                                }
-                               else
-                               {
-                                       // must be an external sensor, so...
-                                       
m_logicmgr->RegisterToSensor(cont,oldsensor);
-                               }
+                               assert(newsensor != NULL);
+                               m_logicmgr->RegisterToSensor(cont,newsensor);
                        }
                }
                
@@ -569,38 +573,38 @@
                for (vector<SCA_IActuator*>::iterator ita = 
linkedactuators.begin();!(ita==linkedactuators.end());ita++)
                {
                        SCA_IActuator* oldactuator = (*ita);
-                       STR_String name = oldactuator->GetName();
-                       //find this name in the list
-                       SCA_IActuator* newactuator = newobj->FindActuator(name);
-                       if (newactuator)
+                       SCA_IObject* oldactuatorobj = oldactuator->GetParent();
+                       SCA_IObject* newactuatorobj = NULL;
+
+                       // the original owner of the sensor has been replicated?
+                       void **h_obj = 
m_map_gameobject_to_replica[oldactuatorobj];
+                       if (h_obj)
+                               newactuatorobj = (SCA_IObject*)(*h_obj);
+
+                       if (!newactuatorobj)
                        {
-                               // relink this newsensor to the controller
-                               
m_logicmgr->RegisterToActuator(cont,newactuator);
-                               
newactuator->SetUeberExecutePriority(m_ueberExecutionPriority);
+                               // no, then the sensor points outside the 
hierachy, keep it the same
+                               
m_logicmgr->RegisterToActuator(cont,oldactuator);
                        }
                        else
                        {
-                               // it can be linked somewhere in the hierarchy 
or...
-                               for (vector<KX_GameObject*>::iterator git = 
m_logicHierarchicalGameObjects.begin();
-                               
!(git==m_logicHierarchicalGameObjects.end());++git)
+                               // yes, then the new sensor has the same 
position
+                               SCA_ActuatorList& actuatorlist = 
oldactuatorobj->GetActuators();
+                               SCA_ActuatorList::iterator ait;
+                               SCA_IActuator* newactuator = NULL;
+                               int actuatorpos;
+
+                               for (actuatorpos=0, ait=actuatorlist.begin(); 
ait!=actuatorlist.end(); ait++, actuatorpos++)
                                {
-                                       newactuator= (*git)->FindActuator(name);
-                                       if (newactuator)
+                                       if ((*ait) == oldactuator) 
+                                       {
+                                               newactuator = 
newactuatorobj->GetActuators().at(actuatorpos);
                                                break;
-                               } 
-
-                               if (newactuator)
-                               {
-                                       // relink this actuator to the 
controller somewhere else within this
-                                       // hierarchy
-                                       
m_logicmgr->RegisterToActuator(cont,newactuator);
-                                       
newactuator->SetUeberExecutePriority(m_ueberExecutionPriority);
+                                       }
                                }
-                               else
-                               {
-                                       // must be an external actuator, so...
-                                       
m_logicmgr->RegisterToActuator(cont,oldactuator);
-                               }
+                               assert(newactuator != NULL);
+                               
m_logicmgr->RegisterToActuator(cont,newactuator);
+                               
newactuator->SetUeberExecutePriority(m_ueberExecutionPriority);
                        }
                }
        }
@@ -669,19 +673,22 @@
                }
                // don't replicate logic now: we assume that the objects in the 
group can have
                // logic relationship, even outside parent relationship
+               // In order to match 3D view, the position of groupobj is used 
as a 
+               // transformation matrix instead of the new position. This 
means that 
+               // the group reference point is 0,0,0
 
-               MT_Point3 newpos = groupobj->NodeGetWorldPosition();
-               replica->NodeSetLocalPosition(newpos);
-
-               MT_Matrix3x3 newori = groupobj->NodeGetWorldOrientation();
-               replica->NodeSetLocalOrientation(newori);
-       
                // get the rootnode's scale
-               MT_Vector3 newscale = 
groupobj->GetSGNode()->GetRootSGParent()->GetLocalScale();
-
+               MT_Vector3 newscale = groupobj->NodeGetWorldScaling();
                // set the replica's relative scale with the rootnode's scale
                replica->NodeSetRelativeScale(newscale);
 
+               MT_Matrix3x3 newori = groupobj->NodeGetWorldOrientation() * 
gameobj->NodeGetWorldOrientation();
+               replica->NodeSetLocalOrientation(newori);
+
+               MT_Point3 newpos = groupobj->NodeGetWorldPosition() + 
+                       newscale*(groupobj->NodeGetWorldOrientation() * 
gameobj->NodeGetWorldPosition());
+               replica->NodeSetLocalPosition(newpos);
+
                if (replica->GetPhysicsController())
                {
                        replica->GetPhysicsController()->setPosition(newpos);


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

Reply via email to