Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/object/object_transform.c')
-rw-r--r--source/blender/editors/object/object_transform.c63
1 files changed, 32 insertions, 31 deletions
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index 20d93083410..a16b0f2a7ac 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -26,6 +26,7 @@
*/
#include <stdlib.h>
+#include <string.h>
#include "DNA_anim_types.h"
#include "DNA_action_types.h"
@@ -104,8 +105,11 @@ static int object_location_clear_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
+ /* this is needed so children are also updated */
+ DAG_ids_flush_update(0);
+
WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -118,7 +122,7 @@ void OBJECT_OT_location_clear(wmOperatorType *ot)
/* api callbacks */
ot->exec= object_location_clear_exec;
- ot->poll= ED_operator_object_active;
+ ot->poll= ED_operator_object_active_editable;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -240,6 +244,9 @@ static int object_rotation_clear_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
+ /* this is needed so children are also updated */
+ DAG_ids_flush_update(0);
+
WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
return OPERATOR_FINISHED;
@@ -254,7 +261,7 @@ void OBJECT_OT_rotation_clear(wmOperatorType *ot)
/* api callbacks */
ot->exec= object_rotation_clear_exec;
- ot->poll= ED_operator_object_active;
+ ot->poll= ED_operator_object_active_editable;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -298,6 +305,9 @@ static int object_scale_clear_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
+ /* this is needed so children are also updated */
+ DAG_ids_flush_update(0);
+
WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
return OPERATOR_FINISHED;
@@ -312,7 +322,7 @@ void OBJECT_OT_scale_clear(wmOperatorType *ot)
/* api callbacks */
ot->exec= object_scale_clear_exec;
- ot->poll= ED_operator_object_active;
+ ot->poll= ED_operator_object_active_editable;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -340,7 +350,7 @@ static int object_origin_clear_exec(bContext *C, wmOperator *op)
CTX_DATA_END;
if(armature_clear==0) /* in this case flush was done */
- ED_anim_dag_flush_update(C);
+ DAG_ids_flush_update(0);
WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
@@ -356,7 +366,7 @@ void OBJECT_OT_origin_clear(wmOperatorType *ot)
/* api callbacks */
ot->exec= object_origin_clear_exec;
- ot->poll= ED_operator_object_active;
+ ot->poll= ED_operator_object_active_editable;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -545,17 +555,7 @@ static int visual_transform_apply_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
where_is_object(scene, ob);
-
- VECCOPY(ob->loc, ob->obmat[3]);
- mat4_to_size(ob->size,ob->obmat);
-
- if (ob->rotmode == ROT_MODE_QUAT)
- mat4_to_quat(ob->quat, ob->obmat);
- else if (ob->rotmode == ROT_MODE_AXISANGLE)
- mat4_to_axis_angle(ob->rotAxis, &ob->rotAngle, ob->obmat);
- else
- mat4_to_eul(ob->rot,ob->obmat);
-
+ object_apply_mat4(ob, ob->obmat);
where_is_object(scene, ob);
change = 1;
@@ -578,7 +578,7 @@ void OBJECT_OT_visual_transform_apply(wmOperatorType *ot)
/* api callbacks */
ot->exec= visual_transform_apply_exec;
- ot->poll= ED_operator_object_active;
+ ot->poll= ED_operator_object_active_editable;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -598,7 +598,7 @@ void OBJECT_OT_location_apply(wmOperatorType *ot)
/* api callbacks */
ot->exec= location_apply_exec;
- ot->poll= ED_operator_object_active;
+ ot->poll= ED_operator_object_active_editable;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -618,7 +618,7 @@ void OBJECT_OT_scale_apply(wmOperatorType *ot)
/* api callbacks */
ot->exec= scale_apply_exec;
- ot->poll= ED_operator_object_active;
+ ot->poll= ED_operator_object_active_editable;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -638,7 +638,7 @@ void OBJECT_OT_rotation_apply(wmOperatorType *ot)
/* api callbacks */
ot->exec= rotation_apply_exec;
- ot->poll= ED_operator_object_active;
+ ot->poll= ED_operator_object_active_editable;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -694,14 +694,14 @@ void texspace_edit(Scene *scene, View3D *v3d)
/********************* Set Object Center ************************/
static EnumPropertyItem prop_set_center_types[] = {
- {0, "CENTER", 0, "ObData to Center", "Move object data around Object center"},
- {1, "CENTER_NEW", 0, "Center New", "Move Object center to center of object data"},
- {2, "CENTER_CURSOR", 0, "Center Cursor", "Move Object Center to position of the 3d cursor"},
+ {0, "GEOMETRY_ORIGIN", 0, "Geometry to Origin", "Move object geometry to object origin"},
+ {1, "ORIGIN_GEOMETRY", 0, "Origin to Geometry", "Move object origin to center of object geometry"},
+ {2, "ORIGIN_CURSOR", 0, "Origin to 3D Cursor", "Move object origin to position of the 3d cursor"},
{0, NULL, 0, NULL, NULL}
};
/* 0 == do center, 1 == center new, 2 == center cursor */
-static int object_center_set_exec(bContext *C, wmOperator *op)
+static int object_origin_set_exec(bContext *C, wmOperator *op)
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
@@ -1009,7 +1009,8 @@ static int object_center_set_exec(bContext *C, wmOperator *op)
CTX_DATA_END;
if (tot_change) {
- ED_anim_dag_flush_update(C);
+ DAG_ids_flush_update(0);
+ WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
}
/* Warn if any errors occured */
@@ -1024,16 +1025,16 @@ static int object_center_set_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void OBJECT_OT_center_set(wmOperatorType *ot)
+void OBJECT_OT_origin_set(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set Center";
- ot->description = "Set the object's center, by either moving the data, or set to center of data, or use 3d cursor";
- ot->idname= "OBJECT_OT_center_set";
+ ot->name= "Set Origin";
+ ot->description = "Set the object's origin, by either moving the data, or set to center of data, or use 3d cursor";
+ ot->idname= "OBJECT_OT_origin_set";
/* api callbacks */
ot->invoke= WM_menu_invoke;
- ot->exec= object_center_set_exec;
+ ot->exec= object_origin_set_exec;
ot->poll= ED_operator_view3d_active;