Skip navigation
prpurcell
Currently Being Moderated

Unicode name from layer

Jun 25, 2013 11:25 AM

Tags: #c++ #plugin #plug-in #layers #sdk #plugins #cs6 #unicode #automation

Right now I am using the following method to get the name of my currently active layer

 

SPErr GetLayerName(char* name, int length)

{

          SPErr error = 0;

 

 

          error = PIUGetInfo(classLayer, keyName, name, &length);

          if (error) goto onError;

 

 

onError:

     return error;

}//GetLayerName

 

Then I can use

 

const int MAX_NAME = 256;

char** names = new char*[layerCount];

for (int i = 0; i < layerCount; ++i)

{

     MakeLayerActive(i);

     names[i] = new char[MAX_NAME];

     GetLayerName(names[i], MAX_NAME);

}

 

What I need to do is get a unicode string...as of right now I am developing

the plugin on Windows, for the time being portability is not a concern (it will

be, but I just want to get it funcitoning first) so I don't mind using wchar_t.

 

I've tried looking for some kind of key i.e. keyUnicodeName, but can't find

anything useful down that road.

 

I saw another user of this forum using the following...

 

auto &layerInfo = globals->exportParamBlock->documentInfo->layersDescriptor;

for (int i = 0; i < layerN; ++i)

{

     std::u16string utfStr = layerInfo->unicodeName;

     layerInfo = layerInfo->next;

}

 

but it seems that his was an export plugin, while mine is an automation...

 

 

Any suggestions would be greatly appreciated

 

Thanks

 
Replies

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points