Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorChris Want <cwant@ualberta.ca>2003-01-28 06:59:33 +0300
committerChris Want <cwant@ualberta.ca>2003-01-28 06:59:33 +0300
commite36159ce85c6b6cb9393b3a2c4f04d45901b94e8 (patch)
tree7659728fcfde5b95ad0bb7efbffbaef7ebfc5674 /source
parent53b540c627a5667b20807fb3d5f88a3f8cb3d018 (diff)
Added functionality for using TKEY in the action windows
to change the Ipo type (constant/linear/bezier) for the Ipo curves owned by the selected channels
Diffstat (limited to 'source')
-rw-r--r--source/blender/include/BSE_editipo.h1
-rw-r--r--source/blender/src/editaction.c42
-rw-r--r--source/blender/src/editipo.c37
3 files changed, 80 insertions, 0 deletions
diff --git a/source/blender/include/BSE_editipo.h b/source/blender/include/BSE_editipo.h
index afafcf72428..938b228a84e 100644
--- a/source/blender/include/BSE_editipo.h
+++ b/source/blender/include/BSE_editipo.h
@@ -131,6 +131,7 @@ void sampledata_to_ipocurve(float *data, int sfra, int efra, struct IpoCurve *ic
void ipo_record(void);
void sethandles_ipo_keys(struct Ipo *ipo, int code);
+void setipotype_ipo(struct Ipo *ipo, int code);
void set_ipo_key_selection(struct Ipo *ipo, int sel);
int is_ipo_key_selected(struct Ipo *ipo);
void delete_ipo_keys(struct Ipo *ipo);
diff --git a/source/blender/src/editaction.c b/source/blender/src/editaction.c
index c9ee8c546b4..bbae0fd60ac 100644
--- a/source/blender/src/editaction.c
+++ b/source/blender/src/editaction.c
@@ -1338,6 +1338,43 @@ static void sethandles_actionchannel_keys(int code)
allqueue(REDRAWNLA, 0);
}
+static void set_ipotype_actionchannels(void) {
+
+ bAction *act;
+ bActionChannel *chan;
+ short event;
+
+ /* Get the selected action, exit if none are selected
+ */
+ act = G.saction->action;
+ if (!act)
+ return;
+
+ /* Present a popup menu asking the user what type
+ * of IPO curve he/she/GreenBTH wants. ;)
+ */
+ event= pupmenu("Channel Ipo Type %t|Constant %x1|Linear %x2|Bezier %x3");
+ if(event < 1) return;
+
+ /* Loop through the channels and for the selected ones set
+ * the type for each Ipo curve in the channel Ipo (based on
+ * the value from the popup).
+ */
+ for (chan = act->chanbase.first; chan; chan=chan->next){
+ if (chan->flag & ACHAN_SELECTED){
+ if (chan->ipo)
+ setipotype_ipo(chan->ipo, event);
+ }
+ }
+
+ /* Clean up and redraw stuff
+ */
+ remake_action_ipos (act);
+ allspace(REMAKEIPO, 0);
+ allqueue(REDRAWACTION, 0);
+ allqueue(REDRAWIPO, 0);
+ allqueue(REDRAWNLA, 0);
+}
void winqreadactionspace(unsigned short event, short val, char ascii)
{
@@ -1414,6 +1451,11 @@ void winqreadactionspace(unsigned short event, short val, char ascii)
else sethandles_actionchannel_keys(HD_ALIGN);
break;
+ /*** set the Ipo type ***/
+ case TKEY:
+ set_ipotype_actionchannels();
+ break;
+
case BKEY:
borderselect_action();
break;
diff --git a/source/blender/src/editipo.c b/source/blender/src/editipo.c
index c5923cbe83c..0f2f10c7eff 100644
--- a/source/blender/src/editipo.c
+++ b/source/blender/src/editipo.c
@@ -2958,6 +2958,43 @@ void sethandles_ipo(int code)
}
+void set_ipocurve_constant(struct IpoCurve *icu) {
+ /* Sets the type of the IPO curve to constant
+ */
+ icu->ipo= IPO_CONST;
+}
+
+void set_ipocurve_linear(struct IpoCurve *icu) {
+ /* Sets the type of the IPO curve to linear
+ */
+ icu->ipo= IPO_LIN;
+}
+
+void set_ipocurve_bezier(struct IpoCurve *icu) {
+ /* Sets the type of the IPO curve to bezier
+ */
+ icu->ipo= IPO_BEZ;
+}
+
+
+void setipotype_ipo(Ipo *ipo, int code)
+{
+ /* Sets the type of the each ipo curve in the
+ * Ipo to a value based on the code
+ */
+ switch (code) {
+ case 1:
+ ipo_keys_bezier_loop(ipo, NULL, set_ipocurve_constant);
+ break;
+ case 2:
+ ipo_keys_bezier_loop(ipo, NULL, set_ipocurve_linear);
+ break;
+ case 3:
+ ipo_keys_bezier_loop(ipo, NULL, set_ipocurve_bezier);
+ break;
+ }
+}
+
void set_ipotype()
{
EditIpo *ei;