[Bf-taskforce25] 2.5 io scripts design

Brecht Van Lommel brecht at blender.org
Sat Jun 20 22:35:18 CEST 2009


Hi,

Object.dupli_list should be defined like any other ListBase in the
Object struct, not dynamically. Just add the ListBase duplilist; at the
end of the Object struct in DNA_object_types.h, and wrap it like e.g.
particle_systems.

It is not the intention to run any RNA_def_* functions while
manipulating data structures. However what is causing the crash here is
that RNA_def_collection_runtime needs the collection pointer type to be
derived from IDPropertyGroup, only then does it really know how to
manipulate the data structure. It's not possible to dynamically create a
collection of any type because RNA can't know how to manipulate it.

I'll add a check for this and document it, but in this case, just avoid
doing any defining at all in this function, and do it as part of
rna_def_object in rna_object.c.

Brecht.

On Sun, 2009-06-21 at 02:08 +0600, Arystan Dyussenov wrote:
> Hi Brecht,
> 
> Again I need your help with RNA.
> 
> I get a crash when accessing DupliObject.object property.
> 
> DupliObject.matrix and DupliObject.ob_matrix can be accessed ok, but
> not DupliObject.object.
> 
> To reproduce the crash: open animation/dupliverts.blend in
> http://download.blender.org/demo/test/test249.zip, select the
> duplivert parent and run the following script:
> 
> ----------------------------------------------------------------------
> ob = bpy.data.objects["Plane"]
> ob.create_dupli_list()
> 
> ob.dupli_list[0].object
> 
> ob.free_dupli_list()
> ----------------------------------------------------------------------
> 
> I've checked DupliObject.object property definition, to me it looks
> ok. 
> I even defined a custom get function for this property, didn't help.
> 
> This crash happens in soc-2009-kazanbas branch, latest revision.
> 
> Arystan
> 
> On Fri, Jun 19, 2009 at 5:19 PM, Brecht Van Lommel
> <brecht at blender.org> wrote:
>         Hi,
>         
>         I would move DupliObject into DNA_object_types.h. The other
>         alternative
>         is to write manual get/set functions, but moving the data
>         structure
>         seems reasonable in this case. For storing the duplilist in
>         the object,
>         it seems easier to just create a ListBase in the Object
>         struct? It
>         doesn't really help to do this using RNA functions, mostly
>         seems to make
>         the code more complicated.
>         
>         Brecht.
>         
>         
>         On Fri, 2009-06-19 at 16:41 +0600, Arystan Dyussenov wrote:
>         > I've committed changes to my branch.
>         >
>         > On Fri, Jun 19, 2009 at 4:25 PM, Arystan Dyussenov
>         > <arystan.d at gmail.com> wrote:
>         >         Hi Brecht,
>         >
>         >         I need your help.
>         >
>         >         I've created a struct function to create duplilist
>         for an
>         >         object. It
>         >         uses object_duplilist which returns a dynamically
>         allocated
>         >         list of
>         >         DupliObjects. DupliObject struct I partially
>         RNA-wrapped.
>         >
>         >         But build fails with the following message:
>         >         http://www.pasteall.org/6214/text
>         >
>         >         Here's contents of rna_object_api.c:
>         >         http://www.pasteall.org/6215/c
>         >
>         >         Here's how I wrap DupliObject:
>         http://www.pasteall.org/6216/c
>         >
>         >         This is probably because DupliObject struct is
>         defined in
>         >         BKE_anim.h,
>         >         not in DNA_*.h.  What should I do?
>         >
>         >         Arystan
>         >
>         
>         > _______________________________________________
>         > Bf-taskforce25 mailing list
>         > Bf-taskforce25 at blender.org
>         > http://lists.blender.org/mailman/listinfo/bf-taskforce25
>         
>         _______________________________________________
>         Bf-taskforce25 mailing list
>         Bf-taskforce25 at blender.org
>         http://lists.blender.org/mailman/listinfo/bf-taskforce25
> 
> _______________________________________________
> Bf-taskforce25 mailing list
> Bf-taskforce25 at blender.org
> http://lists.blender.org/mailman/listinfo/bf-taskforce25



More information about the Bf-taskforce25 mailing list