Index: trunk/src/lib/coord/p_node.cc
===================================================================
--- trunk/src/lib/coord/p_node.cc	(revision 6780)
+++ trunk/src/lib/coord/p_node.cc	(revision 6815)
@@ -1077,5 +1077,5 @@
   SYNCHELP_READ_BEGIN();
 
-  SYNCHELP_READ_FKT( BaseObject::writeState );
+  SYNCHELP_READ_FKT( BaseObject::writeState, NWT_PN_BO_WRITESTATE );
 
 //   char * parentName = NULL;
@@ -1094,19 +1094,19 @@
 
   int parentMode;
-  SYNCHELP_READ_INT( parentMode );
+  SYNCHELP_READ_INT( parentMode, NWT_PN_PARENTMODE );
   this->setParentMode((PARENT_MODE)parentMode);
 
   float f1, f2, f3, f4;
 
-  SYNCHELP_READ_FLOAT( f1 );
-  SYNCHELP_READ_FLOAT( f2 );
-  SYNCHELP_READ_FLOAT( f3 );
+  SYNCHELP_READ_FLOAT( f1, NWT_PN_COORX );
+  SYNCHELP_READ_FLOAT( f2, NWT_PN_COORY );
+  SYNCHELP_READ_FLOAT( f3, NWT_PN_COORZ );
   this->setRelCoor( f1, f2, f3 );
 
 
-  SYNCHELP_READ_FLOAT( f1 );
-  SYNCHELP_READ_FLOAT( f2 );
-  SYNCHELP_READ_FLOAT( f3 );
-  SYNCHELP_READ_FLOAT( f4 );
+  SYNCHELP_READ_FLOAT( f1, NWT_PN_ROTV );
+  SYNCHELP_READ_FLOAT( f2, NWT_PN_ROTX );
+  SYNCHELP_READ_FLOAT( f3, NWT_PN_ROTY );
+  SYNCHELP_READ_FLOAT( f4, NWT_PN_ROTZ );
   this->setRelDir( Quaternion( Vector(f2, f3, f4), f1 ) );
 
@@ -1140,5 +1140,5 @@
   SYNCHELP_WRITE_BEGIN();
 
-  SYNCHELP_WRITE_FKT( BaseObject::readState );
+  SYNCHELP_WRITE_FKT( BaseObject::readState, NWT_PN_BO_WRITESTATE );
 
 //   if ( this->parent )
@@ -1151,14 +1151,14 @@
 //   }
 
-  SYNCHELP_WRITE_INT( this->parentMode );
-
-  SYNCHELP_WRITE_FLOAT( this->relCoordinate.x );
-  SYNCHELP_WRITE_FLOAT( this->relCoordinate.y );
-  SYNCHELP_WRITE_FLOAT( this->relCoordinate.z );
-
-  SYNCHELP_WRITE_FLOAT( this->relDirection.w );
-  SYNCHELP_WRITE_FLOAT( this->relDirection.v.x );
-  SYNCHELP_WRITE_FLOAT( this->relDirection.v.y );
-  SYNCHELP_WRITE_FLOAT( this->relDirection.v.z );
+  SYNCHELP_WRITE_INT( this->parentMode, NWT_PN_PARENTMODE );
+
+  SYNCHELP_WRITE_FLOAT( this->relCoordinate.x, NWT_PN_COORX );
+  SYNCHELP_WRITE_FLOAT( this->relCoordinate.y, NWT_PN_COORY );
+  SYNCHELP_WRITE_FLOAT( this->relCoordinate.z, NWT_PN_COORZ );
+
+  SYNCHELP_WRITE_FLOAT( this->relDirection.w, NWT_PN_ROTV );
+  SYNCHELP_WRITE_FLOAT( this->relDirection.v.x, NWT_PN_ROTX );
+  SYNCHELP_WRITE_FLOAT( this->relDirection.v.y, NWT_PN_ROTY );
+  SYNCHELP_WRITE_FLOAT( this->relDirection.v.z, NWT_PN_ROTZ );
 
 //   int n = children.size();
@@ -1209,5 +1209,5 @@
 
   byte flags = 0;
-  SYNCHELP_READ_BYTE( flags );
+  SYNCHELP_READ_BYTE( flags, NWT_PN_FLAGS );
   //PRINTF(0)("%s::FLAGS = %d\n", this->getName(), flags);
 
@@ -1216,7 +1216,7 @@
   if ( flags & __FLAG_COOR )
   {
-    SYNCHELP_READ_FLOAT( f1 );
-    SYNCHELP_READ_FLOAT( f2 );
-    SYNCHELP_READ_FLOAT( f3 );
+    SYNCHELP_READ_FLOAT( f1, NWT_PN_SCOORX );
+    SYNCHELP_READ_FLOAT( f2, NWT_PN_SCOORY );
+    SYNCHELP_READ_FLOAT( f3, NWT_PN_SCOORZ );
     PRINTF(0)("RCVD COOR: %f %f %f\n", f1, f2, f3);
     this->setRelCoor( f1, f2, f3 );
@@ -1225,8 +1225,8 @@
   if ( flags & __FLAG_ROT )
   {
-    SYNCHELP_READ_FLOAT( f1 );
-    SYNCHELP_READ_FLOAT( f2 );
-    SYNCHELP_READ_FLOAT( f3 );
-    SYNCHELP_READ_FLOAT( f4 );
+    SYNCHELP_READ_FLOAT( f1, NWT_PN_SROTV );
+    SYNCHELP_READ_FLOAT( f2, NWT_PN_SROTX );
+    SYNCHELP_READ_FLOAT( f3, NWT_PN_SROTY );
+    SYNCHELP_READ_FLOAT( f4, NWT_PN_SROTZ );
     PRINTF(0)("RCVD QUAT: %f %f %f %f\n", f1, f2, f3, f4);
     //this->setRelDir( Quaternion( Vector(f2, f3, f4), f1 ) );
@@ -1250,4 +1250,5 @@
 int PNode::readSync( byte * data, int maxLength )
 {
+  //WARNING: if you change this file make sure you also change needsReadSync
   SYNCHELP_WRITE_BEGIN();
 
@@ -1270,5 +1271,5 @@
 
 
-  SYNCHELP_WRITE_BYTE( flags );
+  SYNCHELP_WRITE_BYTE( flags, NWT_PN_FLAGS );
   //PRINTF(0)("FLAGS = %d\n", flags);
 
@@ -1276,9 +1277,9 @@
   {
 
-    PRINTF(0)("SEND COOR: %f %f %f\n", this->relCoordinate.x, this->relCoordinate.y, this->relCoordinate.z);
-
-    SYNCHELP_WRITE_FLOAT( this->relCoordinate.x );
-    SYNCHELP_WRITE_FLOAT( this->relCoordinate.y );
-    SYNCHELP_WRITE_FLOAT( this->relCoordinate.z );
+    //PRINTF(0)("SEND COOR: %f %f %f\n", this->relCoordinate.x, this->relCoordinate.y, this->relCoordinate.z);
+
+    SYNCHELP_WRITE_FLOAT( this->relCoordinate.x, NWT_PN_SCOORX );
+    SYNCHELP_WRITE_FLOAT( this->relCoordinate.y, NWT_PN_SCOORY );
+    SYNCHELP_WRITE_FLOAT( this->relCoordinate.z, NWT_PN_SCOORZ );
 
     coorx = relCoordinate.x;
@@ -1290,10 +1291,10 @@
   {
 
-    PRINTF(0)("SEND QUAT: %f %f %f %f\n", this->absDirection.w, this->absDirection.v.x, this->absDirection.v.y, this->absDirection.v.z);
-
-    SYNCHELP_WRITE_FLOAT( this->absDirection.w );
-    SYNCHELP_WRITE_FLOAT( this->absDirection.v.x );
-    SYNCHELP_WRITE_FLOAT( this->absDirection.v.y );
-    SYNCHELP_WRITE_FLOAT( this->absDirection.v.z );
+    //PRINTF(0)("SEND QUAT: %f %f %f %f\n", this->absDirection.w, this->absDirection.v.x, this->absDirection.v.y, this->absDirection.v.z);
+
+    SYNCHELP_WRITE_FLOAT( this->absDirection.w, NWT_PN_SROTV );
+    SYNCHELP_WRITE_FLOAT( this->absDirection.v.x, NWT_PN_SROTX );
+    SYNCHELP_WRITE_FLOAT( this->absDirection.v.y, NWT_PN_SROTY );
+    SYNCHELP_WRITE_FLOAT( this->absDirection.v.z, NWT_PN_SROTZ );
 
     rotw = absDirection.w;
@@ -1305,2 +1306,18 @@
   return SYNCHELP_WRITE_N;
 }
+
+bool PNode::needsReadSync( )
+{
+  if ( fabs( coorx - relCoordinate.x ) > __OFFSET_POS ||
+       fabs( coory - relCoordinate.y ) > __OFFSET_POS ||
+       fabs( coorz - relCoordinate.z ) > __OFFSET_POS )
+    return true;
+
+  if ( fabs( rotw - absDirection.w ) > __OFFSET_ROT ||
+       fabs( rotx - absDirection.v.x ) > __OFFSET_ROT ||
+       fabs( roty - absDirection.v.y ) > __OFFSET_ROT ||
+       fabs( rotz - absDirection.v.z ) > __OFFSET_ROT )
+    return true;
+  
+  return false;
+}
Index: trunk/src/lib/coord/p_node.h
===================================================================
--- trunk/src/lib/coord/p_node.h	(revision 6780)
+++ trunk/src/lib/coord/p_node.h	(revision 6815)
@@ -190,4 +190,5 @@
   int       writeSync(const byte* data, int length, int sender);
   int       readSync(byte* data, int maxLength );
+  bool      needsReadSync();
 
  private:
