[Bf-committers] In need for help/documentation for modifiers

pete larabell xgl.asyliax at gmail.com
Fri Oct 8 19:51:19 CEST 2010


Normally the way I, as a developer, create such documentation as 1st, do
what you are doing... get a working sample. Then, I create a 2nd working
sample, this time making a rough draft documentation. At that point, I run
through it a 3rd time, trying to use only the notes I took from the previous
run through. If that works well, I'll add any details or clarification to
the notes, and attempt to write a more formal document. As a safety step,
I'd then have someone that is NOT knowledgeable on the topic try to create
the desired thing (a modifier in this case), using my instructions. That
will allow you to add any small details or extra clarification needed. At
that point you are pretty confident that your document is ready. :)

Just my two cents worth. :)

I've worked as an instructor and as a developer, and that method served me
well over the years.

If you don't have time to do it, I will try to get around to it this weekend
or next week. As I'm hosting a conference this weekend on Saturday, I doubt
I'll get it done this weekend, but I'll try. :)

Thanks for your feedback.
Peter


On Fri, Oct 8, 2010 at 11:17 AM, Tobias Oelgarte <
tobias.oelgarte at googlemail.com> wrote:

> Currently i have created a simple ui for my modifier and the properties
> are also correctly registered. I just followed the code from the
> simpledeform modifier and copied adjusted parts from it. Now i can focus
> on writing the modifier itself. Only problem is, that the callback
> functions are not as well documented as i expected. So i will have to go
> through trial and error, to find out what they are exactly for, and
> which i will have to implement.
>
> If we wan't to write a documentation "how to write your own modifier"
> then we need something like a wiki to do so. I guess that i will sooner
> or later forget about the things and details i started of with. Any
> suggestions?
>
> pete larabell schrieb:
> > Thank you very much. If I'm able to get this working, or you are, I think
> we
> > ought to write up a formal document on this process for the benefit of
> > others. I'm more than willing to create such a document once I know it's
> > accurate :)
> >
> > Thanks again!
> > Peter
> >
> >
> > On Fri, Oct 8, 2010 at 9:50 AM, Tobias Oelgarte <
> > tobias.oelgarte at googlemail.com> wrote:
> >
> >
> >> Currently I'm able to compile it without any issue, but it misses all
> >> functionality and the ui-interface. But at least it shows up in the menu
> >> and runs like expected. Im oriented myself closely to the "simple deform
> >> modifier", because it is simple and easier to understand than others.
> >> Currently i did the following things:
> >>
> >> Some Notes:
> >> <ModifierName> is the name of the modifier. In my case "RestoreVolume".
> >> Note that the name is written in different style, at different places.
> >> To know where in the files you will have to add the lines, you should
> >> just look out for similar patterns.
> >>
> >> 1. At the end of MOD_util.c i added:
> >>    INIT_TYPE(<ModifierName>);
> >>
> >> 2. In MOD_modifier_types.h i added:
> >>    extern ModifierTypeInfo modifierType_<ModifierName>;
> >>
> >> 3. In RNA_access.h i added:
> >>    extern StructRNA RNA_<ModifierName>VolumeModifier;
> >>
> >> 4. In DNA_modifier_types.h i added:
> >>    eModifierType_<ModifierName>,
> >>
> >> 5. In DNA_modifier_types.h i added also:
> >>    typedef struct <ModifierName>ModifierData {
> >>        ModifierData modifier;
> >>        // own data from here. Notice the padding, which is needed in
> >> this case
> >>        char name[32];
> >>        float volume;
> >>        char pad[4];
> >>    } <ModifierName>ModifierData;
> >>
> >> 6. In rna_modifier.c i added:
> >>    {eModifierType_<ModifierName>, "<MODIFIER_NAME>", ICON_MOD_PHYSICS,
> >> "<Modifier Name>", ""},
> >>
> >> 7. In rna_modifier.c i added also:
> >>    case eModifierType_<ModifierName>:
> >>        return &RNA_<ModifierName>Modifier;
> >>
> >> 8. In rna_modifier.c i added also:
> >>    static void rna_def_modifier_<modifiername>(BlenderRNA *brna)
> >>    {
> >>        StructRNA *srna;
> >>
> >>        srna= RNA_def_struct(brna, "<ModifierName>Modifier", "Modifier");
> >>        RNA_def_struct_ui_text(srna, "<Modifier Name> Modifier",
> >> "<description what it does>");
> >>        RNA_def_struct_sdna(srna, "<ModifierName>ModifierData");
> >>        RNA_def_struct_ui_icon(srna, ICON_MOD_PARTICLES); // maybe use
> >> other icon
> >>    }
> >>
> >> 9. In rna_modifier.c i added at the end also:
> >>    rna_def_modifier_<modifiername>(brna);
> >>
> >> 10. In properties_data_modifier.py i added:
> >>    def <MODIFIER_NAME>(self, layout, ob, md):
> >>        layout.label(text="Volume:") // the following lines are specific
> >> for my modifier
> >>        layout.prop(md, "volume")
> >>
> >> Notice that #10 is python code, so care for indentation is needed. (I
> >> hate it...)
> >>
> >> After that i copied MOD_simpledeform.c to MOD_<modifiername>.c and
> >> deleted nearly everything from the file. Keep care to update and rename
> >> the struct ModifierTypeInfo at the end of the file.
> >>
> >> Thats basically all i did so far. Currently i'm Missing my input-field
> >> for volume inside the UI, since it blames me to not know about the
> >> property. Guess i will have to register it somewhere.
> >>
> >> Message:
> >> rna_uiItemR: property not found: RestoreVolumeModifier.volume
> >>
>
> _______________________________________________
> 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