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

« back to all changes in this revision

Viewing changes to source/blender/src/drawscript.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: drawscript.c,v 1.3 2004/01/21 04:42:13 ianwill Exp $
 
2
 * $Id: drawscript.c,v 1.8 2005/06/11 05:30:14 ianwill Exp $
3
3
 *
4
4
 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
5
5
 *
41
41
#include <unistd.h>
42
42
#else
43
43
#include <io.h>
44
 
#include "BLI_winstuff.h"
45
44
#endif   
46
45
#include "MEM_guardedalloc.h"
47
46
#include "PIL_time.h"
86
85
void drawscriptspace(ScrArea *sa, void *spacedata)
87
86
{
88
87
        SpaceScript *sc = curarea->spacedata.first;
 
88
        Script *script = NULL;
89
89
 
90
90
        glClearColor(0.6, 0.6,  0.6, 1.0);
91
91
        glClear(GL_COLOR_BUFFER_BIT);
92
92
        myortho2(-0.5, curarea->winrct.xmax-curarea->winrct.xmin-0.5, -0.5, curarea->winrct.ymax-curarea->winrct.ymin-0.5);
93
93
 
94
 
        if(!sc->script) {
95
 
                if (G.main->script.first)
96
 
                        sc->script = G.main->script.first;
97
 
                else
98
 
                        return;
99
 
        }
100
 
 
101
 
        BPY_spacescript_do_pywin_draw(sc);
 
94
        if (!sc->script) {
 
95
                script = G.main->script.first;
 
96
 
 
97
                while (script) {
 
98
 
 
99
                        if (script->py_draw || script->py_event || script->py_button) {
 
100
                                sc->script = script;
 
101
                                break;
 
102
                        }
 
103
                        else script = script->id.next;
 
104
                }
 
105
        }
 
106
 
 
107
        if (!sc->script) return;
 
108
 
 
109
        script = sc->script;
 
110
 
 
111
        if (script->py_draw) {
 
112
                BPY_spacescript_do_pywin_draw(sc);
 
113
        }
 
114
        /* quick hack for 2.37a for scripts that call the progress bar inside a
 
115
         * file selector callback, to show previous space after finishing, w/o
 
116
         * needing an event */
 
117
        else if (!script->flags && !script->py_event && !script->py_button)
 
118
                addqueue(curarea->win, MOUSEX, 0); 
102
119
}
103
120
 
104
121
void winqreadscriptspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt)
105
122
{
106
123
        unsigned short event = evt->event;
107
124
        short val = evt->val;
 
125
        char ascii = evt->ascii;
108
126
        SpaceScript *sc = curarea->spacedata.first;
109
127
        Script *script = sc->script;
110
128
 
111
129
        if (script) {
112
 
                BPY_spacescript_do_pywin_event(sc, event, val);
 
130
                if (script->py_event || script->py_button)
 
131
                        BPY_spacescript_do_pywin_event(sc, event, val, ascii);
 
132
 
 
133
                /* for file/image sel scripts: if user leaves file/image selection space,
 
134
                 * this frees the script (since it can't be accessed anymore): */
 
135
                else if (script->flags == SCRIPT_FILESEL) {
 
136
                        script->flags = 0;
 
137
                        script->lastspace = SPACE_SCRIPT;
 
138
                }
113
139
 
114
140
                if (!script->flags) {/* finished with this script, let's free it */
115
141
                        if (script->lastspace != SPACE_SCRIPT)
120
146
        }
121
147
        else {
122
148
                if (event == QKEY)
123
 
                        if (val && okee("QUIT BLENDER")) exit_usiblender();
 
149
                        if (val && okee("Quit Blender")) exit_usiblender();
124
150
        }
125
151
 
126
152
        return;