Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
developer:multiversionuserdatasupport [2016/04/04]
sandy
developer:multiversionuserdatasupport [2016/04/04] (current)
sandy
Line 4: Line 4:
 > **Version:​** //Rhino 4// > **Version:​** //Rhino 4//
  
-The SaveAs feature in Rhino 4.0 can be used to write files that Rhino 3.0 can use.  By default, ​no plug-in user data will be saved when you save a V3 file from Rhino 4.0.  If you feel it is necessary, and you are willing to do some extra coding and lots of detailed testing, it is possible to round-trip plug-in user data between Rhino 3.0 and Rhino 4.0.+The SaveAs feature in Rhino 4.0 can be used to write files that Rhino 3.0 can use.  By default, plug-in user data is not saved when you save a V3 file from Rhino 4.0.  If you feel need this, and you are willing to do some extra coding and lots of detailed testing, it is possible to round-trip plug-in user data between Rhino 3.0 and Rhino 4.0.
  
 There are several approaches available. The one you choose depends on what you want to accomplish. There are several approaches available. The one you choose depends on what you want to accomplish.
Line 10: Line 10:
 **There is not a V3 version of the plug-in. ​ You want your V4 plug-in to be able to round-trip information through V3 files.** **There is not a V3 version of the plug-in. ​ You want your V4 plug-in to be able to round-trip information through V3 files.**
  
-  * In your V4 plug-in, override CRhinoPlugIn::​SaveAsV3() and return true.  This insures your V4 plug-in will save its information in V3 files. ​ Since the plug-in ​id and any object user data ids will not be recognized by V3, V3 will simply let the "​alien"​ information persist unchanged.+  * In your V4 plug-in, override CRhinoPlugIn::​SaveAsV3() and return true.  This insures your V4 plug-in will save its information in V3 files. ​ Since the plug-in ​ID and any object user data IDs will not be recognized by V3, V3 will simply let the "​alien"​ information persist unchanged.
  
 **There is a V3 version of the plug-in. ​ You want your V4 plug-in to be able to round-trip information through V3 files. ​ You do not want the V3 and V4 plug-ins to exchange information.** **There is a V3 version of the plug-in. ​ You want your V4 plug-in to be able to round-trip information through V3 files. ​ You do not want the V3 and V4 plug-ins to exchange information.**
  
   * In your V4 plug-in, override CRhinoPlugIn::​SaveAsV3() and return true.  This insures your V4 plug-in will save its information in V3 files.   * In your V4 plug-in, override CRhinoPlugIn::​SaveAsV3() and return true.  This insures your V4 plug-in will save its information in V3 files.
-  * Make certain your V4 plug-in id is not equal to your V3 plug-in ​id.  This insures the plug-ins will not attempt to read/write each other'​s document user data.+  * Make certain your V4 plug-in id is not equal to your V3 plug-in ​ID.  This insures the plug-ins will not attempt to read/write each other'​s document user data.
   * Make certain there are no shared ids in the ON_OBJECT_IMPLEMENT() macros or in the m_userdata_id fields in your V3 or V4 plug-ins. ​ This insures the plug-ins will not attempt to read/write each other'​s object user data.   * Make certain there are no shared ids in the ON_OBJECT_IMPLEMENT() macros or in the m_userdata_id fields in your V3 or V4 plug-ins. ​ This insures the plug-ins will not attempt to read/write each other'​s object user data.
  
Line 24: Line 24:
  
   * In your V4 plug-in, override CRhinoPlugIn::​SaveAsV3() and return true.  This insures your V4 plug-in will save its information in V3 files.   * In your V4 plug-in, override CRhinoPlugIn::​SaveAsV3() and return true.  This insures your V4 plug-in will save its information in V3 files.
-  * Make certain your V4 plug-in ​id is identical to the V3 plug-in ​id.  This insures the plug-ins will read/write the same document user data.+  * Make certain your V4 plug-in ​ID is identical to the V3 plug-in ​ID.  This insures the plug-ins will read/write the same document user data.
     * Make certain your V4 plug-in will read the document user data saved by your V3 plug-in. ​ To do this, run Rhino 3.0 with your V3 plug-in and save a V3 file.  Start Rhino 4.0 and put a debugger breakpoint on the first line of the V4 plug-in'​s ReadDocument() function. ​ Open the file you saved from Rhino 3.0.  Step through your V4 plug-in'​s ReadDocument() code line-by-line and make 100% sure it is reading exactly what the V3 plug-in wrote. Repeat this test with at least a dozen files containing different models and different amounts of V3 document user data.     * Make certain your V4 plug-in will read the document user data saved by your V3 plug-in. ​ To do this, run Rhino 3.0 with your V3 plug-in and save a V3 file.  Start Rhino 4.0 and put a debugger breakpoint on the first line of the V4 plug-in'​s ReadDocument() function. ​ Open the file you saved from Rhino 3.0.  Step through your V4 plug-in'​s ReadDocument() code line-by-line and make 100% sure it is reading exactly what the V3 plug-in wrote. Repeat this test with at least a dozen files containing different models and different amounts of V3 document user data.
-    * Make certain your V3 plug-in will read the document user data saved by your V4 plug-in. ​ To do this, run Rhino 4.0 with your V4 plug-in and use Rhino 4.0's SaveAs command to write a V3 file.  Start Rhino 3.0 and put a debugger breakpoint on the first line of the V3 plug-in'​s ReadDocument() function. ​ Open the V3 file you saved from Rhino 4.0.  Step through your V3 plug-in'​s ReadDocument() code line-by-line and make 100% sure it is reading exactly what the V4 plug-in wrote. Repeat this test with at least a dozen files containing different models and different amounts of V4 document user data.+    * Make certain your V3 plug-in will read the document user data saved by your V4 plug-in. ​ To do this, run Rhino 4.0 with your V4 plug-in and use Rhino 4.0'​s ​**SaveAs** command to write a V3 file.  Start Rhino 3.0 and put a debugger breakpoint on the first line of the V3 plug-in'​s ReadDocument() function. ​ Open the V3 file you saved from Rhino 4.0.  Step through your V3 plug-in'​s ReadDocument() code line-by-line and make 100% sure it is reading exactly what the V4 plug-in wrote. Repeat this test with at least a dozen files containing different models and different amounts of V4 document user data.
   * Make certain the class ids used in ON_OBJECT_IMPLEMENT and the values used in ON_UserData::​m_userdata_id exactly the same in your V3 and V4 plug-ins. ​ This insures the plug-ins will read/write each other'​s object user data.   * Make certain the class ids used in ON_OBJECT_IMPLEMENT and the values used in ON_UserData::​m_userdata_id exactly the same in your V3 and V4 plug-ins. ​ This insures the plug-ins will read/write each other'​s object user data.
     * Repeat the two tests described above except put the breakpoints in the Read(ON_BinaryArchive&​) functions of every single object user data class in your plug-ins.     * Repeat the two tests described above except put the breakpoints in the Read(ON_BinaryArchive&​) functions of every single object user data class in your plug-ins.
developer/multiversionuserdatasupport.txt ยท Last modified: 2016/04/04 by sandy