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

    how to set the camera name?

    Scheduled Pinned Locked Moved SDK Help
    1 Posts 0 Posters 148 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 30/07/2007 at 04:31, xxxxxxxx wrote:

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

      ---------
      when I adding a new camera after, I want to rename it; but I change the name using camobj->SetName("mycam");  c4d system  break and exit arose error. when without is the working fine. someone can help me ;this my code:
      bool DoAddCamera()
      {
      BaseDocument* doc = GetActiveDocument();
       if (!doc) return false;
      BaseObject* null = doc->GetActiveObject();
       
          if (!null)
       {
        null = doc->GetFirstObject();
         if (!null)
         {
         return false;
         }
       }
      CameraObject* cam = (CameraObject* )BaseObject::Alloc(Ocamera);
       if ( !cam )
       {
        MessageDialog("CameraObject Create Fail!");
        return false;
       }
       
      doc->InsertObject(cam, NULL, NULL);
        
         DrawViews(DA_FORCEFULLREDRAW);
      Vector objvcr = null->GetMg().off;
       Vector camvcr;
       camvcr.x = objvcr.x - 500;
       camvcr.y = objvcr.y + 500;
       camvcr.z = objvcr.z - 500;
          cam->SetPos( camvcr );
       cam->SetRot(Vector(-0.8, -0.6, 0)); // Set rotation (radians, HPB)

      cam->SetZoom( 1.0 );
       cam->SetAperture( 36.0 );
       cam->SetFocus( 36.0 );
       
      EventAdd();
       
      BaseObject* oldcam = doc->GetRenderBaseDraw()->GetSceneCamera(doc);
       doc->GetRenderBaseDraw()->SetSceneCamera(cam);
      Bool bFindResult = TRUE;
       LONG Id_Cam = 1;
       while ( bFindResult )
       {
        String camname("TSPCam"+ LongToString(Id_Cam));
        BaseObject* camobj = doc->SearchObject( camname );
        if ( !camobj )
        {
         bFindResult = FALSE;
         cam->SetName(camname);
         }
        else
        {
         ++Id_Cam;
        }
        DrawViews(DA_FORCEFULLREDRAW);
        EventAdd();
      }

      }

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