forked from kattkieru/kraken_public
-
Notifications
You must be signed in to change notification settings - Fork 0
/
getNodeDesc.py
81 lines (50 loc) · 2.72 KB
/
getNodeDesc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import os, sys
# fabricEngineDir=os.path.normpath("D:/temp/FabricEngine-2.0.0-Windows-x86_64/")
# # fabricEngineDir=os.path.normpath("D:/temp/FabricEngine-1.15.2-Windows-x86_64/")
# os.environ['PATH'] = os.path.join(fabricEngineDir, 'bin') + ';' + os.environ['PATH']
# os.environ['FABRIC_DFG_PATH'] = os.path.join(fabricEngineDir, 'Presets', 'DFG')
# PYTHON_VERSION = sys.version[:3]
# sys.path.append( os.path.join(fabricEngineDir, 'Python', PYTHON_VERSION ) )
# ##############################
# krakenDir = os.path.dirname(os.path.realpath(__file__))
# # krakenDir=os.path.abspath(os.path.join(krakenModuleDir, '..', '..'))
# os.environ['KRAKEN_PATH'] = krakenDir
# os.environ['FABRIC_EXTS_PATH'] = os.path.join(fabricEngineDir, 'Exts') + ';' + os.path.join(krakenDir, 'KLExts') + ';' + os.environ['FABRIC_EXTS_PATH']
# os.environ['KRAKEN_PATHS'] = os.path.join(krakenDir, 'extraComponents')
# os.environ['PYTHONPATH'] = os.path.join(krakenDir, 'Python') + ';' + os.environ['PYTHONPATH']
# canvasPresetsDir = os.path.join(krakenDir, 'CanvasPresets')
# os.environ['FABRIC_DFG_PATH'] = canvasPresetsDir + ';' + os.environ['FABRIC_DFG_PATH']
# ##############################
# print os.environ['FABRIC_DFG_USER_PATH']
print os.environ['FABRIC_DFG_PATH']
#addPresetDir
import FabricEngine.Core, json
client = FabricEngine.Core.createClient()
host = client.DFG.host
# host.addPresetDir('', 'Kraken', os.path.join(krakenDir, 'CanvasPresets'))
print host.getPresetDesc('Kraken')
# def getPresetDesc(path):
# fileContents = open( host.getPresetImportPathname(path) ).read()
# fileContents = "".join(fileContents.split('\n'))
# fileContents = " ".join(fileContents.split('\t'))
# return json.loads(fileContents)
# addNode = getPresetDesc('Fabric.Core.Math.Add')
# for port in addNode['ports']:
# print port['name']
# # turbulizeVec3Node = getPresetDesc('Fabric.Compounds.Deform.TurbulizeVec3')
# # for port in turbulizeVec3Node['ports']:
# # print port['name'] + ":" + port['execPortType'] + ":" + port["typeSpec"]
# # print json.dumps(json.loads(str(open( host.getPresetImportPathname('Fabric.Core.Math.Add') ).read())))
# # print json.dumps(json.loads(host.getPresetDesc('Fabric.Core.Math.Add')), indent=1, sort_keys=True)
# def displayMsg(path, jsonMsg):
# print "Notif on '" + path + "': " + jsonMsg
# binding = host.createBindingToNewGraph()
# # binding.setNotificationCallback(bindingDisplayMsg)
# rootExec = binding.getExec()
# rootView = rootExec.createView(lambda jsonMsg: displayMsg('', jsonMsg))
# binding = host.createBindingToPreset('Fabric.Core.Math.Add', [42, 45, 0])
# binding.execute()
# binding.setArgValue("lhs", client.RT.types.Float32(5.67))
# print binding.getArgValue("result")
# addInstFromPreset
client.close()