<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>I'm not sure I understand the issue. Pd obtains the bounding rect
of a GUI object (by calling w_getrectfn in gobj_getrect()) to
determine whether it should be visible or not and then calls the
w_visfn as needed, see gobj_shouldvis(). This means you shouldn't
have to perform the bound check against the GOP rect yourself, Pd
will do it for you.<br>
</p>
<p>
<blockquote type="cite">so it'll say it is visible, even though
the object itself is actually out of bounds</blockquote>
Make sure that you report the actual bounding rect of your object.<br>
</p>
<p>Christof<br>
</p>
<div class="moz-cite-prefix">On 27.06.2020 02:35, Alexandre Torres
Porres wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAEAsFmh2h2joALMAu93wYQecKapvo3yrvb-=6QPs80g_ck1eQw@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">Hi folks, I opened an issue about this on github,
but since there was no answer I'm hoping to get some
attention and a possible answer here on the dev list.
<div><br>
</div>
<div>In Pd, if you have graphical objects in a GOP subpatch that
are out of the visible range, it's possible they get drawn,
and I opened the issue to mention that [vradio], for instance,
does that (here it is: <a
href="https://github.com/pure-data/pure-data/issues/1053"
moz-do-not-send="true">https://github.com/pure-data/pure-data/issues/1053</a> ).
I also mentioned n there how graphs inside a GOP subpatch can
also do that. But I also have this issue with some GUI
externals I take care of.</div>
<div><br>
</div>
<div>So, is there a way for an object to know if it is visible
in the parent pacth so we do not tell it to get drawn?</div>
<div><br>
</div>
<div>What I've now just stumbled upon is our code for
cyclone/scope~ - unlike [vradio], if the object is out of
bounds in a GOP and I tell it to change dimensions, it won't
get drawn, but trigger a tcl/tk error instead. Note that no
error happens if the subpatch is opened or if it is inside
bounds (or both of course). Anyway, this line is what triggers
the error => <a
href="https://github.com/porres/pd-cyclone/blob/cyclone_0.5-1/cyclone_objects/binaries/audio/scope.c#L495"
moz-do-not-send="true">https://github.com/porres/pd-cyclone/blob/cyclone_0.5-1/cyclone_objects/binaries/audio/scope.c#L495</a></div>
<div><br>
</div>
<div>The error gives me hope there's a way to check if it is
possible to do it, and then not tell it to do it if it's not
possible...</div>
<div><br>
</div>
<div>I used the "(glist_isvisible())" function to check if it's
visible. It doesn't work as a check because the object is in a
GOP, so it'll say it is visible, even though the object itself
is actually out of bounds. Now, in the case of scope~, it
tries to delete the GUI by referring to the subpatch canvas,
and I assume it doesn't work because that window isn't
active/opened.</div>
<div><br>
</div>
<div>So if I change the lines below </div>
<div><br>
</div>
<div><span class="gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,92,197);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre">sys_vgui</span><span style="color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre;background-color:rgb(255,251,221)">(</span><span class="gmail-pl-s" style="box-sizing:border-box;color:rgb(3,47,98);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre"><span class="gmail-pl-pds" style="box-sizing:border-box">"</span>.x<span class="gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,92,197)">%lx</span>.c delete all<span class="gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,92,197)">%lx</span><span class="gmail-pl-cce" style="box-sizing:border-box">\n</span><span class="gmail-pl-pds" style="box-sizing:border-box">"</span></span><span style="color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre;background-color:rgb(255,251,221)">, x-></span><span class="gmail-pl-smi" style="box-sizing:border-box;color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre">x_cv</span><span style="color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre;background-color:rgb(255,251,221)">, x);</span><br>
</div>
<div><span class="gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,92,197);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre">scope_draw</span><span style="color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre">(x, x-></span><span class="gmail-pl-smi" style="box-sizing:border-box;color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre">x_cv</span><span style="color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre">);</span><span style="color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre;background-color:rgb(255,251,221)">
</span></div>
<div><br>
</div>
<div>
<div>To refer to the parent canvas (and not "x->x_cv"), I
don't get an error, but I get the object getting redrawn in
the parent patch outside the graph, just like the issue I
reported with [vradio].</div>
</div>
<div><br>
</div>
<div>Again, when bumping into this, I thought, since the object
knows it can't delete and redraw (that is, since it gives an
error), there could be a way to check it.</div>
<div><br>
</div>
<div>What do you say?</div>
<div><br>
</div>
<div>Thanks</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Pd-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Pd-dev@lists.iem.at">Pd-dev@lists.iem.at</a>
<a class="moz-txt-link-freetext" href="https://lists.puredata.info/listinfo/pd-dev">https://lists.puredata.info/listinfo/pd-dev</a>
</pre>
</blockquote>
</body>
</html>