当前位置: 首页>>代码示例>>C++>>正文


C++ Control::ReplaceReference方法代码示例

本文整理汇总了C++中Control::ReplaceReference方法的典型用法代码示例。如果您正苦于以下问题:C++ Control::ReplaceReference方法的具体用法?C++ Control::ReplaceReference怎么用?C++ Control::ReplaceReference使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Control的用法示例。


在下文中一共展示了Control::ReplaceReference方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: AddControl

int BlockControl::AddControl(HWND hWnd)
{
//pop up track view selector
Interface *ip = GetCOREInterface();

TrackViewPick res;
MasterBlockTrackViewFilter filter;
if (ip->TrackViewPickDlg(hWnd, &res,&filter ))
   {
//pop frame selector
   if (res.anim != NULL)
      {
      int OK = DialogBoxParam  (hInstance, MAKEINTRESOURCE(IDD_TRACKPROP),
         hWnd, TrackPropDlgProc, (LPARAM)this);
      if (OK)
         {
         Control *list;
         BOOL createdList = FALSE;
//check for list control if not add
         list = BuildListControl(res,createdList);
//check if list has a slave control
         Control *slaveControl;
         slaveControl = BuildSlave(res,list,createdList);


         int i = controls.Count();
         Control *ctemp = NULL;
         controls.Append(1,&ctemp,1);
         tempControls.Append(1,&ctemp,1);
         ReplaceReference(i,CloneRefHierarchy(res.anim));

//copy relvant keys
         propStart = propStart * GetTicksPerFrame();
				Interval iv(propStart,propStart + (m_end-start));
         TrackClipObject *cpy = controls[i]->CopyTrack(iv, TIME_INCLEFT|TIME_INCRIGHT);
//nuke all keys 
         controls[i]->DeleteKeys(TRACK_DOALL);
//paste back relevant keys
				iv.Set(0,m_end-start);
         controls[i]->PasteTrack(cpy, iv, TIME_INCLEFT|TIME_INCRIGHT);


         tempControls[i] = (Control *) CloneRefHierarchy(res.anim);
         SlaveControl *sl = (SlaveControl *) slaveControl;
         backPointers.Append(1,&sl,1);

         AddBlockName(res.anim,res.client,res.subNum,names);
//add slaves controls to the selected tracks and put the original as a sub anim of the slaves
//set slave to have reference to master
         slaveControl->ReplaceReference(1,this);
//copy selected track into slave sub
         slaveControl->ReplaceReference(0,(Control*)CloneRefHierarchy(res.anim));
         int bc;

         #define ID_TV_GETFIRSTSELECTED   680
				MaxSDK::Array<TrackViewPick> r;
         SendMessage(trackHWND,WM_COMMAND,ID_TV_GETFIRSTSELECTED,(LPARAM)&r);
         bc = r[0].subNum-1;

         if (res.anim->SuperClassID() == CTRL_FLOAT_CLASS_ID)
            {
            float f = 0.0f;
            tempControls[i]->DeleteKeys(TRACK_DOALL);
            tempControls[i]->SetValue(0,&f);
            SlaveFloatControl *slave = (SlaveFloatControl *) slaveControl;

            slave->scratchControl = (Control *) CloneRefHierarchy(res.anim);
//now replace track with slave
// int bc = Blocks.Count()-1;
            slave->blockID.Append(1,&bc,1);
            slave->subID.Append(1,&i,1);
            }
#ifndef NO_CONTROLLER_SLAVE_POSITION
         else if (res.anim->SuperClassID() == CTRL_POSITION_CLASS_ID)
            {
            Point3 f(0.0f,0.0f,0.0f);
            tempControls[i]->DeleteKeys(TRACK_DOALL);
            tempControls[i]->SetValue(0,&f);
            SlavePosControl *slave = (SlavePosControl *) slaveControl;

            slave->scratchControl = (Control *) CloneRefHierarchy(res.anim);
//now replace track with slave
// int bc = Blocks.Count()-1;
            slave->blockID.Append(1,&bc,1);
            slave->subID.Append(1,&i,1);
            }
#endif
#ifndef NO_CONTROLLER_SLAVE_ROTATION
         else if (res.anim->SuperClassID() == CTRL_ROTATION_CLASS_ID)
            {
            Quat f;
            f.Identity();
            tempControls[i]->DeleteKeys(TRACK_DOALL);
            tempControls[i]->SetValue(0,&f);
            SlaveRotationControl *slave = (SlaveRotationControl *) slaveControl;

            slave->scratchControl = (Control *) CloneRefHierarchy(res.anim);
//now replace track with slave
            slave->blockID.Append(1,&bc,1);
            slave->subID.Append(1,&i,1);
//.........这里部分代码省略.........
开发者ID:artemeliy,项目名称:inf4715,代码行数:101,代码来源:blockcontrol.cpp


注:本文中的Control::ReplaceReference方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。