Setting minimum brush opacity

I figured it out…

const toolOpt: PaintBrushToolOptionsDescriptor = getAppProperty('currentToolOptions') as PaintBrushToolOptionsDescriptor
  toolOpt.$opVr.minimum._value = 50
  const desc = {
    _obj: 'set',
    _target: {
      _ref: [{ _ref: 'paintbrushTool'}],
    },
    to: toolOpt
  }

  photoshop.action.batchPlay([desc], {})

3 Notes:

  • You can ignore the types if you’re not using typescript, although I highly recommend it to know what’s going on inside the descriptors.
  • For a different tool type, you might need to change the class reference (paintbrushTool). Might be possible to dynamically read that, too.
  • If no opacity control is selected, you’ll have to set one first, too:
    toolOpt.$opVr.$bVTy = 1 (0: off, 1: fade, 2: pen pressure, etc.)
2 Likes