Accessing Selection Object List (COFFEE)



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

    On 12/02/2009 at 05:32, xxxxxxxx wrote:

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

    ---------
    Hi guys, I'm about to start my first coffee plugin - I'm new to both coffee and programming, though I've been familier with some of the concepts and with xpresso for some time.

    My plugin needs to access the Selection Object's 'Selection List' parameter. I want to be able to load a reference to the object(s) into variables.

    By dragging into the console, I have found out the data is called SELECTIONOBJECT_LIST but I'm unable to access the contents.

    If I put the following into a coffee tag on the selection object :

    main(doc, op)
    {
    println(op->GetData(SELECTIONOBJECT_LIST);
    }

    It gives an error 'object not found'

    I also tried to do it for just one of the objects in the list :

    main(doc, op)
    {
    println(op->GetData(SELECTIONOBJECT_LIST:0);
    }

    but I get a syntax error. I am not sure on the syntax for accessing a particular selection object in the list.

    Can anyone help?

    On a related note, is there a command that will allow me to interogate an object so it will return all its data types, so I can see the names and syntax (I especially want to know if the Sleection Object has a data that stores the number of objects in it's list).

    Thanks for your help.



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

    On 12/02/2009 at 06:05, xxxxxxxx wrote:

    Hi!

    This is the correct syntax:

    > \> main(doc, op) \> { \>     println(op#SELECTIONOBJECT_LIST); #syntax correct but will fail on runtime because the selecitonobject_list cnanot be accessed by coffee \> } \> \>

    'op' has to be the selection Object. So just create a coffee tag on your selection object and try this snippet.

    Bye :)



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

    On 12/02/2009 at 10:54, xxxxxxxx wrote:

    Thanks Shawni, makes sense.
    I'm disappointed I can't read the objects out of the selection list. Is there a way to use coffee to press the 'restore selection' button of the selection object ? This would allow me to work round it.
    How can I find out which objcts Coffee does and doesn't support ?



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

    On 12/02/2009 at 23:28, xxxxxxxx wrote:

    Hi!

    I don't know where you find a list which datatypes are supported. I just know you can't read out a list, gradient, splinegadget, etc.

    If you have just begun with Coffee you may find Py4D very interesting. http://py4d.xpresso24.com.

    With Python you can read out several other datatypes which you cannot read out with Coffee. In the next version this feature its supported to set/get such kind of elements.

    Cheers,

    Sebastian



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

    On 13/02/2009 at 01:01, xxxxxxxx wrote:

    Currently only basic data types are supported by COFFEE (integers, floats, vectors etc.). Unfortunatly there is no complete comparison chart of COFFEE and the C++ API.

    cheers,
    Matthias



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

    On 14/02/2009 at 02:13, xxxxxxxx wrote:

    Found a workaround !

    I looked in the description files and found the selection object has a SELECTIONOBJECT_RESTORE property.
    So I can restore the selection with :

    main(doc, op)
    {
        CallButton(op, SELECTIONOBJECT_RESTORE);
    }

    Of course I can't write to the selection object list but for my purposes I only need to read from it.

    Py4D certainly looks interesting but I'm going to stick to coffee as for now, I think it is going to work for my puropses and I'm starting to understand it a little bit.


Log in to reply