Example #1
0
def exit_application(application="maya"):
    """
    This script is like close_script_job but it is much more aggressive and 
    forces the current application to shut off
    """
    if application == "maya":
        closeApp = functools.partial(cmds.quit(f=True))
        cmds.scriptJob(runOnce=True, e=['idle', closeApp])
    elif application == "nuke":
        nuke.scriptExit()
    elif application == "houdini":
        hou.exit()
Example #2
0
def exit():
    """
    change scene mode in manual, save, and exit 
    """
    help(exit)
    import hou

    mode = hou.updateModeSetting().name()
    if mode == 'AutoUpdate':
        hou.setUpdateMode(hou.updateMode.Manual)
    hou.hipFile.save(file_name=None, save_to_recent_files=True)
    hou.exit(exit_code=0, suppress_save_prompt=False)
Example #3
0
        hda_file = hda_file.replace("\\", "/")
        hou.hda.installFile(hda_file)
        definitions = hou.hda.definitionsInFile(hda_file)
        for definition in definitions:
            name = definition.nodeType().name()

            num_nodes = num_nodes + 1

            if name not in nodes_to_ignore:
                print("Attempting to Create Node : " + name)
                ok = True
                try:
                    category = definition.nodeType().category().name()
                    new_node = categories[category].createNode(name)
                    ok = run_tests(new_node)
                    new_node.destroy()
                    if not ok:
                        num_failed = num_failed + 1
                except Exception as e:
                    print(e)
                    ok = False
                    num_failed = num_failed + 1
                print("Tests", "passed" if ok else "FAILED", "on :", name)
            else:
                num_skipped = num_skipped + 1

    print("Completed", num_nodes, "tests")
    print("Skipped", num_skipped)
    print("Failed", num_failed)
    hou.exit()
	def createTurntable_main(self, **connections):
		try:
			dbPath=connections["dbPath"]
		except:
			dbPath=""
		try:
			Type=connections["Type"]
		except:
			Type=""
		try:
			Name=str(connections["Name"])
		except:
			Name=""
		try:
			Version=str(connections["Version"])
		except:
			Version=""
		try:
			oas_output=connections["oas_output"]
		except:
			oas_output="hipFile"		

		if str(geT(dbPath))=="" or str(geT(dbPath))=="0":
			return 0

		vers=getVerFrompath(str(dbPath)+":Model@"+str(Version))
		vPath=gVP(str(dbPath)+":Model@"+str(vers))


		if Type=="Model":
			sure="01_Model"
		elif Type=="Material":
			sure="02_Material"
		else:
			sure="03_Misc"


		projj=ref(str(dbPath).split(":")[1])
		renderdir="/W/Projects/"+projj+"/60_PreRenders/Turntable/"+sure+"/"+str(Name)+"/"+str(vers)
		seqdir=renderdir+"/seq"
		movdir=renderdir+"/mov"

		if os.path.isdir(seqdir):
			pass
		else:
			os.makedirs(seqdir)
		if os.path.isdir(movdir):
			pass
		else:
			os.makedirs(movdir)

		if str(vPath)=="0" or vPath=="":
			return 0

		if os.path.isdir(vPath+'/hipFile'):
			pass
		else:
			os.makedirs(vPath+'/hipFile')
		if os.path.isdir(vPath+'/render'):
			pass
		else:
			os.makedirs(vPath+'/render')
		if os.path.isdir(vPath+'/mov'):
			pass
		else:
			os.makedirs(vPath+'/mov')

		hou.hipFile.clear()

		ret1=LHD(Name,"Model",Version,dbPath,"Turntable_Model")
		par=hou.node("/obj/Turntable_Model").parm("ry")
		hou.setFrame(1)
		par.setKeyframe(hou.Keyframe(0))
		hou.setFrame(101)
		par.setKeyframe(hou.Keyframe(720))
		hou.setFrame(1)

		coll=""
		for item in hou.node("/obj/Turntable_Model").children():
			coll+=str(item.path())+" "

		mat_pars=hou.node("/obj/Turntable_Model").parmsInFolder(("Materials",))

		for pa in mat_pars:
			try:
				pa.set("/obj/Turntable_Shader/turntableShop/out")
			except:
				pass
		
		ret2=LHD("LookdevLightRig","Lightrig","latest",":General:Assets:LightSetups:LookdevLightRig","Turntable_Lightrig")
		hou.node("/obj/"+"Turntable_Lightrig").parm("models").set(coll)
		ret3=LHD("modelTurntable","RenderSetup","latest",":General:Assets:RenderSetups:modelTurntable","Turntable_RenderSetup")

		rsobj=hou.node("/obj/Turntable_RenderSetup")
		rsobj.parm("tt_picture").set(seqdir+'/'+Name+".$F4.exr")
		rsobj.parm("tt_comment").set(Name+"_"+vers)

		ret4=LHD("autoscaleCamera","Camera","latest",":General:Assets:CameraSetups:autoscaleCamera","Turntable_LookdevCamera")
		hou.node("/obj/"+"Turntable_LookdevCamera").parm("models").set(coll)
		ret5=LHD("ModelTurntableShader","Shader","latest",":General:Assets:Shaders:ModelTurntableShader","Turntable_Shader")	


		hou.hipFile.save(vPath+'/hipFile/turntable.hip')

		hou.exit()
Example #5
0
    def createTurntable_main(self, **connections):
        try:
            dbPath = connections["dbPath"]
        except:
            dbPath = ""
        try:
            Type = connections["Type"]
        except:
            Type = ""
        try:
            Name = str(connections["Name"])
        except:
            Name = ""
        try:
            Version = str(connections["Version"])
        except:
            Version = ""
        try:
            oas_output = connections["oas_output"]
        except:
            oas_output = "hipFile"

        if str(geT(dbPath)) == "" or str(geT(dbPath)) == "0":
            return 0

        vers = getVerFrompath(str(dbPath) + ":Model@" + str(Version))
        vPath = gVP(str(dbPath) + ":Model@" + str(vers))

        if Type == "Model":
            sure = "01_Model"
        elif Type == "Material":
            sure = "02_Material"
        else:
            sure = "03_Misc"

        projj = ref(str(dbPath).split(":")[1])
        renderdir = "/W/Projects/" + projj + "/60_PreRenders/Turntable/" + sure + "/" + str(
            Name) + "/" + str(vers)
        seqdir = renderdir + "/seq"
        movdir = renderdir + "/mov"

        if os.path.isdir(seqdir):
            pass
        else:
            os.makedirs(seqdir)
        if os.path.isdir(movdir):
            pass
        else:
            os.makedirs(movdir)

        if str(vPath) == "0" or vPath == "":
            return 0

        if os.path.isdir(vPath + '/hipFile'):
            pass
        else:
            os.makedirs(vPath + '/hipFile')
        if os.path.isdir(vPath + '/render'):
            pass
        else:
            os.makedirs(vPath + '/render')
        if os.path.isdir(vPath + '/mov'):
            pass
        else:
            os.makedirs(vPath + '/mov')

        hou.hipFile.clear()

        ret1 = LHD(Name, "Model", Version, dbPath, "Turntable_Model")
        par = hou.node("/obj/Turntable_Model").parm("ry")
        hou.setFrame(1)
        par.setKeyframe(hou.Keyframe(0))
        hou.setFrame(101)
        par.setKeyframe(hou.Keyframe(720))
        hou.setFrame(1)

        coll = ""
        for item in hou.node("/obj/Turntable_Model").children():
            coll += str(item.path()) + " "

        mat_pars = hou.node("/obj/Turntable_Model").parmsInFolder(
            ("Materials", ))

        for pa in mat_pars:
            try:
                pa.set("/obj/Turntable_Shader/turntableShop/out")
            except:
                pass

        ret2 = LHD("LookdevLightRig", "Lightrig", "latest",
                   ":General:Assets:LightSetups:LookdevLightRig",
                   "Turntable_Lightrig")
        hou.node("/obj/" + "Turntable_Lightrig").parm("models").set(coll)
        ret3 = LHD("modelTurntable", "RenderSetup", "latest",
                   ":General:Assets:RenderSetups:modelTurntable",
                   "Turntable_RenderSetup")

        rsobj = hou.node("/obj/Turntable_RenderSetup")
        rsobj.parm("tt_picture").set(seqdir + '/' + Name + ".$F4.exr")
        rsobj.parm("tt_comment").set(Name + "_" + vers)

        ret4 = LHD("autoscaleCamera", "Camera", "latest",
                   ":General:Assets:CameraSetups:autoscaleCamera",
                   "Turntable_LookdevCamera")
        hou.node("/obj/" + "Turntable_LookdevCamera").parm("models").set(coll)
        ret5 = LHD("ModelTurntableShader", "Shader", "latest",
                   ":General:Assets:Shaders:ModelTurntableShader",
                   "Turntable_Shader")

        hou.hipFile.save(vPath + '/hipFile/turntable.hip')

        hou.exit()
Example #6
0
import coverage
import os
import six
import sys
import unittest

import hou

# Start the coverage reporting.
cov = coverage.Coverage()
cov.start()

# Find and run tests
loader = unittest.TestLoader()
suite = loader.discover(".")
runner = unittest.TextTestRunner()
result = runner.run(suite)

# Stop the coverage operation, generate reports.
cov.stop()
cov.save()
cov.html_report()
cov.xml_report()

html_path = os.path.join(os.path.realpath(os.path.curdir),
                         "coverage_html_report/index.html")
six.print_("View coverage report at file://{}".format(html_path))

if not result.wasSuccessful():
    hou.exit(1)
Example #7
0
 def exit_houdini(self):
     import hou
     hou.exit(suppress_save_prompt=True)
Example #8
0
# Copyright (c) 2020 Shotgun Software Inc.
#
# CONFIDENTIAL AND PROPRIETARY
#
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
# Source Code License included in this distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights
# not expressly granted therein are reserved by Shotgun Software Inc.

"""
This file is loaded automatically by Houdini at startup.
It's called 123 because this is what Houdini looks for an runs on startup.
You can also have a 456, the difference being, that 123 is run when Houdini
starts with out a scene file, and 456 is run whenever a scene file is opened.
"""
import inspect
import os
import sys
import hou

current_file_path = os.path.abspath(inspect.getsourcefile(lambda: 0))

sys.path.append(os.path.join(os.path.dirname(current_file_path), ".."))

# Importing this will run the tests.
import run_tests  # noqa

# Shut Houdini down after the tests have run.
hou.exit(exit_code=0, suppress_save_prompt=True)
Example #9
0
"""Discover and run unittests, with coverage."""

# =============================================================================
# IMPORTS
# =============================================================================

# Third Party Imports
import pytest

# Houdini Imports
import hou

# =============================================================================

result = pytest.main()

if not result:
    hou.exit(result)
Example #10
0
        hda_file = hda_file.replace("\\", "/")
        hou.hda.installFile(hda_file)
        definitions = hou.hda.definitionsInFile(hda_file)
        for definition in definitions:
            name = definition.nodeType().name()

            num_nodes += 1

            if name not in nodes_to_ignore and name not in deprecations:
                print("Attempting to Create Node : " + name)
                ok = True
                try:
                    category = definition.nodeType().category().name()
                    new_node = categories[category].createNode(name)
                    ok = run_tests(new_node)
                    new_node.destroy()
                    if not ok:
                        num_failed += 1
                except Exception as e:
                    print(e)
                    ok = False
                    num_failed += 1
                print("Tests", "passed" if ok else "FAILED", "on :", name)
            else:
                num_skipped += 1

    print("Completed", num_nodes, "tests")
    print("Skipped", num_skipped)
    print("Failed", num_failed)
    hou.exit(suppress_save_prompt=True)