Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
On 10/12/2014 at 17:44, xxxxxxxx wrote:
The documentation for how to .GetLink () is confusing. It says I need an instance of a LinkboxUI.
I don't know how to retrieve what's contained in the linkbox. Would I need to create the LinkBoxUI instance? If so, how exactly do you do that?
Simple code setup for the UI. Linkbox and a button. Press the button, print what's in the linkbox (well, that's the goal).
import c4d from c4d import gui class guiDialog ( gui.GeDialog ) : lb = 1000 btn = 1001 def CreateLayout ( self ) : self.AddCustomGui ( self.lb, pluginid = c4d.CUSTOMGUI_LINKBOX, name = "Target Object", flags = c4d.BFH_SCALEFIT, minw = 466, minh = 15 ) self.AddButton ( self.btn, c4d.BFH_SCALEFIT, 120, 15, 'Okay' ) return True def Command ( self, id, msg ) : if id == self.btn: print 'object name' return True def main() : dialog = guiDialog () dialog.Open ( dlgtype = c4d.DLG_TYPE_MODAL ) if __name__=='__main__': main()
On 11/12/2014 at 01:52, xxxxxxxx wrote:
Hello,
to get the link of a linkbox simply call the GetLink() function of your linkbox. AddCustomGui() will return this linkbox. Either store the returned object or get it using FindCustomGui().
linkbox = self.FindCustomGui(id=4000,pluginid = c4d.CUSTOMGUI_LINKBOX) if linkbox is not None: linkedObject = linkbox.GetLink(documents.GetActiveDocument()) if linkedObject is not None: print linkedObject
Best wishes, Sebastian
On 11/12/2014 at 10:14, xxxxxxxx wrote:
Ah, FindCustomGui(). That's what I was looking for!
Thank you!