• Access Python Tag Globals from outside

    Cinema 4D SDK python
    10
    0 Votes
    10 Posts
    1k Views
    indexofrefractionI
    Thanks zipit and Maxime, I use the MSG_BASECONTAINER solution now, thanks for the example ! one question here: you always return True from the message() function is that necessary? the docs here https://developers.maxon.net/docs/py/2023_2/manuals/introduction/python_tag.html?highlight=python plugin just says : Return type: bool Returns: Depends on the message type. ... and a bit off topic : is there a message, when a python tag or generator gets enabled / disabled by the (generator) switch in the object manager? can i catch that?
  • 0 Votes
    7 Posts
    1k Views
    CairynC
    yupyup, BaseSelect has no connection to the original object it actually selects from, not even in the cases where you get a pointer to the BaseSelect returned and change the selection directly through it. That's why we need the max parameter for SelectAll and ToggleAll -- the BaseSelect doesn't know what "all" even is. (Not GetLastElement()!) For GetRange() though, that reasoning does not apply. Now let's see whether I can crash C4D with inconsistent edge selections...
  • Get Point Positions of Selected N-Gon or Polygon

    General Talk
    11
    0 Votes
    11 Posts
    3k Views
    X
    Hi: This is a bit of a hassle, but can still be scripted, who CARES about an extra polygon. import c4d def main(): polygons = op.GetAllPolygons() points = op.GetAllPoints() point = [c4d.Vector(10000, 10000, 10000),c4d.Vector(9999, 10000,10000), c4d.Vector(9999, 10000, 10001),c4d.Vector(10000, 10000, 10001)] point_indexe = [[len(points) + i ,point[i]] for i in range(len(point))] op.ResizeObject(len(points) + len(point),len(polygons) + 1) set_point = [op.SetPoint(k[0], k[1]) for k in point_indexe] op.Message(c4d.MSG_UPDATE) c4d.EventAdd() if __name__=='__main__': main()
  • ToolPlugin Problems

    Cinema 4D SDK python s22 r21 r20 r19
    7
    2
    0 Votes
    7 Posts
    1k Views
    kbarK
    @gheyret great to hear! Looking forward to seeing what it is you are creating.
  • 0 Votes
    5 Posts
    797 Views
    AwesuusA
    Thank you so much, this works like a charm!!!
  • Requests for GeClipMap Class

    Cinema 4D SDK
    3
    0 Votes
    3 Posts
    445 Views
    ?
    @m_magalhaes Thanks, Manuel!
  • MultiLineEditText Documentation

    Cinema 4D SDK python
    3
    0 Votes
    3 Posts
    352 Views
    ?
    @m_adam Thank you for the update, Maxime!
  • Store generator's property

    Cinema 4D SDK python
    4
    0 Votes
    4 Posts
    597 Views
    ManuelM
    hi can we considered this thread as resolved ? Cheers, Manuel
  • 0 Votes
    5 Posts
    824 Views
    CairynC
    @android Here's a thread for reference regarding the limitation of a Generator spline: https://developers.maxon.net/forum/topic/12596/is-it-possible-to-get-a-spline-wrap-object-to-use-a-python-generated-spline
  • 0 Votes
    4 Posts
    518 Views
    ferdinandF
    Hi, jeah, that is probably somewhat the reason. Although Python has true statically typed arrays, which also can be used to directly in-place manipulate C arrays (i.e. array.array), from what I understand it is quite cumbersome to achieve such linkage. This is probably the reason why Maxon does not bother in this case and others like for example vertex colors. Including these access points is still a bit puzzling though. Maybe they are somehow used internally? But I cannot think of a case where this would make sense. Cheers, zipit
  • Toggle bitmap button on .res file

    Cinema 4D SDK python
    4
    0 Votes
    4 Posts
    792 Views
    ManuelM
    hi, Group is the key in UI. Simply add a SCALE_H; property for your slider. so for that two columns group, the slider will take all the place minus the button. GROUP { COLUMNS 2; REAL ONEFLOAT { CUSTOMGUI REALSLIDER; SCALE_H;} BITMAPBUTTON BUTTON_ID { SIZE 16; TOGGLE; BUTTON; ICONID1 5160; ICONID2 5159; } } Cheers, Manuel
  • 0 Votes
    5 Posts
    658 Views
    B
    @m_magalhaes Thanks! It works as expected. So that's what you mean by UniformToNatural. Basically, even if the segment guides are not the same as spline points, it will conform to its overall shape.
  • Changing Face Normal's Direction?

    Cinema 4D SDK r21 python
    5
    0 Votes
    5 Posts
    1k Views
    ManuelM
    hi, everything have been said, nothing to add here Cheers, Manuel
  • 0 Votes
    3 Posts
    529 Views
    ManuelM
    hi, Since R20, arguments have been added, and the problem is coming from the last one def HeaderClick(self, root, userdata, lColID, lChannel, bDblClk, mouseX, mouseY, ua): I've opened a bug report Cheers, Manuel
  • Write to C4D console in real time

    Cinema 4D SDK python
    14
    0 Votes
    14 Posts
    3k Views
    indexofrefractionI
    @ivodow how is your ConsolePrint() different to a simple print() statement? in my test i didn''t get a real time output with ConsolePrint() best, index
  • Mirror without duplicate using `MCOMMAND_MIRROR`

    Cinema 4D SDK s22 python
    12
    0 Votes
    12 Posts
    2k Views
    ManuelM
    Hi, This have been fixe and will be available in a futur update. Cheers, Manuel
  • 0 Votes
    11 Posts
    1k Views
    ManuelM
    hi can we considered this thread as solved ? (even if there's no real right answer) Cheers, Manuel
  • Creating a Python Script box

    Cinema 4D SDK python
    3
    1
    0 Votes
    3 Posts
    391 Views
    ManuelM
    hi, except what @zipit said, there's nothing outof the box that you can use in our API to do it. You have to come with your own solution. Remotion have create such a tool few years ago: https://bitbucket.org/remotion/code-editor-gui-for-c4d/downloads/ I would say that it's not really hard to do, it's just long and during the path you are walking to build such a tool, you could find some walls that you didn't expect ^^' I would start using the function GetDParameter, check the content and change the color of some words accordingly. Cheers, Manuel
  • Change the default name of ID_OBJECTPROPERTIES

    Cinema 4D SDK python
    3
    1
    0 Votes
    3 Posts
    626 Views
    mfersaouiM
    @m_magalhaes said in Change the default name of ID_OBJECTPROPERTIES: DEFAULT 1; Thank you much.
  • Merge IsolateObjects into a second document

    Cinema 4D SDK r20 python windows
    2
    0 Votes
    2 Posts
    528 Views
    ManuelM
    hi, you have to save the document to memory and use the result to merge the document. When you merge, you have to set the flags to what you want to merge, otherwise it will not merge what you want. On this example i'm merging a document with another selected document. import c4d from c4d import gui # Welcome to the world of Python # Main function def main(): obj = doc.GetActiveObject() if obj is None: return # Isolate the active object isolateDoc = c4d.documents.IsolateObjects(doc, [obj]) # Creates the Memory File Strcuture mfs = c4d.storage.MemoryFileStruct() # Sets the mfs to write mode mfs.SetMemoryWriteMode() # save the document to mfs c4d.documents.SaveDocument(isolateDoc, mfs, c4d.SAVEDOCUMENTFLAGS_DONTADDTORECENTLIST, c4d.FORMAT_C4DEXPORT) # retrieve the data data = mfs.GetData() # Set the MFS to read mode mfs.SetMemoryReadMode(data[0], data[1] ) flags = c4d.SCENEFILTER_OBJECTS | c4d.SCENEFILTER_MATERIALS # Load Document selectedFile = c4d.storage.LoadDialog() if selectedFile is None: return newDoc = c4d.documents.LoadDocument(selectedFile, flags) #Merge the isolated document with the current one. c4d.documents.MergeDocument(newDoc, mfs, flags) c4d.documents.InsertBaseDocument(newDoc) c4d.documents.SetActiveDocument(newDoc) # Execute main() if __name__=='__main__': main() Cheers, Manuel