diff options
Diffstat (limited to 'source')
22 files changed, 145 insertions, 50 deletions
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 48f1df2bd73..66b2c74d758 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -51,7 +51,7 @@ extern "C" { /* can be left blank, otherwise a,b,c... etc with no quotes */ #define BLENDER_VERSION_CHAR /* alpha/beta/rc/release, docs use this */ -#define BLENDER_VERSION_CYCLE beta +#define BLENDER_VERSION_CYCLE rc extern char versionstr[]; /* from blender.c */ diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index 7b57ed243a1..c2d8c356aae 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -773,6 +773,27 @@ std::string AnimationExporter::create_4x4_source(std::vector<float> &frames , Ob copy_m4_m4(mat, pchan->pose_mat); UnitConverter converter; + // SECOND_LIFE_COMPATIBILITY + // AFAIK animation to second life is via BVH, but no + // reason to not have the collada-animation be correct + if(export_settings->second_life) + { + float temp[4][4]; + copy_m4_m4(temp, bone->arm_mat); + temp[3][0] = temp[3][1] = temp[3][2] = 0.0f; + invert_m4(temp); + + mult_m4_m4m4(mat, mat, temp); + + if(bone->parent) + { + copy_m4_m4(temp, bone->parent->arm_mat); + temp[3][0] = temp[3][1] = temp[3][2] = 0.0f; + + mult_m4_m4m4(mat, temp, mat); + } + } + float outmat[4][4]; converter.mat4_to_dae(outmat,mat); diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h index c3a5c7a5383..ba7ec6859cc 100644 --- a/source/blender/collada/AnimationExporter.h +++ b/source/blender/collada/AnimationExporter.h @@ -83,7 +83,9 @@ private: public: - AnimationExporter(COLLADASW::StreamWriter *sw): COLLADASW::LibraryAnimations(sw) { this->sw = sw; } + AnimationExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings): + COLLADASW::LibraryAnimations(sw), export_settings(export_settings) + { this->sw = sw; } void exportAnimations(Scene *sce); @@ -92,6 +94,7 @@ public: void operator() (Object *ob); protected: + const ExportSettings *export_settings; void dae_animation(Object* ob, FCurve *fcu, char* transformName , bool is_param, Material *ma = NULL); diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp index fcfc197ce80..0e89f2db74b 100644 --- a/source/blender/collada/ArmatureExporter.cpp +++ b/source/blender/collada/ArmatureExporter.cpp @@ -221,8 +221,31 @@ void ArmatureExporter::add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW: mult_m4_m4m4(mat, invpar, pchan->pose_mat); } else { - // get world-space from armature-space - mult_m4_m4m4(mat, ob_arm->obmat, pchan->pose_mat); + copy_m4_m4(mat, pchan->pose_mat); + // Why? Joint's localspace is still it's parent node + //get world-space from armature-space + //mult_m4_m4m4(mat, ob_arm->obmat, pchan->pose_mat); + } + + // SECOND_LIFE_COMPATIBILITY + if(export_settings->second_life) + { + // Remove rotations vs armature from transform + // parent_rest_rot * mat * irest_rot + float temp[4][4]; + copy_m4_m4(temp, bone->arm_mat); + temp[3][0] = temp[3][1] = temp[3][2] = 0.0f; + invert_m4(temp); + + mult_m4_m4m4(mat, mat, temp); + + if(bone->parent) + { + copy_m4_m4(temp, bone->parent->arm_mat); + temp[3][0] = temp[3][1] = temp[3][2] = 0.0f; + + mult_m4_m4m4(mat, temp, mat); + } } TransformWriter::add_node_transform(node, mat,NULL ); @@ -341,10 +364,16 @@ std::string ArmatureExporter::add_inv_bind_mats_source(Object *ob_arm, ListBase { std::string source_id = controller_id + BIND_POSES_SOURCE_ID_SUFFIX; + int totjoint = 0; + for (bDeformGroup *def = (bDeformGroup*)defbase->first; def; def = def->next) { + if (is_bone_defgroup(ob_arm, def)) + totjoint++; + } + COLLADASW::FloatSourceF source(mSW); source.setId(source_id); source.setArrayId(source_id + ARRAY_ID_SUFFIX); - source.setAccessorCount(BLI_countlist(defbase)); + source.setAccessorCount(totjoint); //BLI_countlist(defbase)); source.setAccessorStride(16); source.setParameterTypeName(&COLLADASW::CSWC::CSW_VALUE_TYPE_FLOAT4x4); @@ -366,16 +395,27 @@ std::string ArmatureExporter::add_inv_bind_mats_source(Object *ob_arm, ListBase for (bDeformGroup *def = (bDeformGroup*)defbase->first; def; def = def->next) { if (is_bone_defgroup(ob_arm, def)) { - bPoseChannel *pchan = get_pose_channel(pose, def->name); float mat[4][4]; float world[4][4]; float inv_bind_mat[4][4]; - // make world-space matrix, arm_mat is armature-space - mult_m4_m4m4(world, ob_arm->obmat, pchan->bone->arm_mat); - + // SECOND_LIFE_COMPATIBILITY + if(export_settings->second_life) + { + // Only translations, no rotation vs armature + float temp[4][4]; + unit_m4(temp); + copy_v3_v3(temp[3], pchan->bone->arm_mat[3]); + mult_m4_m4m4(world, ob_arm->obmat, temp); + } + else + { + // make world-space matrix, arm_mat is armature-space + mult_m4_m4m4(world, ob_arm->obmat, pchan->bone->arm_mat); + } + invert_m4_m4(mat, world); converter.mat4_to_dae(inv_bind_mat, mat); diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp index 6e8abc08358..6e04a1773bb 100644 --- a/source/blender/collada/DocumentExporter.cpp +++ b/source/blender/collada/DocumentExporter.cpp @@ -257,7 +257,7 @@ void DocumentExporter::exportCurrentScene(Scene *sce) } // <library_animations> - AnimationExporter ae(&sw); + AnimationExporter ae(&sw, this->export_settings); ae.exportAnimations(sce); // <library_controllers> diff --git a/source/blender/collada/ExportSettings.h b/source/blender/collada/ExportSettings.h index 1ad7c8c370e..80e20acbe48 100644 --- a/source/blender/collada/ExportSettings.h +++ b/source/blender/collada/ExportSettings.h @@ -31,6 +31,7 @@ struct ExportSettings { public: bool selected; + bool second_life; char *filepath; }; diff --git a/source/blender/collada/TransformWriter.cpp b/source/blender/collada/TransformWriter.cpp index 379a0619040..a2bca6733e1 100644 --- a/source/blender/collada/TransformWriter.cpp +++ b/source/blender/collada/TransformWriter.cpp @@ -59,6 +59,7 @@ void TransformWriter::add_node_transform(COLLADASW::Node& node, float mat[][4], void TransformWriter::add_node_transform_ob(COLLADASW::Node& node, Object *ob) { + /* float rot[3], loc[3], scale[3]; if (ob->parent) { @@ -91,6 +92,27 @@ void TransformWriter::add_node_transform_ob(COLLADASW::Node& node, Object *ob) } add_transform(node, loc, rot, scale); + */ + + /* Using parentinv should allow use of existing curves */ + // If parentinv is identity don't add it. + bool add_parinv = false; + for(int i = 0; i < 16; ++i) + { + float f = (i%4 == i/4) ? 1.0f : 0.0f ; + if(ob->parentinv[i%4][i/4] != f) add_parinv = true; + } + + // Eat this 3ds Max et friends + if(add_parinv) + { + double dmat[4][4]; + UnitConverter converter; + converter.mat4_to_dae_double(dmat, ob->parentinv); + node.addMatrix("parentinverse", dmat); + } + + add_transform(node, ob->loc, ob->rot, ob->size); } void TransformWriter::add_node_transform_identity(COLLADASW::Node& node) diff --git a/source/blender/collada/collada.cpp b/source/blender/collada/collada.cpp index 0731faceeed..39114f6543b 100644 --- a/source/blender/collada/collada.cpp +++ b/source/blender/collada/collada.cpp @@ -49,11 +49,12 @@ extern "C" return 0; } - int collada_export(Scene *sce, const char *filepath, int selected) + int collada_export(Scene *sce, const char *filepath, int selected, int second_life) { ExportSettings export_settings; export_settings.selected = selected != 0; + export_settings.second_life = second_life != 0; export_settings.filepath = (char *)filepath; /* annoying, collada crashes if file cant be created! [#27162] */ diff --git a/source/blender/collada/collada.h b/source/blender/collada/collada.h index b86f37b7af6..161977368db 100644 --- a/source/blender/collada/collada.h +++ b/source/blender/collada/collada.h @@ -37,7 +37,7 @@ extern "C" { * both return 1 on success, 0 on error */ int collada_import(bContext *C, const char *filepath); - int collada_export(Scene *sce, const char *filepath, int selected); + int collada_export(Scene *sce, const char *filepath, int selected, int second_life); #ifdef __cplusplus } #endif diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 4565806702f..495c8a8f842 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -3389,8 +3389,12 @@ static int convertspline(short type, Nurb *nu) nu->orderu= 4; nu->orderv= 1; nu->type = type; + +#if 0 /* UNUSED */ if(nu->flagu & CU_NURB_CYCLIC) c= nu->orderu-1; else c= 0; +#endif + if(type== CU_NURBS) { nu->flagu &= CU_NURB_CYCLIC; /* disable all flags except for cyclic */ nu->flagu |= CU_NURB_BEZIER; diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 6c93727bf55..99572345c96 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1117,14 +1117,6 @@ static int gp_session_initdata (bContext *C, tGPsdata *p) p->custom_color[1]= 0.0f; p->custom_color[2]= 0.5f; p->custom_color[3]= 0.9f; - - /* check that gpencil data is allowed to be drawn */ - if ((sc->flag & SC_SHOW_GPENCIL)==0) { - p->status= GP_STATUS_ERROR; - if (G.f & G_DEBUG) - printf("Error: In active view, Grease Pencil not shown \n"); - return 0; - } } break; diff --git a/source/blender/editors/metaball/mball_ops.c b/source/blender/editors/metaball/mball_ops.c index c7635bcf2cc..f689fb049fe 100644 --- a/source/blender/editors/metaball/mball_ops.c +++ b/source/blender/editors/metaball/mball_ops.c @@ -36,6 +36,7 @@ #include "ED_mball.h" #include "ED_screen.h" +#include "ED_object.h" #include "BLI_utildefines.h" @@ -77,5 +78,7 @@ void ED_keymap_metaball(wmKeyConfig *keyconf) RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE); kmi = WM_keymap_add_item(keymap, "MBALL_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0); RNA_enum_set(kmi->ptr, "action", SEL_INVERT); + + ED_object_generic_keymap(keyconf, keymap, 3); } diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index a331703690b..de43b30d4f4 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -586,7 +586,7 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra } /* pyramid */ - if(sel && TRACK_SELECTED(track) && (sc->flag&SC_SHOW_PYRAMID_LEVELS) && (track->tracker==TRACKER_KLT) && (marker->flag&MARKER_DISABLED)==0) { + if(sel && TRACK_SELECTED(track) && (track->tracker==TRACKER_KLT) && (marker->flag&MARKER_DISABLED)==0) { if(track->flag&TRACK_LOCKED) { if(act) UI_ThemeColor(TH_ACT_MARKER); else if(track->pat_flag&SELECT) UI_ThemeColorShade(TH_LOCK_MARKER, 64); @@ -1307,7 +1307,7 @@ void clip_draw_grease_pencil(bContext *C, int onlyv2d) MovieClip *clip= ED_space_clip(sc); ImBuf *ibuf; - if((sc->flag&SC_SHOW_GPENCIL)==0 || !clip) + if(!clip) return; if(onlyv2d) { diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index 0d34cc2cfbf..5abdafbfffc 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -157,7 +157,7 @@ static SpaceLink *clip_new(const bContext *C) sc= MEM_callocN(sizeof(SpaceClip), "initclip"); sc->spacetype= SPACE_CLIP; - sc->flag= SC_SHOW_MARKER_PATTERN|SC_SHOW_TRACK_PATH|SC_SHOW_GPENCIL|SC_MANUAL_CALIBRATION|SC_SHOW_GRAPH_TRACKS|SC_SHOW_GRAPH_FRAMES; + sc->flag= SC_SHOW_MARKER_PATTERN|SC_SHOW_TRACK_PATH|SC_MANUAL_CALIBRATION|SC_SHOW_GRAPH_TRACKS|SC_SHOW_GRAPH_FRAMES; sc->zoom= 1.0f; sc->path_length= 20; sc->scopes.track_preview_height= 120; @@ -530,6 +530,12 @@ static void clip_keymap(struct wmKeyConfig *keyconf) kmi= WM_keymap_add_item(keymap, "WM_OT_context_toggle", LKEY, KM_PRESS, 0, 0); RNA_string_set(kmi->ptr, "data_path", "space_data.lock_selection"); + kmi= WM_keymap_add_item(keymap, "WM_OT_context_toggle", DKEY, KM_PRESS, KM_ALT, 0); + RNA_string_set(kmi->ptr, "data_path", "space_data.show_disabled"); + + kmi= WM_keymap_add_item(keymap, "WM_OT_context_toggle", SKEY, KM_PRESS, KM_ALT, 0); + RNA_string_set(kmi->ptr, "data_path", "space_data.show_marker_search"); + kmi= WM_keymap_add_item(keymap, "WM_OT_context_toggle", MKEY, KM_PRESS, 0, 0); RNA_string_set(kmi->ptr, "data_path", "space_data.use_mute_footage"); diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index a595fc1f02b..55481d6aa72 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -1284,7 +1284,7 @@ static void do_view3d_region_buttons(bContext *C, void *UNUSED(index), int event } /* default for now */ - WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, ob); + WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, v3d); } static void view3d_panel_object(const bContext *C, Panel *pa) diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 06138bc0757..64d858bbcee 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -896,11 +896,11 @@ enum { #define SC_SHOW_GRID (1<<9) #define SC_SHOW_STABLE (1<<10) #define SC_MANUAL_CALIBRATION (1<<11) -#define SC_SHOW_GPENCIL (1<<12) +/*#define SC_SHOW_GPENCIL (1<<12)*/ /* UNUSED */ #define SC_SHOW_FILTERS (1<<13) #define SC_SHOW_GRAPH_FRAMES (1<<14) #define SC_SHOW_GRAPH_TRACKS (1<<15) -#define SC_SHOW_PYRAMID_LEVELS (1<<16) +/*#define SC_SHOW_PYRAMID_LEVELS (1<<16) */ /* UNUSED */ #define SC_LOCK_TIMECURSOR (1<<17) /* SpaceClip->mode */ diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 320a7e95ef6..bab9ed60f16 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -2620,14 +2620,13 @@ static void rna_def_mesh(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_PAINT_MASK); RNA_def_property_ui_text(prop, "Paint Mask", "Face selection masking for painting"); RNA_def_property_ui_icon(prop, ICON_FACESEL_HLT, 0); - RNA_def_property_update(prop, 0, "rna_Mesh_update_facemask"); - + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_Mesh_update_facemask"); prop= RNA_def_property(srna, "use_paint_mask_vertex", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_VERT_SEL); RNA_def_property_ui_text(prop, "Vertex Selection", "Vertex selection masking for painting (weight paint only)"); RNA_def_property_ui_icon(prop, ICON_VERTEXSEL, 0); - RNA_def_property_update(prop, 0, "rna_Mesh_update_vertmask"); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_Mesh_update_vertmask"); /* readonly editmesh info - use for extrude menu */ prop= RNA_def_property(srna, "total_vert_sel", PROP_INT, PROP_UNSIGNED); diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index 153317fb687..6d588632c95 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -84,9 +84,9 @@ static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, char *name /* don't remove this, as COLLADA exporting cannot be done through operators in render() callback. */ #include "../../collada/collada.h" -static void rna_Scene_collada_export(Scene *scene, const char *filepath, int selected) +static void rna_Scene_collada_export(Scene *scene, const char *filepath, int selected, int second_life) { - collada_export(scene, filepath, selected); + collada_export(scene, filepath, selected, second_life); } #endif @@ -110,10 +110,11 @@ void RNA_api_scene(StructRNA *srna) #ifdef WITH_COLLADA /* don't remove this, as COLLADA exporting cannot be done through operators in render() callback. */ func= RNA_def_function(srna, "collada_export", "rna_Scene_collada_export"); - RNA_def_string(func, "filepath", "", FILE_MAX, "File Path", "File path to write Collada file"); - parm= RNA_def_boolean(func, "selected", 0, "Export only selected", "Export only selected elements"); + parm= RNA_def_string(func, "filepath", "", FILE_MAX, "File Path", "File path to write Collada file"); RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_property_subtype(parm, PROP_FILEPATH); /* allow non utf8 */ + parm= RNA_def_boolean(func, "selected", 0, "Export only selected", "Export only selected elements"); + parm= RNA_def_boolean(func, "second_life", 0, "Export for Second Life", "Compatibility mode for Second Life"); RNA_def_function_ui_description(func, "Export to collada file"); #endif } diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 799366a5234..8499e2fa111 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -2888,12 +2888,6 @@ static void rna_def_space_clip(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_MARKER_SEARCH); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL); - /* show pyramid */ - prop= RNA_def_property(srna, "show_pyramid_levels", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_ui_text(prop, "Show Pyramid ", "Show patterns for each pyramid level for markers (KLT only)"); - RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_PYRAMID_LEVELS); - RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL); - /* lock to selection */ prop= RNA_def_property(srna, "lock_selection", PROP_BOOLEAN, PROP_NONE); RNA_def_property_ui_text(prop, "Lock to Selection", "Lock viewport to selected markers during playback"); @@ -2973,12 +2967,6 @@ static void rna_def_space_clip(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Manual Calibration", "Use manual calibration helpers"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL); - /* show stable */ - prop= RNA_def_property(srna, "show_grease_pencil", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_GPENCIL); - RNA_def_property_ui_text(prop, "Show Grease Pencil", "Show grease pencil strokes over the footage"); - RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL); - /* show filters */ prop= RNA_def_property(srna, "show_filters", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_FILTERS); diff --git a/source/blender/quicktime/apple/quicktime_import.c b/source/blender/quicktime/apple/quicktime_import.c index b58b4a646e2..a7d09682a14 100644 --- a/source/blender/quicktime/apple/quicktime_import.c +++ b/source/blender/quicktime/apple/quicktime_import.c @@ -41,6 +41,7 @@ #include "BLO_sys_types.h" #include "BKE_global.h" #include "BLI_dynstr.h" +#include "BLI_path_util.h" #ifdef __APPLE__ #include <QuickTime/Movies.h> diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 4052c221935..19c45164b53 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1324,7 +1324,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar uiItemL(col, "Links", ICON_NONE); uiItemStringO(col, IFACE_("Donations"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/blenderorg/blender-foundation/donation-payment"); uiItemStringO(col, IFACE_("Credits"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/credits"); - uiItemStringO(col, IFACE_("Release Log"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/release-logs/blender-261"); + uiItemStringO(col, IFACE_("Release Log"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/release-logs/blender-262"); uiItemStringO(col, IFACE_("Manual"), ICON_URL, "WM_OT_url_open", "url", "http://wiki.blender.org/index.php/Doc:2.5/Manual"); uiItemStringO(col, IFACE_("Blender Website"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org"); uiItemStringO(col, IFACE_("User Community"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/community/user-community"); @@ -2135,7 +2135,7 @@ static int wm_collada_export_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED static int wm_collada_export_exec(bContext *C, wmOperator *op) { char filename[FILE_MAX]; - int selected; + int selected, second_life; if(!RNA_struct_property_is_set(op->ptr, "filepath")) { BKE_report(op->reports, RPT_ERROR, "No filename given"); @@ -2144,7 +2144,8 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "filepath", filename); selected = RNA_boolean_get(op->ptr, "selected"); - if(collada_export(CTX_data_scene(C), filename, selected)) { + second_life = RNA_boolean_get(op->ptr, "second_life"); + if(collada_export(CTX_data_scene(C), filename, selected, second_life)) { return OPERATOR_FINISHED; } else { @@ -2164,6 +2165,8 @@ static void WM_OT_collada_export(wmOperatorType *ot) WM_operator_properties_filesel(ot, FOLDERFILE|COLLADAFILE, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY); RNA_def_boolean(ot->srna, "selected", 0, "Export only selected", "Export only selected elements"); + RNA_def_boolean(ot->srna, "second_life", 0, "Export for Second Life", + "Compatibility mode for Second Life"); } /* function used for WM_OT_save_mainfile too */ diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp index d1e80226cd4..a22122a245e 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp @@ -231,6 +231,8 @@ bool CcdPhysicsController::CreateSoftbody() if (trimeshshape->getMeshInterface()->getNumSubParts()==1) { unsigned char* vertexBase; + btScalar* scaledVertexBase; + btVector3 localScaling; PHY_ScalarType vertexType; int numverts; int vertexstride; @@ -238,8 +240,16 @@ bool CcdPhysicsController::CreateSoftbody() int indexstride; PHY_ScalarType indexType; trimeshshape->getMeshInterface()->getLockedVertexIndexBase(&vertexBase,numverts,vertexType,vertexstride,&indexbase,indexstride,numtris,indexType); - - psb = btSoftBodyHelpers::CreateFromTriMesh(worldInfo,(const btScalar*)vertexBase,(const int*)indexbase,numtris,false); + localScaling = scaledtrimeshshape->getLocalScaling(); + scaledVertexBase = new btScalar[numverts*3]; + for (int i=0; i<numverts*3; i+=3) + { + scaledVertexBase[i] = ((const btScalar*)vertexBase)[i] * localScaling.getX(); + scaledVertexBase[i+1] = ((const btScalar*)vertexBase)[i+1] * localScaling.getY(); + scaledVertexBase[i+2] = ((const btScalar*)vertexBase)[i+2] * localScaling.getZ(); + } + psb = btSoftBodyHelpers::CreateFromTriMesh(worldInfo,scaledVertexBase,(const int*)indexbase,numtris,false); + delete [] scaledVertexBase; } } else { |