Commit a057b494 authored by Ivica Bukvic's avatar Ivica Bukvic
Browse files

added autopatch exception when patching new objects to circumvent checking of...

added autopatch exception when patching new objects to circumvent checking of signal-to-non-signal connections since new empty objects are created by default with control (non-signal) nlets.
parent a44b9846
......@@ -68,7 +68,10 @@ extern void glob_preset_node_list_check_loc_and_update(void);
// for preset_node
extern t_class *text_class;
int do_not_redraw = 0;
int do_not_redraw = 0; // used to optimize redrawing
int connect_exception = 0; // used when autopatching to bypass check whether one is trying to connect signal with non-signal nlet
// since this is impossible to figure out when the newly created object is an empty one
struct _outlet
{
......@@ -4699,8 +4702,8 @@ void canvas_connect(t_canvas *x, t_floatarg fwhoout, t_floatarg foutno,
!(objsink = pd_checkobject(&sink->g_pd)))
goto bad;
/* check signal outlets don't try to connect to non-signal inlets */
if (obj_issignaloutlet(objsrc, outno) && !obj_issignalinlet(objsink, inno)) {
/* check signal outlets don't try to connect to non-signal inlet, but only do so when there is no exception active due to autopatching */
if (!connect_exception && obj_issignaloutlet(objsrc, outno) && !obj_issignalinlet(objsink, inno)) {
error("cannot connect signal outlet to control inlet");
goto bad;
}
......
......@@ -247,6 +247,8 @@ void canvas_howputnew(t_canvas *x, int *connectp, int *xpixp, int *ypixp,
they're invoked from the gui; when pasting or restoring from a file, we
get at least x and y. */
EXTERN int connect_exception;
void canvas_obj(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
{
//fprintf(stderr,"canvas_obj\n");
......@@ -271,7 +273,9 @@ void canvas_obj(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
canvas_objtext(gl, xpix, ypix, 1, b);
if (connectme) {
//fprintf(stderr,"canvas_obj calls canvas_connect\n");
connect_exception = 1;
canvas_connect(gl, indx, 0, nobj, 0);
connect_exception = 0;
}
else {
//fprintf(stderr,"canvas_obj calls canvas_startmotion\n");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment