Notifications
Clear all

[Closed] (c++ SDK) problem with _is_collection

I was asking the same question on Area but didn’t have an answer… Maybe here someone can help me.

I have a local visible class which was originally defined with
BOOL _is_collection() { return 0; }
that means it’s not a collection. It’s fine, and works right.

Now I want to change it to be a collection… But simple changing to
BOOL _is_collection() { return 1; }
screws everything up. It compiles fine but has a lot of issue in use.

Does it make sense for anyone? Did anyone meet a similar problem?

Below there is a ‘minimal’ implementation of a visible applyable class.
I don’t see anything wrong in the code, and I’ve tried almost everything to make it works. But I couldn’t get it working!!!

The problem is – with _is_collection() defined as TRUE, all local properties are going through a built-in set_property method. And there is no way to override it.

If I define _is_collection() as FALSE, everything works as expected.

here is a code (attached):

Should I report it as bug, or I’m missing anything?

Thanks

6 Replies

what happens if you implement as a local_applyable_class as per the example in

\maxsdk\howto\maxscript estdlx\dlxClass.h && \dlxClass.cpp ?

it gives absolutely the same result,
as well as changing to visible_class (not applyable but creatable with extra published methods)

i found something and see the problem now…

if you change “parameter” property definition to “count” for example it starts working. you can try to change
def_property(count) , and add set and get count methods. in this case overridden version of set-property works.

that means the bug not happens for “built-in” properties like count, center, pivot, min, max, etc.

and lists of these properties are different for collections and not collections

for example properties: value, parameter, parameters; works well for not collections, but doesn’t work for collections.

and it happens only in mxs usings (in my case try):

a = testvalue()
a.parameter = <anything>

try adding

def_name (parameter)

to the top of the cpp file

it’s already defined usually in “maxscript\protocols\corenames.inl”