Skip to content
Snippets Groups Projects
Commit 5c58d82c authored by Guillem Bartrina's avatar Guillem Bartrina
Browse files

allow creating ab objects without a specific name

parent 3960a88a
No related branches found
No related tags found
4 merge requests!5752.15.0 release candidate,!574Draft: 2.15.0 release candidate,!560feature - private abstractions [ab],!483WIP: private patch abstractions [ab]. first approach
...@@ -2215,14 +2215,14 @@ static void *ab_new(t_symbol *s, int argc, t_atom *argv) ...@@ -2215,14 +2215,14 @@ static void *ab_new(t_symbol *s, int argc, t_atom *argv)
t_canvas *c = canvas_getcurrent(); t_canvas *c = canvas_getcurrent();
if (!argc || argv[0].a_type != A_SYMBOL) if (argc && argv[0].a_type != A_SYMBOL)
{ {
error("ab_new: not recognized syntax. Usage: ab <name>"); error("ab_new: ab name must be a symbol");
newest = 0; newest = 0;
} }
else else
{ {
t_symbol *name = argv[0].a_w.w_symbol; t_symbol *name = (argc ? argv[0].a_w.w_symbol : gensym("(ab)"));
t_ab_definition *source; t_ab_definition *source;
if(!(source = canvas_find_ab(c, name))) if(!(source = canvas_find_ab(c, name)))
...@@ -2234,7 +2234,7 @@ static void *ab_new(t_symbol *s, int argc, t_atom *argv) ...@@ -2234,7 +2234,7 @@ static void *ab_new(t_symbol *s, int argc, t_atom *argv)
if(canvas_register_ab(c, source)) if(canvas_register_ab(c, source))
{ {
newest = do_create_ab(source, argc-1, argv+1); newest = do_create_ab(source, (argc ? argc-1 : 0), (argc ? argv+1 : 0));
source->ad_numinstances++; source->ad_numinstances++;
} }
else else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment