• Change Dialog Text color

    Cinema 4D SDK 2024 python
    4
    0 Votes
    4 Posts
    679 Views
    i_mazlovI
    Hello @momoko , 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 Thanks to @Dunhou for providing correct solution! Cheers, Ilia
  • 0 Votes
    7 Posts
    2k Views
    DunhouD
    Hey @m_adam , Can we port this DataDescriptionDatabaseInterface in python in some up-coming versions? this would be handy for some converting progress, now if I want to convert data, I have to manually writhe to node id, it is worth an automatic solution and we already have this. Cheers~ DunHou
  • Undraw Slider in TreeView?

    Cinema 4D SDK windows python 2024
    3
    2
    0 Votes
    3 Posts
    609 Views
    gheyretG
    Hi!@ferdinand Yes , That's what i want to do! I never didn't know LV_CHECKBOX_HIDE would work with LV_SLIDER, I simply assumed that it would only work with LV_CHECKBOX and LV_CHECKBOXUSER. But anyway i test it in my code , and it works perfectly! Thank you so much for your reply. Cheers~
  • Python Documentation - Icon Color

    Cinema 4D SDK 2024 python
    4
    0 Votes
    4 Posts
    1k Views
    i_mazlovI
    Hi @del, It's hard to predict future changes. It's likely the c4d.ID_BASELIST_ICON_COLORIZE_MODE_CUSTOM + 1 approach would stay untouched for the compatibility reasons, but who knows if there'd be any change requests that'd break this. Cheers, Ilia
  • 2 Votes
    3 Posts
    536 Views
    M
    Hi thanks for the detailed report, I fixed the issue it be available in the next non-hotfix release. As a workaround you can do dId = c4d.DescID(c4d.ID_LAYER_LINK) allObjects[i][dId] = myLayer Cheers, Maxime.
  • DrawHUDText issue with viewport camera navigation

    Moved Bugs 2024 python
    5
    3
    0 Votes
    5 Posts
    2k Views
    FlavioDinizF
    Thanks a lot @i_mazlov ! The issue is solved !
  • 0 Votes
    3 Posts
    669 Views
    K
    Hi @ferdinand , Thank you for clarifying. I needed a solution for my tool to determine which track/key is displayed&selected. But if I can't do that in user mode, I'll make sure my tools don't work when the timeline is in user mode.
  • Unable to set override in take

    Cinema 4D SDK python
    4
    0 Votes
    4 Posts
    749 Views
    ferdinandF
    Hey @robpayne that is great to hear, thank you for informing us!
  • 2024.3.0 SDK Release

    News & Information cinema 4d news c++ python sdk
    6
    2 Votes
    6 Posts
    2k Views
    ferdinandF
    Hey @no1astrologer, this will be fixed in the next release.
  • Can we handle drag document from treeview?

    Cinema 4D SDK windows python 2024
    3
    0 Votes
    3 Posts
    587 Views
    DunhouD
    Hi @i_mazlov , Sadly the GenerateDragData() not work in python, I had try the c4d.DRAGTYPE_FILENAME_SCENE, but it will return bad without GenerateDragData(),seems nothing we can do here. Cheers~ DunHou
  • 0 Votes
    4 Posts
    703 Views
    B
    Follow up but slightly unrelated question. If I have a GeDialog plugin with an edit field(for changing the Frame of a marker for example), is it possible to have it update while dragging vs on release? Is that some sort of CoreMessage thing? Right now I have a call inside of my Command function that basically says if the ID matches the edit field then set the marker frame. But I would like to be able to click and drag and see the marker's position move as I drag. Is that possible
  • Foldable Groups in Python GeDialog

    Cinema 4D SDK python 2024
    5
    0 Votes
    5 Posts
    957 Views
    i_mazlovI
    Hi @BretBays, Sorry for the delayed answer. Depending on how you picture the final look of your gui and how complex the behavior you'd like to have there, the means can be different. There's no easy way to achieve the same look as with "Freeze Transform" inside GeDialog. The suggested way would be to implement the logic manually and hide/show content by the button or a bitmap button. Such approach is demonstrated in the following examples: gedialog_menu_hide_content_r15.py that's pointed out by @Dunhou shows how to hide/show content customgui_quicktab_r19.py shows how to organize switch between your data using tab buttons If you really want to have the exact same look as foldable groups in the Description context, you could probably try drawing your layout with the DescriptionCustomGui that is capable of that (c++ example). However, I personally don't think this approach is worth the effort. Cheers, Ilia
  • Changing axis rotation position

    Moved General Talk python 2024
    8
    1
    0 Votes
    8 Posts
    2k Views
    S
    @ferdinand I've played with your idea for a bit and then realized, that the point where the adj meets the ground is wrong, as it should be the point where a circle or f = opp with center in O meets the ground. Eventually I decided to just hack it a bit and change the position of the rotating object and the object inside to counter that move. Here's the result: cards_script_v06-thickness.mp4
  • 0 Votes
    3 Posts
    617 Views
    M
    Thanks you answered my question, if it solves my problem we will see.
  • 0 Votes
    3 Posts
    540 Views
    D
    @i_mazlov thanks ilia!!! ok that was truly obvious actually had to use 'c4d.documents.GetActiveDocument()' to make it work in my case ...
  • Python generation script doesn't work

    Cinema 4D SDK python windows 2024
    2
    2
    0 Votes
    2 Posts
    452 Views
    ferdinandF
    Hello @eegoridze, 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 I would like to point you to four sections in our Support Procedures: Scope of Support: "It doesn't work" is not a support request and we cannot debug your code for you, but instead provide answers to specific problems. Asking Questions: Repeatable: Your claims or problem should be repeatable for us. In most cases this means posting executable code which demonstrates your problem, with the emphasis being on executable. We should be able to paste this code into an editor and then run or compile it without having to write code ourselves. When you just post snippets, this usually means that we will not run your code, as we do not have the time to invent all the code around it. Ignoring this also comes with the substantial risk that you do not post the code which contains your actual mistake/problem.. Asking Questions: Sparseness: Your problems should be sparse, or in other words you should spend some time on boiling down more complex problems. When you, for example, are writing a plugin with which one can create trees with physics and all sorts of fancy things, and you run into a problem, you should spend time on removing as many fancy things as possible, so that we have an easier time helping you. Code examples should only very rarely have more than one thousand lines of code. Reporting Bugs & Crashes: The whole section applies here. While it is understandable that users sometimes violate some of these rules, it is here a bit much. Sparseness: You certainly could have spent some time on pruning your script from things you can remove without removing your problem. Repeatable: We cannot run your code. While you have provided the source code, you have not provided the scene file and possibly other files which are necessary to run this. Reporting Bugs & Crashes: When you have provided (2), you should follow the pattern we require to report bugs and crashes, even when they are your own. It is all about reproducibility and clear instructions. General Advice It is obvious that you have put quite some work into your script and also work into your question here. Thousands lines of code do not write themself and screenshots also do not make themself. But my major advice would be here: "Be more strategic about how you approach things." Writing software is all about breaking things into manageable problems and you seem to try to do everything at once. Which is fine if you are a pro and never make mistakes, but it usually bites you royally in the butt when you run into problems. Remove Non-Const Code from Module Scope In the first 100 lines you have a lot of code in the module scope. You can initialize global constants in the module scope, but you should certainly not open dialogs there. This is just a big no-no as it not only makes your code hard to read - when is happening what, you cannot just start reading in the main function -, but also comes with the problem that some of the code will run when the module is initialized and some when the execution context __name__ is "__main__". [image: 1707760026417-2189247f-36d5-4980-a0ca-aa44f1a95f40-image.png] Divide and Conquer & Abstract There is very little abstraction in your code, which again is fine when you are pro who never makes mistakes, but becomes a problem when you must debug things, as you then have to deal a monolithic piece of code where it is hard to turn off things or understand what is happening. When I take the first lines of your main function: [image: 1707764358023-223b2359-9eec-48c0-9f7b-51bc9a774c4e-image.png] If I would rewrite this, it would look like this: import c4d import mxutils class ObjectGroup: """A class to group objects and set their visibility. """ def __init__(self, groupName: str, parent: c4d.BaseObject) -> None: """Initializes the class. """ self.groupName = groupName self.objects = mxutils.CheckType(parent, c4d.BaseObject).GetChildren() # It seems a bit questionable to me to store the names of the objects in a separate list, # since the data is so easy to access on a node, but I went with it here. self.names = [i.GetName() for i in self.objects] self.SetVisibility() def SetVisibility(self, state: int) -> None: """Sets the editor and render visibility of the objects in the group. """ for obj in self.objects: obj[c4d.ID_BASEOBJECT_VISIBILITY_EDITOR] = state obj[c4d.ID_BASEOBJECT_VISIBILITY_RENDER] = state def __iter__(self) -> tuple[str, c4d.BaseObject]: """Iterates over name, object pairs. """ for name, obj in zip(self.names, self.objects): yield name, obj def __getitem__(self, index: int) -> tuple[str, c4d.BaseObject]: """Gets the name, object tuple at the given index. """ if index < 0 or index >= len(self.objects): raise IndexError("Index out of range.") return self.names[index], self.objects[index] def GetObjects(doc: c4d.documents.BaseDocument) -> dict[str, ObjectGroup]: """Gets the objects from the document. """ # Get the objects from the document, be defensive about our assumptions, here we assume that # the document contains at least eight objects, but we should check it. objects: list[c4d.BaseObject] = doc.GetObjects() if len(objects) < 8: raise ValueError("The document must contain at least eight objects.") # Now we create one data structure to hold all the object groups, this makes it easier to use. # I personally would crate a class to hold the object groups, but I went with a dictionary here # to keep it simple. return { "glasses": ObjectGroup("glasses", objects[0]), "masks": ObjectGroup("masks", objects[1]), "jewelery": ObjectGroup("jewelery", objects[2]), "headgear": ObjectGroup("headgear", objects[3]), "clothes": ObjectGroup("clothes", objects[4]), "hairs": ObjectGroup("hairs", objects[5]), "eyes": ObjectGroup("eyes", objects[6]), "special_accessories": ObjectGroup("special_accessories", objects[7]) } def main(): """ """ # Now can just call #GetObjects and get the data we need. data: dict[str, ObjectGroup] = GetObjects(doc) # Now we continue in this style, where we "divide and conquer" the problem, i.e., split things # into sub-problems and solve them one by one. So that we can have here in the main function only # the high-level logic. restrictions: list[str] = GetRestrictions(RESTRICTIONS_FILE) ApplyRestrictions(data, restrictions) # ... Doing this will help you to help yourself, as you would get more control over your own code. Conclusion Some of my colleagues are a bit less squeamish than me when I comes to spaghetti code, but I doubt that they are willing to debug your 800 lines of single letter variables. Try to make your code more abstract and clean, you will likely fix the problem yourself in the process. For me it is currently not really possible to follow your code and with that give you meaningful advice. If not, come back with a pruned version of your code, provide all data, and reproduction steps. And with pruning I mean really prune it. Try to remove as many things as possible. You should also be verbose about what your problem is. I think you are encountering freezes, "the program just hangs" but you only mention that somewhere in the middle of your posting. Cheers, Ferdinand
  • Need help with python field - infection

    Cinema 4D SDK python 2024
    6
    0 Votes
    6 Posts
    1k Views
    ferdinandF
    Hey @SweepingMotion, first of all, I did not want to discourage you as such this would be only possible in C++. All I am saying here is that having points in a mesh which look up their neighbors and then do a possible iterative spreading algorithm per iteration sounds costly. You can certainly do this in Python, you should just brace for really bad performance when you run this on complex meshes with complex settings. That I used the modelling command for the growing part was not only based in my laziness but also the fact that the modelling command will run in C++ nice and fast. Your Problem Regarding your problem, I think I understand what you want. You want a field to (persistently) paint a vertex map to use this as a seed to run your simulation; think of a paint brush (the field) on canvas and the paint then spreading (the simulation). First of all, fields are not really meant to be persistent in that manner as that would be required here. Or to use your example, you would want your ballon tearing to continue even when the field on the tip of the needle is not touching any ballon vertex anymore after the ballon started tearing appart. Fields are also not meant to do these whole field space computations a simulation implies. I.e., you get the point x and the field sampler spit out values for its weight and vector. A field modifier layer would be better suited for running a simulation as they focus more on all values in a field. The problem is that modifiers do not do the sampling part for a transform with a falloff. So you would kind of need both. One could certainly do all this when motivated enough. You could for example simply precompute all values and then sample from a look-up table/cache when your field is sampled. But this all seems very complicated for no good reason. Recommendation I would still recommend using at least a Python TagData plugin. C++ would be better, using a Programming tag also works, but you must be hackier, be more knowledgeable to make it work. There are two ways how you could realize the field/brush influence thing you want: Ignore Mograph fields altogether. Here you would implement your own ObjectData plugin which does the painting. You would have two parts, the object(s) which are continuously painting sees into a vertex map, and your spider-in-the-net tag which then runs a simulation on that map. You would only need one vertex map in this case but would also have to reimplement falloffs and noise for the fields/brushes to the degree you need it. You use Mograph fields but you do not mix them with the simulation directly. The idea is to have two vertex maps. One seed vertex map is driven by MoGraph fields and you can go ham there, use all of MoMgraph to your liking. Your plugin tag would then copy from that seed map into a simulation map on each iteration and advance the simulation. For example by either blending values or taking the max value of both maps. On that other map you then run the simulation. This would have the advantage that you have the temporal persistence for free (since you copy from a volatile seed map into the persistent simulation map). You would also side step the fact that you would have to somehow weave the simulation into fields. If you wanted then wanted to pretty this up, you could make it so that your tag has field list and for the user it looks like that there is only the one output vertex map while the tag uses internally a hidden vertex map into which it feed the field list which is part of its UI. Number two is in my opinion the more sensible solution, number one would give you more freedom but would also be much more work. Cheers, Ferdinand
  • C4D crashes when removing node via MSG_MENUPREPARE

    Cinema 4D SDK python
    3
    0 Votes
    3 Posts
    712 Views
    M
    Hi @merkvilson I would say what you are trying to do is not well supported and MSG_MENUPREPARE was never designed for the current node to be removed. The correct way to do so, is to return False within your NodeData.Init method, this way the object is not created and therefor you do not have to remove it. Cheers, Maxime.
  • Prevent selection

    Cinema 4D SDK python
    2
    0 Votes
    2 Posts
    652 Views
    i_mazlovI
    Hi @merkvilson , If I understand your goal correctly, you would like to have your object/tag plugin being "unselectable" in the object manager, such that any previously selected objects would stay selected. Unfortunately, this is not directly possible. What you would like to have is the same behavior of your plugin like it was on a locked layer. There was already an adjacent discussion about this: How to hide object local coordinates. However, you can theoretically emulate such behavior by tracking current selection in cinema and catching the event of your plugin being selected. At this point you could "undo" the selection by unselecting your plugin and selecting back what was selected before. However, for that you would need a SceneHook, which is only available in the C++ SDK. What is more, such approach does not sound like something robust and reliable, especially when used with some 3rd party plugins that you're not aware of beforehand. Cheers, Ilia
  • Python field error

    Cinema 4D SDK python 2024
    9
    0 Votes
    9 Posts
    2k Views
    S
    @m_adam said in Python field error: A fix is coming in one of the next version of Cinema 4D, so that OutputBlockSize == InputBlockSize and therefor you will not need to add this "useless" values at the end to fullfill the outValues. That's great news. I'll hold off till then.