Skip to content
  • Recent
  • Tags
  • Popular
  • SAMSON Connect
  • Get SAMSON
Collapse
SAMSON Forum
  1. Home
  2. Develop
  3. Modeling
  4. How to add new fields in the inspector for my custom class ?

How to add new fields in the inspector for my custom class ?

Scheduled Pinned Locked Moved Solved Modeling
5 Posts 3 Posters 5.2k Views
  • 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.
  • YassineY
    YassineY
    Yassine
    wrote on last edited by Yassine
    #1

    Hi everyone,

    I have created my own custom class that derives from SBStructuralModel and I want to display an important information of my class in the brand new SAMSON inspector. How should I do that ?

    Thanks in advance !
    Yassine

    1 Reply Last reply
    0
    • G
      G
      Guillaume
      wrote on last edited by Guillaume
      #2

      Here is an example for a Visual model, you can simply adapt that:

      1 Create and implements the functions

      SBQuantity::length getVal1() const;
      float getVal2() const;
      
      void setVal1(SBQuantity::length val1);
      void setVal2(float val2);
      

      2 Then in the descriptor(you may have to create the descriptor if not already done) of your node, add:

      SB_INTERFACE_BEGIN;
      SB_ATTRIBUTE_READ_WRITE(SBQuantity::length, MyVisualModel, Val1, "value 1", "My Parameter");
      SB_ATTRIBUTE_READ_WRITE(float, MyVisualModel, Val2, "value 2", "My Parameter");
      
      SB_INTERFACE_END;
      
      1 Reply Last reply
      1
      • F
        F
        Francois
        wrote on last edited by Francois
        #3

        All the getters must be 'const' :

        SBQuantity::length getVal1() const;
        float getVal2() const;
        
        1 Reply Last reply
        0
        • G
          G
          Guillaume
          wrote on last edited by
          #4

          Indeed, I will edit my answer

          1 Reply Last reply
          0
          • YassineY
            YassineY
            Yassine
            wrote on last edited by
            #5

            Awesome !

            Thank you guys, you rock !

            Yassine

            1 Reply Last reply
            0

            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
            0
            • Recent
            • Tags
            • Popular
            • SAMSON Connect
            • Get SAMSON