• BFM_DRAGRECEIVE

    Cinema 4D SDK sdk c++
    3
    0 Votes
    3 Posts
    846 Views
    WickedPW
    Thanks @m_adam, I had to jump through a bunch of hoops with this one, because I put the queue process into a progress dialog so that for large file arrays there's an indicator of progress. Otherwise it just appears to hang and the user won't know why. But this made it tricky when the timer is also used because of the different thread contexts involved with the timer, the progress dialog and everything else on the main thread. But with a bit of care, it seems to work. Thanks again, WP.
  • Automatic UV Rectangularize / MDATA_UVRECTANGULARIZE

    Cinema 4D SDK
    2
    0 Votes
    2 Posts
    712 Views
    M
    Hi sadly the only way is to use c4d.CallCommand(1055347) which does not open the window but directly execute the command. You can change the setting as you could in the windows, by editing the value in the BaseContainer of the document. Finally it act on the selected polygon, so the best way would be to select them. Find bellow a script that you can execute in the script manager that will select all polygon of an object and run the command. from typing import Optional import c4d doc: c4d.documents.BaseDocument # The active document op: Optional[c4d.BaseObject] # The active object, None if unselected def main() -> None: # Enables UV Polygon Mode if not already in any UV mode (needed for GetActiveUVSet to works) if doc.GetMode() not in [c4d.Muvpoints, c4d.Muvpolygons]: doc.SetMode(c4d.Muvpolygons) # Retrieves active UVSet, The UV windows need to be opened at least one time handle = c4d.modules.bodypaint.GetActiveUVSet(doc, c4d.GETACTIVEUVSET_ALL) if handle is None: # If fail it may be because the Texture view is not open # Open A texture View c4d.CallCommand(170103) # In S22 you need to update the UV Mesh if c4d.API_VERSION >= 22000: c4d.modules.bodypaint.UpdateMeshUV(False) # Retrieves active UVSet, The UV windows need to be opened at least one time handle = c4d.modules.bodypaint.GetActiveUVSet(doc, c4d.GETACTIVEUVSET_ALL) if handle is None: raise RuntimeError("There is no Active UVSet") # Select the polygon you want to operate on currentSel = op.GetPolygonS() previousSel = currentSel.GetClone() # Will be used to restore the initial selection state at the end currentSel.SelectAll(op.GetPolygonCount() - 1 ) # Update the UV mesh to properly take into account the new selection c4d.modules.bodypaint.UpdateMeshUV(True) # Define the settings settings = doc.GetSettingsInstance(c4d.DOCUMENTSETTINGS_MODELING) settings[c4d.MDATA_UVRECTANGULARIZE_ALIGN] = True settings[c4d.MDATA_UVRECTANGULARIZE_EQUIDISTANT] = False # Execute the command c4d.CallCommand(1055347) # Restore the initial selection previousSel.CopyTo(currentSel) c4d.modules.bodypaint.UpdateMeshUV(True) c4d.EventAdd() if __name__ == '__main__': main() Cheers, Maxime.
  • 0 Votes
    3 Posts
    1k Views
    ferdinandF
    Hello @HerzogVonWiesel, Thank you for reaching out to us. Using the message system could be possible here but seems a bit overkill. Since you own both implementations, it would be best if you simply tie together the dialog instances you want to exchange information between. E.g.: import c4d class ConnectedDialog(c4d.gui.GeDialog): """Realizes a dialog type which has a binding to another dialog instance. Note that all methods in this example are not part of the GeDialog interface scheme, i.e., "custom" methods. """ def __init__(self) -> None: """ """ # The list of dialogs this dialog instance does exchange information with. self._connectedDialogs: list[ConnectedDialog] = [] super().__init__() def Bind(self, other: "ConnectedDialog", twoWay: bool = True) -> None: """Binds the dialog #other to #self and makes the connection optionally two-way. Also ensures that bindings are unique, i.e, two dialogs cannot be bound more than once in one direction. """ if not isinstance(other, ConnectedDialog): raise TypeError(f"{other = }") if other not in self._connectedDialogs: self._connectedDialogs.append(other) if twoWay and self not in other._connectedDialogs: other._connectedDialogs.append(self) def SpecialMessage(self, sender: "ConnectedDialog", *args) -> None: """Receives message stream from all connected dialogs. """ print (args) def Action(self, value: any, condition: any) -> None: """Exemplifies a method which informs all other dialog instances about an event. """ if condition: for dlg in self._connectedDialogs: dlg.SpecialMessage(self, value, condition) if __name__ == "__main__": # Instantiate five dialogs and creating bindings between all of them. dialogCollection: tuple[ConnectedDialog] = (ConnectedDialog() for _ in range(5)) for a in dialogCollection: for b in dialogCollection: a.Bind(b) You could do three million and one thing differently here; this is just an example to illustrate a pattern. The crucial information might be here for you (since we just talked about threading and dialogs before) that: The methods both of modal and async dialogs run on the main thread. Async in an async dialog are only the drawing routines which you do not have access to, even when you implement a dialog with a custom GeUserArea. That area only enqueues drawing instructions into a buffer and does not do the actual drawing. So, there is no danger of access violations, which Python of course does not know in the first place due to its GIL. When tying dialogs together is not possible then you can use the message system of Cinema 4D. But tying objects together is always possible in Python even when the objects live in two modules which do not have access to each other. You can either use sockets (a bit overkill) or be lazy and just setup shop in a commonly accessible object, e.g., the sys module. When you go for messages, I would recommend having a look at the Message Manual first as I gave there a rough overview. In short: GeDialog.Message is for UI messages and just like its NodeData.Message counter part instance specific. It is not meant to establish a binding between two dialog instances but to let Cinema 4D or elements in a UI tree communicate with the dialog ("button to dialog: I have been pressed"). What you can do, is set off a core event with c4d.SpecialEventAddd to then catch that core message in all other dialogs using GeDialog.CoreMessage. Note that the Python API does filter message streams, and unlike in C++, you cannot just "invent" a new message type, except for using c4d.SpecialEventAdd. But there you are limited to sending three integers in Python (in C++ the p1 and p2 arguments are meant to be pointers to arbitrary data). Cheers, Ferdinand PS: Yeah using the CPython API you can cast/wrap things (in order to use p1 and p2 actually in the manner they are intended to) but be aware that any C magic is not officially supported by us.
  • Python plugin encryption

    Cinema 4D SDK python 2023 sdk
    3
    0 Votes
    3 Posts
    848 Views
    F
    Thank you very much!
  • ShowBitmap() and image name

    Cinema 4D SDK sdk c++
    5
    1
    0 Votes
    5 Posts
    1k Views
    ferdinandF
    Hey @WickedP, Thank you for pointing it out. There was a problem with how the CSS of the plugin providing the solved feature, the forum CSS, and our styling CSS did mesh in the light skin. I fixed it by putting even more CSS on top of things - because who doesn't love a solid mess in the CSS PS: I am aware that the search feature could also still use some work under the dark skin. It is just not the highest priority when things are ugly but readable. Cheers, Ferdinand
  • ProgressDialog and SetTitle()

    Cinema 4D SDK sdk c++
    3
    0 Votes
    3 Posts
    752 Views
    WickedPW
    Hi @i_mazlov The dialog/gui is open. It's a progress dialog that I use to run an export function. I did some more digging, and I believe I've solved it. I had to put the SetTitle() into the dialog's Timer() function. So, something like this: virtual void MyProgressDialog::Timer(const BaseContainer& msg) { // 'title' is a class-level string variable SetTitle(title); return ProgressDialog::Timer(msg); } Seems to work as expected. WP.
  • Drag & Drop Undo

    Cinema 4D SDK r20 sdk c++
    5
    0 Votes
    5 Posts
    1k Views
    J
    Thanks for the response. I figured that something like this would be the case, will have to look into the options you mentioned. John Terenece
  • using python Layerset - Generate Alpha option?

    Cinema 4D SDK python sdk
    5
    2
    0 Votes
    5 Posts
    940 Views
    P
    @ferdinand Thanks for the advice. i'm going to try Have a nice day today
  • Sliders in Python plugin

    Cinema 4D SDK sdk python 2023
    5
    0 Votes
    5 Posts
    1k Views
    ferdinandF
    Hello @filipst, Without further questions or updates we will consider this topic as solved by Friday the 11th, and flag it accordingly. Cheers, Maxon SDK Group
  • Cineware project does not compile

    Cineware SDK c++ sdk
    3
    0 Votes
    3 Posts
    1k Views
    J
    Hello @zun1 , without further questions or postings, we will consider this topic as solved by Friday, the 11th of august 2023 and flag it accordingly. Thank you for your understanding, Maxon SDK Group
  • Active Controls

    Cinema 4D SDK sdk r20 c++
    5
    1
    0 Votes
    5 Posts
    1k Views
    J
    Thanks for the response. That's what I figured would be the case.
  • Annotation tag without bubble

    Cinema 4D SDK sdk
    5
    0 Votes
    5 Posts
    1k Views
    S
    @ferdinand many thanks, I think that the topic is closed! You're amazing!
  • GvOperatorData, GetDDescription() problems

    Cinema 4D SDK sdk s26
    6
    0 Votes
    6 Posts
    1k Views
    J
    Hello @Filip , without further questions or postings, we will consider this topic as solved by Friday, the 11th of august 2023 and flag it accordingly. Thank you for your understanding, Maxon SDK Group
  • 0 Votes
    10 Posts
    2k Views
    F
    Great, thanks a lot for looking into this and for the detailed explanations! Now I know better what my options are! I am marking this thread as "solved". Best regards Filip Malmberg
  • Using recent VS to make older builds

    Cinema 4D SDK
    5
    0 Votes
    5 Posts
    924 Views
    WickedPW
    Thanks Maxime. And apologies for the delay - I didn't see the response. WP.
  • Apply material to individual faces of a polygon

    Cinema 4D SDK python sdk
    8
    0 Votes
    8 Posts
    3k Views
    ferdinandF
    Hey @zauhar, I do not think so that I have told you that, at least I hope so, because that what you say there is not quite correct A vertex map or a vertex color tag can be rendered. When you use the standard renderer, you will have to use the Vertex Map shader, and when you use Redshift, you will need the Vertex Attribute node (just drag and drop the tag in both cases in the respective reference fields of the shaders). Below is an example for the Redshift case: [image: 1686937459914-screenshot-2023-06-16-at-19.41.37.png] Other renderers support Cinema 4D vertex colors too, but you will have to ask their support how that works Vertex Map Shader Vertex Attribute Node Cheers, Ferdinand
  • How to add custom menu to take manager

    Cinema 4D SDK
    3
    0 Votes
    3 Posts
    682 Views
    H
    Hi @i_mazlov, thank you for your reply. Yes, I thought as much. Too bad the take manager menu is not publicy exposed. And while I understand that Maxon as well as the community are not big fans of every plugin messing around with menu insertions, it still is a pitty. One can e.g. insert plugins into the menu of the material manager as done so by "CV-Swim". IMHO it should pose no problem when done carefully with UX in mind while doing so. Especially when one "only" appends entries to a menu. Nethertheless thank you for confirmation. Cheers, Sebastian
  • 0 Votes
    3 Posts
    1k Views
    J
    Hello @jenandesign , without further questions or postings, we will consider this topic as solved by Friday, the 11th of august 2023 and flag it accordingly. Thank you for your understanding, Maxon SDK Group
  • How to get a port data type?

    Moved Bugs sdk python windows 2023
    6
    1
    0 Votes
    6 Posts
    2k Views
    J
    Hello @Dunhou , you are correct, the issue is not fixed yet. As Ferdinand mentioned in the beginning he has flagged it as "to_fix", so it will be fixed as soon as possible. Thanks and Cheers Maxon SDK Group
  • Register to object change

    Cinema 4D SDK sdk c++
    5
    0 Votes
    5 Posts
    1k Views
    ferdinandF
    Hey @CJtheTiger, sorry for my radio silence here and thank you for updating the thread. In short: you drew all the right conclusions for the general case. A MessageData solution can be quite performant when you know exactly what you are doing and when you must monitor either every object (in the sense of geometry) in the scene graph or at least many of them. For something like monitoring materials, shaders, or tags, the solution is mandatory anyways. The tag solution on the other hand can become a bottle neck when the information flow becomes too expensive. Imagine such dependency propagation tag called DataTag, and you have 1000's of them in a scene. Each tag not only informs then one but multiple other nodes about changes of its host. Due to that there is also overlap, i.e., both DataTag DA and DataTag DB inform a target object T about changes of their host objects HA and HB. But for T this might be the "same" event and it then might be doing work twice. So, when stuff is getting complicated, you. are often better off with a MessageData solution, as you can consolidate things there. Cheers, Ferdinand