Jump to content


Regular Member
  • Content Count

  • Joined

  • Last visited

Community Reputation

3 Noble Beginner

About Myosis

  • Rank
    Cafe Ronin

Profile Information

  • First Name
  • Last Name
  • C4D Ver
    19.024 Studio

Recent Profile Visitors

510 profile views
  1. 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” ?
  2. 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)
  3. @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.
  4. 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!
  5. 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! :)
  6. I'm working around it for now, its working pretty great, thanks again ;)
  7. I'm trying to remove the Tag once it's done baking
  8. @kalugin Your the best! Ah so it was, GetInt32, should have tried. This part I would have never guessed, thanks for explaining it :) The self.GetColorField(BACKGROUND_COLOR)['color'] tag = doc.GetActiveObject().MakeTag(c4d.Tbaketexture) # this creates the tag and applies it to the active object This is great! Again thanks so much for adding this. It works perfectly. Very happy :)) I guess I have one question: I now made it auto start the baking process, and I’m looking to perform some actions after the "Initializing process". If you bake something, you would see 3 phases in your "status bar" bottom left. Initializing , Rendering texture.., and finally: Baking completely --:--. I’m trying to revert that was has been done after the load process. How can I access this process, basically make the script wait for it to be done? Maybe you know how to do it? Super grateful, for your help before, can't thank you enough :)
  9. Hi, I'm working on a script that opens a dialog window and creates a tag from some basic options In this case a Bake Tag I am very new and inexperienced in scripting, learning slowly. I got it to work by looking at lot of examples and trying a whole bunch of stuff.. It works for the most part, the only part that does not work are: “Number Arrows” And “Background color” I’m thinking the problem is in the #saving values so the rest of the script can access them The "Check boxes" work fine: self.option_color = self.GetBool(OPTION_COLOR) self.option_AO = self.GetBool(OPTION_AO) And this is what I tried with the Background and Arrow numbers: self.option_BG = self.GetColorField(BACKGROUND_COLOR) self.option_width = self.GetReal(OPTION_WIDTH) self.option_hight = self.GetReal(OPTION_HIGHT) Not that sure about .GetColorField But I really thought the .GetReal was going to work. Does anyone know what I’m doing wrong? Probably whole bunch of stuff Here the entire script import c4d from c4d import gui #Welcome to the world of Python #Unique id numbers for each of the GUI elements BACKGROUND = 1000 BACKGROUND_COLOR = 1001 GROUP_OPTIONS = 10000 OPTION_COLOR = 10001 OPTION_AO = 10002 GROUP_BUTTONS = 20000 BUTTON_OK = 20001 BUTTON_CANCEL = 20002 OPTION_WIDTH = 20003 OPTION_HIGHT = 20004 #This class defines the dialogue that pops up to request user options class OptionsDialog(gui.GeDialog): #Add all the items we want to show in the dialogue box def CreateLayout(self): #Bake cehck box self.GroupBegin(GROUP_OPTIONS, c4d.BFH_SCALE|c4d.BFH_LEFT, 1, 2) self.AddCheckbox(OPTION_COLOR, c4d.BFH_LEFT, 0,0, name="Color") self.AddCheckbox(OPTION_AO, c4d.BFH_LEFT, 0,0, name="AO") self.GroupEnd() #BG color self.AddStaticText(BACKGROUND, c4d.BFH_LEFT, name="Background Color") self.AddColorField(BACKGROUND_COLOR, c4d.BFH_SCALEFIT, 80, 12) #Group name self.GroupBegin(10000, c4d.BFH_SCALEFIT, 1, title = 'Texture size') self.GroupBorder(c4d.BORDER_GROUP_IN) self.GroupBorderSpace(20, 5, 20, 5) #Arrow numbers self.AddEditNumberArrows(OPTION_WIDTH, c4d.BFH_SCALEFIT, 50, 0) self.AddEditNumberArrows(OPTION_HIGHT, c4d.BFH_SCALEFIT, 50, 0) #Buttons - an OK and a CANCEL button self.GroupBegin(GROUP_OPTIONS, c4d.BFH_CENTER, 2, 1) self.AddButton(BUTTON_OK, c4d.BFH_SCALE, name="Set") self.AddButton(BUTTON_CANCEL, c4d.BFH_SCALE, name="Cancel") self.GroupEnd() return True #This is where we react to user input (eg button clicks) def Command(self, id, msg): if id==BUTTON_CANCEL: #The user has clicked the 'Cancel' button self.ok = False self.Close() elif id==BUTTON_OK: #The user has clicked the 'OK' button self.ok = True #Save the checkbox values so that the rest of the script can access them self.option_color = self.GetBool(OPTION_COLOR) self.option_AO = self.GetBool(OPTION_AO) self.option_BG = self.GetColorField(BACKGROUND_COLOR) self.option_width = self.GetReal(OPTION_WIDTH) self.option_hight = self.GetReal(OPTION_HIGHT) self.Close() return True #This is where the action happens def main(): #Open the options dialogue to let users choose their options optionsdialog = OptionsDialog() optionsdialog.Open(c4d.DLG_TYPE_MODAL, defaultw=300, defaulth=50) #Quit if the user has clicked cancel if not optionsdialog.ok: return #create tag def tool(): return plugins.FindPlugin(doc.GetAction(), c4d.PLUGINTYPE_TOOL) def object(): return doc.GetActiveObject() def tag(): return doc.GetActiveTag() def renderdata(): return doc.GetActiveRenderData() def prefs(id): return plugins.FindPlugin(id, c4d.PLUGINTYPE_PREFS) c4d.CallCommand(100004788, 50005) # New Tag tag()[c4d.BAKETEXTURE_CHANNEL_COLOR] = (optionsdialog.option_color) tag()[c4d.BAKETEXTURE_CHANNEL_AO] = (optionsdialog.option_AO) tag()[c4d.BAKETEXTURE_WIDTH] = (optionsdialog.option_width) tag()[c4d.BAKETEXTURE_HEIGHT] = (optionsdialog.option_hight) tag()[c4d.BAKETEXTURE_BACKGROUND] = c4d.Vector(optionsdialog.option_BG) if __name__=='__main__': main() Probably a wonder that it works at all, but I'm proud of my small achievements non the less, and feel like I'm very close to finessing it. If you know the solution, help a brother out ;) Cheers
  10. Myosis

    Adding camera script

    Hey @kalugin and @Cerbera Thanks for the replay! By camera resolution I mean the render output. This is by default: 1280 x 720. I’m using R19.024 studio. Would be great if you guys could help! or help me steer in the right direction.
  11. Hi, Is there a way to frame a object by whatever your render resolution is? Much like pressing S or O but then keeping the ‘selected object’ within your resolution. (Instead of view port dimensions)
  12. Hi all I would like to ask all scripting geniuses a question. How do I add multiple Cameras with Projection: Front, Back, Left, Right, Top, and Bottom. And make them all frame a selected object by camera resolution? These are the steps I would like to see in a script, First: Select object I want to frame script: 1 Create camera, select property: Projection Front 2 Go in the camera view 3 Press S to frame the selected object ,. But wait! If I press S the camera frames by the viewport dimensions and not by the 'users set' camera resolution, how do I frame the object by camera resolution? And can anyone help me write this script? It would mean the world to me! Hope to hear something :)

About Us

C4D Cafe is the largest Cinema 4D community. We provide facilities for discussion, showcasing and learning our favourite software.
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, watch tutorials directly from our video gallery,  get your own private messenger, post and upload images, manage your profile and much more. If you need to find solution to your problem or otherwise ask for help, C4D Cafe is the right place to be for learning 3D.  :cowboypistol:

  • Create New...