Navigation

    • Register
    • Login
        No matches found
    • Search
    1. Home
    2. referent
    R

    referent

    @referent

    0
    Reputation
    7
    Posts
    50
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    • Profile
    • More
      • Following
      • Followers
      • Topics
      • Posts
      • Best
      • Groups
    referent Follow

    Best posts made by referent

    This user hasn't posted anything yet.

    Latest posts made by referent

    RE: Python Scripting-Help with GeDialog.AddComboBox add child option

    Wow! Thank you soooooooooooo much!

    Those parts were missing. Works like a charm now! 🙂

    can't thank you enough!

    We can close now this topic

    posted in Cinema 4D SDK •
    RE: Python Scripting-Help with GeDialog.AddComboBox add child option

    Hello,

    It is not working, and script isn't executable as I said in previously message,

    thank you for your reply,

    Regards

    posted in Cinema 4D SDK •
    RE: Python Scripting-Help with GeDialog.AddComboBox add child option

    import c4d
    from c4d import gui
    #Welcome to the world of Python

    class TestDialog(gui.GeDialog):

    def CreateLayout(self):
    
        self.AddComboBox(5000, c4d.BFH_LEFT, 100, 10, False)
        self.AddChild(5000, 0, "Child 0")
        self.AddChild(5000, 1, "Child 1")
        self.AddChild(5000, 2, "Child 2")
    
        return True
    
    def Command(self, id, msg):
    
        # print currently selected "child""
        if id == 5000:
            value = self.GetInt32(5000)
            print("got value: " + str(value))
    
    
        return c4d.gui.GeDialog.Command(self, id, msg) 
    
    # custom function
    def GetSelectedChild(self):
        return self.GetInt32(5000)
    

    def main():
    dialog = TestDialog()

    dialog.Open(c4d.DLG_TYPE_MODAL_RESIZEABLE, 132456, -1 ,-1 ,400 ,400)
    
    value = dialog.GetSelectedChild()
    
    op.SetName(str(value))
    c4d.EventAdd()
    

    if name=='main':
    main()

    posted in Cinema 4D SDK •
    RE: Python Scripting-Help with GeDialog.AddComboBox add child option

    7fa52105-f8bc-492d-bd56-e75e84a81179-image.png

    posted in Cinema 4D SDK •
    RE: Python Scripting-Help with GeDialog.AddComboBox add child option

    @s_bach Hello Sebastian!

    The main issue is when I implement command and custom member function into the whole script how you suggest in to previously reply, nothing happening and the script wouldn't work.Or when I just copy your code example in to script manager nothing happening,I am using R17 if that can maybe be one of the reasons why script not work?

    class TestDialog(gui.GeDialog):

    def CreateLayout(self):
    
        self.AddComboBox(5000, c4d.BFH_LEFT, 100, 10, False)
        self.AddChild(5000, 0, "Child 0")
        self.AddChild(5000, 1, "Child 1")
        self.AddChild(5000, 2, "Child 2")
    
        return True
    
    def Command(self, id, msg):
    
        # print currently selected "child""
        if id == 5000:
            value = self.GetInt32(5000)
            print("got value: " + str(value))
    
    
        return c4d.gui.GeDialog.Command(self, id, msg) 
    
    # custom function
    def GetSelectedChild(self):
        return self.GetInt32(5000)
    

    def main():
    dialog = TestDialog()

    dialog.Open(c4d.DLG_TYPE_MODAL_RESIZEABLE, 132456, -1 ,-1 ,400 ,400)
    
    value = dialog.GetSelectedChild()
    
    op.SetName(str(value))
    c4d.EventAdd()
    

    Thank you for reply!

    Regards

    posted in Cinema 4D SDK •
    RE: Python Scripting-Help with GeDialog.AddComboBox add child option

    Hi Sebastian! Thanks a lot for your reply!!!

    and for clarifying me about posting and categories

    I couldn't figure out at the end to add command and that all complete script works by example that you send me here.

    Maybe I wasn't clear enough of what I trying to do and to get as the final result.

    My goal is that I make preset with names e.g child 0-or final name "Bath" and when I run script and chose from dropping menu of combo box e.g name "Bath" or some other next selection child 2 or final name "Patio" by selection from item with ready name "Patio" script and code automatically rename new spline based on selection from combobox eg I draw new Spline> and when I select from combo box child's selection Patio command will automatically rename spline to Patio,if is that possible? Plugin cafe is simply awesome,and I am happy so happy to discover it.
    Thanks a lot for your reply!

    Best Wishes

    Nenad

    posted in Cinema 4D SDK •
    Python Scripting-Help with GeDialog.AddComboBox add child option

    Hi everyone,

    I am new with python scripting so I stuck with this and sorry for my question

    I trying to make a script -later plugin also that will rename automatically e.g.spline by selection from combo box menu with new selected name
    is there a way to add children -6+ options to combo box and send rename command based on a selection from combo box? Here is what I mean and a sample .I find 2 ways for this but I would like to have combobox selection and dropping menu 0_1550960540480_07f88f3d-f799-4997-b4a2-6c88be2cb93a-image.png

    Here are 2 examples that I make:

    Example 1:

    import c4d
    from c4d import gui

    #Dialog settings
    class MyDialogs(gui.GeDialog):
    # Dialog layout settings
    def CreateLayout(self):
    self.SetTitle('Spline Renamer 1.1')
    #Setting widget etc.
    self.GroupBegin(10000, c4d.BFH_SCALEFIT, 1, title = 'Select New Spline Name')
    self.GroupBorder(c4d.BORDER_GROUP_IN)
    self.GroupBorderSpace(20, 5, 20, 5)

        #Drop menu
        self.AddComboBox(1000, c4d.BFH_SCALEFIT, 80, 0, False)
        self.AddChild(1000, 0, 'B1')
        self.AddChild(1000, 1, 'B2')
        self.AddChild(1000, 2, 'B3')
        self.AddChild(1000, 3, 'B4')
        self.AddChild(1000, 4, 'Main')
        self.AddChild(1000, 5, 'Outer')
        self.AddChild(1000, 6, 'Patio')
        self.AddChild(1000, 7, 'Bath 1')
        self.AddChild(1000, 8, 'Bath 2')
        self.AddChild(1000, 9, 'Bath 3')
        self.AddChild(1000, 10, 'WIC')
        self.AddSeparatorV(11)
        self.AddDlgGroup(c4d.DLG_OK|c4d.DLG_CANCEL)
        return True
    

    def main():
    dlg = MyDialogs()
    dlg.Open(c4d.DLG_TYPE_MODAL)

    if name=='main':
    main()
    c4d.EventAdd()

    if name=='main':
    main()

    This Example 2 works but I dont have combobox or droping menu:

    import c4d
    from c4d import gui

    def main():
    objs = doc.GetActiveObjects(1)
    if len(objs) == 0:return

    newName = gui.InputDialog("New Name","B1")
    if newName == "":return
    
    num = gui.InputDialog("Are you sure?","B1")
    if num == "":return
    
    doc.StartUndo()
    for obj in objs:
        doc.AddUndo(c4d.UNDOTYPE_CHANGE,obj)
        obj.SetName(newName +" ")
      
    GeDialog.SetPopup("B 12 ", " B 22")
    doc.EndUndo()
    c4d.EventAdd()
    

    Thanks you so much for any of your help and for your time,

    have a great day!

    posted in Cinema 4D SDK •