Hi,
I would like to retrieve at any time the pointer to the t_canvas containing my object. Is that possible ? I know I can retrieve it with something like : t_glist *glist=(t_glist *)canvas_getcurrent(); t_canvas *canvas=(t_canvas*)glist_getcanvas(glist); in the myobject_new() method.
But the same give me a (nil) t_canvas pointer outside the new() method.
Thanks in advance.
Antoine
-- do it yourself http://antoine.villeret.free.fr
You could save the pointer in your class struct during the new method.
Maritn
On Tue, Mar 3, 2015 at 11:52 AM, Antoine Villeret < antoine.villeret@gmail.com> wrote:
Hi,
I would like to retrieve at any time the pointer to the t_canvas containing my object. Is that possible ? I know I can retrieve it with something like : t_glist *glist=(t_glist *)canvas_getcurrent(); t_canvas *canvas=(t_canvas*)glist_getcanvas(glist); in the myobject_new() method.
But the same give me a (nil) t_canvas pointer outside the new() method.
Thanks in advance.
Antoine
-- do it yourself http://antoine.villeret.free.fr
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
hi,
thanks for your answer, but I was wondering if there is a way to retrieve it without saving it. I'm porting a Max lib to Pd which uses such a thing in Max (which is possible since SDK 6). If it's not possible I would have to rewrite *a lot* of the lib code. :-(
a
-- do it yourself http://antoine.villeret.free.fr
2015-03-03 19:52 GMT+01:00 Martin Peach chakekatzil@gmail.com:
You could save the pointer in your class struct during the new method.
Maritn
On Tue, Mar 3, 2015 at 11:52 AM, Antoine Villeret < antoine.villeret@gmail.com> wrote:
Hi,
I would like to retrieve at any time the pointer to the t_canvas containing my object. Is that possible ? I know I can retrieve it with something like : t_glist *glist=(t_glist *)canvas_getcurrent(); t_canvas *canvas=(t_canvas*)glist_getcanvas(glist); in the myobject_new() method.
But the same give me a (nil) t_canvas pointer outside the new() method.
Thanks in advance.
Antoine
-- do it yourself http://antoine.villeret.free.fr
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
You would only need to rewrite the function that max used (since it won't exist otherwise anyway), and have it retrieve the value from the class struct instead.
Martin
On Tue, Mar 3, 2015 at 2:26 PM, Antoine Villeret <antoine.villeret@gmail.com
wrote:
hi,
thanks for your answer, but I was wondering if there is a way to retrieve it without saving it. I'm porting a Max lib to Pd which uses such a thing in Max (which is possible since SDK 6). If it's not possible I would have to rewrite *a lot* of the lib code. :-(
a
-- do it yourself http://antoine.villeret.free.fr
2015-03-03 19:52 GMT+01:00 Martin Peach chakekatzil@gmail.com:
You could save the pointer in your class struct during the new method.
Maritn
On Tue, Mar 3, 2015 at 11:52 AM, Antoine Villeret < antoine.villeret@gmail.com> wrote:
Hi,
I would like to retrieve at any time the pointer to the t_canvas containing my object. Is that possible ? I know I can retrieve it with something like : t_glist *glist=(t_glist *)canvas_getcurrent(); t_canvas *canvas=(t_canvas*)glist_getcanvas(glist); in the myobject_new() method.
But the same give me a (nil) t_canvas pointer outside the new() method.
Thanks in advance.
Antoine
-- do it yourself http://antoine.villeret.free.fr
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
actually, the function take a t_object* as an argument, not a pointer to the class structure is there a way to access the class a t_object belong to from the t_object itself ? if no, I will have to change each call to that function to pass a class structure pointer instead of just the t_object. but correct me if i'm wrong
-- do it yourself http://antoine.villeret.free.fr
2015-03-03 21:21 GMT+01:00 Martin Peach chakekatzil@gmail.com:
You would only need to rewrite the function that max used (since it won't exist otherwise anyway), and have it retrieve the value from the class struct instead.
Martin
On Tue, Mar 3, 2015 at 2:26 PM, Antoine Villeret < antoine.villeret@gmail.com> wrote:
hi,
thanks for your answer, but I was wondering if there is a way to retrieve it without saving it. I'm porting a Max lib to Pd which uses such a thing in Max (which is possible since SDK 6). If it's not possible I would have to rewrite *a lot* of the lib code. :-(
a
-- do it yourself http://antoine.villeret.free.fr
2015-03-03 19:52 GMT+01:00 Martin Peach chakekatzil@gmail.com:
You could save the pointer in your class struct during the new method.
Maritn
On Tue, Mar 3, 2015 at 11:52 AM, Antoine Villeret < antoine.villeret@gmail.com> wrote:
Hi,
I would like to retrieve at any time the pointer to the t_canvas containing my object. Is that possible ? I know I can retrieve it with something like : t_glist *glist=(t_glist *)canvas_getcurrent(); t_canvas *canvas=(t_canvas*)glist_getcanvas(glist); in the myobject_new() method.
But the same give me a (nil) t_canvas pointer outside the new() method.
Thanks in advance.
Antoine
-- do it yourself http://antoine.villeret.free.fr
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
On 03/03/2015 03:21 PM, Martin Peach wrote:
You would only need to rewrite the function that max used (since it won't exist otherwise anyway), and have it retrieve the value from the class struct instead.
And also add a line to your *_new method where you initialize the t_canvas* field in your struct using canvas_getcurrent().
-Jonathan
Martin
On Tue, Mar 3, 2015 at 2:26 PM, Antoine Villeret <antoine.villeret@gmail.com mailto:antoine.villeret@gmail.com> wrote:
hi, thanks for your answer, but I was wondering if there is a way to retrieve it without saving it. I'm porting a Max lib to Pd which uses such a thing in Max (which is possible since SDK 6). If it's not possible I would have to rewrite *a lot* of the lib code. :-( + a -- do it yourself http://antoine.villeret.free.fr 2015-03-03 19:52 GMT+01:00 Martin Peach <chakekatzil@gmail.com <mailto:chakekatzil@gmail.com>>: You could save the pointer in your class struct during the new method. Maritn On Tue, Mar 3, 2015 at 11:52 AM, Antoine Villeret <antoine.villeret@gmail.com <mailto:antoine.villeret@gmail.com>> wrote: Hi, I would like to retrieve at any time the pointer to the t_canvas containing my object. Is that possible ? I know I can retrieve it with something like : t_glist *glist=(t_glist *)canvas_getcurrent(); t_canvas *canvas=(t_canvas*)glist_getcanvas(glist); in the myobject_new() method. But the same give me a (nil) t_canvas pointer outside the new() method. Thanks in advance. Antoine -- do it yourself http://antoine.villeret.free.fr _______________________________________________ Pd-list@lists.iem.at <mailto:Pd-list@lists.iem.at> mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list