FX_tool for Hython Basic01


`Create_Houdini_tools`

:version Houdini 15.5.673

---
Pythonで自分用にカスタマイズしたtoolを使用して
作業効率をグンっとあげたい1~2年のJunior Artist(僕みたいな人)や
ベテランPythonistaに色々と聞く前にHoudiniを通してとりあえずPython勉強したい人向けです。
:Shareしているscriptはtestで作成していたモノなので自分都合でガンガン変えちゃってください。

---


**`Empty GeometryNodeを作成する`**



![Add_work.PNG](https://qiita-image-store.s3.amazonaws.com/0/179218/5f6f311f-1b9a-e95b-2985-f6a481f4fa03.png)


```

#=== UI function ===#
getp = hou.ui.paneTabOfType(hou.paneTabType.NetworkEditor);

pos = getp.selectPosition();

#=== obj class===#
obj = hou.node("/obj");

# Create OBJ node
geo = obj.createNode("geo","FXwork",0);

#SetColor
geoCol = hou.Color((0.0,0.533,0.0));
geo.setColor(geoCol);

#Set position
geo.setPosition(pos);

```


:Render tabは考慮されません(削除してます)

---

**`.abcを.bgeo_Cacheにするasset`**


![Cache_Publish.PNG](https://qiita-image-store.s3.amazonaws.com/0/179218/48d976d0-4624-6b27-118a-240654090443.png)


```
#===== UI Function =====#
getp = hou.ui.paneTabOfType(hou.paneTabType.NetworkEditor);

pos = getp.selectPosition();


#===== OBJ Class =====#
obj = hou.node("/obj");

geo = obj.createNode("geo","Cache_Publish",0);

#Node Color
geoCol = hou.Color((0.0,0,6,0.6));
geo.setColor(geoCol);

#Set Position
geo.setPosition(pos);

#===== Sop Class =====#
#Get Sop Path
soppath =geo.path();
print soppath;

#Get  Sop node
sop = hou.node(soppath);

#Create Node Object Merge
imprt= sop.createNode("object_merge","Import_Geo");

#==== Edit parameters===#
imprt_parm = imprt.parm("xformtype");

imprt_parm.set(1);



#Create Node unpack
unpack = imprt.createOutputNode("unpack");


#=== Edit parameters ===#

unpackparm = unpack.parm("transfer_attributes");

unpackparm.set("*");




#Create Node filecache
filecache = unpack.createOutputNode("filecache","customName");


#=== Edit Parameter ===#

cache_parm01 = filecache.parm("loadfromdisk");

cache_parm01.set = (1);

#Edit path

cache_parm02 = filecache.parm("file");

cache_parm02.set("$HIP/geo/$OS/$OS.$F.bgeo.sc");


#Create Node  Null

null = filecache.createOutputNode("null","OUT");

```
---

**`SHOPnetworkを作成する`**

![SHOP_net.PNG](https://qiita-image-store.s3.amazonaws.com/0/179218/f09e23c4-b224-24e2-2661-c9f314ca4b04.png)


```

#Set UI function
setp = hou.ui.paneTabOfType(hou.paneTabType.NetworkEditor);
uiP = setp.selectPosition();

#/obj directory ffunction#
obj = hou.node("/obj");

work = obj.createNode("shopnet","SHOP",0);


work.setPosition(uiP);
#parent path is here
objpath =work.path();

#Def Color
defcol = hou.Color((1.0,0.8,0));

work.setColor(defcol);

```
---

**`Shader_Builderを作成する`**

![Shader_Bilder.PNG](https://qiita-image-store.s3.amazonaws.com/0/179218/bee85d79-4805-366b-c423-83bfcc3e8749.png)

```

#error function 
#error picker dialog
select = hou.selectedNodes()

if len(select)!=0:
   hou.ui.displayMessage('-userGuide-\n ============\
   \nSimple Material Builder\n ============',title= 'dialogMessage');
   node = select[0].path()
   print 'nodepath=='+ node
   
else:
   hou.ui.displayMessage('-User Support-\nSelect ShaderNetwork\n\
   ============\nSample...\n Shopnet = SHOP\n SHOP = ShaderNetwork\n\n\
   ============',title= 'dialogMessage');
#Function Select is End

userpath = node;


#Set UI function

shop = hou.node(userpath);

builder = shop.createNode("vopmaterial","ShaderBuilder");

builder.moveToGoodPosition()


#Finish Function


hou.ui.displayMessage("Sucess!!!");

```

:Popup_Windowを使用してます。

---

**`ROPnetworkを作成する`**


![ROP_net.PNG](https://qiita-image-store.s3.amazonaws.com/0/179218/82cb193a-de20-57f5-995c-d78d482e337c.png)


```

#Set UI function
setp = hou.ui.paneTabOfType(hou.paneTabType.NetworkEditor);
uiP = setp.selectPosition();

#/obj directory ffunction#
obj = hou.node("/obj");

work = obj.createNode("ropnet","ROP",0);


work.setPosition(uiP);
#parent path is here
objpath =work.path();

#Def Color
defcol = hou.Color((1.0,0,0.5));

work.setColor(defcol);

```

---

**`MantraNodeを作成する`**


![mantra.PNG](https://qiita-image-store.s3.amazonaws.com/0/179218/a2fc1f9c-ff1f-a143-79d6-b1a8904cd0ec.png)


```

#error function 
#error picker dialog
select = hou.selectedNodes()

if len(select)!=0:
   hou.ui.displayMessage('-userGuide-\n ============\
   \nSimple Mantra_node\n ============',title= 'dialogMessage');
   path= select[0].path()
   print path
else:
   hou.ui.displayMessage('-User Support-\nSelect RenderGeometry\n\
   ============\nSample...\n Add MantraNode\n Create SelectGeometry\n\n\
   ============',title= 'dialogMessage');


#Function Select is End

if len(select)!=0:
                 text = hou.ui.readInput(message = "-userGuide-\n==============\nMantraNode_Name\
\n==============\n-typeHere-\n",);
else:
     none;

typename = text[1];



userPath =(path);


rop = hou.node(userPath);

mantra = rop.createNode("ifd");

mantra.setName(typename,0)

mantra.moveToGoodPosition();

```
:Popup_Windowを使用してます。

---

Python書籍やHelpと照らし合わせながら
自分なりに使いやすいToolをガンガン作って楽しましょう