diff options
author | Gaia Clary <gaia.clary@machinimatrix.org> | 2018-03-12 01:45:53 +0300 |
---|---|---|
committer | Gaia Clary <gaia.clary@machinimatrix.org> | 2018-03-12 01:45:53 +0300 |
commit | ddae05cdca9211a789a6501c6ca054f9a46e07c5 (patch) | |
tree | e7591dd7c31ccfb6c25beb0bca7bf670a788cd35 /source | |
parent | 7ecc7c46af493f984e9cb2f08ac75da5b30ffd35 (diff) | |
parent | 2c9c22df26dfdcf03bb308fdf35294ed79c2d0e5 (diff) |
Merge remote-tracking branch 'origin' into blender2.8
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/collada/AnimationExporter.cpp | 18 | ||||
-rw-r--r-- | source/blender/collada/AnimationImporter.cpp | 39 | ||||
-rw-r--r-- | source/blender/collada/AnimationImporter.h | 4 | ||||
-rw-r--r-- | source/blender/collada/ArmatureImporter.cpp | 11 | ||||
-rw-r--r-- | source/blender/collada/DocumentImporter.cpp | 21 | ||||
-rw-r--r-- | source/blender/collada/ImageExporter.cpp | 4 | ||||
-rw-r--r-- | source/blender/collada/MeshImporter.cpp | 10 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 5 | ||||
-rw-r--r-- | source/creator/creator_args.c | 6 |
9 files changed, 52 insertions, 66 deletions
diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index 9c65aa4d2c5..53c1afd173f 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -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; + if (cti == NULL) + return false; + if (con->flag & (CONSTRAINT_DISABLE | CONSTRAINT_OFF)) + return false; + /* these constraints can't be evaluated anyway */ - if (cti->evaluate_constraint == NULL) valid = false; + if (cti->evaluate_constraint == NULL) + return false; + /* influence == 0 should be ignored */ - if (con->enforce == 0.0f) valid = false; + if (con->enforce == 0.0f) + return false; - return valid; + /* validation passed */ + return true; } diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index 4ef256fbcf1..ee3fddbf5b7 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -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) { diff --git a/source/blender/collada/AnimationImporter.h b/source/blender/collada/AnimationImporter.h index 15dee8ff5f4..7dc4131dd69 100644 --- a/source/blender/collada/AnimationImporter.h +++ b/source/blender/collada/AnimationImporter.h @@ -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); }; diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp index 8832e0fd577..b2794b3bd23 100644 --- a/source/blender/collada/ArmatureImporter.cpp +++ b/source/blender/collada/ArmatureImporter.cpp @@ -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); } } diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index dfd662aa66c..7999b3c4727 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -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"); } diff --git a/source/blender/collada/ImageExporter.cpp b/source/blender/collada/ImageExporter.cpp index a2ab3ce520b..3cdc013c137 100644 --- a/source/blender/collada/ImageExporter.cpp +++ b/source/blender/collada/ImageExporter.cpp @@ -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 diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index f8cd487c355..ec1b14a3855 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -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]; } } } diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index ecd91ff2d1a..8d5282b9076 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -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); diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c index 2dd21c3886f..6106f55c212 100644 --- a/source/creator/creator_args.c +++ b/source/creator/creator_args.c @@ -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); |