Merging trunk up to r38193.
This commit is contained in:
@@ -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(indices[index + 0], mtface->uv[0]);
|
||||
uvs.getUV(indices[index + 1], mtface->uv[1]);
|
||||
uvs.getUV(indices[index + 2], mtface->uv[2]);
|
||||
|
||||
uvs.getUV(uv_indices[0], mtface->uv[0]);
|
||||
uvs.getUV(uv_indices[1], mtface->uv[1]);
|
||||
uvs.getUV(uv_indices[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],
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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']:
|
||||
|
||||
Reference in New Issue
Block a user