www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgfeaturenode/loadobj.m
function obj = loadobj(obj) %LOADOBJ Upgrade old versions of object % % OBJ = LOADOBJ(OBJ) is called when an object is loaded. % Copyright 2005 The MathWorks, Inc. if isstruct(obj) && ~isfield(obj, 'Version') % Add a post-load action to remove feature children that shouldn't be % there. The date number is datenum('15-Aug-2005'). hLoad = mbcloadrecorder('current'); hLoad.add({@i_fixchildren, address(obj.cgcontainer)}, 732539); % Add version field obj.Version = 2; end if isstruct(obj) obj = cgfeaturenode(obj); end function i_fixchildren(Proj, evt, pThisObj) % It is possible that the originating node for this action was deleted as % part of the cleanup of another node, so we need to check this is still a % valid featurenode pointer if isvalid(pThisObj) obj = info(pThisObj); if isa(obj, 'cgfeaturenode') upgradeV1ToV2(obj); end end