Salir
  • Comunidad global
    • Idioma:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티

Why can't I do "layer.kind = LayerKind.SMARTOBJECT;"?

Nuevo aquí ,
Mar 20, 2009 Mar 20, 2009
I want to save each image layer from a PSD separately, and if the image has an effect OR its opacity is < 100%, it needs to be converted to an SmartObject layer and then rasterized (so it becomes a "LayerKind.NORMAL" layer with its effect, rasterized).

I can do it in two clicks, but when I try to do it by scripting, I get an alert saying something like "ArtLayers can't be converted to SmartObjects". I think that makes no sense, because you can do it by right-clicking a layer a selecting "Create smartObject", but whatever...

Is there a workaround for this?
TEMAS
Acciones y scripts
2.0K
Traducir
Informe
Directrices de la comunidad
Sé amable y respetuoso, muestra títulos de crédito de la fuente de contenido original y busca duplicados antes de publicar. Más información
community guidelines
Adobe
Héroe valeroso ,
Mar 20, 2009 Mar 20, 2009
You will have to use ScriptListener to do this...







executeAction( stringIDToTypeID('newPlacedLayer'), undefined, DialogModes.NO );



rasterizeSmart();



function rasterizeSmart() {

var desc201 = new ActionDescriptor();

var ref89 = new ActionReference();

ref89.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );

desc201.putReference( charIDToTypeID('null'), ref89 );

desc201.putEnumerated( charIDToTypeID('What'), stringIDToTypeID('rasterizeItem'), stringIDToTypeID('placed') );

executeAction( stringIDToTypeID('rasterizeLayer'), desc201, DialogModes.NO );

};

Traducir
Informe
Directrices de la comunidad
Sé amable y respetuoso, muestra títulos de crédito de la fuente de contenido original y busca duplicados antes de publicar. Más información
community guidelines
Nuevo aquí ,
Mar 20, 2009 Mar 20, 2009
Thanks Paul! But wow, I don't understand that code at all (lol). Do the "201" and "89" stand for something or are they just random numbers?

On the other hand, my problem is not to rasterize, but to convert a LayerKind.NORMAL to LayerKind.SMARTOBJECT, and I don't see that in the code (maybe it is there but I can't see it).
Traducir
Informe
Directrices de la comunidad
Sé amable y respetuoso, muestra títulos de crédito de la fuente de contenido original y busca duplicados antes de publicar. Más información
community guidelines
Héroe valeroso ,
Mar 20, 2009 Mar 20, 2009
Yes its all scriptListener code auto generated with the ScriptListner plugin.

this line..
executeAction( stringIDToTypeID('newPlacedLayer'), undefined, DialogModes.NO );

converts the normal layer to a smart layer.
The function will rasterize the layer.

The layer must be the active one.
the "201" and "89" are just auto generated variables.
Traducir
Informe
Directrices de la comunidad
Sé amable y respetuoso, muestra títulos de crédito de la fuente de contenido original y busca duplicados antes de publicar. Más información
community guidelines
Community Expert ,
Mar 21, 2009 Mar 21, 2009
Luis, isnt going via Smart Objects more time-intensive than grouping the layer and then merging the resulting group?
But of course that would trash existing Clipping Masks
Traducir
Informe
Directrices de la comunidad
Sé amable y respetuoso, muestra títulos de crédito de la fuente de contenido original y busca duplicados antes de publicar. Más información
community guidelines
Nuevo aquí ,
Mar 21, 2009 Mar 21, 2009
The purpose is to apply layer masks and effects and get just a rasterized layer, so that would be a great and easy way to do it. I'll try and tell you 😉 Thanks!
Traducir
Informe
Directrices de la comunidad
Sé amable y respetuoso, muestra títulos de crédito de la fuente de contenido original y busca duplicados antes de publicar. Más información
community guidelines
Nuevo aquí ,
Mar 24, 2009 Mar 24, 2009
MÁS RECIENTES
Done! It was a bit difficult to obtain exactly what I needed, but the group->merge solution has worked perfectly. Thank you very very much Christoph! :D
Traducir
Informe
Directrices de la comunidad
Sé amable y respetuoso, muestra títulos de crédito de la fuente de contenido original y busca duplicados antes de publicar. Más información
community guidelines