• 0 Votes
    5 Posts
    793 Views
    gheyretG
    @ferdinand Indeed, the allure of good looks can be captivating at times. In fact, my primary objective was to explore the development of a pie toolbar, which may seem unconventional but has always held a deep fascination for me. I sincerely appreciate your valuable advice and will certainly give it a try. Cheers, Gheyret
  • Reading skeleton data from Character Definition tag

    2024 python
    2
    0 Votes
    2 Posts
    482 Views
    i_mazlovI
    Hello @Gregor-M , Welcome to the Plugin Café forum and the Cinema 4D development 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 Guidelines, as they line out details about the Maxon SDK Group support procedures. Of special importance are: Support Procedures: Scope of Support: Lines out the things we will do and what we will not do. Support Procedures: Confidential Data: Most questions should be accompanied by code but code cannot always be shared publicly. This section explains how to share code confidentially with Maxon. Forum Structure and Features: Lines out how the forum works. Structure of a Question: Lines out how to ask a good technical question. It is not mandatory to follow this exactly, but you should follow the idea of keeping things short and mentioning your primary question in a clear manner. About your First Question What you're trying to achieve is supposed to be happening on the main thread. It's difficult to guess the reasons of the crash you're stumbling across without any further information (e.g. the code showcasing the issue), but could be that MTCharacterBodyPart.GetParameters() function is not a thread-safe one. Cheers, Ilia
  • ModuleNotFoundError, but the file is in the same folder

    windows python s26
    3
    0 Votes
    3 Posts
    543 Views
    G
    I see, thanks. But honestly i don't get it why the plugins folder isn't in the search path...
  • "maxon::GenericData &extraData" is not documented

    2024
    2
    1
    0 Votes
    2 Posts
    492 Views
    ferdinandF
    Hey @kbar, Thank you for reaching out to us and pointing out the missing documentation. I will fix that. In the mean time I would recommend having a look at the Gradient and Field Sampling example in the migration guide, as I did explain the principal changes there. In short, extraData is the means with which sampling has been made const. Before, sampling did change the field instance, now the to be mutated data has been separated out into that 'extra data', and you get your extraData when initializing the sampling. In the example I covered Sample, but things translate directly to DirectSample. Cheers, Ferdinand Code from the migration guide: iferr_scope; // #field is a #FieldObject sampled by the #BaseObject #effector. See the full example for details. // The input location we want to sample and the output data. We are only interested in sampling // FIELDSAMPLE_FLAG::VALUE, i.e., the field influence value of the field at point x. FieldInput inputs(Vector(0, 50, 0)); FieldOutput outputs; outputs.Resize(inputs.GetCount(), FIELDSAMPLE_FLAG::VALUE) iferr_return; FieldOutputBlock outputBlock = outputs.GetBlock(); // Create the field info for sampling the sample data #inputs for the caller #effector. const FieldInfo info = FieldInfo::Create(effector, inputs, FIELDSAMPLE_FLAG::VALUE) iferr_return; // Sample the field. In 2024.0 we now must pass on the extra data generated by the sampling // initialization so that #field can remain const for this operation. maxon::GenericData extraData = field->InitSampling(info) iferr_return; field->Sample(inputs, outputBlock, info, extraData, FIELDOBJECTSAMPLE_FLAG::NONE) iferr_return; // Iterate over the output values. for (const maxon::Float value : outputBlock._value) ApplicationOutput("Sampled value: @", value); field->FreeSampling(info, extraData);
  • New Child Render settings with python

    2024 python
    6
    0 Votes
    6 Posts
    1k Views
    M
    Thank you @ferdinand, I'll need to work out how I implement but once again a thorough and considered reply....
  • Howto to pass arguments to a python script

    python windows
    4
    0 Votes
    4 Posts
    555 Views
    ferdinandF
    Hey @Gaal-Dornik, In Cinema 4D you can bind a command to multiple shortcuts, but adding arguments is not possible. You would have to poll the keyboard yourself to distinguish such events. Cheers, Ferdinand Result: [image: 1696252767040-49a4bee1-8135-412f-b238-43d21184e071-image-resized.png] Code: """Runs different code based on which keys are pressed. Must be run as a Script Manager script. Pressing Shift+ALT+A while the script is invoked will print "Foo", while pressing Ctrl+Alt+A will print "Bar". See: https://developers.maxon.net/docs/py/2024_0_0a/misc/inputevents.html """ import c4d def CheckKeyboardState(*args: tuple[str]) -> bool: """Returns #True when the given key sequence is pressed, #False otherwise. """ result = [] for char in (n.upper() for n in args if isinstance(n, str)): if char == "SHIFT": c = c4d.KEY_SHIFT elif char == "CTRL": c = c4d.KEY_CONTROL elif char == "ALT": c = c4d.KEY_ALT else: c = ord(char) bc = c4d.BaseContainer() if not c4d.gui.GetInputState(c4d.BFM_INPUT_KEYBOARD, c, bc): raise RuntimeError("Failed to poll the keyboard.") result += [True if bc[c4d.BFM_INPUT_VALUE] == 1 else False] return all(result) def main() -> None: """ """ if CheckKeyboardState("Shift", "Alt", "A"): print ("Foo") elif CheckKeyboardState("Ctrl", "Alt", "A"): print ("Bar") else: print("None") if __name__ == '__main__': main()
  • Proper way to bake deformed mesh after adjusting joints.

    python
    2
    0 Votes
    2 Posts
    636 Views
    ferdinandF
    Hello @BretBays, Thank you for reaching out to us. Your posting does not contain an explicit question; there is no question mark in it. There is an implied question of us implementing what you describe, but the MAXON SDK group cannot do that, implement feature descriptions provided by users. I would recommend having a look at our support guidelines regarding asking good technical questions and the scope of support. About your Question If you want to CTSO, just CTSO the object or join it, we have examples for both cases in the modeling commands section of the Python examples. The problem with your function is also that it makes quite a few assumptions which do not always hold true, it for example assumes that the deform cache of something is always found directly on an object in the object manager (which is only true for editable polygon objects). What the script is calling 'direct copy' might also lead to results the user does not consider to be a copy. CSTO is the way to go to 'duplicate that deformed shape to a simple mesh with no deformer'. If the output is then not a singular object, you can join the output or a subset of it. Cheers, Ferdinand
  • How to access the BaseContainer of an Command-Dialog

    r23 2023 2024 python windows
    5
    0 Votes
    5 Posts
    1k Views
    ThomasBT
    @ferdinand This is a command, and you can c4d.CallCommand it, but that is all the control you have. thank you Ferdiand,
  • Capsules Drag & Drop

    2023 c++ windows
    7
    1 Votes
    7 Posts
    1k Views
    J
    Thanks for the response, it's all working properly now. John Terenece
  • 2024 c4d python doc link error

    python 2024
    4
    1
    1 Votes
    4 Posts
    720 Views
    chuanzhenC
    @ferdinand Great job!
  • R23 Monterey SDK compile errors

    r23 c++ macos
    9
    0 Votes
    9 Posts
    1k Views
    S
    Thanks Ferdinand. That's very helpful. TBH, for me the best option is probably to support only R2023/4/5 if that just needs the one development environment. It would be different for commercial plugins but for mine I think the most I want to do is support the 2-3 latest versions of Cinema. It just gets too confusing for earlier releases. But it's very useful to know that Monterey/XCode 13 is good for the current two latest releases and maybe the next one too. Cheers, Steve
  • c4d 2024 "MENURESOURCE_SEPERATOR"

    2024 python
    5
    2
    0 Votes
    5 Posts
    842 Views
    chuanzhenC
    @ferdinand Thanks,hope to fix spelling in c4dpython doc in future versions
  • Can't debug C4D 2023 and 2024 on macOS

    2023 2024 c++ macos
    11
    1
    0 Votes
    11 Posts
    2k Views
    fwilleke80F
    @ferdinand said in Can't debug C4D 2023 and 2024 on macOS: first, thank you very much for investing more time into this and with that saving time for me, truly appreciated. You're welcome. If any of this get any of us further it's worth the time. @ferdinand said in Can't debug C4D 2023 and 2024 on macOS: But let us discuss the details per mail. Okay! Cheers, Frank
  • C4d Connector problem in 2024

    python
    6
    0 Votes
    6 Posts
    1k Views
    M
    Hi @filipst just to let you know that with the hotfix released yesterday(20/09/2023). The issue within Cinema 4D has been solved. In the same time make sure to use the latest version of the add-on in VsCode (v1.1.0). Cheers, Maxime.
  • Add normal button in a dialog that opens a dialog to select a folder

    python
    6
    0 Votes
    6 Posts
    1k Views
    ferdinandF
    Hey @danielsian, Yes, a tree view could be another solution, another one could be a GeUserArea. I deliberately did not mention both options since they are more complex. Especially TreeViewFunctions, the underlying interface for tree views, tends to be overwhelming for newcomers. I would recommend the dynamic UI workflow hinted at above, as this will result in the least amount of code. But it will of course not be as beautiful as something truly custom. Cheers, Ferdinand
  • MergeDocument under a selected Null

    python
    2
    0 Votes
    2 Posts
    527 Views
    ferdinandF
    Hey @pyr, Thank you for reaching out to us. The sentence 'if i do the whole thing via obj.InsertUnder(null) i miss the material' is a bit ambiguous, how do you mean that? I assume you mean that when you load two documents A and B and then start copying objects over by either cloning them or removing them from A and inserting them into B, that you then miss material references. Because the call you show us will load both objects and materials found at f into doc. A straightforward way to do what you want to do, parent everything that has been imported to a null, is to track the state of the top-level objects before and after the import. The difference between the states then tells you what to move where. In practice, there are some technical hoops to jump through, primarily the problem that you might run into dead references when you try to store objects references over the import process. Cheers, Ferdinand Result: moomoo.mp4 Code: """Demonstrates how to parent the objects merged into a document to a null object. Must be run as a script manager script and will import the contents of #FILE into the active document. """ import c4d doc: c4d.documents.BaseDocument # The active document. FILE: str = r"file:///e:/test.c4d" # The document to import. def main() -> None: """ """ # Get the UUID markers of all top level objects. We get the markers and not the object # references because importing a document bears a good chance that these references will be # dead (C4DAtom.IsAlive() == False) when we access them again. uuidCollection: list[bytes] = [] op: c4d.BaseObject = doc.GetFirstObject() while op: uuidCollection.append(bytes(op.FindUniqueID(c4d.MAXON_CREATOR_ID))) op = op.GetNext() # Now we import our document. c4d.documents.MergeDocument(doc, FILE, c4d.SCENEFILTER_OBJECTS | c4d.SCENEFILTER_MATERIALS | c4d.SCENEFILTER_MERGESCENE) # We create our null object to parent the imported stuff to. We also add its UUID to # #uuidCollection, so that we do not attempt to parent #null to itself ;) null: c4d.BaseObject = c4d.BaseObject(c4d.Onull) null.SetName(FILE) doc.InsertObject(null) c4d.EventAdd() uuidCollection.append(bytes(null.FindUniqueID(c4d.MAXON_CREATOR_ID))) # Now we iterate again over all top level objects and parent everything that does not appear in # #uuidCollection to #null. op: c4d.BaseObject = doc.GetFirstObject() # We have to do this on two steps, because when we would already move #op in the first step # where we find the things to move, we would sabotage our own loop here (because as soon as # we move the first op to the null, op.GetNext() would be None). move: list[c4d.BaseObject] = [] while op: if bytes(op.FindUniqueID(c4d.MAXON_CREATOR_ID)) not in uuidCollection: move.append(op) op = op.GetNext() # Actually move the items. for op in move: op.InsertUnderLast(null) c4d.EventAdd() if __name__ == "__main__": main()
  • Casting GeListNode* to BaseObject*

    Moved
    10
    0 Votes
    10 Posts
    1k Views
    ferdinandF
    Hey @spedler, I would recommend having a look at the migration guide and the example.migration_2024 in the SDK. When you are then stuck, I would invite you to either open a new thread with concrete code higghlighting your problem or reaching out to us confidentially via our contact form and share there data with us, in case you are not at liberty of sharing your code publicly. We are here to help you along some more bumpy passages of migrating your plugin. Cheers, Ferdinand
  • Can you get a list of missing plugins?

    python
    3
    1
    0 Votes
    3 Posts
    847 Views
    K
    Thanks for the fast response @ferdinand . Sorry that the title of my question is somewhat misleading. The thread that you've linked is actually quite detailed and useful I'll take a closer look into that.
  • How to find and delete a node in a NodeGraph?

    c++ 2023
    5
    0 Votes
    5 Posts
    1k Views
    kbarK
    @ferdinand said in How to find and delete a node in a NodeGraph?: Fig. I: The two IDs are displayed in the node editor info panel for the selected node. Make sure to have Preferences\Node Editor\Ids enabled to also see the node ID in addition to the asset ID. I didn't know about this! I have been copying and pasting the selected nodes into a text editor up until now, which in itself is a very cool feature.
  • C4D 2023 on macOS: GeUserArea::DrawBitmap() not working anymore?

    2023 c++ macos
    8
    0 Votes
    8 Posts
    1k Views
    fwilleke80F
    I already tried using 8 bit greyscale. Still doesn't work in 2023 on macOS, but on the other C4D/OS combinations. Will try RGB, too. If that doesn't work either, I'll be back and try to write a minimal example. Cheers, Frank