• 0 Votes
    2 Posts
    579 Views
    ferdinandF
    Hey @LingZA, Thank you for reaching out to us. There are multiple questions in this topic, which always makes things tricky to answer. Is there any way to stop MMB wheel to zoom the camera? I need to scroll the MMB wheel in the viewport to change my tool's params? Is there any way to get MMB wheel scrolling in viewport? In general, Cinema 4D has no input device control & emulation layer, so you cannot intercept an input device from sending (stop the mouse wheel to zoom) or emulate inputs (get the mouse wheel scrolling). You can get the state of an input device. For MMB that would be the GUI message BFM_INPUT with BFM_INPUT_DEVICE being BFM_INPUT_MOUSE and BFM_INPUT_CHANNEL being BFM_INPUT_MOUSEMIDDLE. When you fail to read BFM_INPUT_MOUSEMIDDLE in your plugin, please share executable code, so that we can reproduce the problem. When necessary, you can send code confidentially to us via sdk_support(at)maxon(dot)net. Cheers, Ferdinand
  • use existing Catmull Clark algorithm

    Cinema 4D SDK python c++ 2024
    14
    0 Votes
    14 Posts
    3k Views
    ferdinandF
    Hey @CJtheTiger, yes, we disabled Ask as question because it was a lot of extra work for us to maintain because 60%-80% of users set their topics never as solved. Cheers, Ferdinand
  • Get & Set Active Camera for a specific viewport

    Cinema 4D SDK python
    4
    0 Votes
    4 Posts
    1k Views
    ferdinandF
    Hey @Thodos, without the console output of your browser, I cannot say much. I suspect that a DNS is failing. In the meantime, here are the offline docs. Cheers, Ferdinand
  • Which DisplayFilter affects ToolData.draw

    Cinema 4D SDK 2023 2024 s26 python
    3
    0 Votes
    3 Posts
    576 Views
    gheyretG
    Hi @ferdinand , I'm sorry that my title and description may be a little confused, maybe I misunderstood something and thought a little complicated. And thank you very much for your answer, you always help me when my thinking is confused. Cheers! Gheyret
  • 0 Votes
    3 Posts
    896 Views
    G
    This is an excellent explanation , thank you.
  • HideElement in Cinema 4D 2024

    Cinema 4D SDK 2024 python
    4
    2
    0 Votes
    4 Posts
    773 Views
    DunhouD
    Yes @simonator420 , it worked in 2023, and not worked any more in 2024, I also found that strange behavior in HideElement() and confused me for a while.
  • Get value of texture node filepath port?

    Cinema 4D SDK 2024 python
    3
    1
    0 Votes
    3 Posts
    939 Views
    B
    Oh wow! Thank you so much! Yes I'm a beginner with python cinema 4D so I really appreciate your support and this definitly gives me a better understanding of the node structure.
  • 0 Votes
    6 Posts
    2k Views
    i_mazlovI
    Hi @gsmetzer, please have a look at the related thread (How to get the bounding box for the whole scene) where your issue was explained in details by @ferdinand @ferdinand said in How to get the bounding box for the whole scene: a BaseObject will also not include its descendants in its bounding box computation So, one must carry out such computations oneself Cheers, Ilia
  • 0 Votes
    14 Posts
    3k Views
    M
    Hi thanks a lot for your report, the issue regarding Reloading Python Plugin not working as expected have been fixed in 2024.2. Cheers, Maxime.
  • Print Custom User data to text doc

    Cinema 4D SDK python
    6
    1
    0 Votes
    6 Posts
    959 Views
    ferdinandF
    Hey @apetownart, Thank you for sharing your solution, much appreciated! I have fenced in your code with a code block so that it is a bit more readable and has a copy button. Find out how to do that yourself in our Forum Markup documenation. Cheers, Ferdinand
  • 0 Votes
    2 Posts
    628 Views
    ferdinandF
    Hello @Aeoll-0, Thank you for reaching out to us. You should be a bit more specific about the circumstances and which you are using the command. As declared in our Support Guidelines, you should always post executable code, as we are otherwise are guessing what you are doing. The self.filedir implies that this happens in a method, which in turn could mean that you are trying to do this off-main-thread. This is not allowed. I also gave it a spin myself, and for me it works. Note that after the operation, the opened file is not the old file anymore. So, when you had a \data\a\myfile.c4d and saved to backup\a\, the opened file will be backup\a\myfile.c4d and not \data\a\myfile.c4d. Because of that, such newly "exported" documents will also induce thumbnail rendering. When you are trying to save many documents at once in this manner, the thumbnail rendering could make Cinema unresponsive. The path into which you want to dump things must also exist, Cinema 4D cannot create it for you. I have tested this in 2023.2.2 and 2024.1.0 and found no problems in both versions. Cheers, Ferdinand Result: [image: 1699977932661-34f18c02-cc1d-42ef-94ac-d50f2ad57195-image.png] Successfully saved project to: 'e:\projects\foo\', exporting the assets: [{'filename': 'e:\\projects\\foo\\myfile.c4d', 'assetname': 'myfile.c4d', 'channelId': 0, 'netRequestOnDemand': False}, {'filename': 'e:\\projects\\foo\\tex\\Maxon-Computer-Logo.jpg', 'assetname': 'E:\\temp\\Maxon-Computer-Logo.jpg', 'channelId': 0, 'netRequestOnDemand': True}]. Code: import c4d import os doc: c4d.documents.BaseDocument # The active document def main() -> None: """ """ # Cinema 4D cannot create the directory path for us, we must ensure that #path does exist. path: str = "e:\\projects\\foo\\" if not os.path.exists(path): os.makedirs(path) # Your settings. flags: int = (c4d.SAVEPROJECT_ASSETS | c4d.SAVEPROJECT_SCENEFILE | c4d.SAVEPROJECT_USEDOCUMENTNAMEASFILENAME) data: list = [doc, flags, path, [], []] # Invoke the command and raise errors on failure or missing assets. if not c4d.documents.SaveProject(*data): raise IOError(f"Could not save project to: '{path}'.") if data[4]: raise IOError(f"Failed to export the following assets: {data[4]}") # Success :) print (f"Successfully saved project to: '{path}', exporting the assets: {data[3]}.") if __name__ == '__main__': main()
  • Frame All command on Spline User Data

    Cinema 4D SDK python 2023
    8
    1
    0 Votes
    8 Posts
    2k Views
    i_mazlovI
    Hi Gabriel, Sorry for the delay in this thread. Unfortunately you cannot control this folding GUI functionality as it is sealed to the non-public GUI implementation. That would not be the case when using custom GUI implementations. Cheers, Ilia
  • Access values of an RS material in Python?

    Cinema 4D SDK python
    2
    0 Votes
    2 Posts
    628 Views
    J
    Hello @ryanjp, Welcome to the Plugin Café forum and the Cinema 4D development 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 Guidelines, as they line out details about the Maxon SDK Group support procedures. Of special importance are: Support Procedures: Scope of Support: Lines out the things we will do and what we will not do. Support Procedures: Confidential Data: Most questions should be accompanied by code but code cannot always be shared publicly. This section explains how to share code confidentially with Maxon. Forum Structure and Features: Lines out how the forum works. Structure of a Question: Lines out how to ask a good technical question. It is not mandatory to follow this exactly, but you should follow the idea of keeping things short and mentioning your primary question in a clear manner. About your First Question We were not sure to which RS material type you are referring - Xpresso based RS material or the RS node material. Here are informations for both: Node API Python examples, mostly focusing on material nodes: https://github.com/PluginCafe/cinema4d_py_sdk_extended/tree/master/scripts/05_modules/node Example for a general pattern for writing an "material converter", here at the example of mapping material models in the RS Xpresso system to the standard material model space. https://developers.maxon.net/forum/topic/14753/script-that-converts-redshift-materials-back-to-c4d-standard-ones/20 Note: In 2024 Redshift renamed all attributes in its legacy material type RS C4D Shader, with the result that the MAPPINGS data defined in the script is incorrect now. While one can easily update the mappings, many ports are just named Color now. You either have to use IDs in the meantime or wait for the update which fixes this port naming issue. Cheers Jana
  • Create Xpresso Python node

    Cinema 4D SDK python 2024
    3
    0 Votes
    3 Posts
    608 Views
    B
    WOW!!! It turns out that there is a node specifically for python. But in the documentation, in the list GV Node Types, it is not indicated. This fact forced me to look for workarounds. Thanks for the help
  • Failed to Connect to Cinema 4D, with port: 7788

    Cinema 4D SDK python 2023 2024
    3
    0 Votes
    3 Posts
    769 Views
    RenatoTR
    ah! Thanks a lot!
  • How to draw a primitive object in BaseDraw

    Cinema 4D SDK python 2023 2024 s26
    3
    0 Votes
    3 Posts
    637 Views
    gheyretG
    Hi @ferdinand Thank you for your reply and guidance. I'll get around to it. Cheers Gheyret
  • Force polygon object to generate it's cache

    Cinema 4D SDK python 2024
    7
    0 Votes
    7 Posts
    1k Views
    bacaB
    Thanks @ferdinand, Thats gone too far, we can close this subj now. I think I have a solution already. I just wasn't clear enough in the beginning, I just wanted to know if PolygonObject can be forced to produce it's cache object by a command. I made an experiment where I spawn flat geometries between other flat geometries. Like planes in-between of deformed soft body planes. Here's working example: Setup: [image: 1699565133962-417b1a04-77c9-4163-bc6f-36c2800323f5-image.png] And simulation: [image: 1699565001814-cloth_multiply__03_.gif] Once you clone original geometry — it's flat, and there would be intersections and simulation will be broken. So you need to blend newborn geo point positions in-between of existing geometry points. Once you blend it — there are no intersections, it nicely continue with soft body simulation. But softbody dynamics build constraints for every new object. And if geometry first appears as deformed — wrong constraints are initialized, and each new object becomes crumpled real quick. Also there's "Mix Animation" -> "Follow Shape" checkbox, which rebuild constraints (or adjusts them - who knows?) — and it reads original point positions, as I understood. So I had to have both — original geo, and cache. Where cache used to simulate geometry in 3D, and original object (CacheParent?) will be used for constraints.
  • Frequent updates on Posemorph tag

    Cinema 4D SDK python
    5
    0 Votes
    5 Posts
    1k Views
    i_mazlovI
    Hi @matrixloong , Please excuse the delayed answer. The real-time scenario is one of those that might not go very smoothly in cinema (check the links in my previous message). It was already discussed in the thread: Is it possible to control Camera with keyboard WASD like a FPS game? Ferdinand showed there one of the possible solutions to achieve live interactions on the scene using interaction dialog. You can use the simplified version of it below. Cheers, Ilia Run this code from the script manager and select an object in the object manager. import c4d, time, math doc: c4d.documents.BaseDocument # The active document class InteractionDialog(c4d.gui.GeDialog): TIMER_DELAY = 40 def CreateLayout(self): return True def InitValues(self): self._doc: c4d.BaseDocument = doc self.SetTimer(InteractionDialog.TIMER_DELAY) self._time = None self._lastTime = None self._angle = 0 return True def Timer(self, msg): # Initialize the time for the first frame a key is being pressed. if self._lastTime is None: self._lastTime = time.time() return None # The delta between now and the last evaluation dt = time.time() - self._lastTime self.DoSomething(dt) self._lastTime = time.time() def DoSomething(self, dt): op: c4d.BaseObject = self._doc.GetActiveObject() if not op: return PI2 = 2 * math.pi angleIncrement = dt * PI2 / 2 self._angle += angleIncrement if self._angle >= PI2: self._angle -= PI2 ml: c4d.Matrix = op.GetMl() bb: c4d.Vector = op.GetRad() pos: c4d.Vector = ml.off pos.x = bb.x * math.sin(self._angle) ml.off = pos op.SetMl(ml) c4d.EventAdd() if __name__ == '__main__': global dialog dialog = InteractionDialog(doc) dialog.Open(c4d.DLG_TYPE_ASYNC)
  • 0 Votes
    4 Posts
    908 Views
    mikeudinM
    @baca Thank you! Works like a charm!
  • Why won't my python generator update? R2024

    Cinema 4D SDK python s26 windows
    5
    0 Votes
    5 Posts
    1k Views
    S
    @baca @ferdinand Thank you both. It was the fact that the user data was not collected in the main function. Silly I didn't catch that. It's working fine now.