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
This commit is contained in:
Chris Want
2003-01-28 03:59:33 +00:00
parent 53b540c627
commit e36159ce85
3 changed files with 80 additions and 0 deletions

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;