setting the active texture layer from python would get the UV layer out of sync. (entering editmode would show the wrong UV layer)
This commit is contained in:
@@ -483,13 +483,20 @@ static int rna_CustomDataLayer_clone_get(PointerRNA *ptr, CustomData *data, int
|
||||
|
||||
static void rna_CustomDataLayer_active_set(PointerRNA *ptr, CustomData *data, int value, int type, int render)
|
||||
{
|
||||
int n = ((CustomDataLayer*)ptr->data) - data->layers;
|
||||
int n = (((CustomDataLayer*)ptr->data) - data->layers) - CustomData_get_layer_index(data, type);
|
||||
|
||||
if (value == 0)
|
||||
return;
|
||||
|
||||
if (render) CustomData_set_layer_render_index(data, type, n);
|
||||
else CustomData_set_layer_active_index(data, type, n);
|
||||
if (render) CustomData_set_layer_render(data, type, n);
|
||||
else CustomData_set_layer_active(data, type, n);
|
||||
|
||||
/* sync loop layer */
|
||||
if (type == CD_MTEXPOLY) {
|
||||
CustomData *ldata = rna_mesh_ldata(ptr);
|
||||
if (render) CustomData_set_layer_render(ldata, CD_MLOOPUV, n);
|
||||
else CustomData_set_layer_active(ldata, CD_MLOOPUV, n);
|
||||
}
|
||||
}
|
||||
|
||||
static void rna_CustomDataLayer_clone_set(PointerRNA *ptr, CustomData *data, int value, int type, int render)
|
||||
@@ -2178,12 +2185,6 @@ static void rna_def_mesh_loops(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
RNA_def_struct_sdna(srna, "Mesh");
|
||||
RNA_def_struct_ui_text(srna, "Mesh Loops", "Collection of mesh loops");
|
||||
|
||||
#if 0 /* BMESH_TODO */
|
||||
prop = RNA_def_property(srna, "active", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "act_face");
|
||||
RNA_def_property_ui_text(prop, "Active Polygon", "The active polygon for this mesh");
|
||||
#endif
|
||||
|
||||
func = RNA_def_function(srna, "add", "ED_mesh_loops_add");
|
||||
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
||||
RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of loops to add", 0, INT_MAX);
|
||||
|
||||
@@ -99,9 +99,16 @@
|
||||
int a; \
|
||||
if (data) { \
|
||||
CustomDataLayer *layer; \
|
||||
for (layer = data->layers, a = 0; a<data->totlayer; layer++, a++) { \
|
||||
int layer_index = CustomData_get_layer_index(data, layer_type); \
|
||||
for (layer = data->layers, a = 0; layer_index + a < data->totlayer; layer++, a++) { \
|
||||
if (value.data == layer) { \
|
||||
CustomData_set_layer_##active_type##_index(data, layer_type, a); \
|
||||
CustomData_set_layer_##active_type(data, layer_type, a); \
|
||||
\
|
||||
/* keep loops in sync */ \
|
||||
if (layer_type == CD_MTEXPOLY) { \
|
||||
CustomData *ldata = rna_mesh_ldata_helper(me); \
|
||||
CustomData_set_layer_##active_type(ldata, CD_MLOOPUV, a); \
|
||||
} \
|
||||
mesh_update_customdata_pointers(me, TRUE); \
|
||||
return; \
|
||||
} \
|
||||
@@ -126,6 +133,11 @@
|
||||
CustomData *data = rna_mesh_##customdata_type(ptr); \
|
||||
if (data) { \
|
||||
CustomData_set_layer_##active_type(data, layer_type, value); \
|
||||
/* keep loops in sync */ \
|
||||
if (layer_type == CD_MTEXPOLY) { \
|
||||
CustomData *ldata = rna_mesh_ldata_helper(me); \
|
||||
CustomData_set_layer_##active_type(ldata, CD_MLOOPUV, value); \
|
||||
} \
|
||||
mesh_update_customdata_pointers(me, TRUE); \
|
||||
} \
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user