Validate data in a ToolPlugin [SOLVED]
-
On 12/07/2015 at 11:34, xxxxxxxx wrote:
Could I be checking for the wrong message?
Should it be MSG_DESCRIPTION_VALIDATE?
If it is, the structure is only:struct DescriptionValidate
{
public:
DescriptionValidate();
Int32 flags;
};So, I see no data there that could be useful to me
-
On 13/07/2015 at 01:20, xxxxxxxx wrote:
Well, I solved it by using a good old "previous state" global variable.
But there should be a way to know what value a user inputted, through the description structure. -
On 13/07/2015 at 03:07, xxxxxxxx wrote:
Hello,
ToolData is not based on NodeData so it works a little bit different. As Robert said, you define the GUI of a Tool using a Subdialog. In that subdialog class the Command() function is called when you change a GUI element. You have to catch that event to update the BaseContainer storing the settings of your tool. The tool settings are accessible with GetToolData(). In the GeDialog class you find functions to easily copy the current value from the GUI element into the given BaseContainer ("Container Get").
Best wishes,
Sebastian -
On 13/07/2015 at 04:32, xxxxxxxx wrote:
Oh, so I should keep a copy of the container of the dialog?
But only for reading purposes, right? Because there seems to be no SetToolData counterpart.
I just have my Tool dialog set with a res file and I work directly on the provided node (when there is one provided). Is that ok or it is something to avoid? -
On 13/07/2015 at 11:18, xxxxxxxx wrote:
Hello,
GetToolData() returns a pointer to the BaseContainer. So you can read and write the settings using this pointer.
Best wishes,
Sebastian -
On 24/07/2015 at 11:32, xxxxxxxx wrote:
Hello Rui,
was your question answered?
Best wishes,
Sebastian -
On 24/07/2015 at 11:48, xxxxxxxx wrote:
Well, I got parallel information that was useful
But the initial question was not answered. I still can't detect what gizmo was changed, when it gets changed.
However, I solved it but using global class variables that store the old values of gizmos and I go through all of them to check if some changed.
Not as efficient or elegant... but it works. -
On 27/07/2015 at 01:01, xxxxxxxx wrote:
Hello,
as said before, you can implement Command() in your subdialog to catch an event when a dialog gadget was changed. You can write the new value in to the tool's BaseContainer that can be accessed with GetToolData().
Best wishes,
Sebastian -
On 27/07/2015 at 01:18, xxxxxxxx wrote:
Yes, but I will have to create a duplicate of the dialog container, or at least keep variables to check the old value against the new, right?
Because Cinema 4D doesn't tell me what was the changed parameter. -
On 27/07/2015 at 09:57, xxxxxxxx wrote:
Hello,
GeDialog::Command() receives the ID of the changed gadget with the "id" argument. So you can easily update the BaseContainer.
Best wishes,
Sebastian -
On 28/07/2015 at 09:01, xxxxxxxx wrote:
Oh, I get it now
Thank you.