SDK506: How to define autopattr value set to be restored in C external?
In an external, in a method called in during creating of an object, I'm creating an autopattr object in the parent patcher.
Autopattr is connected to different boxes.
There is also a pattrstorage in the patch.
This is working fine;
Now, I want to define in the autopattr object the values to restore. In the maxpat, I have
"restore" : {
"number" : [ 9 ],
"number[1]" : [ 10 ],
"number[2]" : [ 18 ]
}
How can I set these values back into pattrstorage/autopattr?
Best regards
Chris
I'm a little unclear about what you're doing, but I don't think that you can do what you want. You can, of course, send data to the objects you're creating to set their values (object_setvalueof()), but I'm not sure if that's what you're talking about. I don't even really understand how you got that restore data in the patch, if the autopattr doesn't exist yet. But maybe you can be a little clearer about what you're trying to do.
Jeremy
kawkhins wrote on Mon, 09 March 2009 16:57In an external, in a method called in during creating of an object, I'm creating an autopattr object in the parent patcher.
Autopattr is connected to different boxes.
There is also a pattrstorage in the patch.
This is working fine;
Now, I want to define in the autopattr object the values to restore. In the maxpat, I have
"restore" : {
"number" : [ 9 ],
"number[1]" : [ 10 ],
"number[2]" : [ 18 ]
}
How can I set these values back into pattrstorage/autopattr?
Best regards
Chris
Hi,
Thanks for you reply and your help. It is working with object_setvalueof.
First, I create the objects, then the lines, then I search for the objects having a value in the "restore" section. I set the value on every, it's working.
Question: Should I restore the values before or after creating the lines?
Do you have an idea about my other post in dev, about menubar?
Thanks;
Chris
{
"box" : {
"maxclass" : "newobj",
"varname" : "u882000099",
"text" : "autopattr",
"patching_rect" : [ 131.0, 113.0, 59.5, 20.0 ],
"presentation" : 1,
"fontsize" : 12.0,
"numinlets" : 1,
"numoutlets" : 4,
"id" : "obj-9",
"presentation_rect" : [ 131.0, 113.0, 59.5, 20.0 ],
"outlettype" : [ "", "", "", "" ],
"fontname" : "Arial",
"restore" : {
"number" : [ 9 ],
"number[1]" : [ 10 ],
"number[2]" : [ 18 ]
}
}
}
, {
"box" : {
"maxclass" : "newobj",
"varname" : "u625000074",
"text" : "pattrstorage",
"patching_rect" : [ 46.0, 112.0, 75.0, 20.0 ],
"presentation" : 1,
"fontsize" : 12.0,
"numinlets" : 1,
"numoutlets" : 1,
"id" : "obj-7",
"presentation_rect" : [ 46.0, 112.0, 75.0, 20.0 ],
"outlettype" : [ "" ],
"fontname" : "Arial",
"saved_object_attributes" : {
"storage_rect" : [ 200, 200, 800, 500 ],
"client_rect" : [ 100, 100, 500, 600 ]
}
}
}
, {
"box" : {
"maxclass" : "number",
"varname" : "number[2]",
"patching_rect" : [ 116.0, 58.0, 50.0, 20.0 ],
"ignoreclick" : 1,
"presentation" : 1,
"fontsize" : 12.0,
"triangle" : 0,
"numinlets" : 1,
"numoutlets" : 2,
"id" : "obj-8",
"presentation_rect" : [ 117.0, 87.0, 50.0, 20.0 ],
"outlettype" : [ "int", "bang" ],
"fontname" : "Arial"
}
}