• Remove points from a polygon

    2
    0 Votes
    2 Posts
    854 Views
    ferdinandF
    Hey @kantronin, Thank you for reaching out to us. I would recommend having a look at the Modeling Python Examples. They are a bit hidden, but in the Geometry section I went over the general classic API geometry model of Cinema 4D. Regarding your core questions: Removing points from a polygon: Without wanting to be overly pedantic, I must point out that polygons only index vertices, they do not hold them; CPolygon references with its fields a, b, c, and d the vertices of the PolygonObject it is attached to. In this sense removing points from a polygon is not possible, you can just de-index them. Cinema 4D expresses both triangles and quadrangles with the type CPolygon, i.e., as quadrangles. A triangle simply repeats its c index in its d index. I explained this in the modelling examples in more detail. Removing vertices or polygons from a PolygonObject: There is neither a PolygonObject.RemovePolygon nor aPointObject.RemovePoint if that is what you are looking for. When you want to change the vertex or polygon count of a PolygonObject, you must call PolygonObject.ResizeObject and then call PointObject.SetAllPoints() and for each (new) polygon PolygonObject.SetPolygon. The operation_extrude_polygons_s26 example covers this subject, although I go there into the opposite direction, I increase the point and polygon count rather than decreasing it. PS: Useful might also be geometry_polygonobject_s26 because I explained there the type from scratch. Cheers, Ferdinand
  • Set PYP file syntax highlighting in VS Code?

    r25 python
    4
    0 Votes
    4 Posts
    966 Views
    M
    Btw if you install the Cinema 4D Vs Code extension, pyp extension should be added as Python.
  • 0 Votes
    3 Posts
    875 Views
    M
    Hi @FSS first of all happy new year ! And I'm glad that you found a solution however even if this is in the documentation we don't explicitly support PyCharm and only provide a dummy package to have autocompletion working with any Python instance. But C4dpy is not supported by all IDE and we can't provide any support there. If you want to have a better IDE workflow we released a plugin for Visual Studio Code, requiring a Cinema 4D plugin and a VS Code plugin. Finally I moved this topic to general talk as it this is nothing related to Cinema 4D API. Cheers, Maxime.
  • Implement A Usage Counter?

    python r25
    3
    0 Votes
    3 Posts
    630 Views
    B
    @ferdinand Thanks for the pointers. I'll try to look up those options. Will close this thread now.
  • SplineMask Render Visibility Not Working

    s26
    2
    0 Votes
    2 Posts
    539 Views
    M
    Hi @InterfaceGuy, this forum is only about Cinema 4D Scripting and plugins, please reach the user support via the maxon website. Cheers, Maxime.
  • Edit C4D files without loading them fully

    3
    0 Votes
    3 Posts
    1k Views
    M
    I see. Thank you for the reply Manuel
  • Condition that generator treats inner spline segment as a hole

    4
    1
    0 Votes
    4 Posts
    893 Views
    ferdinandF
    Hey @kng_ito, So the normal direction of the generated polygons was the point! It depends a bit on what you mean by normal direction, but generally speaking, normals only play a minor role here. Wenn all segments would always lie nicely inside a plane, it would be easy. Just compute the mean point for each segment and then come up with some cockamamie rule when you would consider two segments not being in a shell-hole relation (as I did above with 'a hole is not a hole anymore when T farther away from S than S is tall or wide'). In practice things do not always lie nicely in a plane. So, you then must first project them there, find their mean plane. So, the 'point' would be finding the mean plane / dimensionality reduction. I cooked up an small example below. Cheers, Ferdinand Result (the plane gizmos are a bit buggy and sliding, did not debug this. But that is why I turn them off): [image: spline-hole.gif] The file: spline_hole.c4d
  • Add Additional Script Path?

    r25 python
    3
    0 Votes
    3 Posts
    581 Views
    B
    @m_adam Thanks for the response. Modifying the environment varialbles works for my use case. Closing the thread now.
  • C4D 2023 Script Manager Doesn't Update?

    python
    3
    0 Votes
    3 Posts
    647 Views
    B
    @m_adam Thanks for the confirmation. Will close the thread for now.
  • Difference In Rotation Not Showing Properly in Object Manager?

    r25
    4
    1
    0 Votes
    4 Posts
    775 Views
    B
    @ferdinand Gotcha. Thanks for the clarification and the sample code. Should have probably went for the matrix transforms to begin with. I was hoping I can get away with those euler angles lol. Closing the thread now.
  • Slow MoGraph in 2023?!

    6
    1
    0 Votes
    6 Posts
    1k Views
    jochemdkJ
    Thx for updating.. 2023.1 seems to be working well again
  • Ability to Drag Nodes to the Console?

    r25 python
    7
    0 Votes
    7 Posts
    1k Views
    B
    @ferdinand Gotcha. Thanks for the clarification. Will close this thread now.
  • Include Description in the Search Documentation?

    r25 python
    5
    0 Votes
    5 Posts
    844 Views
    B
    @ferdinand Uhm. It's not as complicated as that. I mean it is complicated per se but there are already existing solutions. Check "Sphinx Search Extension". There are several. Pip install it and just insert it into the conf.py file. Also, it's not really as spicing it up per se. I mean it is but not really. It's just adding a sub paragraph section. The maxon redshift documentation is already doing it. And even if you are using sphinx implementation, it's also existing. Blender documentation is built using sphinx. [image: 1666619696194-8579cd6b-d0a4-4844-9563-5ee4d390a1e3-image.png]
  • Plugin works with R23 and doesn't work with S24.

    python r23 s24
    4
    0 Votes
    4 Posts
    1k Views
    K
    Got it. Thank you.
  • Option to make Python Console in a "Word Wrap" Mode

    r20 python
    6
    0 Votes
    6 Posts
    1k Views
    B
    @m_adam Ah gotcha. I can only access perpetual versions. C4D 2023 was not made available for perpetual. Anyhow, thanks for the confirmation. Will close the thread.
  • how to create BaseList2D Renderer node : c++ to python

    s26 python c++
    6
    0 Votes
    6 Posts
    1k Views
    DunhouD
    I find a way to read aovs and render container , if I had some times I will post a create Read Octane Post from typing import Optional import c4d SET_RENDERAOV_IN_CNT=3700 SET_RENDERAOV_INPUT_0=3740 RNDAOV_TYPE=995 RNDAOV_ENABLED=994 doc: c4d.documents.BaseDocument # The active document op: Optional[c4d.BaseObject] # The active object, None if unselected c4d.CallCommand(13957) #clear console def main() -> None: rdata = doc.GetActiveRenderData() vpost = rdata.GetFirstVideoPost() OctaneRender_ID = 1029525 octVp=None # rdata[c4d.RDATA_RENDERENGINE] = OctaneRender_ID while vpost: print(vpost) if vpost.GetName() == "Octane Renderer": octVp=vpost vpost = vpost.GetNext() if octVp: aovCnt = octVp[SET_RENDERAOV_IN_CNT] print ("--- OCTANERENDER FOUND ---") print(octVp) print ("Buffer:",octVp[1010]) print ("Color space:",octVp[1028]) print ("AOV count:",aovCnt) for i in range(0,aovCnt): aov = octVp[SET_RENDERAOV_INPUT_0+i] enabled = aov[RNDAOV_ENABLED] type = aov[RNDAOV_TYPE] print ("AOV1:",aov," type:",type," enabled:", enabled) if type==185: # cryptomatte print (" crypto_type:",aov[1821]) if type==255: #z-depth AOV print (" z-depth max:",aov[3392]," env.depth:",aov[3397]) if __name__ == '__main__': main()
  • fbx export with metadata

    3
    0 Votes
    3 Posts
    1k Views
    O
    Hi, Thank you for your answer. Unfortunate it seems like this isn`t as easy as we hoped for, but we just have to see if we can find another way around our problem. Cheers, Ola
  • C4D R25 render / Team render Notifier Plugin (win & Mac) ??

    3
    0 Votes
    3 Posts
    818 Views
    O
    Hi Maxime, Thank for your answer ! However, as you say, TR Notifier isn't a priory but it's too bad because I think it's so useful for a lot of people ... No solution exist, at this time to get a an alert when render is finish ... Maybe it will interest community having this feature ..... Cheer, opla
  • "Render Marked Takes" Command via Python?

    python s26
    3
    0 Votes
    3 Posts
    778 Views
    delizadeD
    Hi Manuel, Thank you for your help.
  • [Python] Edit Parameters on nodes?

    5
    0 Votes
    5 Posts
    1k Views
    M
    Hi @sortsovs once you have the node, you need to retrieve the appropriate port. Be careful as some port can be nested. Then once you have the correct port, you need to call GraphNode.SetDefaultValue. When calling SetDefaultValue it is important to pass a maxon data as the current Python system is not able to automatically guess the expected result. Find bellow an example to create a Redshift Material with a Texture Node with a custom path and name. import c4d import maxon REDSHIFT_NODESPACE_ID = maxon.Id("com.redshift3d.redshift4c4d.class.nodespace") def CreateTextureNode(gr: maxon.GraphModelRef, nodeName: str, texturePath: str, isLinear:bool=False) -> maxon.GraphNode: # Start a transaction to inform the graph that a modification is going to happen with gr.BeginTransaction() as transaction: # Create a Redshift Texture Node and rename it textureNodeId = maxon.Id("com.redshift3d.redshift4c4d.nodes.core.texturesampler") texNode = gr.AddChild("", textureNodeId, maxon.DataDictionary()) texNode.SetValue("net.maxon.node.base.name", maxon.String(nodeName)) # Retrieve path and gammage override port path = texNode.GetInputs().FindChild("com.redshift3d.redshift4c4d.nodes.core.texturesampler.tex0").FindChild("path") gammaOverride = texNode.GetInputs().FindChild("com.redshift3d.redshift4c4d.nodes.core.texturesampler.tex0_gammaoverride") # Define the value stored by the node for these port when no connection exist gammaOverride.SetDefaultValue(maxon.Bool(isLinear)) path.SetDefaultValue(maxon.Url(texturePath)) # Push the change to the graph transaction.Commit() return texNode def main() -> None: # Create a BaseMaterial in the active document rsMat = c4d.BaseMaterial(c4d.Mmaterial) doc.InsertMaterial(rsMat) # Retrieve it node material part and create a Redshift Graph nMat = rsMat.GetNodeMaterialReference() nMat.AddGraph(REDSHIFT_NODESPACE_ID) gr = nMat.GetGraph(REDSHIFT_NODESPACE_ID) # Create a texture node albedoTexNode = CreateTextureNode(gr, "Albedo", r"C:/PathToATexture.jpg") c4d.EventAdd() if __name__ == '__main__': main() Cheers, Maxime.