C coding help on Label Function ...

Hi all,

I continue maintening an improving blend2pov but…
I can’t get name ‘argument’ of an ID ‘struct’ passed throw a LABEL button
incompatible type…
It’s should be very simple…when you know how to :slight_smile:

I can’t get the Label data normaly stored in pov.name with &la->pov.name
compile time error


ID pov

uiDefButC(block, TEX, B_REDR, “”, 100,95,200,19, &la->pov.name, 0.0, 21.0, 0, 0, “”);

pov<<" projected_through { OB"<<lamp->pov.name << " }"

Thanks for helping

You didn’t specify, what error you’re getting. I’m assuming something like
warning: passing arg 9 of `uiDefButC’ from incompatible pointer type.

The problem is that you’re passing the address of character array - i.e. you are passing a pointer to a pointer to a character. Instead you should be passing just a pointer to a character. So if you drop the &, it will work ok.

uiDefButC is accepts pointer to character:

uiBut *uiDefButC(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2,  char *tip)

ID.name is character array of the length 24

typedef struct ID {
        void *next, *prev;
        struct ID *newid;
        struct Library *lib;
        char name[24];
        short us;
         * LIB_... flags report on status of the datablock this ID belongs
         * to.
        short flag;
        int icon_id;
        IDProperty *properties;
} ID;

Since character array is already a pointer, you should be using

uiDefButC(block, TEX, B_REDR, "",    100,95,200,19, la-&gt;pov.name, 0.0, 21.0, 0, 0, "");