77
91
/* frees all editmode stuff */
78
92
void ED_editors_exit(bContext *C)
94
Main *bmain = CTX_data_main(C);
82
100
/* frees all editmode undos */
83
101
undo_editmode_clear();
84
102
ED_undo_paint_free();
86
for(sce=G.main->scene.first; sce; sce= sce->id.next) {
88
Object *ob= sce->obedit;
104
for (sce = bmain->scene.first; sce; sce = sce->id.next) {
106
Object *ob = sce->obedit;
90
/* global in meshtools... */
91
mesh_octree_table(NULL, NULL, NULL, 'e');
92
mesh_mirrtopo_table(NULL, 'e');
95
if(ob->type==OB_MESH) {
98
free_editMesh(me->edit_mesh);
99
MEM_freeN(me->edit_mesh);
109
if (ob->type == OB_MESH) {
111
if (me->edit_btmesh) {
112
EDBM_mesh_free(me->edit_btmesh);
113
MEM_freeN(me->edit_btmesh);
114
me->edit_btmesh = NULL;
103
else if(ob->type==OB_ARMATURE) {
117
else if (ob->type == OB_ARMATURE) {
104
118
ED_armature_edit_free(ob);
106
else if(ob->type==OB_FONT) {
109
// else if(ob->type==OB_MBALL)
110
// BLI_freelistN(&editelems);
112
// free_posebuf(); // XXX this is still a global...
115
else if(sce->basact && sce->basact->object) {
116
Object *ob= sce->basact->object;
118
/* if weight-painting is on, free mesh octree data */
119
if(ob->mode & OB_MODE_WEIGHT_PAINT) {
120
mesh_octree_table(NULL, NULL, NULL, 'e');
121
mesh_mirrtopo_table(NULL, 'e');
124
/* global in meshtools... */
125
mesh_octree_table(NULL, NULL, NULL, 'e');
126
mesh_mirrtopo_table(NULL, 'e');
134
135
void apply_keyb_grid(int shift, int ctrl, float *val, float fac1, float fac2, float fac3, int invert)
136
137
/* fac1 is for 'nothing', fac2 for CTRL, fac3 for SHIFT */
141
if(fac3!= 0.0) *val= fac3*floor(*val/fac3 +.5);
142
if (fac3 != 0.0f) *val = fac3 * floorf(*val / fac3 + 0.5f);
144
if(fac2!= 0.0) *val= fac2*floor(*val/fac2 +.5);
145
if (fac2 != 0.0f) *val = fac2 * floorf(*val / fac2 + 0.5f);
147
if(fac1!= 0.0) *val= fac1*floor(*val/fac1 +.5);
148
if (fac1 != 0.0f) *val = fac1 * floorf(*val / fac1 + 0.5f);
152
int GetButStringLength(char *str)
153
int GetButStringLength(const char *str)
156
rt= UI_GetStringWidth(str);
157
rt = UI_GetStringWidth(str);
163
void unpack_menu(bContext *C, const char *opname, const char *id_name, const char *abs_name, const char *folder, struct PackedFile *pf)
165
PointerRNA props_ptr;
168
char line[FILE_MAX + 100];
169
wmOperatorType *ot = WM_operatortype_find(opname, 1);
171
pup = uiPupMenuBegin(C, "Unpack file", ICON_NONE);
172
layout = uiPupMenuLayout(pup);
174
strcpy(line, "Remove Pack");
175
props_ptr = uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
176
RNA_enum_set(&props_ptr, "method", PF_REMOVE);
177
RNA_string_set(&props_ptr, "id", id_name);
179
if (G.relbase_valid) {
180
char local_name[FILE_MAXDIR + FILE_MAX], fi[FILE_MAX];
182
BLI_strncpy(local_name, abs_name, sizeof(local_name));
183
BLI_splitdirstring(local_name, fi);
184
BLI_snprintf(local_name, sizeof(local_name), "//%s/%s", folder, fi);
185
if (strcmp(abs_name, local_name) != 0) {
186
switch (checkPackedFile(local_name, pf)) {
188
BLI_snprintf(line, sizeof(line), "Create %s", local_name);
189
props_ptr = uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
190
RNA_enum_set(&props_ptr, "method", PF_WRITE_LOCAL);
191
RNA_string_set(&props_ptr, "id", id_name);
195
BLI_snprintf(line, sizeof(line), "Use %s (identical)", local_name);
196
//uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_USE_LOCAL);
197
props_ptr = uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
198
RNA_enum_set(&props_ptr, "method", PF_USE_LOCAL);
199
RNA_string_set(&props_ptr, "id", id_name);
203
BLI_snprintf(line, sizeof(line), "Use %s (differs)", local_name);
204
//uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_USE_LOCAL);
205
props_ptr = uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
206
RNA_enum_set(&props_ptr, "method", PF_USE_LOCAL);
207
RNA_string_set(&props_ptr, "id", id_name);
209
BLI_snprintf(line, sizeof(line), "Overwrite %s", local_name);
210
//uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_WRITE_LOCAL);
211
props_ptr = uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
212
RNA_enum_set(&props_ptr, "method", PF_WRITE_LOCAL);
213
RNA_string_set(&props_ptr, "id", id_name);
219
switch (checkPackedFile(abs_name, pf)) {
221
BLI_snprintf(line, sizeof(line), "Create %s", abs_name);
222
//uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_WRITE_ORIGINAL);
223
props_ptr = uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
224
RNA_enum_set(&props_ptr, "method", PF_WRITE_ORIGINAL);
225
RNA_string_set(&props_ptr, "id", id_name);
228
BLI_snprintf(line, sizeof(line), "Use %s (identical)", abs_name);
229
//uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_USE_ORIGINAL);
230
props_ptr = uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
231
RNA_enum_set(&props_ptr, "method", PF_USE_ORIGINAL);
232
RNA_string_set(&props_ptr, "id", id_name);
235
BLI_snprintf(line, sizeof(line), "Use %s (differs)", abs_name);
236
//uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_USE_ORIGINAL);
237
props_ptr = uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
238
RNA_enum_set(&props_ptr, "method", PF_USE_ORIGINAL);
239
RNA_string_set(&props_ptr, "id", id_name);
241
BLI_snprintf(line, sizeof(line), "Overwrite %s", abs_name);
242
//uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_WRITE_ORIGINAL);
243
props_ptr = uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
244
RNA_enum_set(&props_ptr, "method", PF_WRITE_ORIGINAL);
245
RNA_string_set(&props_ptr, "id", id_name);
249
uiPupMenuEnd(C, pup);