JsonHandle

主要是对json文件信息的读写以及部分数据的校验工作。

CG base model.

Mainly to process some configuration information of CG software, and write it into json file.

class rayvision_utils.json_handle.JsonHandle(cg_file, task, cg_id, custom_exe_path)

基类:object

CG basic module.

dump_task_json()

Write the basic information of the scene to the file.

exe_path_from_location(location, exe_name)

Check if the startup file of the CG software exists.

返回:There is a return path, there is no return to None.
返回类型:str or None
json_exist()

Check if the task's task.json, asset.json, tips.json path exists.

返回:
Whether the path exists and prompt information.
e.g.:
(False, "Json file is not generated c:/tips.json").
返回类型:tuple
json_load(json_path, encodings=None)

Get the data of the json file in the path by the specified encoding.

参数:
  • json_path (str) -- Json file path.
  • encodings (list) --

    Encoding list, default is None. e.g.:

    ["utf-8", "gbk"]
返回:

Data in the json file.

返回类型:

dict

Raises:
load_output_json()

Load the output path and information.

Read the data in task.json, asset.json.tips.json, and update the data corresponding to the task.

run()

Throw an exception directly.

Raises:NotImplementedError -- You should override this method.
valid()

Check CG software.

Check if there is a problem with the configuration. If there is a problem, it will be written in the tips.

Raises:VersionNotMatchError -- The version of the CG software does not match.
write_cg_path()

Update data in task.json.

Process the path of the scene file and the CG software id and write it to the task.json file.