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
    3 Posts 0 Posters 289 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 20/02/2011 at 17:55, xxxxxxxx wrote:

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

      ---------
      Hey everyone.  This is going to be a somewhat obscure question but I hope that it makes sense to someone.  I have a particle system that I have created that works through an emitter class and a particle class.  The emitter creates instances of the particle class and updates each particles position and all other attributes.  Alone these items work fine.  But when I make an instance of the emitter class in the Draw() of my object plugin, I get some pretty funky results.  The emitter object emits particles like it should, however, it also emits particles in 2D that appear as though they are on the screen of the viewport.  I am using DrawLine(), and DrawHandle() to draw the particles which uses Vectors for the position of those items.  So I cannot figure out why I would be getting particles being emitted as if they are on the screen.  It's funny because when I deselct the emitter object in the attributes manager, those "screen" particles disappear.  So it has to be something with the Draw().

      Here's my draw function..  Simply calls the Emitter class..

        
        
      DRAWRESULT PXGEmitterObject::Draw(BaseObject* op, DRAWPASS drawpass, BaseDraw* bd, BaseDrawHelp* bh){  
          
        GePrint("EMITTER OBJ");  
        BaseContainer * bc = op->GetDataInstance();  
        
        BaseDocument *doc = op->GetDocument();  
        if (!doc) return DRAWRESULT_ERROR;  
        
        Real fps = doc->GetFps();                        //Get the current Frames Per Second  
        BaseTime bt = doc->GetTime();  
        LONG lngCurrentFrame =    bt.GetFrame(fps);        //Set a variable that represents the current selected frame  
        LONG time = GeGetTimer();  
        
        //Begin Emission Loop      
        if (bc->GetBool(EMITTER_ENABLE_EMITTER) == TRUE){  
            if(lngCurrentFrame > 0){  
                emitter->Update(time, bd, bh, op);  
            }  
        }  
        
        return DRAWRESULT_OK;  
      }  
      

      This one is baffling me..  any help you all could offer would be awesome.  I'd really like to know what would cause the DrawHandle() and DrawLine() to show up in 2D space. ??

      Thanks,

      Hope this makes sense.  🙂

      ~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 21/02/2011 at 02:31, xxxxxxxx wrote:

        You probably haven't set the transformation matrix to object space yet for the drawing functions. The BaseDraw::SetMatrix_Matrix() method must be called before any drawing. See the docs for which drawing functions it is necessary to call SetMatrix_Matrix().

          
        DRAWRESULT PXGEmitterObject::Draw(BaseObject* op, DRAWPASS drawpass, BaseDraw* bd, BaseDrawHelp* bh)  
        {  
          if (drawpass!=DRAWPASS_OBJECT) return DRAWRESULT_SKIP;  
            
          // transformation matrix needs to be set for DrawLine and DrawHandle; for instance object space  
          const Matrix &mg = bh->GetMg();  
          bd->SetMatrix_Matrix(op, mg);  
          
          // do the drawing  
            
          ...  
        }  
        

        cheers,
        Matthias

        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 21/02/2011 at 03:58, xxxxxxxx wrote:

          Thanks Matthias... Problem solved..

          ~Shawn

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