━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ◇ - ◇ - ◇ - ◇ - 3. Shadeスクリプト部 ◇ - ◇ - ◇ - ◇ - ◇ - ◇ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 押忍!タルタルです。今回もスクリプトの文法はとりあえずスッ飛ばしてより 実践的な空手を、否!スクリプトを紹介します! 押忍! 今回はShadeのルートパート以下のパート/形状のshapeオブジェクトを取得し てみます。 --ここから act_shapes = xshade.scene().active_shapes act_shape = xshade.scene().active_shape() root_shape = xshade.scene().shape def get_sons(S): if S.number_of_sons: Sons = [""] * S.number_of_sons Sons[0] = S.son.bro for i in range(1, S.number_of_sons): Sons[i] = Sons[i-1].bro return Sons def get_sonses(S): Sonses = [] Sons = get_sons(S) for i in Sons: Sonses.append(i) if i.has_son: Sonses = Sonses + get_sonses(i) return Sonses Sonses = get_sonses(root_shape) print Sonses --ここまで 機能: ルートパート以下のパート/形状のshapeオブジェクトをメッセージウィンドウ に表示します。 説明: このスクリプトを使う事により、ルートパート以下のshapeオブジェクトをリス トとして取得することが出来ます。あとはそのリストに対してpythonのfilter やmapを使って、特定の条件の形状やパートを抽出したり、編集をしたり、いろ いろ応用することが出来ます。 動作環境: 本スクリプトは以下の環境での動作を確認しています。 Shade 8.5 for Mac OS X Shade 8.5 for Windows それでは失礼します。押忍! 【タルタル】