Highlighted

Find the selected path vertex of a shape layer using the SDK

New Here ,
Apr 16, 2020

Copy link to clipboard

Copied

Hi,
Is it possible to retrieve the index of the selected vertex in a shape layer path ? I mean, using the AEGP API.

I've noticed the type of a collection item can be either (AEGP_CollectionItemType_) layer, mask, effect, stream, keyframe, mask vertex, or stream ref. No mention to path vertex of a shape layer. Perhaps the SDK I'm using is too old.

For a mask path, I've found that getting the selected vertices can be done with the following pseudo code:

ERR(suites.CompSuite7()->AEGP_GetNewCollectionFromCompSelection(S_my_id, compH, &collectionH));
ERR(suites.CollectionSuite2()->AEGP_GetCollectionNumItems(collectionH, &numItemsL));

// loop through current selection
for (A_u_long iL = 0; iL < numItemsL; iL++)
{
	ERR(suites.CollectionSuite2()->AEGP_GetCollectionItemByIndex(collectionH, iL, &collectionItemH));
	
	if (collectionItemH.type == AEGP_CollectionItemType_MASK_VERTEX)
	{
		// here we've got the index of a selected vertex
		AEGP_MaskIndex vertexIdx = collectionItemH.u.mask_vertex.index;
		
		// additional infos
		//AEGP_MaskCollectionItem 	maskItem	= collectionItemH.u.mask_vertex.mask_sel;
		//AEGP_LayerH 					layerH 	= maskItem.layerH;
		//AEGP_MaskIndex				maskIdx	= maskItem.index;
						
		//... do something with the index ...
	}
}

How would you do the same thing for a path of shape layer ?

Thanks

 

TOPICS
SDK

Views

373

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Find the selected path vertex of a shape layer using the SDK

New Here ,
Apr 16, 2020

Copy link to clipboard

Copied

Hi,
Is it possible to retrieve the index of the selected vertex in a shape layer path ? I mean, using the AEGP API.

I've noticed the type of a collection item can be either (AEGP_CollectionItemType_) layer, mask, effect, stream, keyframe, mask vertex, or stream ref. No mention to path vertex of a shape layer. Perhaps the SDK I'm using is too old.

For a mask path, I've found that getting the selected vertices can be done with the following pseudo code:

ERR(suites.CompSuite7()->AEGP_GetNewCollectionFromCompSelection(S_my_id, compH, &collectionH));
ERR(suites.CollectionSuite2()->AEGP_GetCollectionNumItems(collectionH, &numItemsL));

// loop through current selection
for (A_u_long iL = 0; iL < numItemsL; iL++)
{
	ERR(suites.CollectionSuite2()->AEGP_GetCollectionItemByIndex(collectionH, iL, &collectionItemH));
	
	if (collectionItemH.type == AEGP_CollectionItemType_MASK_VERTEX)
	{
		// here we've got the index of a selected vertex
		AEGP_MaskIndex vertexIdx = collectionItemH.u.mask_vertex.index;
		
		// additional infos
		//AEGP_MaskCollectionItem 	maskItem	= collectionItemH.u.mask_vertex.mask_sel;
		//AEGP_LayerH 					layerH 	= maskItem.layerH;
		//AEGP_MaskIndex				maskIdx	= maskItem.index;
						
		//... do something with the index ...
	}
}

How would you do the same thing for a path of shape layer ?

Thanks

 

TOPICS
SDK

Views

374

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Apr 16, 2020 0
Participant ,
Apr 23, 2020

Copy link to clipboard

Copied

I'm not sure in regards to selections and collections, but generally the same code that works on masks (paths) can be used on shapes in a roundabout way. The expression of the mask param must be set to the shape path you're using. 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Apr 23, 2020 0
New Here ,
Apr 29, 2020

Copy link to clipboard

Copied

Hi James,

Yeah mask paths and shape paths are pretty much the same beasts. Most of the time, using the SDK I can do everything I need concerning shape layers: from the creation to the deepest tweaking. But when it comes to current selection, it looks like it's not possible to get the selected vertices (at least now ...).

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Apr 29, 2020 0