• issue with inserting fieldlayers in r2024

    Moved Bugs windows python 2024
    4
    0 Votes
    4 Posts
    1k Views
    M
    Hey thanks for the report, I indeed fix one issue with the InsertLayer but in your case it was another one, sadly there is no workaround for you (except the one you found). The fix will be provided in the next release. Cheers, Maxime.
  • 0 Votes
    2 Posts
    444 Views
    M
    Hi @pyxelrigger there is no real way to execute a script outside of Cinema 4D without Cinema 4D. The only option is to execute c4dpy which is a complete Cinema 4D instance run as a python interpreter. For more information about it, please read c4dpy manual. Note that you have the same limitation as a standalone Cinema 4D so you can't execute multiple c4dpy instance at the same time or they need to be in different folders. Except that note that tkinter does not come by default with Cinema 4D, so you will need to install manually and don't really officially support, so it may or may not works, but from our personal experience in the SDK team, it should work. Cheers, Maxime.
  • 0 Votes
    2 Posts
    671 Views
    ferdinandF
    Hey @ThomasB, Thank you for reaching out to us. Without your code we cannot really help you, we are not the oracle of Delphi There are many things which could go wrong in your plugin. But in general what you are doing is correct; add a dummy point object with your snap points to your cache, when you want to introduce special snapping points for your custom generator object. Snapping onto the points of the returned geometry should work out of the box (but snapping sometimes struggles a bit with deep caches). There is however only limited support for adding special snapping points, as it is not really intended to add you own snap logic in that manner. The snapping module both in Python and C++ does not allow you to implement your own snapping logic, you can just read some data. You should also keep in mind that the snapping is an older part of Cinema 4D which has its flaws. You should check if your problem also does occur when you try to snap onto the converted cache of your object (current state to object). If that is the case, you know it is not something your plugin does, but simply the fact that the snapping struggles with that specific geometry/scenario. Cheers, Ferdinand
  • 0 Votes
    3 Posts
    607 Views
    pyxelriggerP
    Thanks, buddy! It worked. To be honest, I never really understood what Message(c4d.MSG_UPDATE) was all about, and now ExecutePasses is new to me
  • 0 Votes
    4 Posts
    979 Views
    ferdinandF
    Good to hear!
  • 2024.4.0 SDK Release

    News & Information news cinema 4d c++ python sdk
    7
    2
    1 Votes
    7 Posts
    7k Views
    ferdinandF
    Hey, so, I fixed this now, in the sense that the TOC is now back in these classic API type and module pages. [image: 1713774613887-c2f5944c-90e4-49f9-a194-44f7be96b281-image-resized.png] I renamed the old a bit wordily named "Functions Signatures" and "Functions Documentation" to Overview and Functions (or Methods for classes) . Opposed to the old pre 2024.3 TOCs (which were completely broken in many ways), these categories now also show up in the TOC: [image: 1713775118359-adcc5c03-d5fd-4f97-b206-7d69cef2d81e-image-resized.png] [image: 1713774646259-bc7bac63-8959-487a-8aa7-81e729fcc92a-image-resized.png] The old Types and Inheritance section has been merged into root element as I do not see a good reason why it should appear in the middle of the page. The obvious thing would be to now add links to the individual elements on a page, so that you can quick-jump to a particular function. But that turned out to be not so easy with the mess we made there before and stubborn docutils. As evident by the C4DAtom example and other cases our TOC trees are very broken in this part of the docs and I now already almost spent two days with fixing things to this state. This will be shipped in the current state with the next release of Cinema 4D. When I have some time to waste, I will try to add the function links. The manual and maxon API TOCs are unaffected by this, they continue to work as intended. The classic API does its own thing here (as always ) which why this is such a mess. Cheers, Ferdinand
  • Copy children to selection with GetClone()

    Cinema 4D SDK python 2024
    3
    0 Votes
    3 Posts
    689 Views
    John_DoJ
    Hi @ferdinand, thanks for the feedback, I've got it working with your suggestion. The method B was correct but the undo part was wrong ( the undo step was applied on the original objects instead of the new ones, thus leading to a mess when performing an undo). I also added the bit part to keep new objects folded in the OM. Here is the code : # CopyDeformers import c4d doc = c4d.documents.GetActiveDocument() def main(): doc.StartUndo() objs = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_SELECTIONORDER) if len(objs) >= 2: # Get the last selected object active = objs.pop(-1) # Get the deformers deformers = [i for i in active.GetChildren()] # Copy deformers to selection if deformers: for o in objs: for d in deformers[::-1]: dcopy = d.GetClone(c4d.COPYFLAGS_NO_BITS) doc.InsertObject(dcopy, parent=o) doc.AddUndo(c4d.UNDOTYPE_NEW, dcopy) o.SetBit(c4d.BIT_MFOLD) doc.EndUndo() c4d.EventAdd() if __name__ == '__main__': main()
  • fieldlayer with variable tag

    Cinema 4D SDK windows python 2023
    2
    1
    0 Votes
    2 Posts
    434 Views
    D
    found the solution ... the corresponding type is called: FLweight
  • 0 Votes
    2 Posts
    731 Views
    ferdinandF
    Hello @seora, Thank you for reaching out to us. There is noch such functionality to encrypt Python scripting elements. You can encrypt Python plugins, but not things like a Python tag or generator object. I have moved this thread since its is not about the Python API but a feature of Cinema 4D. Cheers, Ferdiand
  • How to LoadDocument from string in memory? 🤔

    Cinema 4D SDK python
    3
    0 Votes
    3 Posts
    972 Views
    mikeudinM
    Cool! Thank you!
  • 0 Votes
    2 Posts
    458 Views
    ferdinandF
    Hey @BretBays, Thank you for reaching out to us. You might want to have a look at the Python Libraries Manual. Since Cinema 4D 2024.0 there is also mxutils.LocalImportPath which automates injecting module paths and reloading such imported modules (I probably should update the Python libraries manual). The "flaw" of all these approaches is that while you still encrypt your plugins pyp file, the imported module(s) py file(s) will not and cannot be encrypted. You can either ship your common functions unencrypted or develop your plugin as a multi module solution (so that you do not have to replicate your code across plugins) and then package up the plugin into a singular file. There are some Python tools like pysconcat and pymerger which can help you with that. But you should be aware that these can fail when you have complex dependencies. You could also serve the py-cache of your modules, but that will not really stop anyone who wants to read your code. Cheers, Ferdinand
  • Create folder in Volume Builder

    Cinema 4D SDK windows python 2023
    3
    0 Votes
    3 Posts
    600 Views
    D
    hi @i_mazlov, thanks for the answer. good to know about this status / limitation. for my current case I found a solution without folders..
  • Plugins Search Path from Preferences

    Cinema 4D SDK python
    3
    0 Votes
    3 Posts
    686 Views
    merkvilsonM
    Thanks @ferdinand I wrote this little script for those who want to add one plugin path via the C4D script. I will update it later. It will NOT overwrite existing paths. Restart is required for instant result. import c4d import os import json def add_plugin_path(path, restart = False): if os.path.exists(path): new_path = path.replace("\\", "/") else: print("Path does not exists") return prefs_folder = c4d.storage.GeGetC4DPath(c4d.C4D_PATH_PREFS) prefs_path = os.path.dirname(prefs_folder) plugins_json_path = os.path.join(prefs_path, 'plugins.json') if os.path.exists(plugins_json_path): with open(plugins_json_path,'r',encoding="utf-8-sig") as plugins: plugins_json_raw = plugins.read() plugins_dict = json.loads(plugins_json_raw) content_dict = plugins_dict["content"]["_impl"]["_data"][1]["content"] # Check if the new path is already in Plugins Path for content_path in content_dict: if os.path.normpath(content_path["_0"]["_path"]) == os.path.normpath(new_path): print(f"'{new_path}' is already in Plugins Path.") return else: plugins_dict = { 'identification': 'plugins', 'content': { 'referenceDataType': 'net.maxon.interface.datadictionary-C', '_impl': { '_mode': 2, '_data': [ { 'dataType': 'net.maxon.datatype.id', 'content': 'searchPaths' }, { 'dataType': '(net.maxon.interface.url-C,bool)', 'isArray': True, 'content': []}]}}} # Create new path content new_content = { "_0": { "referenceIndex": len(plugins_dict["content"]["_impl"]["_data"][1]["content"]), "referenceDataType": "net.maxon.interface.url-C", "_scheme": "file", "_path": new_path, "_authority": {}, "_data": {} }, "_1": True } # Append the new path to the list of paths plugins_dict["content"]["_impl"]["_data"][1]["content"].append(new_content) # Convert the dictionary back to a JSON string updated_plugins_dict = json.dumps(plugins_dict, indent=4) # Write the updated dictionary back to a JSON file with open(plugins_json_path, 'w') as plugins_json: plugins_json.write(updated_plugins_dict) if restart: c4d.RestartMe() custom_path = r"/Path/To/Plugin/Directory/" add_plugin_path(path = custom_path, restart = False)
  • 0 Votes
    3 Posts
    961 Views
    T
    Hi Adam, thanks for the update and the workaround!
  • Get information about renderer plugin via Python

    Moved General Talk 2024 python 2023
    6
    0 Votes
    6 Posts
    1k Views
    ferdinandF
    Hello @hSchoenberger, Sorry, but this is a C4D SDK question! It is NOT about the Octane SDK. "How can I list all installed renderer plugins in C4D with their version?" Although you have put your sentence into quotes, that was not what you asked, your questions were: Is there any way to get some information about renderer plugins? I want to get the version of the Octane plugin. So how I can loop through all plugins loaded and get some information from the plugins like the version? And I answered that: There is no public interface with which you could get the version of a plugin. And when plugins provide version information on their own, you must ask their vendors about that. You can access the flags a plugin has been registered with BasePlugin.GetInfo, the disk-level is in-accessible for you. You can detect installed render engines by looping over all video post data plugins and check if they have PLUGINFLAG_VIDEOPOST_ISRENDERER set (this assumes that the to be detected render engine sets this flag on registration - which is usually unavoidable as you otherwise cannot hook in the render system of Cinema 4D, but there might be 'rogue' render engines out there which side step things). import c4d doc: c4d.documents.BaseDocument # The currently active document. op: c4d.BaseObject | None # The primary selected object in `doc`. Can be `None`. def main() -> None: """Called by Cinema 4D when the script is being executed. """ plugin: c4d.plugins.BasePlugin for plugin in c4d.plugins.FilterPluginList(c4d.PLUGINTYPE_VIDEOPOST, True): if (plugin.GetInfo() & c4d.PLUGINFLAG_VIDEOPOST_ISRENDERER): print (plugin.GetName()) if __name__ == '__main__': main() # Example output for a vanilla installation. Physical Redshift Viewport Renderer Cheers, Ferdinand
  • 0 Votes
    6 Posts
    1k Views
    S
    Okay. I'll ask the support center
  • 0 Votes
    2 Posts
    385 Views
    ferdinandF
    Hey @JACK0319, Thank you for your issue report, I have fixed it and it will be shipped with the next release. Cheers, Ferdinand
  • 0 Votes
    4 Posts
    936 Views
    F
    Thank you, it works perfectly!
  • 0 Votes
    3 Posts
    558 Views
    ferdinandF
    Hey @datamilch, Thank you for reaching out to us and answering your own question. In general we prefer it when topics do not get deleted, so that other users can benefit from a topic. You should also not be able to delete this topic anymore since more than three hours have passed since you posted and because your topic has replies. Cheers, Ferdinand
  • 0 Votes
    5 Posts
    1k Views
    gheyretG
    @czt_306 It looks realy cool!