SetArtUserAttr(art, kArtHidden, 0); not working in CS4
I have a CS3 plug-in that I have converted to CS4. Part of the process is that I hide text objects and save layers as PDF files. At the end of the process I want to show all the objects that I have hidden so that I can save as an Illustrator CS2 file for archiving. To do this I execute the following code by calling ShowAllArt(); below. The call to SetArtUserAttr works fine in CS3 so when I save as an Illustrator CS2 file and re-open the save file, all objects are visible. When I do the same in CS4, SetArtUserAttr returns kNoErr but on opening the Illustrator CS2 file, the text objects are still invisible in the layers palette. Is there something I should do in CS4 before I save (like sAIUtils->AppIdle();) ?
static void ShowAllArt (AIArtHandle inArt)
{
if (inArt)
{
sAIArt->SetArtUserAttr (inArt, kArtHidden, 0);
short type;
if (!sAIArt->GetArtType (inArt, &type))
{
if (type == kGroupArt)
{
AIArtHandle child;
if (!sAIArt->GetArtFirstChild (inArt, &child))
{
while (child)
{
ShowAllArt (child);
if (sAIArt->GetArtSibling (child, &child))
break;
}
}
}
}
}
}
static void ShowAllArt ()
{
AILayerHandle theLayer;
long count;
ReturnIfError (sLayer->CountLayers (&count));
for (long i = 0; i < count; ++i)
{
if (!sLayer->GetNthLayer (i, &theLayer))
{
if (theLayer)
{
sLayer->SetLayerVisible (theLayer, true);
sLayer->SetLayerIsTemplate (theLayer, false);
AIArtHandle art;
if (sAIArt->GetFirstArtOfLayer (theLayer, &art))
return;
while (art)
{
ShowAllArt (art);
ReturnIfError (sAIArt->GetArtSibling (art, &art));
}
}
}
}
}