• Xref object Make it Editable

    Cinema 4D SDK 2024 python
    3
    2
    0 Votes
    3 Posts
    718 Views
    chuanzhenC
    @ferdinand Thanks for your reply!
  • UserArea drag and drop example?

    Cinema 4D SDK windows 2024 python
    6
    0 Votes
    6 Posts
    2k Views
    K
    I tried using a timer to solve this problem, but I still want to know if there is a more direct way import c4d import threading from c4d.gui import GeUserArea, GeDialog GADGET_ID_GEUSERAREA = 10000 class DropArea(GeUserArea): def __init__(self): # Used to store all objects involved in the drag-and-drop operation self.currentDragObjects = [] # Flag to indicate whether a drag operation is in progress self.isDragging = False # Define a timer to delay the handling of the drag completion self.dragTimer = None def Message(self, msg, result): # Handle drag-and-drop messages if msg.GetId() == c4d.BFM_DRAGRECEIVE: # Check if the drag was lost or canceled if msg.GetInt32(c4d.BFM_DRAG_LOST) or msg.GetInt32(c4d.BFM_DRAG_ESC): self.isDragging = False return self.SetDragDestination(c4d.MOUSE_FORBIDDEN) # If the drag just started, clear the previous object list if not self.isDragging: self.currentDragObjects = [] # Initialize the storage list self.isDragging = True # Mark the beginning of the drag # Verify if it is a valid drop area if not self.CheckDropArea(msg, True, True): return self.SetDragDestination(c4d.MOUSE_FORBIDDEN) # Get the dragged file object dragInfo = self.GetDragObject(msg) if dragInfo is not None: dragObject = dragInfo['object'] # Check if the object already exists in the list to avoid duplicates if dragObject not in self.currentDragObjects: self.currentDragObjects.append(dragObject) # Reset the timer to delay the handling of drag completion if self.dragTimer is not None: self.dragTimer.cancel() # Set a short timer (e.g., 0.2 seconds) to determine if the drag operation is complete self.dragTimer = threading.Timer(0.2, self._finalize_drag) self.dragTimer.start() # Set the mouse cursor to a valid state return self.SetDragDestination(c4d.MOUSE_MOVE) # Call the base class Message() method to handle other messages return c4d.gui.GeUserArea.Message(self, msg, result) def _finalize_drag(self): # Delayed execution to ensure all dragged objects have been received self.isDragging = False if self.currentDragObjects: # Print all dropped files print(f"Dropped files: {self.currentDragObjects}") # Additional logic can be executed here, e.g., handling file paths or other content # Clear the object list for the next drag-and-drop operation self.currentDragObjects = [] # Redraw the user area (if UI update is needed) self.Redraw() class ExampleDialog(GeDialog): geUserArea = DropArea() def CreateLayout(self): self.SetTitle("Drag Area") if self.GroupBegin(0, c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT, cols=1, rows=0, title="", groupflags=0, initw=100, inith=100): self.GroupBorderSpace(8, 8, 8, 8) self.GroupSpace(2, 2) # Add the user area gadget self.AddUserArea(GADGET_ID_GEUSERAREA, c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT, 200, 200) # Attach the user area to the gadget self.AttachUserArea(self.geUserArea, GADGET_ID_GEUSERAREA) self.GroupEnd() return True if __name__ == "__main__": global dlg dlg = ExampleDialog() dlg.Open(dlgtype=c4d.DLG_TYPE_ASYNC, defaultw=200, defaulth=200)
  • Character Defenition Tag - maxon.Id?

    Cinema 4D SDK 2024 python
    3
    0 Votes
    3 Posts
    672 Views
    jochemdkJ
    Thx Maxim, so I'll have to wait until the next version..
  • Reset Tool in Interaction Tag

    Cinema 4D SDK 2024 python
    4
    2
    0 Votes
    4 Posts
    815 Views
    ferdinandF
    Hey @CJtheTiger, just as a clarification, it is obvious that you have put quite a bit of effort in your posting. So, that was not meant in the sense of "what a terrible posting". But especially for postings which contain a lot of detail, it is important to put the question at the very beginning so that it is clear what is the question. Regarding the axis behavior thing, I now understand how you mean that. The Interaction Tag (and Tooling) is not owned by the SDK group, so we would not be responsible for this case either, we only own all the "pure" Python stuff. What I thought was your request before, changing the general default value, had probably almost zero changes of being implemented. This request of yours sounds logical (I am not a big expert on the interaction tag) but given how niche that case is, and that it would require customization in tools just for that case, I do not see a high chance that this will ever be implemented either. But if you truly desire that feature, you should still submit the wish, because a lot of user requests for the same thing are something we cannot and will not ignore. Cheers, Ferdinand
  • 0 Votes
    8 Posts
    1k Views
    D
    Marvelous @Dunhou, thanks yet again!! Here's the final script in case someone else has use for it: 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(): # Retrieves BaseTime of frame 5, 20 start = 0 end = 1 if c4d.CheckIsRunning(c4d.CHECKISRUNNING_ANIMATIONRUNNING) == True: c4d.CallCommand(12412) # Play Forwards # Loops through the frames for frame in range(start, end + 1): # Changes the time of the document doc.SetTime(c4d.BaseTime(frame, doc.GetFps())) # Updates timeline c4d.GeSyncMessage(c4d.EVMSG_TIMECHANGED) # Redraws the viewport and regenerate the cache object c4d.DrawViews(c4d.DRAWFLAGS_ONLY_ACTIVE_VIEW | c4d.DRAWFLAGS_NO_THREAD | c4d.DRAWFLAGS_STATICBREAK) # Pushes an update event to Cinema 4D c4d.EventAdd(c4d.EVENT_ANIMATE) if __name__ == '__main__': main()
  • 0 Votes
    3 Posts
    2k Views
    ThomasBT
    @ferdinand Hello Ferdinand, Thank you very much first of all. yes, you're right, I worked extremely sloppily with the SMC method, of course I'll take the threading into account and also work with a Temp Document. Regarding the problem itself, I can only say that reinstalling CINEMA 4D solved our problem. Cheers
  • 0 Votes
    8 Posts
    2k Views
    F
    Hi @i_mazlov , Thank you for confirming my solution. Best regards, Tomasz
  • Rotating a Bitmap image with C4D's C++ SDK?

    Cinema 4D SDK c++ 2024
    5
    0 Votes
    5 Posts
    971 Views
    sasha_janvierS
    Thanks @m_adam. I read the page. Duly noted!
  • SetMousePointer() will not "stick" in GeDialog

    Cinema 4D SDK c++ 2024
    2
    0 Votes
    2 Posts
    540 Views
    i_mazlovI
    Hello @justinleduc, Sorry for the delayed answer. You have a point that the discussion on some abstract questions doesn't require any code. However, you have a very specific question, namely you're struggling from your cursor constantly flickering between cursor states. This is your exact code that produces this undesirable result, so this is not an abstract question. According to my observations there's no issues with flickering cursor in GeUserArea in C4D 2024.2. You can find some good examples in our C++ repository. for example you can start with C++ SDK - Example Dialog. Please also make sure you familiarized yourself with the following manual pages: GUI and Interaction Messages Manual GeDialog Manual GeUserArea Manual Especially the GeUserArea::Message() would be something of your interest. If you're still observing the issue please provide a minimal code snippet that gives context to our discussion. Cheers, Ilia
  • Undo method for LayerShaderLayer

    Moved Bugs python 2024 limitation
    11
    0 Votes
    11 Posts
    2k Views
    John_DoJ
    Oof, that's an unfortunate end for me but at least I have a clear explanation. Thanks @ferdinand
  • Python plugin in costum C4D-Layout

    Cinema 4D SDK 2024 python windows
    3
    0 Votes
    3 Posts
    623 Views
    M
    @ferdinand thank you for your welcoming words, for your help and edits. Since I am no trained developer I was simply copy and pasting my first lines of code including the RegisterCommand function from the maxon python example github and thought it would fit my application since I thought the description in the sdk seemedlike a match to me ["Command can be dragged into an icon bar and delivers its own dialogs instead of icons." (- maybe I got that wrong)]. Also scince I have little developing experience the term "smallnode" is nothing I can make sense of and an accurate description seems to be missing. Nevertheless I tried your suggestion and it works like a charm. Thanks a lot Marc
  • How to get screen space

    Cinema 4D SDK 2024 python
    3
    1
    0 Votes
    3 Posts
    632 Views
    chuanzhenC
    @m_adam Thanks!
  • 0 Votes
    6 Posts
    1k Views
    D
    Thanks a lot for the clarification! It would be nice to include more usecase examples of GetAccessedObjects(..) implementation in the SDK examples in the future. I will try your suggestion once 2024.4 becomes available.
  • How it works new CalcGradientPixel?

    Cinema 4D SDK python 2024
    3
    0 Votes
    3 Posts
    751 Views
    lleallooL
    I am kind of surprised there isn't an easier way to sample a Gradient by a normalized 0-1 position Anyway, thanks @mikeudin for the snippet and @m_adam for the fix
  • VariableTag, Resize, and CopyTo

    Cinema 4D SDK 2024 c++
    18
    0 Votes
    18 Posts
    3k Views
    D
    Hi Ilia, I'm on Mac 13.3 and C4D 2024.0.0 at the moment. Dan
  • 0 Votes
    4 Posts
    956 Views
    G
    The API does appear to have movie saving features. https://developers.maxon.net/docs/py/2023_2/modules/c4d.bitmaps/MovieSaver/index.html
  • How to group nodes in a Scaffold using Python

    Cinema 4D SDK 2024 python
    3
    0 Votes
    3 Posts
    698 Views
    D
    Hey @m_adam , Thanks for your help. It works now. However, I'm wondering how I would have known that I needed to set the scaffold ID to the node. The documentation doesn't seem to explicitly mention this step. I might be wrong, but for someone without strong knowledge of the API, I'd never thought that way. I would rather added the selected nodes to a group, as this is what a scaffol is. Does that make sense? As a side note, after adding the nodes to the scaffold group, they appear messy, actually the nodes are nicely arranged inside the group, but the scaffold is overlapping other nodes. This is likely related to the bug we discussed here: https://developers.maxon.net/forum/post/73446. Am I right? Cheers
  • 0 Votes
    7 Posts
    1k Views
    M
    Hi sadly no news, except we kind of know the issue, sadly this issue is somehow by design and will require an architectural change. While we still want to fix this issue, everything is about priority and this is not a urgent priority at the moment so I can't tell you when it will be fixed. But it's on our list. Cheers, Maxime.
  • OpenUSD (pxr) library in c4d python

    Cinema 4D SDK python 2024
    17
    0 Votes
    17 Posts
    6k Views
    i_mazlovI
    Hi @llealloo, please excuse the delayed answers. To the best of my knowledge in the near future there're no plans for integrating usd python bindings into c4d python system. By the way, with the 2025.0 release internal usd library was properly updated to OpenUSD 24.08, so we expect the double loading usd issue to be solved under OSX. Cheers, Ilia
  • How to create python plugin in 2024?

    Cinema 4D SDK 2024
    6
    0 Votes
    6 Posts
    1k Views
    B
    @ThomasB said in How to create python plugin in 2024?: Yes, download the SDK and study the examples. I wrote my own software that allows me to simply select the type of plugin I want to create, enter the plugin ID and the plugin name. The program then creates the folder structure, all files with the correct content and the correct name automatically...that was the first thing I did because it is always extremely tedious. This then takes 10 seconds and I have a finished blueprint. Then I can start programming straight away. I usually make the Gui first using UserData to roughly create the design and then I write it down in the resfile in no time at all. It's relatively quick and even fun and you gradually grow into it, it emerges little by little..... Basically it wouldn't be a problem to write a script that writes the UserData interface into a Res, header and string file, I already have an idea for that... That would actually be easy to do. I'll get to it when I'm done with my update... and then maybe make it available to the community... However, a similar one is already there, but I can't remember where. Greetings Tom Yeah, that sounds cool. The ui stuff you're mentioning was very similar to how the old ResEdit plugin worked. the source code is on gitHub, but I don't know how to compile C++ plugins. But I guess there is nothing there. This stems from me copying one of the examples from the Python SDK and trying to make it my own. It hasn't been very intuitive for me, which is why I asked because I figured I must have been missing something, but it seems I am not.