diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_userdef.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index cf327583d47..b2af13aa106 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -61,6 +61,19 @@ static EnumPropertyItem compute_device_type_items[] = { }; #endif +#ifdef WITH_OPENSUBDIV +static EnumPropertyItem opensubdiv_compute_type_items[] = { + {USER_OPENSUBDIV_COMPUTE_NONE, "NONE", 0, "None", ""}, + {USER_OPENSUBDIV_COMPUTE_CPU, "CPU", 0, "CPU", ""}, + {USER_OPENSUBDIV_COMPUTE_OPENMP, "OPENMP", 0, "OpenMP", ""}, + {USER_OPENSUBDIV_COMPUTE_OPENCL, "OPENCL", 0, "OpenCL", ""}, + {USER_OPENSUBDIV_COMPUTE_CUDA, "CUDA", 0, "CUDA", ""}, + {USER_OPENSUBDIV_COMPUTE_GLSL_TRANSFORM_FEEDBACK, "GLSL_TRANSFORM_FEEDBACL", 0, "GLSL Transform Feedback", ""}, + {USER_OPENSUBDIV_COMPUTE_GLSL_COMPUTE, "GLSL_COMPUTE", 0, "GLSL Compute", ""}, + { 0, NULL, 0, NULL, NULL} +}; +#endif + static EnumPropertyItem audio_device_items[] = { {0, "NONE", 0, "None", "Null device - there will be no audio output"}, #ifdef WITH_SDL @@ -106,6 +119,10 @@ EnumPropertyItem navigation_mode_items[] = { #include "CCL_api.h" +#ifdef WITH_OPENSUBDIV +# include "opensubdiv_capi.h" +#endif + #ifdef WITH_SDL_DYNLOAD # include "sdlew.h" #endif @@ -538,6 +555,54 @@ static EnumPropertyItem *rna_userdef_compute_device_itemf(bContext *UNUSED(C), P } #endif +#ifdef WITH_OPENSUBDIV +static EnumPropertyItem *rna_userdef_opensubdiv_compute_type_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), + PropertyRNA *UNUSED(prop), bool *r_free) +{ + EnumPropertyItem *item = NULL; + int totitem = 0; + int evaluators = openSubdiv_getAvailableEvaluators(); + + RNA_enum_items_add_value(&item, &totitem, opensubdiv_compute_type_items, USER_OPENSUBDIV_COMPUTE_NONE); + +#define APPEND_COMPUTE(compute) \ + if (evaluators & OPENSUBDIV_EVALUATOR_## compute) { \ + RNA_enum_items_add_value(&item, &totitem, opensubdiv_compute_type_items, USER_OPENSUBDIV_COMPUTE_ ## compute); \ + } ((void)0) + + APPEND_COMPUTE(CPU); + APPEND_COMPUTE(OPENMP); + APPEND_COMPUTE(OPENCL); + APPEND_COMPUTE(CUDA); + APPEND_COMPUTE(GLSL_TRANSFORM_FEEDBACK); + APPEND_COMPUTE(GLSL_COMPUTE); + +#undef APPEND_COMPUTE + + RNA_enum_item_end(&item, &totitem); + *r_free = true; + + return item; +} + +static void rna_userdef_opensubdiv_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) +{ + Object *object; + + for (object = bmain->object.first; + object; + object = object->id.next) + { + if (object->derivedFinal != NULL && + object->derivedFinal->type == DM_TYPE_CCGDM) + { + DAG_id_tag_update(&object->id, OB_RECALC_OB); + } + } +} + +#endif + static EnumPropertyItem *rna_userdef_audio_device_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { @@ -4204,6 +4269,16 @@ static void rna_def_userdef_system(BlenderRNA *brna) RNA_def_property_enum_funcs(prop, "rna_userdef_compute_device_get", NULL, "rna_userdef_compute_device_itemf"); RNA_def_property_ui_text(prop, "Compute Device", "Device to use for computation"); #endif + +#ifdef WITH_OPENSUBDIV + prop = RNA_def_property(srna, "opensubdiv_compute_type", PROP_ENUM, PROP_NONE); + RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT); + RNA_def_property_enum_sdna(prop, NULL, "opensubdiv_compute_type"); + RNA_def_property_enum_items(prop, opensubdiv_compute_type_items); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_userdef_opensubdiv_compute_type_itemf"); + RNA_def_property_ui_text(prop, "OpenSubdiv Compute Type", "Type of computer backend used with OpenSubdiv"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_PROPERTIES, "rna_userdef_opensubdiv_update"); +#endif } static void rna_def_userdef_input(BlenderRNA *brna) |