Jump to content


Regular Member
  • Content Count

  • Joined

  • Last visited

Community Reputation

4 Noble Beginner

About Myosis

  • Rank
    Cafe Ronin

Profile Information

  • First Name
  • Last Name

Cinema 4D Information

  • C4D Version
    19.024 Studio

Recent Profile Visitors

640 profile views
  1. @Cairyn Thank you very much, it worked out great! You've helped me on numerous occasions (various topics) and I am very grateful. Been going down a rabbit hole on how to dynamically change the window size for when the group gets folded / unfolded. Figured this is a different topic so made a new thread for this: Cheers
  2. Hi, Preferably I don't want the user to resize the dialog window, but it doesn't seem possible when using a DLG_TYPE_ASYNC type dialog. I also gave up on trying to dynamically resize the dialog for when a group 'in the dialog' gets folded/unfolded, but that simply doesn't seem possible. Closest I came was closing it and reopening it in a different size. This worked to a certain extent but not without flaws. I got that idea from here So I stopped caring about the empty space when a group gets folded. But I want upon startup that the dialog “at least” goes back to its original shape. (the smallest it can be) Defaulth=0, defaultw=0 are only useful on the very first time opening. When the user resizes this c4d seems to prioritize this and saves it. So do I use RestoreLayout for this?
  3. Works very nice! I couldn't find an example of this online, I'm sure this will help others too, thank you very much! @Cairyn When I set the value of: flagSubgroupClosed = False To True it doesn't seem to be folded upon opening. Any idea what might cause that ? Side question: Tab groups, and quick tabs, don't work in a DLG_TYPE_ASYNC modal window, do they ? Cheers!
  4. Hi, Does anyone know why the button is not in/under the foldable subgroup? import c4d from c4d import gui class Fold(gui.GeDialog): def CreateLayout(self): self.SetTitle('') # create a quicktab self.GroupBegin(1011, c4d.BFH_SCALEFIT, 0, title = '') bc = c4d.BaseContainer() bc.SetBool(c4d.QUICKTAB_BAR, True) bc.SetString(c4d.QUICKTAB_BARTITLE, 'title') bc.SetBool(c4d.QUICKTAB_BARSUBGROUP, True) subgroup = self.AddCustomGui(122, c4d.CUSTOMGUI_QUICKTAB, '', c4d.BFH_SCALEFIT, 0, 0, bc) #foldable group ? self.GroupBegin(122, flags=c4d.BFH_SCALEFIT, cols=1, rows=1, title='', groupflags=0) self.AddButton(123, c4d.BFH_SCALEFIT, 0, 0, 'Button') self.GroupEnd() return True def main(): dlg = Fold() dlg.Open(c4d.DLG_TYPE_MODAL) if __name__=='__main__': main() c4d.EventAdd()
  5. @Cairyn Spent some time comparing the two and learned a bunch. I can see that I was pretty far-off. For some reason I thought I had to look at them individually. Your code makes a lot more sense, and works like a charm! I cannot thank you enough for helping me out with this, so I might give your patreon a try Thank you
  6. Once I cleared all empty selection tags, I'm left with 1 selection tag on each model, but I'm also I'm left with a bunch of texture tags. I want to remove all texture tags that are no longer referring to existing selection tags. But most of the texture tags still have a name in their selection "c4d.TEXTURETAG_RESTRICTION" (but that selection tag no longer exist). So I don't think I can use None in this case. My thought was to compare the names of each tag and remove if is doesn't match If I change the if not to, just if the scripts works reversed, I now remove all texture tags that are referring to existing selection tags. Hence the reason I tried if not, or else: but they both don't seem to be the solution. I hope I was able to explain myself clearly
  7. I'm now trying the same for texture tags I would like to remove them if there are no longer bound to an active selection tag. So I'm running along each tag looking for [c4d.TEXTURETAG_RESTRICTION] And if it contains the name of any active selection tag [c4d.ID_BASELIST_NAME] Code here: import c4d def iter_hierarchy(op): for tag in op.GetTags(): t = op.GetFirstTag() while t: if t.GetType() == c4d.Tpolygonselection: tagselection = t.GetBaseSelect() name = t[c4d.ID_BASELIST_NAME] print name if tag.CheckType(c4d.Ttexture): texname = tag[c4d.TEXTURETAG_RESTRICTION] if not name in texname: doc.AddUndo(c4d.UNDOTYPE_DELETE, tag) tag.Remove() t = t.GetNext() print 'run new tag' for child in op.GetChildren(): iter_hierarchy(child) def main(): for op in doc.GetObjects(): iter_hierarchy(op) c4d.EventAdd() main() If anyone can see the flaw, it would be the final piece to the puzzle for me! My guess is that I'm doing something wrong in the texture tag restriction ?
  8. Oops faceplam, thank you! Works perfect now, super happy
  9. It should be something like this? for tag in op.GetTags(): if tag.CheckType(c4d.Tpolygonselection): tagselection = tag.GetBaseSelect() tagselection.GetCount() print tagselection.GetCount() if tagselection.GetCount()>= 0: doc.AddUndo(c4d.UNDOTYPE_DELETE, tag) tag.Remove() else: return Again I'm not very experienced. At the moment its removing all tags. It isn't reading the 0 part properly?
  10. @Cairyn Yes if the GetCount is 0 I would like to remove the tag But I can't figure out how to write that particular line
  11. @Cairyn Is it possible you could show me an example of how to implement this in a small script ? I managed to see the poly count in the console with your advice: tagselection = tag.GetBaseSelect() tagselection.GetCount() print tagselection.GetCount() But I'm not sure how to continue the script if it reads 0
  12. @Cairyn That sounds interesting! Not that experienced yet, but will try to puzzle a bit more with the info you gave me, thanks
  13. @Cairyn Thanks for the response. That's the thing, I’m not even sure how to tackle this: import c4d def iter_hierarchy(op): for tag in op.GetTags(): if tag.CheckType(c4d.Tpolygonselection) and not [ something here that says there are 0 polygons or points, or when size is 0 ?]: doc.AddUndo(c4d.UNDOTYPE_DELETE, tag) tag.Remove() for child in op.GetChildren(): iter_hierarchy(child) def main(): for op in doc.GetObjects(): iter_hierarchy(op) c4d.EventAdd() main() But it would probably look something like this ? Let me know if you have a solution
  14. I am trying to remove empty polygon selection tags using python. It doesn't sound hard but I’m not getting anywhere, does anyone knows how to do it?
  15. I'm a bit lost, maybe someone can help me out. Here a simple modal example: import c4d from c4d import gui class TestDialog(gui.GeDialog): def CreateLayout(self): self.AddButton(1014, c4d.BFH_SCALEFIT, 100, 17, 'Close') return True def Command(self, id, msg): if id == 1014: #CLOSE BUTTON self.Close() return c4d.gui.GeDialog.Command(self, id, msg) def AskClose(self): return False if __name__=='__main__': dialog = TestDialog() dialog.Open(dlgtype=c4d.DLG_TYPE_ASYNC,) c4d.EventAdd() I want a dialog box with a grayed out or disable X button. I can change it to a different dlgtype, but those are not really what I need. Can I overwrite the “DLG_TYPE_MODAL” ?
  • Create New...