Commit Graph

300 Commits

Author SHA1 Message Date
Dalai Felinto
20c90eae14 Bake API: renaming WM_JOB_RENDER_BAKE to WM_JOB_OBJECT_BAKE and use it consistently
Note: that doesnt change much. It definitively doesnt change the random crash OSX is experiencing sometimes.
2014-05-08 22:56:50 -03:00
Dalai Felinto
97641a0ec9 Bake API - bpy.ops.object.bake()
New operator that can calls a bake function to the current render engine when available. This commit provides no feature for the users, but allows external engines to be accessed by the operator and be integrated with the baking api.

The API itself is simple. Blender sends a populated array of BakePixels to the renderer, and gets back an array of floats with the result.

The Blender Internal (and multires) system is still running independent, but we eventually will pipe it through the API as well. Cycles baking will come next as a separated commit

Python Operator:
----------------
The operator can be called with some arguments, or a user interface can be created for it. In that case the arguments can be ommited and the interface can expose the settings from bpy.context.scene.render.bake

bpy.ops.object.bake(type='COMBINED', filepath="", width=512, height=512, margin=16, use_selected_to_active=False, cage_extrusion=0, cage="", normal_space='TANGENT', normal_r='POS_X', normal_g='POS_Y', normal_b='POS_Z', save_mode='INTERNAL', use_clear=False, use_split_materials=False, use_automatic_name=False)
Note: external save mode is currently disabled.

Supported Features:
------------------
 * Margin - Baked result is extended this many pixels beyond the border of each UV "island," to soften seams in the texture.

 * Selected to Active - bake shading on the surface of selected object to the active object. The rays are cast from the lowpoly object inwards towards the highpoly object. If the highpoly object is not entirely involved by the lowpoly object, you can tweak the rays start point with Cage Extrusion. For even more control of the cage you can use a Cage object.

 * Cage Extrusion - distance to use for the inward ray cast when using selected to active

 * Custom Cage - object to use as cage (instead of the lowpoly object).

 * Normal swizzle - change the axis that gets mapped to RGB

 * Normal space - save as tangent or object normal spaces

Supported Passes:
-----------------
Any pass that is supported by Blender renderlayer system. Though it's up to the external engine to provide a valid enum with its supported passes. Normal passes get a special treatment since we post-process them to converted and "swizzled"

Development Notes for External Engines:
---------------------------------------
(read them in bake_api.c)

* For a complete implementation example look at the Cycles Bake commit (next).

Review: D421
Reviewed by: Campbell Barton, Brecht van Lommel, Sergey Sharybin, Thomas Dinge

Normal map pipeline "consulting" by Andy Davies (metalliandy)
Original design by Brecht van Lommel.

The entire commit history can be found on the branch: bake-cycles
2014-05-02 21:19:08 -03:00
9ae0e585b0 View2d: API Cleanup for view<->region conversion
View2D had some inconsistencies making it error prone in some cases.

- Inconstant checking for NULL x/y args.
  Disallow NULL args for x/y destination pointers, instead add:
  - UI_view2d_region_to_view_x/y
  - UI_view2d_view_to_region_x/y

- '_no_clip' suffix wasn't always used for non-clipping conversion,
  switch it around and use a '_clip' suffix for all funcs that clip.

- UI_view2d_text_cache_add now clips before adding cache.

- '_clip' funcs return a bool to quickly check if its in the view.

- add conversion for rectangles, since this is a common task:
  - UI_view2d_view_to_region_rcti
  - UI_view2d_region_to_view_rctf
2014-04-21 16:59:40 +10:00
d7a2d2b693 Fix T38876: hide area split widget in lower left of widget on OS X.
This is already used by the operating system for window resizing, you must use
the widget in the top right of the area to split.
2014-02-27 23:41:01 +01:00
dcdb4eaf9c NDOF: Fix for fly/walk mode ignoring axis invert options 2014-02-18 23:55:58 +11:00
b105d2ac7f UI: replace uiPupMenuOkee & uiPupMenuSaveOver with WM_operator_confirm 2014-02-09 12:32:20 +11:00
d900f5be55 Code cleanup: use bools where possible 2014-02-03 19:35:44 +11:00
a68ceb0af8 Option to lock the interface while rendering
Added function called WM_set_locked_interface which does
two things:

- Prevents event queue from being handled, so no operators
  (see below) or values are even possible to run or change.
  This prevents any kind of "destructive" action performed
  from user while rendering.

- Locks interface refresh for regions which does have lock
  set to truth in their template. Currently it's just a 3D
  viewport, but in the future more regions could be considered
  unsafe, or we could want to lock different parts of
  interface when doing different jobs.

  This is needed because 3D viewport could be using or changing
  the same data as renderer currently uses, leading to threading
  conflict.

  Notifiers are still allowed to handle, so render progress is
  seen on the screen, but would need to doublecheck on this, in
  terms some notifiers could be changing the data.

  For now interface locking happens for render job only in case
  "Lock Interface" checkbox is enabled.

  Other tools like backing would also benefit of this option.

  It is possible to mark operator as safe to be used in locked
  interface mode by adding OPTYPE_ALLOW_LOCKED bit to operator
  template flags.

  This bit is completely handled by wm_evem_system, not
  with operator run routines, so it's still possible to
  run operators from drivers and handlers.

  Currently allowed image editor navigation and zooming.

Reviewers: brecht, campbellbarton

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D142
2014-01-29 16:07:14 +06:00
8c688a052c File Reading: add wrapper function for WM_file_read
also return cancelled when an operator fails to load a file
2014-01-29 05:33:05 +11:00
9a1dcfbf2d Fix T38367: operators activated from popups didnt reuse settings 2014-01-29 02:54:46 +11:00
a5c35fb27f Code cleanup: use booleans where appropriate 2014-01-28 04:00:04 +11:00
b64f897606 WM: add WM_operatortype_remove_ptr to remove a known operator 2014-01-23 19:05:56 +11:00
621bf47e91 Docs: doxygen file descriptions for BLF, GPU and WM 2014-01-19 23:15:25 +11:00
7ae1949517 Select Random: add option to de-select
also made metaball operator behave like the others.

Path originally from Walid Shouman, with own edits.
2014-01-13 20:39:12 +11:00
2dba2e72b7 Code Cleanup: de-duplicate text pasting which only used the first line 2014-01-08 17:39:12 +11:00
c6620905a7 Tooltips: abbreviate long python operator tooltips
Some tooltips would end up containing long string/array args spanning the screen.
2013-12-09 14:25:03 +11:00
6976866d5a User Interface: Ctrl+C over a menu copies the py command
also use bools rather then ints
2013-12-05 17:26:03 +11:00
285e09bceb Fix T37149: Macros store settings from a cancelled operation 2013-11-29 16:01:03 +11:00
02f90c0001 User Interface: don't show macro args in tooltips
was often making much too big strings to show in a tip.
2013-11-26 09:00:24 +11:00
63caaa2b12 Code Cleanup: rename vars for detecting change to be more consistent
rename change/is_change/is_changed/modified -> changed
also use bools over int/short/char and once accidental float.
2013-11-26 06:39:14 +11:00
ad34a5cc1b Fix [#34675] *AFTER 2.69* Info view shows duplicate operators with incorrect values of args
Refactored a bit WM api to generate operator's pystring, now it can also handle correctly macro operators. Thanks to Campbell for the review!
2013-11-06 20:56:18 +00:00
Lukas Toenne
c9fdec14f5 Fix #37261 Rendering a Render Layer from another scene doesn't update.
The scene pointer used for looking up the appropriate source of render result images in the image editor was always taken from context. This means that render results for a different scene would never be
displayed in the image editor.

To give feedback on running renders, try to get the running render job's scene pointer in the image editor for render result type images. This only happens during rendering, apart from that the regular
context scene result is displayed.
2013-10-31 17:20:31 +00:00
7267221715 remove return argument from wmOperatorType->cancel, was only ever returning OPERATOR_CANCELLED. 2013-10-30 23:08:53 +00:00
de3f6b3ec1 re-enable activating the text input field for new popup dialog boxes,
I'd disabled this for 2.68 since it caused bug [#36109].

This fix now only enabled text activation for popups. (so the toolbar textboxes are skipped)
2013-10-09 14:35:25 +00:00
fc2dbc20ff Fix #36800: closing render window during render crashes, the operator would be
cancelled before the job, causing invalid access to op->reports in the job thread.
2013-09-23 19:35:21 +00:00
b380dd9378 fix [#36537] "Grid Floor Scaling" can have some unexpected behaviour on new objects
curves and metaballs now behave the same as meshes wrt grid scaling.
remove WM_operator_view3d_distance_invoke(), and replace with a function called from exec which initializes defaults, this way operators can have their own invoke functions.
2013-09-16 04:19:48 +00:00
23626e0149 fix [#36444] view3d.viewnumpad operator should not animate
when running viewport operations with exec() rather then invoke(), perform the action immediately rather then using smoothview.
makes viewport operations usable from python scripts.
2013-09-16 04:04:44 +00:00
35cd649c66 rename cursor setting functions to make modal set/restore more clearly related functions. 2013-09-06 22:34:29 +00:00
29efa96940 style cleanup 2013-09-04 03:30:41 +00:00
35b61a7512 Move GCC attributes into a centraized defines
Instead of having ifdef __GNUC__ all over the headers
to use special compiler's hints use a special file where
all things like this are concentrated.

Makes code easier to follow and allows to manage special
attributes in more efficient way.

Thanks Campbell for review!
2013-09-01 15:01:15 +00:00
2c31bce47f Fix #36555: preview render in properties editor did not get cancelled and
restarted fast enough on resizing the editor, especially noticeable with
e.g. luxrender which does a progressive refining render.
2013-08-28 19:22:48 +00:00
0395b8eee8 border render with cycles had 1 pixel offset on the top-right edge of the image, issue was caused by wmSubWindowScissorSet adding 1 to the ar->drawrct, now only add the padding when drawing the entire area 2013-08-05 04:52:27 +00:00
02608d257a add api call for initializing events from the windows eventstate. 2013-07-29 08:29:04 +00:00
3ce280e825 Fix #35960, #36044: blender internal viewport rendering crash while editing data.
Now the viewport rendering thread will lock the main thread while it is exporting
objects to render data. This is not ideal if you have big scenes that might block
the UI, but Cycles does the same, and it's fairly quick because the same evaluated
mesh can be used as for viewport drawing. It's the only way to get things stable
until the thread safe dependency graph is here.

This adds a mechanism to the job system for jobs to lock the main thread, using a
new 'ticket mutex lock' which is a mutex lock that gives priority to the first
thread that tries to lock the mutex.

Still to solve: undo/redo crashes.
2013-07-08 17:56:51 +00:00
6fb6087c68 correct bad use of bool for cursor arg. 2013-07-04 18:58:00 +00:00
42f6136da8 Fix #35991: show warning message to when trying to edit driven values in number buttons. 2013-07-03 20:37:07 +00:00
447e9a4cd5 add option to enable auto-execute scripts, but exclude certain directories. 2013-06-18 18:11:52 +00:00
e6c54c26ae use booleans for operator check functions. 2013-06-18 15:30:51 +00:00
c77179a3c2 code cleanup: comment/remove unused defines 2013-05-28 01:15:59 +00:00
c70a900736 More work on 3d view render:
- reverted fix for bug 32537 (error report drawing after thread job didn't show)

  This solves very bad 3d view render updates while using transform, it was
  getting into an eternal feedback loop for dependencies. (jobs sending mousemoves
  causing jobs to end, causing mousemoves, causing etc).
  
- The render-update code was not going over all windows, but over every screen to
  send signals (also the invisble ones)
2013-05-17 16:46:59 +00:00
ebda20150d fix for crash with toggle-drag on a popup (when the popup is closed while dragging). 2013-05-17 13:54:44 +00:00
00f0ac8107 Fix #35368:
* Editing number of segments for particle hair did not update the viewport.
* Hidden particles were confusing, the paths were drawn but without the points.
  Now it draws the path faded to indicate that they are hidden/locked.
* Select tips/roots operators now have options to select/deselect/toggle/invert.
2013-05-16 00:07:01 +00:00
2914d15241 Fix #35337: sculpt performance regression, partial redraw was not working anymore
due to paint cursor redraw problem.
2013-05-13 13:32:42 +00:00
def15f275d fix [#35156] Edge slide gg shortcut brings up wrong settings.
switch operator types from transform, this would normally be problematic, but transform operators share callbacks so it can be supported.
2013-04-30 03:44:03 +00:00
d867cefa32 Bug fix #34896
The feature "Keep Session" was also loading that session when you double-click
on a .blend to open it, or when a .blend file was on commandline.

Moved this feature to the main() in creator.c, so it can check on it properly, skipping the
kept session when a file was loaded.
2013-04-13 12:03:20 +00:00
85e53317be fix for bug where notifiers could hold pointers to freed data which listeners would operate on. 2013-04-08 13:03:04 +00:00
677172fd65 code cleanup: use bools in interface handlers, dont show translation menu when right clicking on splash, use less confusing args for copy/paste function. 2013-04-04 15:16:29 +00:00
3c5c4fb4f6 Remove unused function.
It was only used for movie clips prefetching, no need
in it nowadays.
2013-04-04 12:26:31 +00:00
7bbaf4853a code cleanup: use bools in UI and WM code, quiet some shadow warnings, remove unused function uiEmboss() 2013-04-04 02:05:11 +00:00
64d161de87 style cleanup:
also rename mesh_getVertexCos() --> BKE_mesh_vertexCos_get() to match curve function.
2013-03-26 07:29:01 +00:00