I need help with rna PROP_COLLECTION and Python template_list()

I am coding a filter system for the Outliner. My system uses two “collections” which represent collections of filters and collections of collections of filters. I have modeled my system after the rna(e.g. rna_def_scene_keying_sets()) and python code for the keying sets in the Properties editor. Man, I have compared, again and again, the keying set code against my code, and they seem to match up/correlate perfectly except for different names.

My first collection’s C struct is called struct TreeFilterList and it contains a ListBase of my second collection. My second is called struct TreeFilterElement and it is supposed to hold all the meaningful data used to filter the Outliner. The Python names and C struct names are identical.

My problem is with the Python template_list() for TreeFilterElement. The problem is that regardless of which UI list element/list is active, only the last UI list element/list properties’ values(e.g. “labelddd”) can be changed or even shows up in Blender’s UI - even after a refresh. Again, it doesn’t matter which template_list() element is actually active - only the last element’s data actually appears on screen or can be altered.

Question: Why might the problem, mentioned above, be happening - my collections seem to correlate perfectly with the keying set collections code?

EDIT: I might post some code later if no one has an answer.

Ok. I figured it out.

The problem was that I was using (TreeFilterList *)ptr->id.data; as opposed to (TreeFilterList *)ptr->data; within my RNA_def_property_int_funcs() get and set functions. The corresponding keying set get and set functions actually did it the latter way. So, my code didn’t match up perfectly with the keying set code after all…

I don’t really know when to use ptr->id.data and when to use ptr->data. That’s the problem.