Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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
    • Login

    Locking an axis while rotating

    SDK Help
    0
    6
    607
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        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..

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          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[URL-REMOVED].
          <_<_t_>_

          But I will start with your suggestion and investigate further.


          [URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

            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[URL-REMOVED].

            ---|---

            MSG_TRANSLATE_POLYGONS
            |
            Sent by the modeling core to let tags etc. update after polygon changes. The corresponding data is TranslationMaps[URL-REMOVED]._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?


            [URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.

            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

              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..

              1 Reply Last reply Reply Quote 0
              • H
                Helper
                last edited by

                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

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post