[PYTHON] FX_tool for Hython Basic01

Create_Houdini_tools

:version Houdini 15.5.673


Using a tool customized for myself in Python Junior Artist (a person like me) for 1 to 2 years who wants to improve work efficiency For those who want to study Python for the time being through Houdini before asking veteran Pythonista a lot. : The shared script is the one created by test, so please change it for your own convenience.


** ʻCreate an Empty Geometry Node` **

Add_work.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 is not considered (deleted)


** Make .abc .bgeo_Cache asset **

Cache_Publish.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");


** Create a SHOP network **

SHOP_net.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);


** Create Shader_Builder **

Shader_Bilder.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!!!");

I'm using: Popup_Window.


** Create a ROP network **

ROP_net.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);


** Create a MantraNode **

mantra.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();

I'm using: Popup_Window.


In light of Python books and Help Let's enjoy making a tool that is easy for you to use

Recommended Posts

FX_tool for Hython Basic02
FX_tool for Hython Basic01
Basic Python grammar for beginners
Basic commands for file operations
Basic syntax notes for shell script
Linux Basic Education for Front-end Engineer
Basic policy for searching for mahjong tiles
Elasticsearch installation and basic operation for ubuntu
Linux operation for beginners Basic command summary
(For myself) Django_1 (Basic / Hello World / Template)
JupyterLab Basic Setting 2 (pip) for data analysis
JupyterLab Basic Setup for Data Analysis (pip)