Get The UserInterface Entries
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 20/11/2011 at 08:54, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R12
Platform:
Language(s) : C++ ;---------
Hi,
I've made a interface with some fields and a button. As soon as the button get pressed, I want to get all the Data from the Fields.BaseContainer bcFieldOne = C4dApi.GetCustomDataTypeDefault(C4dApi.DTYPE_LONG); bcFieldOne .SetString(C4dApi.DESC_NAME, "FieldOne"); bcFieldOne .SetLong(C4dApi.DESC_DEFAULT, 2); if (!descparams.Desc.SetParameter(cid, bcArme, new DescID(new DescLevel(C4dApi.ID_OBJECTPROPERTIES)))) return true; . . . BaseContainer bcButton = C4dApi.GetCustomDataTypeDefault(C4dApi.DTYPE_BUTTON); bcButton.SetLong(C4dApi.DESC_CUSTOMGUI, C4dApi.DTYPE_BUTTON); bcButton.SetString(C4dApi.DESC_NAME, "Test Button"); if (!descparams.Desc.SetParameter(cid, bcButton, new DescID(new DescLevel(C4dApi.ID_OBJECTPROPERTIES)))) return false;
So the question is How do I get the Data? I googled and found the function Message, but I'm not really sure if i do need that function.
Is there a other function which cinema calls as soon as there were changes made (like pressed a button)?
Any tipps?its an ObjectData Plugin
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 20/11/2011 at 12:00, xxxxxxxx wrote:
When you say "interface" do you mean that you're making a command data, dialog type of plugin?
The standard Buttons are kind of a special case in C4D. It's something that confused me a lot too.
Checking button clicks in the Message() method is only done when using descriptions (NodeData::Message). Not in dialogs.In a tag plugin that uses descriptions for example:
Bool SimpleTag::Message(GeListNode *node, LONG type, void *data) { switch (type) { case MSG_DESCRIPTION_COMMAND: // MSG_DESCRIPTION_COMMAND is sent when button is clicked { DescriptionCommand *dc = (DescriptionCommand* )data; // data contains the description ID of the button LONG button = dc->id[0].id; // Get the ID of the button switch (button) // Check for different button IDs { case BUTTON1: GePrint("Button1 was pushed"); break; case BUTTON2: myDialog *dlg = gNew myDialog; dlg->Open(DLG_TYPE_MODAL, TAG_PLUGIN_ID); break; } } } return TRUE; }
If you are working with a dialog. You would not use the Message() method.
You put your button code in the Command() method:Bool myDialog::Command(LONG id,const BaseContainer &msg) { LONG second = msg.GetLong(BFM_ACTION_VALUE); //Assigns an action to a variable switch (id) { case MY_BUTTON: GePrint("Button Was Pressed"); break; case MY_CHECKBOX: GePrint("CHKBox was Toggled"); break; case MY_COMBOBUTTON: if(second == SECOND_CHILD) GePrint("Second Option Selected"); break; } return TRUE; }
In some cases (like the combo button here) you'll need to use things like BFM_ACTION_VALUE
to tell C4D that something has been changed(executed).-ScottA
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/12/2011 at 02:17, xxxxxxxx wrote:
thank you very much. I kinda getting know a bit of a problem with the getParameter function
I tried these variantionsBaseContainer bc = op.GetDataInstance(); GeData data; //DescID cid = new DescID(new DescLevel(SKELETT_TYPE, C4dApi.DTYPE_LONG, 0)); bc.GetParameter(SKELETT_ARME, data); C4dApi.MessageDialog("TEST "+data.GetLong());
BaseContainer bc = op.GetDataInstance(); GeData data; op.GetParameter(new DescLevel(SKELETT_ARME), data,DESC_FLAGS_GET.DESC_FLAGS_GET_0); C4dApi.MessageDialog("TEST "+data.GetLong());
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/12/2011 at 08:11, xxxxxxxx wrote:
Here's a simple example:
GeData d; // Create a variable to store what we get using GetParameter() next objcube->GetParameter(DescID(PRIM_CUBE_SUBX), d, DESCFLAGS_GET_0); // Get the value stored in the cubes's segment parameter and store it in the "d" variable Real divisions = d.GetReal(); // Result from GetParameter is type GeData which can't be printed. So this gets the actual value and assigns it to a variable GePrint(RealToString(divisions)); // Now that we have a Real data type. We can print the actual integer based result
BTW. I noticed that you keep using this syntax: C4dApi.Whatever
You should not need to use that C4dApi prefix.-ScottA
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/12/2011 at 08:35, xxxxxxxx wrote:
uhm cause I'm using C# I've wrapped most of the C4d api from c++ to c#
thank you!
It seems that it has some difficulty with buttonsBaseContainer bc = op.GetDataInstance(); GeData data = new GeData(); DescID cid = new DescID(new DescLevel(SKELETT_BTN_CREATE, C4dApi.DTYPE_LONG, 0)); bc.GetParameter(cid, data); bool wert = data.GetBool(); if (wert == true) { C4dApi.MessageDialog("test 1234 " + wert);
Because I never get into the if.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/12/2011 at 12:36, xxxxxxxx wrote:
I'm still learning how to control descriptions myself. So I might not be the best person to help you.
But what I can do is give you the source code to this tag plugin I made:
https://sites.google.com/site/scottayersmedia/Simple C%2B%2B Tag.zipI build these kinds of plugins that don't do anything except show how to set up various GUI options. So I can use them as references later on.
The SDK examples are kind of weak in this area. Especially for new people trying to understand how all of the GUI stuff works.The plugin contains examples of the following:
-Hide & unhide descriptions
-Change the description data on one GUI item when another one is clicked
-Buttons that can trigger a print event(or anything else if you wish)
-Using a custom Icon on a multibutton
-Gets FPS data
-Use a timer function
-etc...Hopefully that will be help answer some of your questions.
-ScottA -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/12/2011 at 03:33, xxxxxxxx wrote:
Hm yeah thanks singleid isn't available for me yet.
Ok I solved it on a other way, Im not sure if thats good Programming but it worksBaseContainer data=GetDataInstance(node); bool temp = data.GetBool(SKELETT_ARMS_CHECKBOX); if (temp == true) { bcArme.SetBool(C4dApi.DESC_HIDE, false); } else { bcArme.SetBool(C4dApi.DESC_HIDE, true); }
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 21/12/2011 at 08:54, xxxxxxxx wrote:
hm I'm currently trying to get the Objectname I've linked to via DescItm setLink
for example:
I've a cube in my Object Manager and my plugin. I select the Cube with the setLink Item this works fine. But now if i press a button i wan't to get the Objectname or any reference to the object so i can use it in the further code.cid = new DescID(new DescLevel(TEST_OBJ_SELECTION, C4dApi.DTYPE_BASELISTLINK, 0)); BaseDocument doc = C4dApi.GetActiveDocument(); BaseContainer objSel = C4dApi.GetCustomDataTypeDefault(C4dApi.DTYPE_BASELISTLINK); objSel.SetLink(SKELETT_OBJ_AUSWAHL, doc); objSel.SetString(C4dApi.DESC_NAME, "PologonObjekt Wählen"); if (!descparams.Desc.SetParameter(cid, objSel, new DescID(new DescLevel(C4dApi.ID_OBJECTPROPERTIES)))) return true; -------------------------------------------------------------------------------- BaseDocument doc = C4dApi.GetActiveDocument(); BaseList2D objSe = b.GetLink( TEST_OBJ_SELECTION ,doc); switch (button) { case BTN_CREATE: GePrint("Button was pressed " + objSe.ToString()); break; } return true;
All i get is "Button was pressed C4d.BaseList2D "
OK lol the solution is objSe.GetName() incase anyone gets the same problem
or better objSe->GetName(); cuz you guys use c++