Ejemplo n.º 1
0
    def saveAllSet(self):
        self.reloadFatherInfo()

        #self.inSelectIndexArr   =[]
        #self.outSelectIndexArr  =[]
        #data file Path
        fileDataPath =WritePrefPath +nodeClass+"\\button\\"+"button_"+str(self.inSelectIndexArr[-1]) +".data"
        fileFatherButtonNumPath = WritePrefPath +nodeClass+"\\button\\"+"fatherButtonNum.dat"
        f1 = open(fileDataPath,"r")
        tempArr = f1.readlines()
        if  len(tempArr)< 30:
            for i in range(20):
                tempArr.append("\n")
        f1.close()
        PythonName =self.addItem_childrenNewName.currentText()
        IconName =self.addItem_childrenIconClass.currentText() + "/"+ self.addItem_ChildrenIconName.currentText()
        fatherName =self.addItem_Father.currentText()
        fatherIconName =self.addItem_FatherIcon.currentText() +"/"+self.addItem_FatherIconName.currentText()
        fatherCurrentIndex = str(self.slider_insideIndex.value())
        childCurrentIndex =str(self.slider_outSideIndex.value())

        f2= open(fileDataPath,"w")
        f2Index =-1
        for i in tempArr:
            f2Index+=1
            changeLine =i
            if i.split("=")[0] ==  "lab_"+str(self.outSelectIndexArr[-1]):
                changeLine = "lab_"+str(self.outSelectIndexArr[-1])+"="+PythonName+"="+IconName+"\n"
            if i.split("=")[0] == "fatherLab":
                changeLine ="fatherLab="+fatherName+"="+fatherIconName+"\n"
            if i.split("=")[0] == "childLabNumber":
                changeLine = "childLabNumber="+childCurrentIndex+"\n"
            if i == "\n":
                changeLine = "lab_"+str(f2Index-2)+"="+"smile"+"="+"COMMON/delete"+"\n"
            f2.write(changeLine)
        f2.close()

        #####write fatherButtonNum file
        f3 =open(fileFatherButtonNumPath,"w")
        f3.write("fatherButtonNum="+fatherCurrentIndex+"\n")

        f3.close()

        ############### updata init set
        s_button = s_GetButton.getButton(nodeClass)
        fatherNumer = s_button.getFatherButtonNum()

        self.update()
Ejemplo n.º 2
0
s_houdiniEnvenPaths = s_GetHoudiniEnvenPath.readHoudiniEnv().read()
for s_childEnvPath in s_houdiniEnvenPaths:
    a= s_childEnvPath.split(" = ")[-1].split("\n")[0]
    sys.path.append(a)

#readFile
def selectClassButuonClass():
    a = hou.ui.curDesktop()
    pane = a.paneUnderCursor()
    currentTab = pane.currentTab()
    name = currentTab.type().name()
    return name

houdiniHotPathIconPath = sysPath+"/Icon/"

s_button= s_GetButton.getButton(selectClassButuonClass())
fatherNumer = s_button.getFatherButtonNum()

color= s_GetColor.getColor()
shape= s_GetShape.getShape()
#Calculating angle
def getangle(a,b):
    lenA= math.sqrt(a[0]*a[0]+a[1]*a[1])
    lenB = math.sqrt(b[0] * b[0] + b[1] * b[1])
    A_B= a[0]*b[0] +a[1]*b[1]
    if(lenA*lenB !=0 ):
        arcC= A_B/(lenA*lenB)
        arcc=    math.acos(arcC)
        if a[1]>=0 and a[0]>0:
            return arcc*180/(math.pi)
        elif a[1]>=0 and a[0] < 0 :
WritePrefPath = sysPath + "\\pref\\"
import sys
sys.path.append(sysPath)
sys.path.append(LibPath)
sys.path.append(LibPath2)
import math
import s_GetButton
import s_GetColor
import s_GetShape
import getWindowPose
import os

#readFile
houdiniHotPathIconPath = sysPath + "/Icon/"
nodeClass = "Sop"
s_button = s_GetButton.getButton(nodeClass)
fatherNumer = s_button.getFatherButtonNum()
PythonfilePath = LibPath2

color = s_GetColor.getColor()
shape = s_GetShape.getShape()


#Calculating angle
def getangle(a, b):
    lenA = math.sqrt(a[0] * a[0] + a[1] * a[1])
    lenB = math.sqrt(b[0] * b[0] + b[1] * b[1])
    A_B = a[0] * b[0] + a[1] * b[1]
    if (lenA * lenB != 0):
        arcC = A_B / (lenA * lenB)
        arcc = math.acos(arcC)