diff --git a/pd/src/g_canvas.h b/pd/src/g_canvas.h index c58ba42ebb2b7dae6ea25a7322e833e0e5324f92..1c29534bf0e110d3f76249d13a83aa462b61dad9 100644 --- a/pd/src/g_canvas.h +++ b/pd/src/g_canvas.h @@ -258,7 +258,7 @@ typedef struct _dataslot { int ds_type; t_symbol *ds_name; - t_symbol *ds_fieldtemplate; /* filled in for arrays only */ + t_symbol *ds_fieldtemplate; /* filled in only for array/canvas fields */ t_binbuf *ds_binbuf; /* binbuf of an abstraction to be loaded */ } t_dataslot; diff --git a/pd/src/g_readwrite.c b/pd/src/g_readwrite.c index 1b39cc6d5b8cb72c0d15d74cb0ee4e17c39826b4..a3b4ba824887da90c4e7447b8c9551e3a810f4dc 100644 --- a/pd/src/g_readwrite.c +++ b/pd/src/g_readwrite.c @@ -787,8 +787,10 @@ static void canvas_savetemplatesto(t_canvas *x, t_binbuf *b, int wholething) case DT_TEXT: type = gensym("text"); break; //&s_list; break; default: type = &s_float; bug("canvas_write"); } - if (template->t_vec[j].ds_type == DT_ARRAY || - template->t_vec[j].ds_type == DT_LIST) + if (template->t_vec[j].ds_type == DT_LIST) + binbuf_addv(b, "sss", type, template->t_vec[j].ds_name, + gensym(template->t_vec[j].ds_fieldtemplate->s_name)); + else if (template->t_vec[j].ds_type == DT_ARRAY) binbuf_addv(b, "sss", type, template->t_vec[j].ds_name, gensym(template->t_vec[j].ds_fieldtemplate->s_name + 3)); else binbuf_addv(b, "ss", type, template->t_vec[j].ds_name); diff --git a/pd/src/g_template.c b/pd/src/g_template.c index 81d080ffe890dccdd40bc3c241824ac727ad7f77..d1a266d3bbdb0994e9c991c1d0e2b3181340f5e6 100644 --- a/pd/src/g_template.c +++ b/pd/src/g_template.c @@ -96,8 +96,9 @@ t_template *template_new(t_symbol *templatesym, int argc, t_atom *argv) pd_error(x, "canvas lacks template or name"); goto bad; } - /* If we keep the canvas field API this needs to be revisited */ - //filename = canvas_makebindsym(argv[2].a_w.w_symbol); + /* We're abusing newarraytemplate here to store the name of + the abstraction (minus the .pd extension) */ + newarraytemplate = argv[2].a_w.w_symbol; sprintf(filename, "%s.pd", argv[2].a_w.w_symbol->s_name); if (binbuf_read_via_canvas(b, filename, canvas_getcurrent(), 0)) post("warning: abstraction %s not found", filename);