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
  • C4D Version
    19.024 Studio

Recent Profile Visitors

590 profile views
  1. @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
  2. 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
  3. 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 ?
  4. Oops faceplam, thank you! Works perfect now, super happy
  5. 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?
  6. @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
  7. @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
  8. @Cairyn That sounds interesting! Not that experienced yet, but will try to puzzle a bit more with the info you gave me, thanks
  9. @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
  10. 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?
  11. 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” ?
  12. Here the a result review from the video. You can see that around the edges there are some weird lines that need to be cleaned up. Inside / around the dotted lines. "For this I use the clone tool in body paint" Btw: There is more then one video in the post, showing Ambient Occlusion and Normal map baking as well. (The first image is just the view port, not a render output)
  13. @zeden Glad you like it! It's a bit technical. Every normal of the “boundary” has to look at your mesh, The problem with hard surface is that with very tight corners the “boundary” looks at itself before hitting the mesh. Resulting in a black area. (the corner) It's doable depending on the shape. Some shapes are too much work to clean up with the clone tool and are probably better off using other methods.
  14. Hi there, I made a plugin that mimics a render to texture kind of process. it's not perfect, but the results are good enough to quickly fix any mistakes by hand with a clone tool. It works with both standard an physical. Better at organic shapes then hard surface ones. For me it's good enough to use on a professional level. Videos can be watched here: Instagram post Let me know what you think of it, bear in mind it's my first ever plugin. Have done a lot of online research, in the SDK, on plugincafe, and here on c4d cafe!
  15. Hi, I'm making a pretty simple script, but I can find very little documentation on the following: I want to create a bitmap with a preset ‘Height’, ‘Width’, and ‘Random Background color’ on the Luminance channel. Preferably using a SaveDialog, to choose a directory for the bitmap. So far I haven't been able to find any example of this, and I'm fairly new and inexperienced to scripting. Maybe someone here can help me out. As you can see I'm struggling quite a bit, I'm trying to let c4d generate a bitmap on the Luminance channel, 600x600, as a png, and no background. import c4d import bitmaps def main(): # create material Mat = c4d.BaseMaterial(5703) Mat[c4d.ID_BASELIST_NAME] = "4K Preview" doc.InsertMaterial(PrintMat) Mat[c4d.MATERIAL_USE_COLOR] = False Mat()[c4d.MATERIAL_USE_LUMINANCE] = True Mat()[c4d.MATERIAL_USE_REFLECTION] = False Mat()[c4d.MATERIAL_PREVIEWSIZE] = 12 # change sizing to 4k preview mode # create bitmap (i have no clue, this is just a rough idea) """ filePath = "C:\Users\PCname\Desktop\test.png" #or a SaveDialog somehow res = 600 texture = bitmaps.BaseBitmap() texture.Init(res,res) texture.Save(filePath,c4d.FILTER_PNG) """ # Would i then apply the bitmap back using something like this? fn = c4d.storage.GeGetC4DPath(c4d.C4D_PATH_DESKTOP) #Gets the desktop path pathToTexture = os.path.join(fn,'test.png') #Gets the specific texture image on your desktop mat = doc.GetActiveMaterial() #Assign the active material a variable shdr_texture = c4d.BaseList2D(c4d.Xbitmap) #Create a bitmap shader in memory shdr_texture[c4d.BITMAPSHADER_FILENAME] = pathToTexture #Assign the path to the texture image to your shader mat[c4d.MATERIAL_LUMINANCE_SHADER]= shdr_texture #Assign the shader to the luminace channel in memory only mat.InsertShader(shdr_texture) #Insert the shader into the luminace channel mat.Update(True, True) #Re-calculate the thumbnails of the material if __name__=='__main__': main() c4d.EventAdd() If someone knows more about this topic, I would love to hear it! :)

Latest Topics

Latest Comments

  • Create New...