SetArtUserAttr(art, kArtHidden, 0); not working in CS4
i have cs3 plug-in have converted cs4. part of process hide text objects , save layers pdf files. @ end of process want show objects have hidden can save illustrator cs2 file archiving. execute following code calling showallart(); below. call setartuserattr works fine in cs3 when save illustrator cs2 file , re-open save file, objects visible. when same in cs4, setartuserattr returns knoerr on opening illustrator cs2 file, text objects still invisible in layers palette. there should in cs4 before 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 = 0; < 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));
}
}
}
}
}
i checked, , setartuserattr() still works expected in cs4, it's not function. kind of oddity regards timing when saving cs2, don't know.
btw, block:
while (art)
{
showallart (art);
returniferror (saiart->getartsibling (art, &art));
}
...is unnecesary. first art of every layer group represents layer. recursive function has taken care of top-level of art. can call showallart (art) , should whole layer. don't think cause problem, make run faster
alternately, if you're trying put document way before started operation, faster method undo changes using:
sundo->undochanges()
More discussions in Illustrator SDK
adobe
Comments
Post a Comment