• 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
    497 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
    646 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
    711 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
    409 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
    740 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.
  • Issue collecting all the shaders in a material

    python 2024
    11
    2
    0 Votes
    11 Posts
    3k Views
    John_DoJ
    Hi, One last thing I've noticed. The last code shared by @HerrMay works great on all materials but the one I'm using to test my script, it's odd. On this particular material, the function consistently skip the shader which is in the Blend Channel of the Fusion shader. Even the Mask shader in the Mask channel is discovered and printed. [image: 1702592718593-db2bf693-59e6-4eb1-a42e-5c484b38f253-image.png] I've ran the debugger on the function : when the loop state is on the Color shader, the function is going up on the parent Fusion shader as expected but then the elif node.GetNext() condition isn't verified (?!) so it skips the last branch and go back to the material The thing is it doesn't happen with other materials nor other shaders : I've made this particular material's shader tree more complex and all the shaders are seen, even when a node has several children. A brand new material with the same shader setup is not a problem. There are two cases where the function scan the shader correctly and output the expected result : When using the recursive function written by @ferdinand Disconnecting and reconnecting the Filter shader from the Fusion shader. If I run the function again after doing that, the AO and Filter shaders are discovered and printed correctly. Do you have any idea of what it is happening here ? I'm planning to use this function for several commands and I don't like the possibility that it could fail in some cases, even if it is some niche ones.
  • 0 Votes
    9 Posts
    2k Views
    B
    @m_adam @blkmsk Gotcha. It works now. My bad. The ordering of the tag was essential based on the context of the script. I overlooked it.
  • VolumeData::AttachVolumeDataFake() in latest C4D 2024 API

    2024 c++
    3
    0 Votes
    3 Posts
    717 Views
    fwilleke80F
    Super, thank you!
  • 0 Votes
    3 Posts
    725 Views
    fwilleke80F
    Ok, thanks!
  • Material Tag: Fit to object

    python 2024
    3
    0 Votes
    3 Posts
    645 Views
    .
    Hi @m_adam - In this particular instance I'm calling it on objects that have children and I'm getting the prompt to include sub objects. If it were a modeling command or something like that it may include the ability to include or exclude the children programmatically. I'm creating 30 objects and each object has six flat projections that I want to set to the size of the object. That's 180 confirmation clicks.
  • How to connect new ports and node ports in the group?

    python 2024
    7
    1
    0 Votes
    7 Posts
    2k Views
    DunhouD
    Hi @i_mazlov , Thanks for your time, sorry for my bad that I use a confusing word for "id", I should say "asset id", but as you said, I can use ID to check this, for some reason, I overlooked this for a moment. And the GetParent(), I found out that the culprit is GetSelectedNodes(), I use this to get a selected node(abs bode) but the return is "group", so what ever I try the return is 'Root'. Thanks for all your works! Cheers~ DunHou
  • Release API for Modifying Camera Selection on Render Queue

    2023 python
    5
    0 Votes
    5 Posts
    857 Views
    B
    Thanks for the update @m_adam
  • Boundary Edges to Spline in Python

    s26 python 2024 2023
    3
    0 Votes
    3 Posts
    925 Views
    F
    Dear Ilia, I greatly appreciate your assistance; it was precisely what I needed. Thank you for your guidance and I wish you a wonderful day. Best regards, Tomasz
  • 0 Votes
    9 Posts
    3k Views
    i_mazlovI
    Hi Christophe, Please note our Support Procedures, namely: We cannot provide support for third party libraries "It doesn't work" is not a support request and we cannot debug your code for you, but instead provide answers to specific problems. From my personal point of view, you need to reduce your setup as far as possible while still being able to reproduce the bug: Determine which one of your 2 tag plugins causes the issue Cut off unrelated functionality of your plugin that has nothing to do with the issue Figure out the specific function or line that causes the issue Search the forum if this issue was already discussed If not, create an example code snippet that highlights your issue Post your specific question and the example code snippet in a separate thread with a meaningful title Cheers, Ilia
  • This topic is deleted!

    3
    0 Votes
    3 Posts
    19 Views
  • Spline to UV map... is this even possible?

    python 2024 windows
    3
    0 Votes
    3 Posts
    938 Views
    justinleducJ
    Hey @m_adam, I never thanked you for your very helpful and thorough reply, so allow me to do so now: thank you very much! Your reply ended up being extremely useful, as it guided me in implementing the KD-Tree within my Python script, as well as helping me convert the Barycentric coordinates to UV coordinates. So, for that, once again; thank you! Now that this is implemented, I am faced with a challenge: it appears that the precision of the drawing of the Spline greatly depends on the subdivision/triangulation level of my geometry (for example, the Sphere in my parent message). In other words, if the geometry whose UV map I am drawing the shape of my Spline onto is very low-poly, the drawing of said Spline will be incredibly imprecise. It seems like the precision increases as I increase the amount of polygons on the geometry. Just curiously, without necessarily pasting my code here, I was wondering if - at the top of your head - this behavior was to be expected? Does this mean that, with the KD-Tree and Barycentric conversion method, I would never be able to programmatically draw a perfectly round circle Spline on a Plane object that, despite having a perfect UV map, only has 2 polygons? I can work around those constraints, but it'd be great to know if the current imprecision of my drawing approach isn't caused by something else. Thanks!