• Buttons ids

    Cinema 4D SDK python
    2
    0 Votes
    2 Posts
    904 Views
    ManuelM
    Hello, there's no real list where you can find easily those IDs. @m_adam came with this idea : open the Script log (menu script > script log) and click the button you want to call. in the console you will see something like c4d.CallButton(tool(), c4d.MDATA_NEWTRANSFORM) so you know that the ID is c4d.MDATA_NEWTRANSFORM Another place to look for, is the folder ressource/modules where you can find the files .res that build the ui. (using your OS search function will help a lot) Openning those file you will find the information BUTTON MDATA_NEWTRANSFORM { FIT_H; } and you can maybe open the file with the same name with the extention .h where you will find the id MDATA_NEWTRANSFORM = 701, // Button Other than that, there are the enums on the documentation like this page but it's not really "user friendly" Let me know. Cheers Manuel
  • Cinema Gradient, weird behaviour

    Cinema 4D SDK r20 sdk python
    7
    0 Votes
    7 Posts
    1k Views
    M
    Don't feel sorry yes this is the issue and since Knot ID are not ordered from right to left but from creation order its why it's confused you. Moreover, using a for loop will make way more sense and help you to avoid this kind of stuff. grad1 = shdr1[c4d.SLA_GRADIENT_GRADIENT] grad2 = shdr2[c4d.SLA_GRADIENT_GRADIENT] for knotId in xrange(grad1.GetKnotCount()): knot = grad1.GetKnot(knotId) grad2.InsertKnot(col=knot['col'], pos=knot['pos'],index=knot['index']) grad2.FlushKnots() shdr2[c4d.SLA_GRADIENT_GRADIENT] = grad2 Finally, a BaseShader is derived from BaseList2D which is derived from C4DAtom that mean you can use GetClone to retrieves a clone of this shader so your code can look like. import c4d def main(): mat = doc.GetFirstMaterial() colorShader = mat[c4d.MATERIAL_COLOR_SHADER] if colorShader is None: return copyColor = colorShader.GetClone() mat[c4d.MATERIAL_DIFFUSION_SHADER] = copyColor mat.InsertShader(copyColor) mat.Message(c4d.MSG_UPDATE) mat.Update(True, True) c4d.EventAdd() # Execute main() if __name__=='__main__': main() Cheers, Maxime.
  • 0 Votes
    5 Posts
    1k Views
    B
    @m_adam Thanks for further clarification specially the catch with the dialog's on the script. Will now closed the thread. Have a great day ahead!
  • Use a list or array for data?

    General Talk python
    5
    1
    0 Votes
    5 Posts
    2k Views
    ManuelM
    hello, if you don't have anything else to add, i'll mark this topic as "solved" Cheers Manuel
  • Add/Remove Groups of User Data

    Cinema 4D SDK python
    12
    2
    0 Votes
    12 Posts
    4k Views
    mrittmanM
    @m_magalhaes said in Add/Remove Groups of User Data: Hello, I was also talking about something like this. But it's not the best way to go. I suggest a TagData (plugin) with his own UI. pyTagCode = '\ import c4d \n\ #Welcome to the world of Python \n\ \n\ def main():\n\ print "this ia a message"\n\ \n\ ' import c4d # Main function def main(): if op is None: gui.MessageDialog("Please selecte a target object") tag = c4d.BaseTag(c4d.Tpython) tag[c4d.TPYTHON_CODE] = pyTagCode op.InsertTag(tag) c4d.EventAdd() # Execute main() if __name__=='__main__': main() By the way, don't forget you can save tag presets, that include python tags. You can simple add them with right click on your object in OM and "Load tag preset" Cheers, Manuel Oh this is good to know! Thanks so much for the information, this is quite helpful! Matt
  • Access Custom User Data By Name (not by ID)

    Cinema 4D SDK r20 python
    5
    0 Votes
    5 Posts
    2k Views
    B
    Thanks for the response @m_adam Have a great day ahead!
  • How to cancel FileLoad error message.

    Cinema 4D SDK
    3
    0 Votes
    3 Posts
    893 Views
    V
    Thanks for the reply! I'll try that, though I thought that SCENEFILTER_IGNOREXREFS would keep xrefs from being loaded, and since my plugin edits the xref path/name, this would not work. But then again, perhaps I assumed wrong. I appreciate the help! By the way, the idea of classification by tags appears to be a good way to escape the messy folding out tree of classification system that we are all used to. I'll use it next time.
  • The python SDK is running in error

    Cinema 4D SDK sdk c++ python
    2
    1
    0 Votes
    2 Posts
    566 Views
    r_giganteR
    Hi panney, thanks for reaching out us. With regard to the issue you're experiencing, it's pretty likely that the cause is a different revision between the c4dpy executable and the Cinema 4D revision. Please be sure that they both matches (20.059 c4dpy is available here[URL-REMOVED]). Last but not least, here you can find more detail on the c4dpy executable. Best, R. [URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.
  • Move viewport camera from plugin

    General Talk
    5
    0 Votes
    5 Posts
    2k Views
    D
    wow! i love that. great job!
  • Output Current Sound Track Name

    Cinema 4D SDK python r20
    12
    3
    0 Votes
    12 Posts
    3k Views
    S
    Hello, it seems you just write the name of the last track into your user data field: obj[c4d.ID_USERDATA,19] = trak.GetName() Since you do not extend that string, it can only show one name. best wishes, Sebastian
  • 0 Votes
    3 Posts
    860 Views
    B
    HI @r_gigante Thanks for the response. With regard to 2CV-only Bezier curve: Yes, I only need 2 CV maximum. I understand that it will not interpolate complicated shapes properly but as you can see in my example, it's only a simple shape. Looking at it now. I have a feeling I am biting more than I can chew. I'm not sure I can solve it at the moment given my current knowledge. Will just perform it manually at the moment. Anyhow, thanks for responding. Have a great day ahead!
  • 0 Votes
    7 Posts
    2k Views
    M
    Please consider to sets the topic as solved if it's the case. Cheers, Maxime. EDIT: I've done it, but feel free to set it back to Open if you feel the need to ask more questions.
  • access sound attributes using python API

    Cinema 4D SDK r20 python
    7
    0 Votes
    7 Posts
    2k Views
    M
    Hey @mrittman, i cant find the id names in documentation but i think CID_SOUND_START would be the timecode of when the audio starts (notice you are assigning a BaseTime object to it) CID_SOUND_NAME which i'm using is the audio file path. My application is taking the audio file path and the image sequence output (as defined by the render output settings) and combining them via a subprocess using ffmpeg. If there was a way i could do it straight through c4d id prefer that! Mainly cos ffmpeg is a mission! especially when you need to shift/delay audio and what not.
  • Define your own icons for mouse cursor

    Cinema 4D SDK r20 python
    5
    0 Votes
    5 Posts
    969 Views
    P
    Ok, something to think about and to consider.
  • Frame selected objects correctly in camera

    Cinema 4D SDK python r19
    13
    0 Votes
    13 Posts
    3k Views
    r_giganteR
    Thanks a lot @AndreAnjos for sharing the code. I'll try to have a look at it and maybe contribute if/where needed. For the time being I'm glad to hear that you were able to tackle with it. Cheers, Riccardo
  • 0 Votes
    6 Posts
    2k Views
    P
    Yes it is! Thank you very much!
  • Python Tag Priority Problem

    Cinema 4D SDK r20 python
    7
    0 Votes
    7 Posts
    1k Views
    B
    Works as expected. Thank you @m_adam for getting back to me. Have a great day ahead!
  • DrawLine2D on top of everything else

    Cinema 4D SDK r20 python
    6
    0 Votes
    6 Posts
    1k Views
    P
    Thanks. Pim
  • 0 Votes
    3 Posts
    798 Views
    CairynC
    @m_adam Oops. Okay, GeRayCollider works only for polygon objects, as does GetPixelInfoPolygon. The idea was to provide a new selection method for arbitrary objects by just checking all hits of a scattered PickObject within a radius, and then select the nearest hit. For that, I need to be able to hit splines and parametric objects as well. Okay, I guess I can still do that in C++ then, thanks.
  • Get Message from TreeView gui dialog

    Cinema 4D SDK python
    2
    0 Votes
    2 Posts
    694 Views
    S
    Hello, SendParentMessage() is a member function of GeUserArea. It is only relevant if you create a custom GUI element based on GeUserArea. A class based on TreeViewFunctions is used to define the behaviour of a TreeViewGUI. It is not based on GeUserArea. In TreeViewFunctions, you could inform the host GeDialog about an event by sending a custom core message using SpecialEventAdd(). The GeDialog can catch this message with CoreMessage(). If you want to send data, one way is to store the data in a global variable which is then accessed by the dialog. best wishes, Sebastian