Hello, I'm quite new to Blender and its API, and even newer to V-Ray, so the trick is maybe obvious but i can't find any solution...
Here's my problem :
I'd want to write an addon which creates a proxy for each .blend of a folder.
It works very well processing the .blends 1 by 1 in the GUI :
1 - open a blend in an empty scene
2 - right-click on the mesh to select it
3 - set the render engine to V-Ray
4 - clic on the mesh tab to set the 'active data to display and edit: Data'
5 - in the tool tab : set 'proxy_attach_mode' to 'This Object'
6 - clic on "Create proxy"
The script i've written is very strange, as it works if i execute the commands step by step in the console, whereas
it returns an error when i execute it as an addon.
Here's the error :
I suppose the command "bpy.ops.vray.create_proxy()" can't find the data it needs in the context, but i don't know how to fix it.
As far as i know, the only thing i haven't set exactly as in the GUI process is to clic on the mesh tab to set the 'active data to display and edit: Data'...
My script
Here's my problem :
I'd want to write an addon which creates a proxy for each .blend of a folder.
It works very well processing the .blends 1 by 1 in the GUI :
1 - open a blend in an empty scene
2 - right-click on the mesh to select it
3 - set the render engine to V-Ray
4 - clic on the mesh tab to set the 'active data to display and edit: Data'
5 - in the tool tab : set 'proxy_attach_mode' to 'This Object'
6 - clic on "Create proxy"
The script i've written is very strange, as it works if i execute the commands step by step in the console, whereas
it returns an error when i execute it as an addon.
Here's the error :
Code:
Traceback (most recent call last): File "C:\Users\GPMP018_\AppData\Roaming\Blender Foundation\Blender\2.72\scripts\addons\GP_batch_proxy_creation.py", line 84, in execute bpy.ops.vray.create_proxy() File "C:\Program Files\Blender 2.72 (With V-Ray Additions)\2.72\scripts\modules\bpy\ops.py", line 188, in __call__ ret = op_call(self.idname_py(), None, kw) RuntimeError: Error: Traceback (most recent call last): File "C:\Program Files\Blender 2.72 (With V-Ray Additions)\2.72\scripts\addons\vb30\proxy.py", line 322, in execute ob = bpy.context.object AttributeError: 'Context' object has no attribute 'object' location: C:\Program Files\Blender 2.72 (With V-Ray Additions)\2.72\scripts\modules\bpy\ops.py:188 location: <unknown location>:-1
As far as i know, the only thing i haven't set exactly as in the GUI process is to clic on the mesh tab to set the 'active data to display and edit: Data'...
My script