Merge remote-tracking branch 'origin' into blender2.8

This commit is contained in:
Gaia Clary 2018-03-11 23:45:53 +01:00
commit ddae05cdca
9 changed files with 54 additions and 68 deletions

View File

@ -1928,15 +1928,21 @@ void AnimationExporter::sample_animation(float *v, std::vector<float> &frames, i
bool AnimationExporter::validateConstraints(bConstraint *con)
{
bool valid = true;
const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
/* these we can skip completely (invalid constraints...) */
if (cti == NULL) valid = false;
if (con->flag & (CONSTRAINT_DISABLE | CONSTRAINT_OFF)) valid = false;
/* these constraints can't be evaluated anyway */
if (cti->evaluate_constraint == NULL) valid = false;
/* influence == 0 should be ignored */
if (con->enforce == 0.0f) valid = false;
if (cti == NULL)
return false;
if (con->flag & (CONSTRAINT_DISABLE | CONSTRAINT_OFF))
return false;
return valid;
/* these constraints can't be evaluated anyway */
if (cti->evaluate_constraint == NULL)
return false;
/* influence == 0 should be ignored */
if (con->enforce == 0.0f)
return false;
/* validation passed */
return true;
}

View File

@ -70,14 +70,15 @@ FCurve *AnimationImporter::create_fcurve(int array_index, const char *rna_path)
fcu->array_index = array_index;
return fcu;
}
void AnimationImporter::create_bezt(FCurve *fcu, float frame, float output)
void AnimationImporter::add_bezt(FCurve *fcu, float frame, float value, eBezTriple_Interpolation ipo)
{
//float fps = (float)FPS;
BezTriple bez;
memset(&bez, 0, sizeof(BezTriple));
bez.vec[1][0] = frame;
bez.vec[1][1] = output;
bez.ipo = U.ipo_new; /* use default interpolation mode here... */
bez.vec[1][1] = value;
bez.ipo = ipo; /* use default interpolation mode here... */
bez.f1 = bez.f2 = bez.f3 = SELECT;
bez.h1 = bez.h2 = HD_AUTO;
insert_bezt_fcurve(fcu, &bez, 0);
@ -401,7 +402,7 @@ virtual void AnimationImporter::change_eul_to_quat(Object *ob, bAction *act)
eul_to_quat(quat, eul);
for (int k = 0; k < 4; k++)
create_bezt(quatcu[k], frame, quat[k]);
create_bezt(quatcu[k], frame, quat[k], U.ipo_new);
}
}
@ -1560,7 +1561,8 @@ Object *AnimationImporter::translate_animation_OLD(COLLADAFW::Node *node,
copy_m4_m4(mat, matfra);
}
float val[4], rot[4], loc[3], scale[3];
float val[4] = {};
float rot[4], loc[3], scale[3];
switch (tm_type) {
case COLLADAFW::Transformation::ROTATE:
@ -1832,14 +1834,14 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float
}
COLLADABU::Math::Matrix4 matrix;
int i = 0, j = 0;
int mi = 0, mj = 0;
for (std::vector<FCurve *>::iterator it = curves.begin(); it != curves.end(); it++) {
matrix.setElement(i, j, evaluate_fcurve(*it, fra));
j++;
if (j == 4) {
i++;
j = 0;
matrix.setElement(mi, mj, evaluate_fcurve(*it, fra));
mj++;
if (mj == 4) {
mi++;
mj = 0;
}
fcurve_is_used(*it);
}
@ -2006,19 +2008,6 @@ void AnimationImporter::add_bone_fcurve(Object *ob, COLLADAFW::Node *node, FCurv
action_groups_add_channel(act, grp, fcu);
}
void AnimationImporter::add_bezt(FCurve *fcu, float fra, float value)
{
//float fps = (float)FPS;
BezTriple bez;
memset(&bez, 0, sizeof(BezTriple));
bez.vec[1][0] = fra;
bez.vec[1][1] = value;
bez.ipo = BEZT_IPO_LIN; /* use default interpolation mode here... */
bez.f1 = bez.f2 = bez.f3 = SELECT;
bez.h1 = bez.h2 = HD_AUTO;
insert_bezt_fcurve(fcu, &bez, 0);
calchandles_fcurve(fcu);
}
void AnimationImporter::set_import_from_version(std::string import_from_version)
{

View File

@ -78,7 +78,7 @@ private:
FCurve *create_fcurve(int array_index, const char *rna_path);
void create_bezt(FCurve *fcu, float frame, float output);
void add_bezt(FCurve *fcu, float frame, float value, eBezTriple_Interpolation ipo=BEZT_IPO_LIN);
// create one or several fcurves depending on the number of parameters being animated
void animation_to_fcurves(COLLADAFW::AnimationCurve *curve);
@ -214,8 +214,6 @@ public:
void add_bone_fcurve(Object *ob, COLLADAFW::Node *node, FCurve *fcu);
void add_bezt(FCurve *fcu, float fra, float value);
void extra_data_importer(std::string elementName);
};

View File

@ -284,12 +284,11 @@ void ArmatureImporter::connect_bone_chains(bArmature *armature, Bone *parentbone
BoneExtensionMap &extended_bones = bone_extension_manager.getExtensionMap(armature);
BoneExtended *dominant_child = NULL;
int maxlen = 0;
Bone *child;
if (parentbone == NULL)
return;
child = (Bone *)parentbone->childbase.first;
Bone *child = (Bone *)parentbone->childbase.first;
if (child && (import_settings->find_chains || child->next==NULL)) {
for (; child; child = child->next) {
BoneExtended *be = extended_bones[child->name];
@ -339,8 +338,8 @@ void ArmatureImporter::connect_bone_chains(bArmature *armature, Bone *parentbone
}
}
}
for (Bone *child = (Bone *)parentbone->childbase.first; child; child = child->next) {
ArmatureImporter::connect_bone_chains(armature, child, UNLIMITED_CHAIN_MAX);
for (Bone *ch = (Bone *)parentbone->childbase.first; ch; ch = ch->next) {
ArmatureImporter::connect_bone_chains(armature, ch, UNLIMITED_CHAIN_MAX);
}
}
else if (maxlen>1 && maxlen > this->import_settings->min_chain_length) {
@ -350,8 +349,8 @@ void ArmatureImporter::connect_bone_chains(bArmature *armature, Bone *parentbone
else {
/* can't connect this Bone. Proceed with children ... */
if (pbe) pbe->set_leaf_bone(true);
for (Bone *child = (Bone *)parentbone->childbase.first; child; child = child->next) {
ArmatureImporter::connect_bone_chains(armature, child, UNLIMITED_CHAIN_MAX);
for (Bone *ch = (Bone *)parentbone->childbase.first; ch; ch = ch->next) {
ArmatureImporter::connect_bone_chains(armature, ch, UNLIMITED_CHAIN_MAX);
}
}

View File

@ -195,8 +195,8 @@ void DocumentImporter::finish()
std::vector<Object *> *objects_to_scale = new std::vector<Object *>();
/** TODO Break up and put into 2-pass parsing of DAE */
std::vector<const COLLADAFW::VisualScene *>::iterator it;
for (it = vscenes.begin(); it != vscenes.end(); it++) {
std::vector<const COLLADAFW::VisualScene *>::iterator sit;
for (sit = vscenes.begin(); sit != vscenes.end(); sit++) {
PointerRNA sceneptr, unit_settings;
PropertyRNA *system, *scale;
@ -227,7 +227,7 @@ void DocumentImporter::finish()
}
// Write nodes to scene
const COLLADAFW::NodePointerArray& roots = (*it)->getRootNodes();
const COLLADAFW::NodePointerArray& roots = (*sit)->getRootNodes();
for (unsigned int i = 0; i < roots.getCount(); i++) {
std::vector<Object *> *objects_done = write_node(roots[i], NULL, sce, NULL, false);
objects_to_scale->insert(objects_to_scale->end(), objects_done->begin(), objects_done->end());
@ -252,8 +252,8 @@ void DocumentImporter::finish()
armature_importer.fix_animation();
#endif
for (std::vector<const COLLADAFW::VisualScene *>::iterator it = vscenes.begin(); it != vscenes.end(); it++) {
const COLLADAFW::NodePointerArray& roots = (*it)->getRootNodes();
for (std::vector<const COLLADAFW::VisualScene *>::iterator vsit = vscenes.begin(); vsit != vscenes.end(); vsit++) {
const COLLADAFW::NodePointerArray& roots = (*vsit)->getRootNodes();
for (unsigned int i = 0; i < roots.getCount(); i++) {
translate_anim_recursive(roots[i], NULL, NULL);
@ -261,7 +261,6 @@ void DocumentImporter::finish()
}
if (libnode_ob.size()) {
Scene *sce = CTX_data_scene(mContext);
fprintf(stderr, "got %d library nodes to free\n", (int)libnode_ob.size());
// free all library_nodes
@ -472,9 +471,9 @@ void DocumentImporter::create_constraints(ExtraTags *et, Object *ob)
{
if (et && et->isProfile("blender")) {
std::string name;
short* type = 0;
et->setData("type", type);
BKE_constraint_add_for_object(ob, "Test_con", *type);
short type = 0;
et->setData("type", &type);
BKE_constraint_add_for_object(ob, "Test_con", type);
}
}
@ -585,8 +584,8 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, COLLA
++lamp_done;
}
while (controller_done < controller.getCount()) {
COLLADAFW::InstanceGeometry *geom = (COLLADAFW::InstanceGeometry *)controller[controller_done];
ob = mesh_importer.create_mesh_object(node, geom, true, uid_material_map, material_texture_mapping_map);
COLLADAFW::InstanceGeometry *geometry = (COLLADAFW::InstanceGeometry *)controller[controller_done];
ob = mesh_importer.create_mesh_object(node, geometry, true, uid_material_map, material_texture_mapping_map);
if (ob == NULL) {
report_unknown_reference(*node, "instance_controller");
}

View File

@ -158,8 +158,8 @@ bool ImagesExporter::hasImages(Scene *sce)
for (node = this->export_settings->export_set; node; node = node->next) {
Object *ob = (Object *)node->link;
int a;
for (a = 0; a < ob->totcol; a++) {
for (int a = 0; a < ob->totcol; a++) {
Material *ma = give_current_material(ob, a + 1);
// no material, but check all of the slots

View File

@ -554,7 +554,7 @@ void MeshImporter::mesh_add_edges(Mesh *mesh, int len)
{
CustomData edata;
MEdge *medge;
int i, totedge;
int totedge;
if (len == 0)
return;
@ -574,7 +574,7 @@ void MeshImporter::mesh_add_edges(Mesh *mesh, int len)
/* set default flags */
medge = &mesh->medge[mesh->totedge];
for (i = 0; i < len; i++, medge++)
for (int i = 0; i < len; i++, medge++)
medge->flag = ME_EDGEDRAW | ME_EDGERENDER | SELECT;
mesh->totedge = totedge;
@ -608,12 +608,12 @@ void MeshImporter::read_lines(COLLADAFW::Mesh *mesh, Mesh *me)
unsigned int edge_count = mp->getFaceCount();
unsigned int *indices = mp->getPositionIndices().getData();
for (int i = 0; i < edge_count; i++, med++) {
for (int j = 0; j < edge_count; j++, med++) {
med->bweight = 0;
med->crease = 0;
med->flag |= ME_LOOSEEDGE;
med->v1 = indices[2 * i];
med->v2 = indices[2 * i + 1];
med->v1 = indices[2 * j];
med->v2 = indices[2 * j + 1];
}
}
}

View File

@ -495,12 +495,7 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm, const char *title, wm
ghostwin = GHOST_CreateWindow(g_system, title,
win->posx, posy, win->sizex, win->sizey,
#ifdef __APPLE__
/* we agreed to not set any fullscreen or iconized state on startup */
GHOST_kWindowStateNormal,
#else
(GHOST_TWindowState)win->windowstate,
#endif
GHOST_kDrawingContextTypeOpenGL,
glSettings);

View File

@ -504,7 +504,7 @@ static int arg_handle_print_help(int UNUSED(argc), const char **UNUSED(argv), vo
printf("\n");
printf("Window Options:\n");
BLI_argsPrintArgDoc(ba, "--window-border");
BLI_argsPrintArgDoc(ba, "--window-borderless");
BLI_argsPrintArgDoc(ba, "--window-fullscreen");
BLI_argsPrintArgDoc(ba, "--window-geometry");
BLI_argsPrintArgDoc(ba, "--start-console");
BLI_argsPrintArgDoc(ba, "--no-native-pixels");
@ -970,7 +970,7 @@ static int arg_handle_with_borders(int UNUSED(argc), const char **UNUSED(argv),
}
static const char arg_handle_without_borders_doc[] =
"\n\tForce opening without borders."
"\n\tForce opening in fullscreen mode."
;
static int arg_handle_without_borders(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
{
@ -1869,7 +1869,7 @@ void main_args_setup(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle)
/* second pass: custom window stuff */
BLI_argsAdd(ba, 2, "-p", "--window-geometry", CB(arg_handle_window_geometry), NULL);
BLI_argsAdd(ba, 2, "-w", "--window-border", CB(arg_handle_with_borders), NULL);
BLI_argsAdd(ba, 2, "-W", "--window-borderless", CB(arg_handle_without_borders), NULL);
BLI_argsAdd(ba, 2, "-W", "--window-fullscreen", CB(arg_handle_without_borders), NULL);
BLI_argsAdd(ba, 2, "-con", "--start-console", CB(arg_handle_start_with_console), NULL);
BLI_argsAdd(ba, 2, "-R", NULL, CB(arg_handle_register_extension), NULL);
BLI_argsAdd(ba, 2, "-r", NULL, CB_EX(arg_handle_register_extension, silent), ba);