ATTR_CATEGORY problem

Apr 26, 2011 at 11:51am

ATTR_CATEGORY problem

Hi List,

so the scenario is, I’d like to create a custom category for my attributes. After declaring the attributes, I add them to my new ‘custom category’ using CLASS_ATTR_CATEGORY. The problem is that this way I’m getting two different ‘custom categories’ at the same time, both containing all of my attributes. One is the category I created, and the other category has the name of my object. Has anyone an idea of what am I doing wrong?

Thanks,
Ádám

#56623
Apr 27, 2011 at 6:41am

Hello Siska Ádám,

i don’t think you are doing something wrong ; IMHO that is normal behavior ; in myObjectName’s label you get always ALL attributes you declare …

for instance :

CLASS_ATTR_LONG	(c, "genou", ATTR_FLAGS_NONE, t_flop, genou);
CLASS_ATTR_LONG	(c, "hibou", ATTR_FLAGS_NONE, t_flop, hibou);
CLASS_ATTR_LONG	(c, "chou", ATTR_FLAGS_NONE, t_flop, chou);

CLASS_ATTR_CATEGORY (c, "genou", ATTR_FLAGS_NONE, "ortographe");
CLASS_ATTR_CATEGORY (c, "hibou", ATTR_FLAGS_NONE, "ortographe");
CLASS_ATTR_CATEGORY (c, "chou", ATTR_FLAGS_NONE, "ortographe");

CLASS_ATTR_LONG	(c, "table", ATTR_FLAGS_NONE, t_flop, table);
CLASS_ATTR_LONG	(c, "chaise", ATTR_FLAGS_NONE, t_flop, chaise);
CLASS_ATTR_LONG	(c, "lampe", ATTR_FLAGS_NONE, t_flop, lampe);

i get (genou + hibou + chou + table + chaise + lampe) in “flop” attributes
and (genou + hibou + chou) in “orthographe” attributes.

Is there a trick to avoid that ?

#202969
Apr 27, 2011 at 8:09am

@Siska: I don’t get it

#vanille béchamel:

You can also do something like this:


CLASS_STICKY_ATTR(c, "category", 0, "orthographe"); // the 'h' in otrhographe is kinda required ;-)
CLASS_ATTR_LONG(c, "genou", ATTR_FLAGS_NONE, t_flop, genou);
CLASS_ATTR_LONG(c, "hibou", ATTR_FLAGS_NONE, t_flop, hibou);
CLASS_ATTR_LONG(c, "chou", ATTR_FLAGS_NONE, t_flop, chou);
CLASS_STICKY_ATTR_CLEAR(c, "category");

#202970
Apr 27, 2011 at 9:17am

Hi,

what I’d like to avoid is to get a category with the name of my object, as my object has a rather long name, and it doesn’t look cool if it appears as a category in the Object Inspector. I’ve seen, for instance, that the [number] object doesn’t have a category named ‘number’, although it has two custom-attributes in a category called ‘Value’ (these are the ‘minimum’ and ‘maximum’ attributes). So I’m pretty sure I can avoid having a category with my own object’s name, just I can’t realize, how…

Thanks,
Ádám

#202971
Apr 29, 2011 at 12:18am

Just to make my problem more clear, I uploaded a screenshot of the Inspector for my object. The problem is that now I have a category called 'Output' (which I wanted to have) with the two attributes, but I also have a category called 'sadam.foo', with the same two attributes. The question is: since I just need the 'Output' category, how can I remove the 'sadam.foo' category from the Inspector? I guess this can be done somehow, as for instance the [number] object doesn't have a category called 'number' in its Inspector, however, there's a category called 'Value', which is clearly a custom category that only exists for [number], other boxed objects don't have that category by default…

[attachment=160707,2153]

Attachments:
  1. ScreenShot.gif
#202972
Apr 29, 2011 at 7:50am

Hi Siska,

from what I can see, you are trying to give attributes to an non-UI object.
Non-UI objects will always display the name of the object (in this case sadam.foo) in a separate tab.
Have a look at metro or coll. They also behave the same way.
In my experience I have never been able to avoid that.

Number is a UI object and for some reason, with UI objects the problem does not occur.
That has probably something to do with the way attributes are implemented under the hood.

In any case if there is a trick to overcome this problem, I am not aware of it.
Maybe, someone at C74 could tell us…

- Luigi

#202973

You must be logged in to reply to this topic.