• How to access the "root" Scene Nodes graph

    python 2024
    3
    0 Votes
    3 Posts
    586 Views
    K
    Hi @ferdinand , Thanks as always for your clear answers, It solved the problem for me!
  • UuidInterface.ToString() raise a TypeError.

    windows python 2024
    3
    0 Votes
    3 Posts
    541 Views
    DunhouD
    Wow @ferdinand! What a super detailed and super useful information ! Always learning great things from your super user-friendly answers for rookies like me Memory Management is very useful to understand what happened here, I will read it again tomorrow after work, hope I can have a deeper understanding then About the Interfaces/References/Ref class name, super useful information, I always confused them and thought it was an inheritance relationship or something like that, it is much cleaner now! Thanks for your typing tips here, I had learn this by testing your answers and codes (In fact, most of my programming skills are learned through studying your code, and I am truly grateful to you) Last, thanks or your times during the meeting time! Cheers~ DunHou
  • FBX does not export

    windows 2024 python
    2
    0 Votes
    2 Posts
    433 Views
    ferdinandF
    Hey @pyxelrigger, Thank you for reaching out to us. It is always difficult for me in these cases to find the right words. Generally speaking, what you ask us to do here, is out of scope of support: Either debug your code or finish the script for you. What I see here is primarily a user who is overwhelmed by his or her own code. Especially when you are less experienced: Just break up things into manageable pieces where you know what they do and you can confirm that they do what you mean them to do. And when I run into troubles, the first thing I would also remove is all UI fluff. You could for example define your paths just at the top of the script. Finally, NEVER do this c4dpath = '{}\{}'.format(c4dfilesfolder, file), this is just bound to go wrong. Use os.path.join instead. You will have to debug your script yourself. Cheers, Ferdinand Result: Exported /Users/f_hoppe/Desktop/test/Untitled 2.fbx Exported /Users/f_hoppe/Desktop/test/Untitled 1.fbx Code (mostly AI generated): import c4d import os def SetFbxExportSettings() -> None: """Set the FBX export settings. """ plugin: c4d.plugins.BasePlugin = c4d.plugins.FindPlugin(c4d.FORMAT_FBX_EXPORT, c4d.PLUGINTYPE_SCENESAVER) data: dict = {} plugin.Message(c4d.MSG_RETRIEVEPRIVATEDATA, data) settings = data.get("imexporter", None) if settings is None: raise ValueError("Could not retrieve the FBX export settings.") settings[c4d.FBXEXPORT_FBX_VERSION] = False settings[c4d.FBXEXPORT_ASCII] = False settings[c4d.FBXEXPORT_CAMERAS] = False settings[c4d.FBXEXPORT_LIGHTS] = False settings[c4d.FBXEXPORT_SPLINES] = False settings[c4d.FBXEXPORT_INSTANCES] = False settings[c4d.FBXEXPORT_SELECTION_ONLY] = True settings[c4d.FBXEXPORT_GLOBAL_MATRIX] = False settings[c4d.FBXEXPORT_SDS] = c4d.FBXEXPORT_SDS_GENERATOR settings[c4d.FBXEXPORT_TRIANGULATE] = False settings[c4d.FBXEXPORT_SAVE_NORMALS] = True settings[c4d.FBXEXPORT_SAVE_VERTEX_COLORS] = False settings[c4d.FBXEXPORT_SAVE_VERTEX_MAPS_AS_COLORS] = False settings[c4d.FBXEXPORT_UP_AXIS] = c4d.FBXEXPORT_UP_AXIS_Y settings[c4d.FBXEXPORT_TRACKS] = True settings[c4d.FBXEXPORT_BAKE_ALL_FRAMES] = False settings[c4d.FBXEXPORT_PLA_TO_VERTEXCACHE] = False settings[c4d.FBXEXPORT_BOUND_JOINTS_ONLY] = False settings[c4d.FBXEXPORT_TAKE_MODE] = c4d.FBXEXPORT_TAKE_TAKES settings[c4d.FBXEXPORT_MATERIALS] = True settings[c4d.FBXEXPORT_EMBED_TEXTURES] = False settings[c4d.FBXEXPORT_SUBSTANCES] = True settings[c4d.FBXEXPORT_BAKE_MATERIALS] = True settings[c4d.FBXEXPORT_BAKEDTEXTURE_WIDTH] = 1024 settings[c4d.FBXEXPORT_BAKEDTEXTURE_HEIGHT] = 1024 def GetInputDocumentPaths() -> list[str]: """Opens a directory dialog to select a folder and returns a list of Cinema 4D documents that are in the selected folder or its subfolders. """ path: str = c4d.storage.LoadDialog( c4d.FILESELECTTYPE_ANYTHING, "Animations", c4d.FILESELECT_DIRECTORY) if not os.path.isdir(path): raise ValueError("The given path is not a directory.") files: list[str] = [] for root, _, filenames in os.walk(path): for filename in filenames: if filename.endswith('.c4d'): files.append(os.path.join(root, filename)) return files def main() -> None: """Main function. """ # Set the settings and get the inputs. SetFbxExportSettings() filePaths: list[str] = GetInputDocumentPaths() # Export the documents in the list to FBX. for path in filePaths: # Load the document. doc: c4d.documents.BaseDocument = c4d.documents.LoadDocument(path, c4d.SCENEFILTER_OBJECTS) if not doc: raise ValueError(f"Could not load the document at {path}.") # Get the first object in the document and set it as the selection so that it is exported. obj: c4d.BaseObject = doc.GetFirstObject() if not obj: raise ValueError(f"The document at {path} does not contain any objects.") doc.SetSelection(obj, c4d.SELECTION_NEW) # Export the document to FBX and close it. fbxPath: str = path.replace('.c4d', '.fbx') c4d.documents.SaveDocument(doc, fbxPath, c4d.SAVEDOCUMENTFLAGS_DONTADDTORECENTLIST, c4d.FORMAT_FBX_EXPORT) c4d.documents.KillDocument(doc) print(f"Exported {fbxPath}") if __name__ == '__main__': main()
  • Nothing happen when runing generate_solution_win.bat

    windows c++ 2024
    9
    0 Votes
    9 Posts
    1k Views
    gheyretG
    Yeah, it's a little bit anoying, but the problem's solve! Ready for rocking with C++! wohoo~
  • Error compiling R23 framework

    r23 c++
    2
    0 Votes
    2 Posts
    582 Views
    i_mazlovI
    Hi @dgould, Welcome to the Maxon developers forum and its community, it is great to have you with us! Getting Started Before creating your next postings, we would recommend making yourself accustomed with our forum and support procedures. You did not do anything wrong, we point all new users to these rules. Forum Overview: Provides a broad overview of the fundamental structure and rules of this forum, such as the purpose of the different sub-forums or the fact that we will ban users who engage in hate speech or harassment. Support Procedures: Provides a more in detail overview of how we provide technical support for APIs here. This topic will tell you how to ask good questions and limits of our technical support. Forum Features: Provides an overview of the technical features of this forum, such as Markdown markup or file uploads. It is strongly recommended to read the first two topics carefully, especially the section Support Procedures: Asking Questions. About your First Question You are completely right with finding the thread with the answer: Manuel posted in a separate thread the solution for this issue: Building R23 SDK with Visual Studio 16.9. As he states there inside the R23.107 sdk you need to find the file frameworks/core.framework/source/maxon/objectbase.h and make there two changes. This will allow your solution to build without errors. The issue was later resolved in S24 and onwards, so there's no need in changing this file there. Cheers, Ilia
  • Download Cinema 4D 2023.2.0 link doesn't work

    2023 macos
    4
    0 Votes
    4 Posts
    702 Views
    ferdinandF
    Hey @BruceC, you are not expected to. In fact you cannot delete any topic as a user here once it is older than 60 minutes (no replies or not). Postings, a reply in a topic, can be deleted without restrictions. But deleting is not really deleting in NodeBB anyway, true deletion, NodeBB calls its purging, is not available for users at all. Long story short: We do not want users to delete topics as they tend to delete valuable information for others with that, even when they consider the topic failed or obsolete. Cheers, Ferdinand
  • Error compiling R25 framework on MacOS

    r25 macos
    3
    0 Votes
    3 Posts
    617 Views
    B
    Thank you, @ferdinand. I modified sourceprocessor.py for now, and it works.
  • Can I get the typing (input) event in cinema 4d?

    windows python 2024
    3
    0 Votes
    3 Posts
    596 Views
    gheyretG
    Hi @ferdinand, Thank you for your reply. And I will try it later today.
  • Stop projecttool asking for return to exit

    windows
    3
    1
    0 Votes
    3 Posts
    502 Views
    B
    @i_mazlov Thank you very much! This works!
  • Adding a Morph Deformer Causes Pose Morph Tag to Stop Working

    python
    6
    1
    0 Votes
    6 Posts
    1k Views
    kangddanK
    Thank u @i_mazlov I appreciate you pointing me in the right direction. I will try to understand the workings behind the posemorph tag!
  • Plugin in the top bar with Python

    2024 python windows
    2
    1
    0 Votes
    2 Posts
    459 Views
    ferdinandF
    Hey @pyxelrigger, Thank you for reaching out to us. You will have to overwrite PluginMessage in your plugin to do that. You might want to have a look at this thread. Cheers, Ferdinand
  • GetCache Does Not Work Inside the Python Generator

    r21 r25 python
    10
    0 Votes
    10 Posts
    2k Views
    ferdinandF
    Hey @bentraje, I am glad that you found your solution, and yes, you are absolutely right, it should be GeGetCurrentThread . I fixed that in my pseudo-code. Cheers, Ferdiand
  • Best guess at active user selection

    c++ 2023
    4
    0 Votes
    4 Posts
    646 Views
    i_mazlovI
    Hi Andy, Welcome to the Maxon developers forum and its community, it is great to have you with us! Getting Started Before creating your next postings, we would recommend making yourself accustomed with our forum and support procedures. You did not do anything wrong, we point all new users to these rules. Forum Overview: Provides a broad overview of the fundamental structure and rules of this forum, such as the purpose of the different sub-forums or the fact that we will ban users who engage in hate speech or harassment. Support Procedures: Provides a more in detail overview of how we provide technical support for APIs here. This topic will tell you how to ask good questions and limits of our technical support. Forum Features: Provides an overview of the technical features of this forum, such as Markdown markup or file uploads. It is strongly recommended to read the first two topics carefully, especially the section Support Procedures: Asking Questions. About your First Question Yes, unfortunately it's not possible to catch the "hover" event as there's no such event. So yes, you're right, you can somehow emulate the desired behavior. The suggestion for that would be to work with Core Messages, namely do your stuff (i.e. change the mode) as a reaction on catching the EVMSG_CHANGE message. For checking the selections part, you can refer to the DunHou's pointer to the Ferdinand's script. Cheers, Ilia
  • BitmapButton in Resource file

    2024 c++
    8
    0 Votes
    8 Posts
    2k Views
    i_mazlovI
    Hi @JohnThomas, sorry again for a long delay in the answer. Now I see that in this specific setup when the bitmap button is used inside the field layer plugin, the message MSG_DESCRIPTION_COMMAND is not propagated to the field layer plugin, which sounds like a bug to me. I've checked the code and it's likely due to the field layer data object being somewhat special comparing to others. I will double check this with a corresponding developer, once he's back from parental leave, and create a bug report for this to be fixed. Unfortunately, I cannot offer you any workaround for this before it's fixed. Cheers, Ilia
  • Easier Way to Offset an Animation of an Object?

    python r25 windows r21
    4
    0 Votes
    4 Posts
    1k Views
    B
    @ferdinand yea python is much more forgiving than C++. i was just wondering if there was an already existing API for such task.
  • Projecting Points from Object/World Space into Texture Space

    2024 python
    1
    1
    4 Votes
    1 Posts
    681 Views
    No one has replied
  • In the UV Manager,cubic's c4d.CallCommand()

    python 2024
    4
    1
    0 Votes
    4 Posts
    657 Views
    1
    Okay, thank you!
  • How to run UVCOMMAND_OPTIMALCUBICMAPPING

    4
    0 Votes
    4 Posts
    851 Views
    ferdinandF
    Hello @ADCMHI, your code contains syntax errors, you have index arguments after a keyword argument in your CallUVCommand call and you also refer to module attributes that do not exist in your script, uvw and cmdid. You also did not properly follow the code example I provided. Your script could either be a product of some chat bot which is not knowing what is doing (but at least CoPilot/ChatGPT write better Cinema 4D code these days) or the struggles of a beginner. And while we understand that CoPilot is a useful tool (we use it ourselves) and that everyone has to start, we cannot help you with chatbot gibberish or with learning the basics of programming. See our Support Procedures for details. I personally operate by the rule: "Newcomers have one free" and therefore fixed here your script for you. Please understand that we cannot help you with further questions that are on such a fundamental level of non-functional code. Please also understand that this is not a commitment of SDK to always provide solutions for newcomers, no matter in which state their code is. Cheers, Ferdinand Result [image: 1714386772669-357f8ac9-f2a4-4d43-983b-53e9f9d1f4c0-image-resized.png] Code """Demonstrates how to apply the `UVCOMMAND_OPTIMALCUBICMAPPING` to a list of selected objects. """ import c4d import mxutils from mxutils import CheckIterable, CheckType from c4d.modules import bodypaint def apply_cube_mapping(targets: list[c4d.PolygonObject], settings: c4d.BaseContainer) -> None: """Applies `UVCOMMAND_OPTIMALCUBICMAPPING` to each element in `targets` using the `settings` provided. """ # Check the input types. CheckType(settings, c4d.BaseContainer) CheckIterable(targets, c4d.PolygonObject, list) for obj in targets: doc: c4d.documents.BaseDocument = CheckType(obj.GetDocument(), c4d.documents.BaseDocument) # Make sure the object is the only selected object in the scene, as otherwise the UV command # will get confused. doc.SetActiveObject(obj) # EMake sure the document is in UV mode. if doc.GetMode() not in [c4d.Muvpoints, c4d.Muvpolygons]: doc.SetMode(c4d.Muvpolygons) # Acquire the active UVSet, if it doesn't exist, create one by opening the UV editor. handle: bodypaint.TempUVHandle | None = bodypaint.GetActiveUVSet(doc, c4d.GETACTIVEUVSET_ALL) if handle is None: c4d.CallCommand(170103) if c4d.API_VERSION >= 22000: c4d.modules.bodypaint.UpdateMeshUV(False) handle = c4d.modules.bodypaint.GetActiveUVSet(doc, c4d.GETACTIVEUVSET_ALL) if handle is None: raise RuntimeError("There is no Active UVSet") # Retrieve the UVW data for the active UVSet. uvw: list[dict] = handle.GetUVW() if uvw is None: raise RuntimeError(f"Failed to retrieve the uvw data for: {obj}") # Call the uv command. if not c4d.modules.bodypaint.CallUVCommand( handle.GetPoints(), handle.GetPointCount(), handle.GetPolys(), handle.GetPolyCount(), uvw, handle.GetPolySel(), handle.GetUVPointSel(), obj, handle.GetMode(), c4d.UVCOMMAND_OPTIMALCUBICMAPPING, settings): raise RuntimeError("CallUVCommand failed.") # Update the handle with the new UVW data and release it. if not handle.SetUVWFromTextureView(uvw, True, True, True): raise RuntimeError("UVW from Texture View failed to be set.") c4d.modules.bodypaint.FreeActiveUVSet(handle) print(f"Applied UV mapping to: {obj}") def main(): """Entry point of the script. """ # Your settings. settings = c4d.BaseContainer() settings[c4d.OPTIMALMAPPING_PRESERVEORIENTATION] = True settings[c4d.OPTIMALMAPPING_STRETCHTOFIT] = False settings[c4d.OPTIMALMAPPING_TWOD] = False settings[c4d.OPTIMALMAPPING_AREAFAK] = 0.0 settings[c4d.OPTIMALMAPPING_RELAXCOUNT] = 0 settings[c4d.OPTIMALMAPPING_SPACING] = 0.02 # Get all the selected objects in the scene. Your code used here BaseDocument.GetObjects() which # does not make too much sense, as it will only return all the top-level objects in the scene. selection: list[c4d.BaseObject] = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_CHILDREN) if not selection: c4d.gui.MessageDialog("Please select at least one object.") return apply_cube_mapping(selection, settings) if __name__ == "__main__": main()
  • 0 Votes
    7 Posts
    1k Views
    M
    Hi sadly no news, except we kind of know the issue, sadly this issue is somehow by design and will require an architectural change. While we still want to fix this issue, everything is about priority and this is not a urgent priority at the moment so I can't tell you when it will be fixed. But it's on our list. Cheers, Maxime.
  • MacOS : Matplotlib in C4D

    python macos 2024
    7
    0 Votes
    7 Posts
    874 Views
    M
    Hi I'm not a big expert of PyQt5, but I think you need to set the attribute Qt.AA_DontCreateNativeWidgetSiblings Attribute. Cheers, Maxime.