Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2007-05-02 04:01:23 +0400
committerCampbell Barton <ideasman42@gmail.com>2007-05-02 04:01:23 +0400
commitc24aa10561c3e301989df0d7f227f478f846143a (patch)
treec0a0f86cc48f4a6f9ecedeaf479ca353abe55fde /source/blender/blenkernel
parent0b0f0b0ffb0075ce889b7515ebfd822bf99426cb (diff)
Made it so blender has an active render layer for Uv and Vertex color mesh layers.
This means changing the active UV/VCol layers wont change what renders. needed to adjust the minor version so old files will copy the active layer to the render-uv/vcol layer. boxpack2d.py - redoen in C now, dont need python version.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_blender.h2
-rw-r--r--source/blender/blenkernel/BKE_customdata.h2
-rw-r--r--source/blender/blenkernel/intern/customdata.c41
3 files changed, 38 insertions, 7 deletions
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index a96c1b43170..b40ef215a53 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -44,7 +44,7 @@ struct ListBase;
struct MemFile;
#define BLENDER_VERSION 243
-#define BLENDER_SUBVERSION 1
+#define BLENDER_SUBVERSION 2
#define BLENDER_MINVERSION 240
#define BLENDER_MINSUBVERSION 0
diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h
index b41c06f046f..4a486e6795f 100644
--- a/source/blender/blenkernel/BKE_customdata.h
+++ b/source/blender/blenkernel/BKE_customdata.h
@@ -184,6 +184,7 @@ void *CustomData_get_layer_named(const struct CustomData *data, int type,
int CustomData_get_layer_index(const struct CustomData *data, int type);
int CustomData_get_named_layer_index(const struct CustomData *data, int type, char *name);
int CustomData_get_active_layer_index(const struct CustomData *data, int type);
+int CustomData_get_render_layer_index(const struct CustomData *data, int type);
/* copies the data from source to the data element at index in the first
* layer of type
@@ -204,6 +205,7 @@ void *CustomData_set_layer_n(const struct CustomData *data, int type, int n, voi
/* sets the nth layer of type as active */
void CustomData_set_layer_active(struct CustomData *data, int type, int n);
+void CustomData_set_layer_render(struct CustomData *data, int type, int n);
/* adds flag to the layer flags */
void CustomData_set_layer_flag(struct CustomData *data, int type, int flag);
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index 68319b799a2..e239583c4eb 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -410,7 +410,7 @@ void CustomData_merge(const struct CustomData *source, struct CustomData *dest,
{
const LayerTypeInfo *typeInfo;
CustomDataLayer *layer, *newlayer;
- int i, type, number = 0, lasttype = -1, lastactive = 0;
+ int i, type, number = 0, lasttype = -1, lastactive = 0, lastrender = 0;
for(i = 0; i < source->totlayer; ++i) {
layer = &source->layers[i];
@@ -421,6 +421,7 @@ void CustomData_merge(const struct CustomData *source, struct CustomData *dest,
if (type != lasttype) {
number = 0;
lastactive = layer->active;
+ lastrender = layer->active_rnd;
lasttype = type;
}
else
@@ -437,8 +438,10 @@ void CustomData_merge(const struct CustomData *source, struct CustomData *dest,
newlayer = customData_add_layer__internal(dest, type, alloctype,
layer->data, totelem, layer->name);
- if(newlayer)
+ if(newlayer) {
newlayer->active = lastactive;
+ newlayer->active_rnd = lastrender;
+ }
}
}
@@ -526,6 +529,17 @@ int CustomData_get_active_layer_index(const CustomData *data, int type)
return -1;
}
+int CustomData_get_render_layer_index(const CustomData *data, int type)
+{
+ int i;
+
+ for(i=0; i < data->totlayer; ++i)
+ if(data->layers[i].type == type)
+ return i + data->layers[i].active_rnd;
+
+ return -1;
+}
+
void CustomData_set_layer_active(CustomData *data, int type, int n)
{
int i;
@@ -535,6 +549,16 @@ void CustomData_set_layer_active(CustomData *data, int type, int n)
data->layers[i].active = n;
}
+void CustomData_set_layer_render(CustomData *data, int type, int n)
+{
+ int i;
+
+ for(i=0; i < data->totlayer; ++i)
+ if(data->layers[i].type == type)
+ data->layers[i].active_rnd = n;
+}
+
+
void CustomData_set_layer_flag(struct CustomData *data, int type, int flag)
{
int i;
@@ -617,11 +641,14 @@ static CustomDataLayer *customData_add_layer__internal(CustomData *data,
else
data->layers[index].name[0] = '\0';
- if(index > 0 && data->layers[index-1].type == type)
+ if(index > 0 && data->layers[index-1].type == type) {
data->layers[index].active = data->layers[index-1].active;
- else
+ data->layers[index].active_rnd = data->layers[index-1].active_rnd;
+ } else {
data->layers[index].active = 0;
-
+ data->layers[index].active_rnd = 0;
+ }
+
customData_update_offsets(data);
return &data->layers[index];
@@ -679,8 +706,10 @@ int CustomData_free_layer(CustomData *data, int type, int totelem, int index)
i = CustomData_get_layer_index(data, type);
if (i >= 0)
- for (; i < data->totlayer && data->layers[i].type == type; i++)
+ for (; i < data->totlayer && data->layers[i].type == type; i++) {
data->layers[i].active--;
+ data->layers[i].active_rnd--;
+ }
}
if (data->totlayer <= data->maxlayer-CUSTOMDATA_GROW)