• 0 Votes
    2 Posts
    349 Views
    i_mazlovI
    Hi @derudo, 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 There's no single known "thing" we're aware of that could lead to such behavior. In other words, it can be lots of different "things" that caused the symptoms you're describing. Hence, without any further details everything I'm pointing out here is highly speculative. I also don't think answering the question "What could have happened?" is by any means productive, so let's switch the point of view to "How one could diagnose it?". Since you haven't posted any console output in your question, I assume you haven't checked that. This would actually be the first thing to check. Please refer to our Python Console Manual and searching on the forum. Next, try to figure out if it's only UI that stopped appearing or your plugin isn't registered at all anymore. You can do this by checking (e.g. with some temporary print statements) if you plugin is actually functional. On the screenshot you've posted the structure is kind of strange, but we're not sure if it's just a visualization matter of your software. Namely, the plugin.pyp file is expected to reside in the root of the plugin folder. Essentially, the following hierarchy level is not supposed to be there: [image: 1737450594273-232c47cd-171e-4642-8c12-7661b51e6ce5-image.png] Please refer to the article Plugin Structure Manual: Directory Structure and double check your plugin in this regard. If the points above don't lead to any result, try debugging it step-by-step. Namely, strip out everything except the essentials (like plugin registration) and continue adding things piece-by-piece until it starts failing. By the way, one can easily achieve this by using any version control system (e.g. git), as they typically provide a lossless way to manage your code (i.e. remove and add parts of code, without being worried to lose any of them). This approach could also have prevented your scenario in first place, when something stopped working and there're no clues about the change that has lead to it. If this still doesn't help, you can share your plugin here (or send us via contact form, when confidential information is involved). However, I must warn you that our Support Procedures still fully apply, namely: We cannot debug your code for you and instead provide answers to specific problems. Cheers, Ilia
  • 0 Votes
    2 Posts
    385 Views
    ferdinandF
    Hello @myosis, 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 All the methods you list simply do not exist (neither in C++ nor in Python), see c4d.utils.Neighbor for the type overview. I therefore must assume that you are using an AI, like, for example, ChatGPT, which hallucinated these methods. Please note that we reserve the right to refuse support when confronted with undisclosed AI gibberish, especially for beginner content. Always state when you used an AI to generate code. Something such as an edge does not exist concretely in our API and many other APIs, i.e., other than for points and polygons, there is no explicit data type for edges which would be stored. Edges are defined implicitly by CPolygon. To filter a selection for edges of a certain length, you would have to convert edge indices to polygon and point indices and then measure the distance between the relevant points. Cheers, Ferdinand Result [image: 1737027755224-074e2ada-a9ce-45b4-800a-acf7e060941a-image-resized.png] Code """Deselects all edges in the edge selection of the active object whose edge length exceeds MAX_EDGE_LENGTH. Must be run as a Script Manager script with an editable polygon object selected. """ import c4d doc: c4d.documents.BaseDocument # The currently active document. op: c4d.BaseObject | None # The primary selected object in `doc`. Can be `None`. MAX_EDGE_LENGTH: float = 25.0 # The maximum length of an edge before to be considered too long. MAX_EDGE_LENGTH_SQUARED: float = MAX_EDGE_LENGTH ** 2 # The square of `MAX_EDGE_LENGTH`. def main() -> None: """Called by Cinema 4D when the script is being executed. """ if not op or not op.IsInstanceOf(c4d.Opolygon): raise ValueError("The selected object is not a polygon object.") # Get the edge selection of the object and turn it into a list of selected edges indices. Also, # get the points and polygons of the object. selection: c4d.BaseSelect = op.GetEdgeS() selectedEdges: list[int] = [i for i in range(op.GetEdgeCount()) if selection.IsSelected(i)] points: list[c4d.Vector] = op.GetAllPoints() polygons: list[c4d.CPolygon] = op.GetAllPolygons() def getPointByIndex(poly: c4d.CPolygon, index: int) -> c4d.Vector: """Returns the point of the polygon at the given index. CPolygon has no index access, so we fix that here. """ if index == 0: return points[poly.a] elif index == 1: return points[poly.b] elif index == 2: return points[poly.c] elif index == 3: return points[poly.d] # Iterate over the edges and find the one's that are longer than MAX_EDGE_LENGTH. An edge index # is defined as: # # "The edges are indexed by 4 * polygon + edge where polygon is the polygon index and edge is # the edge index between 0 and 3." # # So, we must revert that here, then measure the edge length, and collect all too long edges. tooLongEdges: list[int] = [] for edgeIndex in selectedEdges: polygonIndex: int = edgeIndex // 4 edgeInPolygonIndex: int = edgeIndex % 4 poly: c4d.CPolygon = polygons[polygonIndex] pointA: c4d.Vector = getPointByIndex(poly, edgeInPolygonIndex) pointB: c4d.Vector = getPointByIndex(poly, (edgeInPolygonIndex + 1) % 4) # Getting the length of a vector is quite expensive, so we compare the squared lengths. edgeLengthSq: float = (pointA - pointB).GetLengthSquared() if edgeLengthSq > MAX_EDGE_LENGTH_SQUARED: tooLongEdges.append(edgeIndex) # Print the indices of the edges that are too long. print("The following edges are too long:", tooLongEdges) # Deselect all edges in the object's edge selection that are too long. for edgeIndex in tooLongEdges: selection.Deselect(edgeIndex) # Push an update event to Cinema 4D to redraw the object. c4d.EventAdd() if __name__ == '__main__': main()
  • How to get the attributes of rsramp node in c++?

    Cinema 4D SDK c++ 2025
    3
    0 Votes
    3 Posts
    423 Views
    F
    @ferdinand Thank you for the answer! The problem is solved after I try to find the child of the port according to your answer.
  • 0 Votes
    3 Posts
    402 Views
    chuanzhenC
    @ferdinand Thank you for your detailed answer.
  • 0 Votes
    4 Posts
    488 Views
    i_mazlovI
    Hi @mia-elisenberg, Thanks for reaching out to us! I must note that as per our Support Procedures we cannot debug your code. Hence, in your future postings I kindly ask you to try simplifying your code to a minimal viable example, which highlights your question. Regarding your question, creating keyframes for nodes can be a little trickier comparing to the ordinary objects, but the general data accessing scheme stays the same. @Dunhou has thankfully posted the simplified example for your question, which already shows crucial pieces of how one would access the CTrack, CCurve and CKey for the node port. (@Dunhou I won't get tired showing our appreciation in playing an active role in our community! ). Namely, you're expected to use GetBaseListForNode to get the BaseList2D element that corresponds to the node you have. Additionally, NimbusBaseInterface.GetDescID can be used to get the DescID of the port. After you have this information, the process of interacting with animation data isn't any different. Your can check the animation examples in our repository: Cinema-4D-Python-API-Examples/scripts/04_3d_concepts/scene_elements /animation. The only thing I'd like to point out here is handling color data. Namely, CKey is designed to operate with float values, but Opacity channel works with color data. Hence, you need to create a separate CTrack for each color channel. You basically do this by pushing your DescID one level further to access the elements of your color data. Please find small example below (based on the code shared by @Dunhou): descLevelsRGB: list[c4d.DescLevel] = [ c4d.DescLevel(c4d.COLOR_R, c4d.DTYPE_REAL, 0), c4d.DescLevel(c4d.COLOR_G, c4d.DTYPE_REAL, 0), c4d.DescLevel(c4d.COLOR_B, c4d.DTYPE_REAL, 0) ] opacityValue: list[float] = [0.55, 0.66, 0.77] # example data to store in the keyframe ctime: c4d.BaseTime = c4d.BaseTime(doc.GetTime().GetFrame(doc.GetFps()), doc.GetFps()) for opacityChannelDescLevel, opacityChannelValue in zip(descLevelsRGB, opacityValue): # Get opacity channel DescID and push it to access color channel channelDescID: c4d.DescID = nimbusRef.GetDescID(opacityPort.GetPath()) channelDescID.PushId(opacityChannelDescLevel) track: c4d.CTrack = c4d.CTrack(opacityPortBL2D, channelDescID) opacityPortBL2D.InsertTrackSorted(track) curve: c4d.CCurve = track.GetCurve() key = c4d.CKey() track.FillKey(doc, opacityPortBL2D, key) # this is optional key.SetValue(curve, opacityChannelValue) key.SetTime(curve, ctime) curve.InsertKey(key) Cheers, Ilia
  • About Texture Paths in MergeDocument

    Cinema 4D SDK 2025 python windows
    3
    0 Votes
    3 Posts
    452 Views
    R
    @i_mazlov I get it, thanks for your reply.
  • 0 Votes
    5 Posts
    747 Views
    gheyretG
    I get it, thanks for your reply and keeping the idea. If there are any workarounds or alternative solutions in the meantime, please let me know. I look forward to any updates regarding this feature in the future. Cheers~
  • 0 Votes
    2 Posts
    352 Views
    i_mazlovI
    Hi @shahir-zaman , 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 Assuming that what you're trying to achieve is to toggle the "UV Grid" option [image: 1734354534219-d09d5b8d-51a2-4a6a-9618-90b2dbcc6638-image.png] You effectively have two options: The easiest one is to execute CallCommand(170776) (you can find the command ID in the Script Log) The more involved but also more flexible way is to find the UV settings scenehook and go through all its branches (or may be not all of them, depending on what specifically you want to achieve). Please find the C++ and Python code snippets below. Cheers, Ilia C++ commanddata execute function code snippet: Bool MyCommandData::Execute(BaseDocument* doc, GeDialog* parentManager) { const Int32 ID_UV_SETTINGS_HOOK = 1053309; if (!doc) return true; BaseSceneHook* sceneHook = static_cast<BaseSceneHook*>(doc->FindSceneHook(ID_UV_SETTINGS_HOOK)); if (!sceneHook) return true; maxon::BufferedBaseArray<BranchInfo, 20> infos; sceneHook->GetBranchInfo(infos, GETBRANCHINFO::NONE) iferr_ignore("GetBranchInfo"); for (BranchInfo& info : infos) { if (info.name != "UVSettingsBranch"_s) continue; GeListNode* viewSettings = info.head->GetFirst(); while (viewSettings) { GeData value; viewSettings->GetParameter(CreateDescID(UV_SETTINGS_FILTER_SHOW_GRID), value, DESCFLAGS_GET::NONE); Bool valueBool = value.GetBool(); value = {!valueBool}; viewSettings->SetParameter(CreateDescID(UV_SETTINGS_FILTER_SHOW_GRID), value, DESCFLAGS_SET::NONE); viewSettings = viewSettings->GetNext(); } } EventAdd(); return true; } Python script code snippet (special thanks to @m_adam on this one): import c4d def main() -> None: sh = doc.FindSceneHook(1053309) for branch in sh.GetBranchInfo(): if branch["name"] != "UVSettingsBranch": continue viewSettings = branch["head"].GetFirst() while viewSettings: viewSettings[c4d.UV_SETTINGS_FILTER_SHOW_GRID] = not viewSettings[c4d.UV_SETTINGS_FILTER_SHOW_GRID] viewSettings = viewSettings.GetNext() c4d.EventAdd() if __name__ == '__main__': main()
  • Get and Set any parameter with Tag

    Cinema 4D SDK 2023 2024 2025 python
    3
    0 Votes
    3 Posts
    547 Views
    gheyretG
    Hi @i_mazlov I can't use C++ at the moment, so I thought I'd try MultilineEditText for my purposes. I looked for This post in the forum and now I have some ideas. Thank you for your reply! Cheers~
  • 0 Votes
    3 Posts
    929 Views
    gheyretG
    Thank you for your reply and solution! Cheers~
  • 0 Votes
    7 Posts
    2k Views
    i_mazlovI
    Hi @yaya, I see your point here and I can only guess if such behavior is expected or not, as this is (and I've already mentioned this to you earlier) a question that has nothing to do with development. In general it sounds like a bug, so you're very welcome to reach out to our Support Team and ask them for a proper workaround if they actually classify this issue as a bug. I'm moving your thread to general talk section in case someone from our community might be willing to share their experience on that topic. Cheers, Ilia
  • GraphModelInterface.GetNode not worked

    Cinema 4D SDK python windows 2025
    3
    0 Votes
    3 Posts
    491 Views
    DunhouD
    Hi @m_adam , Thanks for your reply, it worked well. But I still have some doubts about the usage of Node Path, such as how to calculate the port through NodePath instead of concatenating strings (which can easily lead to misoperation). There are few examples and answers for NodePath on the forum, and it seems that people rarely use it. Do you have any insights on this, or in other words, what usage scenarios do you think NodePath is more suitable for. Cheers~ DunHou