Getting a pointer to a UserArea
-
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? -
This post is deleted! -
Hello,
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 class ResourceUserArea(gui.GeUserArea): def GetMinSize(self): return 100, 100 def DrawMsg(self, x1, y1, x2, y2, msg_ref): self.OffScreenOn() self.SetClippingRegion(x1, y1, x2, y2) color = c4d.Vector(1,0,0) self.DrawSetPen(color) self.DrawRectangle(x1, y1, x2, y2) class ResourceDialog(c4d.gui.GeDialog): # user area instance _resourceUserArea = ResourceUserArea() def CreateLayout(self): # load dialog resource if self.LoadDialogResource(10100, None, 0) == False: return False # attach user ara instance to user area defined in resource self.AttachUserArea(self._resourceUserArea, 10103, c4d.USERAREAFLAGS_NONE) return True
best wishes,
Sebastian -
@s_bach said in Getting a pointer to a UserArea:
AttachUserArea
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? -
Hello,
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 toc4d.DESCFLAGS_SET_NONE
. Similarly,c4d.USERAREAFLAGS_NONE
wasc4d.USERAREA_0
.best wishes,
Sebastian