Index: OSGNFIOBase.cpp
===================================================================
RCS file: /cvsroot/opensg/OpenSG/Source/Experimental/NativeFileIO/OSGNFIOBase.cpp,v
retrieving revision 1.18
diff -u -r1.18 OSGNFIOBase.cpp
--- OSGNFIOBase.cpp	31 Aug 2008 10:30:35 -0000	1.18
+++ OSGNFIOBase.cpp	17 Oct 2011 12:20:30 -0000
@@ -868,11 +868,31 @@
     AttachmentMap::const_iterator   mapIt = amap->getValue().begin();
     AttachmentMap::const_iterator   mapEnd = amap->getValue().end();
     
-    UInt32 noe = amap->getValue().size();
-    _out->putValue(noe);
-
+	// count non-internal attachments
+	UInt32 noe = 0;
+	for(; mapIt != mapEnd; ++mapIt)
+    {
+		if( mapIt->second                              != NullFC &&
+			mapIt->second->getSFInternal()->getValue() == true     )
+		{
+			continue;
+		}
+		
+		++noe;
+	}
+    
+	_out->putValue(noe);
+	
+	mapIt = amap->getValue().begin();
     for(; mapIt != mapEnd; ++mapIt)
     {
+		// skip Attachments marked as internal
+		if( mapIt->second                              != NullFC &&
+			mapIt->second->getSFInternal()->getValue() == true     )
+		{
+			continue;
+		}
+
         writeFCId(mapIt->second);
     }
 
@@ -881,6 +901,13 @@
     mapIt = amap->getValue().begin();
     for(; mapIt != mapEnd; ++mapIt)
     {
+		// skip Attachments marked as internal
+		if( mapIt->second                              != NullFC &&
+			mapIt->second->getSFInternal()->getValue() == true     )
+		{
+			continue;
+		}
+
         id_binding = UInt16(mapIt->first & 0x0000ffff);
         if(id_binding != 0)
             break;
@@ -893,11 +920,17 @@
         mapIt = amap->getValue().begin();
         for(; mapIt != mapEnd; ++mapIt)
         {
+			// skip Attachments marked as internal
+			if( mapIt->second                              != NullFC &&
+				mapIt->second->getSFInternal()->getValue() == true     )
+			{
+				continue;
+			}
+
             id_binding = UInt16(mapIt->first & 0x0000ffff);
             _out->putValue(id_binding);
         }
     }
-
 }
 
 void NFIOBase::readEndMarker(void)

