Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login
    1. Maxon Developers Forum
    2. Helper
    3. Posts
    H
    • Profile
    • Following 0
    • Followers 1
    • Topics 10,139
    • Posts 51,694
    • Best 1
    • Controversial 0
    • Groups 0

    Posts made by Helper

    • Script Write to Annotation Tag on Save

      On 31/08/2018 at 07:42, xxxxxxxx wrote:

      I can't seem to figure out how to get
      MSG_DOCUMENTINFO_TYPE_SAVE_BEFORE
      to trigger.

      I would like to save some info to an Annotation tag, but only right before the user saves the document.

      Tried to put it in Message() but couldn't figure out if Message can stand by itself or if it has to be in a NodeData class?

      class SampleClass(plugins.NodeData) :
          def Message(self, node, type, data) :
              if type == c4d.MSG_DOCUMENTINFO:
                  if data['type'] == c4d.MSG_DOCUMENTINFO_TYPE_SAVE_BEFORE:
                      print "Document is about to save"
                      return True
                  return True
      

      Thanks

      posted in PYTHON Development
      H
      Helper
    • RE: Outline selection?

      On 31/08/2018 at 05:31, xxxxxxxx wrote:

      Hi fnoller,

      I'm afraid, as mentioned here there is no direct way to use our internal command for select outline.
      You get a basic implementation of the comment from Donovan by Cesar Vonc [URL=https://code.vonc.fr/?a=100#f-SelectionneAretesContour] which might help you.

      If you have any question please let me know.
      Cheers,
      Maxime!

      posted in PYTHON Development
      H
      Helper
    • Outline selection?

      On 30/08/2018 at 13:12, xxxxxxxx wrote:

      Hi all,

      How can I select the outline edges of selected polygons in python, just like the command "Outline Selection"?

      Best regards

      Fnoller

      posted in PYTHON Development
      H
      Helper
    • RE: Art shader, or load from content browser ?

      On 31/08/2018 at 04:07, xxxxxxxx wrote:

      Hi Myosis, first of all, welcome in the plugincafe community!

      Even if shader didn't get a proper symbols name, each BaseList2D get an ID. And symbols only refer to this ID.
      So if you want to know the current ID of an Art shader. Simply create a shader in a material, then drag and drop the channel where the shader is into the console. Press enter and it will print you the ID.
      For the art shader, it's 1012161.

      About bitmap do the same technique, simply drag and drop the parameter into the console to know the parameter ID.

      Then you can create it using the following script

      import c4d
        
      def main() :
          mat = doc.GetActiveMaterial()
          if not mat:
              return
          
          # Create the bitmap shader
          bmpShader = c4d.BaseShader(c4d.Xbitmap)
          bmpShader[c4d.BITMAPSHADER_FILENAME] = "YourTexturePath"
          
          # Create a art Shader and insert our bmp shader
          artShader = c4d.BaseShader(1012161)
          artShader.InsertShader(bmpShader)
          artShader[c4d.ARTSHADER_TEXTURE] = bmpShader
          
          # Then insert our art Shader into the active material, and use it in the color channel
          mat.InsertShader(artShader)
          mat[c4d.MATERIAL_COLOR_SHADER] = artShader
          
          c4d.EventAdd()
        
      if __name__=='__main__':
          main()
      

      As you already figured out, in python the only way to load stuff from content browser is to use LoadFile/MergeDocument.

      If you have any question, please let me know!
      Cheers,
      Maxime!

      posted in PYTHON Development
      H
      Helper
    • RE: Art shader, or load from content browser ?

      On 30/08/2018 at 23:11, xxxxxxxx wrote:

      I figured out how to load the material form the content browser:

      > doc = c4d.documents.GetActiveDocument()
      >
      > location = "preset://somefolder.lib4d/mymat"
      >
      > c4d.documents.MergeDocument(doc, location, c4d.SCENEFILTER_MATERIALS)

      But I prefer creating the material in python rather then loading it, if anyone knows how to access and apply the Art shader, let me know 😉

      - Tim

      posted in PYTHON Development
      H
      Helper
    • Art shader, or load from content browser ?

      On 30/08/2018 at 02:01, xxxxxxxx wrote:

      Hi,

      First off I'm new here, and also very new with python.
      I'm trying to create a pretty basic material using python, but it seems not so easy.

      I have two questions:
      How can I add the Art shader to a channel?

      It's not listed in the SDK shader list.
      So it's probably not like I'm just missing the right word here, is it ?

      > matt[c4d.MATERIAL_USE_LUMINANCE] = True
      >
      > Art = c4d.BaseList2D(c4d.X...something.....)
      >
      > matt.InsertShader( Art )
      >
      > matt[c4d.MATERIAL_LUMINANCE_SHADER] = Art

      I also want it to load a image in the art shader, so I figured, why don't I just create a preset folder in the content browser and load the material form that folder. 
      Turns out it's quite tricky to import materials from the content browser too.

      > fn = "preset://somefolder/Cube.2.c4d"
      >
      > c4d.documents.LoadFile(fn)

      If I use anything else then LoadFile, it will tell me to use a base document in the console.

      From my understanding, I have to make a virtual base document and then import it from that.
      How does that look like in code ?

      I only need one to work, but I am very interested in both!

      Cheers,
      Tim

      posted in PYTHON Development
      H
      Helper
    • RE: Rectangle selection BUG

      On 30/08/2018 at 10:47, xxxxxxxx wrote:

      Hi,

      as Sebastian already pointed out last time, this is a forum for 3rd party developers. We can not help you with bugs not related to the SDKs here. Please contact our user support via the form on our main website: How can we help?

      posted in Bugs
      H
      Helper
    • Rectangle selection BUG

      On 29/08/2018 at 13:58, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   19 
      Platform:   Windows  ;   
      Language(s) :       PYTHON  ;

      ---------
      Still Cinema have a GREAT BUG of simple selection

      video of a bug


      posted in Bugs
      H
      Helper
    • RE: Launch color picker dialog

      On 30/08/2018 at 11:15, xxxxxxxx wrote:

      Hi,

      if I understand correctly, you want the entire Color Picker dialog, not just the color picker "action" you get, when clicking onto the pipette icon in color chooser, right?
      The color picker dialog can be opened with GeChooseColor(). The color pick action on the other hand is implemented internally and can not be started via the API.

      posted in SDK Help
      H
      Helper
    • Launch color picker dialog

      On 29/08/2018 at 05:26, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   R18 
      Platform:   Windows  ;   
      Language(s) :     C++  ;

      ---------
      Hello.

      I have my custom GeUserArea in a CustomGui parameter.
      I want to click that User Area and launch the Color Picker modal dialog as happens with ColorField dialog parameter or COLOR description parameter.

      Can I do that ?

      Thank you.

      posted in SDK Help
      H
      Helper
    • RE: "Connect Objects" in a Generator?

      On 29/08/2018 at 13:29, xxxxxxxx wrote:

      Of course.  Thanks Riccardo!

      posted in PYTHON Development
      H
      Helper
    • RE: "Connect Objects" in a Generator?

      On 29/08/2018 at 02:53, xxxxxxxx wrote:

      Hi Rasha, the Connect Object functionality is delivered by the MCOMMAND_JOIN.

      Best, Riccardo

      posted in PYTHON Development
      H
      Helper
    • RE: "Connect Objects" in a Generator?

      On 29/08/2018 at 02:21, xxxxxxxx wrote:

      I did not see the "Connect Object" modeling commands represented in MCOMMAND (https://developers.maxon.net/docs/py/2023_2/consts/MCOMMAND.html)

      Is it available somewhere that I missed?

      posted in PYTHON Development
      H
      Helper
    • RE: "Connect Objects" in a Generator?

      On 29/08/2018 at 02:18, xxxxxxxx wrote:

      Hi RashaMatt, thanks for writing us.

      With regard to your support request there are two options either viable.

      The first is to take advantage of the modelling commands delivered in Cinema 4D by using the c4d.utils.SendModelingCommand() and use the appropriate command to achieve the desired behavior.

      The second option is to hard code the merging operation directly in the generator by accessing the information about mesh points position and mesh polygons index for each entity you want to get merged, then by merging this data in a single mesh and finally by disposing the original meshes (if really needed).

      Best, Riccardo

      posted in PYTHON Development
      H
      Helper
    • "Connect Objects" in a Generator?

      On 28/08/2018 at 23:16, xxxxxxxx wrote:

      Is there a way to do the equivalent of "Connect Objects" (or "Connect and Delete") in a Python Generator?

      I am creating a hierarchy of groups of groups of polys, and the viewport is very slow. Perhaps it would be faster if I could convert it to a single poly object and optimize it?

      posted in PYTHON Development
      H
      Helper
    • RE: CommandData Plugin with submenu

      On 31/08/2018 at 00:22, xxxxxxxx wrote:

      Your workaround with a popup dialog sounds too hacky to me.

      The command can be registered with c4d.PLUGINFLAG_HIDEPLUGINMENU flag (plugin won't be shown in "Plugins" menu).
      Then manually add the command to any other menu/command palette with "Customize Commands" and "Customize Menu". The menu structure returned by the command's GetSubContainer() should be dynamically added as expected.

      Note it is possible to customize the Cinema menu by code from a plugin.

      If you have questions related to another subject, please create a new thread.

      posted in PYTHON Development
      H
      Helper
    • RE: CommandData Plugin with submenu

      On 30/08/2018 at 14:58, xxxxxxxx wrote:

      a followup question to the post above:

      ShowPopupDialog() has these flags 
      c4d.POPUP_ALLOWUNDOCK
      c4d.POPUP_ALLOWUNDOCK_REC

      https://developers.maxon.net/docs/py/2023_2/modules/c4d.gui/index.html?highlight=first_popup_id#c4d.gui.ShowPopupDialog

      what are these for?
      i was hoping that you get a drag off handle, 
      but i cant see anything happen if i use these flags

      is there a way to make a PopupDialog sticky?
      or can i create a palette containing my command?

      best index

      posted in PYTHON Development
      H
      Helper
    • RE: CommandData Plugin with submenu

      On 30/08/2018 at 03:36, xxxxxxxx wrote:

      thanks yannick,

      i actually had that idea this morning, but couldnt make it work

      i added a 2nd pyp to the plugin with c4d.PLUGINFLAG_HIDEPLUGINMENU
      but the main pyp didnt show its submenu then

      are you sure this works?
      (maybe i dont understand correctly)
      it also needs a bogus plugin id, which is a bit odd, right?

      another approach i'm trying is:
      generate a PopupDialog and show it with ShowPopupDialog when the menu is selected (works already)
      but i would also like to be able to have a drag off window with the (main) menu items as buttons
      that could be generated by opt-selecting the menu (any tips on how to create such a window?)

      best index

      posted in PYTHON Development
      H
      Helper
    • RE: CommandData Plugin with submenu

      On 30/08/2018 at 03:03, xxxxxxxx wrote:

      Hi,

      Sorry for the late answer.

      There are limitations with GetSubContainer() and the "Plugins" menu.
      If there is only one plugin registered then its menu structure returned by GetSubContainer() is not taken into account. But if the plugin is added to another menu then it is shown as expected.

      So the solution is to register a CommandData plugin with c4d.PLUGINFLAG_HIDEPLUGINMENU flag. Then the plugin can be added to any other menu either manually or with code using the menu functions in c4d.gui module.

      posted in PYTHON Development
      H
      Helper
    • RE: CommandData Plugin with submenu

      On 30/08/2018 at 01:17, xxxxxxxx wrote:

      no help here? 
      i tried for hours, but still cant create a plugin 
      with a sub menu to execute different actions
      😕

      posted in PYTHON Development
      H
      Helper