One more question. I wanted to supply a menu instead of the spectrum numeric input. Looking at the Python code, I see this:
prop = RNA_def_property(srna, "geometry_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "geometry_mode");
RNA_def_property_enum_items(prop, geometry_items);
RNA_def_property_ui_text(prop, "Geometry", "Method of modifying geometry");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
where the enum comes from :
static const EnumPropertyItem geometry_items[] = {
{MOD_OCEAN_GEOM_GENERATE,
"GENERATE",
0,
"Generate",
"Generate ocean surface geometry at the specified resolution"},
{MOD_OCEAN_GEOM_DISPLACE,
"DISPLACE",
0,
"Displace",
"Displace existing geometry according to simulation"},
# if 0
{MOD_OCEAN_GEOM_SIM_ONLY,
"SIM_ONLY",
0,
"Sim Only",
"Leaves geometry unchanged, but still runs simulation (to be used from texture)"},
# endif
{0, NULL, 0, NULL, NULL},
};
I tried something similar for the spectra :
static const EnumPropertyItem spectrum_items[] = {
{MOD_OCEAN_SPECTRUM_PHILIPS,
"PHILIPS",
0,
Philips",
"Philips Spectrum"},
{MOD_OCEAN_SPECTRUM_PIERSONMOSKOWITZ,
"PIERSONMOSKOWITZ",
0,
"Pierson-Moskowitz",
"Pierson-Moskowitz spectrum"},
{MOD_OCEAN_SPECTRUM_TMA,
"TMA",
0,
"TMA",
"TMA spectrum"},
{MOD_OCEAN_SPECTRUM_PHILIPSNEW,
"PIERSONMOSKOWITZ",
0,
"Philips (experimental)", "Philips Spectrum (experimental)"},
{0, NULL, 0, NULL, NULL},
};
and :
prop = RNA_def_property(srna, "spectrum", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "spectrum");
RNA_def_property_enum_items(prop, spectrum_items);
RNA_def_property_ui_text(prop, "Spectrum", "Spectrum");
RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
This results in the compiler whining about redefinitions:
'BL::OceanModifier::spectrum_PIERSONMOSKOWITZ': redefinition; previous definition was 'enumerator' (compiling source file D:\development\blender-git\blender\intern\cycles\blender\blender_camera.cpp) bf_intern_cycles D:\development\blender-git\build_windows_Release_x64_vc16_Release\source\blender\makesrna\intern\RNA_blender_cpp.h 18025
I don’t understand this. Guidance would be extremely welcome.
EDIT: resolved; needed to dig deeper in to the header files to get this working.