JSONデータの処理

Maya

import json
from AtomsMaya.hostbridge.atomsnode import MayaAtomsNodeHostBridge


#importing scene json data
file = open("/path/to/scene/data.json", 'r')
data = json.load(file)
file.close()

MayaAtomsNodeHostBridge.merge_data(data)


#exporting scene json data
data = MayaAtomsNodeHostBridge.get_json_data()

file = open("/path/to/scene/data.json", 'w')
json.dump(data, file)
file.close()


#import variation json
file = open("/path/to/variation.json", 'r')
data_string = file.read()
file.close()

MayaAtomsNodeHostBridge.merge_variation_string(data_string)


#export variation json
data_string = MayaAtomsNodeHostBridge.get_variation_string()

file = open("/path/to/variation.json", 'w')
file.write(data_string)
file.close()

Houdini

import json
from AtomsHoudini.hostbridge.atomsnode import HoudiniAtomsNodeHostBridge


#importing scene json data
file = open("/path/to/scene/data.json", 'r')
data = json.load(file)
file.close()

HoudiniAtomsNodeHostBridge.merge_data(data)


#exporting scene json data
data = HoudiniAtomsNodeHostBridge.get_json_data()

file = open("/path/to/scene/data.json", 'w')
json.dump(data, file)
file.close()


#import variation json
file = open("/path/to/variation.json", 'r')
data_string = file.read()
file.close()

HoudiniAtomsNodeHostBridge.merge_variation_string(data_string)


#export variation json data
data_string = HoudiniAtomsNodeHostBridge.get_variation_string()

file = open("/path/to/variation.json", 'w')
file.write(data_string)
file.close()

Copyright © 2017, Toolchefs LTD.