Get&Copy the object from CUSTOMGUI_LINKBOX



  • On 08/10/2015 at 10:02, xxxxxxxx wrote:

    Hi Guys,
    How can fix this i want to GET and Copy the object that is in side the linkbox plz.

    self.lnk_source = self.AddCustomGui(UI_LNK_SOURCE, c4d.CUSTOMGUI_LINKBOX, "", c4d.BFH_SCALEFIT, 50, 10, self.rootLinkBaseContainer)

    if id == Verify_fbxBT:
    

    doc = c4d.documents.GetActiveDocument()
                fps = doc.GetFps()
                #-----------| Copy Object From LinkBox |---------------#

    	#How I fix this! get it to Copy what is inside the linkbox
    

    self.lnk_source.GetLink()
                doc.GetActiveObjects(self.lnk_source.GetLink())

    #--------------------------------#

    c4d.CallCommand(12094, 12094) # New

    #----| GenerateProjectSettings |----#

    doc = c4d.documents.GetActiveDocument()
                unitScale = c4d.UnitScaleData()
                unitScale.SetUnitScale(1.0,c4d.DOCUMENT_UNIT_M)
                bc = c4d.BaseContainer()
                bc[c4d.DOCUMENT_DOCUNIT] = unitScale
                doc[c4d.DOCUMENT_MINTIME] = c4d.BaseTime(self.GetLong(UI_FRAME_FROM), 30)
                doc[ c4d.DOCUMENT_MAXTIME] = c4d.BaseTime(self.GetLong(UI_FRAME_TO), 30)
                doc.SetDocumentData(c4d. DOCUMENTSETTINGS_DOCUMENT, bc)

    #--------------------------------#

    c4d.CallCommand(100004821, 100004821) # Paste

    #----| EXCUTE FORMAT |----#
                c4d.CallCommand(60000, 9)

    #----| KillDocument |----#
                doc = c4d.documents.GetActiveDocument()  
                c4d.documents.KillDocument(doc)

    #---------------------------------------------------------------------------------------#

    cheers,
    Ashton



  • On 08/10/2015 at 13:48, xxxxxxxx wrote:

    #how i fix this! get it to Copy what is in thelink box
    > self.lnk_source.GetLink()
    > doc.GetActiveObjects(self.lnk_source.GetLink())

    What about:

    myCopy=self.Ink_source.GetLink().GetClone(c4d.COPYFLAGS_0)



  • On 08/10/2015 at 14:28, xxxxxxxx wrote:

    That did not work bro



  • On 09/10/2015 at 00:40, xxxxxxxx wrote:

    Hello,

    to resolve the link of the LinkBoxGui one has to hand over the document containing the object to GetLink() as an argument. Something like this:

      
    obj = linkBox.GetLink(c4d.documents.GetActiveDocument())  
    

    best wishes,
    Sebastian



  • On 09/10/2015 at 05:03, xxxxxxxx wrote:

    hey still dont work and Plugin did not Show up when i Restart C4d lol But any other tip 😢 
    this how it looks now. And if you have a Documentation on this or More of Example doing this type of thing Plz Send it.😢

    if id == Verify_fbxBT:
                doc = c4d.documents.GetActiveDocument()
                fps = doc.GetFps()

    #-------| Get Obj  and Copy Obj From LinkBox |--------# This one Section is Killing me Guys!

    source = self.Ink_source.GetLink(c4d.documents.GetActiveDocument()))
                c4d.CallCommand(100004820, 100004820) # Copy

    #---------------| New Doc |-----------------#
                c4d.CallCommand(12094, 12094) # New

    #----| GenerateProjectSettings |----#
                doc = c4d.documents.GetActiveDocument()
                unitScale = c4d.UnitScaleData()
                unitScale.SetUnitScale(1.0,c4d.DOCUMENT_UNIT_M)
                bc = c4d.BaseContainer()
                bc[c4d.DOCUMENT_DOCUNIT] = unitScale
                doc[c4d.DOCUMENT_MINTIME] = c4d.BaseTime(self.GetLong(UI_FRAME_FROM), 30)
                doc[ c4d.DOCUMENT_MAXTIME] = c4d.BaseTime(self.GetLong(UI_FRAME_TO), 30)
                doc.SetDocumentData(c4d. DOCUMENTSETTINGS_DOCUMENT, bc)

    #--------------- | Paste |-----------------#
                c4d.CallCommand(100004821, 100004821) # Paste

    #----| EXCUTE FORMAT |----#
                c4d.CallCommand(60000, 9)

    #----| KillDocument |----#
                doc = c4d.documents.GetActiveDocument()  
                c4d.documents.KillDocument(doc)

    return True



  • On 09/10/2015 at 08:50, xxxxxxxx wrote:

    Hello,

    when the plugin does not show up this properly means that there is some syntax error in your code. Do you get any error message in the console?

    Also, in your code you don't do anything with the "source" variable.

    Best wishes,
    Sebastian



  • On 09/10/2015 at 11:12, xxxxxxxx wrote:

    I got it back up and running  bro it was that line bro, so here is the Command Section, plz tell me what I am doing wrong plz?

    #-----| T.H.E__C.O.M.M.A.N.D.S__F.U.N.C.T.I.O.N.S |--------------------------------------------------#
        def Command(self, id, msg) :

    print "ID: ", id
                
            if (id == 1021) :  #<-------------------------ADD Layout
                self.LayoutFlushGroup(id=1030)
                self.newfieldindex += 1

    for newid in range(1,self.newfieldindex+1) :
                    #newid = self.newfieldindex
                    id = newid + 1030
                    fieldname = "Take Slot " + str(newid)

    self.AddStaticText(id=id, flags=c4d.BFH_CENTER, initw=250, name=fieldname, borderstyle=c4d.BORDER_NONE)
                    self.AddSeparatorH(150, flags=c4d.BFH_SCALEFIT)
                    self.GroupBegin(20001, c4d.BFH_SCALEFIT, 2, 0, "")
                    doc = c4d.documents.GetActiveDocument()
                    self.rootLinkBaseContainer = c4d.BaseContainer()
                    self.AddStaticText(id=0, flags=c4d.BFH_MASK, initw=90, name="File Name:", borderstyle=c4d.BORDER_NONE)
                    self.AddEditText(1000, c4d.BFH_SCALEFIT, 100, 0)
                    self.AddStaticText(id=0, flags=c4d.BFH_MASK, initw=150, name="Source Object:", borderstyle=c4d.BORDER_NONE)
                    self.lnk_source = self.AddCustomGui(UI_LNK_SOURCE, c4d.CUSTOMGUI_LINKBOX, "", c4d.BFH_SCALEFIT, 50, 10, self.rootLinkBaseContainer)
                    self.GroupEnd() 
            if (id == 1022) :                #remove bottom GUI field
                self.LayoutFlushGroup(id=1030)
                self.newfieldindex -= 1
                if (self.newfieldindex < 0) : self.newfieldindex = 0

    for newid in range(1,self.newfieldindex+1) :
                    #newid = self.newfieldindex
                    id = newid + newid
                    fieldname = "Take Slot " + str(newid)

    self.AddStaticText(id=id, flags=c4d.BFH_CENTER, initw=250, name=fieldname, borderstyle=c4d.BORDER_NONE)
                    self.AddSeparatorH(150, flags=c4d.BFH_SCALEFIT)
                    self.GroupBegin(20001, c4d.BFH_SCALEFIT, 2, 0, "")
                    doc = c4d.documents.GetActiveDocument()
                    self.rootLinkBaseContainer = c4d.BaseContainer()
                    self.AddStaticText(id=0, flags=c4d.BFH_MASK, initw=90, name="File Name:", borderstyle=c4d.BORDER_NONE)
                    self.AddEditText(1000, c4d.BFH_SCALEFIT, 100, 0)
                    self.AddStaticText(id=0, flags=c4d.BFH_MASK, initw=150, name="Source Object:", borderstyle=c4d.BORDER_NONE)
                    self.lnk_source = self.AddCustomGui(UI_LNK_SOURCE, c4d.CUSTOMGUI_LINKBOX, "", c4d.BFH_SCALEFIT, 50, 10, self.rootLinkBaseContainer)
                    self.GroupEnd()
                    #Group with 4 columns
                    self.GroupBegin(20001, c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT, 4, 0, "Animation Frame Timeline")
                    self.GroupBorder(c4d.BORDER_GROUP_IN)
                    self.AddStaticText(0, c4d.BFH_LEFT, 0, 0, "Start:", 0)
                    self.AddEditNumberArrows(UI_FRAME_FROM, c4d.BFH_SCALEFIT, 50, 15)
                    self.AddStaticText(0, c4d.BFH_LEFT, 0, 0, "End:", 0)
                    self.AddEditNumberArrows(UI_FRAME_TO, c4d.BFH_SCALEFIT, 50, 15)
                    self.GroupEnd()
                    self.AddButton(1022, c4d.BFH_RIGHT, initw=160, name="Remove Take Slot")
                    self.GroupBegin(id=1044, flags=c4d.BFH_FIT, cols=1)
                    self.AddSeparatorH(150, flags=c4d.BFH_SCALEFIT)               
                    self.GroupEnd()
                    doc = c4d.documents.GetActiveDocument()
                    self.SetLong(UI_FRAME_FROM, doc[c4d.DOCUMENT_MINTIME].GetFrame(doc.GetFps()))
                    self.SetLong(UI_FRAME_TO, doc[c4d.DOCUMENT_MAXTIME].GetFrame(doc.GetFps()))

    self.LayoutChanged(id=1030)            
                return True

    if id == Verify_fbx_Close_BT:
                self.Close()

    if id == Verify_fbxBT: #<-----This is the (Bake & Export Takes) Button 
                #gui.MessageDialog("This feature is Still IN Development!", c4d.GEMB_OK)
                doc = c4d.documents.GetActiveDocument()
                fps = doc.GetFps()

    #-------| GET OBJECT And COPY OBJECT From LinkBox |--------#

    This is the Problem?
    

    UI_LNK_SOURCE = self.Ink_source.GetLink(c4d.documents.GetActiveDocument(doc)))
                c4d.CallCommand(100004820, 100004820) # Copy

    #---------------| New Doc |-----------------#
                c4d.CallCommand(12094, 12094) # New

    #----| GenerateProjectSettings |----#
                doc = c4d.documents.GetActiveDocument()
                unitScale = c4d.UnitScaleData()
                unitScale.SetUnitScale(1.0,c4d.DOCUMENT_UNIT_M)
                bc = c4d.BaseContainer()
                bc[c4d.DOCUMENT_DOCUNIT] = unitScale
                doc[c4d.DOCUMENT_MINTIME] = c4d.BaseTime(self.GetLong(UI_FRAME_FROM), 30)
                doc[ c4d.DOCUMENT_MAXTIME] = c4d.BaseTime(self.GetLong(UI_FRAME_TO), 30)
                doc.SetDocumentData(c4d. DOCUMENTSETTINGS_DOCUMENT, bc)

    #--------------- | Paste |-----------------#
                c4d.CallCommand(100004821, 100004821) # Paste

    #----| EXCUTE FORMAT |----#
                c4d.CallCommand(60000, 9)

    #----| KillDocument |----#
                doc = c4d.documents.GetActiveDocument()  
                c4d.documents.KillDocument(doc)

    return True 
    #-------------------------------------------| END OF F.U.N.C.T.I.O.N.S |------------------------------------------#
    PLZ HELP,
    Ashton



  • On 16/10/2015 at 09:48, xxxxxxxx wrote:

    Hello,

    GetActiveDocument() does not take any argument. Please consult the documentation to learn details like this.

    Best wishes,
    Sebastian


Log in to reply