• 0 Votes
    4 Posts
    993 Views
    M
    thank you for your help, I am trying to understand ... am I right in the assumption that this is not "clean code" in a pythonic sense ? kind regards
  • ToolData::GetDDescription() redundant call, why?

    c++ r23
    4
    0 Votes
    4 Posts
    951 Views
    WTools3DW
    Thank you guys for quick reply. But I was probably not clear enough with the question. I do understated the concept of setting panel description via GetDDescription() callback. I already did the checks for whether it is request for full description of just single id. As it is listed in the example below (it is member function of C4dControls class from previous snippet void C4dControls::AddIntChoice(int id, int gid, const String& name, const BaseContainer& items) { const DescID cid = DescLevel(id, DTYPE_LONG, 0); //--------------------------------------------------------------------- if (ex_descr && (!ex_singleid || cid.IsPartOf(*ex_singleid, nullptr)) ) { BaseContainer bc = GetCustomDataTypeDefault(DTYPE_LONG); //--------------------------------------------- bc.SetInt32 (DESC_CUSTOMGUI, ID_QUICKTABSRADIO_GADGET); bc.SetString(DESC_NAME, name); bc.SetInt32 (DESC_SCALEH, 1); // animate OFF bc.SetInt32 (DESC_ANIMATE, DESC_ANIMATE_OFF); //--------------------------------------------- bc.SetContainer(DESC_CYCLE, items); //--------------------------------------------- ex_descr->SetParameter(cid, bc, DescLevel(gid)); } } But it is still calling to rewrite each control description several times after any event in GUI. What confuses me the most, is that each series of calls is with the different pointer to description (Description* description) For example there are five different pointers to description when ToolData::GetDDescription() is executed for the same event. (after mouse click into attribute manager) Is this the way how it really works? There are more versions of description for the same panel, and all of them have to be initialized repeatedly after each event? Thanks! Viktor
  • DrawPolygonObject at specific z-offset

    r23 c++
    5
    0 Votes
    5 Posts
    947 Views
    ferdinandF
    Hi @C4DS, I am not sure that I can follow on what you are exactly doing. But my assumption is that you have x objects in a scene, want to block out all these objects with some kind of background texture and then draw one of these objects on top of that background texture, right? This is unfortunately not possible in my understanding. What you could do, is fill the viewport with a background texture by putting it behind an object by manually doing the trigonometry/transforms necessary for a given cemara. Not fun to do, because you have all these ifs and whens of camera parameters, but doable. This however would only give you a custom background and block out everything behind it, but not what is between the camera, the object and the background. Which is probably not what you are after if I understand you correctly. Cheers, Ferdinand
  • GroupBorderNoTitle change GUI or flags after user input

    4
    0 Votes
    4 Posts
    794 Views
    ferdinandF
    Hi @mogh, thank you for reaching out to us and thank you @mp5gosu for providing help. I think the most meaningful thing I can say is that GeDialog is pretty forgiving and not as strict as the sum of its methods might imply; at least that was my insight to be gained when I encountered the class first. Since you said you consider this to be still rough, here are some tips that might be helpful. All following method references are members of GeDialog. You can define and load file based resources for dialogs, just like it is implicitly done with descriptions, with LoadDialogResource. This helps to clean up GeDialog implementations from the inherent clutter that comes with complex interface definitions. You can also do this to some extent in a modular fashion, i.e., invoking LoadDialogResource multiple times will not replace the former content but instead append new content. CreateLayout is mostly a convenience method. Or in other words, there is nothing which does prevent you from modifying the resource of a dialog from anywhere else where you have access to the dialog instance (be careful with threading though). Resources are organized in groups and you can flush these groups with LayoutFlushGroup, for example to rebuild them on user interaction. Single arbitrary elements can be removed by invoking RemoveElement. The relevant methods are all grouped under Dialog Change Methods in the GeDialog documentation. If anything remains unclear, please do not hesitate to ask. Cheers, Ferdinand
  • Gets the point weight of the Field object.

    2
    0 Votes
    2 Posts
    563 Views
    ferdinandF
    Hi @x_nerve, thank you for reaching out to us. The most straightforward way to sample a FieldObject is FieldObject.Sample; there are also other sample methods attached to the various fields related classes, most notably c4d.FieldList. We have two examples in the Python SDK examples which showcase field sampling, fieldlist_sampling_r20 and fieldobject_sampling_20. You also mention "Is there a way to get the weight of the cube field points?"; you are probably aware of this, but since your phrasing could imply otherwise, it seems noteworthy to point out that fields are not discrete. So in other words, there is no finite amount of points you can exhaustively sample for a field object, since the object is non-discrete. You have to pick a point or a set of points you want to sample for a field object, which can be any point in in the value range c4d.Vector can handle. If there are any questions left, please do not hesitate to ask. Cheers, Ferdinand
  • Thinking Particles- How to Set "Settings"

    r23 python
    5
    0 Votes
    5 Posts
    830 Views
    I
    Okay, thank you again.
  • Is there a Resource Editor for Version 23

    r23
    5
    0 Votes
    5 Posts
    1k Views
    ThomasBT
    Thanks a lot, this also works for Python Plugins or? Thanks man...
  • Global variable for Preferences Folder?

    r21 python
    7
    0 Votes
    7 Posts
    624 Views
    ferdinandF
    Hi @bentraje, hi @C4DS, you seem to have solved your problem yourself, so there is not much for me to add here apart from offering alternative solutions. One slightly dodgy way to get the preferences path is to use the path which is stored under c4d.PREF_MEMORY_PVHARDFOLDER in the world container of Cinema (it is the Memory>Cache Path attribute). A more elegant way is to use maxon.Application.GetUrl() which does properly handle the different paths under which the preferences can be stored (see example at the end of my posting for details). Cheers, Ferdinand """On how to iterate over the different preferences paths with the maxon API. """ import maxon def main(): """Entry point. """ for urlType in (maxon.APPLICATION_URLTYPE.GLOBALPREFS_DIR, maxon.APPLICATION_URLTYPE.PREFS_DIR, maxon.APPLICATION_URLTYPE.PREFS_DIR_STATIC): print (f"{urlType}:{maxon.Application.GetUrl(urlType)}") if __name__=='__main__': main()
  • Request: Combobox Icons

    9
    0 Votes
    9 Posts
    1k Views
    ferdinandF
    Hi @blastframe, the Python documentation will be updated in this regard with the release of R24. If you do not have any questions left related to the initial topic we would ask you to mark this topic as solved. Cheers, Ferdinand
  • NodeData: How to get connected GeListNode

    python r20
    3
    0 Votes
    3 Posts
    444 Views
    M
    Thought so. No, there's nothing missing in inherited methods. Thought, it'd be convenient. However, storing it to a member variable on init or forwarding does the trick.
  • Editor and viewport colours - where/how to find them?

    c++ sdk
    3
    0 Votes
    3 Posts
    347 Views
    WickedPW
    Thanks @C4DS, that's what I'm after! WP.
  • This topic is deleted!

    1
    0 Votes
    1 Posts
    2 Views
    No one has replied
  • PYTHON - FIND ANY ID PORT

    python r21 sdk
    7
    0 Votes
    7 Posts
    1k Views
    ferdinandF
    Hi @Hugo-BATTISTELLA , without further questions or feedback, we will consider this thread as solved by Monday and flag it accordingly. Cheers, Ferdinand
  • Sizing Plugin Dialogs

    python s22 sdk
    9
    1
    1 Votes
    9 Posts
    1k Views
    ferdinandF
    Hi @blastframe, without further questions or feedback, by Monday we will consider this thread as solved and flag it accordingly. Cheers, Ferdinand
  • Python Tag Plugin Doesn't Work Properly With Resource Files

    python r23 c++
    6
    1
    0 Votes
    6 Posts
    1k Views
    beatgramB
    @m_magalhaes Anyway thanks for the support, Manuel! I love this great community.
  • BaseContainer containers

    c++ sdk
    3
    0 Votes
    3 Posts
    365 Views
    ManuelM
    Hi, you have two function to retrieve the BaseContainer from an object and a container inside a BaseContainer. You can either retrieve a pointer or a reference. All function retrieve a pointer to the data and the references are just returning a dereference's pointer. To retrieve the data from the object you have GetDataInstance and GetDataInstanceRef and to retrieve a BaseContainer inside another one you have GetContainer and GetContainerInstance. Neither of them return a copy. About the issue, there's no issue as long as the object exist in memory. Depending of the context (specially if you are using threads) this can be more or less safe. Cheers, Manuel
  • Turn Bezier spline to linear spline

    8
    0 Votes
    8 Posts
    2k Views
    Y
    @ferdinand Oh, thanks! Quite a nice idea!
  • 0 Votes
    3 Posts
    806 Views
    ferdinandF
    Hi @alfredogzz, welcome to the Plugin Cafe forum and the Cinema 4D development community! Please have a look at our Forum Guidelines as we have to ask all users to flag their questions with tags. I have added a Python tag (assuming that is the programming environment you are after) to your posting for you, but you have still to add an OS and Cinema 4D version tag yourself. Please also note that providing full solutions is outside of the scope of support (see Forum Guidelines), so it would be best if you could post whatever code you already have. About your problem, let's assume you have an object Obj which has has the "incorrect" c4d.Matrix, i.e., transform, M_old and you want to move that transform to the known transform M_new. Let's also assume that all our transforms are in global space. What you basically have to do is: Compute a difference matrix M_dif for M_old and M_new. One way to do it, is to multiply M_new by the inverse of M_old, i.e., "untransform" M_new by the amount of M_old. Multiply all vertices of Obj by the inverse of M_dif. Set the global matrix of O to M_new. Here are some other postings, topics and examples (the first one contains code for pretty much what you want to do) that might be helpful for you regarding this topic: "Move" the transform of a point object Setting coordinates for selected faces (Python - Beginner) Mirroring with Matching or Different Axes If you import your geometry from Rhino, you might also have to deal with baked normals, i.e., normal tags. Please take a look at this thread for that scenario. It also noteworthy that Rhino's coordinate system is right-handed with Z being up, while Cinema 4D's system is left-handed with Y being up. Handedness of coordinate systems has been discussed in Mirroring with Matching or Different Axes for example. Cheers, Ferdinand
  • 0 Votes
    5 Posts
    863 Views
    ManuelM
    hi, thanks @mp5gosu for the answer. About inserting material before making some changes, there's no real right way of doing it. It just that if something go wrong about the change you are doing, you have to remove the material from the document, while if you don't insert it, you don't have to. As @mp5gosu said it's better to insert the object in the document before linking them. Even if should work if you insert the material after. Cheers, Manuel
  • Errors when recompiling R20 plugin to R21

    6
    0 Votes
    6 Posts
    1k Views
    r_giganteR
    hi @Boony2000 , these are Visual Studio Intellisense errors which you can safely ignore. If they bother you switch the filter from "Build + Intellisense" to "Build". Cheers, R