- Tue Dec 03, 2019 1:15 pm
#304489
Hi.
The access violation error occuers when I create a material attribute.
my code is
The access violation error occuers when I create a material attribute.
my code is
Code: Select all
API_AttrTypeID typeID = API_MaterialID;
API_Attribute attrib;
API_AttributeDefExt defs;
BNZeroMemory(&attrib, sizeof(API_Attribute));
attrib.header.typeID = typeID;
strcpy(attrib.header.name, u8"玻璃 - 蓝色");
err = ACAPI_Attribute_Get(&attrib);
if (err == NoError) {
err = ACAPI_Attribute_GetDefExt(typeID, attrib.header.index, &defs);
if (err == APIERR_BADID) {
BNZeroMemory(&defs, sizeof(API_AttributeDefExt));
err = NoError;
}
//能见度100
attrib.material.transpPc = 100;
if (err == NoError) {
strcpy(attrib.header.name, name.ToCStr().Get());
err = ACAPI_Attribute_Create(&attrib,nullptr);
}
ACAPI_DisposeAttrDefsHdlsExt(&defs);
}