[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24336] trunk/blender: Added mass and spring vertex groups to softbody rna/ui

Campbell Barton ideasman42 at gmail.com
Fri Nov 6 00:44:56 CET 2009


Hey Bjornmose, I think there are quite a few devs in your position
that haven't been so active since 2.4x and I can definitely understand
how using rna is confusing initially.
(big Thank you to Matt also!)

the way python hooks in with rna is also not always obvious especially
when it comes to context.
wrapping ints/floats is quite simple but collections/arrays/pointers
can be tricky too.

Even if commits like this were linked to from the wiki they would be
very useful, as long as the api doesn't change too much.

Side note: It seems there are fairly few people who understand RNA
well, Brecht wrote it, Algorith animated it, I wrapped it, Vekoon
added functions to it but who else?
Understanding its internals isn't always necessary so it might not be so bad.

Incidentally I still didn't read any of the RNA docs, Being so used to
undocumented API's with blender, just looked over the api functions.

On Fri, Nov 6, 2009 at 12:18 AM, bjornmose <bjornmose at gmx.net> wrote:
> Hi Matt
> I'd like to give you a big  'Thank you' .
> This looks generic enough to be a template for
> 'blender developers wiki' : How to plug an object ( or what ever  )
> property to the blender UI .
> Well, may be I missed existing docs, but then they are not clearly
> visible on the blender.org page, which i would choose for 1rst
> developers information ( as if i don't know 42th Murphy's law:  "The
> information you look for is never at the place you would expect it to
> be, but pretty close to the other end of the known universe" )
> So point the flame thrower on me .. (i am used to it)  .. still ..
> search engines  will find this and may be help other coders to ship
> trough /Skylla/ and /Charybdi/s
> at ease.
>
>
>
> Matt Ebb wrote:
>> Revision: 24336
>>           http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24336
>> Author:   broken
>> Date:     2009-11-05 03:50:26 +0100 (Thu, 05 Nov 2009)
>>
>> Log Message:
>> -----------
>> Added mass and spring vertex groups to softbody rna/ui
>>
>> Modified Paths:
>> --------------
>>     trunk/blender/release/scripts/ui/properties_physics_softbody.py
>>     trunk/blender/source/blender/makesrna/intern/rna_object_force.c
>>
>> Modified: trunk/blender/release/scripts/ui/properties_physics_softbody.py
>> ===================================================================
>> --- trunk/blender/release/scripts/ui/properties_physics_softbody.py   2009-11-05 02:21:04 UTC (rev 24335)
>> +++ trunk/blender/release/scripts/ui/properties_physics_softbody.py   2009-11-05 02:50:26 UTC (rev 24336)
>> @@ -73,8 +73,9 @@
>>
>>              col = split.column()
>>              col.itemL(text="Object:")
>> +            col.itemR(softbody, "friction")
>>              col.itemR(softbody, "mass")
>> -            col.itemR(softbody, "friction")
>> +            col.item_pointerR(softbody, "mass_vertex_group", ob, "vertex_groups", text="Mass:")
>>
>>              col = split.column()
>>              col.itemL(text="Simulation:")
>> @@ -167,6 +168,7 @@
>>          col.itemR(softbody, "plastic")
>>          col.itemR(softbody, "bending")
>>          col.itemR(softbody, "spring_length", text="Length")
>> +        col.item_pointerR(softbody, "spring_vertex_group", ob, "vertex_groups", text="Springs:")
>>
>>          col = split.column()
>>          col.itemR(softbody, "stiff_quads")
>>
>> Modified: trunk/blender/source/blender/makesrna/intern/rna_object_force.c
>> ===================================================================
>> --- trunk/blender/source/blender/makesrna/intern/rna_object_force.c   2009-11-05 02:21:04 UTC (rev 24335)
>> +++ trunk/blender/source/blender/makesrna/intern/rna_object_force.c   2009-11-05 02:50:26 UTC (rev 24336)
>> @@ -412,6 +412,19 @@
>>       rna_object_vgroup_name_index_set(ptr, value, &sb->vertgroup);
>>  }
>>
>> +static void rna_SoftBodySettings_mass_vgroup_set(PointerRNA *ptr, const char *value)
>> +{
>> +     SoftBody *sb= (SoftBody*)ptr->data;
>> +     rna_object_vgroup_name_set(ptr, value, sb->namedVG_Mass, sizeof(sb->namedVG_Mass));
>> +}
>> +
>> +static void rna_SoftBodySettings_spring_vgroup_set(PointerRNA *ptr, const char *value)
>> +{
>> +     SoftBody *sb= (SoftBody*)ptr->data;
>> +     rna_object_vgroup_name_set(ptr, value, sb->namedVG_Spring_K, sizeof(sb->namedVG_Spring_K));
>> +}
>> +
>> +
>>  static char *rna_SoftBodySettings_path(PointerRNA *ptr)
>>  {
>>       Object *ob= (Object*)ptr->id.data;
>> @@ -1392,6 +1405,12 @@
>>       RNA_def_property_ui_text(prop, "Mass", "");
>>       RNA_def_property_update(prop, 0, "rna_softbody_update");
>>
>> +     prop= RNA_def_property(srna, "mass_vertex_group", PROP_STRING, PROP_NONE);
>> +     RNA_def_property_string_sdna(prop, NULL, "namedVG_Mass");
>> +     RNA_def_property_ui_text(prop, "Mass Vertex Group", "Control point mass values.");
>> +     RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SoftBodySettings_mass_vgroup_set");
>> +     RNA_def_property_update(prop, 0, "rna_softbody_update");
>> +
>>       prop= RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_ACCELERATION);
>>       RNA_def_property_float_sdna(prop, NULL, "grav");
>>       RNA_def_property_range(prop, -10.0f, 10.0f);
>> @@ -1490,6 +1509,12 @@
>>       RNA_def_property_range(prop, 0.0f, 1.0f);
>>       RNA_def_property_ui_text(prop, "Shear", "Shear Stiffness");
>>
>> +     prop= RNA_def_property(srna, "spring_vertex_group", PROP_STRING, PROP_NONE);
>> +     RNA_def_property_string_sdna(prop, NULL, "namedVG_Spring_K");
>> +     RNA_def_property_ui_text(prop, "Spring Vertex Group", "Control point spring strength values.");
>> +     RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SoftBodySettings_spring_vgroup_set");
>> +     RNA_def_property_update(prop, 0, "rna_softbody_update");
>> +
>>       /* Collision */
>>
>>       prop= RNA_def_property(srna, "collision_type", PROP_ENUM, PROP_NONE);
>>
>>
>> _______________________________________________
>> Bf-blender-cvs mailing list
>> Bf-blender-cvs at blender.org
>> http://lists.blender.org/mailman/listinfo/bf-blender-cvs
>>
>>
>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
>



-- 
- Campbell


More information about the Bf-committers mailing list