• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Count Sublayers in a layer

New Here ,
Aug 12, 2013 Aug 12, 2013

Copy link to clipboard

Copied

Hello,

Is there a possibility to count (only) all sublayers in a given layer?

CountLayers from LayerSuite is only counting top-level layers and that isn't good enough.

Thanks in advance!

Edit: I am using CS SDK 5.

TOPICS
SDK

Views

1.9K

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
community guidelines
Adobe
New Here ,
Aug 15, 2013 Aug 15, 2013

Copy link to clipboard

Copied

Hello,

I've managed to solve it by using GetNextPreorderLayer function within AILayerSuite.

Thanks to all who have read it/or gave it a thought.

Votes

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
community guidelines
New Here ,
Jun 05, 2024 Jun 05, 2024

Copy link to clipboard

Copied

LATEST

Hi, 
I wonder if you can give us a more detailed instruction? I downloaded SDK but still gotta learn a lot to understand this.
Many thanks

Votes

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
community guidelines
New Here ,
Aug 26, 2013 Aug 26, 2013

Copy link to clipboard

Copied

ASErr result = kNoErr;

try {

     AILayerHandle layer;

     result = sAILayer->GetNthLayer(layerIndex, &layer);

     aisdk::check_ai_error(result);

       

     AIArtHandle art;

     AIArtSet artSet = NULL;

     result = sAIArtSet->NewArtSet(&artSet);

     aisdk::check_ai_error(result);

     result = sAIArtSet->LayerArtSet(layer, artSet);

     aisdk::check_ai_error(result);

     ai::int32 count;

     result = sAIArtSet->CountArtSet(artSet, &count);

       

     int countSublayers = 0;

     // ignore first art, it is a layer art

     for ( ai::int32 i = 1; i < count; i++ )

     {

          sAIArtSet->IndexArtSet(artSet, i, &art);

           

          AIBoolean isLayerGroup;

          result = sAIArt->IsArtLayerGroup(art, &isLayerGroup);

          aisdk::check_ai_error(result);

           

          if ( isLayerGroup )

               countSublayers++;

     }

     std::cout << "\tCOUNT SUBLAYERS = " << countSublayers << "\n";

} catch (ai::Error& ex) {

     result = ex;

}

Votes

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
community guidelines