Jump to content

Object Tabs


Recommended Posts

Hi all,

I'm delving into HDK objects now, Null objects to be precise and I've hit a GUI issue.

I'd like to create a null that has 3 tabs mytab, Render and Misc. The Render and Misc tabs are just inherited from the OBJ_Null class.

Now I can hide all the parameters that come with Nulls and create my own tabs but then I lose the use of the inherited ones, or I can hide all the parameters on the transform tab, keep the other two and then have all my parameters lower down under the others, but I can't find a way to get my tab next to the 2 inherited ones and hide the transform one. Is this possible?

See attached images for a clearer understanding of what I'm after.

This is what I need

post-509-1128033747_thumb.jpg

This is what I have at the moment

post-509-1128033760_thumb.jpg

Any help as always will be muchly apprieciated. :)

Link to comment
Share on other sites

Hi Edward, using the shake.C example was how I arrived at what I currently have. I couldn't find a way to hide just the transform tab and add mine to it, I'd be happy if my parameters were on the last tab, but how to you combine your own tabs with the inherited ones.

If I hide the switcher from the inherited null it hides all the tabs and still positions my tabs underneath. Since the tabs are dealt with as one parameter how do you access them to change them?

Link to comment
Share on other sites

Just for the record in case anyone else has had trouble with this I did find a way to nearly do this. At least I managed to hide all the inherited tabs and create two new ones which do appear next to each other like I wanted, one with my parms on and the other with all the rest on.

I ended up creating a switcher that was included in my parms and had entries for the inherited parms too. Then in the buildTemplatePair function I copied all the parameters from my obj into a temporary template then all the inherited class parameters except the stdswitcher into the same temporary template and finally created a template pair out of the template.

OP_TemplatePair *
OBJ_Driven::buildTemplatePair(OP_TemplatePair *prevstuff)
{
   OP_TemplatePair     *driven, *geo;


   // The parm templates here are not created as a static list because
   // if that static list was built before the OBJbaseTemplate static list
   // (which it references) then that list would be corrupt. Thus we have
   // to force our static list to be created after OBJbaseTemplate.
   static PRM_Template *theTemplate = 0;
   if     (!theTemplate)
   {
      PRM_Template *  obj_template = OBJ_Null::getTemplateList();
      int   i,j;
      int   size,mysize;
      UT_String parm_name;

      size = PRM_Template::countTemplates( obj_template );
      mysize = PRM_Template::countTemplates( templatelist );
      theTemplate = new PRM_Template[mysize + size + 1];   // add +1 for sentinel
      for( i = 0,j = 0; i < mysize; i++,j++)
      {
        theTemplate[j] = templatelist[i];
      }
      for( i = 0; i < size; i++)
      {
        obj_template[i].getToken( parm_name );

        if (parm_name != "stdswitcher" )
        {
          if (parm_name == "stdswitcher" ||
              parm_name == "keeppos" ||
              parm_name == "pre_xform" ||
              parm_name == "xOrd" ||
              parm_name == "rOrd" ||
              parm_name == "t" ||
              parm_name == "r" ||
              parm_name == "s" ||
              parm_name == "p" ||
              parm_name == "scale" ||
              parm_name == "lookatpath" ||
              parm_name == "lookup" ||
              parm_name == "pathobjpath" ||
              parm_name == "roll" ||
              parm_name == "pos" ||
              parm_name == "uparmtype" ||
              parm_name == "pathorient" ||
              parm_name == "up" ||
              parm_name == "bank" ||
              parm_name == "tdisplay" )
          {
            copyParmWithInvisible( obj_template[i], theTemplate[j] );
            j++;
          }
          else
          {
            theTemplate[j] = obj_template[i];
            j++;
          }
        }
      }
    }

    driven = new OP_TemplatePair(theTemplate, prevstuff);

   return driven;
}

It seems to work but I don't know if I'm breaking anything that will come back and bite me later.

Link to comment
Share on other sites

Once you do all this, are your regular objects behaving correctly? I.e. your geo and null objects? When I was messing around with the switcher, I found that I could get them to work as long as they were the first ones I layed down, but then the regular ones (which inherit the template pairs from the same place) would be off in their offsets. If I layed down a null or a geo object first, they were fine, but then my Object would work right.

Actually, the code from my object worked fine, but the parameters didn't obey the "disable when..." code right because of the parm indexing.

Dave

Link to comment
Share on other sites

Actually there is an update to this, I did get some problems with the null object missing a couple of parameters so I found another way to do it. Similar but not exactly the same as the above. I thought it was working because if you create the null object first it's ok. Anyway take a look at the attached (it's still in progress but the parameters work)

Driven.zip

// this function returns the OP_TemplatePair that combines the parameters
// of this object with those of its ancestors in the (object type hierarchy)

OP_TemplatePair *
OBJ_Driven::buildTemplatePair(OP_TemplatePair *prevstuff)
{
   OP_TemplatePair     *driven, *geo;
   int   i,j;
   int   size,mysize;
   UT_String parm_name;


   // The parm templates here are not created as a static list because
   // if that static list was built before the OBJbaseTemplate static list
   // (which it references) then that list would be corrupt. Thus we have
   // to force our static list to be created after OBJbaseTemplate.
   static PRM_Template *theTemplate = 0;
   static PRM_Template *myTemplate = 0;
   if     (!theTemplate)
   {
      PRM_Template *  obj_template = OBJ_Null::getTemplateList();

      size = PRM_Template::countTemplates( obj_template );

      theTemplate = new PRM_Template[size + 1];   // add +1 for sentinel

      for( i = 0; i < size; i++)
      {
        obj_template[i].getToken( parm_name );
        if (parm_name == "stdswitcher" )
        {
          theTemplate[i] = templatelist[0]; //my own modified switcher
        }
        else if (parm_name != "stdswitcher" )
        {
          if (parm_name == "stdswitcher" ||
              parm_name == "keeppos" ||
              parm_name == "pre_xform" ||
              parm_name == "xOrd" ||
              parm_name == "rOrd" ||
              parm_name == "t" ||
              parm_name == "r" ||
              parm_name == "s" ||
              parm_name == "p" ||
              parm_name == "scale" ||
              parm_name == "lookatpath" ||
              parm_name == "lookup" ||
              parm_name == "pathobjpath" ||
              parm_name == "roll" ||
              parm_name == "pos" ||
              parm_name == "uparmtype" ||
              parm_name == "pathorient" ||
              parm_name == "up" ||
              parm_name == "bank" ||
              parm_name == "tdisplay" )
          {
            copyParmWithInvisible( obj_template[i], theTemplate[i] );
          }
          else
          {
            theTemplate[i] = obj_template[i];
          }
        }
      }
    }

    mysize = PRM_Template::countTemplates( templatelist );
    myTemplate = new PRM_Template[mysize + 1];

    myTemplate[0]=PRM_Template(PRM_SEPARATOR,1,&names[28]); //replace the switcher with a seperator

    for( i = 1,j=1; i < mysize; i++,j++)
    {
      myTemplate[i] = templatelist[i];
      //templatelist[j].getToken( parm_name );
      //cout<<parm_name<<endl;
    }


    driven = new OP_TemplatePair(myTemplate, prevstuff);
    geo = new OP_TemplatePair(theTemplate, driven);

   return geo;
}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...