• How to be sure if an object is a generator/modifier?

    s26 r20 python sdk
    3
    0 Votes
    3 Posts
    1k Views
    H
    Hello @ferdinand, alright I see. I already thought that you would teach me once again that the naive thought I put up here would'nt hold up to the real world. Thanks for the explanation and the example you provided. I guess that will do just fine. As always much appreciated! Cheers, Sebastian
  • How to draw on spline points from spline returned by Object Data

    4
    0 Votes
    4 Posts
    698 Views
    ferdinandF
    Hello @HerrMay, Funny enough DrawPoints seems to internally use the "same points" to draw, one gets to see when one edits the points of a polygon object. In S26 the points are round (thats probably why I was thinking of circles) while in R20 they are squares. No question here, just an observation. As you can see, in the script I retrieve the cache of the object we are going to draw. # Get the cache of the object representing the plugin in the object manager, i.e., more or # less what we returned in GetContour, Cinema 4D has however exhausted the cache for us, and # the cache is not a SplineObject but a LineObject (i.e, the cache of a SplineObject). cache: c4d.LineObject = op.GetDeformCache() or op.GetCache() if not isinstance(cache, c4d.LineObject): return c4d.DRAWRESULT_O This not only enables us to deal with splines affected by a deformer correctly, but also and more importantly with spline generators as for example the Circle spline generator. Such generators do not have any control points one could retrieve, their cache will always contain LineObject instances and not SplineObject instances (when they have been implemented correctly). This is also what I was referring to in my comment, because OffsetYSpline returns a SplineObject as its cache in GetContour, but Cinema 4D will 'exhaust' that cache for us by returning the cache of the cache, the LineObject. A LineObject represents a SplineObject over its current interpolation settings. What is actually weird though is that the color gradient you used here to color the points doesn't work in R20. The points are simply drawn black there. Possibly a Python 2/3 issue caused by integer/float division differences? Yes, this is Python 3 code. In Python 2 integers divide by default as integers. Simply wrap one of the numbers into a float, e.g., f: float = float(i)/float(count). Allow one follow up question. How can I draw only the control points of the spline? In your example you use a circle primitive which has - when made editable - exactly four points making up the shape via tangents. Where as the drawn points using the intermediate points of the circle as well. You can use BaseObject.GetRealSpline to get the underlying editable spline object for a spline. So, when you would replace the section quoted above with this: cache: c4d.SplineObject = op.GetRealSpline() if not isinstance(cache, c4d.SplineObject): return c4d.DRAWRESULT_OK You would now draw the control points of the SplineObject representing the spline generator rather than the vertices of its underlying LineObject. The problem in this case is that the plugin you have chosen is calling 'Current State to Object' (CSTO) on the input object which it is cloning and returning offset-ed (see line 130 in your code listing). CSTO is of course just replacing an object with its cache state. So, when you put a circle spline below the offset spline, it will still be drawn as in the LineObject cache version because the cache and the BaseObject.GetRealSpline representation are in this case identical. Cheers, Ferdinand
  • Place multiple objects on spline and align

    python 2023
    5
    1
    0 Votes
    5 Posts
    2k Views
    P
    And once again, thank you!
  • 0 Votes
    3 Posts
    861 Views
    Y
    Oh my gosh, so comprehensive answer! I'm so impressed that you put so much effort in it. You a great, thank you a lot!
  • How to get the status of video post in python

    sdk python
    4
    1
    0 Votes
    4 Posts
    743 Views
    R
    @ferdinand Thank you, the code runs well. └(^o^)┘
  • GeDialog Timer Always Printing to Console?

    s26 2023 python
    2
    2
    0 Votes
    2 Posts
    318 Views
    K
    Well, that was a fast solution... couldn't it have emerged BEFORE I hit submit?!? Haha, the solution was easy... I was returning True on the Timer function. Took a look at the python memory viewer example and noticed they don't return a value on it. Removed the return from my Timer() function and all is working as expected. def Timer(self, msg): print("Timer") That's it:)
  • How can I change the order of Reflection layers

    r21 classic api python
    6
    0 Votes
    6 Posts
    828 Views
    M
    Oh my, this is horrible ... cheers mogh
  • PointObject.CalcVertexMap(self, modifier)

    python r25
    5
    0 Votes
    5 Posts
    899 Views
    A
    @m_adam hi Maxime, thank you for your availability. Bacca's answer immediately cleared my mind on the subject, just as I was reading the other thread. I usually use the traditional method of calculating vertexmaps in the presence of obstacles. I thought CalcVertexMap did just that (the restriction tag is not mentioned in the SDK, so I couldn't figure out how to use it) but my curiosity is just didactic. Ciao Gianluca
  • select edge points with python

    Moved
    5
    0 Votes
    5 Posts
    1k Views
    D
    wohaa, thank you so much for your time an effort! i will have a good look at it. alos great insight into what the GetNgonEdgesCompact numbers mean. this was a bit mysterious in the sdk, or at least hard to decipher what the description meant.
  • List all Redshift node types that can be added in Node Editor?

    python 2023
    3
    0 Votes
    3 Posts
    863 Views
    V
    Great, this is exactly what I needed. Thanks @ferdinand !
  • 0 Votes
    6 Posts
    630 Views
    ferdinandF
    Hello @dunhou, ah that was the critical bit of information for me, that is you plugin at work there Well, as always without code it is hard to say what is going wrong there. the main code about this function is like : SetBit() doc.InsertMaterial() c4d.CallCommand(12252) # Render Materials doc.GetActiveMaterial() textag.SetMaterial() and some undo and call the Node Editor for certain renderer or rules for the function ... Out of this selection, I would put my money on CallCommand and undo handling. Setting bits and calling the mentioned methods are far less likely candidates. But that is pure guess work. actually, I checked the c4d.IsCommandChecked(id) The first thing I would do, is search for the command ID of the Material Manager (12159) in your code and add a print statement to each place where either this command ID is invoked with CallCommand or places where an ID determined at runtime is invoked (silly example : CallCommand(random.randint(1000, 1000000))) Then run your plugin again. When you see 12159 being printed when the undesired behaviour happens, you know it must be your plugin which misfiring. When not, it might be a bug in Cinama 4D or one of its APIs. Cheers, Ferdinand
  • Calling system command on animation frame change

    c++ python
    6
    0 Votes
    6 Posts
    1k Views
    yesbirdY
    Hi, Manuel. Thank you for description of both approaches, now I can compare them and choose the best. Regards, Sergey (Yesbird).
  • 0 Votes
    13 Posts
    2k Views
    ferdinandF
    Hey @thomasb, no worries, don't be too concerned about it. And you should not be ashamed, that was certainly not what I wanted to convey. "Every person his or her book", the second so called law of library science, is something I truly believe in. Everyone has valid information needs and we are trying to help users on their individual journey. You should not feel discouraged, we are and were all once in your place. But at the same time, I sometimes have to regulate a bit forum conduct as we, the Maxon SDK group, and other users are human too. And people tend to get confused, when they are being hit with a stream-of-conscious like threads were a user comments diary-style-like on his or her development state. It is not that I would not understand people are doing that. When one is in that situation, one is overwhelmed by the possible routes one can take, the amount of information to traverse. And verbalizing that does indeed help. But for someone who tries to help you or for people who later search for similar information, this "stream-of-conscious/diary" is then an obstacle rather than a help. So, sometimes I try to regulate both interests a bit. But as I said, please do not feel discouraged. Cheers, Ferdinand
  • How to detect CTRL being pressed in a GeDialog

    r23 r25 2023 c++
    4
    0 Votes
    4 Posts
    1k Views
    C4DSC
    Thanks @m_adam I can confirm that the following does work with R20, R23 and 2023 Int32 MyDialog::Message(const BaseContainer& msg, BaseContainer& result) { BaseContainer keyChannels; if (GetInputState(BFM_INPUT_KEYBOARD, QCTRL, keyChannels)) { Bool ctrlModifier = (keyChannels.GetInt32(BFM_INPUT_QUALIFIER) & QCTRL) != 0;
  • 0 Votes
    4 Posts
    924 Views
    ThomasBT
    @ferdinand Yes you are right, in relation to this the self.spline etc is unnecessary that could also be a normal local variable. Is correct. But basically if I load a profile spline in my init method, for example, I can already save it in such a variable. I need to be able to access it from anywhere in the class. But here it is totally superfluous....sorry
  • Error when removing bound joints

    c++ 2023
    4
    0 Votes
    4 Posts
    798 Views
    CJtheTigerC
    Thank you very much Maxime, both for the solution and the explanation. The code works perfectly. Also thanks for fixing this bug. Out of curiosity: Was this causing issues anywhere else? For completion sake: I do need to add a directChild->Free() after directChild->Remove(), correct? Still gonna mark this as answered as the core issue has been solved with flying colors. Thanks again!
  • Removing IsolateObjects document

    r23 r25 c++ 2023 r20
    3
    0 Votes
    3 Posts
    713 Views
    ManuelM
    hi, yes, KillDocument is not necessary in that case. Cheers, Manuel
  • Setting Material Preview for 1 material

    2023 python
    3
    0 Votes
    3 Posts
    540 Views
    P
    Thank you.
  • 0 Votes
    4 Posts
    894 Views
    A
    @manuel Wow! Manuel thank you so much I'm new in code development so that's why its fo easy for me to have those kind of mistakes. Thank you so much for your support.
  • Unsolo a Node?

    python 2023
    5
    0 Votes
    5 Posts
    872 Views
    B
    @m_adam Thanks. Works as expected!