Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_object_api.c
| Show All 32 Lines | |||||
| #include "DNA_constraint_types.h" | #include "DNA_constraint_types.h" | ||||
| #include "DNA_layer_types.h" | #include "DNA_layer_types.h" | ||||
| #include "DNA_modifier_types.h" | #include "DNA_modifier_types.h" | ||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| #include "BKE_gpencil_curve.h" | #include "BKE_gpencil_curve.h" | ||||
| #include "BKE_layer.h" | #include "BKE_layer.h" | ||||
| #include "BKE_material.h" | |||||
| #include "DEG_depsgraph.h" | #include "DEG_depsgraph.h" | ||||
| #include "DEG_depsgraph_query.h" | |||||
| #include "ED_outliner.h" | #include "ED_outliner.h" | ||||
| #include "rna_internal.h" /* own include */ | #include "rna_internal.h" /* own include */ | ||||
| static const EnumPropertyItem space_items[] = { | static const EnumPropertyItem space_items[] = { | ||||
| {CONSTRAINT_SPACE_WORLD, "WORLD", 0, "World Space", "The most global space in Blender"}, | {CONSTRAINT_SPACE_WORLD, "WORLD", 0, "World Space", "The most global space in Blender"}, | ||||
| {CONSTRAINT_SPACE_POSE, | {CONSTRAINT_SPACE_POSE, | ||||
| ▲ Show 20 Lines • Show All 723 Lines • ▼ Show 20 Lines | bool rna_Object_generate_gpencil_strokes(Object *ob, | ||||
| BKE_gpencil_convert_curve( | BKE_gpencil_convert_curve( | ||||
| bmain, scene, ob_gpencil, ob, use_collections, scale_thickness, sample); | bmain, scene, ob_gpencil, ob, use_collections, scale_thickness, sample); | ||||
| WM_main_add_notifier(NC_GPENCIL | ND_DATA, NULL); | WM_main_add_notifier(NC_GPENCIL | ND_DATA, NULL); | ||||
| return true; | return true; | ||||
| } | } | ||||
| Material *rna_Object_material_get_eval(Object *ob, ReportList *reports, int material_index) | |||||
| { | |||||
| if (!DEG_is_evaluated_object(ob)) { | |||||
| BKE_reportf(reports, RPT_ERROR, "This method can only be used on evaluated objects"); | |||||
| return NULL; | |||||
| } | |||||
| return BKE_object_material_get_eval(ob, material_index + 1); | |||||
| } | |||||
| int rna_Object_material_count_eval(Object *ob, ReportList *reports) | |||||
| { | |||||
| if (!DEG_is_evaluated_object(ob)) { | |||||
| BKE_reportf(reports, RPT_ERROR, "This method can only be used on evaluated objects"); | |||||
| return 0; | |||||
| } | |||||
| return BKE_object_material_count_eval(ob); | |||||
| } | |||||
| #else /* RNA_RUNTIME */ | #else /* RNA_RUNTIME */ | ||||
| void RNA_api_object(StructRNA *srna) | void RNA_api_object(StructRNA *srna) | ||||
| { | { | ||||
| FunctionRNA *func; | FunctionRNA *func; | ||||
| PropertyRNA *parm; | PropertyRNA *parm; | ||||
| static const EnumPropertyItem mesh_type_items[] = { | static const EnumPropertyItem mesh_type_items[] = { | ||||
| ▲ Show 20 Lines • Show All 478 Lines • ▼ Show 20 Lines | # endif /* NDEBUG */ | ||||
| RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| parm = RNA_def_boolean(func, "use_collections", true, "", "Use Collections"); | parm = RNA_def_boolean(func, "use_collections", true, "", "Use Collections"); | ||||
| parm = RNA_def_float( | parm = RNA_def_float( | ||||
| func, "scale_thickness", 1.0f, 0.0f, FLT_MAX, "", "Thickness scaling factor", 0.0f, 100.0f); | func, "scale_thickness", 1.0f, 0.0f, FLT_MAX, "", "Thickness scaling factor", 0.0f, 100.0f); | ||||
| parm = RNA_def_float( | parm = RNA_def_float( | ||||
| func, "sample", 0.0f, 0.0f, FLT_MAX, "", "Sample distance, zero to disable", 0.0f, 100.0f); | func, "sample", 0.0f, 0.0f, FLT_MAX, "", "Sample distance, zero to disable", 0.0f, 100.0f); | ||||
| parm = RNA_def_boolean(func, "result", 0, "", "Result"); | parm = RNA_def_boolean(func, "result", 0, "", "Result"); | ||||
| RNA_def_function_return(func, parm); | RNA_def_function_return(func, parm); | ||||
| func = RNA_def_function(srna, "material_get_eval", "rna_Object_material_get_eval"); | |||||
| RNA_def_function_ui_description(func, | |||||
| "Get the material for a material index on an evaluated object"); | |||||
| RNA_def_function_flag(func, FUNC_USE_REPORTS); | |||||
| parm = RNA_def_int(func, | |||||
| "material_index", | |||||
| 0, | |||||
| 0, | |||||
| INT16_MAX, | |||||
| "Material Index", | |||||
| "Zero based index of the material", | |||||
| 0, | |||||
| INT16_MAX); | |||||
| RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | |||||
| parm = RNA_def_pointer(func, "material", "Material", "Material", ""); | |||||
| RNA_def_function_return(func, parm); | |||||
| func = RNA_def_function(srna, "material_count_eval", "rna_Object_material_count_eval"); | |||||
| RNA_def_function_ui_description(func, "Get the number of materials on an evaluated object"); | |||||
| RNA_def_function_flag(func, FUNC_USE_REPORTS); | |||||
| parm = RNA_def_int(func, "count", 0, 0, INT16_MAX, "Count", "", 0, INT16_MAX); | |||||
| RNA_def_function_return(func, parm); | |||||
| } | } | ||||
| #endif /* RNA_RUNTIME */ | #endif /* RNA_RUNTIME */ | ||||