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
    • Recent
    • Tags
    • Users
    • Login

    Rotate all Groups

    Scheduled Pinned Locked Moved SDK Help
    8 Posts 0 Posters 674 Views
    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 Offline
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 17/02/2010 at 03:11, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   11.028 
      Platform:   Windows  ;   
      Language(s) :

      ---------
      Ok, my first post! 😊

      I got a problem by exporting all my models into an other 3D application (DeltaGen from RTT).
      I use the FBX exporter and I need to have turned all models 90° (P). DeltaGen uses Z-up not Y-up!
      This opperation is just one step of a bigger process before exporting.
      I want my 40 user not to do everytime the same steps.

      So this little script I worked hardly out works only on one selected group.
      But if you select more then one group ... nothing happend.

      Could someone tell me what to write in my script for rotating all models P=90°?

      main(doc,op)
      {
       /* Reset object rotation */
       var rotation = vector(0,1.5708,0);
       op->SetRotation(rotation);
      }

      Many thanks

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 17/02/2010 at 06:49, xxxxxxxx wrote:

        You need to iterate thru all selected objects
        by searching for the selection bit.

        Look at this and you should be on your way:)

          
        var op = doc->GetFirstObject();   
        if(!op) return;   
          
        while(op)   
        {   
           if(op->GetBit(BIT_AOBJ))   
           op->SetRotation(vector(0,PI/2,0));   
          
           op = op->SearchNext(BIT_AOBJ);   
          
        }   
        

        Cheers
        Lennart

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

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 17/02/2010 at 07:22, xxxxxxxx wrote:

          Thanks a lot Lennart

          You r the man! 😄

          But now there is one small thing left.
          When I take the command "select all" from the object manager, it also selects all children.
          I do not know how to tell the program only to take the major group of every tree in the scene.

          Could you help me with this command to?

          Many many thanks, you help me to save a lot of time.

          Greets  Andy

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

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 17/02/2010 at 07:29, xxxxxxxx wrote:

            Originally posted by xxxxxxxx

            I do not know how to tell the program only to take the major group of every tree in the scene.

            You have to iterate through your scene, something like this:

              
            main(doc,op)  
            {  
              var obj = doc->GetFirstObject();  
              
              for (; obj; obj = obj->GetNext())  
              {  
                  //do something with obj,  it's the topmost parent of each group  
              }  
            }  
            

            cheers,
            Matthias

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

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 17/02/2010 at 07:52, xxxxxxxx wrote:

              Ok, Matthias

              I do think I m not quiet good in programming, so I tried it out and had no result.
              So I took the rotate script and made a callcommand out of this input.
              Then combined some commands (select all->group all-> rotate -> ungroup->delete empty Group)
              this works! It is not nicely solfed, this problem, but solved in a way!

              So could you finally help me to make a plugin out of this command jungle so I can share it to our users? Will such a plugin work where I used  a callcommand which came out of a script?

              I never created a plugin my self. But I already reached to get a Plugin ID! 👍
              Thanks a lot for your help!

              Regards Andy

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

                THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                On 19/02/2010 at 03:50, xxxxxxxx wrote:

                Ok , I got a result that works!

                Look at this:

                {
                  var obj = doc->GetFirstObject();

                for (; obj; obj = obj->GetNext())
                  {
                      // if(obj->GetBit(BIT_AOBJ))
                       obj->SetRotation(vector(0,PI/2,0));
                  }
                }

                So could you tell me how to make a plugin out of it?
                So i can share this to my users?

                Thanks again

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

                  THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                  On 19/02/2010 at 05:27, xxxxxxxx wrote:

                  Scripts are just like MenuPlugins. Please check the COFFEE docu for MenuPlugin.

                  To convert your script you just put the script code into the menu plugins Execute() method and return the unique plugin ID in the GetID() method.

                  Something like this:

                    
                  class YourMenuPlugin : MenuPlugin  
                  {  
                    public:  
                        YourMenuPlugin();  
                          
                        GetID();  
                          
                        GetName();  
                        GetHelp();  
                          
                        Execute(doc);  
                  }  
                    
                  YourMenuPlugin::YourMenuPlugin()   
                  {  
                    // Call the parent constructor  
                    super();  
                      
                    // TODO: Initialize any local variables etc.  
                  }  
                    
                  YourMenuPlugin::GetID()   
                  {  
                    return YOURPLUGINID;  
                  }  
                    
                  YourMenuPlugin::GetName()  
                  {  
                    // TODO: Return the text of the menu entry  
                    return "Your plugin's name";  
                  }  
                    
                  YourMenuPlugin::GetHelp()  
                  {  
                    // TODO: Return a help text that's displayed when the menu item is selected  
                    return "Some help text";  
                  }  
                    
                  YourMenuPlugin::Execute(doc)  
                  {  
                    // Called when the menu item is chosen  
                      
                    var obj = doc->GetFirstObject();  
                      
                    for (; obj; obj = obj->GetNext())  
                    {  
                        // if(obj->GetBit(BIT_AOBJ))  
                        obj->SetRotation(vector(0,pi05,0));  
                    }  
                  }  
                    
                    
                  /////////  
                  // Main  
                    
                  main()  
                  {  
                    Register(YourMenuPlugin);  
                  }  
                  

                  cheers,
                  Matthias

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

                    THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                    On 23/02/2010 at 00:35, xxxxxxxx wrote:

                    Some corrections to the plugin (missing refresh). Also it has now an icon and is undoable.

                      
                    var icon;  
                      
                    class YourMenuPlugin : MenuPlugin  
                    {  
                      public:  
                          YourMenuPlugin();  
                            
                          GetID();  
                          GetName();  
                          GetHelp();  
                          GetIcon();  
                            
                          Execute(doc);  
                    }  
                      
                    YourMenuPlugin::YourMenuPlugin()   
                    {  
                      // Call the parent constructor  
                      super();  
                        
                      // TODO: Initialize any local variables etc.  
                    }  
                      
                    YourMenuPlugin::GetID()   
                    {  
                      return YOURPLUGINID;  
                    }  
                      
                    YourMenuPlugin::GetName()  
                    {  
                      // TODO: Return the text of the menu entry  
                      return "Your plugin's name";  
                    }  
                      
                    YourMenuPlugin::GetHelp()  
                    {  
                      // TODO: Return a help text that's displayed when the menu item is selected  
                      return "Some help text";  
                    }  
                      
                    YourMenuPlugin::GetIcon()  
                    {  
                      // return the icon's bitmap;  
                      return icon;  
                    }  
                      
                    YourMenuPlugin::Execute(doc)  
                    {  
                      // Called when the menu item is chosen  
                        
                      var obj = doc->GetFirstObject();  
                        
                      doc->StartUndo();    //start collecting undo steps  
                        
                      for (; obj; obj = obj->GetNext())  
                      {  
                          doc->AddUndo(UNDO_OBJECT_BASEDATA, obj);    //add an undo  
                          obj->SetRotation(vector(0,pi05,0));  
                          obj->Message(MSG_UPDATE);  
                      }  
                        
                      doc->EndUndo();    //end undo collection  
                        
                      EventAdd();  
                    }  
                      
                      
                    /////////  
                    // Main  
                      
                    main()  
                    {  
                      icon = new(BaseBitmap,1,1);  
                      var fn = GeGetRootFilename();  
                      fn->RemoveLast();  
                      fn->AddLast("res");  
                      fn->AddLast("icon.tif");  
                      icon->Load(fn);  
                        
                      Register(YourMenuPlugin);  
                    }  
                    

                    cheers,
                    Matthias

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