SendModelingCommand() with plugin ID

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

On 14/06/2009 at 16:41, xxxxxxxx wrote:

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

---------
I'm creating a DescriptionToolData plugin. The framework has been set up and I'm ready to incoprorate my code.

DescriptionToolData::Message() has this:

> \> StopAllThreads(); \> if (md.doc) \> md.doc->StartUndo(); \> SendModelingCommand(GetToolPluginId(), md); \> if (md.doc) \> md.doc->EndUndo(); \>

How do I use SendModelingCommand()in this way? All examples I've found use SDK command IDs.

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

On 16/06/2009 at 14:55, xxxxxxxx wrote:

Can someone please help me with this?

I have this and another DescriptionToolData plugin in the works can't go any further until I have an answer.

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

On 17/06/2009 at 00:54, xxxxxxxx wrote:

Sorry but I don't understand your question. What tool do you want to execute through SendModelingCommand()? If you just want to call your own tools simply pass the plugin ID. For CINEMA 4D's own tools look in the SDK docs for the IDs, also in modelingids.h or through the Command manager.

cheers,
Matthias

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

On 17/06/2009 at 00:59, xxxxxxxx wrote:

Definitely wants to call his own tool. It might be that he doesn't understand that he must fill a BaseContainer with settings from his plugin's Descriptions and add it to the ModelingCommandData? That is the way it seems that it works for C4D's default tools (ID_MODELING_xxxx) - otherwise it will use the default values (??).

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

On 17/06/2009 at 05:04, xxxxxxxx wrote:

Yes, I want to call my own tool. I understand how SendModelingCommand()works for the default tools but not for executing my own plugin.

I'm trying to implement my Wedge Extrude COFFEE plugin as a DescriptionToolData plugin. I've successfully created the framework based on c4d_descriptiondialog.cpp but am not clear on how to execute my plugin code in this context.

Do I for example add a separate, hidden plugin to the project to perform the extrusions and pass its ID to SendModelingCommand()?

I'm still very much at the beginning of the C++ SDK learning curve, so please forgive any obvious or confusing questions.

Thanks for your patience.

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

On 17/06/2009 at 05:25, xxxxxxxx wrote:

Have you checked the edgecuttool.cpp in the SDK examples? It's a complete example of a DescriptionToolData plugin. You don't actually call SendModelingCommand() with your own plugin in this context.

cheers,
Matthias

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

On 17/06/2009 at 06:03, xxxxxxxx wrote:

Thanks for the suggestion. I started with Edge Cut but found building my own framework based on c4d_descriptiondialog.cpp to be more straightforward. Also, I note that it's the basis of Matrix Extrude, which has strong similarities with my plugin.

If I can just figure out how to execute my code with SendModelingCommand() in DescriptionToolData::Message() I'll be flying.

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

On 17/06/2009 at 06:20, xxxxxxxx wrote:

Sorry I still don't understand why you would want to call SendModelingCommand() in your tools Message() method. I think you go wrong about it.

It works usally like this (this is true for most CINEAM 4D plugins) :
-derive your plugin from one of the plugin data classes (ObjectData, ShaderData etc.)
-overload the necessary virtual methods with your own code

Have a look at the example below, here I derived my own plugin from the DescriptionToolData class. Next thing would be to overload the virtual methods. MouseInput lets you react to mouse inputs. DoCommand is called if someone is calling your tool through SendModelingCommand.

For you there is no need to call SendModelingCommand as far as I can tell from your post.

> \> class MyTool : public DescriptionToolData \> { \>      public: \>           MyTool(); \>            \>           virtual LONG               GetToolPluginId() { return ID_MY_TOOL; } \>           virtual const String     GetResourceSymbol() { return String("My Tool"); } \> \>           virtual Bool               MouseInput(BaseDocument \*doc, BaseContainer &data;, BaseDraw \*bd, EditorWindow \*win, const BaseContainer &msg;); \>           virtual LONG               GetState(BaseDocument \*doc); \> \>           virtual void               InitDefaultSettings(BaseDocument \*doc, BaseContainer &data;); \>           virtual Bool               DoCommand(ModelingCommandData &mdat;); \>           virtual Bool               GetCursorInfo(BaseDocument \*doc, BaseContainer &data;, BaseDraw \*bd, Real x, Real y, BaseContainer &bc;); \> \>           virtual Bool               GetDEnabling(BaseDocument \*doc, BaseContainer &data;, const DescID &id;,GeData &t;\_data,LONG flags,const BaseContainer \*itemdesc); \>           virtual LONG               Draw(BaseDocument \*doc, BaseContainer &data;, BaseDraw \*bd, BaseDrawHelp \*bh, BaseThread \*bt,LONG flags); \> }; \>

Please take a look again at the edgecut tool example to see how it works in detail.

cheers,
Matthias

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

On 17/06/2009 at 06:49, xxxxxxxx wrote:

I was basing my assumptions on the contents of DescriptionToolData::Message() as set out in c4d_descriptiondialog.cpp but these assumptions are obviously wrong.

I'll delve back into Edge Cut and work things out from there.

Thanks for persisting with this and helping to steer me back on track.

This baby will fly!