0
$\begingroup$

I'm trying to place text and then put text bubbles around them. To preserve the text bubble corner curves, I'm using shape keys. But sizing their width and height is a problem. I calculated width and height of the text bounding box and tried driving the shape keys, but that wasn't accurate for some reason.

Below is my second attempt. This time I'm calculating the width and height of both the text and bubble bounding box.

In the picture below;

  1. I increase iterate a number of times to incrementally approach the correct size.
  2. The result is used to increase the bubble size
  3. The code seems to work but gets caught in a loop somehow. The bubble flickers through the sizes after hitting it's limit.

I'm missing something with the loop structure I'm sure. Any help would be appreciated.

If you know of a better, more elegant way to size the text bubbles around text, I'm open for that too.

Blend File

Match Shape Key to Size

$\endgroup$
2
$\begingroup$

Animation Nodes have a node to compute the bounding box called Object Bounding Box Node. You can use it to get a rectangle (plane) that bounds each of the text objects, to get round edges, you can use the bevel modifier with the Vertex Only option, no need to use shape keys. To get the mesh of each bubble, get every 2nth vertex of the output bounding box vertices (Only every 2nth because the rest is the upper part of the box), then create a mesh out of it:

Node Tree

Which when joined, output and beveled will produces:

Result

Which is exactly what you want, but you might want to scale the rectangles a bit to give the text some space inside, this is easily done by translating the upper-right, upper-left, lower-left and lower-right vertices a bit in the directions $(1, 1), (1, -1), (-1, -1), (-1, 1)$ respectively (They might not be in the same order as I mentioned, so check first !):

Offset

By changing the scale, we get different padding widths:

Widths

And by changing the bevel width, we can control the radius of the corners:

Corder Width

$\endgroup$
2
  • $\begingroup$ Thanks so much Omar. It all works for me except for the beveling. The bevel doesn't show up on my mesh. If I go into edit mode and give the mesh a face, it will work. But exiting edit mode reverts to square edges. Any Ideas? $\endgroup$ – Bfoot Apr 5 '18 at 1:38
  • $\begingroup$ Found my problem! I hadn't attached the polygon list to the polygon indices for the Combine Mesh Data node. No polygons, no beveling. $\endgroup$ – Bfoot Apr 5 '18 at 11:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.