[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44672] trunk/blender: Camera tracking: wall scene orientation operator
Sergey Sharybin
sergey.vfx at gmail.com
Tue Mar 6 13:27:52 CET 2012
Revision: 44672
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44672
Author: nazgul
Date: 2012-03-06 12:27:42 +0000 (Tue, 06 Mar 2012)
Log Message:
-----------
Camera tracking: wall scene orientation operator
Made Set Floor a bit more general and name it Set Plane which defines
orientation from 3 selected tracks and makes them belong to specified
plane (wall or floor).
Modified Paths:
--------------
trunk/blender/release/scripts/startup/bl_ui/space_clip.py
trunk/blender/source/blender/editors/space_clip/clip_intern.h
trunk/blender/source/blender/editors/space_clip/space_clip.c
trunk/blender/source/blender/editors/space_clip/tracking_ops.c
Modified: trunk/blender/release/scripts/startup/bl_ui/space_clip.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_clip.py 2012-03-06 12:16:55 UTC (rev 44671)
+++ trunk/blender/release/scripts/startup/bl_ui/space_clip.py 2012-03-06 12:27:42 UTC (rev 44672)
@@ -298,7 +298,11 @@
settings = sc.clip.tracking.settings
col = layout.column(align=True)
- col.operator("clip.set_floor")
+ row = col.row()
+ props = row.operator("clip.set_plane", text="Floor")
+ props.plane = 'FLOOR'
+ props = row.operator("clip.set_plane", text="Wall")
+ props.plane = 'WALL'
col.operator("clip.set_origin")
row = col.row()
Modified: trunk/blender/source/blender/editors/space_clip/clip_intern.h
===================================================================
--- trunk/blender/source/blender/editors/space_clip/clip_intern.h 2012-03-06 12:16:55 UTC (rev 44671)
+++ trunk/blender/source/blender/editors/space_clip/clip_intern.h 2012-03-06 12:27:42 UTC (rev 44672)
@@ -126,7 +126,7 @@
void CLIP_OT_lock_tracks(struct wmOperatorType *ot);
void CLIP_OT_set_origin(struct wmOperatorType *ot);
-void CLIP_OT_set_floor(struct wmOperatorType *ot);
+void CLIP_OT_set_plane(struct wmOperatorType *ot);
void CLIP_OT_set_axis(struct wmOperatorType *ot);
void CLIP_OT_set_scale(struct wmOperatorType *ot);
void CLIP_OT_set_solution_scale(struct wmOperatorType *ot);
Modified: trunk/blender/source/blender/editors/space_clip/space_clip.c
===================================================================
--- trunk/blender/source/blender/editors/space_clip/space_clip.c 2012-03-06 12:16:55 UTC (rev 44671)
+++ trunk/blender/source/blender/editors/space_clip/space_clip.c 2012-03-06 12:27:42 UTC (rev 44672)
@@ -347,7 +347,7 @@
/* orientation */
WM_operatortype_append(CLIP_OT_set_origin);
- WM_operatortype_append(CLIP_OT_set_floor);
+ WM_operatortype_append(CLIP_OT_set_plane);
WM_operatortype_append(CLIP_OT_set_axis);
WM_operatortype_append(CLIP_OT_set_scale);
WM_operatortype_append(CLIP_OT_set_solution_scale);
Modified: trunk/blender/source/blender/editors/space_clip/tracking_ops.c
===================================================================
--- trunk/blender/source/blender/editors/space_clip/tracking_ops.c 2012-03-06 12:16:55 UTC (rev 44671)
+++ trunk/blender/source/blender/editors/space_clip/tracking_ops.c 2012-03-06 12:27:42 UTC (rev 44672)
@@ -2248,7 +2248,7 @@
object_apply_mat4(ob, mat, 0, 0);
}
-static int set_floor_exec(bContext *C, wmOperator *op)
+static int set_plane_exec(bContext *C, wmOperator *op)
{
SpaceClip *sc= CTX_wm_space_clip(C);
MovieClip *clip= ED_space_clip(sc);
@@ -2261,6 +2261,7 @@
Object *camera= get_camera_with_movieclip(scene, clip);
int tot= 0;
float vec[3][3], mat[4][4], obmat[4][4], newmat[4][4], orig[3]= {0.0f, 0.0f, 0.0f};
+ int plane= RNA_enum_get(op->ptr, "plane");
float rot[4][4]={{0.0f, 0.0f, -1.0f, 0.0f},
{0.0f, 1.0f, 0.0f, 0.0f},
{1.0f, 0.0f, 0.0f, 0.0f},
@@ -2308,9 +2309,16 @@
/* construct ortho-normal basis */
unit_m4(mat);
- cross_v3_v3v3(mat[0], vec[1], vec[2]);
- copy_v3_v3(mat[1], vec[1]);
- cross_v3_v3v3(mat[2], mat[0], mat[1]);
+ if (plane == 0) { /* floor */
+ cross_v3_v3v3(mat[0], vec[1], vec[2]);
+ copy_v3_v3(mat[1], vec[1]);
+ cross_v3_v3v3(mat[2], mat[0], mat[1]);
+ }
+ else if (plane == 1) { /* wall */
+ cross_v3_v3v3(mat[2], vec[1], vec[2]);
+ copy_v3_v3(mat[1], vec[1]);
+ cross_v3_v3v3(mat[0], mat[1], mat[2]);
+ }
normalize_v3(mat[0]);
normalize_v3(mat[1]);
@@ -2352,19 +2360,28 @@
return OPERATOR_FINISHED;
}
-void CLIP_OT_set_floor(wmOperatorType *ot)
+void CLIP_OT_set_plane(wmOperatorType *ot)
{
+ static EnumPropertyItem plane_items[] = {
+ {0, "FLOOR", 0, "Floor", "Set floor plane"},
+ {1, "WALL", 0, "Wall", "Set wall plane"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
/* identifiers */
- ot->name= "Set Floor";
- ot->description= "Set floor based on 3 selected bundles by moving camera (or it's parent if present) in 3D space";
- ot->idname= "CLIP_OT_set_floor";
+ ot->name= "Set Plane";
+ ot->description= "Set plane based on 3 selected bundles by moving camera (or it's parent if present) in 3D space";
+ ot->idname= "CLIP_OT_set_plane";
/* api callbacks */
- ot->exec= set_floor_exec;
+ ot->exec= set_plane_exec;
ot->poll= set_orientation_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ /* properties */
+ RNA_def_enum(ot->srna, "plane", plane_items, 0, "Plane", "Plane to be sued for orientation");
}
/********************** set axis operator *********************/
More information about the Bf-blender-cvs
mailing list