[Bf-committers] RNA_def_struct_sdna_from using a non-DNA struct

Lukas Tönne lukas.toenne at gmail.com
Mon Aug 10 15:26:07 CEST 2015


 I think this is not an issue with non-DNA structs in RNA: you can make RNA
struct types that have no relation to DNA whatsoever (although it's a lot
more cumbersome because every property has to use getter/setter callbacks).

What this code seems to do is
1) define the 'EditMuscleData' RNA type
2) define a property 'data' of EditMuscleData - which is supposedly also of
EditMuscleData type! (2nd argument to RNA_def_struct_sdna_from)

This would require a nested RNA struct type, which is not possible afaik. I
guess the 'data' property is of a different type anyway. If you need more
help please paste the full DNA/RNA code to www.pasteall.org and post a link
here (to avoid excessively long mails).

Cheers

On Mon, Aug 10, 2015 at 2:17 AM, Rohan Smith <rohan.preacher.smith at gmail.com
> wrote:

> Hi,
> I'm working on a physically based animation system using Blender and
> Blender's real time engine. To this end, I've modified my version of
> Blender to split Bones and EditBones up into three sections,
> ArmatureElements which store spatial information and a pointer to
> specific data structs, BoneData which stores bone specific data such as
> mass and physics properties, and MuscleData which stores muscle specific
> properties. These are all in the DNA system, but the Edit version of
> these structs are not.
>
> When trying to setup the RNA code to work nicely with this setup, the
> non-Edit structs work fine, but I get a "RNA_def_struct_sdna_from:
> EditMuscleData not found." error in makesrna when I try to use
> RNA_def_struct_sdna_from with the Edit versions. Without this the code
> in the generated .c file does not do the proper dereferencing.
>
> static void rna_def_edit_muscle(BlenderRNA *brna)
> {
>      StructRNA *srna;
>
>      srna = RNA_def_struct(brna, "EditMuscleData", "EditArmatureElement");
>      RNA_define_verify_sdna(0);
>      RNA_def_struct_sdna(srna, "EditMuscleData");
>      RNA_def_struct_ui_text(srna, "Edit Muscle Data", "Edit mode Muscle
> specific data of an Armature Element");
>
>      RNA_def_struct_sdna_from(srna, "EditMuscleData", "data");
>
>      rna_def_muscle_common(srna, 1);
>
>      RNA_define_verify_sdna(1);
> }
>
> Is there any way to make the RNA system able to use a non-DNA struct in
> this manner?
>
> --
> Cheers,
> Rohan Smith
>
>
> ---
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
>


More information about the Bf-committers mailing list