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. FSS
    3. Topics
    • Profile
    • Following 0
    • Followers 0
    • Topics 19
    • Posts 44
    • Best 1
    • Controversial 0
    • Groups 0

    Topics created by FSS

    • FSSF

      How do you collapse complex dependies in order?

      Cinema 4D SDK
      • 2023 python • • FSS
      2
      0
      Votes
      2
      Posts
      500
      Views

      ferdinandF

      Hello @fss,

      Thank you for reaching out to us. The Cinema 4D classic API has no dependency graph for its scene elements. If you want such information, you must gather it yourself. This is however a non-trivial task.

      You also have been asking this same question multiple times both here on the forum and via mail, with both Manuel and I giving you multiple times the same answer. To "collapse" things, you must use 'Current State to Object (CSTO)' and then join the results, as first reducing things to their current cache state (CSTO) will remove the dependencies between things. You can/could also do this manually, just as the joining operation, but it is then up to you to develop that.

      Please understand that we will not answer the same question over and over again. We enjoy and encourage discussions with users, but as stated in our forum guidelines:

      We cannot provide support for [...] code design that is in direct violation of Cinema's technical requirements [...]

      Find below an example.

      Cheers,
      Ferdinand

      Result for the fairly complex Mograph asset Example Scenes\Disciplines\Motion Graphics\01 Scenes\Funny Face.c4d:
      connect_and_delete.gif

      Code

      '''Example for mimicking the "Connect & Delete" command in Python. Must be run from the Script Manager with the root objects selected whose local hierarchies should be collapsed. ''' import c4d import typing def Collapse(objects: list[c4d.BaseObject]) -> None: """Collapses all items in #objects as individual root nodes into singular objects. This function mimics the behaviour of the builtin (but unexposed) "Connect & Delete" command by first running the "CSTO" and then "JOIN" command. With setups complex enough, this can still fail due to the non-existent dependency graph of the classic API (when one does CSTO things in the wrong order). In 99.9% of the cases this will not be the case, but one should get the inputs with #GETACTIVEOBJECTFLAGS_SELECTIONORDER as I did below to give the user more control. (or alternatively do not batch operate). """ if len(objects) < 1: raise RuntimeError() doc: c4d.documents.BaseDocument = objects[0].GetDocument() doc.StartUndo() # CSTO all local hierarchies in #objects and replace these root nodes with their collapsed # counter parts. result = c4d.utils.SendModelingCommand(c4d.MCOMMAND_CURRENTSTATETOOBJECT, objects, c4d.MODELINGCOMMANDMODE_ALL, c4d.BaseContainer(), doc, c4d.MODELINGCOMMANDFLAGS_NONE) if not result or len(result) != len(objects): raise RuntimeError() for old, new in zip(objects, result): parent, pred = old.GetUp(), old.GetPred() doc.AddUndo(c4d.UNDOTYPE_DELETEOBJ, old) old.Remove() doc.InsertObject(new, parent, pred) doc.AddUndo(c4d.UNDOTYPE_NEWOBJ, new) # Join the CSTO results root by root object, and then replace the CSTO results with the final # collapsed result. JOIN is a bit weird when it comes to transforms, so we must store the # transform of the to be joined object, then zero it out, and finally apply it to the joined # result again. for obj in result: mg: c4d.Matrix = obj.GetMg() obj.SetMg(c4d.Matrix()) joined = c4d.utils.SendModelingCommand(c4d.MCOMMAND_JOIN, [obj], c4d.MODELINGCOMMANDMODE_ALL, c4d.BaseContainer(), doc, c4d.MODELINGCOMMANDFLAGS_NONE) if not joined: raise RuntimeError() parent, pred = obj.GetUp(), obj.GetPred() doc.AddUndo(c4d.UNDOTYPE_DELETEOBJ, obj) obj.Remove() new: c4d.BaseObject = joined[0] new.SetMg(mg) doc.InsertObject(new, parent, pred) doc.AddUndo(c4d.UNDOTYPE_NEWOBJ, new) doc.EndUndo() c4d.EventAdd() doc: c4d.documents.BaseDocument # The active document op: typing.Optional[c4d.BaseObject] # The active object, can be None. def main() -> None: """Runs the #Collapse() function on all currently selected objects as root nodes. """ selection: list[c4d.BaseObject] = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_SELECTIONORDER) if len(selection) < 1: print("Please select at least one root object.") else: Collapse(selection) if __name__ == "__main__": main()
    • FSSF

      PyCharm Plugin on MacOs starts multiple Interpreter Instances

      General Talk
      • python project tool 2023 • • FSS
      3
      0
      Votes
      3
      Posts
      692
      Views

      M

      Hi @FSS first of all happy new year ! 🙂

      And I'm glad that you found a solution however even if this is in the documentation we don't explicitly support PyCharm and only provide a dummy package to have autocompletion working with any Python instance. But C4dpy is not supported by all IDE and we can't provide any support there.

      If you want to have a better IDE workflow we released a plugin for Visual Studio Code, requiring a Cinema 4D plugin and a VS Code plugin.

      Finally I moved this topic to general talk as it this is nothing related to Cinema 4D API.

      Cheers,
      Maxime.

    • FSSF

      How to detectflip normals of object inwardoutward?

      Cinema 4D SDK
      • r23 python • • FSS
      4
      0
      Votes
      4
      Posts
      980
      Views

      M

      Hello @FSS,

      without further questions or postings, we will consider this topic as solved by Friday 02/06/2023 and flag it accordingly.

      Thank you for your understanding,
      Maxime.

    • FSSF

      How to read a bugreport?

      Cinema 4D SDK
      • r23 windows • • FSS
      2
      0
      Votes
      2
      Posts
      1.4k
      Views

      ferdinandF

      Hello @fss,

      thank you for reaching out to us. I would first point out three things:

      We cannot help users with bugs caused by third party plugins or libraries. We cannot disclose how to read our crash reports in detail, both from a practical and willingness standpoint. I also have difficulties following what you are here talking about in all detail; it is just a little bit too much tech jargon for my librarian brain. Information about Cinema 4D Crash Reports

      The primary data provided by a crash report is the _BugReport.txt file. It contains a stack trace for the list of stack frames which led up to the exception/crash. Our traces are organized bottom-up, i.e., the first entry in the stack is the thing which led to the crash.

      Stack traces mostly make sense in an environment where you have also access to the source code (or debug symbols) of the binary you are debugging. You can debug against our SDK, or more specifically the frameworks contained in them, to get more meaningful stack traces when debugging, however:

      We cannot provide the full declarations of the Cinema 4D API (i.e., the private frameworks and core modules) or debug symbols for them. When you want to debug a binary that is not port of Cinema 4D, e.g., the Corona plugin binary, you will either need at least the declarations of entities (a.k.a. "frameworks") or the debug symbols for it.

      So, when a crash happens in our core, you will also not get too much useful information out of a debugger attached to the binary with the public frameworks included. Because they do not contain information about our core. In its serialized form a trace (a _BugReport.txt) does not provide too much useful information.

      // The stack trace container. CINEMA_4D_Crash_Report_WINDOWS { // The thread container in the trace. Call_Stacks { // The thread in which the exception did occur. Call_Stack_Thread_9180 { // The stack frame which caused the exception which led to the crash. Here it happened // in the binary which handles a CPython virtual machine for Cinema 4D. pythonvm.module.xdl64: Ordinal0 + 0x14ae32 (SP: 0x000000BD342F8850, PC: 0x00007FFADC16AE32) // The frame before that in the same binary. pythonvm.module.xdl64: Ordinal0 + 0x145db3 (SP: 0x000000BD342F8950, PC: 0x00007FFADC165DB3) // The call before that came from the CPython binary, it yields a bit more descriptive // information without a debugger attached, as we get here function names and not just some // memory offset to the binary. python39.dll: PyUnicode_InternInPlace + 0x461 (SP: 0x000000BD342F89B0, PC: 0x00007FFAD8221DDD) // ... } // A stack trace for another thread which has been executed. Call_Stack_Thread_BLAHBLAH { // ... } //... } }

      I do not really understand where you get your information from regarding logos, 'KernelLand', and the 'hexadress of the position in the dump that corresponds to the error number'. But without the source code or debug symbols you cannot make much sense of it.

      It could be that Corona is using a lot of Windows libraries, but in general, our code is very OS agnostic. So, it seems unlikely that you found a crash in a Windows binary.

      Cheers,
      Ferdinand

    • FSSF

      Crash when converting objects in bulk

      Cinema 4D SDK
      • r23 python • • FSS
      5
      0
      Votes
      5
      Posts
      917
      Views

      ManuelM

      You can also filter your objects. Using GetInfo for example, you can check if the current object is a generator or not. If you make a generator editable, the generator will/should handle the children itself. The only exception are primitives. Primitives are generators but they do not care about their children.

      Cheers,
      Manuel

    • FSSF

      Python Module not found on upgrade

      Cinema 4D SDK
      • • • FSS
      4
      0
      Votes
      4
      Posts
      794
      Views

      FSSF

      Thanks alot Ferdinand.

      I investigated some further and added the classes to the plugins list:

      _plugins = [ "Tools", "Recipe",

      The error was also caused, by the executables having different libraries. Meaning, we call once cinema 4d.exe, which uses the {prefs}/python39/libs folder.

      The second part of the plugin is executed using the classic Commandline.exe and uses the {prefs}_x/python39/libs folder.

      Im a idiot, but a stubborn one.
      Have a great day.

      Topic can be locked now.

    • FSSF

      Floating license problem

      General Talk
      • • • FSS
      2
      0
      Votes
      2
      Posts
      610
      Views

      ferdinandF

      Hello @fss,

      Thank you for reaching out to us. We unfortunately cannot help you with this question here in the SDK Team as you are asking effectively for a feature in the Maxon App. While the C++ SDK has some licensing features, they are restricted to reading data, so you cannot just call an API to release the licenses yourself.

      You should ask your question to user support, because they are the right place for things concerning the Maxon App. What you might want to clarify there is what you mean by "defunct instances" and which app you are using. I assume from the context that you are using c4dpy with some Python scripts which sometimes crash c4dpy and then the license is not being released correctly. Which sounds like a bug which you then should report to user support.

      Cheers,
      Ferdinand

    • FSSF

      I have a problem converting a Osweep object to editable.

      Cinema 4D SDK
      • r21 python • • FSS
      7
      0
      Votes
      7
      Posts
      1.3k
      Views

      M

      Hello @FSS,

      without further questions or postings, we will consider this topic as solved by Wednesday 31/05/2023 and flag it accordingly.

      Thank you for your understanding,
      Maxime.

    • FSSF

      Handling Windows Paths with a Umlaut in Python - Ä.

      Cinema 4D SDK
      • r21 python • • FSS
      3
      0
      Votes
      3
      Posts
      1.4k
      Views

      FSSF

      Eh, this was the first approach i tried, it will map the decoded utf-8 to Windows codepage 1252. (Sorry about the wrong one in the code above). I tried to change the system setting to utf8 but it would not accpet that. Thanks for your help, Maxime

    • FSSF

      Possible Bug when running in Commandline

      Cinema 4D SDK
      • r21 python • • FSS
      4
      0
      Votes
      4
      Posts
      910
      Views

      FSSF

      LegionLib_Release.dll: Legion::Mutex::lock + 0xc (SP: 0x000000379A5FF720, PC: 0x00007FFA368CF13C) Corona4D.2023_Release.dll: forcePluginDelayLoad + 0x1229cd (SP: 0x000000379A5FF750, PC: 0x00007FFA39D91F6D) Corona4D.2023_Release.dll: forcePluginDelayLoad + 0x1232fd (SP: 0x000000379A5FF7A0, PC: 0x00007FFA39D9289D) Corona4D.2023_Release.dll: forcePluginDelayLoad + 0x139f47 (SP: 0x000000379A5FF7D0, PC: 0x00007FFA39DA94E7) LegionLib_Release.dll: Legion::LowSystemMemoryChecker::`default constructor closure' + 0x90 (SP: 0x000000379A5FF870, PC: 0x00007FFA368F1CA0) KERNEL32.DLL: BaseThreadInitThunk + 0x14 (SP: 0x000000379A5FF8C0, PC: 0x00007FFAD5C674B4) ntdll.dll: RtlUserThreadStart + 0x21 (SP: 0x000000379A5FF8F0, PC: 0x00007FFAD6EC26A1) Registers

      The counter part to the Mutex. Now looking into hot reloading the dll. If I dont return avenge me.

    • FSSF

      How do i check if another Plugin is loaded in Python?

      Cinema 4D SDK
      • r21 python • • FSS
      2
      0
      Votes
      2
      Posts
      440
      Views

      ferdinandF

      Hello @fss,

      Thank you for reaching out to us. I understand your general question, but some aspects are unclear to me.

      What plugin interfaces/hooks are involved (CommandData, ObjectData, ...)? Your posting somewhat implies that you want to rely inside PluginStart (which is not technically part of a plugin interface) on another plugin being loaded, is that true? If you are in PluginStart(), at which boot message (the ones emmited to PluginStart) are you trying to determine if some plugin X has been registered?

      But i logged those out and it always seemed to be called before the commandline arguments are processed.

      I am not quite sure what is meant with 'logged those out' here?

      The quick answer is to call c4d.plugins.FindPlugin to determine if a plugin is accessible, but depending on what you are trying to do, this might not the right way.

      Cheers,
      Ferdinand

    • FSSF

      Map Cubic Projection of object down to UVs with IDM_ASSIGN_UVW

      Cinema 4D SDK
      • python r21 • • FSS
      2
      0
      Votes
      2
      Posts
      393
      Views

      FSSF

      We life and learn.
      Turns out one must select the material tag with

      doc.SetActiveTag(textureTag)

      before calling the command

      c4d.CallCommand(CMD.GENERATE_UV_COORDS, CMD.GENERATE_UV_COORDS)

      to bake the projection down, down into the ground. It now works as intended.

    • FSSF

      Context Problem

      Cinema 4D SDK
      • python r21 • • FSS
      7
      0
      Votes
      7
      Posts
      1.0k
      Views

      ferdinandF

      Thanks for the update!

    • FSSF

      Bug on the Commandline

      Cinema 4D SDK
      • • • FSS
      5
      0
      Votes
      5
      Posts
      641
      Views

      FSSF

      Thanks did report

    • FSSF

      Zertificates for developer documentation expired yesterday

      General Talk
      • • • FSS
      6
      0
      Votes
      6
      Posts
      869
      Views

      fwilleke80F

      Working again, thanks!

    • FSSF

      Possible to send KeyPress Commands to the Commandline async

      Cinema 4D SDK
      • python r21 • • FSS
      3
      0
      Votes
      3
      Posts
      438
      Views

      FSSF

      Thank you for the swift reply though

    • FSSF

      fbx export plugin critical error

      Cinema 4D SDK
      • r21 python • • FSS
      8
      0
      Votes
      8
      Posts
      1.2k
      Views

      K

      Hi there, I have a similar problem. But I use R25 version.

      If I write
      exporterID[c4d.FBXEXPORT_SDS] = True or exporterID[c4d.FBXEXPORT_SDS] = False
      I get error
      AttributeError: parameter set failed

      If I comment or remove this line, export works fine.

      Maybe I should create a new topic with this issue.

    • FSSF

      Calling a blocking Plugin

      General Talk
      • • • FSS
      4
      0
      Votes
      4
      Posts
      724
      Views

      FSSF

      Understood.

    • FSSF

      Python Plugin Development

      General Talk
      • python r21 • • FSS
      3
      0
      Votes
      3
      Posts
      636
      Views

      FSSF

      Hi Ferdinand, thank you for your reply.
      You were indeed correct, my imports were not working due to bugs. If software bugs had protein, i alone could end world hunger.

      I was able to solve them after providing the
      -nogui argument, which then piped out the errors again to the commandline. This worked without in the old version of the plugin, due to it not using any imports besides the local ones (none in the \AppData\Roaming\Python\{PYTHON_VERSION}). As a result the commandline put out errors. If using imports though, the commandline swallowed the output (error+stacktrace) and stayed blank until the plugin was erroring out and the system continued with other plugin calls and the CONSTRING NOT FREED at the end.