Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Programmatically drawing a brush stroke

    Cinema 4D SDK
    windows c++ 2024
    2
    4
    742
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • justinleducJ
      justinleduc
      last edited by

      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!

      1 Reply Last reply Reply Quote 0
      • justinleducJ
        justinleduc
        last edited by

        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!

        i_mazlovI 1 Reply Last reply Reply Quote 0
        • i_mazlovI
          i_mazlov @justinleduc
          last edited by

          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,
          Ilia

          PS 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.

          MAXON SDK Specialist
          developers.maxon.net

          1 Reply Last reply Reply Quote 1
          • justinleducJ
            justinleduc
            last edited by

            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! 👏

            1 Reply Last reply Reply Quote 0
            • First post
              Last post