Locking an axis while rotating



  • On 01/05/2014 at 14:03, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R15 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    You can lock an axis when moving objects.
    I would like to do something similar for moving and rotating polygons.

    Will it be difficult to create a plugin to do so?
    So, rotate or move polygons while an axis is locked?

    I have a simple plugin that can do that using additional user actions, but not real-time / not dynamically. See below picture for my current approach and blog.grooff.eu for this free plugin.

    What I do is store the point values, then rotate and then re-store the locked axis coordinates.
    But real time, that seems hard to do.
    Any thoughts how to approach this?



  • On 01/05/2014 at 17:54, xxxxxxxx wrote:

    Not sure how it works with your particular plugin setup, but with ObjectData you can override the Message() function and listen for MSG_DESCRIPTION_VALIDATE which lets you alter or block any user interactions ( for example if they type in or drag something out of range ) before building caches etc.  Might be worth looking in to..  Looks something like this:

    Bool MyPlugin::Message(GeListNode* node, LONG type, void* data)
    {
    	if (type==MSG_DESCRIPTION_VALIDATE)
    	{
    			
    		myValidateSettingsFunction(node);
      
    	}
    }
    

    So perhaps you could constantly force only single-axis transforms by throwing away the rest of the rotation matrix each time it is called..



  • On 02/05/2014 at 06:21, xxxxxxxx wrote:

    Good tip.
    But I guess it is not so much as rotating over a single axis, but only changing the coordinates in 2 axis - thus in fact locking / not changing 1 axis.
    I'll need to know the original coordinates and keep 1 coordinate locked.
    In 2d it is easier than in 3d!

    _<_t_>_
    MSG_DESCRIPTION_VALIDATE
    |
    Allows you to update dependencies or to check for invalid values after a parameter has been changed (For example: the light's inner radius always must be smaller than the light's outer radius - so this routine checks for it and corrects it). The corresponding data is [DescriptionValidate](file:///D:/Users/pgrooff/Documents/pim/c4d/c++%20R15%20sdk/help/pages/c4d_baselist/struct_DescriptionVa472.html).
    <_<_t_>_

    But I will start with your suggestion and investigate further.



  • On 02/05/2014 at 06:30, xxxxxxxx wrote:

    Just thinking out loud.

    What about the messages:
    _<__<_t_>_
    MSG_TRANSLATE_POINTS
    |
    Sent by the modeling core to let tags etc. update after point changes. The corresponding data is [TranslationMaps](file:///D:/Users/pgrooff/Documents/pim/c4d/c++%20R15%20sdk/help/pages/lib_modeling/class_TranslationMap1592.html).

    ---|---

    MSG_TRANSLATE_POLYGONS
    |
    Sent by the modeling core to let tags etc. update after polygon changes. The corresponding data is [TranslationMaps](file:///D:/Users/pgrooff/Documents/pim/c4d/c++%20R15%20sdk/help/pages/lib_modeling/class_TranslationMap1592.html)._d>

    But then again, these message are sent to my plugin, meaning that the polygons that are rotated are created with this plugin.
    Or can I select the object with the polygons to be rotated and wait for the messages?



  • On 02/05/2014 at 12:35, xxxxxxxx wrote:

    Yeah i just had a look at the docs for those..  I`m guessing they are pretty much called after the modelling operation and the users view has already been updated with the change.  I thought for a second that MSG_PRETRANSLATE_POLYGONS might have been the answer - but i think that only stores the object/polygon/point/edge state before the actual modelling operation has been commited..

    Might be worth looking at whether MSG_DESCRIPTION_VALIDATE is called at all when modelling ( as opposed to just parameter changes that can be intercepted).

    The only other potential candidate i could see was MSG_DESCRIPTION_USERINTERACTION_END but i`m guessing any transforms will have been performed by c4d by that time..

    Let us know how you progress with it!  Hopefully someone with more experience will come up with an idea..



  • On 03/05/2014 at 13:48, xxxxxxxx wrote:

    I think you'll need to use matrices to do live interactive polygon rotations.
    I've tried to do it. But I keep running into scaling problems.😠

    We really should have functions to access the rotation matrix of selected polygons and points in the SDK like Maya does.
    In Maya, you just type in the rotation values for a polygon/s using MEL. And you're done.
    They don't force you to write the matrix stuff yourself.

    I wish we had this in C4D.
    Or at least an example of how to construct it ourselves.

    -ScottA


Log in to reply