Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Register
    • Login
    1. Home
    2. neon
    3. Posts
    N
    • Profile
    • Following 0
    • Followers 0
    • Topics 12
    • Posts 30
    • Best 0
    • Controversial 0
    • Groups 0

    Posts made by neon

    • RE: Thinking Particles in ParallelFor

      Hello @ferdinand,
      thank you again for this very detailed and helpful reply!

      I tried both methods, allocating beforehand and like the previous setup, just have it after the ParallelFor altogether.
      Both worked, although allocating beforehand introduced some weird flickering in the particles and was (at least it feels that way) more unstable.
      Which is why I opted to go for the second solution as with some exstensive testing it didn't seem to cause any issues.
      For anyone maybe reading this in the future and having the same issues:
      Do not allocate the particle group inside the plugin but use a link field and have the user handle the particle group creation inside c4d, that solved a lot of weird behaviours and seemed to work better/more stable. (at least in my not so intended usecase)

      I will mark this thread as solved, as it works now and I can fix the main-thread issue as well without too much trouble.

      So thank you very much for your quick and very detailed replies!
      Best Regards,
      Florian

      posted in Cinema 4D SDK
      N
      neon
    • RE: Thinking Particles in ParallelFor

      Hello @ferdinand,
      thank you for you reply!
      I am sorry, I should have been more specific.

      • I am currently doing everything in ObjectData::ModifyObject() and was (am) using TP_MasterSystem::AllocParticle().
      • The (maximum) number of particles I would allocate is always bound by the point count of the object I am modifying.

      The simplyfied version of my ParallelFor routine in ModifyObject is like this:

      	Matrix m;
      	m = (~mod_mg) * op_mg;
      	auto worker = [.../*There would normally be more here*/](maxon::Int i)
      		{
      			Vector  p;
      			
      			//holds information about the sampled result
      			sample_t result;
      			
      			p = m * m_padr[i];
      			
      			//these calculations are expensive, thats why the parallel for in the first place
      			result = sampler->doSomeCalculations(p.x, p.z);
      
      			p += result.deformVector;
      
      			m_padr[i] = ~m * p;
      			}
      		};
      	maxon::ParallelFor::Dynamic(0, m_pcnt, worker);
      

      where this sample_t result would also hold information (for that point) if it should spawn a particle for it, its lifetime/velocity etc. are derived from that as well.
      And currently right after this ParallelFor I have this (also simplified):

             Vector  p;
      	Float32 particleValue;
      	for (int i = 0; i < m_pcnt; i++)
      	{
      
      		p = m * m_padr[i];
      		result = sampler->doSomeCalculations(p.x, p.z);
      		particleValue = 1 - result.particleValue;
      		
      		if (particleValue > 0) //should a particle even be spawned
      			if (i % m_particleReduction == 0)  //just some simple reduction for viewport speed
      			{
      				if (m_masterSystem)
      				{
      					Int32 particle = m_masterSystem->AllocParticle();
      					if (particle != NOTOK)
      					{
      						m_masterSystem->SetLife(particle, ...);
      						m_masterSystem->SetColor(particle, ...);
      						m_masterSystem->SetPosition(particle, op_mg * m_padr[i]);
      						m_masterSystem->SetVelocity(particle, ...);
      						
      						if(m_ioParticleGroup)
      							m_masterSystem->SetGroup(particle, m_ioParticleGroup);
      					}
      				}
      			}
      		}
      

      Since doing TP Allocation in ObjectData/ModifyObject is not something I should do, where else, appart from maybe Message would be a place for that? The only information for pre-allocation that I would need is the point count of the object to modify.
      Or should I scrap the idea of generating the particles on my own alltogether? The plugin itself should later on be used in a more dynamic (mesh - subdivisions etc.) context that's why I initially did not want to simply set vertex weights as that would not quite work for the use case of this plugin.
      Hope I could give more useful information on what it is I am trying to achieve.

      Thanks again for your quick and detailed reply!
      Best Regards,
      Florian

      posted in Cinema 4D SDK
      N
      neon
    • Thinking Particles in ParallelFor

      Hello PluginCafe!
      I am currently working on an Object Modifier plugin and wanted to integrate Thinking Particles alongside the deformation.
      The deformation of the points is done in a ParallelFor loop (which works fine and is needed) but even just trying to allocate a particle inside of the worker leads to access violations and a Cinema4D crash.
      However if I loop through the pcnt again outside/after the initial deformation (after the parallel for) everything works as expected.

      So my assumption is that Thinking Particles don't really like ParallelFor/multiple threads?
      Is this a general limitation of Thinking Particles or is there some threading issue that I have missed in the documents/am not aware of?

      If possible I would like to move all the TP-Allocation stuff into the parallel for as I have to (in the context of this plugin) do most calculations twice otherwise.
      The current target version I am developing this plugin for is R20 (and all versions after).

      Thanks in advance!
      -Florian

      posted in Cinema 4D SDK r20 c++ windows sdk
      N
      neon
    • RE: Camera Position/Rotation to POS/DIR/UP Vectors

      Hello Manuel,
      thanks for your input!
      I got it working correctly with the values you mentioned.
      Reading through the docs again I feel kinda dumb for not getting it right myself.
      Thanks to both you and zipit for your great help!

      Best Regards,
      Florian

      posted in Cinema 4D SDK
      N
      neon
    • RE: Camera Position/Rotation to POS/DIR/UP Vectors

      Hello zipit,
      thanks for your quick reply!

      I actually only need one direction, one up and one position vector. I am trying to parse a (generic) scene with the camera and everything from Cinema4D to another program/renderer which has a right handed coordinate system. And for the Camera I do need the up, position and direction vector.

      I will read through what you suggested tomorrow, thanks for the throughout reply!

      Best Regards,
      Florian

      posted in Cinema 4D SDK
      N
      neon
    • Camera Position/Rotation to POS/DIR/UP Vectors

      Hello PluginCafe,
      I have been stuck on the problem of converting Camera Position / Rotation
      to position, direction and up vectors for a right handed system. It is probably really easy and I am just being brain dead right now but I have been struggling for way longer than I want to admit.

      I hope somebody can help me there,
      Florian

      posted in Cinema 4D SDK r21 c++
      N
      neon
    • RE: Get CustomGUI Data in python

      Hello Sebastian,
      I now understand what the difference is, thank you very much!
      With the customdata_customgui example file I actually made both a GUI and a custom DataType. So I only needed to change my resource file and modifiy my data code a bit!

      Best Regards,
      Florian

      posted in Cinema 4D SDK
      N
      neon
    • RE: Get CustomGUI Data in python

      oh... yeah that is true.

      I edited the customdata_customgui example to fit my needs. (mainly only the drawing).
      So I guess I would have to change my customdata to a REAL customgui?

      posted in Cinema 4D SDK
      N
      neon
    • RE: Get CustomGUI Data in python

      Hello Sebastian,
      basically I have something like this

      [...]
      MY_CUSTOMGUI CUSTOMGUIPARAM { }
      [...]

      that is what I use.

      posted in Cinema 4D SDK
      N
      neon
    • RE: Get CustomGUI Data in python

      Hello Maxime,
      thanks for you answer!
      I actually have my custom gui not in a GeDialog but inside a res file of an ObjectData. How would I be able to access the customgui from there?

      Best Regards,
      Florian

      posted in Cinema 4D SDK
      N
      neon
    • RE: Dynamic VertexMap

      Hello Maxime,
      thanks for your answer!

      Its too bad that I can't do it without some hacky way, but thanks for your code snipped and example.

      I'll mark this thread as solved, so thanks!

      Best Regards,
      Florian

      posted in Cinema 4D SDK
      N
      neon
    • Get CustomGUI Data in python

      Hello plugincafe!
      I have recently created a customgui using the example customgui plugin. The only major thing that I changed, appart from drawing, is that I save a single float value.
      I now need to implement this custom gui into a python plugin but I can't seem to find out how to retrieve my saved data from the gui element.

      Do I need to completely switch to a c++ plugin to do this, or is there a way in python.

      Kind Regards,
      Florian

      posted in Cinema 4D SDK python c++ r20 sdk
      N
      neon
    • RE: Show/Hide Tabs in GUI

      Hello Sebastian,
      sorry, for not using the QA System, will do in the future!

      This was exactly what I needed. I have never changed my GUI outside the res file and it felt kinda confusing to me what exactly I have to do after reading the doc.

      Thanks for your awnser!

      Best Regards,
      Florian

      posted in Cinema 4D SDK
      N
      neon
    • RE: Dynamic VertexMap

      Hello,
      thanks m_adam and zipit for your replies.
      I am working in an ObjectData Plugin.
      I am loading a mesh into my ObjectData (in Init) and need to add modifiers/subdivision in GetVirtualObjects.
      After Zipits answer I noticed why it didn't work properly and that is that I added the tag to my ObjectData instead of the loaded mesh, the reason for that is that I would need the user to see the vertexmap but I can't expose the mesh.

      I have now changed it so the vertexmap is created on my internal mesh, and that scales just fine when subdividing, so in that regard my problem is solved.

      But I don't know if I am now able to expose the tag, and only the tag, somehow to the user.
      My Plugin uses the vertexmap internally and I want the user to be able to use it for materials etc.

      Is there any way?
      Thanks for your help so far!
      Best Regards,
      Florian

      posted in Cinema 4D SDK
      N
      neon
    • Show/Hide Tabs in GUI

      Hello PluginCafe,
      I wanted toknow whether it is possible to show/hide tabs in the GUI (like the Fields tab in the VertexMap) if the Tabs / Groups have been defined in the resource file. Or do I have to add/remove them dynamically through description handling?

      Best Regards,
      Florian

      posted in Cinema 4D SDK python
      N
      neon
    • Dynamic VertexMap

      Hello PluginCafe,

      I wanted to know whether it is possible to change the data count of a vertex map dynamically without always killing the tag and recreating it? I have a mesh that gets subdivided dynamically and I need the vertex map to always fit the mesh vertex count but I can't have the user to always re-link the vertex map on every change.

      Best Regards,
      Florian

      posted in Cinema 4D SDK python sdk r20
      N
      neon
    • RE: Detect if document is being rendered in ModifyObject

      Hey zipit,
      thanks for the answer!

      Exactly what I needed!

      Best Regards,
      Florian

      posted in Cinema 4D SDK
      N
      neon
    • Detect if document is being rendered in ModifyObject

      Hello Plugincafe,
      as the title implies I want to know wether the user is currently rendering the document => in the editor,
      or in the picture viewer. I want to change settings of my modifier accordingly. (like the supdivision surface with supdivision editor/render).
      What I have always done is check if the current document is the same as passed in ModifyObject (which works for picture viewer as the document is copied for rendering) but I don't know if this is the indended way of doing it or if there is somethihng else. In addition I want to do the same once the user renders in the editor, which my approach does not cover.
      Is ther an "easy" way to accomplish this?

      Best Regards,
      Florian

      posted in Cinema 4D SDK c++ windows macos r20 r21
      N
      neon
    • RE: Modifier parameters change uppon scaling

      Hello Sebastian,
      thanks for this quick response!
      I dind't know about this. But this solved my issue!

      Best Regards,
      Florian

      posted in Cinema 4D SDK
      N
      neon
    • Modifier parameters change uppon scaling

      Hello,
      I noticed that two of my parameters of my modifier change their values when I scale the modifier in the viewport.
      I thought that it might be the Handles, but the only ones I have are from the Falloff/Field.
      I tried changing the ids of those two parameters (both Realslider) but they do still change.
      The only time I set/get the values for the parameters are in the Init function and in the ModifyObject function.

      I am at a complete loss here. Is there anything I could check that I may be doing?

      Thanks in advance!
      Best Regards,
      Florian

      posted in Cinema 4D SDK r20 c++ windows macos
      N
      neon