FbxProperty(Fbx物件特性)

2021-06-18 06:02:18 字數 2879 閱讀 7356

fbxproperty模板類是為了保證fbxobject能夠非常規範。舉個例子,fbxnode就是由fbxtypedproperty(用fbxdouble3引數化描述)來表示的。

當乙個fbxobject被建立時,它在fbxproperty中建立的靜態資料會被自動初始化。那麼為了建立自己的fbxproperty,我們必須點喲fbxproperty::create(),使用者建立的特性包含使用者自己定義的資料,這些資料可以和fbxobject動態聯絡在一起。下面是一段呼叫**(第乙個引數是fbxscene物件,第二個引數是特性的型別,第三個引數是特性的名字):

fbxproperty p = fbxproperty::create(pscene, dtdouble3, "vector3property");

fbxset(p, fbxdouble3(1.1, 2.2, 3.3);

fbxproperty物件可以通過fbxproperty::getname()來查詢,但是必須要在同一層次中進行。fbxpoperty中的例項可以通過fbxproperty::destroy()來銷毀。乙個層級的fbxproperty可以在根特性(也是乙個fbxproperty物件)中通過呼叫fbxproperty::destroyrecursively()來銷毀。

fbxproperty的例項中的資料可以通過fbxproperty

::get()和fbxproperty::set()分別來寫和讀。比如,fbxnode圖形轉換資訊可以這樣讀取:

// ... initialize fbxnode* lnode ...

fbxdouble3 translation = lnode->lcltranslation.get();

fbxdouble3 rotation = lnode->lclrotation.get();

fbxdouble3 scaling = lnode->lclscaling.get();

特性中也包含一系列的特性集合

fbxpropertyflags::efbxpropertyflags,它們可以通過fbxproperty::getflag和fbxproperty::modifyflag()來操作。

和fbxobject不一樣,fbxproperty可以通過操作符來進行賦值和比較等操作。

fbxproperty可以在fbxobject聯絡也可以和另乙個fbxproperty聯絡。獲取fbxobject函式fbxproperty::getnextproperty().

在fbxobject中獲取fbxproperty可以通過名字fbxobject::findproperty(),也可以通過迭代器依次遍歷查詢:fbxobject::getfirstproperty()後者fbxobject::getnextproperty().

對層級之間的實行操作可以用一下函式fbxproperty::getparent(),fbxproperty::getchild(),fbxproperty::getsibing(),fbxproperty::find().

下面是乙個例子,用來說明怎樣來建立你自己的fbxproperty value,並且將它們與fbxobjectmetadata例項(從fbxobject繼承而來)繫結。

// ... initialize pscene as a fbxscene* ...

// create a fbxobjectmetadata* object in pscene.

fbxobjectmetadata* lfamilymetadata = fbxobjectmetadata::create(pscene, "family");

// create and assign data to several instances of fbxproperty, based on their parametrized

// datatypes (dtstring, dtfloat, dtdouble).

//// the fourth parameter is an optional label string, which can be obtained and modified

// using fbxproperty::getlabel() and fbxproperty::setlabel(). this label only exists

// in the program's main memory, and will not be exported to a file if/when the property

// is exported.

// // these properties will be contained within the pfamilymetadata object.

//fbxproperty::create(lfamilymetadata, dtstring, "level", "level").set(fbxstring("family")); // string

fbxproperty::create(lfamilymetadata, dtstring, "type", "type").set(fbxstring("wall")); // string

fbxproperty::create(lfamilymetadata, dtfloat, "width", "width").set(10.0f); // float

fbxproperty::create(lfamilymetadata, dtdouble, "weight", "weight").set(25.0); // double

fbxproperty::create(lfamilymetadata, dtdouble, "cost", "cost").set(1.25); // double

對建立游標對理解

步驟 1 首先經過底層的 編寫已經建立起了了python和資料庫之間的溝通橋梁並封裝成了模組,通過pymysql下的conntent 方法與之建立起了連線,例項物件。pymysql.connect 方法返回的是connections模組下的connection 例項,connect 方法傳參就是在給...

對勾函式 對勾函式

對勾函式是一種類似於反比例函式的一般函式。所謂的對勾函式,是形如 f x ax b x 的函式,是 一種教材上沒有但考試老喜歡考的函式,所以更加要注意和學習。一般的函式影象形似兩個中心對稱的 對勾,故名。當x 0 時,f x ax b x 有最小值 這裡為了研究方便,規定a 0 b 0 也就是當 x...

一對多 多對一

pip install djangorestframework 3.9.2 pip install markdown 3.0.1 markdown support for the browsable api.pip install django filter 2.1.0 filtering supp...