function DV_ChangeImageSource:process_layerDown(moho, layer)
if (layer:LayerType() == MOHO.LT_IMAGE) then
local imageLayer = moho:LayerAsImage(layer)
print(imageLayer:Name())
print(imageLayer:UniquePSDLayerID())
elseif layer:IsGroupType() then
local groupLayer = moho:LayerAsGroup(layer)
for i = 0, groupLayer:CountLayers()-1 do
local subLayer = groupLayer:Layer(i)
self:process_layerDown(moho, subLayer)
end
end
end
Am i missing something here? Any help is much appreciated!
I got the script working, but by using the LayerOrderID. Ideally i would like to use the UniquePSDLayerID so i can add and move layers around in the PSD file. But i can't figure out how and when to set the UniquePSDLayerID for it to work. Could you give us an example, Mike? Also, what does -2 as a UniquePSDLayerID mean? Thanks!
Lost Marble wrote:I've added the following functions to the ImageLayer class that Lua scripts can use:
void SetSourceImage(const char *path); // set the path of an image - you can use filename.psd*5* notation if you want to
const char *SourceImage(); // return the path of the image being used - *5* notation will have been stripped off
bool IsPSDImage(); // true if the image layer is using a PSD file
void SetUniquePSDLayerID(int32 layerPSDID); // set the unique layer ID that you want to use
int32 UniquePSDLayerID(); // returns the unique ID
void SetPSDLayerOrderID(int32 layerOrderID); // set the layer to use based on its order in the PSD file (0 is the bottom layer, then 1, 2, 3, etc.)
int32 PSDLayerOrderID(); // returns the layer ID by order that is being used
void UnloadImage(); // unloads the image from memory - AS will load it back in if and when it needs to use it
SetSourceImage() and SourceImage() already existed. The others are new.
I think you guys are in the beta - these functions will be available in the next beta release.
I'm not in the beta. Those methods are not included in the 11.2 pkg files. Are they only available in the beta? Are the pkg files keep being updated?
________________________________________________________________________ https://mohoscripting.com/ - Unofficial Moho Lua scripting documentation https://mohoscripts.com/ - The best place to publish and download scripts for Moho
synthsin75 wrote:the scripting documents have not been updated.
That's bad... Really bad...
________________________________________________________________________ https://mohoscripting.com/ - Unofficial Moho Lua scripting documentation https://mohoscripts.com/ - The best place to publish and download scripts for Moho
A question to Mike (or other SmithMicro officials): Is there any other new Lua API features in 11.2?
________________________________________________________________________ https://mohoscripting.com/ - Unofficial Moho Lua scripting documentation https://mohoscripts.com/ - The best place to publish and download scripts for Moho