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

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2005-11-06 12:40:03 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051106124003-3pgs7tcg5rox96xg
Tags: 2.37a-1.1
* Non-maintainer upload.
* Split out parts of 01_SConstruct_debian.dpatch again: root_build_dir
  really needs to get adjusted before the clean target runs - closes: #333958,
  see #288882 for reference

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
 
 * $Id: editlattice.c,v 1.6 2004/03/20 22:06:00 zuster Exp $
 
2
 * $Id: editlattice.c,v 1.11 2005/03/19 21:08:12 zuster Exp $
3
3
 *
4
4
 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
5
5
 *
32
32
 */
33
33
 
34
34
#include <stdlib.h>
 
35
#include <string.h>
35
36
#include <math.h>
36
37
 
37
38
#ifdef HAVE_CONFIG_H
38
39
#include <config.h>
39
40
#endif
40
41
 
41
 
#ifdef WIN32
42
 
#include "BLI_winstuff.h"
43
 
#endif
44
42
#include "MEM_guardedalloc.h"
45
43
 
46
44
#include "BLI_blenlib.h"
57
55
#include "BKE_displist.h"
58
56
#include "BKE_lattice.h"
59
57
#include "BKE_global.h"
 
58
#include "BKE_utildefines.h"
60
59
 
61
 
#include "BIF_toolbox.h"
62
60
#include "BIF_space.h"
63
61
#include "BIF_screen.h"
64
62
#include "BIF_editlattice.h"
 
63
#include "BIF_editmode_undo.h"
65
64
#include "BIF_editkey.h"
 
65
#include "BIF_toolbox.h"
66
66
 
67
67
#include "BSE_edit.h"
68
68
 
72
72
#include "blendef.h"
73
73
#include "mydevice.h"
74
74
 
75
 
#include "render.h"
76
 
 
77
75
#include "BKE_armature.h"
78
76
 
79
 
void apply_lattice(void)
80
 
{
81
 
        Base *base;
82
 
        Object *par;
83
 
        
84
 
        if(okee("Apply Lattice Deform")==0) return;
85
 
        
86
 
        base= FIRSTBASE;
87
 
        while(base) {
88
 
                if TESTBASELIB(base) {
89
 
                        if( (par= base->object->parent) ) {
90
 
                                if(par->type==OB_LATTICE) {
91
 
                                        object_apply_deform(base->object);
92
 
                                        
93
 
                                        base->object->parent= 0;
94
 
                                }
95
 
                        }
96
 
                }
97
 
                base= base->next;
98
 
        }
99
 
        
100
 
        allqueue(REDRAWVIEW3D, 0);
101
 
}
102
 
 
103
77
/* ***************************** */
104
78
 
105
 
 
106
 
 
107
 
 
108
79
void free_editLatt(void)
109
80
{
110
81
        if(editLatt) {
157
128
        }
158
129
 
159
130
        editLatt= MEM_dupallocN(lt);
160
 
        
161
131
        editLatt->def= MEM_dupallocN(lt->def);
162
132
        
163
133
        setflagsLatt(0);
 
134
        BIF_undo_push("original");
164
135
}
165
136
 
166
137
 
221
192
 
222
193
void remake_editLatt(void)
223
194
{
224
 
        if(okee("Reload Original data")==0) return;
 
195
        if(okee("Reload original data")==0) return;
225
196
        
226
197
        make_editLatt();
227
198
        allqueue(REDRAWVIEW3D, 0);
228
199
        allqueue(REDRAWBUTSEDIT, 0);
 
200
 
 
201
        BIF_undo_push("Reload original");
229
202
}
230
203
 
231
204
 
244
217
                if(bp->hide==0) {
245
218
                        if(bp->f1) {
246
219
                                setflagsLatt(0);
 
220
                                BIF_undo_push("(De)select all");
247
221
                                return;
248
222
                        }
249
223
                }
250
224
                bp++;
251
225
        }
252
226
        setflagsLatt(1);
 
227
 
 
228
        BIF_undo_push("(De)select all");
253
229
}
254
230
 
255
231
 
312
288
                }
313
289
 
314
290
                countall();
 
291
                BIF_undo_push("Select");
315
292
        }
316
293
 
317
294
        rightmouse_transform();
318
295
        
319
296
}
 
297
 
 
298
 
 
299
/* **************** undo for lattice object ************** */
 
300
 
 
301
static void undoLatt_to_editLatt(void *defv)
 
302
{
 
303
        Base *base;
 
304
        int a= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw;
 
305
 
 
306
        memcpy(editLatt->def, defv, a*sizeof(BPoint));
 
307
        
 
308
        base= FIRSTBASE;
 
309
        while(base) {
 
310
                if(base->lay & G.vd->lay) {
 
311
                        if(base->object->parent==G.obedit) {
 
312
                                makeDispList(base->object);
 
313
                        }
 
314
                }
 
315
                base= base->next;
 
316
        }
 
317
        allqueue(REDRAWVIEW3D, 0);
 
318
}
 
319
 
 
320
static void *editLatt_to_undoLatt(void)
 
321
{
 
322
        
 
323
        return MEM_dupallocN(editLatt->def);
 
324
}
 
325
 
 
326
static void free_undoLatt(void *defv)
 
327
{
 
328
        MEM_freeN(defv);
 
329
}
 
330
 
 
331
/* and this is all the undo system needs to know */
 
332
void undo_push_lattice(char *name)
 
333
{
 
334
        undo_editmode_push(name, free_undoLatt, undoLatt_to_editLatt, editLatt_to_undoLatt);
 
335
}
 
336
 
 
337
 
 
338
 
 
339
/***/