|
|
CINEMA 4D, Revision 6
COFFEE
plugin tutorial
(a link will be available for part 8 of this tutorial soon) coffee
tutorial 1: Introduction
For QuickStarters: * copy and paste the listing text (below) to a simple text editor and save it as a plain text file under the name 'lesson5.cof' into the C4D "plugins" folder. * restart c4d (or use the menu command "Reload Plugins") * Open the window "Console" * execute the plugin-menu command "coffee-lesson-5" * this time we move nearer to creating a house ;)
The Explanation: In comparison to coffee-lesson-4 there has been added a lot of new stuff.
There are different ways of programming. Some programmers code out of the blue, others tend to plan every step before typing a single letter. Extracting constants and variables lets you enhance and change your code more easily. For an explanation of constants and variables, please refer to a book on basic programming. The number of published books on this topic is overwhelming.
Doesn't do anything yet. I want you to be able to see the evolution of the plugin step by step. Exaggerated examples just confuse rather than explain anything well.
The input-element from coffee-lesson-4 has been rewritten and enhanced with a more complex dialogue. It is usual, that the user-interface takes up to 70% of the programming effort. It's always good to spend a significant time on this issue. Nobody likes to use an unfriendly, unusable Plugin. Without AddGroupBeginV, the following input-fields would be arranged vertically. This group means that 2 fields are positioned together horizontally. The meaning of the parameters like AddEditSlider and AddStaticText can be looked up in the SDK-documentation at www.plugincafe.com. Change the parameters, reload the plugin and watch. Testing is the best teacher. For a comparison, search the COFFEE SDK at www.plugincafe.com for the COFFEE flag "BFH_CENTER" and test the other flags. It is essential, that you are able to deal with the SDK-documentation. That's a programmer's bible. This is were our 10000 commandments are written down ;-)
The function "Init" has also been added. It ignites the initialisation of the dialog box icon's properties. This function is executed automatically after the dialog box's creation and after "CreateLayout()". The button "reset" (see below) uses this function equally. As always: read the SDK-documentation and test: what could SetPercent or SetColorChooser mean...?
After every operation in the dialog box, the function "command" is executed. This function decides if something - and what exactly has to be done. For example, after a click on the "reset" button, (eButInit), the function Init() is executed. Also, after a click on the "new house" button, a new house should be created. fMakeHouse() doesn't do anything... yet...
---------------------------------------- |
|
|
Vantage
Graphics and Design Limited Page last updated: 05 July 2001 |