[Bf-committers] In need for help/documentation for modifiers
Tobias Oelgarte
tobias.oelgarte at googlemail.com
Fri Oct 8 14:29:43 CEST 2010
So far i edited 10 different places. But if i try to compile it, i get
this confusing error message from makesdna:
...
scons:
`/media/Trekstor_01/temp/blender-trunk/build/linux2/lib/libbf_imbuf.a'
is up to date.
"/media/Trekstor_01/temp/blender-trunk/build/linux2/makesdna"
/media/Trekstor_01/temp/blender-trunk/build/linux2/source/blender/makesdna/intern/dna.c
Running makesdna at debug level 0
Program version: $Id: makesdna.c 31990 2010-09-18 03:46:13Z
campbellbarton $
Sizeerror 8 in struct: RestoreVolumeModifierData (add 4 bytes)
scons: ***
[/media/Trekstor_01/temp/blender-trunk/build/linux2/source/blender/makesdna/intern/dna.c]
Error 1
scons: building terminated because of errors.
So far as i read the code, it checks if the struct has the correct size.
But is something wrong with my struct? I can't see it:
from DNA_modifier_types.h:
typedef struct RestoreVolumeModifierData {
ModifierData modifier;
// own data
float volume; /* volume that mesh should have after
applying modifier */
char name[32]; /* name of vertexgroup that defines wich
areas can grow/shrink */
} RestoreVolumeModifierData;
Phil Gosch schrieb:
> Hi, I found this link pretty helpful:
>
> http://enja.org/2010/05/24/blender-creating-a-custom-modifier/
>
> Best wishes, phil (SaphireS)
>
> Am 08.10.2010 12:44, schrieb Tobias Oelgarte:
>
>> At least this is some starting point. A simple documentation on this
>> could be really handy. I will try to setup a basic modifier and see if i
>> run in any trouble. If so, i will ask back, since this could also be
>> helpfull, if you decide to write a documentation on this. For now i will
>> spend my time to read more into the code.
>>
>> Thank you. Without this i might have searched for hours/days and
>> probably given up frustrated.
>>
>> Jeroen Bakker schrieb:
>>
>>> Hi,
>>>
>>> I have a small step by step mind dump, but have not yet had time to
>>> write the complete documentation about it. see below. there is also a
>>> developer website who mentions it, but cannot find it right now.
>>>
>>> Add custom modifier
>>> 1. DNA_modifier_types.h --> add ModifierType enumeration (must start
>>> with eModifierType_[NAME])
>>> 2. DNA_modifier_types.h --> Add [NAME]ModifierData struct. first field
>>> must be ModifierData modifier
>>> 3. rna_modifier.c --> {eModifierType_[NAME], "[NAME]",
>>> ICON_MOD_PHYSICS, "Surface", ""},
>>>
>>> static void rna_def_modifier_test(BlenderRNA *brna)
>>> {
>>> StructRNA *srna;
>>>
>>> srna= RNA_def_struct(brna, "TestModifier", "Modifier");
>>> RNA_def_struct_ui_text(srna, "Test Modifier", "just a test");
>>> RNA_def_struct_sdna(srna, "TestModifierData");
>>> RNA_def_struct_ui_icon(srna, ICON_MOD_PARTICLES);
>>> }
>>> add sdna fields
>>> static StructRNA* rna_Modifier_refine(struct PointerRNA *ptr)
>>> add case
>>>
>>> call method from register
>>>
>>> 4 modifier.c
>>> mti = INIT_TYPE(Test);
>>> mti->type = eModifierTypeType_Constructive;
>>> mti->flags = eModifierTypeFlag_AcceptsMesh;
>>> mti->initData = testModifier_initData; // method to be called
>>> when created
>>> mti->copyData = testModifier_copyData; // method to be called
>>> when copied
>>> mti->applyModifier = testModifier_applyModifier; // method to
>>> be called when applied
>>> mti->applyModifierEM = testModifier_applyModifierEM; // method
>>> to be called when applied
>>> /** test modifier **/
>>> static void testModifier_initData(ModifierData *md)
>>> {
>>> }
>>>
>>> static void testModifier_copyData(ModifierData *md, ModifierData *target)
>>> {
>>> }
>>> static DerivedMesh *testModifier_applyModifier(ModifierData *md,
>>> Object *ob,
>>> DerivedMesh *dm,
>>> int useRenderParams,
>>> int isFinalCalc)
>>> {
>>> return dm;
>>> }
>>> static DerivedMesh *testModifier_applyModifierEM(ModifierData *md,
>>> Object *ob,
>>> EditMesh *editData,
>>> DerivedMesh *derivedData)
>>> {
>>> return testModifier_applyModifier(md, ob, derivedData, 0, 1);
>>> }
>>>
>>> 5. add user interface panel.
>>> properties_data_modifier.py
>>> class DATA_PT_modifiers add method [NAME]
>>>
>>> 6. implement modifier.
>>>
>>>
>>>
>>>
>>> On 10/08/2010 12:30 PM, Tobias Oelgarte wrote:
>>>
>>>
>>>> Hello,
>>>>
>>>> Im currently looking into the sources of blender and try to understand
>>>> how the modifiers are working. Writing a modifier seams to be simple,
>>>> but on the other side there are many other files that are keeping lists
>>>> of them (to know which are available). This is somehow like finding all
>>>> needles in a haystack.
>>>>
>>>> Is there a documentation on modifiers, that lists all the files that
>>>> need to be changed if you write/add your own modifier? Need this files
>>>> to be changed, or will they be updated automatically? (guess not)
>>>>
>>>> Somehow i miss some document that points out how i can write my own
>>>> modifier from scratch (including gui etc.). At least a very simple
>>>> example would be nice.
>>>>
>>>> Currently i developed code to write a so called RestoreVolume-Modifer,
>>>> that ensures that a closed mesh keeps/restores it's original volume
>>>> after deformations (due to other modifiers). Simplest example would be a
>>>> muscle that contracts and will grow on the sides (controllable by vertex
>>>> group), because of the loss of volume in length.
>>>>
>>>> Any suggestions or hints?
>>>>
>>>> Best wishes Tobias Oelgarte
>>>> _______________________________________________
>>>> 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
>>
>>
>
> _______________________________________________
> 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