~ubuntu-branches/ubuntu/intrepid/blender/intrepid-updates

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Cyril Brulebois
  • Date: 2008-08-08 02:45:40 UTC
  • mfrom: (12.1.14 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080808024540-kkjp7ekfivzhuw3l
Tags: 2.46+dfsg-4
* Fix python syntax warning in import_dxf.py, which led to nasty output
  in installation/upgrade logs during byte-compilation, using a patch
  provided by the script author (Closes: #492280):
   - debian/patches/45_fix_python_syntax_warning

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
 
 * $Id: drawscript.c,v 1.9 2006/07/07 18:39:51 ianwill Exp $
 
2
 * $Id: drawscript.c 14444 2008-04-16 22:40:48Z hos $
3
3
 *
4
 
 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
 
4
 * ***** BEGIN GPL LICENSE BLOCK *****
5
5
 *
6
6
 * This program is free software; you can redistribute it and/or
7
7
 * modify it under the terms of the GNU General Public License
8
8
 * as published by the Free Software Foundation; either version 2
9
 
 * of the License, or (at your option) any later version. The Blender
10
 
 * Foundation also sells licenses for use in proprietary software under
11
 
 * the Blender License.  See http://www.blender.org/BL/ for information
12
 
 * about this.
 
9
 * of the License, or (at your option) any later version.
13
10
 *
14
11
 * This program is distributed in the hope that it will be useful,
15
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27
24
 *
28
25
 * Contributor(s): Willian Padovani Germano.
29
26
 *
30
 
 * ***** END GPL/BL DUAL LICENSE BLOCK *****
 
27
 * ***** END GPL LICENSE BLOCK *****
31
28
 */
32
29
 
33
30
#include <stdlib.h>
58
55
#include "BKE_global.h"
59
56
#include "BKE_main.h"
60
57
 
61
 
#include "BPI_script.h"
62
58
#include "BPY_extern.h"
63
59
 
64
60
#include "BIF_gl.h"
95
91
 
96
92
        script = sc->script;
97
93
 
98
 
        if (script->py_draw) {
99
 
                BPY_spacescript_do_pywin_draw(sc);
100
 
        }
101
 
        /* quick hack for 2.37a for scripts that call the progress bar inside a
102
 
         * file selector callback, to show previous space after finishing, w/o
103
 
         * needing an event */
104
 
        else if (!script->flags && !script->py_event && !script->py_button)
105
 
                addqueue(curarea->win, MOUSEX, 0); 
 
94
        /* Is this script loaded from a file and it needs running??? */
 
95
        if (    (G.f & G_DOSCRIPTLINKS) &&
 
96
                                script->scriptname[0] != '\0' &&
 
97
                                (script->flags == 0 &&
 
98
                                script->py_event == NULL &&
 
99
                                script->py_button == NULL &&
 
100
                                script->py_draw ==      NULL )
 
101
                ) {
 
102
                if (!BPY_run_script(script)) {
 
103
                        /* if this fails, script will be free'd */
 
104
                        script = NULL;
 
105
                }
 
106
        }
 
107
        
 
108
        if (script) {
 
109
                if (script->py_draw) {
 
110
                        BPY_spacescript_do_pywin_draw(sc);
 
111
                } else if (!script->flags && !script->py_event && !script->py_button) {
 
112
                        /* quick hack for 2.37a for scripts that call the progress bar inside a
 
113
                         * file selector callback, to show previous space after finishing, w/o
 
114
                         * needing an event */
 
115
                        addqueue(curarea->win, MOUSEX, 0);
 
116
                }
 
117
        }
106
118
}
107
119
 
108
120
void winqreadscriptspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt)
114
126
        Script *script = sc->script;
115
127
 
116
128
        if (script) {
 
129
                /* Is this script loaded from a file and it needs running??? */
 
130
                if (    (G.f & G_DOSCRIPTLINKS) &&
 
131
                                 script->scriptname[0] != '\0' &&
 
132
                                        (script->flags == 0 &&
 
133
                                 script->py_event == NULL &&
 
134
                                 script->py_button == NULL &&
 
135
                                 script->py_draw ==     NULL )
 
136
                   ) {
 
137
                        if (!BPY_run_script(script)) {
 
138
                                /* if this fails, script will be free'd */
 
139
                                script = NULL;
 
140
                        }
 
141
                }
 
142
        }
 
143
        
 
144
        if (script) {
117
145
                if (script->py_event || script->py_button)
118
146
                        BPY_spacescript_do_pywin_event(sc, event, val, ascii);
119
147
 
133
161
        }
134
162
        else {
135
163
                if (event == QKEY)
136
 
                        if (val && okee("Quit Blender")) exit_usiblender();
 
164
                        if (val && (G.qual & LR_CTRLKEY) && okee("Quit Blender")) exit_usiblender();
137
165
        }
138
166
 
139
167
        return;
142
170
void free_scriptspace (SpaceScript *sc)
143
171
{
144
172
        if (!sc) return;
145
 
 
 
173
        
 
174
        /*free buttons references*/
 
175
        if (sc->but_refs) {
 
176
                BPy_Set_DrawButtonsList(sc->but_refs);
 
177
                BPy_Free_DrawButtonsList();
 
178
                sc->but_refs = NULL;
 
179
        }
146
180
        sc->script = NULL;
147
181
}