Programmatically drawing a brush stroke
-
Hey guys!
I am simply looking for some guidance on how I would go about programmatically drawing with BodyPaint's Brush tool in UV space (if even possible).
I know how to use the SDK to configure the Brush tool's settings, but after scouring the C++ documentation on the BodyPaint module and carefully reading through the Painting repo example and, lastly, experimenting with some bits of code (to no avail whatsoever), I'm afraid to admit that I am not sure where to even start.
For example, I would like to have the Brush tool, with its specific brush settings, to draw from the UV coordinates
(0,0,0)
to(0.5,0.5,0)
, just as if the user dragged their mouse between both coordinates in the viewport with the Brush tool.Apologies in advance if I missed something obvious in the SDK documentation.
Any guidance would be immensely appreciated.
Thank you very much!
-
I thought I had exhausted the search keywords before posting this, but upon searching this forum again, I found this thread, which I think answers my question.
Unless proven otherwise, I will consider my intended task to be impossible. A bummer, but I'll try to find another way or give up on the task altogether. All good!
-
Hi @justinleduc,
Please excuse the delay!
Moving brush tool with the code is not something easily achievable in cinema. Bodypaint does not expose any such functionality, so there's no built-in solution in SDK for you. Unfortunately, I have to confirm your suspicions.
You've already done a good job searching the forum and finding the thread about mouse movement simulation. However, I personally think this approach will just create too many issues on the go.
Cheers,
IliaPS Unless you need a general approach (which I think is the whole idea), you could potentially shift to working with textures, for example you could retrieve the PaintTexture using PaintTexture::GetSelectedTexture() and process it the way you like (e.g. drawing a line from (0, 0) to (.5, .5)). This way you of course cannot get use of brush-specific features.
-
Thanks a lot for confirming my doubts, @i_mazlov.
I'll find a compromise, but I can't help but express how great it would be if BodyPaint exposed such functionality.
The Brush tool and its filters (such as "Smudge") can't be replicated with a simple bitmap texture, and gaining access to it (mind you, in the context where the Paint brush can be programmatically moved/dragged across the UV space) would open the door to so many creative and useful applications.
Of course, I'm sure you are already aware of all of this. This is just me casting a single vote for a potential addition of the Brush tool to the SDK in the future.
Thanks for everything!