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:
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c3
-rw-r--r--source/blender/blenkernel/intern/anim.c2
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c77
-rw-r--r--source/blender/blenkernel/intern/cloth.c2
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c7
-rw-r--r--source/blender/blenkernel/intern/displist.c5
-rw-r--r--source/blender/blenkernel/intern/fcurve.c2
-rw-r--r--source/blender/blenkernel/intern/modifier.c12
-rw-r--r--source/blender/blenkernel/intern/nla.c2
-rw-r--r--source/blender/blenkernel/intern/node.c4
-rw-r--r--source/blender/blenkernel/intern/sequencer.c1
-rw-r--r--source/blender/blenkernel/intern/texture.c32
12 files changed, 87 insertions, 62 deletions
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index dd2f3e2c699..941a1516896 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -1055,6 +1055,7 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm,
glEnd();
}
}
+#undef PASSATTRIB
}
static void emDM_drawFacesGLSL(DerivedMesh *dm,
@@ -2846,6 +2847,7 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
attribs->tface[a].array = tfdata->layers[layer].data;
attribs->tface[a].emOffset = tfdata->layers[layer].offset;
attribs->tface[a].glIndex = gattribs->layer[b].glindex;
+ attribs->tface[a].glTexco = gattribs->layer[b].gltexco;
}
}
else if(gattribs->layer[b].type == CD_MCOL) {
@@ -2886,6 +2888,7 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
attribs->orco.array = vdata->layers[layer].data;
attribs->orco.emOffset = vdata->layers[layer].offset;
attribs->orco.glIndex = gattribs->layer[b].glindex;
+ attribs->orco.glTexco = gattribs->layer[b].gltexco;
}
}
}
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index 8aa816f9cb5..ebe7325d96a 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -1245,6 +1245,8 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
sim.ob= par;
sim.psys= psys;
sim.psmd= psys_get_modifier(par, psys);
+ /* make sure emitter imat is in global coordinates instead of render view coordinates */
+ invert_m4_m4(par->imat, par->obmat);
/* first check for loops (particle system object used as dupli object) */
if(part->ren_as == PART_DRAW_OB) {
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 47686c2626f..5c7ffa5adc3 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -1031,6 +1031,50 @@ static void cdDM_drawMappedFacesTex(DerivedMesh *dm, int (*setDrawOptions)(void
cdDM_drawFacesTex_common(dm, NULL, setDrawOptions, userData);
}
+static void cddm_draw_attrib_vertex(DMVertexAttribs *attribs, MVert *mvert, int a, int index, int vert, int smoothnormal)
+{
+ int b;
+
+ /* orco texture coordinates */
+ if(attribs->totorco) {
+ if(attribs->orco.glTexco)
+ glTexCoord3fv(attribs->orco.array[index]);
+ else
+ glVertexAttrib3fvARB(attribs->orco.glIndex, attribs->orco.array[index]);
+ }
+
+ /* uv texture coordinates */
+ for(b = 0; b < attribs->tottface; b++) {
+ MTFace *tf = &attribs->tface[b].array[a];
+
+ if(attribs->tface[b].glTexco)
+ glTexCoord2fv(tf->uv[vert]);
+ else
+ glVertexAttrib2fvARB(attribs->tface[b].glIndex, tf->uv[vert]);
+ }
+
+ /* vertex colors */
+ for(b = 0; b < attribs->totmcol; b++) {
+ MCol *cp = &attribs->mcol[b].array[a*4 + vert];
+ GLubyte col[4];
+ col[0]= cp->b; col[1]= cp->g; col[2]= cp->r; col[3]= cp->a;
+ glVertexAttrib4ubvARB(attribs->mcol[b].glIndex, col);
+ }
+
+ /* tangent for normal mapping */
+ if(attribs->tottang) {
+ float *tang = attribs->tang.array[a*4 + vert];
+ glVertexAttrib4fvARB(attribs->tang.glIndex, tang);
+ }
+
+ /* vertex normal */
+ if(smoothnormal)
+ glNormal3sv(mvert[index].no);
+
+ /* vertex coordinate */
+ glVertex3fv(mvert[index].co);
+}
+
static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, void *attribs), int (*setDrawOptions)(void *userData, int index), void *userData)
{
CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
@@ -1121,37 +1165,14 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, vo
}
}
-#define PASSVERT(index, vert) { \
- if(attribs.totorco) \
- glVertexAttrib3fvARB(attribs.orco.glIndex, attribs.orco.array[index]); \
- for(b = 0; b < attribs.tottface; b++) { \
- MTFace *tf = &attribs.tface[b].array[a]; \
- glVertexAttrib2fvARB(attribs.tface[b].glIndex, tf->uv[vert]); \
- } \
- for(b = 0; b < attribs.totmcol; b++) { \
- MCol *cp = &attribs.mcol[b].array[a*4 + vert]; \
- GLubyte col[4]; \
- col[0]= cp->b; col[1]= cp->g; col[2]= cp->r; col[3]= cp->a; \
- glVertexAttrib4ubvARB(attribs.mcol[b].glIndex, col); \
- } \
- if(attribs.tottang) { \
- float *tang = attribs.tang.array[a*4 + vert]; \
- glVertexAttrib4fvARB(attribs.tang.glIndex, tang); \
- } \
- if(smoothnormal) \
- glNormal3sv(mvert[index].no); \
- glVertex3fv(mvert[index].co); \
- }
+ cddm_draw_attrib_vertex(&attribs, mvert, a, mface->v1, 0, smoothnormal);
+ cddm_draw_attrib_vertex(&attribs, mvert, a, mface->v2, 1, smoothnormal);
+ cddm_draw_attrib_vertex(&attribs, mvert, a, mface->v3, 2, smoothnormal);
- PASSVERT(mface->v1, 0);
- PASSVERT(mface->v2, 1);
- PASSVERT(mface->v3, 2);
if(mface->v4)
- PASSVERT(mface->v4, 3)
+ cddm_draw_attrib_vertex(&attribs, mvert, a, mface->v4, 3, smoothnormal);
else
- PASSVERT(mface->v3, 2)
-
-#undef PASSVERT
+ cddm_draw_attrib_vertex(&attribs, mvert, a, mface->v3, 2, smoothnormal);
}
glEnd();
}
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index ea055e90b45..3a86389dba7 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -923,7 +923,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
for(i = 0; i < dm->getNumVerts(dm); i++)
{
- maxdist = MAX2(maxdist, clmd->coll_parms->selfepsilon* ( cloth->verts[i].avg_spring_len*2.0));
+ maxdist = MAX2(maxdist, clmd->coll_parms->selfepsilon* ( cloth->verts[i].avg_spring_len*2.0f));
}
clmd->clothObject->bvhselftree = bvhselftree_build_from_cloth ( clmd, maxdist );
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index d39be9d683c..667e0850111 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -301,6 +301,7 @@ static void dag_add_driver_relation(AnimData *adt, DagForest *dag, DagNode *node
for (fcu= adt->drivers.first; fcu; fcu= fcu->next) {
ChannelDriver *driver= fcu->driver;
DriverVar *dvar;
+ int isdata_fcu = isdata || (fcu->rna_path && strstr(fcu->rna_path, "modifiers["));
/* loop over variables to get the target relationships */
for (dvar= driver->variables.first; dvar; dvar= dvar->next) {
@@ -320,14 +321,14 @@ static void dag_add_driver_relation(AnimData *adt, DagForest *dag, DagNode *node
( ((dtar->rna_path) && strstr(dtar->rna_path, "pose.bones[")) ||
((dtar->flag & DTAR_FLAG_STRUCT_REF) && (dtar->pchan_name[0])) ))
{
- dag_add_relation(dag, node1, node, isdata?DAG_RL_DATA_DATA:DAG_RL_DATA_OB, "Driver");
+ dag_add_relation(dag, node1, node, isdata_fcu?DAG_RL_DATA_DATA:DAG_RL_DATA_OB, "Driver");
}
/* check if ob data */
else if (dtar->rna_path && strstr(dtar->rna_path, "data."))
- dag_add_relation(dag, node1, node, isdata?DAG_RL_DATA_DATA:DAG_RL_DATA_OB, "Driver");
+ dag_add_relation(dag, node1, node, isdata_fcu?DAG_RL_DATA_DATA:DAG_RL_DATA_OB, "Driver");
/* normal */
else
- dag_add_relation(dag, node1, node, isdata?DAG_RL_OB_DATA:DAG_RL_OB_OB, "Driver");
+ dag_add_relation(dag, node1, node, isdata_fcu?DAG_RL_OB_DATA:DAG_RL_OB_OB, "Driver");
}
}
}
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index 8f57490d057..c2ed6468643 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -1369,6 +1369,11 @@ void makeDispListCurveTypes(Scene *scene, Object *ob, int forOrco)
Curve *cu= ob->data;
ListBase *dispbase;
+ /* The same check for duplis as in do_makeDispListCurveTypes.
+ Happens when curve used for constraint/bevel was converted to mesh.
+ check there is still needed for render displist and orco displists. */
+ if(!ELEM3(ob->type, OB_SURF, OB_CURVE, OB_FONT)) return;
+
freedisplist(&(ob->disp));
dispbase= &(ob->disp);
freedisplist(dispbase);
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index d6a9d950015..13e13fbc3ff 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -1002,7 +1002,7 @@ static float dtar_get_prop_val (ChannelDriver *driver, DriverTarget *dtar)
/* get property to read from, and get value as appropriate */
if (RNA_path_resolve_full(&id_ptr, dtar->rna_path, &ptr, &prop, &index)) {
- if(RNA_property_array_check(&ptr, prop)) {
+ if(RNA_property_array_check(prop)) {
/* array */
if (index < RNA_property_array_length(&ptr, prop)) {
switch (RNA_property_type(prop)) {
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index 51f1cd61e7c..fe26c0ccd2d 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -195,6 +195,18 @@ void modifiers_foreachIDLink(Object *ob, IDWalkFunc walk, void *userData)
}
}
+void modifiers_foreachTexLink(Object *ob, TexWalkFunc walk, void *userData)
+{
+ ModifierData *md = ob->modifiers.first;
+
+ for (; md; md=md->next) {
+ ModifierTypeInfo *mti = modifierType_getInfo(md->type);
+
+ if(mti->foreachTexLink)
+ mti->foreachTexLink(md, ob, walk, userData);
+ }
+}
+
void modifier_copyData(ModifierData *md, ModifierData *target)
{
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c
index c02b5dda9ce..bd238e72d0c 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -1582,7 +1582,7 @@ void BKE_nla_tweakmode_exit (AnimData *adt)
/* Baking Tools ------------------------------------------- */
-static void BKE_nla_bake (Scene *scene, ID *UNUSED(id), AnimData *adt, int UNUSED(flag))
+static void UNUSED_FUNCTION(BKE_nla_bake) (Scene *scene, ID *UNUSED(id), AnimData *adt, int UNUSED(flag))
{
/* verify that data is valid
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 13469e0b58b..5f1a6c911bc 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -3243,7 +3243,7 @@ static int node_animation_properties(bNodeTree *ntree, bNode *node)
int driven, len=1, index;
prop = (PropertyRNA *)link;
- if (RNA_property_array_check(&ptr, prop))
+ if (RNA_property_array_check(prop))
len = RNA_property_array_length(&ptr, prop);
for (index=0; index<len; index++) {
@@ -3261,7 +3261,7 @@ static int node_animation_properties(bNodeTree *ntree, bNode *node)
RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, sock, &ptr);
prop = RNA_struct_find_property(&ptr, "default_value");
- if (RNA_property_array_check(&ptr, prop))
+ if (RNA_property_array_check(prop))
len = RNA_property_array_length(&ptr, prop);
for (index=0; index<len; index++) {
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index d6a152a5280..3aebbea789f 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -699,6 +699,7 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq, int lock_range)
seq->len = 0;
}
seq->strip->len = seq->len;
+ break;
case SEQ_SOUND:
#ifdef WITH_AUDASPACE
if(!seq->sound)
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index 036ba34d0c8..493baebd197 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -1005,7 +1005,7 @@ void autotexname(Tex *tex)
Tex *give_current_object_texture(Object *ob)
{
- Material *ma;
+ Material *ma, *node_ma;
Tex *tex= NULL;
if(ob==NULL) return NULL;
@@ -1015,6 +1015,10 @@ Tex *give_current_object_texture(Object *ob)
tex= give_current_lamp_texture(ob->data);
} else {
ma= give_current_material(ob, ob->actcol);
+
+ if((node_ma=give_node_material(ma)))
+ ma= node_ma;
+
tex= give_current_material_texture(ma);
}
@@ -1080,17 +1084,6 @@ Tex *give_current_material_texture(Material *ma)
tex= (Tex *)node->id;
ma= NULL;
}
- else {
- node= nodeGetActiveID(ma->nodetree, ID_MA);
- if(node) {
- ma= (Material*)node->id;
- if(ma) {
- mtex= ma->mtex[(int)(ma->texact)];
- if(mtex) tex= mtex->tex;
- }
- }
- }
- return tex;
}
if(ma) {
@@ -1165,11 +1158,6 @@ void set_current_material_texture(Material *ma, Tex *newtex)
id_us_plus(&newtex->id);
ma= NULL;
}
- else {
- node= nodeGetActiveID(ma->nodetree, ID_MA);
- if(node)
- ma= (Material*)node->id;
- }
}
if(ma) {
int act= (int)ma->texact;
@@ -1198,16 +1186,8 @@ int has_current_material_texture(Material *ma)
if(ma && ma->use_nodes && ma->nodetree) {
node= nodeGetActiveID(ma->nodetree, ID_TE);
- if(node) {
+ if(node)
return 1;
- }
- else {
- node= nodeGetActiveID(ma->nodetree, ID_MA);
- if(node)
- ma= (Material*)node->id;
- else
- ma= NULL;
- }
}
return (ma != NULL);