Skip to main content
Inspiring
November 19, 2019
Question

sAIMatchingArt->GetMatchingArt() doesn't return kGroupArt

  • November 19, 2019
  • 1 reply
  • 892 views

I made a plugin to notify my extension when something got selected. But I didn't want to notify every time selection changed, just when something is in fact selected, so i used sAIMatchingArt->GetMatchingArt().

 

It works as expected except when groups or clippled objects are selected, even tho I included it them in the filter list.

 

I tried kAnyArt by itself, and it returns all objects but groupart. I also tried only kGroupArt and it returns abosuletly nothing.

ASErr SController::GetSelection(AIArtHandle ***matches, ai::int32 *numMatches){
	short types[]={
//		kAnyArt,
		kGroupArt,
		kPathArt,
		kCompoundPathArt,
		kMysteryPathArt,
		kTextFrameArt,
		kPlacedArt,
		kSymbolArt,
		kForeignArt,
		kRasterArt
		
	};
	   int size = sizeof(types) / sizeof(*types);
	   AIMatchingArtSpec *spec = new AIMatchingArtSpec[size];
	   for (int nIndex = 0; nIndex < size; nIndex++)
	   {
		   spec[nIndex].type = types[nIndex];
		   spec[nIndex].whichAttr = kArtFullySelected;
		   spec[nIndex].attr = kArtFullySelected;
	   }

	   ASErr result = sAIMatchingArt->GetMatchingArt(spec, size, matches, numMatches);
	   delete []spec;
	   if (result)
		   return result;
	   if (!*numMatches)
		   return kCanceledErr;
	   return kNoErr;
}

 

This topic has been closed for replies.

1 reply

mecdosAuthor
Inspiring
December 23, 2019

anything illustrator team? i know you are now on vacation but this has been up since november. a little effort please!

Gobra.Slo
Participant
March 2, 2020

Not a solution but a merely suggestion: try checking ai::ArtMatcher class from the SDK. It wraps low-level functionality, is documented and has methods to get selected art.

 

It probably has source code as well, as most wrapper classes do.