Copy link to clipboard
Copied
Hey guys,
I'm trying to add a mask to my layer using sdk, but I can't get it work right!
Here's my code,
AEGP_MaskRefH maskItem;
A_long maskIndex;
AEGP_StreamRefH maskStream;
AEGP_StreamValue2 maskStreamValue;
AEGP_MaskOutlineValH outlineValue;
AEGP_VertexIndex vertexIndex = 0;
ERR(suites.MaskSuite6()->AEGP_CreateNewMask(*layer, &maskItem, &maskIndex));
ERR(suites.StreamSuite4()->AEGP_GetNewMaskStream(aegp_plugin_id, maskItem, AEGP_MaskStream_OUTLINE, &maskStream));
A_Time time;
time.scale = 1;
time.value = 0;
ERR(suites.StreamSuite4()->AEGP_GetNewStreamValue(aegp_plugin_id, maskStream, AEGP_LTimeMode_LayerTime, &time, TRUE, &maskStreamValue));
outlineValue = maskStreamValue.val.mask;
ERR(suites.MaskOutlineSuite3()->AEGP_CreateVertex(outlineValue, vertexIndex));
AEGP_MaskVertex newVertex;
newVertex.x = x;
newVertex.y = y;
newVertex.tan_in_x = inX;
newVertex.tan_in_y = inY;
newVertex.tan_out_x = outX;
newVertex.tan_out_y = outY;
ERR(suites.MaskOutlineSuite3()->AEGP_SetMaskOutlineVertexInfo(outlineValue, vertexIndex, &newVertex));
ERR(suites.MaskSuite6()->AEGP_DisposeMask(maskItem));// dispose the mask item
ERR(suites.StreamSuite4()->AEGP_DisposeStreamValue(&maskStreamValue)); // dispose the stream value
ERR(suites.StreamSuite4()->AEGP_DisposeStream(maskStream)); // dispose the stream
I did add a new mask to my layer, but there's no vertex on it!
What I'm doing wrong?
Hi Zhiqing Li!
You're almost there (I had the same problem...).
Once you've set the MaskOutlineVertices, what you already did, you still need to set the stream value.
So, at line 31:
ERR(suites.StreamSuite4()->AEGP_SetStreamValue( aegp_plugin_id, maskStream, &outlineValue));
Cheers,
François
Copy link to clipboard
Copied
Hi Zhiqing Li!
You're almost there (I had the same problem...).
Once you've set the MaskOutlineVertices, what you already did, you still need to set the stream value.
So, at line 31:
ERR(suites.StreamSuite4()->AEGP_SetStreamValue( aegp_plugin_id, maskStream, &outlineValue));
Cheers,
François
Copy link to clipboard
Copied
It's working now!!!! Thanks François!!