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
    • Recent
    • Tags
    • Users
    • Login

    Draw() Question

    Scheduled Pinned Locked Moved SDK Help
    6 Posts 0 Posters 486 Views
    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 Offline
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 24/02/2011 at 13:52, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   12 
      Platform:   Windows  ;   
      Language(s) :     C++  ;

      ---------
      Hey everyone.  I have a question regarding the draw function of a tag plugin.

      with my tag plugin I am trying to draw a circle around an object that the user has placed in to a link field in the tag attributes.  When the user places any object in the link field, I want my tag to draw a circle around it.  here is the code I am using.

        
        
        BaseContainer* bc = tag->GetDataInstance();  
        if(!bc) return FALSE;  
        
        BaseDocument *doc = bh->GetDocument();  
        if (!doc) return FALSE;  
        
        objectToOrbit = bc->GetObjectLink(ORBIT_OBJECT_TO_ORBIT, doc);  
        if (!objectToOrbit) return FALSE;  
        
        Real position = bc->GetReal(ORBIT_POSITION);  
        
          
        /**** DRAW THE ORBIT PATH ****/  
        
        Matrix m;  
        Real rx = bc->GetReal(ORBIT_RADIUS_X);  
        Real ry = bc->GetReal(ORBIT_RADIUS_Y);  
        
        m.off = objectToOrbit->GetRelPos();  
          
        if(bc->GetLong(ORBIT_AXIS) == ORBIT_AXIS_X){  
            m.v1 = Vector(0, rx, 0);  
            m.v2 = Vector(0, 0, ry);  
            op->SetRelPos(objectToOrbit->GetAbsPos() + objectToOrbit->GetRad() + (Vector(0, rx, ry) * position));  
        }  
        
        if(bc->GetLong(ORBIT_AXIS) == ORBIT_AXIS_Y){  
            m.v1 = Vector(rx, 0, 0);  
            m.v2 = Vector(0, 0, ry);  
            op->SetRelPos(objectToOrbit->GetAbsPos() + objectToOrbit->GetRad() + (Vector(rx, 0, ry) * position));  
        }  
        
        if(bc->GetLong(ORBIT_AXIS) == ORBIT_AXIS_Z){  
            m.v1 = Vector(rx, 0, 0);  
            m.v2 = Vector(0, ry, 0);  
            op->SetRelPos(objectToOrbit->GetAbsPos() + objectToOrbit->GetRad() + (Vector(rx, ry, 0) * position));  
        }  
        
        
        bd->DrawCircle(m);  
        
      

      for some reason,  instead of drawing the circle around the object in the link field, it is drawing the object around the object on which the tag is placed.  That is not my desired result.  Does anyone see a reason why this would be happening?  Am I doing something wrong with the DrawCircle() function or the Matrix that is involved.

      Thanks,

      Shawn

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 24/02/2011 at 16:34, xxxxxxxx wrote:

        And interestingly...  when I add the tag to an object,   every object below that one in the Object Manager disappears in the viewport.   Weird huh?

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

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 24/02/2011 at 18:06, xxxxxxxx wrote:

          Howdy,

          First of all, I don't think you should set an object's position in the draw function. What I'd suggest is create a class member variable:

          Matrix drawMatrix;
          

          ... and set those values in another function.

          Then in your draw function, you'd simply call:

          bd->DrawCircle(drawMatrix);
          

          Adios,
          Cactus Dan

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

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 25/02/2011 at 03:03, xxxxxxxx wrote:

            Cool.. I'll give it a try.. Thanks Dan.  🙂

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

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 25/02/2011 at 03:21, xxxxxxxx wrote:

              That did the trick.  Thanks again Dan.  !

              Shawn

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

                THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                On 25/02/2011 at 06:55, xxxxxxxx wrote:

                Howdy,

                You're welcome. 😉

                Adios,
                Cactus Dan

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