PluginGroup and Envelope issues with CS3, 4 and 5
hi
i'm making plugin uses aiplugingroupsuite.
when select object in document make envelope. put envelope edit group of plugingroup object.
i've slider allows me modify final results. each time change value i'm rebuilding result group of plugingroup object.
i make copy envelope stored in edit group , put in result group of plugingroup object. move points of associated mesh of new envelope.
with cs3, 4 , 5 new envelope never modified. if expand plugingroup object new envelope appears correct position.
on cs6, plugin works properly.
can expect bug-fix @ least cs5 ?
it's quite easy reproduce bug. i've used livedropshadow example discover bug.
i've change append function , go update function
the goupdate function :
extern aierr goupdate( aiplugingroupmessage *message )
{
#define drop_shadow_offset 5
aierr result = knoerr;
aiarthandle plugin = message->art;
aiarthandle editart = null;
aiarthandle resultart = null;
unsigned long count = 0;
aiarthandle child;
aiarthandle dropshadowgroup;
aiarthandle duplicate;
// edit art
result = saiplugingroup->getpluginarteditart( plugin, &editart );
// result art
result = saiplugingroup->getpluginartresultart( plugin, &resultart );
//result = saiplugingroup->getpluginartdatacount( plugin, &count );
// destroy art exists below result art
result = saiart->getartfirstchild( resultart, &child );
while ( ( result == knoerr ) && ( child != null ) ) {
if ( result == knoerr ) {
result = saiart->disposeart( child );
}
if ( result == knoerr ) {
result = saiart->getartfirstchild( resultart, &child );
}
}
// build drop shadow group
if ( result == knoerr ) {
result = saiart->newart( kgroupart, kplaceinsideontop, resultart, &dropshadowgroup );
}
if ( result == knoerr ) {
result = saiart->getartfirstchild( editart, &child );
}
while ( ( result == knoerr ) && ( child != null ) ) {
result = saiart->duplicateart( child, kplaceinsideontop, dropshadowgroup, &duplicate );
result = saiart->getartsibling( child, &child );
}
if (saienvelope->isenvelope(duplicate)){
aiarthandle mesh;
result = saienvelope->getenvelopeobject(duplicate, &mesh);
long = 0, j = 0;
result = saimesh->getsize(mesh, &i, &j);
for(long = 0; <= i; ++i){
for(long j = 0; j <= j; ++j){
aimeshvertexiterator vertex;
result = saimesh->getnode(mesh, i, j, &vertex);
airealpoint point;
saimeshvertexiterator->getpoint(vertex, &point);
point.h -= 100;
point.v -= 100;
saimeshvertexiterator->setpoint(vertex, &point);
const int nbsegmentscount = saimeshvertexiterator->countsegments(vertex);
for(int k = 0 ; k < nbsegmentscount; ++k){
saimeshvertexiterator->gettangent(vertex, k, &point);
point.h -= 100;
point.v -= 100;
saimeshvertexiterator->settangent(vertex, k, &point);
}
}
}
}
return result;
}
and append function :
extern aierr appendplugingroup( aiarthandle *object, objectdata *data, aiarthandle path ) {
aierr result = knoerr;
aiarthandle editart = null;
if ( *object == null ) {
if ( result == knoerr ) {
result = editlensobject( data );
}
// create new kpluginart above selected art
if ( result == knoerr ) {
result = saiart->newart( kpluginart, kplaceabove, path, object );
}
if ( result == knoerr ) {
// register plugingroup
result = saiplugingroup->useaiplugingroup( *object, g->dsplugingrouphandle );
}
}
// unlock path put inside edit art object
if ( result == knoerr ) {
result = saiart->setartuserattr( path, kartlocked, kartlocked );
}
if ( result == knoerr ) {
result = saiart->setartuserattr( path, kartlocked, 0 );
}
if ( result == knoerr ) {
result = saiplugingroup->getpluginarteditart( *object, &editart );
}
if ( result == knoerr ) {
aiarthandle envelope;
result = saienvelope->makeenvelope(&path, 1, nil, nil, &envelope);
result = saiart->reorderart( envelope, kplaceinsideonbottom, editart );
}
return result;
}
this code makes translation of (-100, -100) on envelope of result group.
More discussions in Illustrator SDK
adobe
Comments
Post a Comment