Subdivide



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

    On 28/08/2009 at 17:51, xxxxxxxx wrote:

    How do I do this is I am making a tool plugin not a tag plugin. This is for a different plugin than the symmetry one.

    Thanks,

    ~Shawn



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

    On 28/08/2009 at 18:04, xxxxxxxx wrote:

    For tool plugins, you create a dialog which is 'stuffed' into the Attributes Manager (don't ask me why it is done this way here and not in other plugins). Put the button into the dialog and override the Command() function. Same idea after that - you get the dialog's button ID and call the function. Heed the Note there: Call StopAllThreads() before making scene modifications.



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

    On 28/08/2009 at 18:19, xxxxxxxx wrote:

    great thanks. Now I have another question. Is it possible to create a true nurbs object within C4D? I suppose it would be done using splines. But its it possible to create geometry between splines?

    Just curious.

    ~Shawn



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

    On 03/09/2009 at 14:04, xxxxxxxx wrote:

    So in my Message() for my tool plugin I have the following code.

    > `

      
    \>  Bool SculptTool::Message(BaseDocument* doc, BaseContainer& data, LONG type, void* t_data)  
    \>  {  
    \>    
    \>  switch (type)  
    \>       {  
    \>            case MSG_DESCRIPTION_COMMAND:  
    \>            {  
    \>            DescriptionCommand *dc = (DescriptionCommand* ) t_data;  
    \>            if (dc->id[0].id==COMMAND_SUBDIVIDE)  
    \>                 {  
    \>                 GePrint("Subdivide Button Clicked");  
    \>                 }  
    \>            }  
    \>       }  
    \>       return TRUE;  
    \>  }  
    \>  
    

    `

    Where if say's GePrint ("Subdivide Button Clicked"); I would instead like to execute the DoCommand() member. in that is the following code.

    > `

      
    \>  Bool SculptTool::DoCommand(ModelingCommandData &mdat;)  
    \>  {  
    \>    
    \>  //CODE RELATED TO THE SUBDIVISION OPTIONS/////////////////////////////////  
    \>    
    \>       //Define Variables  
    \>    
    \>       BaseObject *op=mdat.doc->GetActiveObject();  
    \>       PolygonObject* objPoly;  
    \>       objPoly=(PolygonObject* )op;  
    \>    
    \>       //Determine Attributes  
    \>    
    \>       if (mdat.bc->GetBool(HYPERNURBS_SUBDIVISION, TRUE)) //If HyperNURBS is checked  
    \>       {  
    \>       mdat.bc->SetBool(MDATA_SUBDIVIDE_HYPER, TRUE); //Set HyperNURBS subdivision  
    \>       }  
    \>       else  
    \>       {  
    \>       mdat.bc->SetBool(MDATA_SUBDIVIDE_HYPER, FALSE); //Disable HyperNURBS subdivision  
    \>       }  
    \>       mdat.bc->SetLong(MDATA_SUBDIVIDE_SUB, mdat.bc->GetLong(NUM_SUBDIVISIONS)); //Set Number of Subdivisions  
    \>       mdat.bc->SetReal(MDATA_SUBDIVIDE_ANGLE, mdat.bc->GetReal(MAX_ANGLE)); //Set Maxiumum Angle  
    \>              
    \>       //Subdivision Command  
    \>       SendModelingCommand(MCOMMAND_SUBDIVIDE, mdat);  
    \>       mdat.bc->SetLong(POLYGON_COUNT, objPoly->GetPolygonCount());  
    \>         
    \>       return true;  
    \>    
    \>  //END SUBDIVISION OPTIONS/////////////////////////////////////////////////  
    \>    
    \>    
    \>  }  
    \>  
    

    `

    Can anyone explain how ot do this?
    Thanks
    ~Shawn



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

    On 03/09/2009 at 19:11, xxxxxxxx wrote:

    You should just call DoCommand() where you have that GePrint() in Message().

    Save yourself unnecessary variables and wasted time and just do:

    PolygonObject *objPoly = ToPoly(mdat.doc->GetActiveObject());

    :)



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

    On 03/09/2009 at 19:56, xxxxxxxx wrote:

    Okay this is the code now.

    > `

      
    \>  Bool SculptTool::Message(BaseDocument* doc, BaseContainer& data, LONG type, void* t_data)  
    \>  {  
    \>    
    \>  switch (type)  
    \>       {  
    \>            case MSG_DESCRIPTION_COMMAND:  
    \>            {  
    \>            DescriptionCommand *dc = (DescriptionCommand* ) t_data;  
    \>            if (dc->id[0].id==COMMAND_SUBDIVIDE)  
    \>                 {  
    \>                 GePrint("Subdivide Button Clicked");  
    \>                 DoCommand();  
    \>                 }  
    \>            }  
    \>       }  
    \>       return TRUE;  
    \>  }  
    \>  
    

    `

    This is the error I get now.

    error C2660: 'SculptTool::DoCommand' : function does not take 0 arguments

    any thoughts?

    ~Shawn



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

    On 03/09/2009 at 20:02, xxxxxxxx wrote:

    Well, I hate to be obvious but you need to fill and send the ModelingCommandData& mdat argument for your DoCommand() function. :)



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

    On 03/09/2009 at 20:14, xxxxxxxx wrote:

    LOL..   obviously the obvious eludes me some times. HAHA..

    Do I fill it the way it is declared?

    like this.

    DoCommand(ModelingCommandData &mdat;);

    or do I need something else in the parenthesis?

    LOL. thank you for you patience with this noob.

    ~Shawn



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

    On 03/09/2009 at 20:27, xxxxxxxx wrote:

    Like this unless you have another mdat you have already alotted for this:

    > Bool SculptTool::Message(BaseDocument\* doc, BaseContainer& data, LONG type, void\* t_data) \> { \> switch (type) \>      { \>           case MSG_DESCRIPTION_COMMAND: \>           { \>           DescriptionCommand \*dc = (DescriptionCommand\* ) t_data; \>           if (dc->id[0].id==COMMAND_SUBDIVIDE) \>                { \>                GePrint("Subdivide Button Clicked"); \>                ModelingCommandData     mdat; \>                DoCommand(mdat); \>                } \>           } \>      } \>      return TRUE; \> } \>



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

    On 03/09/2009 at 20:31, xxxxxxxx wrote:

    HAHA.. WOW.. that couldn't be more obvious..   LOL

    thanks Robert. Not sure what time it is where you are but it's 11:30 PM here in NY.    I'm obviously tired..

    Thanks again.

    ~Shawn



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

    On 03/09/2009 at 20:36, xxxxxxxx wrote:

    Okay. so now it calls the DoCommand function but as soon as it does, C4D crashes out...

    Do you see anything in this code that would cause C4D to crash?

    > `

      
    \>  Bool SculptTool::DoCommand(ModelingCommandData &mdat;)  
    \>  {  
    \>    
    \>  //CODE RELATED TO THE SUBDIVISION OPTIONS/////////////////////////////////  
    \>    
    \>       //Define Variables  
    \>    
    \>      PolygonObject *objPoly = ToPoly(mdat.doc->GetActiveObject());  
    \>    
    \>       //Determine Attributes  
    \>    
    \>       if (mdat.bc->GetBool(HYPERNURBS_SUBDIVISION, TRUE)) //If HyperNURBS is checked  
    \>       {  
    \>       mdat.bc->SetBool(MDATA_SUBDIVIDE_HYPER, TRUE); //Set HyperNURBS subdivision  
    \>       }  
    \>       else  
    \>       {  
    \>       mdat.bc->SetBool(MDATA_SUBDIVIDE_HYPER, FALSE); //Disable HyperNURBS subdivision  
    \>       }  
    \>       mdat.bc->SetLong(MDATA_SUBDIVIDE_SUB, mdat.bc->GetLong(NUM_SUBDIVISIONS)); //Set Number of Subdivisions  
    \>       mdat.bc->SetReal(MDATA_SUBDIVIDE_ANGLE, mdat.bc->GetReal(MAX_ANGLE)); //Set Maxiumum Angle  
    \>              
    \>       //Subdivision Command  
    \>       SendModelingCommand(MCOMMAND_SUBDIVIDE, mdat);  
    \>       mdat.bc->SetLong(POLYGON_COUNT, objPoly->GetPolygonCount());  
    \>         
    \>       return TRUE;  
    \>    
    \>  //END SUBDIVISION OPTIONS/////////////////////////////////////////////////  
    \>    
    \>    
    \>  }  
    \>    
    \>  
    

    `

    Thanks,

    ~Shawn



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

    On 03/09/2009 at 20:41, xxxxxxxx wrote:

    After you get objPoly, check that it isn't NULL:

    if (!objPoly) return FALSE;

    Also, make sure that the mdat.bc is set to a BaseContainer. I'd do this in Message after declaring mdat. Declare a BaseContainer and add it:

    BaseContainer bc;
    mdat.bc = bc;

    You may also want to set your input BaseContainer value (HYPERNURBS_SUBDIVISION).



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

    On 03/09/2009 at 20:59, xxxxxxxx wrote:

    now I have this in Message()

    > `

      
    \>  Bool SculptTool::Message(BaseDocument* doc, BaseContainer& data, LONG type, void* t_data)  
    \>  {  
    \>    
    \>  switch (type)  
    \>       {  
    \>            case MSG_DESCRIPTION_COMMAND:  
    \>            {  
    \>            DescriptionCommand *dc = (DescriptionCommand* ) t_data;  
    \>            if (dc->id[0].id==COMMAND_SUBDIVIDE)  
    \>                 {  
    \>                 GePrint("Subdivide Button Clicked");  
    \>                 ModelingCommandData mdat;  
    \>                 BaseContainer* bc;  
    \>                 mdat.bc = bc;  
    \>              DoCommand(mdat);  
    \>                 }  
    \>            }  
    \>       }  
    \>       return TRUE;  
    \>  }  
    \>  
    

    `

    and this is the error.

    warning C4700: uninitialized local variable 'bc' used

    I assume there is more I have to do to the basecontainer.

    :)
    ~Shawn



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

    On 03/09/2009 at 21:19, xxxxxxxx wrote:

    Don't use a pointer to it, just declare it as I did above. :)



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

    On 03/09/2009 at 21:25, xxxxxxxx wrote:

    hmm.. now I get this.

    error C2440: '=' : cannot convert from 'BaseContainer' to 'BaseContainer *'

    after changing

    BaseContainer* bc;

    to

    BaseContainer bc;



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

    On 03/09/2009 at 21:37, xxxxxxxx wrote:

    mdat.bc = &bc;

    That will do it.



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

    On 03/09/2009 at 21:43, xxxxxxxx wrote:

    yes it did. Thanks a lot Robert.

    Off to bed now.

    Thanks for your help.

    ~Shawn


Log in to reply