Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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

    Picking of objects without geometry

    SDK Help
    0
    10
    778
    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 16/05/2013 at 06:22, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   R14 
      Platform:      
      Language(s) :

      ---------
      Hi folks,
      I wonder if it is possible to make an drawn object selectable with the default selection tools. The object gets drawn into the viewport by using DrawPolygon() and DrawPointsArray(). GetVirtualObjects() just returns two points to set the bounding volume.
      Thanks in advance for any help!
      Satara

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

        On 16/05/2013 at 07:38, xxxxxxxx wrote:

        GetVirtualObjects() returns the end result of your modification.  Draw() is where you show the 'potential' changes in the viewport.  Not sure about your question.

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

          On 16/05/2013 at 08:46, xxxxxxxx wrote:

          I don't think so. There is nothing like an overwritable method like ObjectData.HitTest() or
          something like that.

          Maybe you could cheat a bit with hidden polygons. But I am not sure how hidden polygons
          are taken into account for selection tool hit tests.

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

            On 16/05/2013 at 10:16, xxxxxxxx wrote:

            AFAIK. There's nothing built-in for selecting drawn items.
            I wanted to do something similar recently. And I had to write it all from scratch.

            You'll need to get the mouse's coords and it's click event. And you'll need to build a range map for the mouse cursor so your mouse doesn't need to be exactly on the drawn point. Otherwise it will be difficult to select small things like drawn points.
            Then you'll need to create the second state of the drawn image (point, polygon, image, etc..) so it changes it's appearance when clicked.

            I have a free python tool plugin called "PyDraw Smooth Spline" that draws a smooth spline with the Draw() method. And it does all of the above. Except for changing the drawn item's appearance when it's selected.
            Since it's a tool plugin it doesn't use an object or a tag to host the drawn spline. And it allows you to grab and move the points of the drawn virtual spline with your mouse when the LMB is down.
            The code in that plugin might give you some ideas: https://sites.google.com/site/scottayersmedia/plugins

            -ScottA

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

              On 16/05/2013 at 10:58, xxxxxxxx wrote:

              he is talking about the selection tools, not the mouse pointer selection, or in other words the 
              lasso/rectangle/live selection tool.

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

                On 16/05/2013 at 12:21, xxxxxxxx wrote:

                As far as I know, that is not possible. On the the geometry of objects or their caches is used for selection (even though drawn elements can get highlighted, if you don't take care).

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

                  On 17/05/2013 at 04:35, xxxxxxxx wrote:

                  Alright thank you guys! I will let you know when I find a workaround.
                  Satara

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

                    On 13/08/2013 at 15:43, xxxxxxxx wrote:

                    What about the PickObject?

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

                      On 13/08/2013 at 15:47, xxxxxxxx wrote:

                      Or a PickSession.

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

                        On 14/08/2013 at 05:38, xxxxxxxx wrote:

                        Hi tofuburger,

                        as far as I understand, this is not what we need. We want to make an object *pickable*. The PickSessions, as far as I understand it, is to pick an object. That is also the usage example given in the documentation:

                        "Data structure for pick sessions. Custom GUIs can implement their own pick session feature. Currently only the LinkBoxGui supports pick sessions."

                        Also, since the object doesn't seem to be visible to the CINEMA 4D picking in the first place, it would probably also be invisible to a PickSession.

                        Let me reiterate, what Satara and I are trying to achieve. We have a generator object, that has three different viewport modes. Two of these modes just create polygonal geometry and place it in the cache. Picking works fine.

                        The third mode uses the Draw() function of the object to draw points, lines, and polygons right into the viewport. In that case, our object is not pickable using the standard cinema 4d selection tools (live selection, lasso selection, etc.). It generally seems like objects that draw themselves as something else than just geometry in the cache, can be made pickable somehow. Examples are the light and camera objects, as well as the Joints from the character tools.

                        Light and Camera might be special cases that are not exposed through the API, but as far as I know, the Character Tools use the regular SDK.

                        Another thing, that may or may not influence this, is that we are planning to move our drawing into a SceneHook instead of the objects draw function. Reason for this is that we
                        (1) in certain cases want to overlay our manually drawn stuff over the polygonal geometry and
                        (2) want to make sure it also gets drawn when used with render instances, which currently doesn't seem to work.

                        Still hoping for a way to get this to work.

                        Best
                        Timm

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