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

    User Area Dial?

    SDK Help
    0
    21
    12.6k
    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.
    • H
      Helper
      last edited by

      On 25/12/2015 at 12:51, xxxxxxxx wrote:

      Yeah. I noticed there's not even a circle or ellipse function for it. It's really awful.
      But since this thing was written back in the 90's. I sort of give it a break. It was probably state of the art back in it's day.
      I wish Maxon would just bite the bullet and partner with Qt like Autodesk did. And allow Qt handle all of it's gui stuff. But that's probably never going to happen.

      Perhaps someone from Maxon support could tell me if it's even possible to create an object with transforms for the UA?
      The docs say that we can use the UA to host our own objects. But nothing on how to actually do it.

      -ScottA

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        On 29/12/2015 at 08:13, xxxxxxxx wrote:

        Hi,

        To draw to bitmaps you can use the BaseBitmap class low-level drawing functions (SetPixel(), SetAlphaPixel()).
        Also don't forget GeClipMap class exists to draw even more stuff.
        Then draw the bitmap using GeUserArea::DrawBitmap() with the appropriate mode.

        Originally posted by xxxxxxxx

        Perhaps someone from Maxon support could tell me if it's even possible to create an object with transforms for the UA?
        The docs say that we can use the UA to host our own objects. But nothing on how to actually do it.

        If you want to draw a bitmap with special transform that's something completely up to your implementation.
        The GeUserArea only draws pixels and doesn't know what's really drawn. It doesn't keep any information on the drawn lines, bitmaps, text, etc.
        To draw a bitmap with different transforms implement a struct or class to hold the bitmap and the special setup for its transform (just like Robert already told you).
        Then use this information to draw the transformed bitmap (by your own algorithm, the API doesn't provide this).

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          On 29/12/2015 at 08:34, xxxxxxxx wrote:

          Thanks....but...how?

          If I wanted to create my own UA object with it's own transforms. The first thing I need to know is what base class do I extend?
          And If I create my own object. And then add instances of it to the UA. Can I get at all of those instances by iterating through the UA class somehow?
          Or do I need to create my own container to hosts all of the instances?

          I need more information than "Create a class".

          -ScottA

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

            On 29/12/2015 at 09:56, xxxxxxxx wrote:

            I don't know where you got the idea of a UA 'object'.  The UserArea is simply a UI region into which you can draw and respond to user input.  The objects, if we can say that, are simply your own class instances reacting within the UA.  For instance, my one excursion used a UserArea as a realm for nodes (much like Xpresso's system).  Each node was an instance of my node class containing its parameters and information on the location, size, states of the node for display in the UA as well the connections between them.  All of the display code was part of the methods in the node class called from the UA as it iterated through the node list.  When the user clicked over, say, the head of the node, I would find out if the click was over a node, where in the node, and react appropriately.  Over the head, move the node.  Over a input-output connection, either start a connection line or disconnect if one existed already, etc.

            Summarily, all of the 'interface' in the UserArea is just about the same as it would need to be if you were designing your own window system over a basic shell.

            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

              On 29/12/2015 at 12:02, xxxxxxxx wrote:

              I guess it's not possible to create a UA object the way I'm thinking.

              Sure. We can make our own classes.
              But ultimately these class objects must get drawn onto the UA using one of the SDK draw functions.
              Those draw functions are what create the "object" that I want to make myself. But it doesn't seem possible.

              -ScottA

              1 Reply Last reply Reply Quote 0
              • H
                Helper
                last edited by

                On 30/12/2015 at 08:41, xxxxxxxx wrote:

                Wow. I'm really stunned at how hard this is to do.
                I never would have thought that something as simple as rotating a gizmo would be so difficult.

                It turns out that rotating an image is very difficult to do. And it requires some advanced sampling of the nearest pixels. Which require special libraries.
                So I thought that I'd try to rotate the gizmo by moving it's four corners in an arc like manner instead. Like rotating a polygon.
                But the DrawBitmap() function does not provide the four corners of the gizmo that can be moved. It provides only one corner. And then the width&height.

                From the docs:
                The region ( x , y ) to ( x + w , y +h) from the bitmap will be scaled and transformed into the region ( wx , wy ) to ( wx + ww , wy + wh ) of the destination area.

                This makes it very, very hard to understand what's going on.
                Is there a way to get and change the four corner positions for this thing so I can move them in an arc like fashion to rotate it?

                P.S.
                I have studied your line rotate code Robert. But I'm not seeing how I can use that to rotate an image. If it's there I'm just not seeing it.

                -ScottA

                1 Reply Last reply Reply Quote 0
                • H
                  Helper
                  last edited by

                  On 31/12/2015 at 12:16, xxxxxxxx wrote:

                  I think that 'scaled and transformed' means that it will be scaled (width and height) to fit the destination and transformed simply means moved from x,y to wx,wy.  That is it.

                  My code was not intended to show how to rotate an image but as a procedural means to draw and handle a rotating object (line) as an interface.  As you noted, arbitrarily rotating a bitmap requires some hefty algorithmic manipulation.  Photoshop (CS4 here) has a very responsive image rotation: Select All, then Move tool, then simply get the cursor to the rotation cursor and interactively drag rotate.

                  If I find some reasonable code that would rotate a bitmap image quickly, I will post back here.

                  1 Reply Last reply Reply Quote 0
                  • H
                    Helper
                    last edited by

                    On 31/12/2015 at 13:04, xxxxxxxx wrote:

                    Thanks for trying Robert.
                    I don't think I'm going to get anywhere with this. It doesn't seem to be possible.

                    -ScottA

                    1 Reply Last reply Reply Quote 0
                    • H
                      Helper
                      last edited by

                      On 06/01/2016 at 20:18, xxxxxxxx wrote:

                      Just an update to let you know that I figured out a way to do it using the OpenCV library.
                      It works slicker than gorilla snot.😉
                      I would have preferred to do this with the SDK. But it just isn't possible.

                      -ScottA

                      1 Reply Last reply Reply Quote 0
                      • H
                        Helper
                        last edited by

                        On 06/01/2016 at 20:32, xxxxxxxx wrote:

                        Glad to hear that you found a pre-existing solution.  I truly did not find anything past the shear-technique (which is already a bit archaic temporally) as a means of arbitrarily rotating bitmaps. We can land a human on the moon but Bresenham takes decades to surpass.  Thus is technological advance.  Good ventures!

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