patch from Xavier Thomas, color balance and proxy access both need to allocate structs when enabled.

This commit is contained in:
Campbell Barton 2009-06-10 22:03:50 +00:00
parent 1a787efd7c
commit 3bdcd4f738
2 changed files with 50 additions and 6 deletions

@ -144,6 +144,7 @@ class SEQUENCER_MT_add(bpy.types.Menu):
st = context.space_data
layout.column()
layout.itemO("SEQUENCER_OT_scene_strip_add", text="Scene")
layout.itemO("SEQUENCER_OT_movie_strip_add", text="Movie")
layout.item_booleanO("SEQUENCER_OT_movie_strip_add", "sound", True, text="Movie & Sound") # FFMPEG ONLY
layout.itemO("SEQUENCER_OT_image_strip_add", text="Image")
@ -469,6 +470,16 @@ class SEQUENCER_PT_filter(SequencerButtonsPanel):
col.itemR(strip, "reverse_frames", text="Backwards")
layout.itemR(strip, "use_color_balance")
if strip.color_balance: # TODO - need to add this somehow
col = layout.row()
col.itemR(strip.color_balance, "lift")
col.itemR(strip.color_balance, "gamma")
col.itemR(strip.color_balance, "gain")
col = layout.row()
col.itemR(strip.color_balance, "inverse_lift")
col.itemR(strip.color_balance, "inverse_gamma")
col.itemR(strip.color_balance, "inverse_gain")
class SEQUENCER_PT_proxy(SequencerButtonsPanel):
__label__ = "Proxy"
@ -496,11 +507,11 @@ class SEQUENCER_PT_proxy(SequencerButtonsPanel):
layout = self.layout
row = layout.row()
row.itemR(strip, "proxy_custom_directory")
flow = layout.column_flow()
flow.itemR(strip, "proxy_custom_directory")
if strip.proxy: # TODO - need to add this somehow
row.itemR(strip.proxy, "dir")
row.itemR(strip.proxy, "file")
flow.itemR(strip.proxy, "directory")
flow.itemR(strip.proxy, "file")
class SEQUENCER_PT_view(SequencerButtonsPanel_Output):

@ -98,6 +98,39 @@ static void rna_SequenceEditor_channel_set(PointerRNA *ptr, int value)
sort_seq(sce);
}
static int rna_SequenceEditor_use_color_balance_set(PointerRNA *ptr, int value)
{
Sequence *seq= (Sequence*)ptr->data;
int c;
if(value) {
seq->flag |= SEQ_USE_COLOR_BALANCE;
if(seq->strip->color_balance == NULL) {
seq->strip->color_balance = MEM_callocN(sizeof(struct StripColorBalance), "StripColorBalance");
for (c=0; c<3; c++) {
seq->strip->color_balance->lift[c] = 1.0f;
seq->strip->color_balance->gamma[c] = 1.0f;
seq->strip->color_balance->gain[c] = 1.0f;
}
}
} else {
seq->flag ^= SEQ_USE_COLOR_BALANCE;
}
}
static int rna_SequenceEditor_use_proxy_set(PointerRNA *ptr, int value)
{
Sequence *seq= (Sequence*)ptr->data;
if(value) {
seq->flag |= SEQ_USE_PROXY;
if(seq->strip->proxy == NULL) {
seq->strip->proxy = MEM_callocN(sizeof(struct StripProxy), "StripProxy");
}
} else {
seq->flag ^= SEQ_USE_PROXY;
}
}
/* name functions that ignore the first two characters */
static void rna_Sequence_name_get(PointerRNA *ptr, char *value)
{
@ -504,8 +537,8 @@ static void rna_def_filter_video(StructRNA *srna)
prop= RNA_def_property(srna, "use_color_balance", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_COLOR_BALANCE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE); // allocate color balance
RNA_def_property_ui_text(prop, "Use Color Balance", "(3-Way color correction) on input.");
RNA_def_property_boolean_funcs(prop, NULL, "rna_SequenceEditor_use_color_balance_set");
prop= RNA_def_property(srna, "color_balance", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "strip->color_balance");
@ -551,8 +584,8 @@ static void rna_def_proxy(StructRNA *srna)
prop= RNA_def_property(srna, "use_proxy", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_PROXY);
RNA_def_property_clear_flag(prop, PROP_EDITABLE); // allocate proxy
RNA_def_property_ui_text(prop, "Use Proxy", "Use a preview proxy for this strip.");
RNA_def_property_boolean_funcs(prop, NULL, "rna_SequenceEditor_use_proxy_set");
prop= RNA_def_property(srna, "proxy", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "strip->proxy");