魔法のメモ

CG N GAME BLOG

2021-06-01から1ヶ月間の記事一覧

Python_基本ルールb

■変数 ●入れ物 x ='バナナ' print(x) ■型 バナナは文字列 2021は整数型

Python_基本ルールa

■コードが長くなったら print(100 +200 + \ 100 +5) ■コメント ●一行:#コメント ●二行: """ コメント 二行目コメント あいうえお """ ■インデント #半角スペースx4 orタブをつける def test (): print('あいうえお') print('かきくけこ')

Python_17.エラー

#SyntaxError :文法間違い #NameError :定義し忘れ、スペルミス #AttributeError :オブジェクトが持っていない属性を使用しちゃった a =(1,2,3) a.append(4) #TypeError :誤ったデータ型どうしで起こるエラーとか?計算とか #ValueError :データ型はあってい…

Python_16.ライブラリ/Datetime , Pandas

import datetime today = datetime.date.today() datetime.datetime.now() datetime.datetime(2021, 6, 29, 0, 56, 53, 636589) today.month 6 today-datetime.timedelta(days=1) datetime.date(2021, 6, 27) today.strftime('%Y年%m月%d日') #stringfortime…

Python_16.クラス

class Person: def __init__(self,name,nationality,age): self.name=name self.nationality= nationality self.age= age def __call__(self,name): print(f'{name}さん、こんにちわ。私は{self.name}です。call関数から呼び出されています。') def say_hell…

Python_15.参考

www.youtube.com

Python_15.速習_関数

def say_hello(): print('皆さん、こんにちわ') say_hello() 皆さん、こんにちわ def say_hello2(name): print(f'{name}さん、こんにちわ') say_hello2(name='ランディー') ランディーさん、こんにちわ def calc_square(side): return side*side result=calc…

Python_15.速習_break文、continue文(for 文)

#break文(繰り返しを辞めたい場合) #continue文(スキップしたい場合) for i in range(10): if i==7: break print(i) 0 1 2 3 for i in range(10): if i==7: continue print(i) 0 1 2 3 4 5 6 7 8 9 コードテキスト

Python_15.速習_Zip関数、Enumerate関数(for 文)

last_names =['五十嵐','五条','掛布','ランディー','岡田'] middle_names =['TT','ジョー','タイガー','龍','aka'] first_names =['たけし','悟','ひろし','バース','譲司'] for last_name,middle_name,first_name in zip(last_names,middle_names,first_na…

Python_15.速習_繰り返し処理(for 文)

iはindex (英語はnとかでも大丈夫) names=['佐藤','井田','掛布','バース','岡田','阿部','武田'] #print(names[0]+'さん') #print(names[1]+'さん') #面倒くさい、、、 len(names) #namesの長さ 7 for i in range (len(names)): print(names[i]+'さん') 佐…

Python_15.速習_if文

money = 3000 if money >= 8000: print('映画館へ行く') else: print('映画館には行かない') 映画館には行かない money = 1000 if money >= 8000: print('ディズニーへ行く') elif money >=2000: print('映画館に行きます') elif money ==1000: print('ちょ…

Python_15.速習_辞書

scores=[40,90,80,80,70] scores={'国語':40, '数学':90, '英語':80, '理科':80, '社会':70 } print(scores) scores['国語'] scores['家庭科'] =100 scores['体育'] =10 print(scores) scores.pop('体育') scores {'国語': 40, '数学': 90, '英語': 80, '理…

Python_15.速習_リスト

〇リスト ■ names=['おしるこ','グーグル','ブック','あなご'] print(names[1]) print(names[0]) print(names[-1]) print(names[0:3]) # 3(あなご)の一つ前から取得する print(names) print(names[:]) print(names[:2]) print(names[1:]) グーグル おしるこ …

Python_15.速習_比較演算子

〇比較演算子 ■10%3 #10割る3は余り1 1 ■3**3 #3の3乗 27 ■#変数 #大文字、小文字は区別される #数字、一部の記号は先頭の文字にできない#01moji#\moji #予約語は使用できない#and#True など既にPythonで使用されてる文字 #命名規則#my_name #famousu_city…

Python_14.GUI_TKinter

https://flytech.work/blog/16310/#i-2

Python_14.GUI_pysimplegui

Python_13.△コンポーネントに指定したテクスチャの挿入

# -*- coding: utf-8 -*- import engine.cmds as cmds path= 'systems/rendering/12_vosselaar_house_living.dds'; asset= cmds.findAsset( path ); go= cmds.createGameObject('IBL'); ibl= cmds.addComponent(go, 'IBL'); if asset!= None:ibl.IBLTextureR…

Python_12.名前変更

# -*- coding: utf-8 -*- import engine.cmds as cmds # create object hero = cmds.createGameObject('hero'); # set value (direct) hero.Name = 'herohero' #これは後述で上書きされる # set value (use method) hero.SetPropertyValue('Name', 'herohero…

Python_11.コンポーネントの一覧表示

# -*- coding: utf-8 -*- import engine.cmds as cmds # you can get creatable component name list # componentNames = cmds.getComponentNames(); # print component names cmds.printComponents();

Python_10.コンポーネントのRemove

# -*- coding: utf-8 -*- import engine.cmds as cmds # create game go = cmds.createGameObject('GameObject'); # add Component primitive = cmds.addComponent(go, "Primitive"); mesh = cmds.addComponent(go, "Mesh"); # remove Component cmds.delete…

Python_9.オブジェクトのDelete

# -*- coding: utf-8 -*- import engine.cmds as cmds # create game object parent = cmds.createGameObject( 'Parent' ) parent.Transform.LocalPosition = vec3(10, 20, 30) parent.Transform.LocalScale = vec3(1, 2, 3) # delete game object cmds.dele…

Python_8.タイプ、ネーム、パスの取得

# -*- coding: utf-8 -*- import engine.cmds as cmds import engine.wpf as wpf texture = cmds.findAsset( 'assets:/systems/rendering/ColorCubeLinear.dds' ) behavior = cmds.findAsset( 'assets:/systems/script/Behavior.template.cs' ) print textur…

Python_7.位置、回転、大きさ

#-*- coding: utf-8 -*- import engine.cmds as cmds import engine.wpf as wpf from via import vec3 from via import Color # write your code here parent = cmds.createGameObject( 'Parent' ) parent.Transform.LocalPosition = vec3(10, 20, 30) paren…

Houdini_APIに関して

qiita.com

Python_UE4_Unrealとの連携

Python_6.Prefabとして保存する

# -*- coding: utf-8 -*- import engine.cmds as cmds obj = cmds.createGameObject('PrefabSample') path = 'Test/Section/VFX/名前' cmds.toPrefab(obj, path) -- ■Test/Section/VFX/名前 assets:/Test/Section/VFX/名前 ←でもOK ※フォルダは事前に作して…

Python_5.子GameObjectの作成

# -*- coding: utf-8 -*- import engine.cmds as cmds ​ parentGO = cmds.createGameObject('ParentObject') childGO = cmds.createGameObject('ChildObject', parentGO) -- ■createGameObjectコマンドの第二引数に親GameObjectを指定することで、その子Game…

Python_4.Componentを追加

# -*- coding: utf-8 -*- import engine.cmds as cmds ​ go = cmds.createGameObject('addMesh') cmds.addComponent(go, 'Mesh') -- ■go = cmds.createGameObject('addMesh') createGameObjectマクロコマンドの第一引数で生成するGameObjectの名前を設定 ■cm…

Python_3.GameObjectのプロパティを知るには

#-*- coding: utf-8 -*- import engine.cmds as cmds ​ go = cmds.createGameObject() print go.Properties -- ■GameObjectのTransformにアクセスしたい場合は以下のように書く go.Transform ■Transformのプロパティを知りたい場合 print go.Transform.Prope…

Python_2.生成したGameObjectを編集する

#-*- coding: utf-8 -*-import engine.cmds as cmdstest = cmds.createGameObject()test.Name = 'Homehome' ■test = cmds.createGameObject() ソースコードを次のように書き換えることで、生成されたGameObjectを取得することができます。 testは変数です。 …