SAMSON Forum
    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • SAMSON Connect
    • Get SAMSON

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

    Modeling
    3
    5
    3532
    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.
    • Yassine
      Yassine last edited by Yassine

      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 Reply Quote 0
      • G
        Guillaume last edited by Guillaume

        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 Reply Quote 1
        • G
          Guillaume last edited by Guillaume

          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 Reply Quote 1
          • F
            Francois last edited by Francois

            All the getters must be 'const' :

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

              Indeed, I will edit my answer

              1 Reply Last reply Reply Quote 0
              • Yassine
                Yassine last edited by

                Awesome !

                Thank you guys, you rock !

                Yassine

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