THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 26/08/2011 at 03:06, xxxxxxxx wrote:
Cinema 4D Version: 12
Language(s) : C.O.F.F.E.E ;
I'm going crazy to set a bitmap image for a custom user area.
i'm not using pyton or c++ but normal c.o.f.f.e.e. language.
Please any example? Big thanks
On 26/08/2011 at 08:51, xxxxxxxx wrote:
Here's a simple example using a Button , Textbox, and a UserArea.
Note the path to the bitmap image is at the end of the script:
// be sure to use a unique ID obtained from www.plugincafe.com
var PLUGIN_ID = 10000010;
// be sure to use a unique ID obtained from www.plugincafe.com
But_clicked, // This is the ID name I gave my Button. Use whatever name you want
DLG_EDIT_BOX = 1000,
_DUMMY_ // This is needed for the enum type to work.
// global variables
// definition of my user area
class MyUserArea : GeUserArea
DrawBitmap(bmp, 0, 0, 127, 127, x1, y1, x2, y2, BMP_NORMALSCALED);
class MyDialog : GeDialog // definition of my Dialog class
SetTitle("Test Bitmap Dialog");
ua = new(MyUserArea,5000,this);
AddEditText(DLG_EDIT_BOX, 0, 200, 0);
AddButton(But_clicked, BFH_SCALEFIT, 250, 20, "Click Me");
var doc = GetActiveDocument();
if (id == DLG_EDIT_BOX) //you got input from the text edit box.
text = GetString(DLG_EDIT_BOX); //grab the string from the edit box and store it into the text variable.
var len = sizeof(text); //find the size of the string (strlen for the C programmers)
if(id == But_clicked)
var obj = doc->GetActiveObject();
TextDialog("No Cube object was selected\n" + "Please select one", DLG_OK + DLG_ICONEXCLAMATION);
SetString(DLG_EDIT_BOX, "It Worked!");
class MyMenuPlugin : MenuPlugin
return "Test bitmap Dialog"; // The name shown in plugins menu
return "Shows programming of bitmap area";
if (!d) d = new(MyDialog);
d = new(MyDialog);
if (!bmp) bmp = new(BaseBitmap, 128, 128);
var fn = new(Filename);
fn->SetFullString("c:/Test.jpg");// references the c: directory
On 26/08/2011 at 09:33, xxxxxxxx wrote:
Thanks Scott one more question:
how to get the instance of a controller inside a dialog?
I mean, if i want to add a new controller as custom area at a group controller how can i do?
On 26/08/2011 at 10:16, xxxxxxxx wrote:
I'm not sure I understand your question.
When you say "controller". Are you talking about the various gizmos like: Buttons, textboxes, etc...
Are you asking how to lay them out and arrange them in your dialog window?
On 26/08/2011 at 10:26, xxxxxxxx wrote:
yes please help me i can't figure out!
Another thing i can't do is how to call a function when a button is clicked or a textbox changes value.
Thanks and again thanks
On 26/08/2011 at 11:01, xxxxxxxx wrote:
There are two types of methods to layout the gizmos in your dialog. And they depend on which way you create your gizmos.
In both methods. You use Groups to layout your dialog items.
The Coffee SDK docs also have some information on using Groups.
Method#1: The internal ("Add") method.
Where you add the gizmo's code to the same file as the code that executes something.
AddGroupBeginV(1000, BFH_SCALE|BFV_SCALE, 1, "", 0);
AddGroupBeginV(1001, BFH_SCALE|BFV_SCALE, 2, "", 0);
AddStaticText(1002, BFH_LEFT, 0,0, "X", 0);
AddEditNumberArrows(2000, BFH_SCALE, 80, 0);
AddStaticText(1003, BFH_LEFT, 0,0, "Y", 0);
AddEditNumberArrows(2001, BFH_SCALE, 80, 0);
AddStaticText(1004, BFH_LEFT, 0,0, "Z", 0);
AddEditNumberArrows(2002, BFH_SCALE, 80, 0);
Method#2: The external (.res file) method
Where you use a .res file to layout the gizmos.
Here is another example plugin that uses the external layout method:https://sites.google.com/site/scottayersmedia/Coffee_ResBasedMenuPlugin.zip
It might be helpful if you went to my site and download the CoffeeBible. And watched the videos. They address some of the things you've been asking about:https://sites.google.com/site/scottayersmedia/scripting
Just a word of caution.
Coffee is fading away. And Python is becoming the better choice for scripting in C4D.
But learning Coffee will help you if you decide to transition into C++ later on.
On 26/08/2011 at 11:15, xxxxxxxx wrote:
Yes i know already this but the problem is the group is created in design mode by resedit plugin and the custom area is added in a second time in the .cof code.
so i need to get the existing group inside the code and append the custom area.
So i understand phyton is better then coffiee (someone could say that in some maxon page?? ) Now if i've to choose a new language it's better use c++ or phyton? And why?
I'm checking your website, thanks!
On 26/08/2011 at 12:09, xxxxxxxx wrote:
From my experience. If someone asks that question they usually aren't ready for C++ yet.
You'll probably want to use Python (or Coffee) for a while. Then if the unsupported things bother you. You can always switch to C++.
On 26/08/2011 at 13:40, xxxxxxxx wrote:
yes but c++ used in c4d has more feature then coffiee or python? That's the second question.
The first and more important for me was:
i need to get the existing group inside the code and append the custom area.
On 26/08/2011 at 14:35, xxxxxxxx wrote:
I'm not sure I understand what you're asking.
If you want to know how to add a CustomUserArea into a plugin using a .res file. Then you would need to do something like this:
The C++ SDK docs do a better job of describing these descriptions than the Coffee SDK does.
If you plan on using .res files. You'll probably want to download the C++ docs.
To be honest. I don't even know if this will work properly in Coffee. I've never tried it before.
Coffee tends not to support things like CustomGUI's.
Which represents an example of how Coffee can quickly lead you into a dead end. Where using Python it should work just as well as in C++.
Python in C4D isn't that far behind C++ in terms of supported options. That's it's big selling point.
If you want the maximum support. Then of course C++ is the best choice.
But with that comes the down sides of longer, more complicated code. And the need to use a compiler.
I'm not trying to talk you out of C++. I'm just saying you should see what Python can do for you first. You might be surprised how much it supports.
Then you can make an informed decision whether or not it's worth the extra time to use C++ and a compiler.
On 26/08/2011 at 14:57, xxxxxxxx wrote:
now i can understand why c++ is best choose for coding plugin for c4d.
I know pretty well c++ and i know it is very power language but i didn't knew if c++ was better then coffiee on the c4d plugin SDK or if this was perfectly the same for the 3 languages. I thought languages was just a feeling choose in the case of c4d SDK but you say me no, so my choose is c++ now becouse i already know this.
i preferred coffiee becouse seem to be more simple but with same power on c4d. the answer is no, and now i know. GOOD.
Now i know that, just another question for you: how is possible to create the Dialog GUI in c++ if c++ doesn't use RES files? All programatically? Thanks
On 26/08/2011 at 15:28, xxxxxxxx wrote:
C++, Python, and Coffee all reference the .res files the same way.
In C++ you have the same choice whether to use the Add method in your .cpp files.
Or to use an external .res file.
If you are familiar with C++ and want to pursue that direction. Then the first thing you'll need to do is download the C++ docs. Then compile the SDK found in your plugins folder.
The SDK has lots of examples you can learn from in it.
If you have questions on compiling the SDK. The first part of my Intro to C++ tutorial shows how to compile the SDK.
Most of the guys in this forum are long time C++ users. And they can offer help on that better than I can.
On 26/08/2011 at 15:29, xxxxxxxx wrote:
thanks for your support