• Merging external files into plugins

    python
    4
    0 Votes
    4 Posts
    788 Views
    M
    Hi Merkvilson, the best way would be in the NodeData.Init method to load the scene with LoadDocument(). This will give you a BaseDocument. Then you can retrieve the LineObject or whatever you need from this document. Then get a Clone of these things and draw it inside your Draw method. Just in case, if you would have to return everything in the GetVirtualObject methods, you would need to insert everything under a null and return this null. And to manually handles/tracks material (this part can become very tedious) If you have any questions, please let me know. Cheers, Maxime.
  • This topic is deleted!

    1
    0 Votes
    1 Posts
    3 Views
    No one has replied
  • Spline shape for BaseDraw Handles

    python
    6
    0 Votes
    6 Posts
    1k Views
    M
    The best way would be to store directly the LineObject in a member variable of your ObjectData class. The alternative way to retrieves a LineObject (which is never visible in the ObjectManager) is to call GetCache() from a Spline Object. But a Spline Object can have multiple LineObject and a SplineObject (like any other objects) does not guarantee that a cache is available at any time. So if there is no cache, the best way would have been to clone the SplineObject to a Temporary document, call ExecutePass from this document in order to build the cache. Then retrieves the cached LineObject. But I think SplineHelp, is the best option you have which works in all case, easy to setup/use, is there any drawback to it? Cheers, Maxime.
  • BaseDocument.StartPickSession() Documentation

    python
    2
    0 Votes
    2 Posts
    625 Views
    M
    Hi, Donovan thanks for reaching us. The mystery variable is actually an int flag to retrieve if the user cancels the PickSession or not. def OnPick(flags, active, multi): if flags & c4d.PICKSESSION_FLAG_CANCELED: print "User cancel" print "active: ", active print "multi: ", multi def main(): doc.StartPickSession(OnPick, multi=True) No there is no way. Actually nothing, it's up to you to detect when the user cancels with PICKSESSION_FLAG_CANCELED and do whatever you want. Cinema 4D handle automatically undo. But you can call BaseDocument.GetSelection before and BaseDocument.SetSelection after if the user cancels the pick session) Finally, note the C++ version offer to adds userdata ( For more information please read the C++ documentation https://developers.maxon.net/docs/cpp/2023_2/struct_pick_session_data_struct.html) If you have any question, please let me know. Cheers, Maxime.
  • Using c4dpy to show Class Documentation?

    3
    2
    0 Votes
    3 Posts
    924 Views
    dskeithD
    Hi Maxime - thank you very much for the response, and I'm glad to hear you're considering it for the future.
  • Python missing ObjectColorProperties?

    r19 r20 python
    3
    0 Votes
    3 Posts
    721 Views
    C4DSC
    @cairyn You are right. I thought having to go over the BaseContainer obtained from the object via GetData(), but didn't see anything in its content related to the displaycolor ... didn't think of just accessing the object's properties directly. I am not that confident with the Python SDK. Thanks for the piece of code.
  • Lots of "unresolved external symbol" errors

    c++ windows r20
    9
    0 Votes
    9 Posts
    2k Views
    a_blockA
    Hi, we are glad @rui_mac you were able to solve your problem. I'd just like to quickly recap to make this also clear for future readers. Visual Studio has two "concepts" two organize your development work. Projects, which is basically a set of files plus a bunch of configuration options and instructions for the tool chain (compiler, linker,...) to build a binary (in our case here always a plugin library). Solutions, which are collections of above projects plus some additional global configuration data and more important, information on dependencies of the contained projects. Now, our project tool can and does create both projects (for your plugins and for our frameworks) and a solution containing all of the above (actual workflow described in our docs under the links provided by Riccardo earlier on in this thread). So when you open such a solution and build your plugin project, also the frameworks it's depending on should be built.So, this is the way to go (project tool -> solution and projects -> open solution in Visual Studio). But if you instead open just one of the generated projects directly, Visual Studio will implicitly generate a solution for you, but it still lacks the framework projects and the build of the opened project will fail (error: unresolved symbols, i.e. function or class names normally provided by our frameworks and used in the plugins code can not be resolved). I hope this makes it a bit easier to understand. Cheers, Andreas
  • GetClone() with Fields

    r20 python windows
    4
    3
    0 Votes
    4 Posts
    1k Views
    GianniG
    Just tried now… It seems to work perfectly! Thank you! I don't want to boring you, but, please, don't disable this super feature in python. Instead you could update the documentation specifying well how to use it.
  • To grow selection in UVPolygon mode

    2
    3
    0 Votes
    2 Posts
    900 Views
    M
    Hi Kisaf, I'm afraid this is not possible from SendModelingCommand to send command in UV mode. So it's up to you to remove the extra selected stuff or build your own grow algorithm. A good way to achieves that could be to: Detects uv island and give them an ID. Store uv island ID used with the current selection. Grow the selection in polygon mode Deselect all polygons if they are not in the uv island. But this not work in all cases (e.g. topology of the object is disconnected but uv are connected). Cheers, Maxime.
  • R20 equivalent of GeSignal

    r20 sdk c++
    7
    0 Votes
    7 Posts
    2k Views
    P
    Hello. The problem was that I didn't add the definitions. iferr_scope; signal = maxon::ConditionVariableRef::Create() iferr_return; Thank you for your time and sorry for that
  • Migrating from the Classic API

    3
    0 Votes
    3 Posts
    731 Views
    C4DSC
    Thanks Riccardo, It all (well, some of it) starts to make sense after your explanation. A big step forward in starting to understand how to proceed with the MAXON API.
  • Save variables during current session (until C4D is closed)

    7
    0 Votes
    7 Posts
    2k Views
    K
    Thank you very much guys! I think that plugin will be better solution then script in this case. Cheers
  • This topic is deleted!

    1
    0 Votes
    1 Posts
    4 Views
    No one has replied
  • 0 Votes
    3 Posts
    809 Views
    P
    Ok this was defently my fault. It works now. I was using GetVirtualObjects instead of GetContour.
  • Tag GetInfo() help

    4
    0 Votes
    4 Posts
    956 Views
    N
    @m_adam Great info. Thanks Maxime!
  • Python Autocomplete in Script Manger

    python r20
    4
    0 Votes
    4 Posts
    1k Views
    mikeudinM
    @ipython "c4dpy.exe/app is an executable that runs Cinema 4D in Python command-line mode. It is not only an interpreter, it brings extra features for daily Python development with external code editors/IDEs: auto-completion and debugging."
  • 0 Votes
    2 Posts
    582 Views
    r_giganteR
    Hi Pyr, thanks for reaching us. With regard to the issue you reported, it looks like there's something unexpected happening that instead of returning the computed cache, regenerate and returns a new cache. Although it might occur that switching between documents require the generator to recreate the cache, switching between view definitively it's not supposed to happen. Considering that your information doesn't actually help too much in understanding how you're evaluating cache dirtiness nor what changes are you're checking in the vertexmap, could please post fragments of the code or, alternatively, try to reuse your cache dirtiness mechanism on an "simpler" plugin to see if it works reliably? Looking forward further comments, give best. Riccardo
  • Tag not in sync

    r20 python
    5
    0 Votes
    5 Posts
    2k Views
    r_giganteR
    Hi Rage, thanks for reaching us. With regard to the issue mentioned and considering your non-Cinema background, first of all lets settle down a few concepts: UVWTags are just acting as "storage" for the UVW data used on polygonal objects; TextureTags are instead used to create the actual texturing on the on a generic object (whatever it's a polygonal or parametric one) A parametric object can use a texture even without explicit an UVWTag since the TextureTag delivers all the information with regard on how to map a texture to the object. When a parametric object (e.g. cube) is converted into a polygonal one the UVW values which are part of the parametric object gets dumped in the UVWTag that is generated as soon as the conversion ends. That said give a certain object (a polygonal one) the way to go is: def main(): # check that an object is selected if op is None: return # get the active material activeMat = doc.GetActiveMaterial() if activeMat is None: return # instantiate a TextureTag sph50NoTileTextureTag = c4d.TextureTag() if sph50NoTileTextureTag is None: return # set the mapping type sph50NoTileTextureTag[c4d.TEXTURETAG_PROJECTION] = c4d.TEXTURETAG_PROJECTION_SPHERICAL # turn off tiling sph50NoTileTextureTag[c4d.TEXTURETAG_TILE] = False # scale the mapping to 50% on u and v sph50NoTileTextureTag[c4d.TEXTURETAG_LENGTHX] = 0.5 sph50NoTileTextureTag[c4d.TEXTURETAG_LENGTHY] = 0.5 # link to the active material sph50NoTileTextureTag[c4d.TEXTURETAG_MATERIAL] = activeMat # generate the corresponding UVWTag using the mapping settings specific in the TextureTag sph50NoTileUVWTag = c4d.utils.GenerateUVW(op, op.GetMg(), sph50NoTileTextureTag, op.GetMg()) # check for UVWtag being properly created if sph50NoTileUVWTag is None: return # set the name of the tag sph50NoTileUVWTag.SetName('0.5 non-tiled spherical') # add both the UVWTag and the TextureTag if op.GetTag(c4d.Tuvw) is None: op.InsertTag(sph50NoTileUVWTag) if op.GetTag(c4d.Ttexture) is None: op.InsertTag(sph50NoTileTextureTag) # notify Cinema about the changes c4d.EventAdd() Best, Riccardo
  • Catch InputDialog Cancel?

    3
    0 Votes
    3 Posts
    759 Views
    M
    Hi Donovan, unfortunately, there is no change in this regards. The best way is still to check for an empty return value or either creates your own dialog. I've filled a feature request. Cheers, Maxime.
  • FormatStatement and maxon DataTypes...

    r20 c++ windows
    5
    0 Votes
    5 Posts
    1k Views
    M
    Ah, thank you. I didn't take a look at vec.h. Meanwhile, I already wrote a conversion unit to handle all sorts of formatting. Thought, it was possible to modify the intern string conversions somehow. But nevermind, all works pretty well. Cheers, Robert