• 0 Votes
    5 Posts
    1k Views
    B
    Thank you so much! That was it. I was thinking I would try to create this standalone, before moving it into creating a GUI, and I didn't know about the Timer in GeDialog. This is now working, and all I needed to do is remove the multithreading and change it to the timer.
  • 0 Votes
    2 Posts
    540 Views
    i_mazlovI
    Hi @pyxelrigger , Unfortunately your question is out of the scope of support on this forum, namely: We cannot provide support on learning C++, Python, or one of their popular third-party libraries. With that's said, I'm kind of missing the main idea behind your question, in other words what are you trying to achieve? Is it just another (e.g. simply more convenient) data structure for the hierarchy? If so, then you're free to create whatever data structure fits your need the best. For example, check a very fast draft code snippet below. Is it that you want to track changes of the hierarchy? If so, then you might need to come up with some more complex setup, e.g. involving using the c4d.EVMSG_CHANGE message. Please, refer to a great Ferdinand's answer here: Best way to detect an object has been deleted? Please also consider visiting our How to ask Questions section of the support procedures for your future postings. Cheers, Ilia A super draft example of nested lists hierarchy representation: import c4d doc: c4d.documents.BaseDocument class HierarchyObject: def __init__(self, op): self.op = op self.children = [] child = self.op.GetDown() if op else doc.GetFirstObject() # recursion entry point while child: self.addChild(HierarchyObject(child)) # recursion child = child.GetNext() def addChild(self, child): self.children.append(child) def toString(self, indentation: int = 0): indentStr: str = '\t' * indentation name: str = self.op.GetName() if self.op else '___root___' s: str = f'{indentStr}<{name}' if self.children: s += ':' for child in self.children: s += f'\n{child.toString(indentation + 1)}' s += f'\n{indentStr}' s += '>' return s def __str__(self): return self.toString() if __name__=='__main__': root: HierarchyObject = HierarchyObject(None) print(root)
  • 0 Votes
    7 Posts
    1k Views
    S
    Yes, I know about not using multiple events. I was playing with that, I thought that's the reason the button was not being called Thank you @ferdinand
  • 0 Votes
    3 Posts
    669 Views
    kangddanK
    Thank you @m_adam It seems that the best approach is to manually create a null object and calculate its correct rotation matrix through certain methods to achieve the same effect. Once again, thank you for your code; it has been very useful to me!
  • TagData plugin undo issues

    Cinema 4D SDK python windows
    6
    0 Votes
    6 Posts
    1k Views
    ferdinandF
    No need to be sorry, a good to hear that you found your solution!
  • Negative Vertex Map values

    Moved General Talk python r25
    3
    0 Votes
    3 Posts
    990 Views
    P
    hey, found the error. works exactly as i had planned. my code was correct, but i forgot to switch off use fields on the new vertex i mapped. thanks for the help anyway! [image: 1717679020556-4761c896-9141-42d3-8872-df429c5441df-grafik.png]
  • Updated Redshift node material examples

    Bugs c++ python
    4
    2 Votes
    4 Posts
    1k Views
    DunhouD
    Hey @ferdinand , Thanks for your answer, unfortunately, the answer is the same as I thought, and I am powerless to do anything about it. I can only wait for the exposed parameters. Based on your suggestion, there may be many issues, and it is not worth spending a lot of time debugging them. Fortunately, this is not a very urgent task. Cheers~ DunHou
  • 0 Votes
    3 Posts
    730 Views
    gheyretG
    Thanks for your explanation @m_adam , Yes it's a CommandData plguin but no GeDialog. Because of some limitations, I had to use PySide to create my plugin's special user interface.
  • 0 Votes
    4 Posts
    638 Views
    ferdinandF
    Hey everyone, just to add a little disclaimer here, as Maxime gave a very hacking friendly answer with the a bit tame warning 'do it at your own risk'. What you are tyring to do is out of scope of support because it is a violation of the threading restrictions. The whole core message system is about events and UI, both things that are inherently bound to the main thread. Maxime's code just circumvents the main-thread check someone once put into our code for a reason, as that person also made sure to put a warning into the docs. When you are someone like Maxime, i.e., you know all the bits and bytes of Cinema 4D on a first-name basis, you can make a workaround like this work. But for everyone else I would strongly recommend not circumventing such things in production code. Just because a hack runs fine on a development machine, does not mean that a customer might not lose work due to a crash induced by such hack. The underlying issue we talked about this morning, is that in C++ one can easily defer things to the main thread with the aptly named ExecuteOnMaainThread while in Python one cannot. We are aware of this issue but it is quite costly to solve. An outcome of this thread, was that we at least promoted the priority of the already existing ticket for this issue in our task pool. We can however give no ETA when we will fix this, as doing this will cost quite some time. Cheers, Ferdinand
  • 0 Votes
    3 Posts
    905 Views
    ThomasBT
    @ferdinand Thanks a lot Ferdinand for your time and effort. It is always admirable how carefully and thoroughly you answer many questions. At first it was often difficult to understand and follow your code examples...now it is a little easier. Thanks for that. I found out that the following method also does the job: c4d.SendCoreMessage(c4d.COREMSG_CINEMA, c4d.BaseContainer(c4d.COREMSG_CINEMA_FORCE_AM_UPDATE), 0) Sorry for the second question about why this buttonDesc[c4d.DESC_FITH] = True buttonDesc[c4d.DESC_SCALEH] = True in the GetDDescription method are not working. I thought this is a follow-up question. I will open another topic for that.
  • 0 Votes
    3 Posts
    514 Views
    gheyretG
    Hi @ferdinand, Thanks for your reply. I just want to make sure if it's possible. And I'll try the BaseDraw.DrawObject later.
  • Change icon of python script in UI palette

    Moved General Talk python macos
    5
    1
    0 Votes
    5 Posts
    1k Views
    ferdinandF
    Hey @InterfaceGuy, you did nothing wrong here, that was an understandable mistake and we do not mind moving topics from time to time. But at the same time we still have to uphold our rules. Cheers, Ferdinand
  • How to generate a tag?

    Cinema 4D SDK python 2024
    3
    0 Votes
    3 Posts
    590 Views
    F
    Ok thanks. Will do that!
  • BaseDraw.DrawHUDText in Cinema4D 2024

    Cinema 4D SDK 2024 python
    6
    0 Votes
    6 Posts
    1k Views
    ferdinandF
    Hello @FlavioDiniz, thank you for reaching out to us. No, that was not fixed in 2024.4. The current plan is to fix it an upcoming minor release, but as always we cannot give any guarantees regarding an ETA. There are currently no workarounds for the other issue. Cheers, Ferdinand
  • 2024.4.0 crashes when setting key-values

    Moved Bugs 2024 python windows
    5
    0 Votes
    5 Posts
    2k Views
    M
    Hi @ThomasB, sorry for the issue. This is going to be fixed in the next version of Cinema 4D. With that's said you can workaround the issue by using directly SetParameter like so: # key[c4d.ID_CKEY_PRESET] = 2 key.SetParameter(c4d.DescID(c4d.ID_CKEY_PRESET), 2, c4d.DESCFLAGS_SET_NONE) Thanks for the report ! Cheers, Maxime.
  • 0 Votes
    4 Posts
    651 Views
    i_mazlovI
    Hello @Hongzz, 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 When removing all the path handling fluff from your code, everything works as expected (the layout is created properly, when runs from both "Execute" button and the menu item). Please check the attached script below. This actually means that there's something fishy going on with the files on your filesystem or the way you're dealing with them. I'd suggest improve handling edge cases, when the path doesn't exist or when there're no files in the specified path. There're a couple more comments on your posting. First of all, storing your dialog in the global scope of the script is a "hack" that is a) highly not recommended in general b) exceptionally not recommended for being shipped to the end user. You should consider developing a plugin instead, if you need your dialog to be persistent over multiple openings of your dialog. You can have a look into our github repository for some references, e.g. the CommandDataDialog example. Secondly, please consolidate your consequent messages in a single posting as it improves the readabily of the forum (please check the "Support Topic Rules" part of our Support Procedures). For your previous message I've already done this for you. Cheers, Ilia The code snippet without unnecessary path handling parts: import os import c4d class ImportDialog(c4d.gui.GeDialog): BUTTON_ID_BASE = 1000 def __init__(self): self.files = ['myFile1.c4d', 'myFile2.c4d', 'myFile3.c4d'] def CreateLayout(self): self.SetTitle("Import C4D Projects") for index, file in enumerate(self.files, start=self.BUTTON_ID_BASE): filename = os.path.splitext(os.path.basename(file))[0] self.AddButton(index, c4d.BFH_CENTER, name=filename) return True global_dialog_instance = None def main(): global global_dialog_instance if global_dialog_instance is None: global_dialog_instance = ImportDialog() global_dialog_instance.Open(c4d.DLG_TYPE_ASYNC, defaultw=400, defaulth=50) if __name__=="__main__": main()
  • Browsing field layers causes dangling/not alive references

    Moved Bugs 2024 python
    4
    0 Votes
    4 Posts
    1k Views
    ferdinandF
    Hey @baca, feel free to send us a mail to sdk_support(at)maxon(dot)net in case you cannot share code publicly. But we have to have a look at your code to see what is going on. When you say this worked before, we either have a soft regression (you did something which you should not but it somehow worked and we now broke that) or a strong one (we broke something that should work) on our hands. And for that we will need code to see what is going on. And I would not say that the performance penalty is dramatic, it more likely will be neligable. But if everyone would do that everywhere, Cinema 4D would come to a crawl. I would say you can ship your plugin with that "fix" when it does not cause any issues for you. But we should work towards solving this properly. Cheers, Ferdinand
  • Drag Object in GeDialog.AddEditText

    Cinema 4D SDK windows 2024 python
    4
    0 Votes
    4 Posts
    710 Views
    ferdinandF
    Hey @pyxelrigger, sure you can use the string custom GUI. You could also use a base link or a filename field which be the more natural solutions for this. But you asked for AddEditText and that is what I answered. Cheers, Ferdinand
  • UuidInterface.ToString() raise a TypeError.

    Cinema 4D SDK windows python 2024
    3
    0 Votes
    3 Posts
    543 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