Forum

Make "Do not export" option behave native-like

31 August 2018 21:28
Hello. I think this is a little feature, but it could be really handy.

The thing is when you use Cycles to render an image you can control objects that are visible on scene but will not be renderable by camera button in Outliner.
I think it is possible to link this button with "Do not export" checker to replicate similar behavior when pressing Fast Preview button or exporting html/json.


p.s: by the way alt+f12 is free and could be as fast preview shortcut.
01 September 2018 18:28
I think it is possible to link this button with "Do not export" checker
Well, if you don't want to wait, it's just a few lines of code:
for ob in bpy.context.scene.objects:
try:
ob.b4w_do_not_export = ob.hide_render
except:
pass
Put this in an add-on, assign a key shortcut, done. Now you can press your key and all the B4W export checkboxes take on the status of the render ("Camera") buttons.


p.s: by the way alt+f12 is free and could be as fast preview shortcut.
1. Open User Preferences.
2. Go to the Input Tab -> "Window" shortcuts
3. Add a new shortcut at the end of the list
4. As the operator identifier, give "b4w.preview"
5. Assign a key of your liking, e.g. ALT+F12
6. Save and exit User Preferences.

01 September 2018 23:07
Well, if you don't want to wait, it's just a few lines of code

I put this snippet at the end of _init_.py file of b4w add-on, restarted and got this:

bpy.data.window_managers["WinMan"].addon_search = "blend"
Traceback (most recent call last):
File "/usr/share/blender/2.79/scripts/modules/addon_utils.py", line 331, in enable
mod = __import__(module_name)
File "/home/rumi/blend4web_ce/addons/blend4web/__init__.py", line 432, in <module>
for ob in bpy.context.scene.objects:
AttributeError: '_RestrictContext' object has no attribute 'scene'


Do I have to put it somewhere else?
02 September 2018 17:56
You can use the little add-on I attached, "b4w_sync_hide_render.py".

To get this activated:

1. Save the file to your Blender add-ons folder (for me, this is /Users/<username>/AppData/Roaming/Blender Foundation/Blender/2.79/scripts/addons).

2. Start Blender, go to User Prefs -> Add-ons and check out the list. A new add-on "Render: B4W tools: sync hide_render" should appear. Activate it.

3. Now repeat the steps mentioned above for the key shortcut: Go to the Input tab of User Prefs, add a new shortcut to the "Window" section; this time, the identifier is render.synchiderender. Don't forget to save user prefs.

When you press your keyboard shortcut, the objects' "do not export" checkbox states are matched to the "Camera" buttons.
 
Please register or log in to leave a reply.