sexta-feira, 13 de dezembro de 2019

system manager tools

SYSTEM-MANAGER-tools!!WIP--> dependence "HTOP" "NVIDIA-SMI
compile with : g++ watchNV.cpp -o watchNV



Code :
       


#include <stdlib.h>
#include <math.h>
#include <iostream>



int main(int argc , char* argv[])
{
        std::cout << "watch system START" << std::endl;
        system("gnome-terminal --geometry='85x25+0+8000' -e 'watch -n 1 nvidia-smi' ");
        system("gnome-terminal --geometry='85x25+0+0' -e 'htop' ");
        std::cout << "watch system OVER" << std::endl;

        return 0;


}



       
 






sexta-feira, 6 de setembro de 2019

Archive tool

ARCHIVE WIP !!WIP



Code :
       




import os
import hou



#Get HIP
hipdir = hou.expandString("$HIP")
#Get frame range 
totalFrameRange = 50000

# check if it is in Project Path
def isInProjectPath(projPath , filePath ):
    absProject = os.path.abspath(projPath)
    absFilePath = os.path.abspath(filePath)    
    return os.path.commonprefix([absProject,absFilePath])==absProject



# run my custom prefligth
def chrysl666_PF():
    
    #empty list
    compressList = []
    messages = ""
    
    # list all parm and paths
    for parm , path in hou.fileReferences():
        
        #expand path to absolute paths in all frames
        for i in range(totalFrameRange):
            try:
                filePath = parm.evalAsStringAtFrame(i)
            
                
                #check if file  is inside Main Project
                if not isInProjectPath(hipdir, filePath):
                    messages += (  "---->filePath = "+filePath + " is not in $HIP\n" )
                    
                    break
                
                #check if exists in disk
                if(os.path.exists(filePath) == True ):
                    # if True add into the list
                    compressList.append(filePath)
            except:
                pass
                
    # remove duplicate paths from list
    compressList = list(dict.fromkeys(compressList))
    # sort
    compressList.sort()
    
    #not used 
    #for each in  compressList:
    #    print each + "\n"
    
    if(messages>1):
        hou.ui.displayMessage( messages , title ="NOT IN THE PROJECT PATH")
    return  compressList
    

    
    # ARCHIVE FUNC
def archive(list):
    from zipfile import ZipFile
    import os
    
        # gets scene file
    scene = hou.expandString("$HIPFILE")
    sceneName = hou.expandString("$HIPNAME")
    
    # gets HIP Projct folder
    hipdir = hou.expandString("$HIP")
    
    zipNameAndPath = os.path.join(hipdir,sceneName)+".zip"
    
    # opens zip to write
    
    finalZip = ZipFile(zipNameAndPath,"w")
    
    
    # write dependence files
    finalZip.write(scene)
    for each in list:
        finalZip.write(each)
    
    # closes zip    
    finalZip.close()
    hou.ui.displayMessage(zipNameAndPath , title = "DONE")

    
archive(chrysl666_PF())






       
 






domingo, 1 de setembro de 2019

Animated Network Background Image

I created a little script to update Network Background images
using houdini`s timeline callback , just create a new shelf tool and copy and paste my code
this tool works as toggle mode . click to activate , click again to deactivate

Code :
       




import hou 
chrysl666BG_padding = 0 

#CREATE BG
def updateBG(event_type,frame):
    #create initial vars 
    imagePath=""
    strFrame = str(frame)

    
    #get editor and BGimage infos
    editorHolder = hou.ui.paneTabOfType(hou.paneTabType.NetworkEditor)
    BGLIST = editorHolder.backgroundImages()
    
    #if BG image is not created  -- do create
    if(len(BGLIST) < 1 ):
        #start holders
        imageHolder = hou.NetworkImage()
        imagePath = hou.ui.selectFile(start_directory="HIP" , title = "SELECT FRAMES ")
        # check padzeros
        pathParse = imagePath.rsplit(".",2)        
        if( len(pathParse[1]) > 2 ):
            global chrysl666BG_padding
            chrysl666BG_padding  = int(pathParse[1][2])
            strFrame = str(frame).zfill(chrysl666BG_padding) # apply padding
        # build path string 
        newPath = pathParse[0]+"."+strFrame+"."+pathParse[2]
        # apply Background Image 
        imageHolder.setPath(newPath)
        imageHolder.setRect(hou.BoundingRect(0, 0, 5, 5))
        editorHolder.setBackgroundImages([imageHolder])
    else: # BG image is already created 
        #starts holders
        imageHolder = BGLIST[0]
        imagePath = imageHolder.path()
        #chack padzeros
        pathParse = imagePath.rsplit(".",2)
        #padding  = len(pathParse[1])
        global chrysl666BG_padding
        strFrame = str(frame).zfill(chrysl666BG_padding) # apply padding
        # build path string 
        newPath = pathParse[0]+"."+strFrame+"."+pathParse[2]
        # apply Background Image 
        imageHolder.setPath(newPath)
        editorHolder.setBackgroundImages([imageHolder])
        

#check for playbar events when tool is clicked 
events =  hou.playbar.eventCallbacks() 
if(len(events) <1):
    #if not events, create it
    updateBG(0,hou.intFrame())
    hou.ui.displayMessage("BG IMAGE CREATED")
    hou.playbar.addEventCallback(updateBG)
else:
    # events exist  delete it
    hou.playbar.clearEventCallbacks()   
    hou.ui.displayMessage("BG IMAGE EVENT DELETED")






       
 






sábado, 27 de abril de 2019

quinta-feira, 24 de janeiro de 2019

using GCC 6.3 in Centos 7 -- HOUDINI HDK

Centos7 comes with gcc 4.8
but Houdini 17 needs gcc 6.3 at least

so you need install a update version
and left old version only for the system general uses
you will need  SCL package manager  and GCC 6.3 dev toolset

Write down in terminal :

sudo yum -y install centos-release-scl
sudo yum -y install devtoolset-6

then to compiling using hcustom and this new dev toolset
just send commands by scl
lets go compile geoisosphere from HDK samples :

scl enable devtoolset-6 "hcustom -s geoisosurface.C"

output :

Making geoisosurface.o from geoisosurface.C
Making ./geoisosurface from geoisosurface.o
g++ geoisosurface.o -lpthread -o ./geoisosurface -L /opt/hfs17.0.352/dsolib -lHoudiniUI -lHoudiniOPZ -lHoudiniOP4 -lHoudiniUSD -lHoudiniOP3 -lHoudiniOP2 -lHoudiniOP1 -lHoudiniSIM -lHoudiniGEO -lHoudiniPRM -lHoudiniUT -lhboost_system -L/usr/X11R6/lib64 -L/usr/X11R6/lib -lGL -lX11 -lXext -lXi -ldl -Wl,-rpath,/opt/hfs17.0.352/dsolib


done!