~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to source/blender/editors/space_time/time_ops.c

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
#include "time_intern.h"
48
48
 
49
49
/* ****************** Start/End Frame Operators *******************************/
50
 
static int time_set_sfra_exec (bContext *C, wmOperator *UNUSED(op))
 
50
static int time_set_sfra_exec(bContext *C, wmOperator *UNUSED(op))
51
51
{
52
 
        Scene *scene= CTX_data_scene(C);
 
52
        Scene *scene = CTX_data_scene(C);
53
53
        int frame;
54
54
 
55
55
        if (scene == NULL)
56
56
                return OPERATOR_CANCELLED;
57
57
 
58
 
        frame= CFRA;
 
58
        frame = CFRA;
59
59
 
60
60
        /* if Preview Range is defined, set the 'start' frame for that */
61
61
        if (PRVRANGEON)
62
 
                scene->r.psfra= frame;
 
62
                scene->r.psfra = frame;
63
63
        else
64
 
                scene->r.sfra= frame;
 
64
                scene->r.sfra = frame;
65
65
        
66
66
        if (PEFRA < frame) {
67
67
                if (PRVRANGEON)
68
 
                        scene->r.pefra= frame;
 
68
                        scene->r.pefra = frame;
69
69
                else
70
 
                        scene->r.efra= frame;
 
70
                        scene->r.efra = frame;
71
71
        }
72
72
        
73
 
        WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
 
73
        WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
74
74
        
75
75
        return OPERATOR_FINISHED;
76
76
}
77
77
 
78
 
static void TIME_OT_start_frame_set (wmOperatorType *ot)
 
78
static void TIME_OT_start_frame_set(wmOperatorType *ot)
79
79
{
80
80
        /* identifiers */
81
81
        ot->name = "Set Start Frame";
87
87
        ot->poll = ED_operator_timeline_active;
88
88
        
89
89
        /* flags */
90
 
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
90
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
91
91
}       
92
92
 
93
93
 
94
 
static int time_set_efra_exec (bContext *C, wmOperator *UNUSED(op))
 
94
static int time_set_efra_exec(bContext *C, wmOperator *UNUSED(op))
95
95
{
96
 
        Scene *scene= CTX_data_scene(C);
 
96
        Scene *scene = CTX_data_scene(C);
97
97
        int frame;
98
98
 
99
99
        if (scene == NULL)
100
100
                return OPERATOR_CANCELLED;
101
101
 
102
 
        frame= CFRA;
 
102
        frame = CFRA;
103
103
 
104
104
        /* if Preview Range is defined, set the 'end' frame for that */
105
105
        if (PRVRANGEON)
106
 
                scene->r.pefra= frame;
 
106
                scene->r.pefra = frame;
107
107
        else
108
 
                scene->r.efra= frame;
 
108
                scene->r.efra = frame;
109
109
 
110
110
        if (PSFRA > frame) {
111
111
                if (PRVRANGEON)
112
 
                        scene->r.psfra= frame;
 
112
                        scene->r.psfra = frame;
113
113
                else
114
 
                        scene->r.sfra= frame;
 
114
                        scene->r.sfra = frame;
115
115
        }
116
116
        
117
 
        WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
 
117
        WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
118
118
        
119
119
        return OPERATOR_FINISHED;
120
120
}
121
121
 
122
 
static void TIME_OT_end_frame_set (wmOperatorType *ot)
 
122
static void TIME_OT_end_frame_set(wmOperatorType *ot)
123
123
{
124
124
        /* identifiers */
125
125
        ot->name = "Set End Frame";
131
131
        ot->poll = ED_operator_timeline_active;
132
132
        
133
133
        /* flags */
134
 
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
134
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
135
135
}
136
136
 
137
137
/* ************************ View All Operator *******************************/
138
138
 
139
 
static int time_view_all_exec (bContext *C, wmOperator *UNUSED(op))
 
139
static int time_view_all_exec(bContext *C, wmOperator *UNUSED(op))
140
140
{
141
 
        Scene *scene= CTX_data_scene(C);
142
 
        ARegion *ar= CTX_wm_region(C);
143
 
        View2D *v2d= (ar) ? &ar->v2d : NULL;
 
141
        Scene *scene = CTX_data_scene(C);
 
142
        ARegion *ar = CTX_wm_region(C);
 
143
        View2D *v2d = (ar) ? &ar->v2d : NULL;
144
144
        float extra;
145
145
        
146
146
        if (ELEM(NULL, scene, ar))
151
151
        v2d->cur.xmax = (float)PEFRA;
152
152
        
153
153
        /* we need an extra "buffer" factor on either side so that the endpoints are visible */
154
 
        extra= 0.01f * (v2d->cur.xmax - v2d->cur.xmin);
 
154
        extra = 0.01f * BLI_rctf_size_x(&v2d->cur);
155
155
        v2d->cur.xmin -= extra;
156
156
        v2d->cur.xmax += extra;
157
157
        
161
161
        return OPERATOR_FINISHED;
162
162
}
163
163
 
164
 
static void TIME_OT_view_all (wmOperatorType *ot)
 
164
static void TIME_OT_view_all(wmOperatorType *ot)
165
165
{
166
166
        /* identifiers */
167
167
        ot->name = "View All";
173
173
        ot->poll = ED_operator_timeline_active;
174
174
        
175
175
        /* flags */
176
 
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
176
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
177
177
}
178
178
 
179
179
/* ************************** registration **********************************/