Merging r39312 through r39329 from trunk into soc-2011-tomato
authorSergey Sharybin <sergey.vfx@gmail.com>
Fri, 12 Aug 2011 14:39:04 +0000 (14:39 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Fri, 12 Aug 2011 14:39:04 +0000 (14:39 +0000)
13 files changed:
1  2 
release/scripts/startup/bl_operators/presets.py
release/scripts/startup/bl_ui/properties_data_camera.py
release/scripts/startup/bl_ui/properties_object_constraint.py
release/scripts/startup/bl_ui/properties_scene.py
release/scripts/startup/bl_ui/space_sequencer.py
release/scripts/startup/bl_ui/space_time.py
release/scripts/startup/bl_ui/space_userpref_keymap.py
release/scripts/startup/bl_ui/space_view3d.py
source/blender/editors/space_sequencer/sequencer_edit.c
source/blender/editors/space_sequencer/sequencer_intern.h
source/blender/editors/space_sequencer/sequencer_ops.c
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/intern/wm_operators.c

@@@ -194,24 -195,7 +195,24 @@@ class AddPresetRender(AddPresetBase, Op
      preset_subdir = "render"
  
  
- class AddPresetSSS(AddPresetBase, bpy.types.Operator):
 +class AddPresetCamera(AddPresetBase, bpy.types.Operator):
 +    '''Add a Camera Preset'''
 +    bl_idname = "camera.preset_add"
 +    bl_label = "Add Camera Preset"
 +    preset_menu = "CAMERA_MT_presets"
 +
 +    preset_defines = [
 +        "cam = bpy.context.object.data"
 +    ]
 +
 +    preset_values = [
 +        "cam.sensor_width"
 +    ]
 +
 +    preset_subdir = "camera"
 +
 +
+ class AddPresetSSS(AddPresetBase, Operator):
      '''Add a Subsurface Scattering Preset'''
      bl_idname = "material.sss_preset_add"
      bl_label = "Add SSS Preset"
@@@ -316,48 -300,7 +317,48 @@@ class AddPresetInteraction(AddPresetBas
      preset_subdir = "interaction"
  
  
- class AddPresetKeyconfig(AddPresetBase, bpy.types.Operator):
 +class AddPresetTrackingCamera(AddPresetBase, bpy.types.Operator):
 +    '''Add a Tracking Camera Intrinsics  Preset'''
 +    bl_idname = "clip.camera_preset_add"
 +    bl_label = "Add Camera Preset"
 +    preset_menu = "CLIP_MT_camera_presets"
 +
 +    preset_defines = [
 +        "camera = bpy.context.edit_movieclip.tracking.camera"
 +    ]
 +
 +    preset_values = [
 +        "camera.sensor_width",
 +        "camera.units",
 +        "camera.focal_length",
 +        "camera.pixel_aspect",
 +        "camera.k1",
 +        "camera.k2",
 +        "camera.k3"
 +    ]
 +
 +    preset_subdir = "tracking_camera"
 +
 +
 +class AddPresetTrackingTrackColor(AddPresetBase, bpy.types.Operator):
 +    '''Add a Clip Track Color Preset'''
 +    bl_idname = "clip.track_color_preset_add"
 +    bl_label = "Add Track Color Preset"
 +    preset_menu = "CLIP_MT_track_color_presets"
 +
 +    preset_defines = [
 +        "track = bpy.context.edit_movieclip.tracking.active_track"
 +    ]
 +
 +    preset_values = [
 +        "track.color",
 +        "track.use_custom_color"
 +    ]
 +
 +    preset_subdir = "tracking_track_color"
 +
 +
+ class AddPresetKeyconfig(AddPresetBase, Operator):
      '''Add a Keyconfig Preset'''
      bl_idname = "wm.keyconfig_preset_add"
      bl_label = "Add Keyconfig Preset"
@@@ -32,15 -33,7 +33,15 @@@ class CameraButtonsPanel()
          return context.camera and (engine in cls.COMPAT_ENGINES)
  
  
- class DATA_PT_context_camera(CameraButtonsPanel, bpy.types.Panel):
 +class CAMERA_MT_presets(bpy.types.Menu):
 +    bl_label = "Camera Presets"
 +    preset_subdir = "camera"
 +    preset_operator = "script.execute_preset"
 +    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 +    draw = bpy.types.Menu.draw_preset
 +
 +
+ class DATA_PT_context_camera(CameraButtonsPanel, Panel):
      bl_label = ""
      bl_options = {'HIDE_HEADER'}
      COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@@ -112,31 -95,24 +113,31 @@@ class DATA_PT_lens(CameraButtonsPanel, 
          col.prop(cam, "shift_x", text="X")
          col.prop(cam, "shift_y", text="Y")
  
 -        col = split.column(align=True)
 -        col.label(text="Clipping:")
 -        col.prop(cam, "clip_start", text="Start")
 -        col.prop(cam, "clip_end", text="End")
  
- class DATA_PT_camera(CameraButtonsPanel, bpy.types.Panel):
 -        layout.label(text="Depth of Field:")
++class DATA_PT_camera(CameraButtonsPanel, Panel):
 +    bl_label = "Camera"
 +    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 +
 +    def draw(self, context):
 +        layout = self.layout
  
 -        split = layout.split()
 -        split.prop(cam, "dof_object", text="")
 +        cam = context.camera
  
 -        col = split.column()
 +        row = layout.row(align=True)
  
 -        if cam.dof_object != None:
 -            col.enabled = False
 -        col.prop(cam, "dof_distance", text="Distance")
 +        row.menu("CAMERA_MT_presets", text=bpy.types.CAMERA_MT_presets.bl_label)
 +        row.operator("camera.preset_add", text="", icon="ZOOMIN")
 +        row.operator("camera.preset_add", text="", icon="ZOOMOUT").remove_active = True
 +
 +        layout.prop(cam, "sensor_width")
 +
 +        layout.label(text="Clipping:")
 +        row = layout.row(align=True)
 +        row.prop(cam, "clip_start", text="Start")
 +        row.prop(cam, "clip_end", text="End")
  
  
- class DATA_PT_camera_display(CameraButtonsPanel, bpy.types.Panel):
+ class DATA_PT_camera_display(CameraButtonsPanel, Panel):
      bl_label = "Display"
      COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
  
@@@ -190,17 -191,7 +191,17 @@@ class SCENE_PT_simplify(SceneButtonsPan
          col.prop(rd, "simplify_ao_sss", text="AO and SSS")
  
  
- class SCENE_PT_custom_props(SceneButtonsPanel, PropertyPanel, bpy.types.Panel):
 +class SCENE_PT_movie_clip(SceneButtonsPanel, bpy.types.Panel):
 +    bl_label = "Movie Clip"
 +
 +    def draw(self, context):
 +        layout = self.layout
 +        scene = context.scene
 +
 +        layout.prop(scene, "clip")
 +
 +
+ class SCENE_PT_custom_props(SceneButtonsPanel, PropertyPanel, Panel):
      COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
      _context_path = "scene"
      _property_type = bpy.types.Scene
@@@ -734,8 -747,8 +749,8 @@@ class SEQUENCER_PT_filter(SequencerButt
              col.prop(strip.color_balance, "invert_gain", text="Inverse")
  
  
- class SEQUENCER_PT_proxy(SequencerButtonsPanel, bpy.types.Panel):
+ class SEQUENCER_PT_proxy(SequencerButtonsPanel, Panel):
 -    bl_label = "Proxy"
 +    bl_label = "Proxy / Timecode"
  
      @classmethod
      def poll(cls, context):
              if strip.use_proxy_custom_file:
                  flow.prop(strip.proxy, "filepath")
  
 +            row = layout.row()
 +            row.label(text="Build Sizes:")
 +            row.prop(strip.proxy, "build_25")
 +            row.prop(strip.proxy, "build_50")
 +            row.prop(strip.proxy, "build_75")
 +
 +            col = layout.column()
 +            col.label(text="Build JPEG quality")
 +            col.prop(strip.proxy, "quality")
 +
 +            if strip.type == "MOVIE":
 +                col = layout.column()
 +                col.label(text="Use timecode index:")
 +
 +                col.prop(strip.proxy, "timecode")
 +
  
- class SEQUENCER_PT_preview(SequencerButtonsPanel_Output, bpy.types.Panel):
+ class SEQUENCER_PT_preview(SequencerButtonsPanel_Output, Panel):
      bl_label = "Scene Preview/Render"
      bl_space_type = 'SEQUENCE_EDITOR'
      bl_region_type = 'UI'
@@@ -2937,34 -2645,223 +2751,255 @@@ void SEQUENCER_OT_view_ghost_border(wmO
        WM_operator_properties_gesture_border(ot, FALSE);
  }
  
 +/* rebuild_proxy operator */
 +static int sequencer_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op))
 +{
 +      Scene *scene = CTX_data_scene(C);
 +      Editing *ed = seq_give_editing(scene, FALSE);
 +      Sequence * seq;
 +
 +      SEQP_BEGIN(ed, seq) {
 +              if ((seq->flag & SELECT)) {
 +                      seq_proxy_build_job(C, seq);
 +              }
 +      }
 +      SEQ_END
 +              
 +      return OPERATOR_FINISHED;
 +}
 +
 +void SEQUENCER_OT_rebuild_proxy(wmOperatorType *ot)
 +{
 +      /* identifiers */
 +      ot->name= "Rebuild Proxy and Timecode Indices";
 +      ot->idname= "SEQUENCER_OT_rebuild_proxy";
 +      ot->description="Rebuild all selected proxies and timecode indeces using the job system";
 +      
 +      /* api callbacks */
 +      ot->exec= sequencer_rebuild_proxy_exec;
 +      ot->poll= ED_operator_sequencer_active;
 +      
 +      /* flags */
 +      ot->flag= OPTYPE_REGISTER;
 +}
++
+ /* change ops */
+ static EnumPropertyItem prop_change_effect_input_types[] = {
+       {0, "A_B", 0, "A -> B", ""},
+       {1, "B_C", 0, "B -> C", ""},
+       {2, "A_C", 0, "A -> C", ""},
+       {0, NULL, 0, NULL, NULL}
+ };
+ static int sequencer_change_effect_input_exec(bContext *C, wmOperator *op)
+ {
+       Scene *scene= CTX_data_scene(C);
+       Editing *ed= seq_give_editing(scene, FALSE);
+       Sequence *seq= seq_active_get(scene);
+       Sequence **seq_1, **seq_2;
+       switch(RNA_enum_get(op->ptr, "swap")) {
+               case 0:
+                       seq_1= &seq->seq1;
+                       seq_2= &seq->seq2;
+                       break;
+               case 1:
+                       seq_1= &seq->seq2;
+                       seq_2= &seq->seq3;
+                       break;
+               default: /* 2 */
+                       seq_1= &seq->seq1;
+                       seq_2= &seq->seq3;
+                       break;
+       }
+       if(*seq_1 == NULL || *seq_2 == NULL) {
+               BKE_report(op->reports, RPT_ERROR, "One of the effect inputs is unset, can't swap");
+               return OPERATOR_CANCELLED;
+       }
+       else {
+               SWAP(Sequence *, *seq_1, *seq_2);
+       }
+       update_changed_seq_and_deps(scene, seq, 0, 1);
+       /* important else we dont get the imbuf cache flushed */
+       free_imbuf_seq(scene, &ed->seqbase, FALSE, FALSE);
+       WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+       return OPERATOR_FINISHED;
+ }
+ void SEQUENCER_OT_change_effect_input(struct wmOperatorType *ot)
+ {
+       /* identifiers */
+       ot->name= "Change Effect Input";
+       ot->idname= "SEQUENCER_OT_change_effect_input";
+       ot->description="";
+       /* api callbacks */
+       ot->exec= sequencer_change_effect_input_exec;
+       ot->poll= sequencer_effect_poll;
+       /* flags */
+       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->prop= RNA_def_enum(ot->srna, "swap", prop_change_effect_input_types, 0, "Swap", "The effect inputs to swap");
+ }
+ static int sequencer_change_effect_type_exec(bContext *C, wmOperator *op)
+ {
+       Scene *scene= CTX_data_scene(C);
+       Editing *ed= seq_give_editing(scene, FALSE);
+       Sequence *seq= seq_active_get(scene);
+       const int new_type= RNA_enum_get(op->ptr, "type");
+       /* free previous effect and init new effect */
+       struct SeqEffectHandle sh;
+       if ((seq->type & SEQ_EFFECT) == 0) {
+               return OPERATOR_CANCELLED;
+       }
+       /* can someone explain the logic behind only allowing to increse this,
+        * copied from 2.4x - campbell */
+       if (get_sequence_effect_num_inputs(seq->type) <
+               get_sequence_effect_num_inputs(new_type)
+       ) {
+               BKE_report(op->reports, RPT_ERROR, "New effect needs more input strips");
+               return OPERATOR_CANCELLED;
+       }
+       else {
+               sh = get_sequence_effect(seq);
+               sh.free(seq);
+               seq->type= new_type;
+               sh = get_sequence_effect(seq);
+               sh.init(seq);
+       }
+       /* update */
+       update_changed_seq_and_deps(scene, seq, 0, 1);
+       /* important else we dont get the imbuf cache flushed */
+       free_imbuf_seq(scene, &ed->seqbase, FALSE, FALSE);
+       WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+       return OPERATOR_FINISHED;
+ }
+ void SEQUENCER_OT_change_effect_type(struct wmOperatorType *ot)
+ {
+       /* identifiers */
+       ot->name= "Change Effect Type";
+       ot->idname= "SEQUENCER_OT_change_effect_type";
+       ot->description="";
+       /* api callbacks */
+       ot->exec= sequencer_change_effect_type_exec;
+       ot->poll= sequencer_effect_poll;
+       /* flags */
+       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->prop= RNA_def_enum(ot->srna, "type", sequencer_prop_effect_types, SEQ_CROSS, "Type", "Sequencer effect type");
+ }
+ static int sequencer_change_path_exec(bContext *C, wmOperator *op)
+ {
+       Scene *scene= CTX_data_scene(C);
+       Editing *ed= seq_give_editing(scene, FALSE);
+       Sequence *seq= seq_active_get(scene);
+       if(seq->type == SEQ_IMAGE) {
+               char directory[FILE_MAX];
+               const int len= RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files"));
+               StripElem *se;
+               if(len==0)
+                       return OPERATOR_CANCELLED;
+               RNA_string_get(op->ptr, "directory", directory);
+               BLI_strncpy(seq->strip->dir, directory, sizeof(seq->strip->dir));
+               if(seq->strip->stripdata) {
+                       MEM_freeN(seq->strip->stripdata);
+               }
+               seq->strip->stripdata= se= MEM_callocN(len*sizeof(StripElem), "stripelem");
+               RNA_BEGIN(op->ptr, itemptr, "files") {
+                       char *filename= RNA_string_get_alloc(&itemptr, "name", NULL, 0);
+                       BLI_strncpy(se->name, filename, sizeof(se->name));
+                       MEM_freeN(filename);
+                       se++;
+               }
+               RNA_END;
+               /* correct start/end frames so we dont move
+                * important not to set seq->len= len; allow the function to handle it */
+               reload_sequence_new_file(scene, seq, TRUE);
+               calc_sequence(scene, seq);
+               /* important else we dont get the imbuf cache flushed */
+               free_imbuf_seq(scene, &ed->seqbase, FALSE, FALSE);
+       }
+       else {
+               /* lame, set rna filepath */
+               PointerRNA seq_ptr;
+               char filepath[FILE_MAX];
+               RNA_pointer_create(&scene->id, &RNA_Sequence, seq, &seq_ptr);
+               RNA_string_get(op->ptr, "filepath", filepath);
+               RNA_string_set(&seq_ptr, "filepath", filepath);
+       }
+       WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+       return OPERATOR_FINISHED;
+ }
+ static int sequencer_change_path_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+ {
+       Scene *scene= CTX_data_scene(C);
+       Sequence *seq= seq_active_get(scene);
+       RNA_string_set(op->ptr, "directory", seq->strip->dir);
+       /* set default display depending on seq type */
+       if(seq->type == SEQ_IMAGE) {
+               RNA_boolean_set(op->ptr, "filter_movie", 0);
+       }
+       else {
+               RNA_boolean_set(op->ptr, "filter_image", 0);
+       }
+       WM_event_add_fileselect(C, op);
+       return OPERATOR_RUNNING_MODAL;
+ }
+ void SEQUENCER_OT_change_path(struct wmOperatorType *ot)
+ {
+       /* identifiers */
+       ot->name= "Change Data/Files";
+       ot->idname= "SEQUENCER_OT_change_path";
+       ot->description="";
+       /* api callbacks */
+       ot->exec= sequencer_change_path_exec;
+       ot->invoke= sequencer_change_path_invoke;
+       ot->poll= sequencer_strip_has_path_poll;
+       /* flags */
+       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+       WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY|WM_FILESEL_RELPATH|WM_FILESEL_FILEPATH|WM_FILESEL_FILES);
+ }
@@@ -86,8 -86,10 +86,12 @@@ void sequencer_operatortypes(void
        WM_operatortype_append(SEQUENCER_OT_view_zoom_ratio);
        WM_operatortype_append(SEQUENCER_OT_view_ghost_border);
  
 +      WM_operatortype_append(SEQUENCER_OT_rebuild_proxy);
 +
+       WM_operatortype_append(SEQUENCER_OT_change_effect_input);
+       WM_operatortype_append(SEQUENCER_OT_change_effect_type);
+       WM_operatortype_append(SEQUENCER_OT_change_path);
        /* sequencer_select.c */
        WM_operatortype_append(SEQUENCER_OT_select_all_toggle);
        WM_operatortype_append(SEQUENCER_OT_select_inverse);
Simple merge