Creating a Parameter Block

來源:互聯網
上載者:User

轉自:3ds max skd 9 :creating a Paramter Block .(稍後翻譯)

Parameter Block Creation Methods

There are two methods for creating a parameter block.

The First method is a global function defined in iparamb2.h:

IParamBlock2 *CreateParameterBlock2(ParamBlockDesc2 *pdesc, ReferenceMaker* iowner);

The second method is:

void ClassDesc2::MakeAutoParamBlocks(ReferenceMaker* owner)

which is a member function of a class descriptor object (i.e. class ClassDesc2).

Of the two methods, plugin developers should almost without exception use the MakeAutoParamBlocks function. In fact MakeAutoParamBlocks internally calles the CreateParameterBlock2 function. It is standard practice to call the MakeAutoParamBlocks when the plugin object gets created - usually this is done in the plugin's constructor function. i.e.

Widget::Widget()

{

    WidgetDesc.MakeAutoParamBlocks(this);

}

These functions shown above are not called by the plugin developer, but are called internally by Max. The plugin developer simply has to implement them properly. If the parameter block is created using the MakeAutoParamBlocks methods, then certain arguments must be set in describing the parameter block. These arguments are described below.

Number of parameter blocks per plugin

A plugin can have any number of parameter blocks. All the parameter blocks for that plugin should be associated with one class descriptor for each plugin. This is accomplished by passing the same class descriptor object address to each Parameter Block Descriptor constructor. For example:

static ParamBlockDesc2 widget_param_blk (

   //...

   , &WidgetDesc,

   //...

);

 

static ParamBlockDesc2 widget_param_blk_extra (

   //...

   , &WidgetDesc,

   //...

);

When Max creates the parameter block by calling MakeAutoParamBlocks it automaticly loop through all the parameter block descriptors that have been registered with the class descriptor.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.