2014年9月15日 星期一

Kanzi C++ project

除了在設定中的:
C/C++
 -Advanced: Compiled as -> 改成 Compiled as C++ Code 外

也要把
-Code Generation: Enable C++ Exceptions 設成 /EHsc

參照:http://msdn.microsoft.com/zh-tw/library/1deeycx5.aspx

如果沒改,在編一些第三方函式庫會編不過...




2014年9月4日 星期四

建立Custom Component

1. 建立自已的KzuUiComponentNodeClass

2. 在configuration->onStartup = startup; 時註冊Factory

3. 為了2. 所以要建2個function:
       a. FactoryCreate //用來create component
       b. RegisterToFactory //用來註冊, 如果有要註冊Custom message也可以寫在這
   這會對應到在Editor中,建立的Custom Component name

4. 如果有要處理Message, Handler加在KzuUiComponentNodeClass的initialize function中。

 要在editor preview的話,編GL_21_release版的,ps:要把Editor關掉才能把dll蓋掉。

註冊custom message


 const struct KzuMessageType* MESSAGE_TEXTUREFONT_CHANGRD;
 {
  struct KzcMemoryManager* memoryManager = kzcMemoryGetManager(factory);
  struct KzuMessageType* messageType;
                
  //Message.Custom.FontChange 對應Editor裡的Custom Message Name
  result = kzuMessageRegistryAddMessageType(memoryManager, "Message.Custom.FontChange", KZU_MESSAGE_ROUTING_TUNNELLING_BUBBLING,        &messageType);
  kzsErrorForward(result);

  MESSAGE_TEXTUREFONT_CHANGRD = messageType;
 }

取得/設定 custom property

 {
    struct KzuPropertyType* UV_SET; 
    struct KzcVector4 uvs;

    //get property type
    UV_SET = kzuPropertyRegistryFindPropertyType("uv_modify");
    kzsAssert(kzcIsValidPointer(UV_SET));

    //get property
    uvs = kzuObjectNodeGetVector4PropertyDefault(textrue_font->planeNode, UV_SET);
    uvs.data[0] = (kzFloat)(uv_sets[index].x);
    uvs.data[1] = (kzFloat)(uv_sets[index].y);
    uvs.data[2] = (kzFloat)(uv_sets[index].z);
    uvs.data[3] = (kzFloat)(uv_sets[index].w);

    //set property
    result = kzuObjectNodeSetVector4Property(textrue_font->planeNode, UV_SET, uvs);
    kzsErrorForward(result);
}
在scene node底下的mesh的material,可以從node就直接get property來set,不用去get它的material

2014年8月15日 星期五

linux筆記

ldap.arcade.igs.com.tw

rm -rf 刪資料夾
新系統剛開始用時
vi /etc/ssh/sshd_config

PermitRootLogin yes
PermitEmptyPasswords yes

/etc/init.d/sshd restart


/etc/init.d/ntpd stop          //停止與其它人同步
ntpdate 10.1.1.254             //與server同步

svn co http://rd601/svn/pt/trunk trunk
svn update //要在code2端
chmod -R 777../
Xorg&
xterm&   //& 在背景執行

//ssh root@10.3.10.245 -p 412
ssh test@10.1.0.75 -p 412
ssh test@10.3.10.245 -p 22
password : linnet
su  //取得root
mount -t cifs -o username=brianchang,noserverino //10.1.254.52/brianchang /mnt

mount /dev/sdb1 /mnt

find ./ -name .svn -exec rm -rf '{}' \;
find . -type d -name ".svn"|xargs rm -rf

\\10.1.254.52 --> new code2 position

改開機default選項

mongo 筆記

http://docs.mongodb.org/manual/reference/operator/update/rename/
rename:

{
"occupation":"Doctor",
"name": {
   "first":"Jimmy",
   "additional":"Smith"
}

db.foo.update({}, {$rename:{"name.additional":"name.last"}}, false, true);
remap = function (x) {
  if (x.additional){
    db.foo.update({_id:x._id}, {$set:{"name.last":x.name.additional}, $unset:{"name.additional":1}});
  }
}

db.foo.find().forEach(remap);

db.students.update( { _id: 1 }, { $rename: { "nmae": "name" } } )
#rename all field
db.user.update({}, {$rename: {"session.play_data.Attack":"session.play_data.Power"}}, false, true)
#add all field
db.user.update({}, set{"session.play_data.Denfense":0}}, true, true)
[remove]
db.expTable.remove({'_id':ObjectId("52b29b8f5d89c90330cc23ad")})

#remove all documents in collection
db.expTable.remove()
#remove collections
db.expTable.drop()

[backup]
在command line下
mongodump --host 192.168.132.62 --port 27017 --out /backup/mongo-2013-01-17
#會存在 C:/backup/mongo-2013-01-17/
================[pymongo]================
from bson.objectid import ObjectId
#mike is a cursour
mike = testDB['posts'].find({'_id':ObjectId('52b144545d87c91b605dfca9')})

#modify a item
item = testDB['posts'].find({'_id':ObjectId('52b144545d87c91b605dfca9')})
item = item[0]
item['text'] = "haha"
testDB['posts'].save(item)

or

item = testDB['posts'].find_one({'_id':ObjectId('52b144545d87c91b605dfca9')})
testDB['posts'].update({'_id':ObjectId('52b144545d87c91b605dfca9')}, {"$set":{"text":"UCCU"}})

git 筆記

workdirectory --> Stage/Index --> repository --> Server
              add            commit          push

在專案底下使用 git init 開始一個新的 Git repo.

新增遠端儲存庫
git remote add [shortname] [url]
git remote add origin git@bitbucket.org:username/c-practice.git
欲從遠端擷取資料
$ git fetch [remote-name]

$ git push origin master 想要上傳 master 分支到 origin 伺服器

.gitignore
空白列或者以#開頭的列會被忽略
# 不要追蹤檔名為 .a 結尾的檔案
*.a
# 但是要追蹤 lib.a,即使上方已指定忽略所有的 .a 檔案
!lib.a
# 只忽略根目錄下的 TODO 檔案。 不包含子目錄下的 TODO
/TODO
# 忽略build/目錄下所有檔案
build/
# 忽略doc/notes.txt但不包含doc/server/arch.txt
doc/*.txt
# ignore all .txt files in the doc/ directory
doc/**/*.txt
#從repo中移掉某檔但不刪除
git rm --cached mylogfile.log
#add modify files, ingore untracked
git add -u (--update)
#add all files
git add -A
git commit -am  (add modify/delete file. not include untracked file)
同等於
git add -u, git commit -m

#checkout -> 移動Head的位置 到某個branch -b:若沒這個branch就建一個
git checkout -b Brian
#把 那個file revert
git checkout -- Assets/Artworks/Textures/girl.png.meta
同等於
git branch Brian
git checkout Brian
#把stage中某個file移掉
git reset filename

看某個file比較
git diff