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).
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
Hello,
It is not working, and script isn't executable as I said in previously message,
thank you for your reply,
Regards
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()
@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?
Thank you for reply!
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
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
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()
This Example 2 works but I dont have combobox or droping menu:
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!