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

Rohan Smith rohan.preacher.smith at gmail.com
Tue Aug 11 14:00:08 CEST 2015


Hi,
That's pretty much the entire reason I'm wanting to get these structs 
working nicely with the RNA system, as there's quite a lot of variables 
which define the muscle's dynamics.

I had it set to BoneData and MuscleData in the BoneData and MuscleData 
RNA definitions which worked just fine for some reason.

The RNA code is at [0], the DNA is at [1] and the editmode structs are 
at [2].

With the RNA_def_struct_sdna_from uncommented on lines 1388 and 1413, I 
get "RNA_def_struct_sdna_from: EditArmatureElement not found." errors at 
makesrna.

Thanks for your help with this.

[0] http://www.pasteall.org/60401/c
[1] http://www.pasteall.org/60403/c
[2] http://www.pasteall.org/60404/c

On 10/08/2015 23:26, Lukas Tönne wrote:
>   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
>>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers


-- 
Cheers,
Rohan Smith


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus



More information about the Bf-committers mailing list