コード例 #1
0
ファイル: mesh_validate.c プロジェクト: Eibriel/kiriblender
/**
 * \returns is_valid.
 */
bool BKE_mesh_validate_all_customdata(CustomData *vdata, CustomData *edata,
                                      CustomData *ldata, CustomData *pdata,
                                      const bool check_meshmask,
                                      const bool do_verbose, const bool do_fixes,
                                      bool *r_change)
{
	bool is_valid = true;
	bool is_change_v, is_change_e, is_change_l, is_change_p;
	int tot_texpoly, tot_uvloop;
	CustomDataMask mask = check_meshmask ? CD_MASK_MESH : 0;

	is_valid &= mesh_validate_customdata(vdata, mask, do_verbose, do_fixes, &is_change_v);
	is_valid &= mesh_validate_customdata(edata, mask, do_verbose, do_fixes, &is_change_e);
	is_valid &= mesh_validate_customdata(ldata, mask, do_verbose, do_fixes, &is_change_l);
	is_valid &= mesh_validate_customdata(pdata, mask, do_verbose, do_fixes, &is_change_p);

	tot_texpoly = CustomData_number_of_layers(pdata, CD_MTEXPOLY);
	tot_uvloop = CustomData_number_of_layers(ldata, CD_MLOOPUV);
	if (tot_texpoly != tot_uvloop) {
		PRINT_ERR("\tCustomDataLayer mismatch, tot_texpoly(%d), tot_uvloop(%d)\n",
		          tot_texpoly, tot_uvloop);
	}

	*r_change = (is_change_v || is_change_e || is_change_l || is_change_p);

	return is_valid;
}
コード例 #2
0
ファイル: mesh_validate.c プロジェクト: wchargin/blender
/**
 * \returns is_valid.
 */
bool BKE_mesh_validate_all_customdata(
        CustomData *vdata, CustomData *edata,
        CustomData *ldata, CustomData *pdata,
        const bool check_meshmask,
        const bool do_verbose, const bool do_fixes,
        bool *r_change)
{
	bool is_valid = true;
	bool is_change_v, is_change_e, is_change_l, is_change_p;
	int tot_texpoly, tot_uvloop, tot_vcolloop;
	CustomDataMask mask = check_meshmask ? CD_MASK_MESH : 0;

	is_valid &= mesh_validate_customdata(vdata, mask, do_verbose, do_fixes, &is_change_v);
	is_valid &= mesh_validate_customdata(edata, mask, do_verbose, do_fixes, &is_change_e);
	is_valid &= mesh_validate_customdata(ldata, mask, do_verbose, do_fixes, &is_change_l);
	is_valid &= mesh_validate_customdata(pdata, mask, do_verbose, do_fixes, &is_change_p);

	tot_texpoly = CustomData_number_of_layers(pdata, CD_MTEXPOLY);
	tot_uvloop = CustomData_number_of_layers(ldata, CD_MLOOPUV);
	tot_vcolloop = CustomData_number_of_layers(ldata, CD_MLOOPCOL);
	if (tot_texpoly != tot_uvloop) {
		PRINT_ERR("\tCustomDataLayer mismatch, tot_texpoly(%d), tot_uvloop(%d)\n",
		          tot_texpoly, tot_uvloop);
	}
	if (tot_texpoly > MAX_MTFACE) {
		PRINT_ERR("\tMore UV layers than %d allowed, %d last ones won't be available for render, shaders, etc.\n",
		          MAX_MTFACE, tot_texpoly - MAX_MTFACE);
	}
	if (tot_uvloop > MAX_MTFACE) {
		PRINT_ERR("\tMore UV layers than %d allowed, %d last ones won't be available for render, shaders, etc.\n",
		          MAX_MTFACE, tot_uvloop - MAX_MTFACE);
	}
	if (tot_vcolloop > MAX_MCOL) {
		PRINT_ERR("\tMore VCol layers than %d allowed, %d last ones won't be available for render, shaders, etc.\n",
		          MAX_MCOL, tot_vcolloop - MAX_MCOL);
	}

	/* check indices of clone/stencil */
	if (do_fixes && CustomData_get_clone_layer(pdata, CD_MTEXPOLY) >= tot_texpoly) {
		CustomData_set_layer_clone(pdata, CD_MTEXPOLY, 0);
		is_change_p = true;
	}
	if (do_fixes && CustomData_get_clone_layer(ldata, CD_MLOOPUV) >= tot_uvloop) {
		CustomData_set_layer_clone(ldata, CD_MLOOPUV, 0);
		is_change_l = true;
	}
	if (do_fixes && CustomData_get_stencil_layer(pdata, CD_MTEXPOLY) >= tot_texpoly) {
		CustomData_set_layer_stencil(pdata, CD_MTEXPOLY, 0);
		is_change_p = true;
	}
	if (do_fixes && CustomData_get_stencil_layer(ldata, CD_MLOOPUV) >= tot_uvloop) {
		CustomData_set_layer_stencil(ldata, CD_MLOOPUV, 0);
		is_change_l = true;
	}

	*r_change = (is_change_v || is_change_e || is_change_l || is_change_p);

	return is_valid;
}
コード例 #3
0
ファイル: mesh_validate.c プロジェクト: mik0001/Blender
static int BKE_mesh_validate_all_customdata(CustomData *vdata, CustomData *edata, CustomData *fdata,
                                            short do_verbose, const short do_fixes)
{
	int vfixed= 0, efixed= 0, ffixed= 0;

	vfixed= mesh_validate_customdata(vdata, do_verbose, do_fixes);
	efixed= mesh_validate_customdata(edata, do_verbose, do_fixes);
	ffixed= mesh_validate_customdata(fdata, do_verbose, do_fixes);

	return vfixed || efixed || ffixed;
}
コード例 #4
0
ファイル: mesh_validate.c プロジェクト: 244xiao/blender
static int BKE_mesh_validate_all_customdata(CustomData *vdata, CustomData *edata,
                                            CustomData *ldata, CustomData *pdata,
                                            const bool do_verbose, const short do_fixes)
{
	int vfixed = 0, efixed = 0, lfixed = 0, pfixed = 0;

	vfixed = mesh_validate_customdata(vdata, do_verbose, do_fixes);
	efixed = mesh_validate_customdata(edata, do_verbose, do_fixes);
	lfixed = mesh_validate_customdata(ldata, do_verbose, do_fixes);
	pfixed = mesh_validate_customdata(pdata, do_verbose, do_fixes);

	return vfixed || efixed || lfixed || pfixed;
}