• How to draw a primitive object in BaseDraw

    Cinema 4D SDK python 2023 2024 s26
    3
    0 Votes
    3 Posts
    779 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
    2k 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
    1k 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.
  • 0 Votes
    3 Posts
    771 Views
    S
    @i_mazlov sorry I thought I deleted this post as I solved the issue. Anyway to anyone who stumbles upon this question here's how I solved it: for i,pt in enumerate(points_list[::-1]): off = c4d.Vector(distance * i,0,0 ) mg = pt.GetMg() mg.off = off print(rotation.x) rm = c4d.utils.HPBToMatrix(rotation) pt.SetMg(mg * rm) So basically if the objects are inserted in the hierarchy and you start from the last one with the transformations this will work just like in the OM.
  • Icons reuse

    Cinema 4D SDK windows 2024 python
    3
    0 Votes
    3 Posts
    731 Views
    DunhouD
    Hi @ferdinand , Thanks for your explain, I would convert the svg files to png then regist them for a temp solution, and wait the attribute valid in python. Thanks always for your awesome works. Cheers~ DunHou
  • Check the state of record modes with python?

    Cinema 4D SDK 2024 python
    2
    0 Votes
    2 Posts
    533 Views
    B
    ah ok I figured it out. its possible to check those with the c4d.IsCommandChecked() function.
  • 0 Votes
    6 Posts
    3k Views
    G
    I apologize for posting repeatedly. I think I succeeded in installing numpy and other libraries as well. In case for someone in same situation, I would like to share my own case resolution. After installing pip, not from c4dpy, but using the python below worked: /Applications/Maxon Cinema 4D 2024/resource/modules/python/libs/python311.macos.framework/python and executed the command like python -m pip install numpy normally. And worked inside C4D properly. If there are any inaccuracies or clear errors, I would appreciate it if you could point them out. Thank you in advance.
  • Colorchooser in 2024

    Cinema 4D SDK 2024 python
    2
    0 Votes
    2 Posts
    501 Views
    M
    Hi @mikeudin thanks a lot for the report, this is a regression due to a last minute optimization within the internal Python API parsing done for which bring around 20% performance boost of the Python Effector in 2024.0. So any other classic API (c4d module) previously accepting a maxon.Vector or maxon.Color/A as an argument will be impacted (only ColorSwatchGroup.SetColor and ColorSwatchGroup.AddColor are affected by these changes) With that's said I was never a big fan of mixed datatype from classic API and maxon API, so even if this is a regression I think I prefer the new behavior. I will discuss that internally and see what is the outcome. I will keep you posted. Cheers, Maxime.
  • 0 Votes
    3 Posts
    832 Views
    H
    Hi @ferdinand, ah okay I see. Some part of me already suspected it could be a bug. Thanks for taking the time to look into it. Regarding the scope of question. You are absolutely right. And while I understand that it can make answering branching questions hard, it is sometimes not that easy to split things up. But all good, no offense taken. One last thing, I know you guys are not here to develop solutions or come up with algorithms. Still, I was wondering if a possible solution could be to move the selected points to a custom vector position and afterwards simply send an "Optimize" modeling command? Cheers, Sebastian
  • 0 Votes
    5 Posts
    830 Views
    M
    Hi just to let you know that with the release 2024.2 the issue have been fixed and it is now possible to retrieve the value of a Vertex Color Tag in point mode. Cheers, Maxime.
  • 0 Votes
    2 Posts
    528 Views
    ferdinandF
    Hello @LingZA, Thank you for reaching out to us. Thank you for posting your solution, much appreciated! I have provided below a variant of your example which without having the C++ Example Pick Object Tool installed. In case someone is wondering how to find out such a thing, you would have to look into the description of a tool, e.g. the extrude tool ... toolextrude.res: CONTAINER xbeveltool { NAME xbeveltool; GROUP MDATA_BEVEL_GROUP_OPTION { DEFAULT 1; LONG MDATA_BEVEL_MASTER_MODE // ... } INCLUDE ToolBase; // Includes the gadgets that are common to all description tools. } to find out that they all include all ToolBase which then looks like this: toolbase.res: CONTAINER ToolBase { NAME ToolBase; GROUP MDATA_MAINGROUP { DEFAULT 1; } GROUP MDATA_COMMANDGROUP { DEFAULT 1; GROUP { // SEPARATOR { LINE; } BOOL MDATA_INTERACTIVE { } SEPARATOR { } GROUP { COLUMNS 2; DEFAULT 1; BUTTON MDATA_APPLY { FIT_H; } BUTTON MDATA_NEWTRANSFORM { FIT_H; } } } } SUBCONTAINER ID_SNAPSETTINGS { } } Cheers, Ferdinand Code: """Actives and runs the extrude tool. """ import c4d ID_EXTRUDE_TOOL: int = 1011183 def main() -> None: c4d.CallCommand(ID_EXTRUDE_TOOL) tool = c4d.plugins.FindPlugin(ID_EXTRUDE_TOOL, c4d.PLUGINTYPE_TOOL) tool[c4d.MDATA_INTERACTIVE] = True c4d.EventAdd() if tool is not None: c4d.CallButton(tool, c4d.MDATA_APPLY) c4d.CallButton(tool, c4d.MDATA_NEWTRANSFORM) c4d.EventAdd() if __name__ == '__main__': main()
  • How to hide object local coordinates

    Cinema 4D SDK python
    5
    1
    0 Votes
    5 Posts
    1k Views
    i_mazlovI
    @chuanzhen , Sorry for the delayed answer. The layer.locked behavior is integrated deeply in the internal code of cinema bypassing common cinema pipelines. Unfortunately, there's no good way to imitate such behavior without using layers. In case you decide to proceed with the layer approach, there's an example in github repo highlighting the usage of SetLayerData() function: layer_creates_r13.py. Cheers, Ilia
  • some icon index not find

    Cinema 4D SDK python
    3
    1
    0 Votes
    3 Posts
    511 Views
    chuanzhenC
    @ferdinand Thanks
  • TimeLine Window Custom open

    Cinema 4D SDK 2024 python
    7
    2
    0 Votes
    7 Posts
    2k Views
    chuanzhenC
    @kangddan @Dunhou
  • Spline Round Tool behave issue

    Moved General Talk python 2024
    6
    1
    0 Votes
    6 Posts
    1k Views
    ferdinandF
    Hey @baca, Just as an FYI, this bug has been fixed and it will be included in one of the upcoming releases of Cinema 4D, quite likely the next release. Cheers, Ferdinand
  • how to program plugins with python?

    Cinema 4D SDK 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
  • 0 Votes
    6 Posts
    1k Views
    bacaB
    @ferdinand said in c4d.MCOMMAND_EXPLODESEGMENTS makes target object dead: Select 0th polygon in a mesh. SMC: MCOMMAND_SELECTCONNECTED SMC: MCOMMAND_SPLIT Delete the selected polygons. When no polygons are left, exit, otherwise goto 1. Oh, great idea. Not that elegant, but seems legit. Thanks again.
  • Running commanline application with Python

    Moved General Talk 2023 python macos windows
    15
    0 Votes
    15 Posts
    4k Views
    ferdinandF
    One last thing: Have you tried using LICENSEMODEL::MAXONAPP as an alternative login method? ::MAXONACCOUNT is being deprecated as I said, and I do not quite remember why we chose it here nonetheless. User support surely can help you with the details here.