Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/object/object_bake_api.c
| Show First 20 Lines • Show All 455 Lines • ▼ Show 20 Lines | if (!BKE_id_attributes_color_find(&me->id, me->active_color_attribute)) { | ||||
| BKE_reportf(reports, | BKE_reportf(reports, | ||||
| RPT_ERROR, | RPT_ERROR, | ||||
| "Mesh does not have an active color attribute \"%s\"", | "Mesh does not have an active color attribute \"%s\"", | ||||
| me->id.name + 2); | me->id.name + 2); | ||||
| return false; | return false; | ||||
| } | } | ||||
| } | } | ||||
| else if (target == R_BAKE_TARGET_IMAGE_TEXTURES) { | else if (target == R_BAKE_TARGET_IMAGE_TEXTURES) { | ||||
| if (CustomData_get_active_layer_index(&me->ldata, CD_MLOOPUV) == -1) { | if (CustomData_get_active_layer_index(&me->ldata, CD_PROP_FLOAT2) == -1) { | ||||
| BKE_reportf( | BKE_reportf( | ||||
| reports, RPT_ERROR, "No active UV layer found in the object \"%s\"", ob->id.name + 2); | reports, RPT_ERROR, "No active UV layer found in the object \"%s\"", ob->id.name + 2); | ||||
| return false; | return false; | ||||
| } | } | ||||
| for (int i = 0; i < ob->totcol; i++) { | for (int i = 0; i < ob->totcol; i++) { | ||||
| const bNodeTree *ntree = NULL; | const bNodeTree *ntree = NULL; | ||||
| const bNode *node = NULL; | const bNode *node = NULL; | ||||
| ▲ Show 20 Lines • Show All 903 Lines • ▼ Show 20 Lines | static int bake(const BakeAPIRender *bkr, | ||||
| if (!RE_bake_has_engine(re)) { | if (!RE_bake_has_engine(re)) { | ||||
| BKE_report(reports, RPT_ERROR, "Current render engine does not support baking"); | BKE_report(reports, RPT_ERROR, "Current render engine does not support baking"); | ||||
| goto cleanup; | goto cleanup; | ||||
| } | } | ||||
| if (bkr->uv_layer[0] != '\0') { | if (bkr->uv_layer[0] != '\0') { | ||||
| Mesh *me = (Mesh *)ob_low->data; | Mesh *me = (Mesh *)ob_low->data; | ||||
| if (CustomData_get_named_layer(&me->ldata, CD_MLOOPUV, bkr->uv_layer) == -1) { | if (CustomData_get_named_layer(&me->ldata, CD_PROP_FLOAT2, bkr->uv_layer) == -1) { | ||||
| BKE_reportf(reports, | BKE_reportf(reports, | ||||
| RPT_ERROR, | RPT_ERROR, | ||||
| "No UV layer named \"%s\" found in the object \"%s\"", | "No UV layer named \"%s\" found in the object \"%s\"", | ||||
| bkr->uv_layer, | bkr->uv_layer, | ||||
| ob_low->id.name + 2); | ob_low->id.name + 2); | ||||
| goto cleanup; | goto cleanup; | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 848 Lines • ▼ Show 20 Lines | void OBJECT_OT_bake(wmOperatorType *ot) | ||||
| RNA_def_boolean(ot->srna, | RNA_def_boolean(ot->srna, | ||||
| "use_automatic_name", | "use_automatic_name", | ||||
| false, | false, | ||||
| "Automatic Name", | "Automatic Name", | ||||
| "Automatically name the output file with the pass type"); | "Automatically name the output file with the pass type"); | ||||
| RNA_def_string(ot->srna, | RNA_def_string(ot->srna, | ||||
| "uv_layer", | "uv_layer", | ||||
| NULL, | NULL, | ||||
| MAX_CUSTOMDATA_LAYER_NAME, | MAX_CUSTOMDATA_LAYER_NAME_NO_PREFIX, | ||||
| "UV Layer", | "UV Layer", | ||||
| "UV layer to override active"); | "UV layer to override active"); | ||||
| } | } | ||||