How to GePrint variables..



  • On 12/04/2014 at 08:58, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R14 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    Hi really silly basic question here:

    How do i print variables and objects to the C4D console?

    I know i can use something like:

    GePrint(LongToString(myLong));
    

    But is there an easier way if you have a lot of different variable types and objects?

    Transitioning from Python where i could pretty much just say Print(myObjectOrVariable) and it`d dump it onto the console..



  • On 12/04/2014 at 09:27, xxxxxxxx wrote:

    Just write some wrapper functions for your own use. Something like:

    inline void Print(const LONG x, String prefix = String())
    {
    GePrint(prefix + " " + LongToString(x));
    }

    If you want this to be done for any object, you would probably write some templates for it (with specializations for certain types).

    There are surely more ways but honestly, it's not worth the trouble. Just define some functions for your own use. Quick n dirty ;)



  • On 12/04/2014 at 11:22, xxxxxxxx wrote:

    Cheers Katachi.  Quick and dirty is fine.  Transferring my plugin code from Python to C++, debugging is a little more tedious..

    Wonders if C++ 11 converts things to strings automatically *rolls eyes*



  • On 12/04/2014 at 11:29, xxxxxxxx wrote:

    Won't happen.  The 'strings' that you will be using in the C4D C++ API are C4D Strings (class) and methods like LongToString() et al are what you have to work with.



  • On 12/04/2014 at 11:46, xxxxxxxx wrote:

    Yeah i figured that might be the case :/

    Slowly but surely getting accustomed to working in VS and C++..


Log in to reply