• 0 Votes
    6 Posts
    1k Views
    ferdinandF
    Hey @qq475519905, sorry for the delay. As I said in the beginning, you can implement your own serializer using GoZ. But there is no dedicated exporter API in ZScript. I assume you are using some RoutineCall to achieve what you are doing. You cannot escape any GUI associated with such call. Cheers, Ferdinand
  • 0 Votes
    24 Posts
    4k Views
    Y
    Oh, you've edited your previous message! Thanks! I will try it.
  • Volume Builder Type Fog Should it be solid?

    Cinema 4D SDK c++ 2024
    3
    1
    0 Votes
    3 Posts
    541 Views
    D
    Hi @m_adam , Thank you so much! That was exactly what I needed. Dan
  • How to drag rows in Treeview

    Cinema 4D SDK 2024 python
    4
    1
    0 Votes
    4 Posts
    588 Views
    chuanzhenC
    @ferdinand Thanks for your help!
  • customize ZBrush add-on

    ZBrush SDK windows 2024
    3
    0 Votes
    3 Posts
    941 Views
    L
    @m_adam thanks for your prompt response. I'm looking forward to hearing from you.
  • 0 Votes
    6 Posts
    1k Views
    ferdinandF
    Hey @kbar, Thank you for reaching out to us and the heads up, much appreciated. Looks like we forgot to update the function documentation, because the change is in the change notes. I updated the docs for the upcoming release. Cheers, Ferdinand
  • Image Viewer API

    Cinema 4D SDK 2024 s26 python
    6
    0 Votes
    6 Posts
    870 Views
    K
    @i_mazlov Thanks for the reply. I may have described it wrong. I am talking about the image viewer. It seems that there is currently no API interface to get the number of frames rendered, nor can I get the total number of frames in the rendering settings.
  • How to correctly get maxon::NimbusInterface?

    Cinema 4D SDK 2023 2024 c++
    2
    0 Votes
    2 Posts
    494 Views
    O
    Hi Kent, the cast is safe. In the public API, NimbusInterface is an incomplete type. Only NimbusBaseInterface is defined there. But internally, NimbusInterface is derived from NimbusBaseInterface, therefore you can safely do the cast.
  • 0 Votes
    3 Posts
    544 Views
    chuanzhenC
    @ferdinand Thanks for reply. Perhaps not expressed clearly. For changing the axis of an object, it is not a problem. What I want to ask is whether the manual operation step of selecting the axis before the Move tool works can be implemented using a script.
  • 0 Votes
    4 Posts
    925 Views
    ferdinandF
    Hello everyone, we have moved this topic to a mail discussion, when there are outcomes relevant for other developers, I will post them here. Cheers, Ferdinand
  • TreeView rows selected?

    Cinema 4D SDK 2024 python
    4
    1
    0 Votes
    4 Posts
    431 Views
    chuanzhenC
    @m_adam Thanks,it works well [image: 1737723959721-2b524b98-f131-4d69-bcf0-4dec858821ab-image.png] this is code: import c4d import random from c4d import gui # Welcome to the world of Python NAME = 0 LINKTO = 1 LINK = 2 TYPE = 3 class TreeView_Item(object): def __init__(self,): self.type = 'psr' self.selected = False self.obj_name = str(random.randint(1,100)) self.linkto_name = "" @property def IsSelected(self): return self.selected def Select(self): self.selected = True def Deselect(self): self.selected = False def __repr__(self): return str(self) def __str__(self): return self.obj_name class TreeView(c4d.gui.TreeViewFunctions): def __init__(self,items_list=None): self.items_list = items_list if items_list else [] def GetLineHeight(self,root, userdata, obj, col, area): return area.DrawGetFontHeight() def IsResizeColAllowed(self, root, userdata, lColID): return True def IsTristate(self, root, userdata): return False def GetColumnWidth(self, root, userdata, obj, col, area): """Measures the width of cells. Although this function is called #GetColumnWidth and has a #col, it is not only executed by column but by cell. So, when there is a column with items requiring the width 5, 10, and 15, then there is no need for evaluating all items. Each item can return its ideal width and Cinema 4D will then pick the largest value. Args: root (any): The root node of the tree view. userdata (any): The user data of the tree view. obj (any): The item for the current cell. col (int): The index of the column #obj is contained in. area (GeUserArea): An already initialized GeUserArea to measure the width of strings. Returns: TYPE: Description """ # The default width of a column is 80 units. width = 80 # Replace the width with the text width. area is a prepopulated # user area which has already setup all the font stuff, we can # measure right away. if col == NAME: return area.DrawGetTextWidth(obj.obj_name) + 5 if col == LINKTO: return area.DrawGetTextWidth("-->") + 5 if col == LINK: return area.DrawGetTextWidth(obj.linkto_name) + 5 if col == TYPE: return area.DrawGetTextWidth(obj.type) + 5 return width def GetFirst(self, root, userdata): """ Return the first element in the hierarchy, or None if there is no element. """ rValue = None if not len(self.items_list) else self.items_list[0] return rValue def GetNext(self, root, userdata, obj): """ Returns the next Object to display after arg:'obj' """ rValue = None currentObjIndex = self.items_list.index(obj) nextIndex = currentObjIndex + 1 if nextIndex < len(self.items_list): rValue = self.items_list[nextIndex] return rValue def GetPred(self, root, userdata, obj): """ Returns the previous Object to display before arg:'obj' """ rValue = None currentObjIndex = self.items_list.index(obj) predIndex = currentObjIndex - 1 if 0 <= predIndex < len(self.items_list): rValue = self.items_list[predIndex] return rValue def GetId(self, root, userdata, obj): """ Return a unique ID for the element in the TreeView. """ return hash(obj) def Select(self, root, userdata, obj, mode): print(obj.obj_name) if mode == c4d.SELECTION_NEW: for item in self.items_list: item.Deselect() obj.Select() elif mode == c4d.SELECTION_ADD: obj.Select() elif mode == c4d.SELECTION_SUB: obj.Deselect() def IsSelected(self, root, userdata, obj): return obj.IsSelected def DeletePressed(self, root, userdata): "Called when a delete event is received." for item in reversed(self.items_list): if item.IsSelected: self.items_list.remove(item) def GetName(self, root, userdata, obj): """ Returns the name to display for arg:'obj', only called for column of type LV_TREE """ return str(obj) # Or obj.texturePath def DrawCell(self, root, userdata, obj, col, drawinfo, bgColor): """ Draw into a Cell, only called for column of type LV_USER """ if col == NAME: text = obj.obj_name elif col == LINKTO: text = '-->' elif col == LINK: text = obj.linkto_name elif col == TYPE: text = obj.type else: text = '' canvas = drawinfo["frame"] xpos = drawinfo["xpos"] ypos = drawinfo["ypos"] txtColorDict = canvas.GetColorRGB(c4d.COLOR_TEXT_SELECTED) if obj.IsSelected else canvas.GetColorRGB( c4d.COLOR_TEXT) txtColorVector = c4d.Vector(txtColorDict["r"] / 255.0, txtColorDict["g"] / 255.0, txtColorDict["b"] / 255.0) canvas.DrawSetTextCol(txtColorVector, bgColor) canvas.DrawText(text, xpos, ypos) def DoubleClick(self, root, userdata, obj, col, mouseinfo): return True class test_dialog(gui.GeDialog): def __init__(self): self._treegui = None self.treeview = TreeView() def CreateLayout(self): # Other than edit fields, buttons do not have a builtin bubble help. customgui = c4d.BaseContainer() customgui.SetBool(c4d.TREEVIEW_BORDER, c4d.BORDER_THIN_IN) customgui.SetBool(c4d.TREEVIEW_HAS_HEADER, True) # True if the tree view may have a header line. customgui.SetBool(c4d.TREEVIEW_HIDE_LINES, False) # True if no lines should be drawn. customgui.SetBool(c4d.TREEVIEW_MOVE_COLUMN, False) # True if the user can move the columns. customgui.SetBool(c4d.TREEVIEW_RESIZE_HEADER, True) # True if the column width can be changed by the user. customgui.SetBool(c4d.TREEVIEW_FIXED_LAYOUT, True) # True if all lines have the same height. customgui.SetBool(c4d.TREEVIEW_ALTERNATE_BG, True) # Alternate background per line. customgui.SetBool(c4d.TREEVIEW_CURSORKEYS, True) # True if cursor keys should be processed. customgui.SetBool(c4d.TREEVIEW_NOENTERRENAME, True) # Suppresses the rename popup when the user presses enter. customgui.SetBool(c4d.TREEVIEW_NO_MULTISELECT, False) self._treegui = self.AddCustomGui(1000, c4d.CUSTOMGUI_TREEVIEW, "", c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT, 300, 300, customgui) if not self._treegui: print("[ERROR]: Could not create TreeView") return False self.AddButton(1001, c4d.BFH_CENTER, name="Add") return True def InitValues(self) -> bool: layout = c4d.BaseContainer() layout.SetInt32(NAME, c4d.LV_USER) layout.SetInt32(LINKTO, c4d.LV_USER) layout.SetInt32(LINK, c4d.LV_USER) layout.SetInt32(TYPE, c4d.LV_USER) self.layout = layout self._treegui.SetLayout(4, layout) # Set the header titles. self._treegui.SetHeaderText(NAME, "Name") self._treegui.SetHeaderText(LINKTO, "") self._treegui.SetHeaderText(LINK, "Link") self._treegui.SetHeaderText(TYPE, "Type") # Set TreeViewFunctions instance used by our CUSTOMGUI_TREEVIEW self._treegui.SetRoot(self._treegui, self.treeview, None) self._treegui.Refresh() return True def Command(self, id, msg): if id == 1001: item = TreeView_Item() self.treeview.items_list.append(item) self._treegui.Refresh() return True return True # Execute main() if __name__=='__main__': dlg = test_dialog() dlg.Open(c4d.DLG_TYPE_ASYNC,0 -1,-1,400,400)
  • Automating Dynamic Place

    Cinema 4D SDK python 2024
    5
    0 Votes
    5 Posts
    469 Views
    M
    Hi Ferdinand, Thank you for your answer. No, I'm no developer, and yes, I work for a business looking to automate still image production in the rendering pipeline - trying to reduce human error as much as possible, and speed up our process/volume. It's all about money in the end sadly. I was curious to know if something was possible to place an object automatically on the "shooting table" flat in a way that the place tool allows - we have automated every other step of our process and this is the only one left that is a challenge. This is a much bigger problem than I thought it was. Thank you again for understanding I'm likely not a developer - it's frustrating when developpers always think everyone is like them, and it should evident our questions are ridiculous. Markeee.
  • 0 Votes
    6 Posts
    698 Views
    ferdinandF
    Hello @uogygiuol, Thank you for the added details. Yes, reducing the complexity of questions is the right thing to do, thank you for doing tit. Essays are counterproductive, as we then tend to overlook things (q.e.d., I overlooked the fact that you wanted to mangle the scene file in this thread). In general, trying to mangle a file beforehand is not a good route, as you always risk invalidating the file. For your very specific scenario - very simple scene graph, just geometry, no materials, animations or other dependencies - it could make sense. I briefly talked with the owner of our GLTF-importer, and we do not do any sanity checking, e.g., comparing nodes with meshes. So, you could just 'clean up' the scene graph ("nodes") of the file, and Cinema's GLTF importer will then just ignore extra data in fields such as "meshes". How fruitful this will be, you will have to find out yourself. I already had the hunch that your are here surfing on the edge of what is sensbible, and GLTF JSON files which translate to gigabytes of memory are certainly an edge case, due to the fact that text-based file formats are usually a bad choice for such heavy data. Using Python to Read JSON My guesstimate would be that when you throw a GLTF JSON file at Python's JSON parser - which takes five minutes to load in Cinema 4D - to mangle it, you end up with a net-loss or tie, because you loose most or more than the won time in that Python JSON stage. Python's json module is mostly written in C to make it performant, but that is still a lot of JSON to deserialize, modify, and then serialize. One idea could be to use re, i.e., regular expressions, to find the "nodes" section in that file, just deserialize that from JSON, modify it, serialize back to a JSON string, and write it back in place, and by that sidestep having to deserialize that whole file. The problem with all that is that json.load allows you to pass a file object, allowing you to bypass the Python VM entirely and let the data reside in C until the parsing is done, while re does not allow you to regex a file object directly (AFAIK), you always must read the file object into lines or chunks to then pass these strings to the re module. I.e., you would have to load that whole file into a Python string first. What would come here out on top, I have no clue, but my hunch is that re might loose, as Python's string handling is not the fastest. Alternatives might be 3rd party libs such as isjon (a lazy JSON loader) but I do not know how performant it is. For this section it would make a huge difference if you could predict the position of "nodes" in the file, either exactly as a chunk offset, or in the form of 'I know that it is always very close to the end, so let's regex parse the file in reverse'. Using a Binary File Format But the fact remains that text-format file types, e.g., JSON GLTF, become extemely ineffcient once you pass the ~100 MB barrier. Using something like binary GLTF or another binary format such as FBX will likely speed up your Cinema 4D loading times quite a bit, no extra steps required. And to be clear, text-based file formats are always wildely ineffcient. It is just that below the ~100 MB barrier (adjust for the beefiness of your machine), you can drown that inefficency with pure computing power and have the nice advantage of a human-readble file format. Cheers, Ferdinand
  • 0 Votes
    3 Posts
    336 Views
    A
    That is perfect, thank you for being through and concise, lifesaver.
  • python script change Redshift setting

    Cinema 4D SDK python windows 2024
    6
    0 Votes
    6 Posts
    944 Views
    R
    @Dunhou @i_mazlov Thanks a lot.
  • Automatically execute python scripte

    Cinema 4D SDK python 2024 windows
    2
    0 Votes
    2 Posts
    285 Views
    M
    Hi @serco, there is multiple way to execute a script automatically when Cinema 4D is opened. Use python_init.py, this force you to add your script into the temp folder. Bu it can be done for a particular instance of a Cinema 4D or it can also be applied to all Cinema 4D versions that use a given python version. Implement a Plugin and react to PluginMessage various event are sent to Python, and you can hook into them to execute your code. This require to have a Python plugin loaded by Cinema 4D. Depending of your needs there is c4dpy which act as a Python Interpreter, where you can pass directly your Python file as an argument. Then again depending of your need you may be able to start what you want to do next. Cheers, Maxime.
  • 0 Votes
    5 Posts
    707 Views
    gheyretG
    I get it, thanks for your reply and keeping the idea. If there are any workarounds or alternative solutions in the meantime, please let me know. I look forward to any updates regarding this feature in the future. Cheers~
  • Change posemorph's name

    Moved Bugs python 2024 2023
    2
    2
    0 Votes
    2 Posts
    663 Views
    M
    Hi thanks for the question, I've opened a bug report, for the moment the only workaround would be to remove the Morph and re-add it. For the moment the name in the treeview is only updated when manually edited from the treeview and on the insertion of the item in the tree view. Cheers, Maxime.
  • ZBrush 2024 FileExecute Issue

    ZBrush SDK windows 2024 c++
    3
    0 Votes
    3 Posts
    1k Views
    B
    Thank you for the detailed reply, @i_mazlov! I was unable to determine the root cause of the issue, however I was able to work around it by preloading direct dependencies with a FileExecute call and using the SearchPath Windows function to locate the runtime dependency DLLs and pass the absolute paths to LoadLibrary (I'm aware this is not recommended, but should be fine for this internally used plugin). I couldn't find anything in the newly added Maxon options that appeared to affect the loading behavior. My only remaining theory is that the new licensing process is indirectly triggering this behavior: LoadLibrary function returns STATUS_DLL_NOT_FOUND error on impersonate thread in Windows https://learn.microsoft.com/en-us/troubleshoot/windows-client/setup-upgrade-and-drivers/loadlibrary-function-returns-status-dll-not-found-error-impersonate-thread Thanks again! Nick
  • Get and Set any parameter with Tag

    Cinema 4D SDK 2023 2024 2025 python
    3
    0 Votes
    3 Posts
    533 Views
    gheyretG
    Hi @i_mazlov I can't use C++ at the moment, so I thought I'd try MultilineEditText for my purposes. I looked for This post in the forum and now I have some ideas. Thank you for your reply! Cheers~