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:
authorMatt Ebb <matt@mke3.net>2006-11-21 04:38:28 +0300
committerMatt Ebb <matt@mke3.net>2006-11-21 04:38:28 +0300
commit1b24f495132930255860915f812072a97c222d85 (patch)
tree1ead78af6aed61868aad155394a034c2b7a0986f /source/blender/src/header_view3d.c
parent3d29a7c7efbfdf0ece13f6c061ebb8e8555ec161 (diff)
* Modified version of patch #5109 by Onur Yalazi, 'view camera selector'.
This appears as a new 'Cameras' menu in the 3D View's View menu, containing a command to set the active object as active camera, and a list of the available cameras in the scene to choose from.
Diffstat (limited to 'source/blender/src/header_view3d.c')
-rw-r--r--source/blender/src/header_view3d.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c
index 41ee7fc07ca..957aaa0a60e 100644
--- a/source/blender/src/header_view3d.c
+++ b/source/blender/src/header_view3d.c
@@ -195,6 +195,67 @@ void do_layer_buttons(short event)
allqueue(REDRAWNLA, 0);
}
+static void do_view3d_view_camerasmenu(void *arg, int event)
+{
+ Base *base;
+ int i=1;
+
+ if (event == 1) {
+ /* Set Active Object as Active Camera */
+ /* ugly hack alert */
+ G.qual |= LR_CTRLKEY;
+ persptoetsen(PAD0);
+ G.qual &= ~LR_CTRLKEY;
+ } else {
+ for( base = FIRSTBASE; base; base = base->next ) {
+ if (base->object->type == OB_CAMERA) {
+ i++;
+
+ if (event==i) {
+ G.vd->camera= base->object;
+ handle_view3d_lock();
+
+ G.vd->persp= 2;
+ G.vd->view= 0;
+ }
+ }
+ }
+ }
+
+ allqueue(REDRAWVIEW3D, 0);
+}
+
+static uiBlock *view3d_view_camerasmenu(void *arg_unused)
+{
+ Base *base;
+ uiBlock *block;
+ short yco= 0, menuwidth=120;
+ int i=1;
+ char camname[48];
+
+ block= uiNewBlock(&curarea->uiblocks, "view3d_view_camerasmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
+ uiBlockSetButmFunc(block, do_view3d_view_camerasmenu, NULL);
+
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Active Object as Active Camera|Ctrl NumPad 0", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
+
+ uiDefBut(block, SEPR, 0, "", 0, yco-=6, 140, 6, NULL, 0.0, 0.0, 0, 0, "");
+
+ for( base = FIRSTBASE; base; base = base->next ) {
+ if (base->object->type == OB_CAMERA) {
+ i++;
+
+ strcpy(camname, base->object->id.name+2);
+ if (base->object == G.scene->camera) strcat(camname, " (Active)");
+
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, camname, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, i, "");
+ }
+ }
+
+ uiBlockSetDirection(block, UI_RIGHT);
+ uiTextBoundsBlock(block, 50);
+ return block;
+}
+
static void do_view3d_view_cameracontrolsmenu(void *arg, int event)
{
switch(event) {
@@ -537,6 +598,8 @@ static uiBlock *view3d_viewmenu(void *arg_unused)
if (G.vd->viewbut == 3) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Side|NumPad 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Side|NumPad 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
+ uiDefIconTextBlockBut(block, view3d_view_camerasmenu, NULL, ICON_RIGHTARROW_THIN, "Cameras", 0, yco-=20, 120, 19, "");
+
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
if(G.vd->persp==1) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Perspective|NumPad 5", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, "");