my plugin problems
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 08/09/2009 at 19:04, xxxxxxxx wrote:
You'll have to remove the definition of ModelCommandData mdat and BaseContainer bc from Message(). Local variables always override more global variables.
Do you actually get the GePrint() in Message() when the button is clicked?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 08/09/2009 at 19:12, xxxxxxxx wrote:
yes I get the GePrint from Message() That says "Subdivide Button Clicked" I also get the first GePrint from Subdivide() that says "In Subdivide" I do not get the one at the end of Subdivide that says " End of Subdivide.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 08/09/2009 at 19:15, xxxxxxxx wrote:
okay when I remove the definitions of ModelCommandData mdat and BaseContainer bc from Message(), c4d crashes when I click the button.
~Shawn
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 08/09/2009 at 19:16, xxxxxxxx wrote:
scratch that.. it doesn't crash anymore.. but still does nothing..

-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 08/09/2009 at 19:19, xxxxxxxx wrote:
GePrint("End Of Subdivide"); shows up now because I moved it above return TRUE;
Seems like it's running the code in Subdivide() but it's not effecting the object.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 08/09/2009 at 20:29, xxxxxxxx wrote:
Yeah, I was going to mention that the "End of Subdivide" would never print.

The only thing that I can think of is that the object isn't really a Polygon object. For something like subdivision it must be. But if it is, then I'm at a loss. One thing to check is if SendModelingCommand() is succeeding or failing (if (!SendModelingCommand(...)). Another is to verify that the document is not a clone. Many times, Cinema 4D passes a clone of the document (like for rendering or generator plugins). I couldn't imagine this for a tool but best to verify, verify, verify!
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 08/09/2009 at 20:37, xxxxxxxx wrote:
How can I make sure that the object is really a polygon object?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 08/09/2009 at 20:46, xxxxxxxx wrote:
if (objPoly->IsInstanceOf(Opolygon)) // It's a polygon object

-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/09/2009 at 02:52, xxxxxxxx wrote:
Here's the Subdivide function with a few new checks in there...
> `
\> Bool SculptTool::Subdivide(ModelingCommandData &mdat;) \> { \> GePrint("In Subdivide"); \> //CODE RELATED TO THE SUBDIVISION OPTIONS///////////////////////////////// \> \> //Define Variables \> \> PolygonObject *objPoly = ToPoly(mdat.doc->GetActiveObject()); \> \> \> if (objPoly->IsInstanceOf(Opolygon)) \> { \> GePrint("It's a Polygon"); \> } \> else \> { \> GePrint ("It's not a polygon"); \> return FALSE; \> } \> \> \> mdat.op = objPoly; \> \> //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());//Shows the current polygon count \> if (!SendModelingCommand(MCOMMAND_SUBDIVIDE, mdat)) \> { \> GePrint("FAILURE"); \> } \> else \> { \> GePrint("SUCCESS"); \> } \> \> GePrint("End Of Subdivide"); \> return TRUE; \> \> //END SUBDIVISION OPTIONS///////////////////////////////////////////////// \> \> \> } \>`
In the console I get
> `\> Subdivide Button Clicked \> In Subdivide \> It's a Polygon \> SUCCESS \> End of Subdivide \>`
But still it does not subdivide the current polygon object in the scene.
Anyone know why this is? SEE above for other code in the plugin.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/09/2009 at 18:30, xxxxxxxx wrote:
okay so I stripped it back down to just the message() and the DoCommand () code looks like this.
> `
\> Bool SculptTool::Message(BaseDocument* doc, BaseContainer& data, LONG type, void* t_data) \> { \> PolygonObject *op = ToPoly(doc->GetActiveObject()); \> switch (type) \> { \> case MSG_DESCRIPTION_COMMAND: \> { \> DescriptionCommand *dc = (DescriptionCommand* ) t_data; \> if (dc->id[0].id==COMMAND_SUBDIVIDE) \> { \> GePrint("Subdivide Button Clicked"); \> //Determine Attributes \> mdat.doc = doc; \> mdat.bc = &bc; \> mdat.op = op; \> \> \> mdat.mode = MODIFY_ALL; \> DoCommand(mdat); \> } \> \> } \> } \> return TRUE; \> \> } \> \> Bool SculptTool::DoCommand(ModelingCommandData &mdat;) \> { \> GePrint("In DoCommand"); \> \> SendModelingCommand(MCOMMAND_SUBDIVIDE, mdat); \> \> return TRUE; \> } \>`
Now when I click the button, the object subdivides.
but I have no control over the attributes.When I try to add in the following.
> `
\> //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, bc->GetLong(NUM_SUBDIVISIONS)); //Set Number of Subdivisions \> mdat.bc->SetReal(MDATA_SUBDIVIDE_ANGLE, mdat.bc->GetReal(MAX_ANGLE)); //Set Maxiumum Angle \>`
It won't recognize the attributes and won't subdivide at all. Must be something in the way I am using the base container. Any thoughts about this? Anyone know how I could edit the first code to be able to adjust subdivision attributes from the NUM_SUBDIVISIONS long and the MAX_ANGLE real?
Thanks,
~Shawn
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/09/2009 at 01:22, xxxxxxxx wrote:
Don't pass the BaseContainder from Message() to mdat.
Do something like this:
BaseContainer bc;
bc.SetLong(MDATA_SUBDIVIDE_SUB, data.GetLong(NUM_SUBDIVISIONS));
bc.SetReal(MDATA_SUBDIVIDE_ANGLE,data.GetReal(MDATA_SUBDIVIDE_ANGLE));
ModelingCommandData mdat;
mdat.doc = doc;
mdat.bc = &bc;
mdat.op = op; //pass the pointer to the object
SendModelingCommand(MCOMMAND_SUBDIVIDE, cd));cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/09/2009 at 02:58, xxxxxxxx wrote:
LOL... it's always so simple. Thanks, Matthias.. works like a charm now.
~Shawn