Skip to content

Commit a982bee

Browse files
Merge pull request #65 from renderbus/updata-demo-doc
Updata demo doc
2 parents 047b10b + 356278c commit a982bee

File tree

1 file changed

+172
-1
lines changed

1 file changed

+172
-1
lines changed

render/demo/demo.rst

Lines changed: 172 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ C4D demo
578578

579579
# API Parameter
580580
render_para = {
581-
"domain": "task.renderbus.com",
581+
"domain": "jop.foxrenderfarm.com", # If it doesn't work, you can use "task.foxrenderfarm.com"
582582
"platform": "6",
583583
"access_id": "xxxxx",
584584
"access_key": "xxxxxx",
@@ -653,3 +653,174 @@ C4D demo
653653
# download.auto_download_after_task_completed([task_id])
654654
# Poll download (automatic download for each completed frame)
655655
download.auto_download([int(task_id)])
656+
657+
658+
Blender DEMO
659+
----------------
660+
661+
::
662+
663+
from rayvision_api.core import RayvisionAPI
664+
from rayvision_api.task.check import RayvisionCheck
665+
from rayvision_api.utils import update_task_info, append_to_task, append_to_upload
666+
from rayvision_blender.analyze_blender import AnalyzeBlender
667+
from rayvision_sync.download import RayvisionDownload
668+
from rayvision_sync.upload import RayvisionUpload
669+
670+
# API Parameter
671+
render_para = {
672+
"domain": "jop.foxrenderfarm.com", # If it doesn't work, you can use "task.foxrenderfarm.com"
673+
"platform": "2",
674+
"access_id": "xxxx",
675+
"access_key": "xxxx",
676+
}
677+
678+
api = RayvisionAPI(access_id=render_para['access_id'],
679+
access_key=render_para['access_key'],
680+
domain=render_para['domain'],
681+
platform=render_para['platform'])
682+
683+
# Step1:Analyze CG File
684+
analyze_info = {
685+
"cg_file": r"D:\houdini\cg_file\PRAM RENDER 1.blend",
686+
"workspace": "c:/workspace",
687+
"software_version": "2.81",
688+
"project_name": "Project1",
689+
"plugin_config": {}
690+
}
691+
analyze_obj = AnalyzeBlender(**analyze_info)
692+
analyze_obj.analyse(exe_path=r"C:\Program Files (x86)\Blender Foundation\Blender\blender.exe")
693+
694+
# step2:Add some custom parameters, or update the original parameter value
695+
update_task = {
696+
"pre_frames": "100",
697+
"stop_after_test": "1",
698+
"hardwareConfigId": "5",
699+
}
700+
update_task_info(update_task, analyze_obj.task_json)
701+
702+
custom_info_to_task = {}
703+
append_to_task(custom_info_to_task, analyze_obj.task_json)
704+
705+
# User-defined UPLOAD.JSON file path
706+
upload_json_path = r"D:\blender\upload.json"
707+
708+
custom_info_to_upload = [
709+
r"D:\houdini\cg_file\PRAM RENDER 1.blend"
710+
]
711+
712+
append_to_upload(custom_info_to_upload, upload_json_path)
713+
714+
# step3:Check json files
715+
check_obj = RayvisionCheck(api, analyze_obj)
716+
task_id = check_obj.execute(analyze_obj.task_json, analyze_obj.upload_json)
717+
718+
# Step4:Transmission
719+
"""
720+
There are two ways to upload the transmission:
721+
Upload_method: 1:upload four json files and upload the resource file according to upload.json;
722+
2:json files and resources are uploaded separately;
723+
"""
724+
CONFIG_PATH = {
725+
"tips_json_path": analyze_obj.tips_json,
726+
"task_json_path": analyze_obj.task_json,
727+
"asset_json_path": analyze_obj.asset_json,
728+
}
729+
upload_obj = RayvisionUpload(api, automatic_line=True)
730+
"""
731+
The default of the test demo is to upload json and resource files at the same time,
732+
and users can choose their own upload method according to the actual situation.
733+
"""
734+
upload_obj.upload_asset(upload_json_path=upload_json_path)
735+
upload_obj.upload_config(str(task_id), list(CONFIG_PATH.values()))
736+
737+
# Step5:Submit Task
738+
api.submit(int(task_id))
739+
740+
# Step6:Download
741+
download = RayvisionDownload(api)
742+
# All complete before the automatic start of uniform download.
743+
# download.auto_download_after_task_completed([task_id])
744+
# Poll download (automatic download for each completed frame)
745+
download.auto_download([int(task_id)])
746+
747+
748+
Arnorld Standalone demo
749+
-------------------------
750+
751+
.. warning::
752+
Arnold Standalone has no automatic asset analysis function and requires customers to analyze asset files by themselves.
753+
754+
---------------
755+
756+
::
757+
758+
from rayvision_api.core import RayvisionAPI
759+
from rayvision_sync.upload import RayvisionUpload
760+
from rayvision_sync.download import RayvisionDownload
761+
from rayvision_api.task.check import RayvisionCheck
762+
from rayvision_api.utils import update_task_info, append_to_task, append_to_upload
763+
764+
# API Parameter
765+
render_para = {
766+
"domain": "jop.foxrenderfarm.com", # If it doesn't work, you can use "task.foxrenderfarm.com"
767+
"platform": "6",
768+
"access_id": "xxxxx",
769+
"access_key": "xxxxx",
770+
}
771+
772+
CONFIG_PATH = {
773+
"task_json_path": r"D:\test\task.json",
774+
"upload_json_path": r"D:\test\upload.json"
775+
}
776+
777+
api = RayvisionAPI(access_id=render_para['access_id'],
778+
access_key=render_para['access_key'],
779+
domain=render_para['domain'],
780+
platform=render_para['platform'])
781+
782+
783+
# step1: Add some custom parameters, or update the original parameter value
784+
# Step1 can also be set without setting
785+
update_task = {
786+
"pre_frames": "000:2,4,6-10[1]",
787+
"stop_after_test": "1"
788+
}
789+
update_task_info(update_task, CONFIG_PATH['task_json_path'])
790+
791+
custom_info_to_task = {}
792+
append_to_task(custom_info_to_task, CONFIG_PATH['task_json_path'])
793+
794+
custom_info_to_upload = [
795+
r"E:\fang\ass_test\static_ass.ass",
796+
r"E:\fang\ass_test\animation_ass.0060.ass"
797+
]
798+
append_to_upload(custom_info_to_upload, CONFIG_PATH['upload_json_path'])
799+
800+
801+
# step2:Check json files
802+
check_obj = RayvisionCheck(api)
803+
task_id = check_obj.execute(CONFIG_PATH['task_json_path'])
804+
805+
806+
# Step3: Transmission
807+
"""
808+
task.json files and resources are uploaded separately
809+
"""
810+
upload_obj = RayvisionUpload(api)
811+
812+
# step3.1: Upload resource file(upload.json)
813+
upload_obj.upload_asset(upload_json_path=CONFIG_PATH["upload_json_path"])
814+
# step3.2: Upload task.json
815+
upload_obj.upload_config(str(task_id), list(CONFIG_PATH.values()))
816+
817+
818+
# Step4:Submit Task
819+
api.submit(int(task_id))
820+
821+
# Step5:Download
822+
download = RayvisionDownload(api)
823+
# All complete before the automatic start of uniform download.
824+
download.auto_download_after_task_completed([task_id])
825+
# Poll download (automatic download for each completed frame)
826+
download.auto_download([int(1484947)], local_path=r"E:\test", download_filename_format="false")

0 commit comments

Comments
 (0)