~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to source/blender/src/header_buttonswin.c

  • Committer: Bazaar Package Importer
  • Author(s): Lukas Fittl
  • Date: 2006-09-20 01:57:27 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20060920015727-gmoqlxwstx9wwqs3
Tags: 2.42a-1ubuntu1
* Merge from Debian unstable (Closes: Malone #55903). Remaining changes:
  - debian/genpot: Add python scripts from Lee June <blender@eyou.com> to
    generate a reasonable PO template from the sources. Since gettext is used
    in a highly nonstandard way, xgettext does not work for this job.
  - debian/rules: Call the scripts, generate po/blender.pot, and clean it up
    in the clean target.
  - Add a proper header to the generated PO template.
* debian/control: Build depend on libavformat-dev >= 3:0.cvs20060823-3.1,
  otherwise this package will FTBFS

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 * Functions to draw the "Buttons Window" window header
5
5
 * and handle user events sent to it.
6
6
 * 
7
 
 * $Id: header_buttonswin.c,v 1.38 2005/11/10 20:07:17 broken Exp $
 
7
 * $Id: header_buttonswin.c,v 1.42 2006/07/22 17:11:36 ton Exp $
8
8
 *
9
9
 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
10
10
 *
46
46
#include "DNA_armature_types.h"
47
47
#include "DNA_lamp_types.h"
48
48
#include "DNA_material_types.h"
 
49
#include "DNA_node_types.h"
49
50
#include "DNA_object_types.h"
50
51
#include "DNA_scene_types.h"
51
52
#include "DNA_screen_types.h"
62
63
#include "BIF_butspace.h"
63
64
 
64
65
#include "BKE_armature.h"
 
66
#include "BKE_blender.h"
65
67
#include "BKE_global.h"
66
68
#include "BKE_library.h"
67
69
#include "BKE_main.h"
68
70
#include "BKE_material.h"
 
71
#include "BKE_node.h"
69
72
#include "BKE_texture.h"
70
73
#include "BKE_utildefines.h"
 
74
 
71
75
#include "BSE_drawipo.h"
 
76
#include "BSE_node.h"
72
77
#include "BSE_headerbuttons.h"
73
78
 
74
79
#include "MEM_guardedalloc.h"
 
80
#include "BLI_blenlib.h"
75
81
 
76
82
#include "blendef.h"
77
83
#include "mydevice.h"
98
104
 
99
105
        if(matcopybuf.ramp_col) MEM_freeN(matcopybuf.ramp_col);
100
106
        if(matcopybuf.ramp_spec) MEM_freeN(matcopybuf.ramp_spec);
 
107
        
101
108
        matcopybuf.ramp_col= NULL;
102
109
        matcopybuf.ramp_spec= NULL;
103
110
        
 
111
        if(matcopybuf.nodetree) {
 
112
                ntreeFreeTree(matcopybuf.nodetree);
 
113
                MEM_freeN(matcopybuf.nodetree);
 
114
                matcopybuf.nodetree= NULL;
 
115
        }
104
116
        default_mtex(&mtexcopybuf);
105
117
}
106
118
 
131
143
                scrarea_queue_winredraw(curarea);
132
144
                break;
133
145
        case B_BUTSPREVIEW:
134
 
                BIF_preview_changed(G.buts);
 
146
                BIF_preview_changed(ID_TE);
135
147
                G.buts->oldkeypress = 0;
136
148
                scrarea_queue_headredraw(curarea);
137
149
                scrarea_queue_winredraw(curarea);
143
155
                break;
144
156
        case B_MATCOPY:
145
157
                if(G.buts->lockpoin) {
 
158
                        ma= G.buts->lockpoin;
146
159
                        if(matcopied) free_matcopybuf();
147
160
 
148
 
                        memcpy(&matcopybuf, G.buts->lockpoin, sizeof(Material));
 
161
                        memcpy(&matcopybuf, ma, sizeof(Material));
149
162
                        if(matcopybuf.ramp_col) matcopybuf.ramp_col= MEM_dupallocN(matcopybuf.ramp_col);
150
163
                        if(matcopybuf.ramp_spec) matcopybuf.ramp_spec= MEM_dupallocN(matcopybuf.ramp_spec);
151
164
 
155
168
                                        matcopybuf.mtex[a]= MEM_dupallocN(mtex);
156
169
                                }
157
170
                        }
 
171
                        matcopybuf.nodetree= ntreeCopyTree(ma->nodetree, 0);
158
172
                        matcopied= 1;
159
173
                }
160
174
                break;
161
175
        case B_MATPASTE:
162
176
                if(matcopied && G.buts->lockpoin) {
163
177
                        ma= G.buts->lockpoin;
 
178
                        
164
179
                        /* free current mat */
165
180
                        if(ma->ramp_col) MEM_freeN(ma->ramp_col);
166
181
                        if(ma->ramp_spec) MEM_freeN(ma->ramp_spec);
170
185
                                if(mtex) MEM_freeN(mtex);
171
186
                        }
172
187
                        
 
188
                        if(ma->nodetree) {
 
189
                                ntreeFreeTree(ma->nodetree);
 
190
                                MEM_freeN(ma->nodetree);
 
191
                        }
 
192
                        
173
193
                        id= (ma->id);
174
 
                        memcpy(G.buts->lockpoin, &matcopybuf, sizeof(Material));
 
194
                        memcpy(ma, &matcopybuf, sizeof(Material));
175
195
                        (ma->id)= id;
176
196
                        
177
197
                        if(matcopybuf.ramp_col) ma->ramp_col= MEM_dupallocN(matcopybuf.ramp_col);
184
204
                                        if(mtex->tex) id_us_plus((ID *)mtex->tex);
185
205
                                }
186
206
                        }
187
 
                        BIF_preview_changed(G.buts);
 
207
                        
 
208
                        ma->nodetree= ntreeCopyTree(matcopybuf.nodetree, 0);
 
209
 
 
210
                        BIF_preview_changed(ID_MA);
188
211
                        BIF_undo_push("Paste material settings");
189
212
                        scrarea_queue_winredraw(curarea);
190
213
                }
261
284
 
262
285
                        if(G.buts->texfrom==0) {
263
286
                                if(ob && ob->type<OB_LAMP && ob->type) {
 
287
                                        bNode *node= NULL;
 
288
                                        
264
289
                                        ma= give_current_material(ob, ob->actcol);
265
 
                                        *idfrom= (ID *)ma;
266
 
                                        if(ma) {
267
 
                                                mtex= ma->mtex[ ma->texact ];
268
 
                                                if(mtex) *id= (ID *)mtex->tex;
 
290
                                        if(ma && ma->use_nodes)
 
291
                                                node= editnode_get_active_idnode(ma->nodetree, ID_TE);
 
292
                                                
 
293
                                        if(node) {
 
294
                                                *idfrom= NULL;
 
295
                                                *id= node->id;
 
296
                                        }
 
297
                                        else {
 
298
                                                ma= editnode_get_active_material(ma);
 
299
                                                *idfrom= (ID *)ma;
 
300
                                                if(ma) {
 
301
                                                        mtex= ma->mtex[ ma->texact ];
 
302
                                                        if(mtex) *id= (ID *)mtex->tex;
 
303
                                                }
269
304
                                        }
270
305
                                }
271
306
                        }
455
490
 
456
491
static void do_buts_viewmenu(void *arg, int event)
457
492
{       
 
493
        SpaceButs *sbuts= curarea->spacedata.first;
 
494
        
458
495
        switch(event) {
 
496
                case 1: /* zoom in */
 
497
                        view2d_zoom(&sbuts->v2d, 0.06f, curarea->winx, curarea->winy);
 
498
                        break;
 
499
                case 2: /* zoom out */
 
500
                        view2d_zoom(&sbuts->v2d, -0.075f, curarea->winx, curarea->winy);
 
501
                        break;
459
502
                case 3: /* View All */
460
503
                        do_buts_buttons(B_BUTSHOME);
461
504
                        break;
519
562
 
520
563
        uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
521
564
        
 
565
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Zoom In|NumPad +", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
 
566
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Zoom Out|NumPad -", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
 
567
        
 
568
        uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
 
569
        
522
570
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "View All|Home", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
523
571
                
524
572
        if (!curarea->full) 
653
701
        uiBlockEndAlign(block);
654
702
        
655
703
        xco+=XIC;
656
 
        uiDefButS(block, NUM, B_NEWFRAME, "",   (short)(xco+20),0,60,YIC, &(G.scene->r.cfra), 1.0, MAXFRAMEF, 0, 0, "Displays Current Frame of animation. Click to change.");
 
704
        uiDefButI(block, NUM, B_NEWFRAME, "",   (xco+20),0,60,YIC, &(G.scene->r.cfra), 1.0, MAXFRAMEF, 0, 0, "Displays Current Frame of animation. Click to change.");
657
705
        xco+= 80;
658
706
 
659
707
        buttons_active_id(&id, &idfrom);