Skip to content
0
  • Recent
  • Tags
  • Popular
  • SAMSON Connect
  • Get SAMSON
  • Recent
  • Tags
  • Popular
  • SAMSON Connect
  • Get SAMSON
Collapse
SAMSON Forum
  1. Home
  2. Develop
  3. Apps
  4. In-code camera duplication

In-code camera duplication

Scheduled Pinned Locked Moved Apps
2 Posts 2 Posters 2.9k Views 1 Watching
  • 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.
  • K
    K
    Karsten
    wrote on last edited by
    #1

    Hello there,

    I was wondering if there is any possibility to create a duplicate of the currently active camera, modify the duplicate, and then replace the active camera with the modified duplicate. I tried several approaches and none of them worked as intended. Please note that it is crucial for my application case that this process happens purely in code and requires no user interaction. The general copying of a camera via

    auto camcopy = SAMSON::getActiveCamera()->clone();
    

    is working as intended and the modification of the copy is perfectly possible without affecting the original camera. However, the replacement of the currently active camera leads to unexpected behaviour. The command

    SAMSON::getActiveDocument()->setActiveCamera(camcopy);
    

    seems to do nothing at all, while the more hacky approach

    (*SAMSON::getActiveCamera()) = *camcopy;
    

    leads to a camera that is not movable by the user and to an access violation when quitting SAMSON.
    Is there any possibility to do this correctly, or is the in-code swapping of active cameras not intended at all?

    Thanks in advance,
    Karsten

    1 Reply Last reply
    0
    • DmitriyMarinD
      DmitriyMarinD
      DmitriyMarin
      wrote on last edited by DmitriyMarin
      #2

      Hi @Karsten ,

      For every node, you create you need to invoke create function, and then if you want it to appear in the DataGraph this node needs to be added to a parent node:

      auto camcopy = SAMSON::getActiveCamera()->clone();     // clone the camera
      camcopy->create();                                     // create the node
      document->addChild(camcopy);                           // add the created camera into the active document
      /*
      ... some modifications of the camcopy
      */
      SAMSON::getActiveDocument()->setActiveCamera(camcopy); // set the active camera
      

      Dmitriy,
      The SAMSON Team, https://s-c.io

      1 Reply Last reply
      1

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Login or register to search.
      • First post
        Last post