• Get clone position over spline for Spline Based Cloner/Matrix

    python
    2
    1
    0 Votes
    2 Posts
    581 Views
    M
    Hi @baca, sadly it is not possible to get the exact same random in Python than the one used internally for this feature. So the only way would be to actually clone some objects an retrieve their position as shown in read_modata_color.py. The previous example retrieve the color and not the position, so instead of retrieving the MODATA_COLOR, use the MODATA_MATRIX. Cheers, Maxime.
  • Python Weight Painting Brush Plugin Questions

    python 2024
    2
    0 Votes
    2 Posts
    578 Views
    M
    Hi @BretBays this is correct, if you want to make a Brush the easiest way is to register a SculptBrushToolData , you can find examples in Python in Github or in C++ in Github. SculptBrushToolData is derived from DescriptionToolData, meaning they can have a description visible in the attribute manager and therefor you can add your own checkbox if needed. Cheers, Maxime.
  • Vertex Color Tag disappearing when made editable

    2024 c++
    3
    2
    0 Votes
    3 Posts
    822 Views
    D
    Thanks Ilia! That was exactly what I needed! Dan
  • how to program plugins with python?

    r25 python
    20
    0 Votes
    20 Posts
    7k Views
    love_me_renderL
    Hi, thank you for the tips. Here is my C++ -treegenerator-plugin, written for R25: http://www.klausfilm.bplaced.net/TreeGenerator/Website_Treegenerator.html Cheers Klaus
  • Python Effector with custom FieldList

    python 2024
    3
    0 Votes
    3 Posts
    789 Views
    M
    Hi @baca, this is unfortunately not possible there is some default CheckDirty in place to support the default FiledList, but since you can not override CheckDirty in an effector yourself you can't add another FieldList dependency check. Cheers Maxime.
  • Python: How to import files as modules?

    python 2024
    2
    0 Votes
    2 Posts
    666 Views
    i_mazlovI
    Hi @gaschka, In your next postings please provide more detailed description of your question. In this case you're lacking information about the file structure you're using, the code that performs the import, the information on how and what have you set the environment variable for. Regarding your question, when splitting python code into separate pieces one usually uses the concept of packages rather than raw files. Hence, your question relates to local modules you'd like to use in your script. Please, have a look at the Python Libraries Manual especially the last section about the Local Plugin Search Paths. Another point of interest for you would be a utility function LocalImportPath that simplifies the process of importing packages. If you have any further questions, please let me know and provide a code sketch that showcases your issue. Cheers, Ilia
  • GraphModelHelper.IsConnected(node, port) crash in 2024.

    2024 python windows
    2
    0 Votes
    2 Posts
    514 Views
    M
    Hi thanks for the report, python should never crash, so it's going to be fixed in the next release. In any case the port should be a valid a port, but an exception should be raised when None is passed. Cheers, Maxime
  • Python tag initalization?

    python 2024
    7
    0 Votes
    7 Posts
    1k Views
    gaschkaG
    @m_adam @m_adam said in Python tag initalization?: OM is not single threaded, Oh, that's an interesting insight for me. Perhaps I was misinformed, as Character Rigs had the tendency to get slow quite easily in C4D, and Animators look envy over to Maya, as they do have a parallel evaluation (and caching). Though I'm aware that there are changes/improvements to C4D performance lately. Thanks for the link. A lot of new information to learn an absorb
  • Python script to Python tag hand over?

    2024 python
    3
    0 Votes
    3 Posts
    886 Views
    gaschkaG
    Thanks for your help and nudging me into the right direction, I think I can work with that
  • Python: How to inject code into a Python tag?

    python 2024
    4
    0 Votes
    4 Posts
    1k Views
    gaschkaG
    Thanks to you both for your answers. @m_adam Regarning my issue with the file linking, I'll try to come up with a procedure for reproduction of my issue soon: It was quite random, but I was in the flow of writing my script, so I circumvented with the string solution, but I would prefer the file solution for sure.
  • Python: User Data Float Slider?

    python 2024
    4
    1
    0 Votes
    4 Posts
    1k Views
    gaschkaG
    @i_mazlov Thank you for the friendly introduction and the hint to CUSTOMGUI and REALSLIDER, exactly what I was looking for. @baca Thank you for the additional tip.
  • Python: GetTags() returning non-existent tags

    python
    9
    0 Votes
    9 Posts
    2k Views
    .
    thanks @i_mazlov
  • Get the "Position" of a Polygon

    Moved
    5
    0 Votes
    5 Posts
    1k Views
    i_mazlovI
    Hi James, You can use GetDeformCache() for that in place. The rest of the code would stay exactly the same, just add the following three lines before retrieving object points and polys: obj = obj.GetDeformCache() if not obj: raise RuntimeError("Couldn't retrieve objects deform cache") By the way, there's a great example that showcases the workflow with generators and deform caches: geometry_caches_s26.py Cheers, Ilia
  • Call "Set Deformed Mesh" on Weight Tag

    2024 python windows
    2
    0 Votes
    2 Posts
    578 Views
    M
    Hi you need to use call button def apply_deformed_mesh(meshes): """ Apply 'Set Deformed Mesh' on all meshes with weight tags. """ for obj in meshes: weight_tag = obj.GetTag(c4d.Tweights) if weight_tag: bc = weight_tag.GetDataInstance() # Set the button to 'Set Deformed Mesh' bc.SetInt32(c4d.ID_CA_WEIGHT_TAG_SET_BUTTON, c4d.ID_CA_WEIGHT_TAG_SET_DEFORMED_MESH) c4d.CallButton(weight_tag, c4d.ID_CA_WEIGHT_TAG_SET_BUTTON) # Update the scene c4d.EventAdd() Cheers, Maxime.
  • Script to change Navigation Camera Mode (help)

    python 2024 windows
    5
    0 Votes
    5 Posts
    1k Views
    joel_motionJ
    @i_mazlov Thank you very much for your response! I am not sure how long it would have taken me to figure out the "prefsPlugin: c4d.BasePlugin =... " part without your help. This is the code I wrote, which works exactly how I wanted it to (and now I have the script mapped to a hotkey). import c4d def main(): prefsPlugin: c4d.BasePlugin = c4d.plugins.FindPlugin(c4d.PREFS_NAVIGATION, c4d.PLUGINTYPE_PREFS) navigationValue: int = prefsPlugin[c4d.PREF_NAVIGATION_CAMERA] if navigationValue == 3: prefsPlugin[c4d.PREF_NAVIGATION_CAMERA] = c4d.PREF_NAVIGATION_CAMERA_CAM else: prefsPlugin[c4d.PREF_NAVIGATION_CAMERA] = c4d.PREF_NAVIGATION_CAMERA_CUR if __name__=='__main__': main() Thanks again!
  • How do I return the connected port from the input port?

    sdk python r19 r20 r21
    9
    0 Votes
    9 Posts
    2k Views
    B
    @Dunhou Thanks for the reference but yea I'm unfortunately using the xpresso here instead of the new node editor. Which in all regards, an unfortunate scenario is xpresso is not integrated to the new node editor. @m_adam Gotcha. Thanks. Looking forward to the update.
  • Arrange All Nodes Command/API in Xpresso?

    2023 python
    3
    0 Votes
    3 Posts
    756 Views
    B
    Thanks for the confirmation. I guess I'll just let the users do some reordering the nodes themselves. lol The nodes are creating procedurally so the nodes are just stacked on top of each other. haha
  • Easier Way to Modify Pose Morph Strength Based on Name?

    2023 python
    3
    0 Votes
    3 Posts
    805 Views
    B
    @i_mazlov Ah yes, my pose morph names are standardized so there should be no duplicated/redundant names. And yea, thanks for mentioning the dictionary route. Totally overlooked that. That could indeed be an easier way to set/get some values. Thanks!
  • c4d.gui.ShowPopupDialog Hide search entry

    python
    2
    0 Votes
    2 Posts
    466 Views
    i_mazlovI
    Hi @merkvilson, Please give more information about your setup and provide a code snippet that shows your issue. I'm not able to reproduce your issue using the code snippet below in C4D 2024.2 There's a c4d.POPUP_ALLOW_FILTERING flag that you can pass to the ShowPopupDialog() function to allow showing the filtering entry in your menu: c4d.gui.ShowPopupDialog(cd=None, bc=menu, x=300, y=300, flags=c4d.POPUP_ALLOW_FILTERING) Cheers, Ilia import c4d def main() -> None: menu = c4d.BaseContainer() for idx in range(5): menu.InsData(c4d.FIRST_POPUP_ID + idx, f"Item {idx}") c4d.gui.ShowPopupDialog(cd=None, bc=menu, x=300, y=300) # c4d.gui.ShowPopupDialog(cd=None, bc=menu, x=400, y=300, flags=c4d.POPUP_ALLOW_FILTERING) if __name__ == '__main__': main() [image: 1702636223773-03915845-5d04-4cf4-a79c-1cb342e2aa60-image.png]
  • Get All Nodes inside an Xpresso Tag?

    2023 python
    3
    0 Votes
    3 Posts
    881 Views
    M
    Hi yes, GvNode are BaseList2D and GeListNode, like material, object, tags. There is the same discussion going on, so you may find it interesting Issue collecting all the shaders in a material. Cheers, Maxime.