Need a little help gett. start. in XCode



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

    On 23/09/2007 at 15:12, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   10.102 
    Platform:      Mac OSX  ; 
    Language(s) :     C++  ;

    ---------
    Hello,

    I feel a bit embarrassed because I'm asking a lot of basic stuff but I need a little help getting started.

    A want to adopt one of my COFFEE plugins to C++. This plugin is nothing special, just a little dialog plugin. I duplicated the cinema4dsdk folder, renamed it, deleted all the stuff and so on...

    Here is my skeleton:

      
    #include "c4d.h"  
    #include "c4d_symbols.h"  
      
    LONG PLUGIN_ID = 1000008;  
    String ap_version = "1.0";  
      
    class ap_gui : GeDialog {  
         private:  
              Bool sel, ref_point;  
                
         public:  
              ap_gui();  
              virtual Bool     CreateLayout();  
              virtual Bool     InitValues();  
              virtual Bool     Command(LONG id, const BaseContainer& msg);  
    };  
      
    ap_gui::ap_gui() {  
      
    }  
      
    Bool ap_gui::CreateLayout() {  
         return TRUE;  
    }  
      
    Bool ap_gui::InitValues() {  
         return TRUE;  
    }  
      
    Bool ap_gui::Command(LONG id, const BaseContainer& msg) {  
         return TRUE;  
    }  
      
      
    class APoints : public BaseData {  
         public:  
              APoints();  
              virtual Bool     Execute(BaseDocument* doc);  
              virtual LONG     GetState(BaseDocument* doc);  
              virtual Bool     RestoreLayout(void* secret);  
    };  
      
    APoints::APoints() {  
      
    }  
      
    Bool APoints::Execute(BaseDocument* doc) {  
         return TRUE;  
    }  
      
    LONG APoints::GetState(BaseDocument* doc) {  
      
    }  
      
    Bool APoints::RestoreLayout(void* secret) {  
         return TRUE;  
    }
    

    Still need to create a main.cpp and register the plugin.

    But where do I have to put all my files? Right now the XCode project files are in a folder inside the plugins folder of Cinema. The build files are in another folder outside Cinema. Do I have to copy the required files inside a new folder with the res/dialogs structure. Or should I create the same structure inside the XCode project? XCode also needs the dialogs description, no?

    Also, is there a simple dialog example using BaseData in the cinema4dsdk? I couldn't find one. Only tools, shaders, tag plugins...



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

    On 23/09/2007 at 15:40, xxxxxxxx wrote:

    You'll need to copy your plugin's res folder to a folder inside of your Cinema 4D 'plugins' folder:

    Cinema 4D R10
    ->plugins
    -->myPlugin (or whatever)
    --->res
    --->myPlugin.dylib (or .cdl, cdl64, .xdl for other systems)

    Keep a source res with your build source code for builds. After modifying the res files and building the plugin, copy the source res folder and plugin to the one in the Cinema 4D install for testing.

    Don't ever use BaseData! It is the base class for plugin data structures and contains absolutely nothing (except a constructor and destructor). You need to use one of the derived classes - i.e.: CommandData for a dialog plugin run from the Plugins menu. Otherwise, the plugin won't work. So:

    class APoints : plugin CommandData
    ...



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

    On 24/09/2007 at 11:11, xxxxxxxx wrote:

    Hey, thanks for your help.

    Does that mean that the XCode project folder needs to have the same directory structure as described in the doc? With all the .res and .str files for dialogs? I mean, he's going to need those files for the build, no?

    Second thing I don't get is: I duplicate the existing sdk folder, open it in XCode, rename it, and then, I delete everything inside the source folder, to have a clean project again. So why duplicating it before if you're going to delete it afterwards :/



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

    On 24/09/2007 at 11:36, xxxxxxxx wrote:

    Yes, the project folder should look something like this:

    myPlugin
    ->myPlugin.xcodeproj
    ->[myPlugin.dylib] (this is where the built plugin should end up upon successful build - although there is a default project build folder where the intermediate and end files are placed during building - as mentioned in the docs)
    ->source
    ->res
    -->description
    -->strings_us
    ...

    The source folder isn't necessary for storing the source code, but it keeps things neat. This doesn't need to be copied to the Cinema 4D install - just the res folder and dylib.

    On the second thing - build configuration and the api lib. By duplicating the existing sdk folder, you get the correct build settings (which are hellish in themselves) and the api library build project is automatically included - this is absolutely necessary. It is possible to replace the api lib project with an already built _api.dylib, but one must be careful not to lose the other information that this brings in: namely, all of the SDK includes and resource descriptions.

    Really, the only thing you are going to delete from the sdk copy are the source files and the resources, maybe keeping those for the type of plugin your are creating. After your first project, you can then use that instead as a basis for the next project.



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

    On 25/09/2007 at 08:09, xxxxxxxx wrote:

    Ok, I think I figured it out now. Thank you again, for your help.


Log in to reply