Notifications
Clear all

[Closed] SDK – applyable_class properties issue

The names are pointing to the proper value now because they were not initialized.

About the count getter/setter and get_property/set_property, Larry Minton (MAXScript developer at Autodesk) explains in the topic “How do I make properties and methods of a class?” of the sparks archive:
Larry Minton

You can only use the get_XXX and set_XXX forms of getting/setting properties when XXX is defined in biprops.h. You cannot add to this biprops.h file (as you found), as this file defines virtual functions on the Value class. Instead, you need to use the get_property and set_property methods, testing the property name passed in.

In biprops.h, count is defined as a property:

def_property( count )

If you want, I can send you a version with comments where I made the modifications to make it work.

2 Replies
(@pjanssen)
Joined: 10 months ago

Posts: 0

So where are they initialized now? Still the only thing that is declaring or doing anything with them is def_name(), or am I missing something?

About the count getter/setter and get_property/set_property, Larry Minton (MAXScript developer at Autodesk) explains in the topic “How do I make properties and methods of a class?” of the sparks archive:

I must have missed that thread, thanks

(@ypuech)
Joined: 10 months ago

Posts: 0

I will send you a commented version of testdlx to show you what I added/modified to make it work.

This thread explains how to make the names work. I just applied what Larry explains.

Edited: Also, mxsagni sample at samples\maxscript\mxsagni helped me a lot too! It uses the namedefs.h file method. In fact it’s the code of avg_dlx by Larry Minton.

Thanks again Yannick! I’ve now managed to make my own maxscript class, with custom properties.

I do still find it strangely designed, having to use different includes to have def_name do the right thing in the right place… But I guess it can’t be helped, let’s just try to avoid it as much as possible.

Ok, now for the next mystery: setting a value.
For some reason, not the set_property function is called when assigning a new value to one of the class properties, but the map(node_map&) function.
There is no documentation on the map function, or the node_map class…nor could I find anything in the Sparks archive. So once again, I’m stuck. 🙁

edit: messing around a bit with the map function seems to somehow invoke the set_property function. So now I’ve got something working, but I don’t yet know how…hehe.


if (m.vfn_ptr != NULL)
	vl.result = (this->*(m.vfn_ptr))(m.arg_list, m.count);

Page 2 / 2