• 0 Votes
    11 Posts
    2k Views
    Tasos MagkafasT
    @m_adam Dear Maxime thanks for everything! But, unfortunally now that I almost finished this part I realized that all this scripting doen't give me the desired procedural result. It just changes the values once but if i change the values of the PARENT object the OBJECT_A (child) is not updated... Anyway I have to approach it in a different way. I think I should tag this thread as "SOLVED" and in case I need again help i create a new one. Please advise me Maxime. And for one more time THANK YOU both , Maxime and Zipit
  • Custom GUI button via resource description

    Cinema 4D SDK c++ r20 r21
    3
    0 Votes
    3 Posts
    590 Views
    C4DSC
    @PluginStudent You mentioning the BITMAPBUTTON and with the help of ExampleSculptGrabBrush::GetDDescription from the cinemasdk I was able to make it work. Thanks.
  • Custom FIELDLAYER_CHANNELFLAG

    Cinema 4D SDK r20 c++ classic api maxon api r21
    7
    1
    1 Votes
    7 Posts
    1k Views
    mikeudinM
    @m_adam @zipit @PluginStudent OK, thank you guys!
  • Cannot write specific values to UVWTag

    Cinema 4D SDK r20 r21 c++ python
    6
    0 Votes
    6 Posts
    644 Views
    r_giganteR
    It's actually due to a lower number of bits used to store the floating value.
  • Update button

    Cinema 4D SDK python r20 r19 r21
    4
    1
    0 Votes
    4 Posts
    1k Views
    pyxelriggerP
    Thanks! seems to work well! the problem is that apparently it only runs on the tag, if I set the option as a UserData of my object, it doesn't work
  • 0 Votes
    3 Posts
    593 Views
    M
    While the method provided by Zipit Is fine, it is not 100% reliable. here how to achieve, unfortunately, the ELEMENT_Count value is hardcoded and no way for you to retrieve it. constraintTag = doc.GetActiveTag() targetCount = constraintTag[c4d.ID_CA_CONSTRAINT_TAG_PARENT_TARGET_COUNT] for i in range(targetCount): CONSTRAINT_ELEMENT = 10 # This is hardcoded targetId = c4d.ID_CA_CONSTRAINT_TAG_PARENT_TARGET_COUNT + i * CONSTRAINT_ELEMENT + 1 print(constraintTag[targetId]) Cheers, Maxime.
  • Set Track Data Method?

    Cinema 4D SDK r21 python
    4
    0 Votes
    4 Posts
    371 Views
    B
    @zipit @m_adam Apologies for the late response. Thank you for the confirmation both. I will close this for now.
  • 0 Votes
    8 Posts
    905 Views
    r_giganteR
    Hi @JuicyJuggles , I apologize for coming late here but luckly you've been already provided in the meanwhile of some good guidance from @PluginStudent and @zipit . Rest assured that the API documentation is, by far, the best place where to look for answers although I can see that, due to huge number of covered topics, it could take time to get used to browse it effectively. Last but not least, if the issue is addressed, don't forget to mark the right post as correct answer or if it's not possible to identify a specific one, to set the whole topic as Solved Cheers, Riccardo
  • First time compiling of plugin with R21

    Cinema 4D SDK r21 c++ sdk
    5
    3
    0 Votes
    5 Posts
    829 Views
    P
    Yes, I must read the manuals more throroughly (RTFMS). Excuses: it is so much and I just wanted to compiler R20 in R21. But you are correct. BUT, adding iferr to the code worked, AND also solved the other issue. Everything is working now! Thanks!
  • ParallelFor with race conditions

    Cinema 4D SDK c++ windows r21 r20 maxon api
    4
    0 Votes
    4 Posts
    639 Views
    ManuelM
    hi, that really depends on what you are doing. There's different type of lock for different cases and scenario. That also depends on what you care first, speed or memory. but the manual is pretty easy to understand, just pass the lock as a reference to your lambda function and you should be good to go. Cheers, Manuel
  • 0 Votes
    7 Posts
    734 Views
    ManuelM
    @mp5gosu thanks for the addition. Cheers, Manuel
  • 0 Votes
    8 Posts
    1k Views
    I
    Hello to all @zipit said in GetFontDescription() on Windows and Mac: FONT_FLAGS Thank you i miss flags in https://developers.maxon.net/forum/post/58961
  • 0 Votes
    4 Posts
    1k Views
    ManuelM
    Hi, I often use the python generator to create some prototype myself. So it's ok for me. But if you want to give or sell your result, you should move to a plugin. It's not hard at all, if you already did that prototype, the plugin is easy, and we are here in case you have some issue. Nice result Cheers, Manuel
  • Can't work out BaseDocument.StartPickSession

    Cinema 4D SDK python r21
    7
    0 Votes
    7 Posts
    1k Views
    M
    Without a further reply from you until tomorrow I will consider and mark this topic as solved, but feel free to open it again if you have more information. Cheers, Maxime.
  • Extending the Command Line with Python

    Cinema 4D SDK python r21
    10
    0 Votes
    10 Posts
    3k Views
    moghurtM
    @jwzegelaar said in Extending the Command Line with Python: We found a good workaround! We now made a custom commandline plugin where we can add our own arguments. And it works great. If anybody in the future has this issue you can always contact us and we will help. Thanks again everybody for all the help! Hi jwzegelaar, I believe that I share the same needs as you, where I also need to pass in external parameters via a .py file to make modifications to the file before rendering. Unfortunately, I am encountering the same issue as you. Although this post has been quite some time, I am still hopeful for your assistance. Your help would be greatly appreciated and it is highly important to me.
  • 0 Votes
    3 Posts
    822 Views
    M
    Hi sorry I overlook your answers, There is no way to directly change the path in the RenderQueue to do so, you have to edit the document. So before adding a document, you need to load them, then define the path in the render setting and then resave the file. Here a quick example. import c4d # Load the document docPath = r"PATHtoc4dFile.c4d" doc = c4d.documents.LoadDocument(docPath, c4d.SCENEFILTER_OBJECTS | c4d.SCENEFILTER_MATERIALS, None) # Retrieves the active render setting renderData = doc.GetActiveRenderData() # Set the new path for the picture renderData[c4d.RDATA_PATH] = r"MyPicturePath.exr" # Save the document c4d.documents.SaveDocument(doc, docPath, c4d.SAVEDOCUMENTFLAGS_DONTADDTORECENTLIST, c4d.FORMAT_C4DEXPORT) Cheers, Maxime.
  • MouseWheel different between R20 and R21

    Cinema 4D SDK
    3
    0 Votes
    3 Posts
    449 Views
    C4DSC
    @r_gigante Well ... this is embarrassing. I came up with the R21 code using notes I had collected over the years, and was rather confused seeing this didn't port over to R20. Actually the correct code should look like following: Bool MyUserArea::InputEvent(const BaseContainer& msg) { const Int32 dev = msg.GetInt32(BFM_INPUT_DEVICE); const Int32 chn = msg.GetInt32(BFM_INPUT_CHANNEL); if (dev == BFM_INPUT_MOUSE) { if (chn == BFM_INPUT_MOUSEWHEEL) { const Float wheel = msg.GetFloat(BFM_INPUT_VSCROLL) / 120.0; Int32 mx = msg.GetInt32(BFM_INPUT_X); Int32 my = msg.GetInt32(BFM_INPUT_Y); Global2Local(&mx, &my); ApplicationOutput("Mousewheel value @ at x=@, y=@", wheel, mx, my); return true; } } return false; } No need at all to perform a GetInputState to obtain the the x and y coordinates from, as the BaseContainer to get it from is already provided as "msg". And this works both for R21 and R20. Man ... sometimes you think you know what you're doing, and then it seems you just know squad. Embarrassing! Riccardo, terribly sorry for wasting your time!
  • Fun with maxon::BaseArray

    Cinema 4D SDK c++ r20 r21
    5
    0 Votes
    5 Posts
    700 Views
    r_giganteR
    I need to spend some further consideration since it looks like I was unprecise. When the BaseArray::Append() and the capacity of a BaseArray is reached - BaseArray default size is 16 elements - the internal BaseArray::IncreaseCapacity()is called and it sequentially allocates a new memory block, copies the values of the previous block to the new one, and then the old one is released. Being the values passed to the BaseArray::Append() a reference to myArray[0], it references the first element of the old block and because the code in Append() accesses the reference after the old block has been released, that access is illegal. @r_gigante said in Fun with maxon::BaseArray: To temporarily mitigate it you have to cast the value returned from the [] operator before appending it to the proper type. Actually by writing Int32(myArray[0]) - and here I was indeed unprecise because it is NOT casting but temporary local creating of a copy - a local Int32 copy of myArray[0] is made on the stack at first by the compiler (before calling Append) and then Append(Int32(myArray[0])) references that local copy which is legal. This behavior is NOT a bug - another initial overlook of mine - but rather a behavior by design which for example is also part of std::vector::push_back(). So, as a rule of thumb, cases where references to array elements are used while the array gets resized must be avoided. This note will be added to the BaseArray Manual in our documentation. Sorry for the confusion I initially generated and, if further clarification are needed, feel free to come back. R.
  • ParallelFor: TestBreak()

    Cinema 4D SDK c++ r20 r21
    7
    0 Votes
    7 Posts
    681 Views
    ManuelM
    hi, as @PluginStudent said i was using GeGetEscTestThread and by the way, it's not really working But that's the same question with your code. You test the thread that have been provided to you or your own thread. For that you pass that thread as a reference to the lambda function. Cheers, Manuel