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

If/Else, Stop Expression if no Parent

New Here ,
Aug 17, 2022 Aug 17, 2022

Is it possible to use an if/else statement to ignore an expression and use its "value" if it doesn't have a parent layer?

 

I'm attempting to build a template that utilizes multiple text layers where, if a checkbox is enabled, then that text layer will automatically adjust positioning based on other text layers in the layer stack. I have it setup to look at several variables like the text box height of other text layers or its own layer, font sizes, and any additional values controlled by sliders. At the moment, all of these text layers are parented to a null layer to establish the starting position. On rare occasions, I might want to remove a text layer from that layer stack so that I can manually position it. It would also be nice to supress the expression error since it wouldn't have a parent layer.

TOPICS
Expressions
243
Translate
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

correct answers 1 Correct answer

Community Expert , Aug 17, 2022 Aug 17, 2022

Like this, I think:

if (hasParent){
 // your expression here
}else{
  value
}
Translate
Community Expert ,
Aug 17, 2022 Aug 17, 2022

Like this, I think:

if (hasParent){
 // your expression here
}else{
  value
}
Translate
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 17, 2022 Aug 17, 2022
LATEST

Wow, definitely was overthinking that one. Thank you Dan!

Translate
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