I have a dialog defined in a res file. My dialog contains three user areas.
Now I want to be able to deal with them.
How can I get a variable pointing to each one of the user areas, so that I can create a class for each one?
in Python, there are no pointers.
As usual, you have to define a GeUserArea based class to define your user area. Then you just have to attach that class to the user area declared in your resource file using its ID. You can do that with AttachUserArea().
# custom user area class
return 100, 100
def DrawMsg(self, x1, y1, x2, y2, msg_ref):
self.SetClippingRegion(x1, y1, x2, y2)
color = c4d.Vector(1,0,0)
self.DrawRectangle(x1, y1, x2, y2)
# user area instance
_resourceUserArea = ResourceUserArea()
# load dialog resource
if self.LoadDialogResource(10100, None, 0) == False:
# attach user ara instance to user area defined in resource
self.AttachUserArea(self._resourceUserArea, 10103, c4d.USERAREAFLAGS_NONE)
@s_bach said in Getting a pointer to a UserArea:
Thank you, Sebastian. It worked fine.
But, when testing it in R14, it tells me that:
AttributeError: 'module' object has no attribute 'USERAREAFLAGS_NONE'
So, I replaced the c4d.USERAREAFLAGS_NONE with 0 (zero).
It will work fine in R14 to R20, right?
I don't have a Cinmea 4D R14 version so I can't test that case.
But in R20 some symbols have changed. E.g. c4d.DESCFLAGS_SET_0 was changed to c4d.DESCFLAGS_SET_NONE. Similarly, c4d.USERAREAFLAGS_NONE was c4d.USERAREA_0.