Hi,
you can actually use obj_starttraverseoutlet() to traverse the outlets like
this:
// x is your object
t_outlet *outlet;
int nout = obj_noutlets(x);
for (int i = 0; i < nout; ++i){
obj_starttraverseoutlet(x, &outlet, i);
// do something with outlet
}
obj_starttraverseoutlet returns the connections from this outlet to other
ojects (which you can traverse with obj_nexttraverseoutlet), but it also gives
you the outlet via the second parameter (a t_outlet** so it can change your
t_outlet* to point to the right outlet).
note that those functions are not part of the public API, so use with caution.
Christof
Gesendet: Dienstag, 20. November 2018 um 17:37 Uhr
Von: "Henri Augusto Bisognini" <[email protected]>
An: "[email protected]" <[email protected]>
Betreff: [PD-dev] why some structs are defined in m_obj.c? + what are vinlets
and voutlets?
Hi.
I'm starting to dwelve into pd's C side of things. I'm having a really hard
time figuring stuff out. (i have mainly experience with more high-level
languages like Java, etc)
I'm trying to experiment with some editor features and i've been wandering:
why the _inlet and _outlet structures are defined in m_obj.c instead of m_pd.h ?
This way i can't access the structure members. I'm trying to traverse an
t_object's t_outlets linked list but
t_outlet *o = selected_object->te_outlet;
o = o->o_next;
but this throws me an "dereferencing incomplete type" error since there is no
definition for t_outlet inside m_pd.
The same goes for accessing members of t_outconnect for example, but there are
two methods that allows you to traverse the connections linked list
obj_starttraverseoutlet() (m_imp.h)(m_obj.c)
obj_nexttraverseoutlet() (m_imp.h)(m_obj.c)
But i couldn't find any method to traverse an t_object's linked list of
t_outlets. The only three methods that seems to return t_outlets pointers are
t_outlet *outlet_new(t_object *owner, t_symbol *s)
(m_obj.c)
t_outlet *canvas_addoutlet(t_canvas *x, t_pd *who, t_symbol *s)
(g_graph.c)
and
t_outlet *voutlet_getit(t_pd *x) (g_io.c)
which i currently do not understand but doesn't seem to be what i'm looking for.
How could i traverse from, lets say the g_editor.c file, all the t_inlets and
t_outlets of an t_object?
Btw, on a second question, what exactly are vinlets and voutlets?
Cheers,
Henri._______________________________________________ Pd-dev mailing list
[email protected] https://lists.puredata.info/listinfo/pd-dev
_______________________________________________
Pd-dev mailing list
[email protected]
https://lists.puredata.info/listinfo/pd-dev