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. nicholas_yue
    3. Posts
    N
    • Profile
    • Following 0
    • Followers 0
    • Topics 14
    • Posts 22
    • Best 2
    • Controversial 0
    • Groups 0

    Posts made by nicholas_yue

    • Finding name/handle to last object merged into scene

      After calling MergeDocument()

      merge_status = c4d.documents.MergeDocument(doc, path,
                                                 c4d.SCENEFILTER_MERGESCENE | c4d.SCENEFILTER_OBJECTS)
      

      I check merge_status to be true and wish to find some handle/name to the object associated with the call to MergeDocument(), how do I do that ?

      I tried the following on an empty scene

              doc = c4d.documents.GetActiveDocument()
              ao = doc.GetActiveObject()
      

      that works if I am calling MergeDocument for a single path but if I am calling MergeDocument (in a loop) for a collection of paths, GetActiveObject() points to the same object, not the next one corresponding to the next path I am merging into the scene

      Cheers

      posted in Cinema 4D SDK
      N
      nicholas_yue
    • C4DUnhandledExceptionFilter - debugging log ?

      I am troubleshooting a crash in C4D R21 commandline.exe on Windows 10

      Error: application crashed
      C4DUnhandledExceptionFilter: writing exception info
      C4DUnhandledExceptionFilter: writing call stacks
      

      Where are the likely place I can go to look at the exception info and call stacks that was being written out ?

      Cheers

      posted in Cinema 4D SDK
      N
      nicholas_yue
    • Object GetNext() method does not advance to next object

      We are using Arnold with C4D

      While iterating the scene, we have found that one of the node (create via the ArnoldtoC4D plugin), the GetNext() method does not return the next object but itself, this resulted in an infinite loop iterating the scene.

      Since we are now sitting between two different vendors, I am trying to narrow it down to who I need to follow up with regarding this issue.

      
      >>> doc = c4d.documents.GetActiveDocument()
      >>> obj = doc.GetFirstObject()
      >>> print(obj)
      <c4d.BaseObject object called 'Arnold distant_light/Arnold Light' with ID 1030424 at 0x0000027ACD423D10>
      >>> obj.GetNext()
      <c4d.BaseObject object called '<display driver>/Arnold Driver' with ID 1030141 at 0x0000027ACD423AD0>
      >>> obj.GetNext()
      <c4d.BaseObject object called '<display driver>/Arnold Driver' with ID 1030141 at 0x0000027ACD423FB0>
      >>> obj.GetNext()
      <c4d.BaseObject object called '<display driver>/Arnold Driver' with ID 1030141 at 0x0000027ACD423DF0>
      >>> obj.GetNext()
      <c4d.BaseObject object called '<display driver>/Arnold Driver' with ID 1030141 at 0x0000027ACD423AD0>
      >>> obj.GetNext()
      <c4d.BaseObject object called '<display driver>/Arnold Driver' with ID 1030141 at 0x0000027ACD423FB0>
      >>> obj.GetNext()
      <c4d.BaseObject object called '<display driver>/Arnold Driver' with ID 1030141 at 0x0000027ACD423DF0>
      >>> obj.GetNext()
      <c4d.BaseObject object called '<display driver>/Arnold Driver' with ID 1030141 at 0x0000027ACD423AD0>
      >>> obj.GetNext()
      <c4d.BaseObject object called '<display driver>/Arnold Driver' with ID 1030141 at 0x0000027ACD423FB0>
      >>> obj.GetNext()
      <c4d.BaseObject object called '<display driver>/Arnold Driver' with ID 1030141 at 0x0000027ACD423DF0>
      >>> obj.GetNext()
      <c4d.BaseObject object called '<display driver>/Arnold Driver' with ID 1030141 at 0x0000027ACD423AD0>
      >>> 
      

      Cheers

      posted in Cinema 4D SDK
      N
      nicholas_yue
    • RE: Dialog button hangs C4D

      @zipit There was a typo when updating to use the new IDs generated from Maxon, it has since been resolved and the plugins are loading.

      Cheers

      posted in Cinema 4D SDK
      N
      nicholas_yue
    • Alternative way to iterate list other than GetNext()?

      I am currently using this approach to iterate the objects in a document

      doc = c4d.documents.GetActiveDocument()
      obj = doc.GetFirstObject()
      next_obj = obj.GetNext()
      while next_obj:
      # Do stuff
      next_obj = obj.GetNext()

      Is there some equivalent of doing this via e.g. indexing in a for-loop ?

      Cheers

      posted in Cinema 4D SDK
      N
      nicholas_yue
    • RE: Dialog button hangs C4D

      I have generated the IDs from the site you recommended.

      When I replace the plugin IDs with those generated from https://developers.maxon.net/forum/pid the menu would not even load.

      Cheers

      posted in Cinema 4D SDK
      N
      nicholas_yue
    • Dialog button hangs C4D

      I have a dialog button which hangs when I click it but it only hangs for a specific scene.

      From looking at the printout in the python console window, it appears that when I click the 'Submit' button, it never reaches the call to Command()

      TTR_PLUGIN_ID = 999121032
      TTR_CANCEL_BUTTON = 12003
      TTR_SUBMIT_BUTTON = 12004
      
          def Command(self, id, msg):
              print('TurnTableRenderDialog::Command()')
              print('id = {}'.format(id))
              print('TTR_SUBMIT_BUTTON = {}'.format(TTR_SUBMIT_BUTTON))
              if (id == TTR_SUBMIT_BUTTON):
                  print('TTR_SUBMIT_BUTTON')
      
          def CreateLayout(self):
              '''
              Frame Chunk size,
              Render folder prefix
              Frame range (start, end)
              '''
              self.SetTitle('Submit turn table to Tractor (PlutoWithDamage)')
              self.GroupBegin(id=1013, flags=c4d.BFH_SCALEFIT, cols=1)
              #
              self.GroupBegin(id=1014, flags=c4d.BFH_SCALEFIT, cols=2)
      
              self.AddStaticText(TTR_COMMENT_LABEL, c4d.BFV_MASK |
                                 c4d.BFH_RIGHT, name="Comments")
              self.AddEditText(TTR_COMMENT_EDIT, c4d.BFV_MASK |
                               c4d.BFH_LEFT, initw=400)
      
              self.AddStaticText(TTR_FRAME_RANGE_LABEL, c4d.BFV_MASK |
                                 c4d.BFH_RIGHT, name="Frame range (start,end,step)")
              self.GroupBegin(id=1015, flags=c4d.BFH_SCALEFIT, cols=3)
              self.AddEditNumberArrows(TTR_FRAME_RANGE_START, c4d.BFV_MASK, initw=100)
              self.AddEditNumberArrows(TTR_FRAME_RANGE_END, c4d.BFV_MASK, initw=100)
              self.AddEditNumberArrows(TTR_FRAME_RANGE_STEP, c4d.BFV_MASK, initw=100)
              self.GroupEnd()
      
              self.GroupEnd()
              #
              self.GroupBegin(id=1016, flags=c4d.BFV_MASK | c4d.BFH_RIGHT, cols=2)
              self.AddButton(TTR_CANCEL_BUTTON, c4d.BFV_MASK |
                             c4d.BFH_RIGHT, initw=100, name="Cancel")
              self.AddButton(TTR_SUBMIT_BUTTON, c4d.BFV_MASK |
                             c4d.BFH_RIGHT, initw=100, name="Submit")
              self.GroupEnd()
      
      posted in Cinema 4D SDK python
      N
      nicholas_yue
    • Rendering with specific camera ?

      I am writing some scene assembly tool using C4D and c4dpy.

      I am bringing in Alembic cameras and other geometry assets.

      On the commandline.exe, there is no option to specify which camera I can render with so I am wondering if there is some python call I need to make to the C4D document before saving so that when I render the file, it knows which camera to use ?

      Cheers

      posted in General Talk python
      N
      nicholas_yue
    • Detecting unsaved changes

      Hi,

      Is there a call to c4d to ascertain if there are unsaved changes in the current session. The current session was started from opening a file from disk.

      I am using R21 on Windows and using Python.

      Cheers

      posted in Cinema 4D SDK
      N
      nicholas_yue
    • Getting and setting frame range from RenderData

      Hi,

      I read that I can get the RenderData object via

      rdata = doc.GetActiveRenderData()

      I see that frame range values are documented here

      https://developers.maxon.net/docs/py/2023_2/modules/c4d.documents/RenderData/index.html?highlight=renderdata

      RDATA_FRAMEFROM
      RDATA_FRAMETO
      RDATA_FRAMESTEP

      Cheers

      posted in Cinema 4D SDK
      N
      nicholas_yue
    • Directory UI component ?

      Hi,

      I am reading the following

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

      hoping there might be some directory browsing UI.

      My intention is to allow the user to pick an output directory for some processing.

      Cheers

      posted in Cinema 4D SDK
      N
      nicholas_yue
    • Keeping text and edit UI component horizontally

      Hi,

      I have difficulty keeping the label for a edit UI component on the same line with the following code. I want the FRAME_CHUNK_EDIT to the right of FRAME_CHUNK_LABEL

          def CreateLayout(self) :
              '''
              Frame Chunk size,
              Render folder prefix
              Frame range (start, end)
              '''
              self.GroupBegin(id=1013, flags=c4d.BFH_SCALEFIT, cols=1)
              #
              self.GroupBegin(id=1014, flags=c4d.BFH_SCALEFIT|c4d.BFV_SCALEFIT, cols=1)
              self.AddStaticText(FRAME_CHUNK_LABEL, c4d.BFV_MASK, name="Frame Chunk size")
              self.AddEditNumberArrows(FRAME_CHUNK_EDIT, c4d.BFV_MASK, initw=100)
              self.GroupEnd()
              #
              self.AddButton(SUBMIT_BUTTON, c4d.BFV_MASK, initw=100, name="Submit")
              self.GroupEnd()
              return True
      

      Cheers

      posted in Cinema 4D SDK
      N
      nicholas_yue
    • RE: Unable to update Alembic path in xref

      @m_adam said in Unable to update Alembic path in xref:

      Unfortunately, there is no built-in way to control MessageBox within Cinema4D.

      The only way for you is to install a 3rd party python package, here a possible one https://github.com/asweigart/pyautogui.

      Cheers,
      Maxime.

      But I am running the script with c4dpy, there is no UI.

      Is there something I can call in c4dpy to tell the current active session to default to "Yes", it seems that c4dpy defaults to "No"

      Cheers

      posted in Cinema 4D SDK
      N
      nicholas_yue
    • RE: Unable to update Alembic path in xref

      @r_gigante said in Unable to update Alembic path in xref:

      DESCFLAGS_SET_USERINTERACTION

      Using DESCFLAGS_SET_USERINTERACTION there was a prompt in my script.

      Update XRef (Yes) or replace (No)?
      

      How do I respond (Yes) in my script ?

      Cheers

      posted in Cinema 4D SDK
      N
      nicholas_yue
    • Unable to update Alembic path in xref

      I have the following code which was able to get the path but can't update the path

      flags = c4d.SCENEFILTER_MERGESCENE | c4d.SCENEFILTER_OBJECTS | c4d.SCENEFILTER_MATERIALS
      
      active_doc = c4d.documents.GetActiveDocument()
      merge_status = c4d.documents.MergeDocument(active_doc, target_scene, flags)
      assert(merge_status)
      # Model[c4d.ID_CA_XREF_FILE]
      obj_name_to_search = 'Model'
      xref = active_doc.SearchObject(obj_name_to_search)
      alembic_path = xref.GetParameter(c4d.ID_CA_XREF_FILE, c4d.DESCFLAGS_GET_NONE)
      print(alembic_path)
      status = xref.SetParameter(c4d.ID_CA_XREF_FILE, animated_alembic_file, c4d.DESCFLAGS_SET_PARAM_SET)
      assert(status)
      if True:
          c4d.documents.SaveDocument(active_doc,
                                  target_scene,
                                  c4d.SAVEDOCUMENTFLAGS_0,
                                  c4d.FORMAT_C4DEXPORT)
      
      posted in Cinema 4D SDK
      N
      nicholas_yue
    • Getting a list of objects at a given hierarchy

      Hi,

      I have been using GetNext() and GetDown() to perform depth first visit of the scene. That works fine.

      I wish to now perform some operations a a given hierarchy level.

      Is there some GetNodeListsAtCurrentLevel() type of methods ?

      I am using the Python API with R21

      Cheers

      posted in Cinema 4D SDK
      N
      nicholas_yue
    • RE: XRef : Alembic pop-up suppression ?

      OK, I will use the support forum.

      Yes, using "Add XRef..." still result in seeing the Alembic Settings pop up every time I open the file.

      posted in Cinema 4D SDK
      N
      nicholas_yue
    • RE: XRef : Alembic pop-up suppression ?

      I am creating the xRef from the UI

      C4D_xRef.jpg

      posted in Cinema 4D SDK
      N
      nicholas_yue
    • XRef : Alembic pop-up suppression ?

      I created a couple of XRef that load alembic file. When I re-open the C4D file, I get a pop-up for each alembic file. How can I suppress the Alembic pop-up as I plan to build a large scene with many XRef and don't want the artists to click OK for every alembic file in the scene.

      posted in Cinema 4D SDK
      N
      nicholas_yue
    • RE: Post import - Updating alembic path does not update scene ?

      @m_magalhaes Is there a way to get Cinema4D to update the object identifier ? When I import an alembic file, Cinema4D builds a hierarchy and all the paths recursively. Is there a way to tell Cinema4D to rebuild that hierarchy or is deleting and re-importing the only way to get the object identifier rebuilt ?

      posted in Cinema 4D SDK
      N
      nicholas_yue