aboutsummaryrefslogtreecommitdiff
path: root/pmpd3d_set.c
diff options
context:
space:
mode:
authorCyrille Henry <nusmuk@users.sourceforge.net>2013-01-16 15:30:22 +0000
committerCyrille Henry <nusmuk@users.sourceforge.net>2013-01-16 15:30:22 +0000
commit7a53826f78f654ec1a2bdb45c1b2ab95d449453b (patch)
treebad5f64fa0748e9e37d83066d100cbd2454b6d3d /pmpd3d_set.c
parentd23606cba1c9094706ce978b72398efa80ac2208 (diff)
add a active / inactive state for link
svn path=/trunk/externals/pmpd/; revision=16881
Diffstat (limited to 'pmpd3d_set.c')
-rw-r--r--pmpd3d_set.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/pmpd3d_set.c b/pmpd3d_set.c
index d6f5d2e..e806fd5 100644
--- a/pmpd3d_set.c
+++ b/pmpd3d_set.c
@@ -471,3 +471,61 @@ void pmpd3d_setForceZ(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv)
}
}
}
+
+void pmpd3d_setActive(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv)
+{
+ int tmp, i;
+
+ if ( argv[0].a_type == A_FLOAT )
+ {
+ tmp = atom_getfloatarg(0, argc, argv);
+ tmp = max(0, min( x->nb_link-1, tmp));
+ x->link[tmp].active = 1;
+ }
+ else if ( argv[0].a_type == A_SYMBOL )
+ {
+ for (i=0; i< x->nb_link; i++)
+ {
+ if ( atom_getsymbolarg(0,argc,argv) == x->link[i].Id )
+ {
+ x->link[i].active = 1;
+ }
+ }
+ }
+ else if ( argc == 0 )
+ {
+ for (i=0; i< x->nb_link; i++)
+ {
+ x->link[i].active = 1;
+ }
+ }
+}
+
+void pmpd3d_setInactive(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv)
+{
+ int tmp, i;
+
+ if ( argv[0].a_type == A_FLOAT )
+ {
+ tmp = atom_getfloatarg(0, argc, argv);
+ tmp = max(0, min( x->nb_link-1, tmp));
+ x->link[tmp].active = 0;
+ }
+ else if ( argv[0].a_type == A_SYMBOL )
+ {
+ for (i=0; i< x->nb_link; i++)
+ {
+ if ( atom_getsymbolarg(0,argc,argv) == x->link[i].Id)
+ {
+ x->link[i].active = 0;
+ }
+ }
+ }
+ else if ( argc == 0 )
+ {
+ for (i=0; i< x->nb_link; i++)
+ {
+ x->link[i].active = 0;
+ }
+ }
+}