diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-12-19 14:13:59 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-12-19 14:13:59 +0400 |
commit | 7990171c9001266917509f08e50b438ea2cfc717 (patch) | |
tree | e4f95e286ab250e6f1dba4aa8e0e2d3ccc197958 | |
parent | d19e46e8a853cd7a154b390ab16b2dc0e7b87747 (diff) |
svn merge ^/trunk/blender -c53096 -c53112 -c53123 -c53129
9 files changed, 52 insertions, 30 deletions
diff --git a/release/scripts/startup/bl_ui/properties_physics_cloth.py b/release/scripts/startup/bl_ui/properties_physics_cloth.py index 5a44294f0e0..91b4cc0ae49 100644 --- a/release/scripts/startup/bl_ui/properties_physics_cloth.py +++ b/release/scripts/startup/bl_ui/properties_physics_cloth.py @@ -91,7 +91,7 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel, Panel): sub.prop(cloth, "pin_stiffness", text="Stiffness") col.label(text="Pre roll:") - col.prop(cloth, "pre_roll", text="Frame") + col.prop(cloth, "pre_roll", text="Frames") # Disabled for now """ diff --git a/release/scripts/templates/operator_modal_view3d_raycast.py b/release/scripts/templates/operator_modal_view3d_raycast.py index 3236c08cc8c..eac76922187 100644 --- a/release/scripts/templates/operator_modal_view3d_raycast.py +++ b/release/scripts/templates/operator_modal_view3d_raycast.py @@ -16,7 +16,6 @@ def main(context, event, ray_max=10000.0): ray_origin = view3d_utils.region_2d_to_origin_3d(region, rv3d, coord) ray_target = ray_origin + (view_vector * ray_max) - scene.cursor_location = ray_target def visible_objects_and_duplis(): """Loop over (object, matrix) pairs (mesh only)""" @@ -58,7 +57,9 @@ def main(context, event, ray_max=10000.0): if obj.type == 'MESH': hit, normal, face_index = obj_ray_cast(obj, matrix) if hit is not None: - length_squared = (hit - ray_origin).length_squared + hit_world = matrix * hit + scene.cursor_location = hit_world + length_squared = (hit_world - ray_origin).length_squared if length_squared < best_length_squared: best_length_squared = length_squared best_obj = obj @@ -67,6 +68,7 @@ def main(context, event, ray_max=10000.0): # we could do lots of stuff but for the example just select. if best_obj is not None: best_obj.select = True + context.scene.objects.active = best_obj class ViewOperatorRayCast(bpy.types.Operator): @@ -105,3 +107,4 @@ def unregister(): if __name__ == "__main__": register() + diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index ec0703248fd..6c9dc0fdb96 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -88,7 +88,7 @@ int BKE_object_is_libdata(struct Object *ob); int BKE_object_obdata_is_libdata(struct Object *ob); void BKE_object_scale_to_mat3(struct Object *ob, float mat[][3]); -void BKE_object_rot_to_mat3(struct Object *ob, float mat[][3]); +void BKE_object_rot_to_mat3(struct Object *ob, float mat[][3], short use_drot); void BKE_object_mat3_to_rot(struct Object *ob, float mat[][3], short use_compat); void BKE_object_to_mat3(struct Object *ob, float mat[][3]); void BKE_object_to_mat4(struct Object *ob, float mat[][4]); diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 47ca502d247..4905a313714 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1495,7 +1495,7 @@ void BKE_object_scale_to_mat3(Object *ob, float mat[][3]) size_to_mat3(mat, vec); } -void BKE_object_rot_to_mat3(Object *ob, float mat[][3]) +void BKE_object_rot_to_mat3(Object *ob, float mat[3][3], short use_drot) { float rmat[3][3], dmat[3][3]; @@ -1526,7 +1526,10 @@ void BKE_object_rot_to_mat3(Object *ob, float mat[][3]) } /* combine these rotations */ - mul_m3_m3m3(mat, dmat, rmat); + if(use_drot) + mul_m3_m3m3(mat, dmat, rmat); + else + copy_m3_m3(mat, rmat); } void BKE_object_mat3_to_rot(Object *ob, float mat[][3], short use_compat) @@ -1671,7 +1674,7 @@ void BKE_object_to_mat3(Object *ob, float mat[][3]) /* no parent */ BKE_object_scale_to_mat3(ob, smat); /* rot */ - BKE_object_rot_to_mat3(ob, rmat); + BKE_object_rot_to_mat3(ob, rmat, TRUE); mul_m3_m3m3(mat, rmat, smat); } diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 2b170ea546b..10ba10d3b36 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -164,15 +164,20 @@ static int panels_re_align(ScrArea *sa, ARegion *ar, Panel **r_pa) /****************************** panels ******************************/ -static void panels_collapse_all(ScrArea *sa, ARegion *ar) +static void panels_collapse_all(ScrArea *sa, ARegion *ar, Panel *from_pa) { Panel *pa; + PanelType *pt, *from_pt; int flag = ((panel_aligned(sa, ar) == BUT_HORIZONTAL) ? PNL_CLOSEDX : PNL_CLOSEDY); for (pa = ar->panels.first; pa; pa = pa->next) { - if (pa->type && !(pa->type->flag & PNL_NO_HEADER)) { - pa->flag = flag; - } + pt = pa->type; + from_pt = from_pa->type; + + /* close panels with headers in the same context */ + if (pt && from_pt && !(pt->flag & PNL_NO_HEADER)) + if (!pt->context[0] || strcmp(pt->context, from_pt->context) == 0) + pa->flag = flag; } } @@ -1016,7 +1021,7 @@ static void ui_do_drag(const bContext *C, wmEvent *event, Panel *panel) /* this function is supposed to call general window drawing too */ /* also it supposes a block has panel, and isn't a menu */ -static void ui_handle_panel_header(const bContext *C, uiBlock *block, int mx, int my, int event) +static void ui_handle_panel_header(const bContext *C, uiBlock *block, int mx, int my, int event, int ctrl) { ScrArea *sa = CTX_wm_area(C); ARegion *ar = CTX_wm_region(C); @@ -1049,6 +1054,9 @@ static void ui_handle_panel_header(const bContext *C, uiBlock *block, int mx, in ED_region_tag_redraw(ar); } else { /* collapse */ + if(ctrl) + panels_collapse_all(sa, ar, block->panel); + if (block->panel->flag & PNL_CLOSED) { block->panel->flag &= ~PNL_CLOSED; /* snap back up so full panel aligns with screen edge */ @@ -1088,7 +1096,6 @@ static void ui_handle_panel_header(const bContext *C, uiBlock *block, int mx, in int ui_handler_panel_region(bContext *C, wmEvent *event) { - ScrArea *sa = CTX_wm_area(C); ARegion *ar = CTX_wm_region(C); uiBlock *block; Panel *pa; @@ -1118,10 +1125,10 @@ int ui_handler_panel_region(bContext *C, wmEvent *event) if (pa->flag & PNL_CLOSEDY) { if ((block->rect.ymax <= my) && (block->rect.ymax + PNL_HEADER >= my)) - ui_handle_panel_header(C, block, mx, my, event->type); + ui_handle_panel_header(C, block, mx, my, event->type, event->ctrl); } else - ui_handle_panel_header(C, block, mx, my, event->type); + ui_handle_panel_header(C, block, mx, my, event->type, event->ctrl); continue; } @@ -1150,15 +1157,13 @@ int ui_handler_panel_region(bContext *C, wmEvent *event) /* open close on header */ if (ELEM(event->type, RETKEY, PADENTER)) { if (inside_header) { - ui_handle_panel_header(C, block, mx, my, RETKEY); + ui_handle_panel_header(C, block, mx, my, RETKEY, event->ctrl); break; } } else if (event->type == LEFTMOUSE) { if (inside_header) { - if (event->ctrl) - panels_collapse_all(sa, ar); - ui_handle_panel_header(C, block, mx, my, 0); + ui_handle_panel_header(C, block, mx, my, 0, event->ctrl); break; } else if (inside_scale && !(pa->flag & PNL_CLOSED)) { diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 900bf57b509..7a2eb5667a2 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -447,7 +447,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo float tmat[3][3], timat[3][3]; /* simple rotation matrix */ - BKE_object_rot_to_mat3(ob, rsmat); + BKE_object_rot_to_mat3(ob, rsmat, TRUE); /* correct for scale, note mul_m3_m3m3 has swapped args! */ BKE_object_scale_to_mat3(ob, tmat); diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index a29524de36d..77662d8ac13 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -2025,7 +2025,7 @@ static void set_axis(Scene *scene, Object *ob, MovieClip *clip, MovieTrackingOb if (!flip) { float lmat[4][4], ilmat[4][4], rmat[3][3]; - BKE_object_rot_to_mat3(ob, rmat); + BKE_object_rot_to_mat3(ob, rmat, TRUE); invert_m3(rmat); mul_m4_m4m3(mat, mat, rmat); diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c index b9e86e116a2..69de86da007 100644 --- a/source/blender/makesrna/intern/rna_cloth.c +++ b/source/blender/makesrna/intern/rna_cloth.c @@ -403,8 +403,8 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "pre_roll", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "preroll"); - RNA_def_property_range(prop, 0, 200); - RNA_def_property_ui_text(prop, "Pre Roll", "Simulation starts on this frame"); + RNA_def_property_range(prop, 0, MAXFRAME); + RNA_def_property_ui_text(prop, "Pre Roll", "Start simulation a number of frames earlier to let the cloth settle in"); RNA_def_property_update(prop, 0, "rna_cloth_reset"); prop = RNA_def_property(srna, "rest_shape_key", PROP_POINTER, PROP_NONE); diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index eb695e624e4..ab0630bf398 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -2187,26 +2187,37 @@ static void bl_ConvertBlenderObject_Single( blenderobject->loc[1]+blenderobject->dloc[1], blenderobject->loc[2]+blenderobject->dloc[2] ); - MT_Vector3 eulxyz(blenderobject->rot); + + MT_Matrix3x3 rotation; + float rotmat[3][3]; + BKE_object_rot_to_mat3(blenderobject, rotmat, FALSE); + rotation.setValue3x3((float*)rotmat); + MT_Vector3 scale(blenderobject->size); + if (converter->addInitFromFrame) {//rcruiz - float eulxyzPrev[3]; blenderscene->r.cfra=blenderscene->r.sfra-1; //XXX update_for_newframe(); MT_Vector3 tmp=pos-MT_Point3(blenderobject->loc[0]+blenderobject->dloc[0], blenderobject->loc[1]+blenderobject->dloc[1], blenderobject->loc[2]+blenderobject->dloc[2] ); - eulxyzPrev[0]=blenderobject->rot[0]; - eulxyzPrev[1]=blenderobject->rot[1]; - eulxyzPrev[2]=blenderobject->rot[2]; + + float rotmatPrev[3][3]; + BKE_object_rot_to_mat3(blenderobject, rotmatPrev, FALSE); + + float eulxyz[3], eulxyzPrev[3]; + mat3_to_eul(eulxyz, rotmat); + mat3_to_eul(eulxyzPrev, rotmatPrev); double fps = (double) blenderscene->r.frs_sec/ (double) blenderscene->r.frs_sec_base; tmp.scale(fps, fps, fps); inivel.push_back(tmp); - tmp=eulxyz-eulxyzPrev; + tmp[0]=eulxyz[0]-eulxyzPrev[0]; + tmp[1]=eulxyz[1]-eulxyzPrev[1]; + tmp[2]=eulxyz[2]-eulxyzPrev[2]; tmp.scale(fps, fps, fps); iniang.push_back(tmp); blenderscene->r.cfra=blenderscene->r.sfra; @@ -2214,7 +2225,7 @@ static void bl_ConvertBlenderObject_Single( } gameobj->NodeSetLocalPosition(pos); - gameobj->NodeSetLocalOrientation(MT_Matrix3x3(eulxyz)); + gameobj->NodeSetLocalOrientation(rotation); gameobj->NodeSetLocalScale(scale); gameobj->NodeUpdateGS(0); |