Adding a copy of a modifier, all files related to modfier?


#1

Doubt I’d get any help with all these links ,but here it is.

I’m trying to basically copy everything from a modifier to see how you would add a new one. I can’t figure out if this is everything related to modifiers. It’s everything I could find ,but I’m running into a crash when trying to select the modifier menu. This is what I found from searching different things and here’s pretty much what I did.

1: Copied the MOD_boolean.c content and created a new c file with different name
https://developer.blender.org/diffusion/B/browse/master/source/blender/modifiers/intern/MOD_boolean.c

2: Copied everything related to boolean and renamed it
https://developer.blender.org/diffusion/B/browse/master/release/scripts/startup/bl_ui/properties_data_modifier.py$169

3: Copied line here and renamed
https://developer.blender.org/diffusion/B/browse/master/source/blender/modifiers/CMakeLists.txt$51

4: Copied line here and renamed
https://developer.blender.org/diffusion/B/browse/master/source/blender/modifiers/MOD_modifiertypes.h$45

5: Copied line here, renamed, and placed at end of list
https://developer.blender.org/diffusion/B/browse/master/source/blender/makesdna/DNA_modifier_types.h$50

Copied everything related to boolean and renamed it
https://developer.blender.org/diffusion/B/browse/master/source/blender/makesdna/DNA_modifier_types.h$774

6: Copied everything related to boolean and renamed it
https://developer.blender.org/diffusion/B/browse/master/source/blender/editors/space_outliner/outliner_draw.c$939

7: Copied lines here and renamed
https://developer.blender.org/diffusion/B/browse/master/source/blender/makesrna/intern/rna_modifier.c$81

https://developer.blender.org/diffusion/B/browse/master/source/blender/makesrna/intern/rna_modifier.c$594

https://developer.blender.org/diffusion/B/browse/master/source/blender/makesrna/intern/rna_modifier.c$5122

The two lines here
https://developer.blender.org/diffusion/B/browse/master/source/blender/makesrna/intern/rna_modifier.c$352

Everything related to boolean
https://developer.blender.org/diffusion/B/browse/master/source/blender/makesrna/intern/rna_modifier.c$2011

Crash happens with this part of the line “eModifierType_NewModifierName”. If I change to “eModifierType_Boolean” it doesn’t crash. This has got me thinking I haven’t found/changed all files.
https://developer.blender.org/diffusion/B/browse/master/source/blender/makesrna/intern/rna_modifier.c$81


#2

You can check my past modifier (which was never got into the trunk), it used to work back then, it might offer some clues

https://developer.blender.org/D542


#3

Your link helped. I didn’t edit the “MOD_util.c”. All my searches I did never brought that file up. How are you suppose to know what files to change?


#4

I generally look at other people’s diffs :slight_smile:


#5

a good starting point is also https://en.blender.org/index.php/Dev:Source/Modifiers/Adding which helped me to get it running when I had a similar issue.


#6

I added new modifiers a couple of times in the last few months. I always forgot to change at least once code segment.

See here: https://github.com/JacquesLucke/blender/commit/c33f6fb104cfe2d4165945dfc204263eb62e58df
with this little fix afterwards: https://github.com/JacquesLucke/blender/commit/1b4fff101255e6a6fcf744f1c4bd668d83a020ff

Hope it helps.