Free Coffee List Class



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

    On 30/09/2011 at 12:13, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   any 
    Platform:      
    Language(s) :   C.O.F.F.E.E  ;

    ---------
    Hello,

    missing a class for a dynamic set of data in COFFEE ? Like Python lists for example ?
    The clList class is exactly what you search for. Append items, remove items, pop 'em out !

    The code is Open Source and the methods have a short description. You may use the code in private and commercial projects.

    An example of how to use the class:

     **include** "clList.coh"_// note that it doesn't work in the Script Manager. ;)  
    _  
     **main** (doc, op) {  
      op = doc->GetFirstObject();  
        var list = new(clList, NULL);  
      list->message_errors = FALSE;  
        while (op) {  
         list->append(op);  
         op = op->GetNext();  
      }  
        println(list->getLength());  
      try {  
            list->pop2(3);  
      }  
      catch (ExOutOfRange) {  
          println("I expected minimum 4 objects on the hierarchies top level.");  
      }  
      try {  
            list->remove(doc->GetActiveObject());  
      }  
      catch (ExNotAMember) {  
          println("Seems like there is no object in the scene.");  
      }  
        println(list->getLength());  
    }
    

    Download: clList10.zip

    Post bugs here

    Cheers,
    Niklas



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

    On 30/09/2011 at 12:58, xxxxxxxx wrote:

    Where are you putting your .coh file?

    I've used .cof & .coh files with coffee plugins. By putting them in the plugins folder.
    But I've never been able to call to .coh file classes from within the script manager that way.
    To do that. I've had to put my custom classes & methods in the coffee folder. But the extension had to be .cof for it to work.

    In your example. It looks like you're calling to the class in your .coh file from within the script manager.
    And I'm wondering how you're doing that?

    -ScottA



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

    On 30/09/2011 at 13:15, xxxxxxxx wrote:

    I am sorry I confused you, It was just as an example. Idk if it's possible to include from the SkriptManager, but it would be good to find out.

    You said they had to be .cof to include them into your plugins ? It works for me with any file extension, but the filename must be given with suffix.

    Have you tried the class ?

    Cheers,



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

    On 30/09/2011 at 13:32, xxxxxxxx wrote:

    No. I haven't tried it yet because I was trying to call to it from the script manager and getting errors.
    Your examples gave me the impression you were doing it from the script manager.
    I'll have to try it out with a plugin when I get a chance.

    What I was talking about with .cof files is something different.
    We can create our own custom coffee classes and methods similar to what you did. But if you put them in the resource/modules/coffee folder. They will be globally available to use and call to. Even from inside the script manager. But...They need to have the file extension of (.cof).

    -ScottA



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

    On 30/09/2011 at 13:38, xxxxxxxx wrote:

    Ye, sorry again for the confusion.

    Ah I remember, this is actually very awesome. But not very portable to say 'put this here and that there and then copy the script to this directory an run it' ^^

    Cheers


Log in to reply