[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29600] trunk/blender/source/blender: sequence.swap(other) rna function.
Campbell Barton
ideasman42 at gmail.com
Tue Jun 22 00:05:34 CEST 2010
Revision: 29600
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29600
Author: campbellbarton
Date: 2010-06-22 00:05:34 +0200 (Tue, 22 Jun 2010)
Log Message:
-----------
sequence.swap(other) rna function.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/sequencer.c
trunk/blender/source/blender/makesrna/intern/makesrna.c
trunk/blender/source/blender/makesrna/intern/rna_internal.h
trunk/blender/source/blender/makesrna/intern/rna_sequencer.c
Added Paths:
-----------
trunk/blender/source/blender/makesrna/intern/rna_sequencer_api.c
Modified: trunk/blender/source/blender/blenkernel/intern/sequencer.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/sequencer.c 2010-06-21 21:53:33 UTC (rev 29599)
+++ trunk/blender/source/blender/blenkernel/intern/sequencer.c 2010-06-21 22:05:34 UTC (rev 29600)
@@ -3812,7 +3812,8 @@
SWAP(int, seq_a->startstill, seq_b->startstill);
SWAP(int, seq_a->endstill, seq_b->endstill);
SWAP(int, seq_a->machine, seq_b->machine);
- SWAP(int, seq_a->startdisp, seq_b->enddisp);
+ SWAP(int, seq_a->startdisp, seq_b->startdisp);
+ SWAP(int, seq_a->enddisp, seq_b->enddisp);
return 1;
}
Modified: trunk/blender/source/blender/makesrna/intern/makesrna.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/makesrna.c 2010-06-21 21:53:33 UTC (rev 29599)
+++ trunk/blender/source/blender/makesrna/intern/makesrna.c 2010-06-21 22:05:34 UTC (rev 29600)
@@ -2274,7 +2274,7 @@
{"rna_screen.c", NULL, RNA_def_screen},
{"rna_sculpt_paint.c", NULL, RNA_def_sculpt_paint},
{"rna_sensor.c", NULL, RNA_def_sensor},
- {"rna_sequencer.c", NULL, RNA_def_sequencer},
+ {"rna_sequencer.c", "rna_sequencer_api.c", RNA_def_sequencer},
{"rna_smoke.c", NULL, RNA_def_smoke},
{"rna_space.c", NULL, RNA_def_space},
{"rna_test.c", NULL, RNA_def_test},
Modified: trunk/blender/source/blender/makesrna/intern/rna_internal.h
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_internal.h 2010-06-21 21:53:33 UTC (rev 29599)
+++ trunk/blender/source/blender/makesrna/intern/rna_internal.h 2010-06-21 22:05:34 UTC (rev 29600)
@@ -34,6 +34,7 @@
struct ID;
struct IDProperty;
struct SDNA;
+struct Sequence;
/* Data structures used during define */
@@ -232,6 +233,7 @@
void RNA_api_pose_channel(struct StructRNA *srna);
void RNA_api_scene(struct StructRNA *srna);
void RNA_api_scene_render(struct StructRNA *srna);
+void RNA_api_sequence_strip(StructRNA *srna);
void RNA_api_text(struct StructRNA *srna);
void RNA_api_ui_layout(struct StructRNA *srna);
void RNA_api_wm(struct StructRNA *srna);
@@ -340,6 +342,7 @@
int rna_parameter_size(struct PropertyRNA *parm);
int rna_parameter_size_alloc(struct PropertyRNA *parm);
+
#endif /* RNA_INTERNAL_H */
Modified: trunk/blender/source/blender/makesrna/intern/rna_sequencer.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_sequencer.c 2010-06-21 21:53:33 UTC (rev 29599)
+++ trunk/blender/source/blender/makesrna/intern/rna_sequencer.c 2010-06-21 22:05:34 UTC (rev 29600)
@@ -627,7 +627,6 @@
{
StructRNA *srna;
PropertyRNA *prop;
- FunctionRNA *func;
static const EnumPropertyItem seq_type_items[]= {
{SEQ_IMAGE, "IMAGE", 0, "Image", ""},
@@ -811,12 +810,7 @@
RNA_def_property_ui_text(prop, "Speed effect fader position", "");
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
- /* functions */
- func= RNA_def_function(srna, "getStripElem", "give_stripelem");
- RNA_def_function_ui_description(func, "Return the strip element from a given frame or None.");
- prop= RNA_def_int(func, "frame", 0, -MAXFRAME, MAXFRAME, "Frame", "The frame to get the strip element from", -MAXFRAME, MAXFRAME);
- RNA_def_property_flag(prop, PROP_REQUIRED);
- RNA_def_function_return(func, RNA_def_pointer(func, "elem", "SequenceElement", "", "strip element of the current frame"));
+ RNA_api_sequence_strip(srna);
}
static void rna_def_editor(BlenderRNA *brna)
Added: trunk/blender/source/blender/makesrna/intern/rna_sequencer_api.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_sequencer_api.c (rev 0)
+++ trunk/blender/source/blender/makesrna/intern/rna_sequencer_api.c 2010-06-21 22:05:34 UTC (rev 29600)
@@ -0,0 +1,72 @@
+/**
+ * $Id: rna_sequencer.c 29537 2010-06-18 04:39:32Z broken $
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Blender Foundation (2010)
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "RNA_define.h"
+
+#include "BLO_sys_types.h" /* needed for intptr_t used in ED_mesh.h */
+
+#include "RNA_access.h"
+#include "RNA_define.h"
+
+#include "rna_internal.h"
+
+#include "DNA_scene_types.h"
+#include "DNA_sequence_types.h"
+
+#ifdef RNA_RUNTIME
+
+#include "BKE_report.h"
+#include "BKE_sequencer.h"
+
+static void rna_Sequence_swap_internal(Sequence *seq_self, ReportList *reports, Sequence *seq_other)
+{
+ if(seq_swap(seq_self, seq_other) == 0)
+ BKE_report(reports, RPT_ERROR, "both strips must be the same length");
+}
+
+#else
+
+void RNA_api_sequence_strip(StructRNA *srna)
+{
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ func= RNA_def_function(srna, "getStripElem", "give_stripelem");
+ RNA_def_function_ui_description(func, "Return the strip element from a given frame or None.");
+ parm= RNA_def_int(func, "frame", 0, -MAXFRAME, MAXFRAME, "Frame", "The frame to get the strip element from", -MAXFRAME, MAXFRAME);
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_function_return(func, RNA_def_pointer(func, "elem", "SequenceElement", "", "strip element of the current frame"));
+
+ func= RNA_def_function(srna, "swap", "rna_Sequence_swap_internal");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm= RNA_def_pointer(func, "other", "Sequence", "Other", "");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+}
+
+#endif
More information about the Bf-blender-cvs
mailing list