[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46501] trunk/blender/source/blender: patch [#30871] VSE py-api
Campbell Barton
ideasman42 at gmail.com
Thu May 10 17:10:51 CEST 2012
Revision: 46501
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46501
Author: campbellbarton
Date: 2012-05-10 15:10:51 +0000 (Thu, 10 May 2012)
Log Message:
-----------
patch [#30871] VSE py-api
from Dan Eicher (dna)
--- message from the tracker
Classes for all effect types with proper input attributes
Added new/delete functions for SequenceEditor.sequences.
push/pop functions for ImageSequence.elements to add/remove images
Moved waveform from the base class to SoundSequence (probably should be renamed use_waveform or show_waveform)
Fixed user count for scene and movie clip types
--- my own comments
- dont have blending mode argument from sequencer.new_*() functions. Better edit this after.
- dont change waveform attribute, seems unrelated change and should be kept for sound afaik.
- dont apply scene, clip usercount changes - Sergey dealt with these separately.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/BKE_sound.h
trunk/blender/source/blender/blenkernel/intern/sound.c
trunk/blender/source/blender/makesrna/intern/rna_internal.h
trunk/blender/source/blender/makesrna/intern/rna_scene.c
trunk/blender/source/blender/makesrna/intern/rna_sequencer.c
trunk/blender/source/blender/makesrna/intern/rna_sequencer_api.c
Modified: trunk/blender/source/blender/blenkernel/BKE_sound.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_sound.h 2012-05-10 14:51:18 UTC (rev 46500)
+++ trunk/blender/source/blender/blenkernel/BKE_sound.h 2012-05-10 15:10:51 UTC (rev 46501)
@@ -136,6 +136,8 @@
void sound_update_scene(struct Scene* scene);
-void* sound_get_factory(void* sound);
+void *sound_get_factory(void* sound);
+float sound_get_length(struct bSound *sound);
+
#endif
Modified: trunk/blender/source/blender/blenkernel/intern/sound.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/sound.c 2012-05-10 14:51:18 UTC (rev 46500)
+++ trunk/blender/source/blender/blenkernel/intern/sound.c 2012-05-10 15:10:51 UTC (rev 46501)
@@ -756,6 +756,14 @@
return ((struct bSound *) sound)->playback_handle;
}
+/* stupid wrapper because AUD_C-API.h includes Python.h which makesrna doesn't like */
+float sound_get_length(struct bSound* sound)
+{
+ AUD_SoundInfo info = AUD_getInfo(sound->playback_handle);
+
+ return info.length;
+}
+
#else // WITH_AUDASPACE
#include "BLI_utildefines.h"
@@ -797,5 +805,5 @@
void sound_set_scene_sound_pan(void* handle, float pan, char animated) { (void)handle; (void)pan; (void)animated; }
void sound_set_scene_volume(struct Scene *scene, float volume) { (void)scene; (void)volume; }
void sound_set_scene_sound_pitch(void* handle, float pitch, char animated) { (void)handle; (void)pitch; (void)animated; }
-
+float sound_get_length(struct bSound* sound) { (void)sound; return 0; }
#endif // WITH_AUDASPACE
Modified: trunk/blender/source/blender/makesrna/intern/rna_internal.h
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_internal.h 2012-05-10 14:51:18 UTC (rev 46500)
+++ trunk/blender/source/blender/makesrna/intern/rna_internal.h 2012-05-10 15:10:51 UTC (rev 46501)
@@ -267,6 +267,8 @@
void RNA_api_actuator(struct StructRNA *srna);
void RNA_api_texture(struct StructRNA *srna);
void RNA_api_environment_map(struct StructRNA *srna);
+void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop);
+void RNA_api_sequence_elements(BlenderRNA *brna, PropertyRNA *cprop);
/* main collection functions */
void RNA_def_main_cameras(BlenderRNA *brna, PropertyRNA *cprop);
Modified: trunk/blender/source/blender/makesrna/intern/rna_scene.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_scene.c 2012-05-10 14:51:18 UTC (rev 46500)
+++ trunk/blender/source/blender/makesrna/intern/rna_scene.c 2012-05-10 15:10:51 UTC (rev 46501)
@@ -625,6 +625,14 @@
iter->valid = (internal->link != NULL);
}
+static PointerRNA rna_Scene_sequence_editor_get(PointerRNA *ptr)
+{
+ Scene *scene = (Scene *)ptr->data;
+ /* mallocs an Editing (if it doesn't exist) so you can access
+ * Scene.sequence_editor functions without having to manually
+ * add a Sequence using the UI to create the SequenceEditor */
+ return rna_pointer_inherit_refine(ptr, &RNA_SequenceEditor, seq_give_editing(scene, TRUE));
+}
static char *rna_RenderSettings_path(PointerRNA *UNUSED(ptr))
{
@@ -4307,6 +4315,7 @@
/* Sequencer */
prop = RNA_def_property(srna, "sequence_editor", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "ed");
+ RNA_def_property_pointer_funcs(prop, "rna_Scene_sequence_editor_get", NULL, NULL, NULL);
RNA_def_property_struct_type(prop, "SequenceEditor");
RNA_def_property_ui_text(prop, "Sequence Editor", "");
Modified: trunk/blender/source/blender/makesrna/intern/rna_sequencer.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_sequencer.c 2012-05-10 14:51:18 UTC (rev 46500)
+++ trunk/blender/source/blender/makesrna/intern/rna_sequencer.c 2012-05-10 15:10:51 UTC (rev 46501)
@@ -49,6 +49,15 @@
#include "WM_types.h"
#include "BLI_math.h"
+typedef struct EffectInfo
+{
+ const char *struct_name;
+ const char *ui_name;
+ const char *ui_desc;
+ void (*func)(StructRNA*);
+ int inputs;
+} EffectInfo;
+
#ifdef RNA_RUNTIME
/* build a temp referene to the parent */
@@ -401,14 +410,21 @@
case SEQ_SOUND:
return &RNA_SoundSequence;
case SEQ_CROSS:
+ return &RNA_CrossSequence;
case SEQ_ADD:
+ return &RNA_AddSequence;
case SEQ_SUB:
+ return &RNA_SubtractSequence;
case SEQ_ALPHAOVER:
+ return &RNA_AlphaOverSequence;
case SEQ_ALPHAUNDER:
+ return &RNA_AlphaUnderSequence;
case SEQ_GAMCROSS:
+ return &RNA_GammaCrossSequence;
case SEQ_MUL:
+ return &RNA_MultiplySequence;
case SEQ_OVERDROP:
- return &RNA_EffectSequence;
+ return &RNA_OverDropSequence;
case SEQ_MULTICAM:
return &RNA_MulticamSequence;
case SEQ_ADJUSTMENT:
@@ -944,6 +960,19 @@
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); */
}
+EnumPropertyItem blend_mode_items[] = {
+ {SEQ_BLEND_REPLACE, "REPLACE", 0, "Replace", ""},
+ {SEQ_CROSS, "CROSS", 0, "Cross", ""},
+ {SEQ_ADD, "ADD", 0, "Add", ""},
+ {SEQ_SUB, "SUBTRACT", 0, "Subtract", ""},
+ {SEQ_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", ""},
+ {SEQ_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", ""},
+ {SEQ_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", ""},
+ {SEQ_MUL, "MULTIPLY", 0, "Multiply", ""},
+ {SEQ_OVERDROP, "OVER_DROP", 0, "Over Drop", ""},
+ {0, NULL, 0, NULL, NULL}
+};
+
static void rna_def_sequence(BlenderRNA *brna)
{
StructRNA *srna;
@@ -973,18 +1002,6 @@
{SEQ_MULTICAM, "MULTICAM", 0, "Multicam Selector", ""},
{SEQ_ADJUSTMENT, "ADJUSTMENT", 0, "Adjustment Layer", ""},
{0, NULL, 0, NULL, NULL}};
-
- static const EnumPropertyItem blend_mode_items[] = {
- {SEQ_BLEND_REPLACE, "REPLACE", 0, "Replace", ""},
- {SEQ_CROSS, "CROSS", 0, "Cross", ""},
- {SEQ_ADD, "ADD", 0, "Add", ""},
- {SEQ_SUB, "SUBTRACT", 0, "Subtract", ""},
- {SEQ_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", ""},
- {SEQ_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", ""},
- {SEQ_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", ""},
- {SEQ_MUL, "MULTIPLY", 0, "Multiply", ""},
- {SEQ_OVERDROP, "OVER_DROP", 0, "Over Drop", ""},
- {0, NULL, 0, NULL, NULL}};
srna = RNA_def_struct(brna, "Sequence", NULL);
RNA_def_struct_ui_text(srna, "Sequence", "Sequence strip in the sequence editor");
@@ -1004,11 +1021,8 @@
RNA_def_property_ui_text(prop, "Type", "");
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
- /*prop= RNA_def_property(srna, "ipo", PROP_POINTER, PROP_NONE); */
- /*RNA_def_property_ui_text(prop, "IPO Curves", "IPO curves used by this sequence"); */
/* flags */
-
prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
RNA_def_property_ui_text(prop, "Select", "");
@@ -1034,13 +1048,7 @@
RNA_def_property_ui_text(prop, "Lock", "Lock strip so that it can't be transformed");
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL);
- prop = RNA_def_property(srna, "waveform", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_AUDIO_DRAW_WAVEFORM);
- RNA_def_property_ui_text(prop, "Draw Waveform", "Whether to draw the sound's waveform");
- RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL);
-
/* strip positioning */
-
prop = RNA_def_property(srna, "frame_final_duration", PROP_INT, PROP_TIME);
RNA_def_property_range(prop, 1, MAXFRAME);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
@@ -1154,24 +1162,6 @@
"to this frame");
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
- /* effect strip inputs */
-
- prop = RNA_def_property(srna, "input_count", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_int_funcs(prop, "rna_Sequence_input_count_get", NULL, NULL);
-
- prop = RNA_def_property(srna, "input_1", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "seq1");
- RNA_def_property_ui_text(prop, "Input 1", "First input for the effect strip");
-
- prop = RNA_def_property(srna, "input_2", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "seq2");
- RNA_def_property_ui_text(prop, "Input 2", "Second input for the effect strip");
-
- prop = RNA_def_property(srna, "input_3", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "seq1");
- RNA_def_property_ui_text(prop, "Input 3", "Third input for the effect strip");
-
RNA_api_sequence_strip(srna);
}
@@ -1189,6 +1179,7 @@
RNA_def_property_collection_sdna(prop, NULL, "seqbase", NULL);
RNA_def_property_struct_type(prop, "Sequence");
RNA_def_property_ui_text(prop, "Sequences", "");
+ RNA_api_sequences(brna, prop);
prop = RNA_def_property(srna, "sequences_all", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "seqbase", NULL);
@@ -1207,6 +1198,7 @@
prop = RNA_def_property(srna, "active_strip", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "act_seq");
RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Active Strip", "Sequencer's active strip");
prop = RNA_def_property(srna, "show_overlay", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "over_flag", SEQ_EDIT_OVERLAY_SHOW);
@@ -1225,7 +1217,6 @@
RNA_def_property_int_funcs(prop, "rna_SequenceEditor_overlay_frame_get",
"rna_SequenceEditor_overlay_frame_set", NULL);
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
- RNA_def_property_ui_text(prop, "Active Strip", "Sequencer's active strip");
}
static void rna_def_filter_video(StructRNA *srna)
@@ -1355,6 +1346,36 @@
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
}
+static void rna_def_effect_inputs(StructRNA *srna, int count)
+{
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "input_count", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_int_funcs(prop, "rna_Sequence_input_count_get", NULL, NULL);
+
+ if (count >= 1) {
+ prop = RNA_def_property(srna, "input_1", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "seq1");
+ RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_NULL);
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list