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
path: root/source
diff options
context:
space:
mode:
authorJoerg Mueller <nexyon@gmail.com>2011-07-07 20:34:19 +0400
committerJoerg Mueller <nexyon@gmail.com>2011-07-07 20:34:19 +0400
commitc57ac39f7f0629a1ec73654664202637a07cb770 (patch)
tree6d8242891139f56ae8863f021fab185c36a59b8b /source
parentc9d6989098e2defbaea36b767169f521c8a5d62a (diff)
parent99736f373c12e7ab91f962c738243bddf2d713c6 (diff)
Merging trunk up to r38193.
Diffstat (limited to 'source')
-rw-r--r--source/blender/collada/MeshImporter.cpp63
-rw-r--r--source/blender/collada/MeshImporter.h2
-rw-r--r--source/blender/editors/interface/interface_templates.c4
-rw-r--r--source/blender/editors/space_outliner/outliner.c2
-rw-r--r--source/blender/makesrna/intern/rna_pose.c22
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_ghost.cpp7
-rw-r--r--source/gameengine/GamePlayer/ghost/SConscript2
7 files changed, 58 insertions, 44 deletions
diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp
index d1977d15fb2..760fb2359a4 100644
--- a/source/blender/collada/MeshImporter.cpp
+++ b/source/blender/collada/MeshImporter.cpp
@@ -144,15 +144,18 @@ void WVDataWrapper::print()
}
#endif
-void UVDataWrapper::getUV(int uv_index[2], float *uv)
+void UVDataWrapper::getUV(int uv_index, float *uv)
{
+ int stride = mVData->getStride(0);
+ if(stride==0) stride = 2;
+
switch(mVData->getType()) {
case COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT:
{
COLLADAFW::ArrayPrimitiveType<float>* values = mVData->getFloatValues();
if (values->empty()) return;
- uv[0] = (*values)[uv_index[0]];
- uv[1] = (*values)[uv_index[1]];
+ uv[0] = (*values)[uv_index*stride];
+ uv[1] = (*values)[uv_index*stride + 1];
}
break;
@@ -160,8 +163,8 @@ void UVDataWrapper::getUV(int uv_index[2], float *uv)
{
COLLADAFW::ArrayPrimitiveType<double>* values = mVData->getDoubleValues();
if (values->empty()) return;
- uv[0] = (float)(*values)[uv_index[0]];
- uv[1] = (float)(*values)[uv_index[1]];
+ uv[0] = (float)(*values)[uv_index*stride];
+ uv[1] = (float)(*values)[uv_index*stride + 1];
}
break;
@@ -197,54 +200,36 @@ void MeshImporter::rotate_face_indices(MFace *mface) {
void MeshImporter::set_face_uv(MTFace *mtface, UVDataWrapper &uvs,
COLLADAFW::IndexList& index_list, unsigned int *tris_indices)
{
- int uv_indices[4][2];
-
// per face vertex indices, this means for quad we have 4 indices, not 8
COLLADAFW::UIntValuesArray& indices = index_list.getIndices();
- // make indices into FloatOrDoubleArray
- for (int i = 0; i < 3; i++) {
- int uv_index = indices[tris_indices[i]];
- uv_indices[i][0] = uv_index * 2;
- uv_indices[i][1] = uv_index * 2 + 1;
- }
-
- uvs.getUV(uv_indices[0], mtface->uv[0]);
- uvs.getUV(uv_indices[1], mtface->uv[1]);
- uvs.getUV(uv_indices[2], mtface->uv[2]);
+ uvs.getUV(indices[tris_indices[0]], mtface->uv[0]);
+ uvs.getUV(indices[tris_indices[1]], mtface->uv[1]);
+ uvs.getUV(indices[tris_indices[2]], mtface->uv[2]);
}
void MeshImporter::set_face_uv(MTFace *mtface, UVDataWrapper &uvs,
COLLADAFW::IndexList& index_list, int index, bool quad)
{
- int uv_indices[4][2];
-
// per face vertex indices, this means for quad we have 4 indices, not 8
COLLADAFW::UIntValuesArray& indices = index_list.getIndices();
- // make indices into FloatOrDoubleArray
- for (int i = 0; i < (quad ? 4 : 3); i++) {
- int uv_index = indices[index + i];
- uv_indices[i][0] = uv_index * 2;
- uv_indices[i][1] = uv_index * 2 + 1;
- }
-
- uvs.getUV(uv_indices[0], mtface->uv[0]);
- uvs.getUV(uv_indices[1], mtface->uv[1]);
- uvs.getUV(uv_indices[2], mtface->uv[2]);
+ uvs.getUV(indices[index + 0], mtface->uv[0]);
+ uvs.getUV(indices[index + 1], mtface->uv[1]);
+ uvs.getUV(indices[index + 2], mtface->uv[2]);
- if (quad) uvs.getUV(uv_indices[3], mtface->uv[3]);
+ if (quad) uvs.getUV(indices[index + 3], mtface->uv[3]);
#ifdef COLLADA_DEBUG
/*if (quad) {
fprintf(stderr, "face uv:\n"
- "((%d, %d), (%d, %d), (%d, %d), (%d, %d))\n"
+ "((%d, %d, %d, %d))\n"
"((%.1f, %.1f), (%.1f, %.1f), (%.1f, %.1f), (%.1f, %.1f))\n",
- uv_indices[0][0], uv_indices[0][1],
- uv_indices[1][0], uv_indices[1][1],
- uv_indices[2][0], uv_indices[2][1],
- uv_indices[3][0], uv_indices[3][1],
+ indices[index + 0],
+ indices[index + 1],
+ indices[index + 2],
+ indices[index + 3],
mtface->uv[0][0], mtface->uv[0][1],
mtface->uv[1][0], mtface->uv[1][1],
@@ -253,12 +238,12 @@ void MeshImporter::set_face_uv(MTFace *mtface, UVDataWrapper &uvs,
}
else {
fprintf(stderr, "face uv:\n"
- "((%d, %d), (%d, %d), (%d, %d))\n"
+ "((%d, %d, %d))\n"
"((%.1f, %.1f), (%.1f, %.1f), (%.1f, %.1f))\n",
- uv_indices[0][0], uv_indices[0][1],
- uv_indices[1][0], uv_indices[1][1],
- uv_indices[2][0], uv_indices[2][1],
+ indices[index + 0],
+ indices[index + 1],
+ indices[index + 2],
mtface->uv[0][0], mtface->uv[0][1],
mtface->uv[1][0], mtface->uv[1][1],
diff --git a/source/blender/collada/MeshImporter.h b/source/blender/collada/MeshImporter.h
index 20fdb0dcc6e..88ee0e46c33 100644
--- a/source/blender/collada/MeshImporter.h
+++ b/source/blender/collada/MeshImporter.h
@@ -69,7 +69,7 @@ public:
void print();
#endif
- void getUV(int uv_index[2], float *uv);
+ void getUV(int uv_index, float *uv);
};
class MeshImporter : public MeshImporterBase
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index c4a07a004d2..975093bd877 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -34,6 +34,7 @@
#include "MEM_guardedalloc.h"
#include "DNA_anim_types.h"
+#include "DNA_key_types.h"
#include "DNA_scene_types.h"
#include "DNA_userdef_types.h"
@@ -2093,6 +2094,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
}
else if(itemptr->type == &RNA_ShapeKey) {
Object *ob= (Object*)activeptr->data;
+ Key *key= (Key*)itemptr->data;
split= uiLayoutSplit(sub, 0.75f, 0);
@@ -2100,7 +2102,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
uiBlockSetEmboss(block, UI_EMBOSSN);
row= uiLayoutRow(split, 1);
- if(i == 0) uiItemL(row, "", ICON_NONE);
+ if(i == 0 || (key->type != KEY_RELATIVE)) uiItemL(row, "", ICON_NONE);
else uiItemR(row, itemptr, "value", 0, "", ICON_NONE);
if(ob->mode == OB_MODE_EDIT && !((ob->shapeflag & OB_SHAPE_EDIT_MODE) && ob->type == OB_MESH))
diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c
index db64aead8a8..d5bd5c7437f 100644
--- a/source/blender/editors/space_outliner/outliner.c
+++ b/source/blender/editors/space_outliner/outliner.c
@@ -5262,7 +5262,7 @@ static void outliner_draw_tree(bContext *C, uiBlock *block, Scene *scene, ARegio
outliner_draw_selection(ar, soops, &soops->tree, &starty);
// grey hierarchy lines
- UI_ThemeColorBlend(TH_BACK, TH_TEXT, 0.2f);
+ UI_ThemeColorBlend(TH_BACK, TH_TEXT, 0.4f);
starty= (int)ar->v2d.tot.ymax-UI_UNIT_Y/2-OL_Y_OFFSET;
startx= 6;
outliner_draw_hierarchy(soops, &soops->tree, startx, &starty);
diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c
index 949415fbf29..47c8435cc46 100644
--- a/source/blender/makesrna/intern/rna_pose.c
+++ b/source/blender/makesrna/intern/rna_pose.c
@@ -585,6 +585,25 @@ static void rna_PoseChannel_matrix_basis_set(PointerRNA *ptr, const float *value
pchan_apply_mat4(pchan, (float (*)[4])values, FALSE); /* no compat for predictable result */
}
+static void rna_PoseChannel_matrix_set(PointerRNA *ptr, const float *values)
+{
+ bPoseChannel *pchan= (bPoseChannel*)ptr->data;
+ Object *ob= (Object*)ptr->id.data;
+ float umat[4][4]= MAT4_UNITY;
+ float tmat[4][4];
+
+ /* recalculate pose matrix with only parent transformations,
+ * bone loc/sca/rot is ignored, scene and frame are not used. */
+ where_is_pose_bone(NULL, ob, pchan, 0.0f, FALSE);
+
+ /* find the matrix, need to remove the bone transforms first so this is
+ * calculated as a matrix to set rather then a difference ontop of whats
+ * already there. */
+ pchan_apply_mat4(pchan, umat, FALSE);
+ armature_mat_pose_to_bone(pchan, (float (*)[4])values, tmat);
+ pchan_apply_mat4(pchan, tmat, FALSE); /* no compat for predictable result */
+}
+
#else
static void rna_def_bone_group(BlenderRNA *brna)
@@ -830,8 +849,9 @@ static void rna_def_pose_channel(BlenderRNA *brna)
prop= RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
RNA_def_property_float_sdna(prop, NULL, "pose_mat");
RNA_def_property_multi_array(prop, 2, matrix_dimsize);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_float_funcs(prop, NULL, "rna_PoseChannel_matrix_set", NULL);
RNA_def_property_ui_text(prop, "Pose Matrix", "Final 4x4 matrix after constraints and drivers are applied (object space)");
+ RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
/* Head/Tail Coordinates (in Pose Space) - Automatically calculated... */
prop= RNA_def_property(srna, "head", PROP_FLOAT, PROP_TRANSLATION);
diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
index 14048c70516..cbbeb9419d1 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
@@ -64,6 +64,7 @@ extern "C"
#include "BKE_node.h"
#include "BKE_report.h"
#include "BKE_library.h"
+#include "BLI_threads.h"
#include "BLI_blenlib.h"
#include "DNA_scene_types.h"
#include "DNA_userdef_types.h"
@@ -399,7 +400,11 @@ int main(int argc, char** argv)
::DisposeNibReference(nibRef);
*/
#endif // __APPLE__
-
+
+ // We don't use threads directly in the BGE, but we need to call this so things like
+ // freeing up GPU_Textures works correctly.
+ BLI_threadapi_init();
+
RNA_init();
init_nodesystem();
diff --git a/source/gameengine/GamePlayer/ghost/SConscript b/source/gameengine/GamePlayer/ghost/SConscript
index e3ffc1a406b..de063f5e297 100644
--- a/source/gameengine/GamePlayer/ghost/SConscript
+++ b/source/gameengine/GamePlayer/ghost/SConscript
@@ -40,6 +40,8 @@ incs = ['.',
'#source/blender/gpu',
'#extern/glew/include']
+incs.append(env['BF_PTHREADS_INC'])
+
defs = [ 'GLEW_STATIC' ]
if env['WITH_BF_PYTHON']: