<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>python on Drake&#39;s Weblog</title>
    <link>https://drakeguan.org/categories/python/</link>
    <description>Recent content in python on Drake&#39;s Weblog</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Sat, 29 Aug 2020 21:15:23 +0800</lastBuildDate><atom:link href="https://drakeguan.org/categories/python/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>PyCon Taiwan History, 2012~2020</title>
      <link>https://drakeguan.org/blog/2020/08/pycontw-history-2012-2020/</link>
      <pubDate>Sat, 29 Aug 2020 21:15:23 +0800</pubDate>
      
      <guid>https://drakeguan.org/blog/2020/08/pycontw-history-2012-2020/</guid>
      <description>&lt;p&gt;PyCon Taiwan 2020 is about to kick off, just one week to go.
Sometimes I&amp;rsquo;d wonder if we can host PyConTW somewhere else than Taipei.
And it just happened this year, right amid the pandemic, COVID-19, 2020.
The venue is in Tainan, south Taiwan, a historical and beautiful city.
I&amp;rsquo;m not sure how the committee made this decision.&lt;/p&gt;
&lt;p&gt;I have to say, having PyConTW in Tainan is one of the best decisions!&lt;/p&gt;
&lt;iframe src=&#39;https://cdn.knightlab.com/libs/timeline3/latest/embed/index.html?source=135b76fLYyza65MNUXkz0eJukW-ComHmFBQX8ehoIo4Q&amp;font=Default&amp;lang=en&amp;initial_zoom=0&amp;height=650&#39; width=&#39;100%&#39; height=&#39;650&#39; webkitallowfullscreen mozallowfullscreen allowfullscreen frameborder=&#39;0&#39;&gt;&lt;/iframe&gt;
&lt;p&gt;Hopefully you can see a timeline, embedded through iframe, above that guide
you through PyCon Taiwan from 2012 to 2020.
And it seems the best viewing experience needs you to have a bigger screen, like a laptop,
along with a stand-alone webview.
So here it is, &lt;a href=&#34;https://cdn.knightlab.com/libs/timeline3/latest/embed/index.html?source=135b76fLYyza65MNUXkz0eJukW-ComHmFBQX8ehoIo4Q&amp;amp;font=Default&amp;amp;lang=en&amp;amp;initial_zoom=0&amp;amp;height=800&#34;&gt;the stand-alone timeline of PyCon Taiwan 2012~2020&lt;/a&gt;.
Cheer~&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Python Modules I used while in work</title>
      <link>https://drakeguan.org/blog/2012/09/python-modules-i-used-while-in-work/</link>
      <pubDate>Sun, 16 Sep 2012 01:48:00 +0800</pubDate>
      
      <guid>https://drakeguan.org/blog/2012/09/python-modules-i-used-while-in-work/</guid>
      <description>What Python modules you use while in working?
 
我們都曉得，Python 有個模組倉庫 Cheese Shop (or PyPI)，只要善用 Google + PIP + virtualenv，你需要什麼樣的模組，一般都有人替你寫好一版了。 不過這也不是什麼挺稀奇的。 Perl 老早就有 CPAN; PHP 也有個 PEAR; Ruby 的是 RubyForge; R 也有個 CRAN; 甚至連 Tex/LaTeX 都有個 CTAN; 喔，對了，Vim 也有個 Vim Scripts…
但你曉得你對某個程式語言的社群函式庫有多熟悉嗎? 你常用的模組倒底是哪些呢? 還是只是想到什麼，就 Google 什麼，然後看著 Tutorial 試用一下?!
以下是我在這七年多的工作期間，所寫的獨立執行的 Python scripts 所常用到的模組清單。 赫然發現，常用的模組，其實就那幾個!! （前頭的數字是引用的次數）
 155 wx 126 os 119 sys 95 codecs 55 re 49 ldap 30 time 28 tempfile 28 shutil 20 datetime 19 urllib 18 setuptools 15 maya 15 copy 13 socket 11 subprocess 11 getpass 11 distutils 10 locale 9 warnings 8 threading 7 types 7 logging 6 traceback  這個清單裏頭，wx 的次數比 os, sys 來得多，應該是意外，不過也相差不遠。 與檔案處理有關的就有 codecs, tempfile, shutil, 這一點都不意外。 但是 re 居然也用很多次?</description>
    </item>
    
    <item>
      <title>PyCon Taiwan 2012!</title>
      <link>https://drakeguan.org/blog/2012/04/pycon-taiwan-2012/</link>
      <pubDate>Mon, 16 Apr 2012 17:21:55 +0800</pubDate>
      
      <guid>https://drakeguan.org/blog/2012/04/pycon-taiwan-2012/</guid>
      <description>What is PyCon?  PyCon Taiwan is organized by the Taiwan Python community for the community. PyCon Taiwan is intended to provide a professional venue to exchange technical information of Python. We want to clone the experience of PyCon (US), the largest annual gathering of Python programmers, in Taiwan, and bring the joy to more people.
    PyCon Taiwan 2012 will also stress on industrial applications of Python.</description>
    </item>
    
    <item>
      <title>PyPs := Python &#43; Photoshop</title>
      <link>https://drakeguan.org/blog/2012/03/pyps-python-photoshop/</link>
      <pubDate>Sun, 04 Mar 2012 13:48:14 +0800</pubDate>
      
      <guid>https://drakeguan.org/blog/2012/03/pyps-python-photoshop/</guid>
      <description>Python, the so-called scripting language but actually more than that, keeps sweeping this CG/Animation/VFX/Game industries in technical programming field. The bigger the stronger. I even start to doubt if PyPy could take over this situation one day by it’s natural power of strength in concurrent programming.
  &amp;gt; 由 Aardman Animations 與 Sony Pictures Animation 合力製作，於 2011 年放映的動畫。《聖誕快遞》揭示了一個令人難以置信、以前從未見過的答案，關於每一個孩子都曾有過的問題：“究竟聖誕老人是如何在一個晚上送完這些禮物？”答案是：聖誕老人在北極擁有超高科技的協助！但是，電影中心是關於一個家庭的故事，一個有漫畫功能障礙和一個不太可靠的主角阿瑟，一個緊迫的任務，一個必須在聖誕節前黎明的晨光前完成的任務。
Ok, 重點其實不是這部動畫，而是 Aardman Animations 這家動畫公司。這家位於 far far away（相對於台灣搭飛機過去所需要的時間來看）的大不列顛王國的動畫公司，一位技術研發人員於 2010 年釋出了一則有趣的訊息出來：Photoshop Embedded Python Pipeline。把整個 Python 給整合進 Photosthop 裏頭，提供 python programmer 一個管道，可以直接透過寫 python script 來與 PS 互動。放出來的一些圖，示範了可能的互動：</description>
    </item>
    
    <item>
      <title>Python and 3D Industry/Tools</title>
      <link>https://drakeguan.org/blog/2012/02/python-and-3d-industry-tools/</link>
      <pubDate>Sun, 12 Feb 2012 00:31:09 +0800</pubDate>
      
      <guid>https://drakeguan.org/blog/2012/02/python-and-3d-industry-tools/</guid>
      <description>People keep asking about “How to learn Python”, “What to study for Python” or “Recommend Python books…” for VFX/Animation Industry. And here is a brief, not confirmed but, at least, some sort of informative answer I organized on Internet.
For general Python programming:
 Official Python website, http://python.org/, http://docs.python.org/tutorial/ Learn Python the hard way, http://learnpythonthehardway.org/ Dive Into Python, http://www.diveintopython.net/ How to Think Like a Computer Scientist, http://greenteapress.com/thinkpython/ A Byte of Python, http://www.</description>
    </item>
    
    <item>
      <title>2011 Python 回憶錄</title>
      <link>https://drakeguan.org/blog/2012/01/2011-python-hui-yi-lu/</link>
      <pubDate>Wed, 11 Jan 2012 12:54:10 +0800</pubDate>
      
      <guid>https://drakeguan.org/blog/2012/01/2011-python-hui-yi-lu/</guid>
      <description>2011 走了，民國 100 年在眾人互相廝殺的 boardgame, 美味湯頭火鍋, 以及散步看 101 煙火去中度過；2012 世界末日年也來了，我覺得 2012 年比其它年幸運，大家都記得它有個世界末日的外號，其它年份未必有這個福氣被大多數人記著。
論語《為政》篇裏頭提到“溫故而知新，可以為師矣。”參考 Tarek 的計畫，趁勢來個 2011 Python 回憶錄。
1. What’s the coolest Python application, framework or library you have discovered in 2011?
virtualenv, pip, Fabric, logbook, and mongoengine.
2. What new programming technique did you learn in 2011?
map reduce, git, optimization by matlab, and TDD.
3. What’s the name of the open source project you contributed the most in 2011?</description>
    </item>
    
    <item>
      <title>Concurrent Map in Python</title>
      <link>https://drakeguan.org/blog/2011/07/concurrent-map-in-python/</link>
      <pubDate>Sat, 02 Jul 2011 02:21:05 +0800</pubDate>
      
      <guid>https://drakeguan.org/blog/2011/07/concurrent-map-in-python/</guid>
      <description>There are several articles and Python modules talking about how to do concurrent/distributed/parallel computing in Python. There is an article in Python wik addressing &amp;ldquo;Parallel Processing and Multiprocessing in Python&amp;rdquo; which is a good start point for that. But the most interests me is how to make map parallel. One reason is that I started functional programming for a while and I started to switch my mind from imperative for-loop + if-else into map + filter + reduce + comprehension list; the other reason is that parallel map is just so good to boost up your program without chaning your code a lot.</description>
    </item>
    
    <item>
      <title>在 Maya 2011 下，準備好 PyQt4 的開發環境</title>
      <link>https://drakeguan.org/blog/2011/02/zai-maya-2011-xia-zhun-bei-hao-pyqt4-de-kai-fa-huan-jing/</link>
      <pubDate>Sun, 27 Feb 2011 00:57:17 +0800</pubDate>
      
      <guid>https://drakeguan.org/blog/2011/02/zai-maya-2011-xia-zhun-bei-hao-pyqt4-de-kai-fa-huan-jing/</guid>
      <description>Maya 2011 可能是有史以來，對於開發人員最最有善的一次改版了：整個 GUI 使用 Nokia Qt 重寫一遍。Maya 過去的版本發表中，影響程度足以和 2011 相提並論的，我想只有 Maya 8.5 推出時提供的 Python binding，以及隨後由 Chad Dombrova 個人領軍執行的 pymel open source project 可以匹敵。事實上我覺得，Maya 2011 以 Qt 重寫這件事，不止是用哪個 GUI framework 的差別而已，包括整個 GUI 的能力，與系統的整合，使用第三方程式庫的能力…等，差別遠比想像中的大很多。
所以當你拿到一個已經安裝好 Maya 2011 的機器時，就程式開發的角度來看的話，裏頭提供的環境應該就會有 Maya SDK + Python + pymel，然後應該也會有 Qt 的開發環境。然後既然有 Python 又有 Qt，那也應該可以使用 PyQt4 的吧? 似乎應該就是如此，但又有點不太一樣。一來，Maya 提供的 Qt 函式庫（.so or .dll）與 Nokia Qt 官方提供的有一些差異，甚至是有不全的地方；二來，Maya 並沒有提供 PyQt4! 事實上，Maya 要把 PyQt4 包入比你想像中的，都要來得複雜一些。在這邊分享一下 Maya 2011 + PyQt4 的作法與過程，雖然已經不是什麼新聞了 ;p</description>
    </item>
    
    <item>
      <title>Python versions for 3D softwares in VFX industry</title>
      <link>https://drakeguan.org/blog/2011/01/python-versions-for-3d-softwares-in-vfx-industry/</link>
      <pubDate>Mon, 31 Jan 2011 23:51:54 +0800</pubDate>
      
      <guid>https://drakeguan.org/blog/2011/01/python-versions-for-3d-softwares-in-vfx-industry/</guid>
      <description>I start this tiny post to collect embedded python version for several major players of 3D softwares in VFX/Animation industry. It is a personal desire to build the list such that we don&amp;rsquo;t need to guess or google it while facing python version issue. Hopefully, this post can get someone&amp;rsquo;s notice and help to make it as complete as possible. Any information is welcome~
   Python versoins for 3D softwares Software version Python version     Autodesk Maya    Maya 2011 Linux 64bit Python 2.</description>
    </item>
    
    <item>
      <title>The Definition of Functional Programming Language</title>
      <link>https://drakeguan.org/blog/2010/10/the-definition-of-functional-programming-language/</link>
      <pubDate>Mon, 04 Oct 2010 13:21:54 +0800</pubDate>
      
      <guid>https://drakeguan.org/blog/2010/10/the-definition-of-functional-programming-language/</guid>
      <description>目前我覺得非常中肯且值得特別一一去了解，並且在 coding 時，時時提醒自己的 Functional Programming Paradigm，如下：
 First-class function Higher-order function Lexical closure Pattern matching Single assignment Lazy evaluation Garbage collection Type inference Tail recursion List comprehension Monad  其中 Python 有提供的，有第 1, 2, 3 (部分?), 6, 7, 8 (部分?), 10, 11 (部分?)，就我微薄的知識所了解後的，可能會有一些出入。
目前的感想是，與 function 有直接關係的功能，對於一個剛入門 FP，想學習怎麼做到 paradigm shift 的人來說，是最最直接，最容易感受到不一樣的地方。（其實，本來也就應該是這樣的啦，不然幹麻叫做 functional programming?）透過功能 1, 2, 3, 10 這幾點，就可以開始去體驗所謂的：
 A program is some specific combination and arrangement of functions, which are also some sort of combination of other functions.</description>
    </item>
    
    <item>
      <title>用 Python 寫一個精簡的 Lisp Interpreter</title>
      <link>https://drakeguan.org/blog/2010/10/yong-python-xie-yi-ge-jing-jian-de-lisp-interpreter/</link>
      <pubDate>Sun, 03 Oct 2010 19:47:15 +0800</pubDate>
      
      <guid>https://drakeguan.org/blog/2010/10/yong-python-xie-yi-ge-jing-jian-de-lisp-interpreter/</guid>
      <description>Peter Norvig 在他的個人網站上頭，寫了一篇 (How to Write a (Lisp) Interpreter (in Python))（註）， 他寫了約莫 100 行的 python script 來小小模擬一個簡化版的 Lisp Interpreter，看了不禁拍案叫絕。 下頭這個表格截取自他的網頁，指出他這 100 行的程式碼，所實作的 syntax 只有 9 個（註）。
  var, variable reference
A symbol is interpreted as a variable name; its value is the variable&amp;rsquo;s value.
Example: x
  number, constant literal
A number evaluates to itself.
Examples: 12 or -3.45e+6
  (quote exp), quotation
Return the exp literally; do not evaluate it.</description>
    </item>
    
    <item>
      <title>Lisp 初體驗：Grammar Induction</title>
      <link>https://drakeguan.org/blog/2010/09/lisp-chu-ti-yan-grammar-induction/</link>
      <pubDate>Sun, 19 Sep 2010 18:35:06 +0800</pubDate>
      
      <guid>https://drakeguan.org/blog/2010/09/lisp-chu-ti-yan-grammar-induction/</guid>
      <description>我們這個地球上的人實在太多了，加上上天賦與我們的大腦又過於活躍，以致於時時可以聽聞到，又有什麼人做出了驚人之舉。
幾個禮拜前，無意間得知一個網頁：Random CG Paper Generator。每 reload 這個頁面一次，就會亂數產生一篇圖學論文的標題出來（以假亂真似地）。也許，苦於找不到研究方向的研究生，可以來這個頁面 reload, re-roll your brain，看看有沒有什麼意外的研究靈感可以借用的。
Anyway，借用一個這樣的 random stuff generator 來找點子，實在太冒險也太不明智了，況且，我還處於 non-qualified Ph.D. student，沒啥理由理會這個網站的。除非…
 我想知道它是怎麼產生這些以假亂真的論文標題。
 在與 Edward 來來回回，反反覆覆的 email 往來後，終於，他了解我的目的了。Ed 建議我用 Lisp 來試著解解看這個問題。一方面 Ed 最近一直在寫 Lisp program，而 Lisp 又是號稱 functional programming languages 裏頭的元老之一，很擅長處理這類 AI 相關，或是 NLP（Natural Language Processing）相關的問題；另一方面，我剛好也在鑽研 FP，想多一些小而美的例子好讓自己的手變得髒一些（黑手），從中了解一下 FP 的特色。於是就開工了。
透過 MacPorts 安裝好 SBCL (Steel Bank Common Lisp) 與 Emacs 後，自 Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp 這本書的網站上，下載了書中提到的一些程式碼。試圖用裏頭的一些函式與方法來解決，或是某種程度上“逼近“我想要處理的這個問題。非常遺憾的，PAIP 的程式碼，似乎是給老舊的 Common Lisp 用的，而 SBCL 與他沒有很合，會一直出現一堆 warnings，得一直按 continue/ignore 之類的@@</description>
    </item>
    
    <item>
      <title>你是怎麼使用 Python 的?</title>
      <link>https://drakeguan.org/blog/2010/08/ni-shi-zen-me-shi-yong-python-de/</link>
      <pubDate>Tue, 31 Aug 2010 22:17:24 +0800</pubDate>
      
      <guid>https://drakeguan.org/blog/2010/08/ni-shi-zen-me-shi-yong-python-de/</guid>
      <description>上上週的某個深夜，電動也玩夠了（一直輸），Erlang 也看煩了，上網查看 Python, RenderMan, Maya, Computer Graphics, Game, Animation, Lighting, Stereoscopy, … 等關鍵字的各種組合過程中，發現到一篇 2009 年的文章：What do you do with Python?。

非常有趣，把片段的內容翻譯過來：
 盡可能地，在任何地方做 log，存進 SQL 資料庫裏頭，好事後做分析。舉個例子，像是 3DS Max 開啟到完整載入一個 scene file 的時間；執行自己寫的程式的各個功能的時間。從中找出可能的問題，像是執行時間太久，然後可能自動發個信給開發人員得知。 使用 wxPython 把各個工具給整合起來。這點和我有篇文章提到 Pipeline as a Glue 的想法一致。 把 Python 整合進開發工具裏頭。這點有點像是在 3DS Max 裏頭加進 MaxScript。 3DS Max 啟動時，自動執行一些事務：把一些目錄裏頭的 MaxScripts 整包建置出一個 .mcr 來；掃描整個 texture 目錄，加進 scene file 裏頭…等。 把 Perforce 裏頭的 assets rendering 所花費的時間、資源等資料，存進 SQL 資料庫。 自內部使用的 bug tracking system 裏頭抓出 tasks/tickets，然後使用 Vista Sidebar gadget 的型式秀出來給工作同仁，讓他們第一時間以最醒目的方式得知還有多少工作要做。 使用 wavelet transform 來執行 image comparison。這我猜有點像是 Perceptual Image Difference Utility (pdiff)。（注：這是個好東西） Data minging!</description>
    </item>
    
    <item>
      <title>Introducing Python 的影片</title>
      <link>https://drakeguan.org/blog/2010/03/introducing-python-de-ying-pian/</link>
      <pubDate>Fri, 26 Mar 2010 19:23:32 +0800</pubDate>
      
      <guid>https://drakeguan.org/blog/2010/03/introducing-python-de-ying-pian/</guid>
      <description>以非常…..宅…..的方式介紹 Python，整個畫面很 low, 很南方公園的 video。雖然這樣，不過裏頭出現很多 Python Community 的大頭!</description>
    </item>
    
    <item>
      <title>Interesting Python Shells</title>
      <link>https://drakeguan.org/blog/2010/03/interesting-python-shells/</link>
      <pubDate>Sat, 13 Mar 2010 02:08:58 +0800</pubDate>
      
      <guid>https://drakeguan.org/blog/2010/03/interesting-python-shells/</guid>
      <description>I&amp;rsquo;ve found several very interesting and active python shells. Each has it&amp;rsquo;s own strength and the most often mentioned feature is syntax highlight, auto-complete and function attributes info.
Here they are:
IPython
bpython
DreamPie
Interactive server-side Python shell</description>
    </item>
    
    <item>
      <title>TIFF file handling in PIL</title>
      <link>https://drakeguan.org/blog/2010/01/tiff-file-handling-in-pil/</link>
      <pubDate>Wed, 27 Jan 2010 19:52:05 +0800</pubDate>
      
      <guid>https://drakeguan.org/blog/2010/01/tiff-file-handling-in-pil/</guid>
      <description>TIFF is a flexible, if somewhat aged, image file format originally # defined by Aldus. Although TIFF supports a wide variety of pixel # layouts and compression methods, the name doesn’t really stand for # “thousands of incompatible file formats,” it just feels that way.  thousands of incompatible file formats, 這個的確有挖苦到 TIFF 這個格式 XD</description>
    </item>
    
    <item>
      <title>Python Programming Coding Style in Entertainment Industry</title>
      <link>https://drakeguan.org/blog/2009/06/python-programming-in-entertainment-industry-coding-style/</link>
      <pubDate>Tue, 23 Jun 2009 21:19:16 +0800</pubDate>
      
      <guid>https://drakeguan.org/blog/2009/06/python-programming-in-entertainment-industry-coding-style/</guid>
      <description>Python Programming in Entertainment Industry: Coding Style
View more Microsoft Word documents from drakeguan.</description>
    </item>
    
    <item>
      <title>Why Pyton in Entertainment Industry</title>
      <link>https://drakeguan.org/blog/2009/06/why-pyton-in-entertainment-industry/</link>
      <pubDate>Wed, 17 Jun 2009 21:14:15 +0800</pubDate>
      
      <guid>https://drakeguan.org/blog/2009/06/why-pyton-in-entertainment-industry/</guid>
      <description>Why Python In Entertainment Industry?
View more Microsoft Word documents from drakeguan.</description>
    </item>
    
    <item>
      <title>How to clean up &#34;Render Stats&#34; of all geometry in Maya?</title>
      <link>https://drakeguan.org/blog/2009/03/how-to-clean-up-render-stats-of-all-geometry-in-maya/</link>
      <pubDate>Thu, 05 Mar 2009 16:12:22 +0800</pubDate>
      
      <guid>https://drakeguan.org/blog/2009/03/how-to-clean-up-render-stats-of-all-geometry-in-maya/</guid>
      <description>No matter what renderer you are going to use, you should take care of geometry’s &amp;ldquo;Render Stats&amp;rdquo; before rendering, especially when you are planning to decompose a rendering job into several layers/passes. Here is a quick python scripts based on pymel to do that.
from pymel import * def dgVerifyRenderStats(surfaces=None): &#39;&#39;&#39; dgVerifyRenderStats deps: none verify and adjust all surface&#39;s render stats. double sided, opposite, smooth shading, motion blur visible in reflections/refractions, casts/receive shadows primary visibility &#39;&#39;&#39; def _verifier(surface): surface.</description>
    </item>
    
    <item>
      <title>Maya Scripting - MEL V.S. Python</title>
      <link>https://drakeguan.org/blog/2009/02/maya-scripting-mel-v-s-python/</link>
      <pubDate>Sun, 08 Feb 2009 17:54:36 +0800</pubDate>
      
      <guid>https://drakeguan.org/blog/2009/02/maya-scripting-mel-v-s-python/</guid>
      <description>Maya scripting 現在有了 MEL 與 Python 可供選擇，對於大部分的 Maya 使用者來說，這是件微不足道的事，但對於天天使用與撰寫 Maya scripting 的人來說（ex, TD?!）（或保守一點的說，很有機會被要求寫點程式的人），這重要極了。
個人淺見，Python 與之後由 Luma Pictures 的 Chad Dombrova 所推出的 pymel (0.7.8)，是 Autodesk 買下 Maya 後，在 8.5 所做的 features 裏頭，最最重要的一點了。好吧，我是以 RD/TD/SD 人員的角度來看事的，請先暫時原諒我這有點狹隘的說詞，然後接著繼續看文章。
Maya 8.5 發表以前，在 Maya 上頭工作的技術人員，除了和大家一樣要去了解與使用 Maya 以外（說真的，Maya 的學習曲線有點長，進入門檻有點兒高，以致於很多資訊系所的電腦圖學實驗室，都不容易利用這個工具來做點什麼，實在很可惜），可能還需要去了解一下 Maya ascii file format, Maya nodes, Hierarchy in a Maya scene file, Mel, Maya C++ API, 技術名詞, …好不容易似懂非懂一些東西後，就是寫些程式來試試看。
舉些個例子。如果你想寫個可以自動幫你架好骨架的 joints 與一些 IK/FK 的設定的東西，你可以利用 Mel 來做到；如果你希望有一個特別的材質球，它會在你的模型有互相穿刺時，用紅色這種非常鮮豔且帶警告意味的顏色來提醒人，你可以用 C++ API 寫個 plugin 來提供一個特製化的 material node；如果你想用透過一個放在 Maya shelf 上頭的按鈕，讓 lighter 可以很快的下算圖指令的話，那你可以使用 Mel 外加 RMS/MtoR 提供的指令來做到；如果你想利用 locator 來實作 instance（一些 Maya instance 無法做到的情況下），同時要讓這個 locator 秀出原 reference model 的各種動態的話，你得用 Maya API 外加對於 Maya node 的了解（當然，你也可以使用 billboard(sprite) 做到）；…</description>
    </item>
    
    <item>
      <title>把 MSN 放進 Maya 裏頭?!</title>
      <link>https://drakeguan.org/blog/2009/02/ba-msn-fang-jin-maya-li-tou/</link>
      <pubDate>Thu, 05 Feb 2009 10:56:49 +0800</pubDate>
      
      <guid>https://drakeguan.org/blog/2009/02/ba-msn-fang-jin-maya-li-tou/</guid>
      <description>Chris Chia 在他的 blog 發表了一篇 Maya ChatWin v0.6.1 (100% Built on Python)，完成了一件非常有趣的事：在 Autodesk Maya 裏頭實作了一個 MSN 外加一個遠端的 script editor 出來。
這個 Maya ChatWin 運作起來就像 MSN，只是聯絡人清單是來自於同網段（內網）的電腦，目的…大概是讓你工作到一半有個小問題，想找人問一下時使用的吧，我想基本立意應該是這樣。它另外比較有趣的功能是，可以直接遠端傳送 mel 或 python script，所以可以做到遠端執行一些 fixing scripts 之類的。這功能目前是單向的，不過也夠應付 supporting TD 使用。
我個人覺得，MSN（或更正確一點的說法是 instant messenger）這功能要很實用，得看大家的使用情況，畢竟當你已經有一個更好用的 IM 時（ex, MSN, Pidgin, Adium, …），你並不會覺得有需要再有一個 IM。不過當這個 IM 與 remote mel/python scripting 結合時，就顯得有價值一些了。
，使用率其實不高，原因之一是我們還不是很了解怎麼好好善用這個 IM，有時亂用反而容易影響到其它人，另一方面是，有些情況還不如直接走過去當面問或聊來得好。RD/TD 對於 IM 的使用率高一些，尤其在於一些 scripting writing 或 tool 使用方法之類的，這些問題的答案常常是一兩行 commands，就很適合。
Maya 預設的 commandPort 目前只支援 mel script，所以這個 Maya ChatWin 可以支援 python script 是個非常吸引人的工作，就我所知，有不少 studio 的 TD 都非常渴望 Maya 有這個功能，相信不久的未來 Autodesk 會加入才是。</description>
    </item>
    
    <item>
      <title>pymel 讓 optionVar 用起來看起來，更像 dictionary</title>
      <link>https://drakeguan.org/blog/2009/02/pymel-rang-optionvar-yong-qi-lai-kan-qi-lai-geng-xiang-dictionary/</link>
      <pubDate>Wed, 04 Feb 2009 13:15:57 +0800</pubDate>
      
      <guid>https://drakeguan.org/blog/2009/02/pymel-rang-optionvar-yong-qi-lai-kan-qi-lai-geng-xiang-dictionary/</guid>
      <description>Maya 裏頭有個非常 high level 的 mel function: optionVar，有別於其它的 functions 的簡單與立即反應，它的目的在提供一個跟 Maya session 的設定檔的存取。換個說法，你可以在一次執行 Maya 的時候，存一個自訂的變數 IamSoHandsome，然後在下一次執行時取出來用。所以你可以把它想成是 Windows 上頭的 registry、Unix-like 下的 .ooxx 個人設定檔、或是會永續存在下去的 environment variables。
optionVar 另一個優秀的地方在於，它允許你隨時更改存下來的變數的 data type。所以你可以今天把 IamSoHandsome 宣告成一個只有 0 與 1 的 boolean，然後明天改成 “yes” 與 “no” 的 string，只要直接指定給它一個新的 data type 就做到了。如下：
optionVar -iv &amp;quot;IamSoHandsome&amp;quot; 1; ... ... optionVar -sv &amp;quot;IamSoHandsome&amp;quot; &amp;quot;yes&amp;quot;; ... ...   optionVar -sv:
 creates a new variable named using the first string with value given by the second string.</description>
    </item>
    
    <item>
      <title>Maya UI 裏的 Callback</title>
      <link>https://drakeguan.org/blog/2009/02/maya-ui-li-de-callback/</link>
      <pubDate>Wed, 04 Feb 2009 00:39:31 +0800</pubDate>
      
      <guid>https://drakeguan.org/blog/2009/02/maya-ui-li-de-callback/</guid>
      <description>GUI 是個非常偉大的發明，它讓電腦就這麼快速地滲透進家家戶戶與各大小商辦或公家機關，因為我們有 Mac OS、Windows、X Window System，再加上現下當紅的掌上型界面（iPhone、NDSL、PDS、Android）與從 web browser 裏出生的 web interface，世界就此進入資訊高科技時代，人人都會使用這些電腦設備，因為它們都提供了一套容易使用的 GUI。
我依稀記得我的第一個有 GUI 的程式，是在新竹中學的軟研社（22th招生影片）裏頭，使用 QuickBasic 呼叫底層的 VGA interrupt 來存取 video buffer，在螢幕上畫了兩個眼睛，裏頭的眼珠子會依據滑鼠游標所在的方位，往那對應的方向看過去。這隻程式除了滑鼠移動時所造成的 event 以外，就沒別的了，既沒有 button 也沒有 textField 供輸入什麼的，非常的陽春，但我寫得很愉快，這經驗一直是那麼的深刻。事實上，這經驗讓我不討厭在寫程式之餘，花點力氣刻一下 UI，要多花點時間也行。這無形中讓我不至於學到某種壞習慣：programmer 覺得 GUI 是最最討人厭與沒有用的技術。
時間拉回到進入太極影音以降。
在 Maya 裏頭，scripts 提供 GUI programming 的函式，算是進入「MFC 之前，event driven 之後」的時代。所以 Maya 提供的 control（ex, button）大都可以針對一些 event（ex, click）指定一個 callback ，寫這類的程式對於一般修讀過四年資訊課程的學生來說，不是什麼問題。
遺憾的是，Maya 的 callback 機制很原始，callback 裏頭的程式碼並不會繼承所在的 namespace（or scope）的資訊，而是在 global namespace 下執行的，拿下頭這個例子來看：
proc dgCallbackCancel() { deleteUI &amp;quot;ooxx&amp;quot;; } global proc dgShiftAnimationKeysGUI() { if(`window -exists &amp;quot;ooxx&amp;quot;`) { deleteUI &amp;quot;ooxx&amp;quot;; } string $win = `window -title &amp;quot;ooxx by Drake&amp;quot; &amp;quot;ooxx&amp;quot;`; rowColumnLayout -nc 2 -cal 1 &amp;quot;right&amp;quot; -cal 2 &amp;quot;left&amp;quot; -cw 1 100 -cw 2 200 -w 300; text -label &amp;quot;Mode : &amp;quot;; string $mode = `radioButtonGrp -nrb 2 -labelArray2 &amp;quot;All&amp;quot; &amp;quot;Selected&amp;quot; -cw2 80 80 -select 1 &amp;quot;mode&amp;quot;`; text -label &amp;quot;Frames to shift : &amp;quot;; string $shift = `textField &amp;quot;shift&amp;quot;`; button -label &amp;quot;Do It&amp;quot; -c &amp;quot;dgCallbackDoIt()&amp;quot;; button -label &amp;quot;Cancel&amp;quot; -c &amp;quot;dgCallbackCancel()&amp;quot;; showWindow(); } dgShiftAnimationKeysGUI();  兩個 button 的個別 callback functions 裏頭，為了可以順利存取到其它 control，使用了 hard-coded control name 的方式（直接假設 window name 是 &amp;ldquo;ooxx&amp;rdquo;, 另外兩個 control 分別是 &amp;ldquo;mode&amp;rdquo; 與 &amp;ldquo;shift&amp;rdquo;），另一種作法是使用全域變數的方式，直接把這些 control 的名稱存到全域變數，然後在 callback functions 裏頭使用他們。</description>
    </item>
    
    <item>
      <title>Python Puzzle</title>
      <link>https://drakeguan.org/blog/2009/01/python-puzzle/</link>
      <pubDate>Tue, 20 Jan 2009 00:43:46 +0800</pubDate>
      
      <guid>https://drakeguan.org/blog/2009/01/python-puzzle/</guid>
      <description>Interesting subsequent comparison:
&amp;gt;&amp;gt;&amp;gt; a = 1 &amp;gt;&amp;gt;&amp;gt; b = 10 &amp;gt;&amp;gt;&amp;gt; c = 100 &amp;gt;&amp;gt;&amp;gt; a &amp;lt; b &amp;lt; c True &amp;gt;&amp;gt;&amp;gt; (a &amp;lt; b) &amp;lt; c True  The following 2 code snippets are equal, which can explain why the above code works in that way.
if a &amp;lt; b &amp;lt; c: doSomething() if (a &amp;lt; b) and (b &amp;lt; c): doSomething()  How about booleans? Is True bigger than False?</description>
    </item>
    
    <item>
      <title>Delete unknown nodes in Maya</title>
      <link>https://drakeguan.org/blog/2008/12/delete-unknown-nodes-in-maya/</link>
      <pubDate>Tue, 30 Dec 2008 17:10:49 +0800</pubDate>
      
      <guid>https://drakeguan.org/blog/2008/12/delete-unknown-nodes-in-maya/</guid>
      <description>Sometimes you need to delete unknown nodes in a Maya scene. You can do it in the following python snippet.
from pymel import * def deleteUnknownNodes(): # 2 things to take care of: # 1) you can&#39;t delete nodes from references. # 2) &amp;quot;delete&amp;quot; will delete all children nodes (hierarchy) in default. unknown = ls(type=&amp;quot;unknown&amp;quot;) unknown = filter(lambda node: not node.isReferenced(), unknown) for node in unknown: if not objExists(node): continue delete(node)  Compare it to the MEL way:</description>
    </item>
    
    <item>
      <title>Nuke scripting 初體驗：Nuke &#43; Alfred</title>
      <link>https://drakeguan.org/blog/2008/12/nuke-scripting-chu-ti-yan-nuke-alfred/</link>
      <pubDate>Thu, 25 Dec 2008 18:16:24 +0800</pubDate>
      
      <guid>https://drakeguan.org/blog/2008/12/nuke-scripting-chu-ti-yan-nuke-alfred/</guid>
      <description>大約三週之前，開發 Nuke 的 The Foundry，由 CEO, Bill Collis, 偕同技術人員 Matt Plec 與兩位美麗的華裔女士來台，參與了 SIGGRAPH 2008 Taipei Chapter 的活動，會後立即趕來太極，面對太極的幾位 compositors，給了一個更加深入一點的 talk + demonstration。
Matte 就 Nuke 與 Ocula 做了不少的 demo，像是 3D scene/model/camera importing by FBX、multi-channel manipulation、customized gizmo、stereoscopic vector viewing by Ocula、stereoscopic offset、stereoscopic filein handling…其中我最感興趣的，是 Nuke 的可程式化能力。
Nuke 5 發佈的特色之一是對 Python scripting 的支援。根據我 k 了文件後的了解，幾乎所有在 Nuke 裏頭的操作，都可以使用 Python 來做到，於是乎，有很大的空間可以就「自動化」與「整合其它軟體或服務」做延伸上的開發。我對於這一點感到非常的興奮。相對於 Apple Shake 限制多多的 shake macros 與我們一直無緣拿到手的 Shake SDK，Nuke 對 programmer 實在友善太多了。
我立即寫了個 python script，做了點設定上的調整，在 Nuke 上頭多新增了一個 Digimax 的 menu，然後裏頭有個 Submit To Render Farm 的功能。目的是透過它來產生一個 alfscript 來，然後呼叫 alfred 把 nuke rendering 給送進 render farm。</description>
    </item>
    
    <item>
      <title>活躍於 3D 軟體之間的程式語言：Python</title>
      <link>https://drakeguan.org/blog/2008/12/huo-yue-yu-3d-ruan-ti-zhi-jian-de-cheng-shi-yu-yan-python/</link>
      <pubDate>Wed, 17 Dec 2008 23:53:24 +0800</pubDate>
      
      <guid>https://drakeguan.org/blog/2008/12/huo-yue-yu-3d-ruan-ti-zhi-jian-de-cheng-shi-yu-yan-python/</guid>
      <description>Guido van Rossum 於 1991 年創造出 Python 這個 scripting language 時，應該是沒有料想到它的風行全球，更不可能會猜到 3D 軟體產業是多麼的愛戴這個語言：
 Maya 在被 Autodesk 併購了後，於 2007 年年初釋出了 8.5 版，支援 Python 的環境。 相傳，原本和 Maya 拼得你死我活的 Softimage （不過現在和 Maya 成了親家了@@ 還真的是世事難料呀~）也早就有了 Python 的 binding。 台灣新聞台的最愛 Poser 軟體，2000 的 4.0 版支援 Python。 特效軟體界的傳說 Houdini（也是目前我知道最貴的軟體之一，不過據說 Massive 更貴 @@）於 2007 年投入 Python 的懷抱。 流體模擬（Fluid &amp;amp; Dynamic Simulation）界的第一把交椅 RealFlow 也在最近發表的 RF4 (?) 新增了對 Python 的支援。 因為與 Peter Jackson 的魔戒合作下問世的 Massive，一樣有提供 Python（不過也一樣是有 TCL）。 趁著被 Apple 收購的 Shake 不會有下一版，然後挾天子以令諸侯（啊，不是，是有 Digital Domain 當靠山）的 Nuke ，在今年（2008）推出 5.</description>
    </item>
    
    <item>
      <title>How do I determine which Shading Group is associated with a Material?</title>
      <link>https://drakeguan.org/blog/2008/11/how-do-i-determine-which-shading-group-is-associated-with-a-material/</link>
      <pubDate>Tue, 11 Nov 2008 19:07:44 +0800</pubDate>
      
      <guid>https://drakeguan.org/blog/2008/11/how-do-i-determine-which-shading-group-is-associated-with-a-material/</guid>
      <description>Pymel solution:
def getSGFromMaterial(mat): mat = PyNode(mat) return mat.shadingGroups()  The following is the original article and mel codes by Bryan Ewert.
To determine which Material is associated to a Shading Group, get a list of all connection from the Material’s “.outColor” attribute. Iterate this array to find all Shading Groups. The 『nodeType』 command will identify a Shading Group with the string “shadingEngine”.
// //////////////////////////////////////////////////////////////////// // getSGFromMaterial // // Description: Returns the Shading Group set whose &#39;.</description>
    </item>
    
    <item>
      <title>Cancellation Error</title>
      <link>https://drakeguan.org/blog/2008/10/cancellation-error/</link>
      <pubDate>Thu, 02 Oct 2008 00:36:44 +0800</pubDate>
      
      <guid>https://drakeguan.org/blog/2008/10/cancellation-error/</guid>
      <description>今天聽莊永裕教授的 Digital Image Synthesis 課時，聽到一個 Cancellation Error 的東西，是個與 IEEE floating point 有關的「數值計算問題」。
投影片上如是說：
 Cancellation error: devastating loss of precision when small numbers are computed from large numbers by addition or subtraction.
 寫了個簡單的 c 程式親身試驗一下。
void main(){ double x1 = 10.000000000000004; double x2 = 10.000000000000000; double y1 = 10.00000000000004; double y2 = 10.00000000000000; double z = (y1-y2)/(x1-x2); printf(&amp;quot;%f\n&amp;quot;, z); } // output: // # 11.500000  接著我在想，Python 會不會有這個問題呢? 結果試了一下…一樣!! 看來 CPython 的 number 這個 type 真的是用 double 實作的 :o</description>
    </item>
    
    <item>
      <title>How can I check if an objects attributes are connected?</title>
      <link>https://drakeguan.org/blog/2008/07/how-can-i-check-if-an-objects-attributes-are-connected/</link>
      <pubDate>Sun, 06 Jul 2008 16:28:20 +0800</pubDate>
      
      <guid>https://drakeguan.org/blog/2008/07/how-can-i-check-if-an-objects-attributes-are-connected/</guid>
      <description>Quick Answer:
from pymel import * # Is the object.attr a source of a connection? len(object.tx.inputs()) &amp;gt; 0 # Is the object.attr the destination of a connection? len(object.tx.outputs()) &amp;gt; 0 # List an object.attr&#39;s source connection, meaning, list the input connection. # This will return a single object.attr. object.tx.inputs() # List an object.attr&#39;s destination connection, meaning, list the all output connections: # This could return multiple object.attrs. object.tx.outputs() # In other words, you can just use inputs() and outputs() to get if there is a connection # (source or destination), how many connections there are, and what they are!</description>
    </item>
    
    <item>
      <title>How to retrieve lights from the selected nodes?</title>
      <link>https://drakeguan.org/blog/2008/06/how-to-retrieve-lights-from-the-selected-nodes/</link>
      <pubDate>Thu, 26 Jun 2008 14:53:48 +0800</pubDate>
      
      <guid>https://drakeguan.org/blog/2008/06/how-to-retrieve-lights-from-the-selected-nodes/</guid>
      <description>The quick answer is as below:
from pymel import * filter( lambda n: &#39;light&#39; in n.classification(), ls(sl=True, dag=True, leaf=True))  In pymel’s google group, there are 2 people giving different opinions for this and the following are from their post:
take out the ‘sl=True’ by using pymel’s “selected()” function by Ofer Koren
from pymel import * filter( lambda n: &#39;light&#39; in n.classification(), selected(dag=True, leaf=True))  Doing it through the API requires more code but is considerably faster by Dean Edmonds</description>
    </item>
    
    <item>
      <title>Python 歷史書·GUI 部</title>
      <link>https://drakeguan.org/blog/2007/05/python-li-shi-shu-gui-bu/</link>
      <pubDate>Thu, 17 May 2007 23:53:13 +0800</pubDate>
      
      <guid>https://drakeguan.org/blog/2007/05/python-li-shi-shu-gui-bu/</guid>
      <description>話說在前頭，這是一篇非常的無聊，可以被當作火星文的 blog，所以如果你是來看裸女或 3D/CG 的，請離開吧…
原文
2007 年, 遊俠沈崴經過 Python 在 Mangbar 的營地, 賢者 Tomz 和 Andelf 邀請他向眾人敘說他在各地的見聞, 於是便有了這本歷史書。
第一章、世界的形成 初, 只是一片混沌。大師圖靈沉睡在這片漫無邊際的黑暗中。先知書《編程之道》說, 有一天, 大師夢見自己變成了一台機器, 渾然不知是機器夢見了自己還是自己夢見了機器。他醒來, 天地就分開了。無數巨大的計算機從天而降, 秩序由此建立。
過了一千年, 第一批人類從原始的混沌之夢中醒來。沒有人知道大師的去處, 他們好奇地圍繞在那些巨大的機器周圍, 他們相信這些機器是世界秩序的源泉並奉之為神明。太古的機器也許諾給他們無窮的力量, 幫助他們把世界變得更為繁榮。
第二章、諸神的黃昏 百年後, 當世界變得足夠繁榮的時候, 那些來自於遠古的巨大機器就離開了。這時第二批人類才從混沌中醒來, 他們對過去一無所知, 以為這個世界本應如此。他們用泥土和金屬塑造了自己的偶像, 取名微機, 並頂禮膜拜。
們對微機的狂熱, 讓最初的聖人們非常憂慮, 又感到無能為力。在意識到人類將不可避免地滑向混亂的深淵之後, 他們建立了自己的神殿, 將最後的信仰和古老的力量保護起來。異教徒嘲笑他們, 並向他們發動了聖戰。那些異教徒人數眾多, 守衛陣營也發生了叛變和分裂, 聖人們不能抵抗, 他們離開神殿, 在世界各地建立了諸多被稱為學院的據點, 來自於太古的神聖力量在那裡得以保存下來。
後, 在人類的狂熱中, 世界經歷了一段混亂不堪的歷史, 在戰火中誕生了許多人類最為古老的王國。一切都平靜下來, 世界被微機統治。但是先知不屑地說, 世界其實仍然運轉在太古的神力之下, 人類被自己的幻覺所欺騙。在合適的時候, 諸神會回來修復大地的傷痕。
第三章、新大陸的誕生 過了八十年, 關於新大陸的傳言開始流傳。兩年後, 學院 MIT 開始向海外探險, 他們最終發現了一塊全新的大陸。這是一塊神秘的未知之地, 所以他們把它命名為 X。不久之後, 貪婪的人類蜂擁而至, 傳說在那裡他們看到了巨大的彩色雲彩, 於是, 人們將新大陸重新命名為 GUI。</description>
    </item>
    
    <item>
      <title>Maya8.5 出了</title>
      <link>https://drakeguan.org/blog/2007/01/maya8-5-chu-le/</link>
      <pubDate>Mon, 22 Jan 2007 23:28:33 +0800</pubDate>
      
      <guid>https://drakeguan.org/blog/2007/01/maya8-5-chu-le/</guid>
      <description>剛剛得知的消息。

對於我這個 TD，最興奮的就是看到以下兩點：
一、Script Editor 出新版了。新版的 Editor 看起來還真是漂亮，希望真的能很好用。
二、除了內見的 MEL（Maya Embedded Language），現在多了 Python 了。感覺這玩意兒和 cgkit 很像，不過無所謂，反正本來 Python 就是個好東西，而 cgkit 又真的整合得很好。（小道消息指出，再一個多月就會進我們公司的一位外國人，他就是使用 python 來做他的 3D/CG 專案的）
Maya 8.5 的官方消息與 pdf 說明檔。
突然想到，根據 Pzman 的說法，它現在的 3D Text 也可以使用中文了，不曉得在 Linux 下是不是用起來也很順利 :D:D</description>
    </item>
    
    <item>
      <title>Python 官網上頭的 Quotes</title>
      <link>https://drakeguan.org/blog/2006/12/python-guan-wang-shang-tou-de-quotes/</link>
      <pubDate>Sat, 02 Dec 2006 18:10:06 +0800</pubDate>
      
      <guid>https://drakeguan.org/blog/2006/12/python-guan-wang-shang-tou-de-quotes/</guid>
      <description>最近，迷上了 Python 這個綜合了 scripting language, object-oriented programming language, dynamic programming language 的程式語言。為此，還拿出大學時期的 programming language 教科書來查閱有關 functional programming 的重點為何，順道了解一下大學同學 cklin 當初為何會這麼推崇 erlang。心得是：大學時，真是不懂事，竟然不曉得有這種可以大大改變寫程式方式與想法的東西，有種「現在才開始了解 computer science 的感覺」。
Python 官網上頭的 Quotes，節取了一些商業公司的人，在使用了 Python 後的心得（一般來說，比較常看到用 Testimonial 而不是 Quote），我挑了幾家我聽過的，而且也是我關心的公司，把它們的 quotes 列出來：
 Industrial Light &amp;amp; Magic     &amp;ldquo;Python plays a key role in our production pipeline. Without it a project the size of Star Wars: Episode II would have been very difficult to pull off.</description>
    </item>
    
  </channel>
</rss>
