Compare commits

...

323 Commits

Author SHA1 Message Date
baca8611e5 Merge branch 'master' into active-fcurve-keyframe 2020-09-01 12:38:05 -05:00
2930d4fcea Fix T80031: UI: Use a more specific label for stencil mask opacity
This is not the opacity of the vertex colors itself but of the stencil 
mask.

Follows up on rBbb4478f2fdd8426d6050bf7b7c09611afeb1bd14
2020-09-01 12:56:22 -04:00
d6a9783b71 Cleanup: GLFrameBuffer: Reduce indentation 2020-09-01 18:42:46 +02:00
7edd60b35b GLFramebuffer: Avoid calling method on a partially destroyed GLContext
This avoid an ASAN runtime error.
2020-09-01 18:42:37 +02:00
3c54db4a4e Audaspace: port compilation fix from upstream. 2020-09-01 18:12:48 +02:00
a92ab93c7d Fix T79553: StretchTo constraint: Apply Pose changes bone length
Recompute Rest Length stored in the StretchTo constraint after applying
the current pose as rest pose.

The "Apply Pose as Rest Pose" operator applies the evaluated pose as
rest pose, which means that the change in bone length from the StretchTo
constraint is applied to the rest pose. The bug was caused by the fact
that the StretchTo constraint wasn't updated for the new pose, and thus
still applied the same scale factor to the new pose, effectively
doubling its effect.

The "Apply Pose as Rest Pose" operator now forces a recompute of the
rest length cached in the StretchTo constraint data. As a result, the
length of the bone before and after the pose is applied remains the
same. The X and Z scale (perpendicular to the bone length) are reset to
1.0, as with the applied pose the bone isn't stretched or squashed any
more.
2020-09-01 17:57:42 +02:00
23767937ef USD: remove library initialisation hack
Remove the hack for library initialisation; this is no longer necessary
as the required information can be passed to the USD library after its
static initialisers have run.

This new approach is compatible with both the patched and original USD
library. This means that platform maintainers don't need to rebuild the
USD library until the next upgrade.

Manifest Task: https://developer.blender.org/T80320
2020-09-01 17:29:01 +02:00
fef1a6c54e USD: move library initialisation from main() to USD module
Initialize the USD library when used (instead of at startup), so that
this can happen inside the IO/USD module. This makes calls to the USD
library local to Blender's USD code.

Note that failure to find the USD JSON files will now only be reported
when the USD exporter is used, and not on every startup of Blender.

This is the first step in cleaning up the way Blender patches and
initialises the USD library.

Manifest Task: https://developer.blender.org/T80320
2020-09-01 17:28:05 +02:00
f1b10477c2 GPUOffscreen: Remove scissor and viewport state tracking
This was a workaround that is not needed anymore.

Fix FT80321 Cropped output with Viewport Render Animation
2020-09-01 17:22:57 +02:00
907a718ebe Fix T80224: Crash after duplicating and hiding vertices while using X Axis Mirror
The mirror map can reference a hidden vertex that is currently ignored
in the transformation.

Thus the mirror element array is not filled.
2020-09-01 12:13:34 -03:00
eb911610d0 Fix ugly alignment of "Mono" option in the Sequencer
Steps to reproduce were:
* Open Sequencer, add a sound strip
* In the sidebar, open the Adjust > Sound sub-panel
* Note the placement of the "Mono" item

The layout code would disable decorators if a property came from a
non-animatable data-block type. Doing so would mess up the alignment
where properties from different data-block types were be mixed.
This is not the case any more.

Note that when actually adding the decorator, a blank icon is inserted
to keep the alignment intact when the data-block type isn't animatable.
So the decorator is still not shown, but the alignment looks fine.

This may affect more cases. If so, and if that's an issue, the
decorators should be explicitly disabled.
2020-09-01 17:10:42 +02:00
ee393f9821 Fix (unreported) GPencil cannot deselect points with box/lasso select
Selecting in empty space wasnt considered as 'changed'.

Differential Revision: https://developer.blender.org/D8770
2020-09-01 17:03:09 +02:00
fec522be6a Fix T79941: mantaflow cache doesn't work with ' character in path
The fix is to escape the `'` character as well.

Reviewers: sebbas

Differential Revision: https://developer.blender.org/D8773
2020-09-01 16:33:32 +02:00
a708cdabe6 Fix T80328 Commit introduced build warnings in Windows 2020-09-01 16:16:48 +02:00
7e3967ed37 Gizmo: Navigate: Make use of UI_draw_roundbox_4fv
This improves circles AntiAliasing, and line antialiasing.

This keeps the old drawing method (3d spheres) for the selection pipeline.

This was suggested by @harley on devtalk.
2020-09-01 16:08:50 +02:00
998b680e5b UI: Widget: Add conservative raster to avoid cut widget borders
This avoids incorrect AA when the widget is not perfectly alligned with the
pixel grid.
2020-09-01 16:08:50 +02:00
31004ef48e Transform: Keymap: Enable Auto Constraint with Middle Mouse + Shift 2020-09-01 10:59:16 -03:00
c7287ffaec Transform: remove MOD_CONSTRAINT_PLANE
It conflicts with MOD_PRECISION and was not really working properly.
2020-09-01 10:50:50 -03:00
8170c92ed4 Fix constrain plane masking shift event
This prevented transformation with a precision modifier.
2020-09-01 10:38:37 -03:00
26d5c24f0a Fix T80258: UILayout.prop_search() issues with datablock names
If the search menu was used for a string property, and a data-block was
selected from the search, the value set would be an invalid name. The
property would get the modified UI string, not the proper data name set.

This problem was already once solved in rB249ccab111ac, but resurfaced
in rB937d89afba36.

Now only use the modified UI string if requires_exact_data_name is not
true.

Note: the comments in rB249ccab111ac [reg. library hints and string
properties, also that pointer properties are preferred over string
properties when dealing with IDs] still apply.

Reviewers: campbellbarton

Differential Revision: https://developer.blender.org/D8759

(cherry picked from 2.90 commit
cb0b0416f4)
2020-09-01 15:24:26 +02:00
9259052e15 Fix T64267: 'Add Snap Point' does not work with Ctrl pressed 2020-09-01 09:53:35 -03:00
Germano Cavalcante
526fbdec3b Transform: Move some hardcoded keyitems to keymap_data in python
Keymaps must be customized by the user.

But this is not the case for hardcoded keymaps.

Also the repetition of hardcoded and user-defined keyitems may induce
the user to think they have made a mistake or it is a bug.

Differential Revision: https://developer.blender.org/D6454
2020-09-01 09:39:06 -03:00
Stefan Werner
17cf500101 Cycles: Fixed Cycles standalone build.
The node refactor in 429afe0c62 was missing in the standalone code.
2020-09-01 14:13:17 +02:00
07899ddd22 Fix double include of gmp.cmake
This fixes `make deps` complaining about the `extern_gmp` project being
defined twice.
2020-09-01 12:39:58 +02:00
d6d2897ef0 Sequencer: Fix crash caused by stereo rendering fix
Caused by rB2e908156d0c7

This was caused by the sequencer timeline area not using a GPUViewport
but still using `sequencer_draw_preview`.
2020-09-01 12:03:52 +02:00
991eb5f79c Cleanup: GPUContext: Remove unused functions 2020-09-01 12:03:52 +02:00
a6185e4fa5 OCIO: Make GLSL implementation use GPUUniformBuf to avoid debug errors
Now that we use internal state info, we require drawing that uses the
GPU api to use it throughout the whole pipeline. This is in order to
track the GL state and do our own error checking.
2020-09-01 12:03:52 +02:00
53a806f6df GPU: Move UBO binding validation to GL backend
This also make the validation quicker by tracking the currently
bound slots.
2020-09-01 12:03:52 +02:00
5ec0250df9 EEVEE: Volumetric: Fix Mesa Compiler error
The compiler does not seems to understand the `const` in the
function declaration and complains about non constant indexing
of unsized array.
2020-09-01 12:03:52 +02:00
ccf476f8af EEVEE: Volumetric: Fix missing UBO
This is undefined behavior on certain system.
2020-09-01 12:03:52 +02:00
f818d1d636 Cleanup: Fix warnings in our intern bullet api wrapper
No functional changes.
2020-09-01 12:01:50 +02:00
Stefan Werner
45da7ce177 Cycles: Followup fixes for node ownership refactor.
There were some places where nodes still would end up without owners.

See D8540 and 429afe0c62
2020-09-01 11:47:54 +02:00
e8be55a485 Fix: Active rigidbodies would not recive updates after the stopped being animated
Because depsgraph isn't rebuild for animated properies, we have to
assume that active bodies will always want to have updates from the
rigidbody simulation.
2020-09-01 11:41:44 +02:00
c2df6658ee CMake: Fix linking errors with gmp library
gmpxx library (C++ version of gmp) uses symbols from libgmp, which means
the libgmp is to be passed to the linker after libgmpxx.
2020-09-01 11:31:47 +02:00
114150e80c Fix compilation error with -Werror=array-bounds
This error happened only with O2 or O3 in my tests.
Casting to uintptr_t and back seems to quiet the compiler.
2020-09-01 11:11:21 +02:00
1449ae042e Cleanup: EEVEE bloom shaders
- moved to eevee_shaders
- added to test suite

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D8763
2020-09-01 10:57:20 +02:00
c78c425266 PyAPI: expose 'bl_options' for operators in bpy.ops
Useful for checking which operators are only for internal use.
2020-09-01 17:02:51 +10:00
06ba233374 RNA: rename Area.ui_type 'VIEW' enum identifier to 'IMAGE_EDITOR'
The term makes sense in the image editor, but not among other editors
where we had both VIEW and VIEW_3D.
2020-09-01 16:35:47 +10:00
87aa13d025 PyAPI: prevent leading comma when printing some enums
BPy_enum_as_string (used for creating error messages)
showed a leading comma for enums that used category headings.

While harmless, it looks odd.
2020-09-01 16:32:11 +10:00
76f513f6dc Fix T78601: User count errors when reading home-file
Calling: bpy.ops.wm.read_homefile(use_empty=True)
exposes invalid user-counts in versioning code.

Simplified logic for assigning materials in versioning code.

Caused by 29f3af9527.
2020-09-01 15:00:48 +10:00
a241948ad9 Fix errors ensuring grease pencil palette
- Direct assignment caused ID user counts to be invalid.
- The first palette would always be used,
  even when the named palette searched for was found.

Also pass 'const' string to `hex_to_rgb`, avoid casting to 'non-const'.
2020-09-01 15:00:48 +10:00
d9d0a386cb Cleanup: don't register mix-in menu class
The class is only used as a base for other menus.

This caused complications for tests that inspect menu contents.
2020-09-01 15:00:48 +10:00
8c86c55035 Cleanup: correct doxy sections 2020-09-01 15:00:48 +10:00
bb4478f2fd Fix T80031: UI: "Stencil Opacity" is vague
This affects the mask opacity not the stencil itself.
2020-08-31 23:30:18 -04:00
12c0ecc934 Fix T80100: To sphere tooltip uses "vertices" even in object mode 2020-08-31 23:30:18 -04:00
4e06afb0a1 GL: Fix two GLerror
The gizmo one was only reproducible in debug builds.
The GLImmediate one was only affecting amdpro drivers when --debug-gpu was
enabled.
2020-09-01 00:30:36 +02:00
7f95d780e8 GLImmediate: Use CL_CHECK_ERROR
This provides a bit more debugging info on MacOS.
2020-09-01 00:30:36 +02:00
9d932b426f GL: Move MacOS debug callback to gl_debug.cc
And format to use the same callback as standard debugging layer.
2020-09-01 00:30:36 +02:00
82a197cc7f GPUDebug: Reformat GL debug callbacks and move them to GL backend
Now the callbacks are setup for each debug context.

The formating has been reworked to be less verbose and make errors
and warnings stand out from the notifications.
Errors are most of the time sufficiently explicit in their message.

This also remove the support for AMD_debug_output which is 10 years old.

This is related to the Vulkan port T68990.
2020-09-01 00:30:36 +02:00
058d29ed9a GHOST: Enable debug context on offscreen context too
This was a long standing TODO. This was also preventing debug callbacks
form other context than the main window.
2020-09-01 00:30:36 +02:00
13b0a697a0 Cleanup: GPU: Remove GPU_draw_primitive and default_vao_
These are not used anymore and can be replicated using the GPUBatch API.
2020-09-01 00:30:36 +02:00
052538edc1 Cleanup: Use GPUBatch for icon and area drawing
This is in order to remove GPU_draw_primitive to streamline the drawing
abstraction.
2020-09-01 00:30:36 +02:00
3e7feaff44 Cleanup: Comment formatting in unit.c 2020-08-31 14:18:06 -05:00
fc8533a3c9 New Boolean: Always expose solver propery, add warning
After discussion with @howardt, it seems the solver property should
always be exposed, even in lite builds. This commit removes the
ifdefs for that property and adds a warning if the "Exact" solver is
used when Blender is compiled without GMP.

These changes apply to the boolean modifier as well.
2020-08-31 11:49:22 -05:00
7056f180d3 cleanup: Fix GMP spacing in cmake configurations
It now follows the spacing around it.
2020-08-31 09:42:58 -06:00
3014b5efc8 Fix unused parameter warning in snap_increment_apply_ex()
No functional changes.
2020-08-31 17:37:48 +02:00
f5866f484f Remove patch for HDF5 library
Delete `hdf5.diff`, because it's no longer used. Since Blender 2.90 the
optional support for HDF5 has been dropped, but this file accidentally
wasn't deleted.

See 0102b9d47e and 0c38436227.

No functional changes.
2020-08-31 17:32:28 +02:00
Germano Cavalcante
546b900194 Cleanup/Refactor: Split the snap to increments code
Now we have a better distinction of what is snap to grid and what is
snap to increments.

The code also allows the implementation of mixed snap for these modes.
2020-08-31 11:24:37 -03:00
a1df2fc443 Cleanup: GPU: Remove unused attr_binding and primitive code 2020-08-31 15:15:04 +02:00
1804eb57fd GPUImmediate: GL backend isolation
This is part of the Vulkan backend task T68990.

This is mostly a cleanup, however, there is a small change:
We don't use a special Vertex Array binding function for Immediate
anymore and just reuse the one for batches.
This might create a bit more state changes but this could be fixed
easily if it causes perf regression.

# Conflicts:
#	source/blender/gpu/intern/gpu_context.cc
2020-08-31 15:14:47 +02:00
1b3a0ae231 GLContext: Fix framebuffer deletion to GPUContext
This has more meaning as it's the base class who holds the pointer.

# Conflicts:
#	source/blender/gpu/opengl/gl_context.cc
2020-08-31 15:13:26 +02:00
a54fb081ba Cleanup: GPU_immediate: Change assert to BLI_assert 2020-08-31 15:10:38 +02:00
Germano Cavalcante
a440060142 Fix T79973: Re-ordering face maps messes up the names of other face maps
Use a remap function instead a swap.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D8739
2020-08-31 09:00:48 -03:00
c83ef9d7b2 Cleanup: reduce variable scope 2020-08-31 13:59:33 +02:00
e9da71ae2d Cleanup: reduce variable scope and use LISTBASE_FOREACH 2020-08-31 12:55:51 +02:00
c5b9bf32e9 Fix T80126: Alembic Import dialogue has overwrite protection UI
Use `FILE_OPENFILE` when importing, rather than `FILE_SAVE`.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D8715
2020-08-31 12:39:01 +02:00
1c2ade053a Linux: 2.90 release information in appdata 2020-08-31 11:21:01 +02:00
6879798202 Cleanup: Resolve unused variable warning in lite build 2020-08-30 22:47:05 -05:00
596b30a080 Clang Tidy: Fix readability-delete-null-pointer warnings 2020-08-30 18:58:40 -05:00
429afe0c62 Cycles: introduce an ownership system to protect nodes from unwanted deletions.
Problem: the Blender synchronization process creates and tags nodes for usage. It does
this by directly adding and removing nodes from the scene data. If some node is not tagged
as used at the end of a synchronization, it then deletes the node from the scene. This poses
a problem when it comes to supporting procedural nodes who can create other nodes not known
by the Blender synchonization system, which will remove them.

Nodes now have a NodeOwner, which is set after creation. Those owners for now are the Scene
for scene level nodes and ShaderGraph for shader nodes. Instead of creating and deleting
nodes using `new` and `delete` explicitely, we now use `create_node` and `delete_node` methods
found on the owners. `delete_node` will assert that the owner is the right one.

Whenever a scene level node is created or deleted, the appropriate node manager is tagged for
an update, freeing this responsability from BlenderSync or other software exporters.

Concerning BlenderSync, the `id_maps` do not explicitely manipulate scene data anymore, they
only keep track of which nodes are used, employing the scene to create and delete them. To
achieve this, the ParticleSystem is now a Node, although it does not have any sockets.

This is part of T79131.

Reviewed By: #cycles, brecht

Maniphest Tasks: T79131

Differential Revision: https://developer.blender.org/D8540
2020-08-30 23:49:38 +02:00
19363880a6 New boolean: silence an "unused" warning.
Previous commit stopped using some functions. Since I may need
them again for future performance tuning, these are just ifdef'd out
for now.
2020-08-30 14:11:36 -04:00
3fa1280132 Fix T79940 VSE Editor crash when opening a different scene as a strip
This was caused by a double lock of the DRW context mutex.

This changes the logic a bit by releasing the DRW context before rendering
with BKE_sequencer_give_ibuf and restoring it after.

Critical fix for 2.91

Reviewed By: dfelinto
Differential Revision: https://developer.blender.org/D8657
2020-08-30 19:58:54 +02:00
19c9b27ffe New boolean: another performance improvement.
Instead of calculating exact normals for all faces, just do it
for those that potentially intersect. A big improvement for dense
meshes that only intersect in relatively few places.
2020-08-30 13:47:18 -04:00
ade8d84fe3 GPUFrameBuffer: Fix build error on MSVC
This also gets rid of the macro.
2020-08-30 19:07:49 +02:00
0299817e0e Fix T80138 Node Editor: Add Frame turns background gray
The removed `UI_ThemeClearColor` made no sense in this context. It must
have been a leftover from previous refactor.
2020-08-30 18:24:19 +02:00
3699d6fe34 Re-enable modifer and bmesh_boolean tests.
These were disabled in the newboolean merge commit.
This commit renables them, using the original 'FAST' solver
so that the result objects need not change.
A TODO to add more tests using the 'EXACT' solver,
though most functionality there is now covered by unit gtests.
2020-08-30 08:31:40 -04:00
dee665b462 GPUShader: Improve shader compilation log
- Print shader type (fragment, vertex, geom)
- Support for Apple + intel error format.
- Handle formatting a bit more gracefully.
2020-08-30 13:35:25 +02:00
ad5d5d3f3b EEVEE: Fix broken rendering caused by SSR + Alpha blended material
This was affecting Mesa drivers as well as AMD pro driver. But it
might have been noticeable on other config too.

This was introduced by rBa9f2ebb21508.
2020-08-30 13:11:03 +02:00
d98c722a5a GPUFramebuffer: Tag dirty after recursing downsample
Also do not bind automatically. This is fine since the framebuffer will
update next time it's bound.
2020-08-30 13:11:03 +02:00
8527d84d35 GPUState: Move Scissor and Viewport state to framebuffer
This way it is way clearer what each viewport state is. There is
no more save and reset. The scissor test is also saved per
framebuffer.

The only rule to remember is that the viewport state (size and
origin) is reset for both the viewport and scissor when a texture
is attached or detached from an attachment slot.
2020-08-30 13:11:03 +02:00
4f395c84fe BLI_math_vector: Add equals_v4v4_int 2020-08-30 13:11:03 +02:00
0f372f3966 GPUContext: Update internal framebuffer size when activating context
This is to ensure the FrameBuffer extents are always up to date.
2020-08-30 13:11:03 +02:00
bb530a77b6 BLI_utildefines: Fix assignment in binary ops for ENUM_OPERATORS
That was an overlook from the review when we introduced it.
2020-08-30 13:11:02 +02:00
83f144b176 WM: Remove 10year old workaround for buggy drivers
This should have no consequence nowadays.
Can be reverted if needed.
2020-08-30 13:11:02 +02:00
832a975c2c GPUUniformBuf: Fix debug name being shorter than release name 2020-08-30 13:11:02 +02:00
f69c7a7ff9 Cleanup: GPUContext: Remove default_framebuffer_
This is now handled by FrameBuffer wrapping.
2020-08-30 13:11:02 +02:00
807817c0c4 GPUFrameBuffer: Use debug name support
This is to make it easier to navigate captures in renderdoc.
2020-08-30 13:11:02 +02:00
f3a65a1b4a GPUFrameBuffer: GL backend isolation
This is related to the Vulkan port T68990.

This is a full cleanup of the Framebuffer module and a separation
of OpenGL related functions.

There is some changes with how the default framebuffers are handled.
Now the default framebuffers are individually wrapped inside special
GLFrameBuffers. This make it easier to keep track of the currently bound
framebuffer state and have some specificity for operations on these
framebuffers.

Another change is dropping the optimisation of only configuring the
changed attachements during framebuffers update. This does not give
any benefits and add some complexity to the code. This might be brought
back if it has a performance impact on some systems.

This also adds support for naming framebuffers but it is currently not
used.
2020-08-30 13:11:02 +02:00
0850afb34e Cleanup: GPU: Remove unused init/exit functions 2020-08-30 13:11:02 +02:00
6e901fd8fc GPUFramebuffer: Make GPUFrameBuffer an opaque type
This is in preparation of the Framebuffer GL backend.

This is a just changing types and moving some code.
No logic is changed... almost... it just removes the context attach.
i.e: `gpu_context_add/remove_framebuffer()`
This is not needed for now and was even disabled in release.

This is part of T68990.
2020-08-30 13:11:02 +02:00
ed7dbaa5a7 GPUState: Fix missing writemask encapsulation
This was the last remaining.
2020-08-30 13:11:02 +02:00
b1b1be1754 Object: support multiple objects for limit-total vertex groups
Also add this to the "Clean Up" menu.
2020-08-30 18:53:24 +10:00
12bc34b0b8 Object: add ED_object_array_in_mode_or_selected
Use this utility function for render-shading & weight paint modes.

This adds support for edit-mode & pose-mode where all objects in the
mode are used in this case instead of the selected objects.
2020-08-30 18:53:19 +10:00
1a623c183f UI: add "Object -> Clean Up" menu
Useful to perform cleanup operations on many objects at once,
also these operations weren't accessible from the search menu.

This follows the convention for other clean up menus
when editing mesh, curve & grease-pencil.

Resolves issues raised in T80011
2020-08-30 13:48:35 +10:00
530ccde909 Object: support removing unused weights for selected objects
This is useful to run in object-mode, instead of from the property editor,
note that this still only used the current object when activated from
the property editor.
2020-08-30 13:48:35 +10:00
1a650fdcb2 Object: support removing unused material slots for selected objects
This is useful to run in object-mode, instead of from the property editor,
note that this still only used the current object when activated from
the property editor.
2020-08-30 13:48:30 +10:00
47908f0155 Operator: expose ED_operator_object_active_local_editable_ex
Support calling this function with an object argument,
useful for implementing filter functions that loop over objects.
2020-08-30 13:42:28 +10:00
2778937fb6 BKE_layer: add BKE_view_layer_array_selected_objects_params
Useful for similar situations as BKE_view_layer_array_from_bases_in_mode_params
without depending on the active objects mode.
2020-08-30 13:42:28 +10:00
e06050945e Cleanup: pass v3d as const to view layer utilities 2020-08-30 13:42:28 +10:00
3abbae2d7c UI: Use term "Plasticity" instead of "Plastic" 2020-08-29 23:30:53 -04:00
3789aa8506 New Boolean: performance improvement.
Avoided cost of searching for coplanar clusters in many cases.
2020-08-29 17:48:01 -04:00
d8585e184a New boolean: fixed a bug in coplanar intersect.
The code that found coplanar clusters was not updating a bounding box.
Also, code that was detecting non-trivial coplanar intersects was
slightly wrong, but that would not have caused any functional problems.
2020-08-29 11:31:47 -04:00
014276a11c Cleanup: spelling 2020-08-29 18:56:08 +10:00
bfa78aceed Cleanup: remove paranoid 'MDeformVert.totweight < 0' check
This was added in 1cb7267a9f, however the behavior before this
would have failed on negative values already.

Also negative values here would fail in many other places.
2020-08-29 10:48:33 +10:00
141a3e6d47 Boolean Modifier: Reorder properties
Properties that display conditionally depending on other properties
should generally be lower down so the movement of buttons as
settings are tweaked is less intrusive.
2020-08-28 16:41:13 -05:00
f34653e498 Clang Tidy: Fix readability-delete-null-pointer warning 2020-08-28 16:20:25 -05:00
5c5d43fd66 Clang Tidy: Fix no lint marker placement
There was a line between the NOLINTNEXTLINE marker and the function.
2020-08-28 16:12:47 -05:00
91bbf96c1d Revert "tmp"
This reverts commit b78a439e90.

This was committed by mistake, and including BLI_winstuff.h on non-windows
platforms results in an error.
2020-08-28 15:29:10 -05:00
pembem22
d8283a1f89 UI: Improve curve grid drawing code
This patch fixes assert on grid drawing. `for` loops are used instead
of `while` loops to make sure the number of lines is exact. The old
code draws lots of unnecessary lines offscreen. This bug is fixed as
well. See the patch for a comparison without a scissor test.

Differential Revision: https://developer.blender.org/D8745
2020-08-28 15:22:36 -05:00
744eb1172e Fix T80195: crash when invoking tooltips on MacOS
Problem introduced in rBadd48c007428.
`UI_but_string_info_get` can change the value of the args.
2020-08-28 17:09:19 -03:00
b78a439e90 tmp 2020-08-28 17:09:19 -03:00
8f5b9fb519 Fix for T75369: Text Editor Line Color
Use correct text color when syntax highlighting is off but line numbers are on.

Differential Revision: https://developer.blender.org/D7337

Reviewed by Hans Goudey
2020-08-28 09:58:48 -07:00
c0eb6faa47 UI: Do Not Display Negative Zero Floats
Display negative zero floats as regular zero. Does not alter underlying value.

Differential Revision: https://developer.blender.org/D4795

Reviewed by Brecht Van Lommel
2020-08-28 09:30:51 -07:00
285353c252 Cleanup: clang-format 2020-08-28 10:04:26 -06:00
79e82dbc05 cleanup: Fix style issue in sculpt.c
At first sight this code should not build at all
but due to the use of macro's that look like functions
this seemingly has no issues building.

Clang-format alerted me to this strange bit of code
by placing the `if` on it's own line for some reason.

added the missing brackets, and clang-format is happy
again.
2020-08-28 10:03:52 -06:00
7844486e47 Change cmake configs for full and release to enable WITH_GMP. 2020-08-28 11:49:10 -04:00
1cb7267a9f Cleanup: Fix build error with msvc
`ssize_t` is not a standardized type (it's a posix type)
given the line in question here is calculating the size
of a memory allocation there's no logical way this
should ever be negative.

I do not know this code too well and was unsure if
`mdverts->totweight` could ever be < 0, so I protected
it with a clamp, just in case.
2020-08-28 09:47:52 -06:00
4749bd2277 Fix to previous commit to allow building without WITH_GMP. 2020-08-28 11:43:56 -04:00
9e09b5c418 Merge newboolean branch into master.
This is for design task T67744, Boolean Redesign.
It adds a choice of solver to the Boolean modifier and the
Intersect (Boolean) and Intersect (Knife) tools.
The 'Fast' choice is the current Bmesh boolean.
The new 'Exact' choice is a more advanced algorithm that supports
overlapping geometry and uses more robust calculations, but is
slower than the Fast choice.
The default with this commit is set to 'Exact'. We can decide before
the 2.91 release whether or not this is the right choice, but this
choice now will get us more testing and feedback on the new code.
2020-08-28 11:01:06 -04:00
4a17508c6d Merge branch 'blender-v2.90-release' into master 2020-08-28 16:58:40 +02:00
62e2d92aed Blenloader: add api function for accessing packedfile address map
This is needed to move direct_link_packedfile out of readfile.c for T76372.
2020-08-28 16:57:34 +02:00
ddbf41d88d Fix T80104: Crash on making material local.
Problem is again with the embedded data, we want to make those local
together with their owner ID, but sometimes we are actually dealing with
copies here, which are inheritently already local.

Code did not considered that possibility before, leading to access to a
NULL `lib` pointer.

This should also be back-ported to 2.83 LTS release.

Maniphest Tasks: T80104

Differential Revision: https://developer.blender.org/D8731
2020-08-28 16:51:16 +02:00
5086bdfe0b Fix T80064: Adding mask curve points doesn't work around endpoints 2020-08-28 11:50:21 -03:00
368f8f7404 Blenloader: new api function to check if reading is for undo 2020-08-28 16:29:55 +02:00
7b2fe4c9ec Refactor: move Lattice .blend I/O to IDTypeInfo callbacks 2020-08-28 16:10:17 +02:00
8815996418 Refactor: move Mesh .blend I/O to IDTypeInfo callbacks
I'm also adding `BKE_id_blend_write`, so that it can be accessed
outside of `readfile.c`.
2020-08-28 15:49:14 +02:00
5db5ac611a GPU: Fix Segmentation Fault Freeing Failed Shader
The CPP Shader class does not initialize the interface attribute.
What will crash when deleting the shader.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D8740
2020-08-28 15:45:07 +02:00
b8f990b0b4 Revert "GPU: Fix Segmentation Fault Freeing Failed Shader"
This reverts commit c284326809.
2020-08-28 15:43:14 +02:00
0ed7aedc71 Fix building without bullet support
The new BKE_rigidbody_is_affected_by_simulation function was in side the
WITH_BULLET ifdef guard.
2020-08-28 15:28:15 +02:00
b4a608c11c Merge branch 'blender-v2.90-release' into master 2020-08-28 15:09:42 +02:00
4fdd8452a6 DNA: add pragma once to dna_type_offsets.h
Sometimes, this generated file is included more than once,
so it should have an include guard.
2020-08-28 15:05:47 +02:00
8726354d46 Fix Rigidbody depsgraph passive and constraint transform relations.
We need to have transforms from passive objects if they are animated or
driven by parent relations. This is not immediately obvious as the
object transform matrix will still be available, it is just one frame
behind in some cases.

Fixed dependency cycles if there is a constraint between two rigid
bodies. Because bullet keeps track of its simulated bodies, we do not
need to supply objects transforms as bullet should already have them.

I need combine these two fixes because otherwise we will get depsgraph
warnings that nodes are missing that it expects to be there.

Reviewed By: Sergey, Jacques

Differential Revision: http://developer.blender.org/D8732
2020-08-28 14:55:59 +02:00
df8a63bb9c Fix T80078: Overrides: Crash with animated IK control on linked armature.
Issue was with our dear posebones again... when applying overrides we
keep the same address/pointer for the IDs themselves, (which avoids us
the need to remap their usages), but their inner data is often
re-allocated.

Therefore, we need once again to go over armature objects and invalidate
their posebone pointers.

This should also be back-ported to Blender LTS 2.83.

Maniphest Tasks: T80078

Differential Revision: https://developer.blender.org/D8734
2020-08-28 14:53:22 +02:00
Jeroen Bakker
0852ecd844 DrawEngine: Shader Test Suite
A test case that compiles all the GLSL shaders for workbench, gpencil, overlay and some
of eevee. Compilation is still platform dependent, but when run on a test-farm
with different hardware we will be able to detect GLSL compilation
errors early on.

The test will be compiled when `WITH_GTEST` and `WITH_OPENGL_DRAW_TESTS`
are On.

For eevee only the shaders inside eevee_shaders.c are included. EEVEE has some shaders
located inside the submodule. They aren't accessible to the outside and aren't added
to the test case. We should see how we want to add them. For the test cases it is better
to move them to eevee_shaders.c, but for eevee perspective it is better to keep them in
the submodule. Keeping them in the submodule could lead to situations that is harder to test.
as the shader could already have been initialized.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D8667
2020-08-28 14:47:27 +02:00
Jeroen Bakker
2654e9c9c1 Fix T80141: Fix Compiling Workbench Volume Shaders (Mesa 20.0.8)
Default mesa driver for ubuntu 20.04 fails when a name is defined twice.
M_PI is defined in both `common_workbench_lib` and `common_math_lib`. This patch
remove the define out of common_workbench_lib

For reference it fails on https://github.com/mesa3d/mesa/blob/mesa-20.0.8/src/compiler/glsl/glcpp/glcpp-parse.y#L1186
during the check if the macros are the same.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D8741
2020-08-28 14:41:41 +02:00
Jeroen Bakker
922aac999d Fix T79920: Fix Compiling EEVEE Volume Shaders
There were some missing UBO bindings, what asserted in debug mode.
This patch fixes this by binding the missing UBO's

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D8742
2020-08-28 14:40:06 +02:00
Jeroen Bakker
3198fec1fe Fix T80160: Workbench shadows are broken
In recent refactoring {a9f2ebb21508} an issue was introduced that the
opengl rasterizer would be disabled when only writing to a stencil
buffer.

This fix adds stencil writing to the write mask and set it. This makes
the write map not evaluate to GPU_WRITE_NONE and the rasterizer will be
enabled in `GLStateManager::set_write_mask`.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D8743
2020-08-28 14:38:33 +02:00
df8e2c76c9 Merge branch 'blender-v2.90-release' 2020-08-28 14:35:04 +02:00
Jeroen Bakker
c284326809 GPU: Fix Segmentation Fault Freeing Failed Shader
The CPP Shader class does not initialize the interface attribute.
What will crash when deleting the shader.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D8740
2020-08-28 14:32:29 +02:00
a48d78ce07 Refactor: move CustomData .blend I/O to blenkernel
This is part of T76372.
2020-08-28 14:30:45 +02:00
3dc222ea7b Refactor: move defvert .blend IO to blenkernel
This is part of T76372.
2020-08-28 14:30:45 +02:00
65dcf812a5 Fix T80182: Curve [Edit Mode] : Can't Deselect Control Point with Select Box
Caused by rB49f59092e7c8: Curves: Implement Handles for selected points
only

Changes from deselecting all were not considered as changes anymore.

Maniphest Tasks: T80182

Differential Revision: https://developer.blender.org/D8744
2020-08-28 14:28:57 +02:00
2bb60db94a Merge branch 'blender-v2.90-release' 2020-08-28 14:00:51 +02:00
0e021414fe Cleanup: improve function names
With this change, the three .blend read operations: data reading, lib reading
and expanding are more grouped together.
2020-08-28 13:18:24 +02:00
a443287908 IDTypeInfo: add .blend file io callbacks
This is part of T76372.
It adds the `blend_write`, `blend_read_data`, `blend_read_lib`
and `blend_read_expand` which correspond to the various
steps when reading and writing .blend files.
Having these callbacks allows us to decentralize the blenloader
code a lot more. This has the affect that code related to any
specific ID type is less scattered.

Reviewers: mont29

Differential Revision: https://developer.blender.org/D8670
2020-08-28 13:05:48 +02:00
d3f2037966 Fix T80149: Cycles OpenCL baking broken after changes to uses tiles for baking
We forgot to update this code as part of D3108. I'd like to include this in 2.90,
it's entirely broken now so can't really get any worse.

Differential Revision: https://developer.blender.org/D8738
2020-08-28 12:53:50 +02:00
346023b457 Cleanup 'make vertex parent' operator code.
More localized variables, avoid ugly 'offset by one' index usage in
favor of explicit `INDEX_UNSET` define, etc.

No behavior change expected from this commit.
2020-08-28 11:08:03 +02:00
94d6b54826 Merge branch 'blender-v2.90-release' into master 2020-08-28 14:37:05 +10:00
1725e46cee Fix T80135: Duplicate doesn't preserve active spline
Checks to preserve the active spline on duplication
required an active vertex too.

Now having no active vertex doesn't prevent duplicate
from keeping the spline active.

Reviewed by: @mano-wii

Ref D8729
2020-08-28 14:35:30 +10:00
bc2830a3ce Cleanup: use doxy sections in interface_panels.c 2020-08-28 14:25:23 +10:00
84ae44138d Cleanup: spelling 2020-08-28 14:25:19 +10:00
5ee60c9815 Fix (unreported): Walk expansion on scene collection
Left walk navigation while the scene collection is active would collapse
the subtree which shouldn't be allowed. This adds another check to
`outliner_item_openclose` to prevent collapsing the scene collection.

Introduced in rBb077de086e14.
2020-08-27 18:49:47 -06:00
e726ed3c6b Fix: Outliner walk navigation in Data API mode
Because the subtrees in Data API mode are empty for performance reasons,
it was impossible to move through the tree with walk navigation. This
adds an exception to allow walk navigation to expand subtrees in that
mode.
2020-08-27 18:25:51 -06:00
2a0e996d77 Fix T80159: Custom Normals Averaging crash after clearing
custom split normals data

Clearing custom split normals would get rid of the CD_CUSTOMLOOPNORMAL
layer - but editing data `lnor_spacearr` would be kept.

Adding a CD_CUSTOMLOOPNORMAL layer (if none exists yet) should be done
in `edbm_average_normals_exec` / `BKE_editmesh_lnorspace_update` /
`BM_lnorspace_update` / `BM_lnorspacearr_store`. The thing is that if
the editing data `lnor_spacearr` would still be valid after `Clear
Custom Split Normals Data`, blender would happily call
`BM_lnorspace_rebuild` instead. Doing that without a CD_CUSTOMLOOPNORMAL
layer is asking for trouble.

Now clear lnor_spacearr on `Clear Custom Split Normals Data` as well.

Thx @mont29 for feedback here.

Maniphest Tasks: T80159

Differential Revision: https://developer.blender.org/D8730
2020-08-27 22:12:12 +02:00
770cc66f75 UI: Avoid redundant loops in region panel handler
Currently the panel handler loops through every block and every button
for every single panel. This commit moves that check to happen a single
time at the beginning.
2020-08-27 14:36:01 -05:00
a8766de5d5 Fix T68317: Panel "A" key doesn't collapse subpanels properly
We need to only collapse or expand the first panel under the cursor
rather than all of them. Note that whether the parent panel or
the subpanel is first depends on the order of the uiBlocks in the
region's list.
2020-08-27 14:22:28 -05:00
714dbf273c Clang Tidy: Fix warning
Fix readability-static-definition-in-anonymous-namespace in new code
2020-08-27 14:18:06 -05:00
f1565e7f73 UI: Cleanup / refactor region panel event handling
The code for handling panel events was much more complicated than it
needed to be. This commit removes some unecessary function calls and
variables, reduces indentation levels by returning early, and does
some other general cleanup.
2020-08-27 14:02:14 -05:00
0649ed7fa2 GPencil: Don't convert color to sRGB
The color is linear, so the conversion is breaking the real color.
2020-08-27 20:13:51 +02:00
e74a24f0bb Fix T77382: zooming into adjust last operation panel clips contents
This panel should not have zoom functionality at all, just like headers and
many other regions don't have it either.
2020-08-27 19:52:56 +02:00
9d6789115a Cleanup: Move panel category drawing to proper section
Somehow the panel category drawing functions ended up in the middle
of the region event handling code. This commit moves them to their
own section next to the rest of the drawing code.
2020-08-27 12:33:27 -05:00
eed8ea1b73 Cleanup: Fix white space in versions.cmake 2020-08-27 11:03:31 -06:00
9b0ef34534 Fix Outliner allowing to enter Pose Mode on linked armature
If a different object was active, clicking on a linked armature's pose
in the Outliner would enter Pose Mode for it.
This would actually cause a failed assert, but in release builds the
armature would just enter pose mode.

Steps to reproduce were:
* Link in armature object
* Activate a different object
* In the Outliner, un-collapse the armature object
* Activate Pose Mode by clicking on its pose there
2020-08-27 16:40:56 +02:00
8a984ddd0f Cleanup: Fix build warning on windows
MSBuild on windows currently spews a warning about
buildinfo.h_fake not being generated.

For build info we use a non existing file to trigger a
custom_command on every build, which has worked well for
years now, however in recent versions of MSBuild it has
started issuing warnings about files that should be
generated but are not.

CMake is actually aware of this being a problem and states
in the documentation that "If the output of the custom command
is not actually created as a file on disk it should be marked
with the SYMBOLIC source file property."

This change fixes the build warning by properly marking the
buildinfo.h_fake as symbolic resolving the warning.
2020-08-27 08:10:37 -06:00
e51c721315 Fix crash of alembic tests after recent depsgraph builder change
Need to make sure node factories are initialized prior to the dependency
graph allocation.

The regression was initially introduced in 5b021dff41

Thanks Brecht for testing!
2020-08-27 14:52:58 +02:00
1131328aeb Fix: Mantaflow always builds openvdb statically
This would lead to problems when we build a dynamic openvdb library.
2020-08-27 14:49:34 +02:00
91aeb452ab Fix: FindEmbree.cmake looking for non existing dynamic libraries and failing
It is now possible to build against a shared embree library.
Before it was only possible to build against static Embree libraries.

Reviewed By: Brecht

Differential Revision: http://developer.blender.org/D8702
2020-08-27 11:55:40 +02:00
54b47da565 Cleanup: clang-format 2020-08-27 15:33:33 +10:00
8b82693898 MSVC: Set proper flags for C++17 support.
MSVC already builds with the /std:c++17 flag but for
'reasons' [1] MSVC still gives the wrong value for the
__cplusplus define.

This change sets an additional cxx flag on supported
compilers to allow the compiler properly identify
C++17 support.

This resolves 2 warnings coming out of bullet about
the register keyword being deprecated.

[1] https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/
2020-08-26 22:25:40 -06:00
bbf00a6231 Cleanup: Fix build warning with MSVC and OSL
OSL requires RTTI to be off, this is done with the /GR- flag for
MSVC, however /GR is in the default CXX flags leading to warning

D9025 : overriding '/GR' with '/GR-'

which cannot be suppressed.

/GR is on by default and this flag is not required, so removing
it from the default CXX flags makes it possible later use /GR-
without generating warnings.
2020-08-26 22:20:34 -06:00
7f3febf4c0 Fix (unreported): Outliner Data API tree subtree expansion
The changes in rB70151e41dc02 broke subtree expansion in the Data API
display mode because the closed subtrees are empty lists. Move the empty
subtree check from `outliner_item_openclose` to the walk navigation
code to prevent the issue.
2020-08-26 21:29:45 -06:00
489b5790cf Cleanup: Fix build warning with MSVC
`IDTypeForeachCacheFunctionCallback` lists the `flags` parameter
as `uint`, having these functions use `eIDTypeInfoCacheCallbackFlags`
results in the following warning when building with MSVC:

warning C4028: formal parameter 4 different from declaration

This change resolves this warning by changing the parameter to
the appropriate type.
2020-08-26 19:14:17 -06:00
6438fc4f79 Cleanup: Fix MSVC warning in mantaflow
This resolves the following MSVC warning:

warning C4805: '&=': unsafe mix of type 'int' and type 'bool' in operation
2020-08-26 19:07:24 -06:00
Red Mser
479ce00809 UI: Use alternating row theme color in file browser
The outliner already uses the alternating row theme color as an
overlay for every other row. This uses the same color for the file
browser, instead of a hardcoded shading.

The file browser background color is slightly tweaked to match the
outliner, and the Blender Light theme is updated to use a lighter
background color like the outliner.

Reviewed by: Hans Goudey, Julian Eisel

Differential Revision: https://developer.blender.org/D8717
2020-08-26 16:53:58 -05:00
8a9912eaf8 Tests: fail automated tests on memory leaks and other internal errors
This adds a new `--debug-exit-on-error` flag. When it is set, Blender
will abort with a non-zero exit code when there are internal errors.
Currently, "internal errors" includes memory leaks detected by
guardedalloc and error/fatal log entries in clog.

The new flag is passed to Blender in various places where automated
tests are run. Furthermore, the `--debug-memory` flag is used in tests,
because that makes the verbose output more useful, when dealing
with memory leaks.

Reviewers: brecht, sergey

Differential Revision: https://developer.blender.org/D8665
2020-08-26 22:02:02 +02:00
d8cf6ee316 install_deps: add fontconfig to installed libs/tools. 2020-08-26 20:44:53 +02:00
f807b27b67 Cleanup: Fix const warning with BLI_array_free
when you call the BLI_array_free macro with a const pointer you get a
warning when the macro calls `MEM_freeN` (warning C4090: 'function':
different 'const' qualifiers)

This was warning originating from
`smart_uv_project_calculate_project_normals` in `uvedit_unwrap_ops.c`

Normally we resolve these with a non const cast at the callsite
but given BLI_array_free is a macro not a function this is not
an option here and it has to be resolved in the macro.
2020-08-26 11:42:40 -06:00
0498feb0df Fix T80129: Cycles shadow catcher viewport error with exposure other than 1 2020-08-26 19:26:38 +02:00
bd678918ae Fix T80080: improve tooltip for render number of threads
Since the switch to TBB, the threads value specificies the maximum number of
CPU cores used while rendering, it is not longer possible to use more threads
than cores. Change the tooltip to make this more clear.
2020-08-26 19:26:38 +02:00
f699ba3d30 Cleanup: better naming and no bad level access in BLI_winstuff 2020-08-26 19:26:38 +02:00
9de18c361b Outliner: Use shift for restrict button child toggle
The `ctrl` key was mapped to recursive bone selectable and visibility
toggling. This changes the key to `shift` to be consistent with objects
and collections. Also adds an explanation to the tooltip.

Part of T77408

Differential Revision: https://developer.blender.org/D8650
2020-08-26 11:19:19 -06:00
70151e41dc Outliner: Left and right walk navigation
Previously the left and right arrow keys would close and open the active
tree element, but a subsequent key press would not select up or
down the tree as is common in tree-based interfaces.

Walking left and right now does a selection action after opening or closing
the active tree item. For example, a right key press on a closed element
will open it's subtree, and an additional right key press will select
the first child element.

A left key press anywhere in a subtree will first close the active
element if it's subtree is expanded. Walking left again will select the
parent element.

Part of T77408

Differential Revision: https://developer.blender.org/D8650
2020-08-26 10:58:23 -06:00
b028a43245 Cleanup:Remove C++14 flags from extern/quadriflow
The main CMakeLists.txt specifies C++17, quadriflow tries to add C++14
flags leading to the following warnings when building with MSVC

Command line warning D9025 : overriding '/std:c++17' with '/std:c++14`

This change removes the C++14 flags, and fixes a build error caused
by the removal of `std::unary_function` in C++17 in the .obj loader
(which isn't used by blender)

Reviewed By: zeddb

Differential Revision: https://developer.blender.org/D8720
2020-08-26 10:04:24 -06:00
3185e17844 Logging: change error to warning
This is in preparation for https://developer.blender.org/D8665.
2020-08-26 17:48:20 +02:00
14608c5e86 Cleanup: Fix MSVC warning regarding flags in bullet
For bullet we compile at /W0 for MSVC but we did not
remove the standard /W3 flag. Leading to the following
warning:

Command line warning D9025 : overriding '/W3' with '/W0'

This change removes the W3 flag for bullet to get rid
of the warning.
2020-08-26 09:16:21 -06:00
Yevgeny Makarov
2ef5fabec9 Fix T77900: File Browser in macOS fullscreen crashes
When Blender is started in fullscreen mode from the command line,
or if the fullscreen state is saved in the startup file, all temporary windows
will also open in fullscreen mode. When closing the fullscreen File Browser,
Blender would either crash or parent window becomes black.

This does not happen if the Blender switches to full screen manually.

`NSWindowCollectionBehaviorFullScreenPrimary` should be set for windows that
can enter full-screen mode. Otherwise macOS will turn the wrong window into
full-screen.

Similar fix: rB4b39de677d20

Differential Revision: https://developer.blender.org/D8708

Reviewed by: Julian Eisel
2020-08-26 16:27:05 +02:00
239b0ba750 Clenaup: Refactor Sculpt gesture mask operators
This refactors Box Mask and Lasso mask making both functions share the
same code. After this change it should be easier to add new
functionality, new gesture tools or implement new gesture modes.

No functional changes.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D8707
2020-08-26 15:44:54 +02:00
08ec9b71df Merge branch 'blender-v2.90-release' into master 2020-08-26 23:28:44 +10:00
e0772c6607 Fix T80098: Mesh deform doesn't update in edit mode
Use BKE_mesh_wrapper API access to access mesh coordinates
for modifier evaluation.

Call BKE_mesh_wrapper_ensure_mdata when binding
since it's a one off operation.

Regression from deaff945d0.

Reviewed by: @brecht

Ref D8709
2020-08-26 23:20:37 +10:00
826bd46e66 GPencil: Hide Boundary strokes in Render
This change hides the boundary strokes used for closing filled areas in render mode (viewport and final render).

Related to T80128
2020-08-26 15:05:54 +02:00
d4f7c7f4cc GPencil: Fix Assert using fill tool
With the new changes in the Draw Manager, GPU_depth_mask must be set to ON, before clear depth.
2020-08-26 13:32:57 +02:00
a7e1963b63 Cleanup: remove G.debug_value check for old mesh-deform behavior
Added in 2007, it doesn't seem useful to support alternate behavior.
2020-08-26 21:04:00 +10:00
7773663eb7 Cleanup: remove unused UvVertMap.flag 2020-08-26 21:01:28 +10:00
70d48255ae Fix T79992: Error calling context.copy() in Properties Editor
This was an oversight in rB83e3d25bcae3.

Basically we still have the "hair" and "point_cloud" entries for the
context. However they were ifdef'ed.

Note this would mostly happen in 2.90 since we always build without hair
and particles there.

Differential Revision: https://developer.blender.org/D8712
2020-08-26 11:34:12 +02:00
e414afbaf6 Cleanup: typos 2020-08-26 11:24:10 +02:00
c44251c7d7 Merge remote-tracking branch 'origin/blender-v2.90-release' 2020-08-26 11:18:41 +02:00
Evan Wilson
8ddf8cfa6f Fix #ifdef WITH_PARTICLE_NODES and WITH_HAIR_NODES mixup in rna_internal.h
Differential Revision: https://developer.blender.org/D8711
2020-08-26 11:16:48 +02:00
0e50b6529c BLI: support removing multiple elements from a vector 2020-08-26 10:52:43 +02:00
6a10e69d27 UV: match 3D mesh editing behavior for edge-loop select
- Cycling between part of the boundary & the entire UV boundary.
- Include pole vertices in the selection.

Edge loop selection was rewritten to use BMesh connectivity data.
2020-08-26 18:39:25 +10:00
8f545375f9 Cleanup: simplify edge loop/boundary select cycling logic 2020-08-26 16:56:24 +10:00
7fb11f22a2 Docs: comments for interface_handlers.c
Explain why some features have defines,
also use doxy sections for defines & prototypes.
2020-08-26 10:31:50 +10:00
add48c0074 Cleanup: use const variables in interface code 2020-08-26 10:31:44 +10:00
88ada5e218 Cleanup: add SEQ_ALL_BEGIN, SEQ_CURRENT_BEGIN to .clang-format
These were missed in 70500121b4 which caused reformatting.
2020-08-26 09:59:15 +10:00
be4abb42c1 Cleanup: spelling 2020-08-26 09:41:30 +10:00
bbb6ec9e51 Cleanup: build without USE_KEYNAV_LIMIT defined 2020-08-26 09:41:09 +10:00
396d39c6b9 Cleanup: Declare variables where they are initialized
Further changes to interface_handlers.c to avoid a block of variable
declarations at the beginning of functions. Also use const in some
situations. I only made changes where the variable's intended scope
was obvious.
2020-08-25 14:28:04 -05:00
Valentin
6e06936c0e Cleanup in interface_handlers.c
- Reduce variables scope
 - Use some const prefixes
 - Initialize variables at declaration
 - Use comparison to boolean false instead of 0

Differential Revision: https://developer.blender.org/D8678
2020-08-25 13:15:57 -05:00
72bcb900d0 install_deps: also clear BLOSC cmake variables.
Otherwise when switching from self-built to distro packages for OpenVDB,
Blosc CMake cached variables break building...
2020-08-25 19:54:22 +02:00
999667a8c5 Fix T79494 Refrence Image reflects object after source got deleted
Silly typo was causing the error texture to not be bound.
2020-08-25 19:25:39 +02:00
97f75ca87f GPUState: Move state limits getter to the area they belong
This fix a GL_INVALID_VALUE error on startup due to 0.0f max line width.

Also moves the max anisotropy filter to the sampler creation.

This reduces code fragmentation.
2020-08-25 18:18:55 +02:00
2c34e09b08 Outliner: Include gpencil modifiers and effects in the tree
Grease pencil modifiers already had defined outliner icons, but had
never been included in the tree. This adds the modifiers and the shader
effects to the tree.

Part of T68498
2020-08-25 10:04:15 -06:00
21cb6f09ff Fix T77298: Cycles multiple object making not working with multiple samples
The previous fix loaded the pixels so existing tiles were not overwritten.
However the Cycles render buffer is expected to be scaled by the number of
sample, which was not taken into account.

This is not ideal in that previews could have a mismatched number of samples
between multiple objects, though the result will be correct. The better solution
would be to bake all objects together per tile, rather than one after the other.
But that is a bigger change than we can do in 2.90.

Differential Revision: https://developer.blender.org/D8704
2020-08-25 18:00:35 +02:00
949d92ad5d Fix T79811 MacOS: Edit Mode - vertex/edge/face selection is missing
The VAO reconfiguration from the offset workaround was not working.
2020-08-25 17:42:07 +02:00
b2b4f9fc9b Fix buildbot failing due to non-existent git submodule hash
The wrong hash was committed in 95cc709612, presumably due to local changes
to the submodule repository.
2020-08-25 16:13:58 +02:00
c336947dbb Merge branch 'blender-v2.90-release' into master 2020-08-25 23:56:34 +10:00
33ac3582bb Fix T77359: Crash adding UV's in edit-mode with linked duplicates
This prevents UV layer mix up in
MeshBatchCache.cd_used/cd_needed/cd_used_over_time which depends on the
extraction method.

One object's mesh can be accessed with MR_EXTRACT_MESH, another object
that uses the same mesh can use MR_EXTRACT_BMESH based on
(Object.mode & OB_MODE_EDIT), this causes a problem as the edit-mesh
and the mesh aren't always in sync, the custom data layers wont
necessarily match up, causing T77359.

Reviewed by @jbakker, @brecht

Ref D8645
2020-08-25 23:54:26 +10:00
9dd4d87f18 GPU: Fix compilation issue caused by rBb43f4fda19b9 2020-08-25 15:16:06 +02:00
b43f4fda19 GL: Add error checking function
This is to ease the debugging process on Apple GL implementation.
2020-08-25 15:02:34 +02:00
e51c428be6 GPUSelect: Avoid assert caused by clearing without a depth mask
This should not cause any problem since the depth test is required
in order to draw to the depth buffer and this is not altered by
this change.

To be on the safe side, we still restor the mask after altering it.
2020-08-25 15:02:34 +02:00
5f86a10477 Fix T80012: Bevel Shader node Samples value has too low hardcoded limit
Up the hard limit, keep the UI range max at 16

Maniphest Tasks: T80012

Differential Revision: https://developer.blender.org/D8701
2020-08-25 12:34:10 +02:00
8657c6cb71 Merge branch 'blender-v2.90-release' 2020-08-25 12:17:49 +02:00
Red Mser
3ea324488a Fix T80016: Shape key animation is linked when duplicating object
Fix T80016

Caused by a typo in rB7b1c406b5431ce65d84ddb5f2c53977c25c18373

Reviewed By: mont29, dfelinto

Maniphest Tasks: T80016

Differential Revision: https://developer.blender.org/D8693
2020-08-25 12:11:59 +02:00
ac8825621f Merge branch 'blender-v2.90-release' 2020-08-25 11:56:27 +02:00
263cf2ea94 Enabled workaround to solve threading issues in draw manager
This workaround addresses T79533 and T79038 for Blender 2.90. The
solution isn't clear and needs more research and work. In order to
continue with blender 2.90 release it was proposed to add this work
around.

It has been tested with the test files provided in the reports.

Reviewed By: Dalai Felinto, Clément Foucault

Differential Revision: https://developer.blender.org/D8695
2020-08-25 11:48:48 +02:00
024a9d17d2 Revert "Enabled workaround to solve threading issues in draw manager"
This reverts commit 141a8ff6b3.
2020-08-25 11:29:20 +02:00
8bb93ca80a Fix T79915: crash when changing to white noise texture
Reviewers: brecht, OmarSquircleArt

Differential Revision: https://developer.blender.org/D8697
2020-08-25 11:23:35 +02:00
Jeroen Bakker
141a8ff6b3 Enabled workaround to solve threading issues in draw manager
This workaround addresses T79533 and T79038 for Blender 2.90. The
solution isn't clear and needs more research and work. In order to
continue with blender 2.90 release it was proposed to add this work
around.

It has been tested with the test files provided in the reports.

Reviewed By: Dalai Felinto, Clément Foucault

Differential Revision: https://developer.blender.org/D8695
2020-08-25 08:18:25 +02:00
189ba40e9b Cleanup: use doxy sections 2020-08-25 15:10:36 +10:00
5eb7aa5ebb Fix T80077: Objects disappear when joining with a zero scaled axis
Use invert_m4_m4_safe_ortho when joining objects so zero scaled axis
doesn't cause all points to be scaled to zero.

Instead geometry is left un-scaled on degenerate axes.

Report a warning in this case since users may want to adjust the
active objects scale.
2020-08-25 14:32:10 +10:00
96401e2ef8 BLI_math_matrix: add invert_m4_m4_safe_ortho (m3 version too)
Unlike invert_m4_m4_safe, this calculates zeroed axes.
Useful when we need to use the inverse of an objects matrix,
keeping the valid axis, only filling in the zeroed ones.
2020-08-25 12:57:56 +10:00
46eca3366e Sculpt: Cloth Snake Hook Brush
This implements Snake Hook as a deform type for the cloth brush. This
brush changes the strength of the deformation constraints per brush step
to avoid affecting the results of the simulation as much as possible. It
allows to grab the cloth without producing any artifacts in the surface
and create more natural looking folds than any of the other deformation
modes.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D8621
2020-08-24 23:28:01 +02:00
5a634735e6 Fix T80008: Smooth brush not deforming mesh boundaries correctly
In 2.83 and previous versions there was a bug that was causing boundary
vertices to be detected incorrectly that was preventing the smooth brush
to work on boundaries if there was a pole on them.
In 2.90 the boundary vertex detection was fixed, but it was still using a
simplified version of the algorithm without any boundary smoothing. This
patch implements a similar smoothing algorithm to what I think it was
the intention of 2.83 and previous versions, but working correctly.

Reviewed By: sergey

Maniphest Tasks: T80008

Differential Revision: https://developer.blender.org/D8680
2020-08-24 23:09:10 +02:00
ed4c83f61f T79811 MacOS: Edit Mode - vertex/edge/face selection is missing
This is quite embarassing... it was returning the base instance instead of
the correct vao. No wonder that it was causing crash and at most drawing
issues.
2020-08-24 19:25:43 +02:00
f5ca34d0b4 BLI: simplify lookup methods in Map
No functional changes expected.
2020-08-24 19:02:41 +02:00
975fc39457 Merge branch 'blender-v2.90-release' 2020-08-24 18:28:58 +02:00
1bced5884c Fix T80039: Do not subdivide with Multires is mesh has no faces
This skips the subdivision operation if the mesh has no loops, avoiding
the crash.

Reviewed By: sergey

Maniphest Tasks: T80039

Differential Revision: https://developer.blender.org/D8696
2020-08-24 18:27:49 +02:00
dc74d60915 Fix T79819: crash with OSL trace() and getmessage() after Embree changes
The return value of scene_intersect must be checked, the isect struct members
can't be assumed to be initialized if that returns false.

Differential Revision: https://developer.blender.org/D8692
2020-08-24 17:54:25 +02:00
8e18a99845 BLI: improve exception safety of Set and Map
For more information see rB2aff45146f1464ba8899368ad004522cb6a1a98c.
2020-08-24 17:24:13 +02:00
5303509354 Fix T80076: Cycles Alembic Motion Blur Problem
The problem occurs when a deforming modifier is added to the object
after the MeshSequenceCache modifier. We should only consider the cached
velocities if the MeshSequenceCache modifier is the last one on the
object and we also need to check for the correct vertex count before
adding the motion vertex attribute.
2020-08-24 16:56:23 +02:00
734abaa252 Cycles: cleanup, remove unused parameter
This parameter was introduced during a revision of the Alembic motion
blur patch, and is not needed anymore.
2020-08-24 16:56:23 +02:00
950d857505 Merge branch 'blender-v2.90-release' 2020-08-24 10:40:12 -04:00
9498eb2692 API Docs: Update Changelog from 2.83 2020-08-24 10:38:17 -04:00
39a09b536e Workbench: Fix assert with sculpt in textured color mode 2020-08-24 16:26:29 +02:00
5b021dff41 Fix T80035: Fix crash switching/adding scenes
Ensure that time source always is in the dependency graph, allowing to
tag the graph for time update prior it was fully built.

Collaboration of Philipp Oeser, Jacques Lucke and myself.
Thanks everyone :)
2020-08-24 15:55:07 +02:00
ee2e2f14ac numaapi: Sync with upstream
Fixes potential build error in some build configurations
2020-08-24 07:45:39 -06:00
Jeroen Bakker
95cc709612 Theme: Remove TH_UV_OTHERS from bTheme
`TH_UV_OTHERS` is a theme option that isn't hooked to anything since
blender 2.80. This patch will remove the option and related code.

Reviewed By: Campbell Barton

Differential Revision: https://developer.blender.org/D8669
2020-08-24 15:19:49 +02:00
1cac6fe542 Fix selected UV vertex drawing ignoring size 2020-08-24 22:51:31 +10:00
be920fe786 UVEdit: Fix assert caused by depth mask not being set before clear
This happened when using the shading panel when a uv editor opened.
2020-08-24 14:14:17 +02:00
7ce764c9ec Fix T79896 Awful performance with Dyntopo on
Regression caused by rB9443da6166f5. Forgot to clear the flag.
2020-08-24 13:52:01 +02:00
cb8da6efce GPUState: Fix scissor state being overwritten when changing scissor bounds
Fix T79899 viewport artifacts when sculpting
2020-08-24 12:28:54 +02:00
4883cc5728 BLI: add Array.last method
This makes it consistent with Vector and Span.
2020-08-24 11:51:41 +02:00
Imre Palik
afbc727da2 Cycles: Fix missing dependencies in libcycles_device
The code uses OpenGL functionality, so is to be linked against
OpenGL libraries.

This makes it easier to integrate with cycles using CMake.

Differential Revision: https://developer.blender.org/D8371
2020-08-24 11:45:47 +02:00
6b1b2ded77 Merge branch 'blender-v2.90-release' into master
# Conflicts:
#	source/blender/editors/space_node/node_draw.c
#	source/blender/editors/space_sequencer/sequencer_draw.c
2020-08-24 11:31:06 +02:00
35ef42d967 Fix T79970 EEVEE: Camera Animation Breaks Motion Blur (Two Steps or More)
This was caused by motion blur camera movement tagging the view as
invalid and thus resetting the temporal sampling.

Critical fix for 2.90. Need second look, but quite confident. This function
is only called once when Motion blur is off.

Reviewed by: jbakker

Differential Revision: https://developer.blender.org/D8676
2020-08-24 11:24:33 +02:00
40edb84dcf Revert "Fix T77564: VSE (and compositor background) lost stereoscopy preview"
This reverts commit d5b5b228e4.
This reverts commit 47c6f41b89.
2020-08-24 11:17:52 +02:00
e4932d1167 Fix T80034 Crash using material panel on 2.91.0 alpha
This was caused by a NULL name.
2020-08-23 14:48:44 +02:00
e74ba9e09e Fix T79872: VSE - splitting strip shows the channel number when unused
This operator is dependent on mouse position (if the Use Cursor Position
option is used). The Channel property is irrelevant/unused in this case.
So it is not optimal displaying this property when calling this from the
menu (or even using the shortcut with default settings).

Now use a custom UI in the Adjust Last Operation panel in this case.
The properties are now drawn in relation to another then (Channel
underneath Use Cursor Position) next to some other minor layout
improvements.

Thx @HooglyBoogly for feedback (also providing UI code)

Maniphest Tasks: T79872

Differential Revision: https://developer.blender.org/D8625
2020-08-23 13:17:49 +02:00
833bc70399 Fix T79874: VSE - error clearing fades without animation data
Maniphest Tasks: T79874

Differential Revision: https://developer.blender.org/D8624
2020-08-23 13:09:57 +02:00
f18e537451 Cleanup: GPU: Use explicit clear value in GPU_clear* commands
This replace `GPU_clear()` by `GPU_clear_color()` and `GPU_clear_depth()`.
Since we always set the clear value before clearing, it is unecessary
to track the clear color state.
Moreover, it makes it clearer what we clear the framebuffer to.
2020-08-23 12:04:24 +02:00
846cac94db GPUFramebuffer: Use GPUState to temporary change write mask in clear fn
This avoid breaking sync of the state object. Also avoid more hazard.
2020-08-23 12:04:24 +02:00
72e78df464 GPUState: Expose Stencil mask and test
This is to be used by framebuffer clearing.
2020-08-23 12:04:24 +02:00
ed288a5786 Fix T79989: File browser Return doesn't open a directory
Regression in e4a50e3f47.
2020-08-23 16:32:33 +10:00
8f8ed8f567 Fix T80028: Crash opening a file from a timer 2020-08-23 13:44:18 +10:00
2cf930adf3 Cleanup: remove unused UvNearestHit struct members 2020-08-23 12:13:48 +10:00
010c1370af CMake: Fix policy warning about OSL_ROOT being set.
When the OSL_ROOT variable is set this is ignored
by findpackage on cmake < 3.12. CMake 3.12 and up
also  ignore it and warn about it. This change
tells cmake it is OK to use the variable and
stop warning
2020-08-22 16:24:09 -06:00
8f48a32f9f UI: In-line layout for camera passepartout
No need for a sub-panel when there is just one setting.
2020-08-22 21:53:16 +02:00
1885bf77b6 Fix T80013: Crash when toggling maximized area
Error renaming variable in 75aeb4b881
2020-08-22 11:30:51 -04:00
e26301f4d1 Fix T79971 Regression: Transform Gizmos doesnt work anymore
This changes the state of occlusion queries quite a bit. Now scissors is
explicitely disabled and we enabled color write.

I still don't understand why we now need this. This patch is just trial and
error on an affected setup. Note that on the same computer, renderdoc
was not able to capture the regression (the regression did not manifest
during capture).

Regression likely introduced by rB5f414234ddea
2020-08-22 01:42:15 +02:00
a204324966 DRW: Fix state not being locked
Regression introduced by rBe12c08e8d170b7ca40f204a5b0423c23a9fbc2c1
2020-08-22 01:42:15 +02:00
a1f54be042 Cleanup: Remove unused variables 2020-08-21 15:33:40 -04:00
53d1f89322 Fix T79987: Crash when joining objects
Mistake in b077de086e. I did the same fix for a few operators there,
but missed the object "Join" one.

The joining operator changes the layer content. So it must send a
notifier for that.
Before b077de086e that didn't cause a noticeable issue, because the
Outliner happened to listen to other notifiers (active/selection
changes) the operator sent and fully rebuilt its tree in response. Now
missing these notifiers can be more problematic, since we try to avoid
more rebuilds.

Added comments to the notifier types to avoid at least this pitfall.
2020-08-21 19:46:15 +02:00
70500121b4 Cleanup: rename iterators over sequences to be more clear about what they do.
No functional changes expected.
2020-08-21 18:55:27 +02:00
74ded456b3 Merge branch 'blender-v2.90-release' into master 2020-08-21 17:43:59 +02:00
ebf10b72b0 Fix critical bug in foreach ID looper of Scene data-block.
Since stone age of lib_query, the code would iterate over the current
list of active sequences (from a meta strip e.g.), and not over the
whole list of those.

This is a critical issue as it means in some cases (editing a meta strip
typically), some ID pointers would be missed/ignored by this foreach
looper, which is now at the center of most of our ID management code.

This caused a bug here at the studio, leading to loss of all sound IDs
used by sound strips when editing and undoing inside a meta strip, since
ID refcounting would not happen properly on strips using sounds outside
the meta-strip context during file reading of the undo steps.

To be backported to 2.83.

Differential Revision: https://developer.blender.org/D8671
2020-08-21 17:35:18 +02:00
661ba642f2 Cleanup: spelling 2020-08-22 00:10:52 +10:00
eed43a89dd Cleanup: use doxy sections for fcurve.c 2020-08-22 00:10:52 +10:00
c00707c18d Cleanup: remove f-string use 2020-08-22 00:10:52 +10:00
995725c681 Cleanup: remove duplicated code from previously unnoticed merge conflict
`BKE_animdata_blend_expand` is called in `expand_id` already.
2020-08-21 16:01:30 +02:00
0de48f8550 Refactor: move animdata code from blenloader to blenkernel 2020-08-21 15:58:28 +02:00
bed634c4f9 Refactor: move nla code from blenloader to blenkernel 2020-08-21 15:42:26 +02:00
71634d94ca Cleanup: remove LodLevel
This was part of the game engine and is not used anymore.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D8666
2020-08-21 15:24:36 +02:00
79d678e677 Refactor: move fcurve/fmodifier code from blenloader to blenkernel
This is part of T76372.
2020-08-21 15:23:33 +02:00
76689e8517 Cleanup: use LISTBASE_FOREACH in readfile.c 2020-08-21 14:39:39 +02:00
2e630297af GPUShader: Fix linking working even if one shader compilation failed
Linking without valid shaders works on some drivers. Avoid this case by
forcing linking step to return false.
2020-08-21 14:25:58 +02:00
3a6e981bcd Cleanup: GPU: Update classes comments
This should avoid confusion about what is a class and what is an opaque
pointer.
2020-08-21 14:16:42 +02:00
220fbdf593 GPUShader: Make GPUShader* an opaque pointer to blender::gpu::Shader
This avoids the misleading inheritance.

Also cleanup by setting the blender::gpu::Shader as active shader to
avoid some casting.
2020-08-21 14:16:42 +02:00
1e95a7402c GPUShader: Fix NULL string used as shader name.
The shader name is required with the latest changes.
2020-08-21 14:16:42 +02:00
c4f122ac8f GPUUniformBuf: GL backend isolation
This is in preparation of vulkan backend. We move all opengl
functionnalities behind an abstract class.

This also cleansup the "dynamic" ubo create and rename it to
`GPU_uniformbuf_from_list()`

Contains, no functional change.

Part of T68990 Vulkan support.
2020-08-21 14:16:42 +02:00
7edd8a7738 GPUUniformBuf: Rename struct and change API a bit
This follows the GPU module naming of other buffers.
We pass name to distinguish each GPUUniformBuf in debug mode.
Also remove DRW_uniform_buffer interface.
2020-08-21 14:16:42 +02:00
4f0a749489 Cleanup: use LISTBASE_FOREACH in writefile.c 2020-08-21 13:14:41 +02:00
933f0caec6 Blenloader: move IDProperty read/write code to blenkernel
This is part of T76372.
2020-08-21 12:45:41 +02:00
27f0a19bdc Cleanup: remove exec() calls from custom property editor
Remove `exec()` and `eval()` calls from `WM_OT_properties_edit` where
possible. This not only results in simpler, cleaner code, but also
removes the necessity for `repr(value)` to evaluate to a Python
expression that in turn evaluates to `value` again.

No functional changes.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D8658
2020-08-21 12:34:41 +02:00
3bc09c1c1e Cleanup: split BKE_scene_get_depsgraph() into two functions
Split the depsgraph allocation into a separate function
`BKE_scene_ensure_depsgraph()`. Parameters are only passed to those
functions that actually need them. This removes the the "if that boolean
is `false` this pointer is allowed to be `NULL`" logic and more cleanly
decouples code.

No functional changes.
2020-08-21 12:23:13 +02:00
e7767ba6be Cleanup: Reduce nesting of scene_get_depsgraph_p()
Reduce nesting by flipping conditions and returning early. It's now much
clearer that it's actually a linear function (rather than a nested one).

No functional changes.
2020-08-21 12:18:48 +02:00
7aeaf5da0e Fix crash when accessing view_layer.depsgraph through BPY
For the sanity checks to work we don't actually need to check other
scenes. So this function can be simplified so that it does not require
a `Main *`.

Mistake in 5cc08510e0.
2020-08-21 11:31:15 +02:00
31705201dd Merge branch 'master' into active-fcurve-keyframe 2020-08-12 14:19:05 -04:00
ea4c327c97 Merge branch 'master' into active-fcurve-keyframe 2020-07-16 14:15:37 -04:00
e18fdef39f Deselect before set active on shift click 2020-07-10 09:35:39 -04:00
1fbd713265 Remove unecessary comment 2020-07-10 09:35:25 -04:00
736636ca49 Remove accidental changes 2020-07-10 09:15:48 -04:00
ff155a6677 Merge branch 'master' into active-fcurve-keyframe 2020-07-10 09:05:44 -04:00
d2a07a0bbf Merge branch 'master' into active-fcurve-keyframe 2020-07-07 21:46:27 -04:00
b890b97b67 Merge branch 'master' into active-fcurve-keyframe 2020-07-07 14:53:35 -04:00
ce170bdd4c Always draw active FCurve (and active keyframe) last (on top) 2020-06-24 20:20:42 -04:00
fc1fee9916 Merge branch 'master' into active-fcurve-keyframe 2020-06-24 16:10:53 -04:00
9d9efbb2f8 insert_vert_fcurve sets active keyframe 2020-06-09 11:11:33 -04:00
21d542d068 Activate keyframe before deselecting 2020-06-09 11:11:16 -04:00
aa5ad440a3 Merge branch 'master' into active-fcurve-keyframe 2020-06-09 09:45:28 -04:00
3fe313b954 Don't change active vertex or fcurve when dragging 2020-06-03 15:06:10 -04:00
2a7b44e33d Cleanup: Use const for FCurve 2020-06-03 15:05:42 -04:00
598cac0ce6 Clamp active keyframe to totvert when deleting 2020-06-03 15:05:26 -04:00
1fc49878f5 Changes from Julian 2020-06-03 13:48:48 -04:00
30a4fbf57b Merge branch 'master' into active-fcurve-keyframe 2020-06-03 13:41:42 -04:00
b49bcbe68e Remove dopesheet drawing changes 2020-05-19 10:38:15 -04:00
7ac3dc69a8 Merge branch 'master' into active-fcurve-keyframe 2020-05-19 10:29:16 -04:00
81bdaefbd7 Draw active keyframe differently in dopesheet 2020-05-18 12:53:48 -04:00
ba1efe851e Move active graph vertex drawing to separate functions 2020-05-18 12:52:55 -04:00
dc68db427a Change set active logic 2020-05-18 12:36:39 -04:00
03a8e74405 Merge branch 'master' into active-fcurve-keyframe 2020-05-18 09:27:27 -04:00
c452c66b70 Remove unintentional change 2020-05-14 17:08:17 -04:00
d4ddba4b59 Fix T76595: No Indication of Active Keyframe in Graph Editor
Currently there is a panel that says "Active Keyframe" for numerically editing one keyframe's values, but in the code there is no concept of the "active keyframe."

This patch adds an "active keyframe index" to each FCurve, and displays it with a theme color for the active vertex (which didn't exist before) if the FCurve is active.

{F8536092}

The active keyframe is not currently set for select operations other than basic click-select, which mirrors the behavior in the 3D view.

Differential Revision: https://developer.blender.org/D7737
2020-05-14 17:06:24 -04:00
83c9b99e76 Add active keyframe to FCurve, draw and mark with clickselect 2020-05-14 16:42:13 -04:00
09d9ef45c6 Add active vertex theme color for graph editor 2020-05-14 16:40:48 -04:00
569 changed files with 29893 additions and 18732 deletions

View File

@@ -253,8 +253,8 @@ ForEachMacros:
- RNA_STRUCT_BEGIN_SKIP_RNA_TYPE
- SCULPT_VERTEX_DUPLICATES_AND_NEIGHBORS_ITER_BEGIN
- SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN
- SEQP_BEGIN
- SEQ_BEGIN
- SEQ_ALL_BEGIN
- SEQ_CURRENT_BEGIN
- SURFACE_QUAD_ITER_BEGIN
- foreach
- ED_screen_areas_iter

View File

@@ -102,6 +102,11 @@ if(POLICY CMP0068)
cmake_policy(SET CMP0068 NEW)
endif()
# find_package() uses <PackageName>_ROOT variables.
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
#-----------------------------------------------------------------------------
# Load some macros.
include(build_files/cmake/macros.cmake)
@@ -183,6 +188,7 @@ if(APPLE)
else()
option(WITH_XR_OPENXR "Enable VR features through the OpenXR specification" ON)
endif()
option(WITH_GMP "Enable features depending on GMP (Exact Boolean)" ON)
# Compositor
option(WITH_COMPOSITOR "Enable the tile based nodal compositor" ON)
@@ -1566,6 +1572,12 @@ endif()
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17")
# Make MSVC properly report the value of the __cplusplus preprocessor macro
# Available MSVC 15.7 (1914) and up, without this it reports 199711L regardless
# of the C++ standard chosen above
if(MSVC_VERSION GREATER 1913)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:__cplusplus")
endif()
elseif(
CMAKE_COMPILER_IS_GNUCC OR
CMAKE_C_COMPILER_ID MATCHES "Clang" OR
@@ -1728,6 +1740,7 @@ if(FIRST_RUN)
info_cfg_option(WITH_QUADRIFLOW)
info_cfg_option(WITH_USD)
info_cfg_option(WITH_TBB)
info_cfg_option(WITH_GMP)
info_cfg_text("Compiler Options:")
info_cfg_option(WITH_BUILDINFO)

View File

@@ -312,6 +312,7 @@ set(NASM_HASH f4fd1329b1713e1ccd34b2fc121c4bcd278c9f91cc4cb205ae8fcd2e4728dd14)
set(XR_OPENXR_SDK_VERSION 1.0.8)
set(XR_OPENXR_SDK_URI https://github.com/KhronosGroup/OpenXR-SDK/archive/release-${XR_OPENXR_SDK_VERSION}.tar.gz)
set(XR_OPENXR_SDK_HASH c6de63d2e0f9029aa58dfa97cad8ce07)
set(ISPC_VERSION v1.13.0)
set(ISPC_URI https://github.com/ispc/ispc/archive/${ISPC_VERSION}.tar.gz)
set(ISPC_HASH 4bf5e8d0020c4b9980faa702c1a6f25f)

View File

@@ -1087,7 +1087,7 @@ Those libraries should be available as packages in all recent distributions (opt
* libjpeg, libpng, libtiff, [openjpeg2], [libopenal].
* libx11, libxcursor, libxi, libxrandr, libxinerama (and other libx... as needed).
* libsqlite3, libbz2, libssl, libfftw3, libxml2, libtinyxml, yasm, libyaml-cpp.
* libsdl2, libglew, [libgmp], [libglewmx].\""
* libsdl2, libglew, [libgmp], [libglewmx], fontconfig.\""
DEPS_SPECIFIC_INFO="\"BUILDABLE DEPENDENCIES:
@@ -3654,7 +3654,7 @@ install_DEB() {
THEORA_DEV="libtheora-dev"
_packages="gawk cmake cmake-curses-gui build-essential libjpeg-dev libpng-dev libtiff-dev \
git libfreetype6-dev libx11-dev flex bison libxxf86vm-dev \
git libfreetype6-dev libfontconfig-dev libx11-dev flex bison libxxf86vm-dev \
libxcursor-dev libxi-dev wget libsqlite3-dev libxrandr-dev libxinerama-dev \
libbz2-dev libncurses5-dev libssl-dev liblzma-dev libreadline-dev \
libopenal-dev libglew-dev yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV \
@@ -4320,7 +4320,7 @@ install_RPM() {
OGG_DEV="libogg-devel"
THEORA_DEV="libtheora-devel"
_packages="gcc gcc-c++ git make cmake tar bzip2 xz findutils flex bison \
_packages="gcc gcc-c++ git make cmake tar bzip2 xz findutils flex bison fontconfig-devel \
libtiff-devel libjpeg-devel libpng-devel sqlite-devel fftw-devel SDL2-devel \
libX11-devel libXi-devel libXcursor-devel libXrandr-devel libXinerama-devel \
wget ncurses-devel readline-devel $OPENJPEG_DEV openal-soft-devel \
@@ -4898,7 +4898,7 @@ install_ARCH() {
BASE_DEVEL=`pacman -Sgq base-devel | sed -e 's/^gcc$/gcc-multilib/g' | paste -s -d' '`
fi
_packages="$BASE_DEVEL git cmake \
_packages="$BASE_DEVEL git cmake fontconfig \
libxi libxcursor libxrandr libxinerama glew libpng libtiff wget openal \
$OPENJPEG_DEV $VORBIS_DEV $OGG_DEV $THEORA_DEV yasm sdl2 fftw \
libxml2 yaml-cpp tinyxml python-requests jemalloc gmp"
@@ -5577,7 +5577,7 @@ print_info() {
_buildargs="-U *SNDFILE* -U PYTHON* -U *BOOST* -U *Boost* -U *TBB*"
_buildargs="$_buildargs -U *OPENCOLORIO* -U *OPENEXR* -U *OPENIMAGEIO* -U *LLVM* -U *CYCLES*"
_buildargs="$_buildargs -U *OPENSUBDIV* -U *OPENVDB* -U *COLLADA* -U *FFMPEG* -U *ALEMBIC* -U *USD*"
_buildargs="$_buildargs -U *OPENSUBDIV* -U *OPENVDB* -U *BLOSC* -U *COLLADA* -U *FFMPEG* -U *ALEMBIC* -U *USD*"
_buildargs="$_buildargs -U *EMBREE* -U *OPENIMAGEDENOISE* -U *OPENXR*"
_1="-D WITH_CODEC_SNDFILE=ON"

View File

@@ -1,11 +0,0 @@
--- UserMacros.cmake
+++ UserMacros.cmake
@@ -16,6 +16,8 @@
if (BUILD_USER_DEFINED_LIBS)
MACRO_USER_DEFINED_LIBS ()
endif (BUILD_USER_DEFINED_LIBS)
+
+include(Config/cmake/usermacros/windows_mt.cmake)
#-----------------------------------------------------------------------------
#------------------- E X A M P L E E N D -----------------------------------
#-----------------------------------------------------------------------------

View File

@@ -10,77 +10,6 @@ diff -x .git -ur usd.orig/cmake/defaults/Packages.cmake external_usd/cmake/defau
add_definitions(${TBB_DEFINITIONS})
# --math
diff -x .git -ur usd.orig/pxr/base/plug/initConfig.cpp external_usd/pxr/base/plug/initConfig.cpp
--- usd.orig/pxr/base/plug/initConfig.cpp.orig 2020-06-12 17:20:07.478199779 +0200
+++ external_usd/pxr/base/plug/initConfig.cpp 2020-06-12 17:25:28.648588552 +0200
@@ -69,10 +69,40 @@
ARCH_CONSTRUCTOR(Plug_InitConfig, 2, void)
{
+ /* The contents of this constructor have been moved to usd_initialise_plugin_path(...) */
+}
+
+}; // end of anonymous namespace
+
+/**
+ * The contents of this function used to be in the static constructor Plug_InitConfig.
+ * This static constructor made it impossible for Blender to pass a path to the USD
+ * library at runtime, as the constructor would run before Blender's main() function.
+ *
+ * This function is wrapped in a C function of the same name (defined below),
+ * so that it can be called from Blender's main() function.
+ *
+ * The datafiles_usd_path path is used to point to the USD plugin path when Blender
+ * has been installed. The fallback_usd_path path should point to the build-time
+ * location of the USD plugin files so that Blender can be run on a development machine
+ * without requiring an installation step.
+ */
+void
+usd_initialise_plugin_path(const char *datafiles_usd_path)
+{
std::vector<std::string> result;
std::vector<std::string> debugMessages;
+ // Add Blender-specific paths. They MUST end in a slash, or symlinks will not be treated as directory.
+ if (datafiles_usd_path != NULL && datafiles_usd_path[0] != '\0') {
+ std::string datafiles_usd_path_str(datafiles_usd_path);
+ if (datafiles_usd_path_str.back() != '/') {
+ datafiles_usd_path_str += "/";
+ }
+ result.push_back(datafiles_usd_path_str);
+ }
+
// Determine the absolute path to the Plug shared library. Any relative
// paths specified in the plugin search path will be anchored to this
// directory, to allow for relocatability. Note that this can fail when pxr
@@ -114,9 +144,24 @@
_AppendPathList(&result, installLocation, binaryPath);
#endif // PXR_INSTALL_LOCATION
- Plug_SetPaths(result, debugMessages);
-}
+ if (!TfGetenv("PXR_PATH_DEBUG").empty()) {
+ printf("USD Plugin paths: (%zu in total):\n", result.size());
+ for(const std::string &path : result) {
+ printf(" %s\n", path.c_str());
+ }
+ }
+ Plug_SetPaths(result, debugMessages);
}
PXR_NAMESPACE_CLOSE_SCOPE
+
+/* Workaround to make it possible to pass a path at runtime to USD. */
+extern "C" {
+void
+usd_initialise_plugin_path(
+ const char *datafiles_usd_path)
+{
+ PXR_NS::usd_initialise_plugin_path(datafiles_usd_path);
+}
+}
diff -Naur external_usd_base/cmake/macros/Public.cmake external_usd/cmake/macros/Public.cmake
--- external_usd_base/cmake/macros/Public.cmake 2019-10-24 14:39:53 -0600
+++ external_usd/cmake/macros/Public.cmake 2020-01-11 13:33:29 -0700

View File

@@ -59,6 +59,14 @@ FOREACH(COMPONENT ${_embree_FIND_COMPONENTS})
PATH_SUFFIXES
lib64 lib
)
IF (NOT EMBREE_${UPPERCOMPONENT}_LIBRARY)
IF (EMBREE_EMBREE3_LIBRARY)
# If we can't find all the static libraries, try to fall back to the shared library if found.
# This allows building with a shared embree library
SET(_embree_LIBRARIES ${EMBREE_EMBREE3_LIBRARY})
BREAK()
ENDIF ()
ENDIF ()
LIST(APPEND _embree_LIBRARIES "${EMBREE_${UPPERCOMPONENT}_LIBRARY}")
ENDFOREACH()

View File

@@ -80,7 +80,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMP DEFAULT_MSG
GMP_LIBRARY GMPXX_LIBRARY GMP_INCLUDE_DIR GMPXX_INCLUDE_DIR)
IF(GMP_FOUND)
SET(GMP_LIBRARIES ${GMP_LIBRARY} ${GMPXX_LIBRARY})
SET(GMP_LIBRARIES ${GMPXX_LIBRARY} ${GMP_LIBRARY})
SET(GMP_INCLUDE_DIRS ${GMP_INCLUDE_DIR} ${GMPXX_INCLUDE_DIR})
ENDIF(GMP_FOUND)

View File

@@ -70,6 +70,9 @@ macro(BLENDER_SRC_GTEST_EX)
if(WITH_TBB)
target_link_libraries(${TARGET_NAME} ${TBB_LIBRARIES})
endif()
if(WITH_GMP)
target_link_libraries(${TARGET_NAME} ${GMP_LIBRARIES})
endif()
get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(GENERATOR_IS_MULTI_CONFIG)

View File

@@ -15,11 +15,12 @@ set(WITH_CYCLES_EMBREE ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_OSL ON CACHE BOOL "" FORCE)
set(WITH_DRACO ON CACHE BOOL "" FORCE)
set(WITH_FFTW3 ON CACHE BOOL "" FORCE)
set(WITH_GMP OFF CACHE BOOL "" FORCE)
set(WITH_GMP ON CACHE BOOL "" FORCE)
set(WITH_LIBMV ON CACHE BOOL "" FORCE)
set(WITH_LIBMV_SCHUR_SPECIALIZATIONS ON CACHE BOOL "" FORCE)
set(WITH_COMPOSITOR ON CACHE BOOL "" FORCE)
set(WITH_FREESTYLE ON CACHE BOOL "" FORCE)
set(WITH_GMP ON CACHE BOOL "" FORCE)
set(WITH_IK_SOLVER ON CACHE BOOL "" FORCE)
set(WITH_IK_ITASC ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_CINEON ON CACHE BOOL "" FORCE)

View File

@@ -25,6 +25,7 @@ set(WITH_LIBMV OFF CACHE BOOL "" FORCE)
set(WITH_LLVM OFF CACHE BOOL "" FORCE)
set(WITH_COMPOSITOR OFF CACHE BOOL "" FORCE)
set(WITH_FREESTYLE OFF CACHE BOOL "" FORCE)
set(WITH_GMP OFF CACHE BOOL "" FORCE)
set(WITH_IK_SOLVER OFF CACHE BOOL "" FORCE)
set(WITH_IK_ITASC OFF CACHE BOOL "" FORCE)
set(WITH_IMAGE_CINEON OFF CACHE BOOL "" FORCE)

View File

@@ -16,11 +16,12 @@ set(WITH_CYCLES_EMBREE ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_OSL ON CACHE BOOL "" FORCE)
set(WITH_DRACO ON CACHE BOOL "" FORCE)
set(WITH_FFTW3 ON CACHE BOOL "" FORCE)
set(WITH_GMP OFF CACHE BOOL "" FORCE)
set(WITH_GMP ON CACHE BOOL "" FORCE)
set(WITH_LIBMV ON CACHE BOOL "" FORCE)
set(WITH_LIBMV_SCHUR_SPECIALIZATIONS ON CACHE BOOL "" FORCE)
set(WITH_COMPOSITOR ON CACHE BOOL "" FORCE)
set(WITH_FREESTYLE ON CACHE BOOL "" FORCE)
set(WITH_GMP ON CACHE BOOL "" FORCE)
set(WITH_IK_SOLVER ON CACHE BOOL "" FORCE)
set(WITH_IK_ITASC ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_CINEON ON CACHE BOOL "" FORCE)

View File

@@ -496,6 +496,10 @@ function(SETUP_LIBDIRS)
link_directories(${ALEMBIC_LIBPATH})
endif()
if(WITH_GMP)
link_directories(${GMP_LIBPATH})
endif()
if(WITH_GHOST_WAYLAND)
link_directories(
${wayland-client_LIBRARY_DIRS}

View File

@@ -407,6 +407,15 @@ if(WITH_TBB)
find_package(TBB)
endif()
if(WITH_GMP)
find_package(GMP)
if(NOT GMP_FOUND)
set(WITH_GMP OFF)
message(STATUS "GMP not found")
endif()
endif()
# CMake FindOpenMP doesn't know about AppleClang before 3.12, so provide custom flags.
if(WITH_OPENMP)
if(CMAKE_C_COMPILER_ID MATCHES "AppleClang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "7.0")

View File

@@ -427,6 +427,15 @@ if(WITH_TBB)
find_package_wrapper(TBB)
endif()
if(WITH_GMP)
find_package(GMP)
if(NOT GMP_FOUND)
set(WITH_GMP OFF)
message(STATUS "GMP not found")
endif()
endif()
if(WITH_XR_OPENXR)
find_package(XR_OpenXR_SDK)
if(NOT XR_OPENXR_SDK_FOUND)

View File

@@ -136,6 +136,13 @@ add_definitions(
# MSVC11 needs _ALLOW_KEYWORD_MACROS to build
add_definitions(-D_ALLOW_KEYWORD_MACROS)
# RTTI is on by default even without this switch
# however having it in the CXX Flags makes it difficult
# to remove for individual files that want to disable it
# using the /GR- flag without generating a build warning
# that both /GR and /GR- are specified.
remove_cc_flag("/GR")
# We want to support Windows 7 level ABI
add_definitions(-D_WIN32_WINNT=0x601)
include(build_files/cmake/platform/platform_win32_bundle_crt.cmake)

File diff suppressed because it is too large Load Diff

View File

@@ -2016,7 +2016,7 @@ AUD_API Sound* checkSound(PyObject* sound)
bool initializeSound()
{
import_array();
import_array1(false);
return PyType_Ready(&SoundType) >= 0;
}

View File

@@ -419,7 +419,8 @@ if(MSVC)
# bullet is responsible for quite a few silly warnings
# suppress all of them. Not great, but they really needed
# to sort that out themselves.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W0")
remove_cc_flag("/W3")
add_c_flag("/W0")
endif()
blender_add_lib(extern_bullet "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")

View File

@@ -64,9 +64,6 @@ endif()
if(WITH_OPENVDB)
add_definitions(-DOPENVDB=1)
if(NOT WIN32)
add_definitions(-DOPENVDB_STATICLIB)
endif()
endif()
if(WITH_OPENVDB_BLOSC)

View File

@@ -28,9 +28,6 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
)
endif()
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
add_definitions(-D_USE_MATH_DEFINES)
endif()

View File

@@ -1,3 +1,15 @@
diff --git a/extern/quadriflow/src/loader.cpp b/extern/quadriflow/src/loader.cpp
--- a/extern/quadriflow/src/loader.cpp
+++ b/extern/quadriflow/src/loader.cpp
@@ -69,7 +69,7 @@
};
/// Hash function for obj_vertex
- struct obj_vertexHash : std::unary_function<obj_vertex, size_t> {
+ struct obj_vertexHash {
std::size_t operator()(const obj_vertex &v) const {
size_t hash = std::hash<uint32_t>()(v.p);
hash = hash * 37 + std::hash<uint32_t>()(v.uv);
diff --git a/extern/quadriflow/src/config.hpp b/extern/quadriflow/src/config.hpp
index 842b885..bf597ad 100644
--- a/extern/quadriflow/src/config.hpp

View File

@@ -69,7 +69,7 @@ void load(const char* filename, MatrixXd& V, MatrixXi& F)
};
/// Hash function for obj_vertex
struct obj_vertexHash : std::unary_function<obj_vertex, size_t> {
struct obj_vertexHash {
std::size_t operator()(const obj_vertex &v) const {
size_t hash = std::hash<uint32_t>()(v.p);
hash = hash * 37 + std::hash<uint32_t>()(v.uv);

View File

@@ -132,13 +132,14 @@ void CLG_logf(CLG_LogType *lg,
const char *format,
...) _CLOG_ATTR_NONNULL(1, 3, 4, 5) _CLOG_ATTR_PRINTF_FORMAT(5, 6);
/* Main initializer and distructor (per session, not logger). */
/* Main initializer and destructor (per session, not logger). */
void CLG_init(void);
void CLG_exit(void);
void CLG_output_set(void *file_handle);
void CLG_output_use_basename_set(int value);
void CLG_output_use_timestamp_set(int value);
void CLG_error_fn_set(void (*error_fn)(void *file_handle));
void CLG_fatal_fn_set(void (*fatal_fn)(void *file_handle));
void CLG_backtrace_fn_set(void (*fatal_fn)(void *file_handle));

View File

@@ -98,6 +98,7 @@ typedef struct CLogContext {
} default_type;
struct {
void (*error_fn)(void *file_handle);
void (*fatal_fn)(void *file_handle);
void (*backtrace_fn)(void *file_handle);
} callbacks;
@@ -352,6 +353,13 @@ static CLG_LogType *clg_ctx_type_register(CLogContext *ctx, const char *identifi
return ty;
}
static void clg_ctx_error_action(CLogContext *ctx)
{
if (ctx->callbacks.error_fn != NULL) {
ctx->callbacks.error_fn(ctx->output_file);
}
}
static void clg_ctx_fatal_action(CLogContext *ctx)
{
if (ctx->callbacks.fatal_fn != NULL) {
@@ -522,6 +530,10 @@ void CLG_logf(CLG_LogType *lg,
clg_ctx_backtrace(lg->ctx);
}
if (severity == CLG_SEVERITY_ERROR) {
clg_ctx_error_action(lg->ctx);
}
if (severity == CLG_SEVERITY_FATAL) {
clg_ctx_fatal_action(lg->ctx);
}
@@ -555,6 +567,12 @@ static void CLG_ctx_output_use_timestamp_set(CLogContext *ctx, int value)
}
}
/** Action on error severity. */
static void CLT_ctx_error_fn_set(CLogContext *ctx, void (*error_fn)(void *file_handle))
{
ctx->callbacks.error_fn = error_fn;
}
/** Action on fatal severity. */
static void CLG_ctx_fatal_fn_set(CLogContext *ctx, void (*fatal_fn)(void *file_handle))
{
@@ -674,6 +692,11 @@ void CLG_output_use_timestamp_set(int value)
CLG_ctx_output_use_timestamp_set(g_ctx, value);
}
void CLG_error_fn_set(void (*error_fn)(void *file_handle))
{
CLT_ctx_error_fn_set(g_ctx, error_fn);
}
void CLG_fatal_fn_set(void (*fatal_fn)(void *file_handle))
{
CLG_ctx_fatal_fn_set(g_ctx, fatal_fn);

View File

@@ -292,7 +292,7 @@ static void xml_read_shader_graph(XMLReadState &state, Shader *shader, xml_node
filepath = path_join(state.base, filepath);
}
snode = OSLShaderManager::osl_node(manager, filepath);
snode = OSLShaderManager::osl_node(graph, manager, filepath, "");
if (!snode) {
fprintf(stderr, "Failed to create OSL node from \"%s\".\n", filepath.c_str());

View File

@@ -83,13 +83,13 @@ Geometry *BlenderSync::sync_geometry(BL::Depsgraph &b_depsgraph,
if (geom == NULL) {
/* Add new geometry if it did not exist yet. */
if (geom_type == Geometry::HAIR) {
geom = new Hair();
geom = scene->create_node<Hair>();
}
else if (geom_type == Geometry::VOLUME) {
geom = new Volume();
geom = scene->create_node<Volume>();
}
else {
geom = new Mesh();
geom = scene->create_node<Mesh>();
}
geometry_map.add(key, geom);
}

View File

@@ -19,6 +19,8 @@
#include <string.h>
#include "render/scene.h"
#include "util/util_map.h"
#include "util/util_set.h"
#include "util/util_vector.h"
@@ -32,9 +34,8 @@ CCL_NAMESPACE_BEGIN
template<typename K, typename T> class id_map {
public:
id_map(vector<T *> *scene_data_)
id_map()
{
scene_data = scene_data_;
}
T *find(const BL::ID &id)
@@ -76,7 +77,6 @@ template<typename K, typename T> class id_map {
void add(const K &key, T *data)
{
assert(find(key) == NULL);
scene_data->push_back(data);
b_map[key] = data;
used(data);
}
@@ -97,22 +97,23 @@ template<typename K, typename T> class id_map {
}
/* Combined add and update as needed. */
bool add_or_update(T **r_data, const BL::ID &id)
bool add_or_update(Scene *scene, T **r_data, const BL::ID &id)
{
return add_or_update(r_data, id, id, id.ptr.owner_id);
return add_or_update(scene, r_data, id, id, id.ptr.owner_id);
}
bool add_or_update(T **r_data, const BL::ID &id, const K &key)
bool add_or_update(Scene *scene, T **r_data, const BL::ID &id, const K &key)
{
return add_or_update(r_data, id, id, key);
return add_or_update(scene, r_data, id, id, key);
}
bool add_or_update(T **r_data, const BL::ID &id, const BL::ID &parent, const K &key)
bool add_or_update(
Scene *scene, T **r_data, const BL::ID &id, const BL::ID &parent, const K &key)
{
T *data = find(key);
bool recalc;
if (!data) {
/* Add data if it didn't exist yet. */
data = new T();
data = scene->create_node<T>();
add(key, data);
recalc = true;
}
@@ -144,27 +145,8 @@ template<typename K, typename T> class id_map {
b_map[NULL] = data;
}
bool post_sync(bool do_delete = true)
void post_sync(Scene *scene, bool do_delete = true)
{
/* remove unused data */
vector<T *> new_scene_data;
typename vector<T *>::iterator it;
bool deleted = false;
for (it = scene_data->begin(); it != scene_data->end(); it++) {
T *data = *it;
if (do_delete && used_set.find(data) == used_set.end()) {
delete data;
deleted = true;
}
else
new_scene_data.push_back(data);
}
*scene_data = new_scene_data;
/* update mapping */
map<K, T *> new_map;
typedef pair<const K, T *> TMapPair;
typename map<K, T *>::iterator jt;
@@ -172,15 +154,17 @@ template<typename K, typename T> class id_map {
for (jt = b_map.begin(); jt != b_map.end(); jt++) {
TMapPair &pair = *jt;
if (used_set.find(pair.second) != used_set.end())
if (do_delete && used_set.find(pair.second) == used_set.end()) {
scene->delete_node(pair.second);
}
else {
new_map[pair.first] = pair.second;
}
}
used_set.clear();
b_recalc.clear();
b_map = new_map;
return deleted;
}
const map<K, T *> &key_to_scene_data()
@@ -189,7 +173,6 @@ template<typename K, typename T> class id_map {
}
protected:
vector<T *> *scene_data;
map<K, T *> b_map;
set<T *> used_set;
set<void *> b_recalc;

View File

@@ -39,9 +39,9 @@ void BlenderSync::sync_light(BL::Object &b_parent,
BL::Light b_light(b_ob.data());
/* Update if either object or light data changed. */
if (!light_map.add_or_update(&light, b_ob, b_parent, key)) {
if (!light_map.add_or_update(scene, &light, b_ob, b_parent, key)) {
Shader *shader;
if (!shader_map.add_or_update(&shader, b_light)) {
if (!shader_map.add_or_update(scene, &shader, b_light)) {
if (light->is_portal)
*use_portal = true;
return;
@@ -176,7 +176,7 @@ void BlenderSync::sync_background_light(BL::SpaceView3D &b_v3d, bool use_portal)
Light *light;
ObjectKey key(b_world, 0, b_world, false);
if (light_map.add_or_update(&light, b_world, b_world, key) || world_recalc ||
if (light_map.add_or_update(scene, &light, b_world, b_world, key) || world_recalc ||
b_world.ptr.data != world_map) {
light->type = LIGHT_BACKGROUND;
if (sampling_method == SAMPLING_MANUAL) {

View File

@@ -923,48 +923,34 @@ static void create_subd_mesh(Scene *scene,
/* Sync */
static BL::MeshSequenceCacheModifier object_mesh_cache_find(BL::Object &b_ob,
BL::Scene /*b_scene*/)
static BL::MeshSequenceCacheModifier object_mesh_cache_find(BL::Object &b_ob)
{
BL::Object::modifiers_iterator b_mod;
if (b_ob.modifiers.length() > 0) {
BL::Modifier b_mod = b_ob.modifiers[b_ob.modifiers.length() - 1];
for (b_ob.modifiers.begin(b_mod); b_mod != b_ob.modifiers.end(); ++b_mod) {
if (!b_mod->is_a(&RNA_MeshSequenceCacheModifier)) {
continue;
}
if (b_mod.type() == BL::Modifier::type_MESH_SEQUENCE_CACHE) {
BL::MeshSequenceCacheModifier mesh_cache = BL::MeshSequenceCacheModifier(b_mod);
BL::MeshSequenceCacheModifier mesh_cache = BL::MeshSequenceCacheModifier(*b_mod);
if (MeshSequenceCacheModifier_has_velocity_get(&mesh_cache.ptr)) {
return mesh_cache;
if (MeshSequenceCacheModifier_has_velocity_get(&mesh_cache.ptr)) {
return mesh_cache;
}
}
}
return BL::MeshSequenceCacheModifier(PointerRNA_NULL);
}
static void sync_mesh_cached_velocities(BL::Object &b_ob,
BL::Scene b_scene,
Scene *scene,
Mesh *mesh)
static void sync_mesh_cached_velocities(BL::Object &b_ob, Scene *scene, Mesh *mesh)
{
if (scene->need_motion() == Scene::MOTION_NONE)
return;
BL::MeshSequenceCacheModifier b_mesh_cache = object_mesh_cache_find(b_ob, b_scene);
BL::MeshSequenceCacheModifier b_mesh_cache = object_mesh_cache_find(b_ob);
if (!b_mesh_cache) {
return;
}
/* Find or add attribute */
float3 *P = &mesh->verts[0];
Attribute *attr_mP = mesh->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
if (!attr_mP) {
attr_mP = mesh->attributes.add(ATTR_STD_MOTION_VERTEX_POSITION);
}
if (!MeshSequenceCacheModifier_read_velocity_get(&b_mesh_cache.ptr)) {
return;
}
@@ -975,6 +961,14 @@ static void sync_mesh_cached_velocities(BL::Object &b_ob,
return;
}
/* Find or add attribute */
float3 *P = &mesh->verts[0];
Attribute *attr_mP = mesh->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
if (!attr_mP) {
attr_mP = mesh->attributes.add(ATTR_STD_MOTION_VERTEX_POSITION);
}
/* Only export previous and next frame, we don't have any in between data. */
float motion_times[2] = {-1.0f, 1.0f};
for (int step = 0; step < 2; step++) {
@@ -1071,7 +1065,7 @@ void BlenderSync::sync_mesh(BL::Depsgraph b_depsgraph,
}
/* cached velocities (e.g. from alembic archive) */
sync_mesh_cached_velocities(b_ob, b_depsgraph.scene(), scene, mesh);
sync_mesh_cached_velocities(b_ob, scene, mesh);
/* mesh fluid motion mantaflow */
sync_mesh_fluid_motion(b_ob, scene, mesh);
@@ -1095,7 +1089,7 @@ void BlenderSync::sync_mesh_motion(BL::Depsgraph b_depsgraph,
}
/* Cached motion blur already exported. */
BL::MeshSequenceCacheModifier mesh_cache = object_mesh_cache_find(b_ob, b_scene);
BL::MeshSequenceCacheModifier mesh_cache = object_mesh_cache_find(b_ob);
if (mesh_cache) {
return;
}

View File

@@ -207,7 +207,7 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
/* test if we need to sync */
bool object_updated = false;
if (object_map.add_or_update(&object, b_ob, b_parent, key))
if (object_map.add_or_update(scene, &object, b_ob, b_parent, key))
object_updated = true;
/* mesh sync */
@@ -405,14 +405,10 @@ void BlenderSync::sync_objects(BL::Depsgraph &b_depsgraph,
sync_background_light(b_v3d, use_portal);
/* handle removed data and modified pointers */
if (light_map.post_sync())
scene->light_manager->tag_update(scene);
if (geometry_map.post_sync())
scene->geometry_manager->tag_update(scene);
if (object_map.post_sync())
scene->object_manager->tag_update(scene);
if (particle_system_map.post_sync())
scene->particle_system_manager->tag_update(scene);
light_map.post_sync(scene);
geometry_map.post_sync(scene);
object_map.post_sync(scene);
particle_system_map.post_sync(scene);
}
if (motion)

View File

@@ -53,7 +53,8 @@ bool BlenderSync::sync_dupli_particle(BL::Object &b_ob,
ParticleSystem *psys;
bool first_use = !particle_system_map.is_used(key);
bool need_update = particle_system_map.add_or_update(&psys, b_ob, b_instance.object(), key);
bool need_update = particle_system_map.add_or_update(
scene, &psys, b_ob, b_instance.object(), key);
/* no update needed? */
if (!need_update && !object->geometry->need_update && !scene->object_manager->need_update)

View File

@@ -363,7 +363,8 @@ void BlenderSession::do_write_update_render_tile(RenderTile &rtile,
PassType pass_type = BlenderSync::get_pass_type(b_pass);
int components = b_pass.channels();
rtile.buffers->set_pass_rect(pass_type, components, (float *)b_pass.rect());
rtile.buffers->set_pass_rect(
pass_type, components, (float *)b_pass.rect(), rtile.num_samples);
}
end_render_result(b_engine, b_rr, false, false, false);

View File

@@ -224,7 +224,7 @@ static ShaderNode *add_node(Scene *scene,
if (b_node.is_a(&RNA_ShaderNodeRGBCurve)) {
BL::ShaderNodeRGBCurve b_curve_node(b_node);
BL::CurveMapping mapping(b_curve_node.mapping());
RGBCurvesNode *curves = new RGBCurvesNode();
RGBCurvesNode *curves = graph->create_node<RGBCurvesNode>();
curvemapping_color_to_array(mapping, curves->curves, RAMP_TABLE_SIZE, true);
curvemapping_minmax(mapping, true, &curves->min_x, &curves->max_x);
node = curves;
@@ -232,13 +232,13 @@ static ShaderNode *add_node(Scene *scene,
if (b_node.is_a(&RNA_ShaderNodeVectorCurve)) {
BL::ShaderNodeVectorCurve b_curve_node(b_node);
BL::CurveMapping mapping(b_curve_node.mapping());
VectorCurvesNode *curves = new VectorCurvesNode();
VectorCurvesNode *curves = graph->create_node<VectorCurvesNode>();
curvemapping_color_to_array(mapping, curves->curves, RAMP_TABLE_SIZE, false);
curvemapping_minmax(mapping, false, &curves->min_x, &curves->max_x);
node = curves;
}
else if (b_node.is_a(&RNA_ShaderNodeValToRGB)) {
RGBRampNode *ramp = new RGBRampNode();
RGBRampNode *ramp = graph->create_node<RGBRampNode>();
BL::ShaderNodeValToRGB b_ramp_node(b_node);
BL::ColorRamp b_color_ramp(b_ramp_node.color_ramp());
colorramp_to_array(b_color_ramp, ramp->ramp, ramp->ramp_alpha, RAMP_TABLE_SIZE);
@@ -246,94 +246,94 @@ static ShaderNode *add_node(Scene *scene,
node = ramp;
}
else if (b_node.is_a(&RNA_ShaderNodeRGB)) {
ColorNode *color = new ColorNode();
ColorNode *color = graph->create_node<ColorNode>();
color->value = get_node_output_rgba(b_node, "Color");
node = color;
}
else if (b_node.is_a(&RNA_ShaderNodeValue)) {
ValueNode *value = new ValueNode();
ValueNode *value = graph->create_node<ValueNode>();
value->value = get_node_output_value(b_node, "Value");
node = value;
}
else if (b_node.is_a(&RNA_ShaderNodeCameraData)) {
node = new CameraNode();
node = graph->create_node<CameraNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeInvert)) {
node = new InvertNode();
node = graph->create_node<InvertNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeGamma)) {
node = new GammaNode();
node = graph->create_node<GammaNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeBrightContrast)) {
node = new BrightContrastNode();
node = graph->create_node<BrightContrastNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeMixRGB)) {
BL::ShaderNodeMixRGB b_mix_node(b_node);
MixNode *mix = new MixNode();
MixNode *mix = graph->create_node<MixNode>();
mix->type = (NodeMix)b_mix_node.blend_type();
mix->use_clamp = b_mix_node.use_clamp();
node = mix;
}
else if (b_node.is_a(&RNA_ShaderNodeSeparateRGB)) {
node = new SeparateRGBNode();
node = graph->create_node<SeparateRGBNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeCombineRGB)) {
node = new CombineRGBNode();
node = graph->create_node<CombineRGBNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeSeparateHSV)) {
node = new SeparateHSVNode();
node = graph->create_node<SeparateHSVNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeCombineHSV)) {
node = new CombineHSVNode();
node = graph->create_node<CombineHSVNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeSeparateXYZ)) {
node = new SeparateXYZNode();
node = graph->create_node<SeparateXYZNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeCombineXYZ)) {
node = new CombineXYZNode();
node = graph->create_node<CombineXYZNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeHueSaturation)) {
node = new HSVNode();
node = graph->create_node<HSVNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeRGBToBW)) {
node = new RGBToBWNode();
node = graph->create_node<RGBToBWNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeMapRange)) {
BL::ShaderNodeMapRange b_map_range_node(b_node);
MapRangeNode *map_range_node = new MapRangeNode();
MapRangeNode *map_range_node = graph->create_node<MapRangeNode>();
map_range_node->clamp = b_map_range_node.clamp();
map_range_node->type = (NodeMapRangeType)b_map_range_node.interpolation_type();
node = map_range_node;
}
else if (b_node.is_a(&RNA_ShaderNodeClamp)) {
BL::ShaderNodeClamp b_clamp_node(b_node);
ClampNode *clamp_node = new ClampNode();
ClampNode *clamp_node = graph->create_node<ClampNode>();
clamp_node->type = (NodeClampType)b_clamp_node.clamp_type();
node = clamp_node;
}
else if (b_node.is_a(&RNA_ShaderNodeMath)) {
BL::ShaderNodeMath b_math_node(b_node);
MathNode *math_node = new MathNode();
MathNode *math_node = graph->create_node<MathNode>();
math_node->type = (NodeMathType)b_math_node.operation();
math_node->use_clamp = b_math_node.use_clamp();
node = math_node;
}
else if (b_node.is_a(&RNA_ShaderNodeVectorMath)) {
BL::ShaderNodeVectorMath b_vector_math_node(b_node);
VectorMathNode *vector_math_node = new VectorMathNode();
VectorMathNode *vector_math_node = graph->create_node<VectorMathNode>();
vector_math_node->type = (NodeVectorMathType)b_vector_math_node.operation();
node = vector_math_node;
}
else if (b_node.is_a(&RNA_ShaderNodeVectorRotate)) {
BL::ShaderNodeVectorRotate b_vector_rotate_node(b_node);
VectorRotateNode *vector_rotate_node = new VectorRotateNode();
VectorRotateNode *vector_rotate_node = graph->create_node<VectorRotateNode>();
vector_rotate_node->type = (NodeVectorRotateType)b_vector_rotate_node.rotation_type();
vector_rotate_node->invert = b_vector_rotate_node.invert();
node = vector_rotate_node;
}
else if (b_node.is_a(&RNA_ShaderNodeVectorTransform)) {
BL::ShaderNodeVectorTransform b_vector_transform_node(b_node);
VectorTransformNode *vtransform = new VectorTransformNode();
VectorTransformNode *vtransform = graph->create_node<VectorTransformNode>();
vtransform->type = (NodeVectorTransformType)b_vector_transform_node.vector_type();
vtransform->convert_from = (NodeVectorTransformConvertSpace)
b_vector_transform_node.convert_from();
@@ -344,43 +344,43 @@ static ShaderNode *add_node(Scene *scene,
BL::Node::outputs_iterator out_it;
b_node.outputs.begin(out_it);
NormalNode *norm = new NormalNode();
NormalNode *norm = graph->create_node<NormalNode>();
norm->direction = get_node_output_vector(b_node, "Normal");
node = norm;
}
else if (b_node.is_a(&RNA_ShaderNodeMapping)) {
BL::ShaderNodeMapping b_mapping_node(b_node);
MappingNode *mapping = new MappingNode();
MappingNode *mapping = graph->create_node<MappingNode>();
mapping->type = (NodeMappingType)b_mapping_node.vector_type();
node = mapping;
}
else if (b_node.is_a(&RNA_ShaderNodeFresnel)) {
node = new FresnelNode();
node = graph->create_node<FresnelNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeLayerWeight)) {
node = new LayerWeightNode();
node = graph->create_node<LayerWeightNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeAddShader)) {
node = new AddClosureNode();
node = graph->create_node<AddClosureNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeMixShader)) {
node = new MixClosureNode();
node = graph->create_node<MixClosureNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeAttribute)) {
BL::ShaderNodeAttribute b_attr_node(b_node);
AttributeNode *attr = new AttributeNode();
AttributeNode *attr = graph->create_node<AttributeNode>();
attr->attribute = b_attr_node.attribute_name();
node = attr;
}
else if (b_node.is_a(&RNA_ShaderNodeBackground)) {
node = new BackgroundNode();
node = graph->create_node<BackgroundNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeHoldout)) {
node = new HoldoutNode();
node = graph->create_node<HoldoutNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeBsdfAnisotropic)) {
BL::ShaderNodeBsdfAnisotropic b_aniso_node(b_node);
AnisotropicBsdfNode *aniso = new AnisotropicBsdfNode();
AnisotropicBsdfNode *aniso = graph->create_node<AnisotropicBsdfNode>();
switch (b_aniso_node.distribution()) {
case BL::ShaderNodeBsdfAnisotropic::distribution_BECKMANN:
@@ -400,12 +400,12 @@ static ShaderNode *add_node(Scene *scene,
node = aniso;
}
else if (b_node.is_a(&RNA_ShaderNodeBsdfDiffuse)) {
node = new DiffuseBsdfNode();
node = graph->create_node<DiffuseBsdfNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeSubsurfaceScattering)) {
BL::ShaderNodeSubsurfaceScattering b_subsurface_node(b_node);
SubsurfaceScatteringNode *subsurface = new SubsurfaceScatteringNode();
SubsurfaceScatteringNode *subsurface = graph->create_node<SubsurfaceScatteringNode>();
switch (b_subsurface_node.falloff()) {
case BL::ShaderNodeSubsurfaceScattering::falloff_CUBIC:
@@ -426,7 +426,7 @@ static ShaderNode *add_node(Scene *scene,
}
else if (b_node.is_a(&RNA_ShaderNodeBsdfGlossy)) {
BL::ShaderNodeBsdfGlossy b_glossy_node(b_node);
GlossyBsdfNode *glossy = new GlossyBsdfNode();
GlossyBsdfNode *glossy = graph->create_node<GlossyBsdfNode>();
switch (b_glossy_node.distribution()) {
case BL::ShaderNodeBsdfGlossy::distribution_SHARP:
@@ -449,7 +449,7 @@ static ShaderNode *add_node(Scene *scene,
}
else if (b_node.is_a(&RNA_ShaderNodeBsdfGlass)) {
BL::ShaderNodeBsdfGlass b_glass_node(b_node);
GlassBsdfNode *glass = new GlassBsdfNode();
GlassBsdfNode *glass = graph->create_node<GlassBsdfNode>();
switch (b_glass_node.distribution()) {
case BL::ShaderNodeBsdfGlass::distribution_SHARP:
glass->distribution = CLOSURE_BSDF_SHARP_GLASS_ID;
@@ -468,7 +468,7 @@ static ShaderNode *add_node(Scene *scene,
}
else if (b_node.is_a(&RNA_ShaderNodeBsdfRefraction)) {
BL::ShaderNodeBsdfRefraction b_refraction_node(b_node);
RefractionBsdfNode *refraction = new RefractionBsdfNode();
RefractionBsdfNode *refraction = graph->create_node<RefractionBsdfNode>();
switch (b_refraction_node.distribution()) {
case BL::ShaderNodeBsdfRefraction::distribution_SHARP:
refraction->distribution = CLOSURE_BSDF_REFRACTION_ID;
@@ -484,7 +484,7 @@ static ShaderNode *add_node(Scene *scene,
}
else if (b_node.is_a(&RNA_ShaderNodeBsdfToon)) {
BL::ShaderNodeBsdfToon b_toon_node(b_node);
ToonBsdfNode *toon = new ToonBsdfNode();
ToonBsdfNode *toon = graph->create_node<ToonBsdfNode>();
switch (b_toon_node.component()) {
case BL::ShaderNodeBsdfToon::component_DIFFUSE:
toon->component = CLOSURE_BSDF_DIFFUSE_TOON_ID;
@@ -497,7 +497,7 @@ static ShaderNode *add_node(Scene *scene,
}
else if (b_node.is_a(&RNA_ShaderNodeBsdfHair)) {
BL::ShaderNodeBsdfHair b_hair_node(b_node);
HairBsdfNode *hair = new HairBsdfNode();
HairBsdfNode *hair = graph->create_node<HairBsdfNode>();
switch (b_hair_node.component()) {
case BL::ShaderNodeBsdfHair::component_Reflection:
hair->component = CLOSURE_BSDF_HAIR_REFLECTION_ID;
@@ -510,7 +510,7 @@ static ShaderNode *add_node(Scene *scene,
}
else if (b_node.is_a(&RNA_ShaderNodeBsdfHairPrincipled)) {
BL::ShaderNodeBsdfHairPrincipled b_principled_hair_node(b_node);
PrincipledHairBsdfNode *principled_hair = new PrincipledHairBsdfNode();
PrincipledHairBsdfNode *principled_hair = graph->create_node<PrincipledHairBsdfNode>();
principled_hair->parametrization = (NodePrincipledHairParametrization)get_enum(
b_principled_hair_node.ptr,
"parametrization",
@@ -520,7 +520,7 @@ static ShaderNode *add_node(Scene *scene,
}
else if (b_node.is_a(&RNA_ShaderNodeBsdfPrincipled)) {
BL::ShaderNodeBsdfPrincipled b_principled_node(b_node);
PrincipledBsdfNode *principled = new PrincipledBsdfNode();
PrincipledBsdfNode *principled = graph->create_node<PrincipledBsdfNode>();
switch (b_principled_node.distribution()) {
case BL::ShaderNodeBsdfPrincipled::distribution_GGX:
principled->distribution = CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID;
@@ -540,77 +540,77 @@ static ShaderNode *add_node(Scene *scene,
node = principled;
}
else if (b_node.is_a(&RNA_ShaderNodeBsdfTranslucent)) {
node = new TranslucentBsdfNode();
node = graph->create_node<TranslucentBsdfNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeBsdfTransparent)) {
node = new TransparentBsdfNode();
node = graph->create_node<TransparentBsdfNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeBsdfVelvet)) {
node = new VelvetBsdfNode();
node = graph->create_node<VelvetBsdfNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeEmission)) {
node = new EmissionNode();
node = graph->create_node<EmissionNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeAmbientOcclusion)) {
BL::ShaderNodeAmbientOcclusion b_ao_node(b_node);
AmbientOcclusionNode *ao = new AmbientOcclusionNode();
AmbientOcclusionNode *ao = graph->create_node<AmbientOcclusionNode>();
ao->samples = b_ao_node.samples();
ao->inside = b_ao_node.inside();
ao->only_local = b_ao_node.only_local();
node = ao;
}
else if (b_node.is_a(&RNA_ShaderNodeVolumeScatter)) {
node = new ScatterVolumeNode();
node = graph->create_node<ScatterVolumeNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeVolumeAbsorption)) {
node = new AbsorptionVolumeNode();
node = graph->create_node<AbsorptionVolumeNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeVolumePrincipled)) {
PrincipledVolumeNode *principled = new PrincipledVolumeNode();
PrincipledVolumeNode *principled = graph->create_node<PrincipledVolumeNode>();
node = principled;
}
else if (b_node.is_a(&RNA_ShaderNodeNewGeometry)) {
node = new GeometryNode();
node = graph->create_node<GeometryNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeWireframe)) {
BL::ShaderNodeWireframe b_wireframe_node(b_node);
WireframeNode *wire = new WireframeNode();
WireframeNode *wire = graph->create_node<WireframeNode>();
wire->use_pixel_size = b_wireframe_node.use_pixel_size();
node = wire;
}
else if (b_node.is_a(&RNA_ShaderNodeWavelength)) {
node = new WavelengthNode();
node = graph->create_node<WavelengthNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeBlackbody)) {
node = new BlackbodyNode();
node = graph->create_node<BlackbodyNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeLightPath)) {
node = new LightPathNode();
node = graph->create_node<LightPathNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeLightFalloff)) {
node = new LightFalloffNode();
node = graph->create_node<LightFalloffNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeObjectInfo)) {
node = new ObjectInfoNode();
node = graph->create_node<ObjectInfoNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeParticleInfo)) {
node = new ParticleInfoNode();
node = graph->create_node<ParticleInfoNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeHairInfo)) {
node = new HairInfoNode();
node = graph->create_node<HairInfoNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeVolumeInfo)) {
node = new VolumeInfoNode();
node = graph->create_node<VolumeInfoNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeVertexColor)) {
BL::ShaderNodeVertexColor b_vertex_color_node(b_node);
VertexColorNode *vertex_color_node = new VertexColorNode();
VertexColorNode *vertex_color_node = graph->create_node<VertexColorNode>();
vertex_color_node->layer_name = b_vertex_color_node.layer_name();
node = vertex_color_node;
}
else if (b_node.is_a(&RNA_ShaderNodeBump)) {
BL::ShaderNodeBump b_bump_node(b_node);
BumpNode *bump = new BumpNode();
BumpNode *bump = graph->create_node<BumpNode>();
bump->invert = b_bump_node.invert();
node = bump;
}
@@ -624,12 +624,13 @@ static ShaderNode *add_node(Scene *scene,
string bytecode_hash = b_script_node.bytecode_hash();
if (!bytecode_hash.empty()) {
node = OSLShaderManager::osl_node(manager, "", bytecode_hash, b_script_node.bytecode());
node = OSLShaderManager::osl_node(
graph, manager, "", bytecode_hash, b_script_node.bytecode());
}
else {
string absolute_filepath = blender_absolute_path(
b_data, b_ntree, b_script_node.filepath());
node = OSLShaderManager::osl_node(manager, absolute_filepath, "");
node = OSLShaderManager::osl_node(graph, manager, absolute_filepath, "");
}
}
#else
@@ -641,7 +642,7 @@ static ShaderNode *add_node(Scene *scene,
BL::ShaderNodeTexImage b_image_node(b_node);
BL::Image b_image(b_image_node.image());
BL::ImageUser b_image_user(b_image_node.image_user());
ImageTextureNode *image = new ImageTextureNode();
ImageTextureNode *image = graph->create_node<ImageTextureNode>();
image->interpolation = get_image_interpolation(b_image_node);
image->extension = get_image_extension(b_image_node);
@@ -693,7 +694,7 @@ static ShaderNode *add_node(Scene *scene,
BL::ShaderNodeTexEnvironment b_env_node(b_node);
BL::Image b_image(b_env_node.image());
BL::ImageUser b_image_user(b_env_node.image_user());
EnvironmentTextureNode *env = new EnvironmentTextureNode();
EnvironmentTextureNode *env = graph->create_node<EnvironmentTextureNode>();
env->interpolation = get_image_interpolation(b_env_node);
env->projection = (NodeEnvironmentProjection)b_env_node.projection();
@@ -726,7 +727,7 @@ static ShaderNode *add_node(Scene *scene,
}
else if (b_node.is_a(&RNA_ShaderNodeTexGradient)) {
BL::ShaderNodeTexGradient b_gradient_node(b_node);
GradientTextureNode *gradient = new GradientTextureNode();
GradientTextureNode *gradient = graph->create_node<GradientTextureNode>();
gradient->type = (NodeGradientType)b_gradient_node.gradient_type();
BL::TexMapping b_texture_mapping(b_gradient_node.texture_mapping());
get_tex_mapping(&gradient->tex_mapping, b_texture_mapping);
@@ -734,7 +735,7 @@ static ShaderNode *add_node(Scene *scene,
}
else if (b_node.is_a(&RNA_ShaderNodeTexVoronoi)) {
BL::ShaderNodeTexVoronoi b_voronoi_node(b_node);
VoronoiTextureNode *voronoi = new VoronoiTextureNode();
VoronoiTextureNode *voronoi = graph->create_node<VoronoiTextureNode>();
voronoi->dimensions = b_voronoi_node.voronoi_dimensions();
voronoi->feature = (NodeVoronoiFeature)b_voronoi_node.feature();
voronoi->metric = (NodeVoronoiDistanceMetric)b_voronoi_node.distance();
@@ -744,7 +745,7 @@ static ShaderNode *add_node(Scene *scene,
}
else if (b_node.is_a(&RNA_ShaderNodeTexMagic)) {
BL::ShaderNodeTexMagic b_magic_node(b_node);
MagicTextureNode *magic = new MagicTextureNode();
MagicTextureNode *magic = graph->create_node<MagicTextureNode>();
magic->depth = b_magic_node.turbulence_depth();
BL::TexMapping b_texture_mapping(b_magic_node.texture_mapping());
get_tex_mapping(&magic->tex_mapping, b_texture_mapping);
@@ -752,7 +753,7 @@ static ShaderNode *add_node(Scene *scene,
}
else if (b_node.is_a(&RNA_ShaderNodeTexWave)) {
BL::ShaderNodeTexWave b_wave_node(b_node);
WaveTextureNode *wave = new WaveTextureNode();
WaveTextureNode *wave = graph->create_node<WaveTextureNode>();
wave->type = (NodeWaveType)b_wave_node.wave_type();
wave->bands_direction = (NodeWaveBandsDirection)b_wave_node.bands_direction();
wave->rings_direction = (NodeWaveRingsDirection)b_wave_node.rings_direction();
@@ -763,14 +764,14 @@ static ShaderNode *add_node(Scene *scene,
}
else if (b_node.is_a(&RNA_ShaderNodeTexChecker)) {
BL::ShaderNodeTexChecker b_checker_node(b_node);
CheckerTextureNode *checker = new CheckerTextureNode();
CheckerTextureNode *checker = graph->create_node<CheckerTextureNode>();
BL::TexMapping b_texture_mapping(b_checker_node.texture_mapping());
get_tex_mapping(&checker->tex_mapping, b_texture_mapping);
node = checker;
}
else if (b_node.is_a(&RNA_ShaderNodeTexBrick)) {
BL::ShaderNodeTexBrick b_brick_node(b_node);
BrickTextureNode *brick = new BrickTextureNode();
BrickTextureNode *brick = graph->create_node<BrickTextureNode>();
brick->offset = b_brick_node.offset();
brick->offset_frequency = b_brick_node.offset_frequency();
brick->squash = b_brick_node.squash();
@@ -781,7 +782,7 @@ static ShaderNode *add_node(Scene *scene,
}
else if (b_node.is_a(&RNA_ShaderNodeTexNoise)) {
BL::ShaderNodeTexNoise b_noise_node(b_node);
NoiseTextureNode *noise = new NoiseTextureNode();
NoiseTextureNode *noise = graph->create_node<NoiseTextureNode>();
noise->dimensions = b_noise_node.noise_dimensions();
BL::TexMapping b_texture_mapping(b_noise_node.texture_mapping());
get_tex_mapping(&noise->tex_mapping, b_texture_mapping);
@@ -789,7 +790,7 @@ static ShaderNode *add_node(Scene *scene,
}
else if (b_node.is_a(&RNA_ShaderNodeTexMusgrave)) {
BL::ShaderNodeTexMusgrave b_musgrave_node(b_node);
MusgraveTextureNode *musgrave_node = new MusgraveTextureNode();
MusgraveTextureNode *musgrave_node = graph->create_node<MusgraveTextureNode>();
musgrave_node->type = (NodeMusgraveType)b_musgrave_node.musgrave_type();
musgrave_node->dimensions = b_musgrave_node.musgrave_dimensions();
BL::TexMapping b_texture_mapping(b_musgrave_node.texture_mapping());
@@ -798,7 +799,7 @@ static ShaderNode *add_node(Scene *scene,
}
else if (b_node.is_a(&RNA_ShaderNodeTexCoord)) {
BL::ShaderNodeTexCoord b_tex_coord_node(b_node);
TextureCoordinateNode *tex_coord = new TextureCoordinateNode();
TextureCoordinateNode *tex_coord = graph->create_node<TextureCoordinateNode>();
tex_coord->from_dupli = b_tex_coord_node.from_instancer();
if (b_tex_coord_node.object()) {
tex_coord->use_transform = true;
@@ -808,7 +809,7 @@ static ShaderNode *add_node(Scene *scene,
}
else if (b_node.is_a(&RNA_ShaderNodeTexSky)) {
BL::ShaderNodeTexSky b_sky_node(b_node);
SkyTextureNode *sky = new SkyTextureNode();
SkyTextureNode *sky = graph->create_node<SkyTextureNode>();
sky->type = (NodeSkyType)b_sky_node.sky_type();
sky->sun_direction = normalize(get_float3(b_sky_node.sun_direction()));
sky->turbidity = b_sky_node.turbidity();
@@ -828,7 +829,7 @@ static ShaderNode *add_node(Scene *scene,
}
else if (b_node.is_a(&RNA_ShaderNodeTexIES)) {
BL::ShaderNodeTexIES b_ies_node(b_node);
IESLightNode *ies = new IESLightNode();
IESLightNode *ies = graph->create_node<IESLightNode>();
switch (b_ies_node.mode()) {
case BL::ShaderNodeTexIES::mode_EXTERNAL:
ies->filename = blender_absolute_path(b_data, b_ntree, b_ies_node.filepath());
@@ -844,20 +845,20 @@ static ShaderNode *add_node(Scene *scene,
}
else if (b_node.is_a(&RNA_ShaderNodeTexWhiteNoise)) {
BL::ShaderNodeTexWhiteNoise b_tex_white_noise_node(b_node);
WhiteNoiseTextureNode *white_noise_node = new WhiteNoiseTextureNode();
WhiteNoiseTextureNode *white_noise_node = graph->create_node<WhiteNoiseTextureNode>();
white_noise_node->dimensions = b_tex_white_noise_node.noise_dimensions();
node = white_noise_node;
}
else if (b_node.is_a(&RNA_ShaderNodeNormalMap)) {
BL::ShaderNodeNormalMap b_normal_map_node(b_node);
NormalMapNode *nmap = new NormalMapNode();
NormalMapNode *nmap = graph->create_node<NormalMapNode>();
nmap->space = (NodeNormalMapSpace)b_normal_map_node.space();
nmap->attribute = b_normal_map_node.uv_map();
node = nmap;
}
else if (b_node.is_a(&RNA_ShaderNodeTangent)) {
BL::ShaderNodeTangent b_tangent_node(b_node);
TangentNode *tangent = new TangentNode();
TangentNode *tangent = graph->create_node<TangentNode>();
tangent->direction_type = (NodeTangentDirectionType)b_tangent_node.direction_type();
tangent->axis = (NodeTangentAxis)b_tangent_node.axis();
tangent->attribute = b_tangent_node.uv_map();
@@ -865,14 +866,14 @@ static ShaderNode *add_node(Scene *scene,
}
else if (b_node.is_a(&RNA_ShaderNodeUVMap)) {
BL::ShaderNodeUVMap b_uvmap_node(b_node);
UVMapNode *uvm = new UVMapNode();
UVMapNode *uvm = graph->create_node<UVMapNode>();
uvm->attribute = b_uvmap_node.uv_map();
uvm->from_dupli = b_uvmap_node.from_instancer();
node = uvm;
}
else if (b_node.is_a(&RNA_ShaderNodeTexPointDensity)) {
BL::ShaderNodeTexPointDensity b_point_density_node(b_node);
PointDensityTextureNode *point_density = new PointDensityTextureNode();
PointDensityTextureNode *point_density = graph->create_node<PointDensityTextureNode>();
point_density->space = (NodeTexVoxelSpace)b_point_density_node.space();
point_density->interpolation = get_image_interpolation(b_point_density_node);
point_density->handle = scene->image_manager->add_image(
@@ -897,26 +898,26 @@ static ShaderNode *add_node(Scene *scene,
}
else if (b_node.is_a(&RNA_ShaderNodeBevel)) {
BL::ShaderNodeBevel b_bevel_node(b_node);
BevelNode *bevel = new BevelNode();
BevelNode *bevel = graph->create_node<BevelNode>();
bevel->samples = b_bevel_node.samples();
node = bevel;
}
else if (b_node.is_a(&RNA_ShaderNodeDisplacement)) {
BL::ShaderNodeDisplacement b_disp_node(b_node);
DisplacementNode *disp = new DisplacementNode();
DisplacementNode *disp = graph->create_node<DisplacementNode>();
disp->space = (NodeNormalMapSpace)b_disp_node.space();
node = disp;
}
else if (b_node.is_a(&RNA_ShaderNodeVectorDisplacement)) {
BL::ShaderNodeVectorDisplacement b_disp_node(b_node);
VectorDisplacementNode *disp = new VectorDisplacementNode();
VectorDisplacementNode *disp = graph->create_node<VectorDisplacementNode>();
disp->space = (NodeNormalMapSpace)b_disp_node.space();
disp->attribute = "";
node = disp;
}
else if (b_node.is_a(&RNA_ShaderNodeOutputAOV)) {
BL::ShaderNodeOutputAOV b_aov_node(b_node);
OutputAOVNode *aov = new OutputAOVNode();
OutputAOVNode *aov = graph->create_node<OutputAOVNode>();
aov->name = b_aov_node.name();
node = aov;
}
@@ -1038,7 +1039,7 @@ static void add_nodes(Scene *scene,
continue;
}
ConvertNode *proxy = new ConvertNode(to_socket_type, to_socket_type, true);
ConvertNode *proxy = graph->create_node<ConvertNode>(to_socket_type, to_socket_type, true);
input_map[b_link->from_socket().ptr.data] = proxy->inputs[0];
output_map[b_link->to_socket().ptr.data] = proxy->outputs[0];
@@ -1069,7 +1070,7 @@ static void add_nodes(Scene *scene,
continue;
}
ConvertNode *proxy = new ConvertNode(input_type, input_type, true);
ConvertNode *proxy = graph->create_node<ConvertNode>(input_type, input_type, true);
graph->add(proxy);
/* register the proxy node for internal binding */
@@ -1085,7 +1086,7 @@ static void add_nodes(Scene *scene,
continue;
}
ConvertNode *proxy = new ConvertNode(output_type, output_type, true);
ConvertNode *proxy = graph->create_node<ConvertNode>(output_type, output_type, true);
graph->add(proxy);
/* register the proxy node for internal binding */
@@ -1240,7 +1241,7 @@ void BlenderSync::sync_materials(BL::Depsgraph &b_depsgraph, bool update_all)
Shader *shader;
/* test if we need to sync */
if (shader_map.add_or_update(&shader, b_mat) || update_all) {
if (shader_map.add_or_update(scene, &shader, b_mat) || update_all) {
ShaderGraph *graph = new ShaderGraph();
shader->name = b_mat.name().c_str();
@@ -1253,7 +1254,7 @@ void BlenderSync::sync_materials(BL::Depsgraph &b_depsgraph, bool update_all)
add_nodes(scene, b_engine, b_data, b_depsgraph, b_scene, graph, b_ntree);
}
else {
DiffuseBsdfNode *diffuse = new DiffuseBsdfNode();
DiffuseBsdfNode *diffuse = graph->create_node<DiffuseBsdfNode>();
diffuse->color = get_float3(b_mat.diffuse_color());
graph->add(diffuse);
@@ -1336,7 +1337,7 @@ void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d,
shader->volume_step_rate = get_float(cworld, "volume_step_size");
}
else if (new_viewport_parameters.use_scene_world && b_world) {
BackgroundNode *background = new BackgroundNode();
BackgroundNode *background = graph->create_node<BackgroundNode>();
background->color = get_float3(b_world.color());
graph->add(background);
@@ -1352,23 +1353,23 @@ void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d,
world_color = make_float3(0.0f, 0.0f, 0.0f);
}
BackgroundNode *background = new BackgroundNode();
BackgroundNode *background = graph->create_node<BackgroundNode>();
graph->add(background);
LightPathNode *light_path = new LightPathNode();
LightPathNode *light_path = graph->create_node<LightPathNode>();
graph->add(light_path);
MixNode *mix_scene_with_background = new MixNode();
MixNode *mix_scene_with_background = graph->create_node<MixNode>();
mix_scene_with_background->color2 = world_color;
graph->add(mix_scene_with_background);
EnvironmentTextureNode *texture_environment = new EnvironmentTextureNode();
EnvironmentTextureNode *texture_environment = graph->create_node<EnvironmentTextureNode>();
texture_environment->tex_mapping.type = TextureMapping::VECTOR;
texture_environment->tex_mapping.rotation[2] = new_viewport_parameters.studiolight_rotate_z;
texture_environment->filename = new_viewport_parameters.studiolight_path;
graph->add(texture_environment);
MixNode *mix_intensity = new MixNode();
MixNode *mix_intensity = graph->create_node<MixNode>();
mix_intensity->type = NODE_MIX_MUL;
mix_intensity->fac = 1.0f;
mix_intensity->color2 = make_float3(new_viewport_parameters.studiolight_intensity,
@@ -1376,10 +1377,10 @@ void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d,
new_viewport_parameters.studiolight_intensity);
graph->add(mix_intensity);
TextureCoordinateNode *texture_coordinate = new TextureCoordinateNode();
TextureCoordinateNode *texture_coordinate = graph->create_node<TextureCoordinateNode>();
graph->add(texture_coordinate);
MixNode *mix_background_with_environment = new MixNode();
MixNode *mix_background_with_environment = graph->create_node<MixNode>();
mix_background_with_environment->fac = new_viewport_parameters.studiolight_background_alpha;
mix_background_with_environment->color1 = world_color;
graph->add(mix_background_with_environment);
@@ -1466,7 +1467,7 @@ void BlenderSync::sync_lights(BL::Depsgraph &b_depsgraph, bool update_all)
Shader *shader;
/* test if we need to sync */
if (shader_map.add_or_update(&shader, b_light) || update_all) {
if (shader_map.add_or_update(scene, &shader, b_light) || update_all) {
ShaderGraph *graph = new ShaderGraph();
/* create nodes */
@@ -1478,7 +1479,7 @@ void BlenderSync::sync_lights(BL::Depsgraph &b_depsgraph, bool update_all)
add_nodes(scene, b_engine, b_data, b_depsgraph, b_scene, graph, b_ntree);
}
else {
EmissionNode *emission = new EmissionNode();
EmissionNode *emission = graph->create_node<EmissionNode>();
emission->color = make_float3(1.0f, 1.0f, 1.0f);
emission->strength = 1.0f;
graph->add(emission);

View File

@@ -55,11 +55,11 @@ BlenderSync::BlenderSync(BL::RenderEngine &b_engine,
: b_engine(b_engine),
b_data(b_data),
b_scene(b_scene),
shader_map(&scene->shaders),
object_map(&scene->objects),
geometry_map(&scene->geometry),
light_map(&scene->lights),
particle_system_map(&scene->particle_systems),
shader_map(),
object_map(),
geometry_map(),
light_map(),
particle_system_map(),
world_map(NULL),
world_recalc(false),
scene(scene),
@@ -239,7 +239,7 @@ void BlenderSync::sync_data(BL::RenderSettings &b_render,
/* Shader sync done at the end, since object sync uses it.
* false = don't delete unused shaders, not supported. */
shader_map.post_sync(false);
shader_map.post_sync(scene, false);
free_data_after_sync(b_depsgraph);
}

View File

@@ -67,6 +67,7 @@ set(LIB
cycles_render
cycles_kernel
cycles_util
${BLENDER_GL_LIBRARIES}
)
if(WITH_CUDA_DYNLOAD)

View File

@@ -864,6 +864,11 @@ void OpenCLDevice::load_preview_kernels()
bool OpenCLDevice::wait_for_availability(const DeviceRequestedFeatures &requested_features)
{
if (requested_features.use_baking) {
/* For baking, kernels have already been loaded in load_required_kernels(). */
return true;
}
if (background) {
load_kernel_task_pool.wait_work();
use_preview_kernels = false;
@@ -1933,13 +1938,12 @@ void OpenCLDevice::bake(DeviceTask &task, RenderTile &rtile)
kernel_set_args(kernel, start_arg_index, sample);
enqueue_kernel(kernel, d_w, d_h);
clFinish(cqCommandQueue);
rtile.sample = sample + 1;
task.update_progress(&rtile, rtile.w * rtile.h);
}
clFinish(cqCommandQueue);
}
static bool kernel_build_opencl_2(cl_device_id cdDevice)

View File

@@ -26,10 +26,16 @@ CCL_NAMESPACE_BEGIN
/* Node Type */
NodeOwner::~NodeOwner()
{
}
Node::Node(const NodeType *type_, ustring name_) : name(name_), type(type_)
{
assert(type);
owner = nullptr;
/* assign non-empty name, convenient for debugging */
if (name.empty()) {
name = type->name;
@@ -679,4 +685,15 @@ bool Node::is_a(const NodeType *type_)
return false;
}
const NodeOwner *Node::get_owner() const
{
return owner;
}
void Node::set_owner(const NodeOwner *owner_)
{
assert(owner_);
owner = owner_;
}
CCL_NAMESPACE_END

View File

@@ -31,6 +31,10 @@ struct Transform;
/* Node */
struct NodeOwner {
virtual ~NodeOwner();
};
struct Node {
explicit Node(const NodeType *type, ustring name = ustring());
virtual ~Node() = 0;
@@ -99,6 +103,12 @@ struct Node {
ustring name;
const NodeType *type;
const NodeOwner *get_owner() const;
void set_owner(const NodeOwner *owner_);
protected:
const NodeOwner *owner;
};
CCL_NAMESPACE_END

View File

@@ -47,7 +47,7 @@ ccl_device float4 film_get_pass_result(KernelGlobals *kg,
if (kernel_data.film.use_display_exposure) {
float exposure = kernel_data.film.exposure;
pass_result *= make_float4(exposure, exposure, exposure, alpha);
pass_result *= make_float4(exposure, exposure, exposure, 1.0f);
}
}
else if (display_pass_components == 1) {

View File

@@ -12,12 +12,11 @@
__kernel void kernel_ocl_bake(
ccl_constant KernelData *data,
ccl_global uint4 *input,
ccl_global float4 *output,
ccl_global float *buffer,
KERNEL_BUFFER_PARAMS,
int type, int filter, int sx, int sw, int offset, int sample)
int sx, int sy, int sw, int sh, int offset, int stride, int sample)
{
KernelGlobals kglobals, *kg = &kglobals;
@@ -27,12 +26,11 @@ __kernel void kernel_ocl_bake(
kernel_set_buffer_info(kg);
int x = sx + ccl_global_id(0);
int y = sy + ccl_global_id(1);
if(x < sx + sw) {
#ifdef __NO_BAKING__
output[x] = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
#else
kernel_bake_evaluate(kg, input, output, (ShaderEvalType)type, filter, x, offset, sample);
if(x < sx + sw && y < sy + sh) {
#ifndef __NO_BAKING__
kernel_bake_evaluate(kg, buffer, sample, x, y, offset, stride);
#endif
}
}

View File

@@ -90,6 +90,7 @@ struct OSLTraceData {
ShaderData sd;
bool setup;
bool init;
bool hit;
};
/* thread key for thread specific data lookup */

View File

@@ -1481,6 +1481,7 @@ bool OSLRenderServices::trace(TraceOpt &options,
tracedata->ray = ray;
tracedata->setup = false;
tracedata->init = true;
tracedata->hit = false;
tracedata->sd.osl_globals = sd->osl_globals;
KernelGlobals *kg = sd->osl_globals;
@@ -1492,7 +1493,8 @@ bool OSLRenderServices::trace(TraceOpt &options,
/* Raytrace, leaving out shadow opaque to avoid early exit. */
uint visibility = PATH_RAY_ALL_VISIBILITY - PATH_RAY_SHADOW_OPAQUE;
return scene_intersect(kg, &ray, visibility, &tracedata->isect);
tracedata->hit = scene_intersect(kg, &ray, visibility, &tracedata->isect);
return tracedata->hit;
}
bool OSLRenderServices::getmessage(OSL::ShaderGlobals *sg,
@@ -1506,9 +1508,9 @@ bool OSLRenderServices::getmessage(OSL::ShaderGlobals *sg,
if (source == u_trace && tracedata->init) {
if (name == u_hit) {
return set_attribute_int((tracedata->isect.prim != PRIM_NONE), type, derivatives, val);
return set_attribute_int(tracedata->hit, type, derivatives, val);
}
else if (tracedata->isect.prim != PRIM_NONE) {
else if (tracedata->hit) {
if (name == u_hitdist) {
float f[3] = {tracedata->isect.t, 0.0f, 0.0f};
return set_attribute_float(f, type, derivatives, val);

View File

@@ -459,7 +459,7 @@ bool RenderBuffers::get_pass_rect(
return false;
}
bool RenderBuffers::set_pass_rect(PassType type, int components, float *pixels)
bool RenderBuffers::set_pass_rect(PassType type, int components, float *pixels, int samples)
{
if (buffer.data() == NULL) {
return false;
@@ -482,8 +482,17 @@ bool RenderBuffers::set_pass_rect(PassType type, int components, float *pixels)
assert(pass.components == components);
for (int i = 0; i < size; i++, out += pass_stride, pixels += components) {
for (int j = 0; j < components; j++) {
out[j] = pixels[j];
if (pass.filter) {
/* Scale by the number of samples, inverse of what we do in get_pass_rect.
* A better solution would be to remove the need for set_pass_rect entirely,
* and change baking to bake multiple objects in a tile at once. */
for (int j = 0; j < components; j++) {
out[j] = pixels[j] * samples;
}
}
else {
/* For non-filtered passes just straight copy, these may contain non-float data. */
memcpy(out, pixels, sizeof(float) * components);
}
}

View File

@@ -92,7 +92,7 @@ class RenderBuffers {
const string &name, float exposure, int sample, int components, float *pixels);
bool get_denoising_pass_rect(
int offset, float exposure, int sample, int components, float *pixels);
bool set_pass_rect(PassType type, int components, float *pixels);
bool set_pass_rect(PassType type, int components, float *pixels, int samples);
};
/* Display Buffer

View File

@@ -253,6 +253,8 @@ void Pass::add(PassType type, vector<Pass> &passes, const char *name)
case PASS_BAKE_PRIMITIVE:
case PASS_BAKE_DIFFERENTIAL:
pass.components = 4;
pass.exposure = false;
pass.filter = false;
break;
default:
assert(false);

View File

@@ -221,7 +221,7 @@ ShaderGraph::ShaderGraph()
finalized = false;
simplified = false;
num_node_ids = 0;
add(new OutputNode());
add(create_node<OutputNode>());
}
ShaderGraph::~ShaderGraph()
@@ -272,7 +272,7 @@ void ShaderGraph::connect(ShaderOutput *from, ShaderInput *to)
ShaderInput *convert_in;
if (to->type() == SocketType::CLOSURE) {
EmissionNode *emission = new EmissionNode();
EmissionNode *emission = create_node<EmissionNode>();
emission->color = make_float3(1.0f, 1.0f, 1.0f);
emission->strength = 1.0f;
convert = add(emission);
@@ -285,7 +285,7 @@ void ShaderGraph::connect(ShaderOutput *from, ShaderInput *to)
}
}
else {
convert = add(new ConvertNode(from->type(), to->type(), true));
convert = add(create_node<ConvertNode>(from->type(), to->type(), true));
convert_in = convert->inputs[0];
}
@@ -416,7 +416,7 @@ void ShaderGraph::find_dependencies(ShaderNodeSet &dependencies, ShaderInput *in
void ShaderGraph::clear_nodes()
{
foreach (ShaderNode *node, nodes) {
delete node;
delete_node(node);
}
nodes.clear();
}
@@ -428,7 +428,7 @@ void ShaderGraph::copy_nodes(ShaderNodeSet &nodes, ShaderNodeMap &nnodemap)
/* copy nodes */
foreach (ShaderNode *node, nodes) {
ShaderNode *nnode = node->clone();
ShaderNode *nnode = node->clone(this);
nnodemap[node] = nnode;
/* create new inputs and outputs to recreate links and ensure
@@ -523,7 +523,7 @@ void ShaderGraph::remove_proxy_nodes()
if (!removed[node->id])
newnodes.push_back(node);
else
delete node;
delete_node(node);
}
nodes = newnodes;
@@ -585,7 +585,7 @@ void ShaderGraph::constant_fold(Scene *scene)
* that happens to ensure there is still a valid graph for displacement.
*/
if (has_displacement && !output()->input("Displacement")->link) {
ColorNode *value = (ColorNode *)add(new ColorNode());
ColorNode *value = (ColorNode *)add(create_node<ColorNode>());
value->value = output()->displacement;
connect(value->output("Color"), output()->input("Displacement"));
@@ -821,7 +821,7 @@ void ShaderGraph::clean(Scene *scene)
if (visited[node->id])
newnodes.push_back(node);
else
delete node;
delete_node(node);
}
nodes = newnodes;
@@ -848,43 +848,43 @@ void ShaderGraph::default_inputs(bool do_osl)
if (!input->link && (!(input->flags() & SocketType::OSL_INTERNAL) || do_osl)) {
if (input->flags() & SocketType::LINK_TEXTURE_GENERATED) {
if (!texco)
texco = new TextureCoordinateNode();
texco = create_node<TextureCoordinateNode>();
connect(texco->output("Generated"), input);
}
if (input->flags() & SocketType::LINK_TEXTURE_NORMAL) {
if (!texco)
texco = new TextureCoordinateNode();
texco = create_node<TextureCoordinateNode>();
connect(texco->output("Normal"), input);
}
else if (input->flags() & SocketType::LINK_TEXTURE_UV) {
if (!texco)
texco = new TextureCoordinateNode();
texco = create_node<TextureCoordinateNode>();
connect(texco->output("UV"), input);
}
else if (input->flags() & SocketType::LINK_INCOMING) {
if (!geom)
geom = new GeometryNode();
geom = create_node<GeometryNode>();
connect(geom->output("Incoming"), input);
}
else if (input->flags() & SocketType::LINK_NORMAL) {
if (!geom)
geom = new GeometryNode();
geom = create_node<GeometryNode>();
connect(geom->output("Normal"), input);
}
else if (input->flags() & SocketType::LINK_POSITION) {
if (!geom)
geom = new GeometryNode();
geom = create_node<GeometryNode>();
connect(geom->output("Position"), input);
}
else if (input->flags() & SocketType::LINK_TANGENT) {
if (!geom)
geom = new GeometryNode();
geom = create_node<GeometryNode>();
connect(geom->output("Tangent"), input);
}
@@ -999,10 +999,10 @@ void ShaderGraph::bump_from_displacement(bool use_object_space)
* output, so it can finally set the shader normal, note we are only doing
* this for bump from displacement, this will be the only bump allowed to
* overwrite the shader normal */
ShaderNode *set_normal = add(new SetNormalNode());
ShaderNode *set_normal = add(create_node<SetNormalNode>());
/* add bump node and connect copied graphs to it */
BumpNode *bump = (BumpNode *)add(new BumpNode());
BumpNode *bump = (BumpNode *)add(create_node<BumpNode>());
bump->use_object_space = use_object_space;
bump->distance = 1.0f;
@@ -1012,15 +1012,15 @@ void ShaderGraph::bump_from_displacement(bool use_object_space)
ShaderOutput *out_dy = nodes_dy[out->parent]->output(out->name());
/* convert displacement vector to height */
VectorMathNode *dot_center = (VectorMathNode *)add(new VectorMathNode());
VectorMathNode *dot_dx = (VectorMathNode *)add(new VectorMathNode());
VectorMathNode *dot_dy = (VectorMathNode *)add(new VectorMathNode());
VectorMathNode *dot_center = (VectorMathNode *)add(create_node<VectorMathNode>());
VectorMathNode *dot_dx = (VectorMathNode *)add(create_node<VectorMathNode>());
VectorMathNode *dot_dy = (VectorMathNode *)add(create_node<VectorMathNode>());
dot_center->type = NODE_VECTOR_MATH_DOT_PRODUCT;
dot_dx->type = NODE_VECTOR_MATH_DOT_PRODUCT;
dot_dy->type = NODE_VECTOR_MATH_DOT_PRODUCT;
GeometryNode *geom = (GeometryNode *)add(new GeometryNode());
GeometryNode *geom = (GeometryNode *)add(create_node<GeometryNode>());
connect(geom->output("Normal"), dot_center->input("Vector2"));
connect(geom->output("Normal"), dot_dx->input("Vector2"));
connect(geom->output("Normal"), dot_dy->input("Vector2"));
@@ -1064,7 +1064,7 @@ void ShaderGraph::transform_multi_closure(ShaderNode *node, ShaderOutput *weight
if (fin) {
/* mix closure: add node to mix closure weights */
MixClosureWeightNode *mix_node = new MixClosureWeightNode();
MixClosureWeightNode *mix_node = create_node<MixClosureWeightNode>();
add(mix_node);
ShaderInput *fac_in = mix_node->input("Fac");
ShaderInput *weight_in = mix_node->input("Weight");
@@ -1101,7 +1101,7 @@ void ShaderGraph::transform_multi_closure(ShaderNode *node, ShaderOutput *weight
/* already has a weight connected to it? add weights */
float weight_value = node->get_float(weight_in->socket_type);
if (weight_in->link || weight_value != 0.0f) {
MathNode *math_node = new MathNode();
MathNode *math_node = create_node<MathNode>();
add(math_node);
if (weight_in->link)

View File

@@ -159,7 +159,7 @@ class ShaderNode : public Node {
ShaderInput *input(ustring name);
ShaderOutput *output(ustring name);
virtual ShaderNode *clone() const = 0;
virtual ShaderNode *clone(ShaderGraph *graph) const = 0;
virtual void attributes(Shader *shader, AttributeRequestSet *attributes);
virtual void compile(SVMCompiler &compiler) = 0;
virtual void compile(OSLCompiler &compiler) = 0;
@@ -275,9 +275,9 @@ class ShaderNode : public Node {
#define SHADER_NODE_CLASS(type) \
NODE_DECLARE \
type(); \
virtual ShaderNode *clone() const \
virtual ShaderNode *clone(ShaderGraph *graph) const \
{ \
return new type(*this); \
return graph->create_node<type>(*this); \
} \
virtual void compile(SVMCompiler &compiler); \
virtual void compile(OSLCompiler &compiler);
@@ -289,9 +289,9 @@ class ShaderNode : public Node {
virtual void compile(OSLCompiler &compiler);
#define SHADER_NODE_BASE_CLASS(type) \
virtual ShaderNode *clone() const \
virtual ShaderNode *clone(ShaderGraph *graph) const \
{ \
return new type(*this); \
return graph->create_node<type>(*this); \
} \
virtual void compile(SVMCompiler &compiler); \
virtual void compile(OSLCompiler &compiler);
@@ -312,7 +312,7 @@ typedef map<ShaderNode *, ShaderNode *, ShaderNodeIDComparator> ShaderNodeMap;
* Shader graph of nodes. Also does graph manipulations for default inputs,
* bump mapping from displacement, and possibly other things in the future. */
class ShaderGraph {
class ShaderGraph : public NodeOwner {
public:
list<ShaderNode *> nodes;
size_t num_node_ids;
@@ -345,6 +345,24 @@ class ShaderGraph {
void dump_graph(const char *filename);
/* This function is used to create a node of a specified type instead of
* calling 'new', and sets the graph as the owner of the node.
*/
template<typename T, typename... Args> T *create_node(Args &&... args)
{
T *node = new T(args...);
node->set_owner(this);
return node;
}
/* This function is used to delete a node created and owned by the graph.
*/
template<typename T> void delete_node(T *node)
{
assert(node->get_owner() == this);
delete node;
}
protected:
typedef pair<ShaderNode *const, ShaderNode *> NodePair;

View File

@@ -262,9 +262,9 @@ ImageTextureNode::ImageTextureNode() : ImageSlotTextureNode(node_type)
tiles.push_back(1001);
}
ShaderNode *ImageTextureNode::clone() const
ShaderNode *ImageTextureNode::clone(ShaderGraph *graph) const
{
ImageTextureNode *node = new ImageTextureNode(*this);
ImageTextureNode *node = graph->create_node<ImageTextureNode>(*this);
node->handle = handle;
return node;
}
@@ -525,9 +525,9 @@ EnvironmentTextureNode::EnvironmentTextureNode() : ImageSlotTextureNode(node_typ
animated = false;
}
ShaderNode *EnvironmentTextureNode::clone() const
ShaderNode *EnvironmentTextureNode::clone(ShaderGraph *graph) const
{
EnvironmentTextureNode *node = new EnvironmentTextureNode(*this);
EnvironmentTextureNode *node = graph->create_node<EnvironmentTextureNode>(*this);
node->handle = handle;
return node;
}
@@ -1234,9 +1234,9 @@ IESLightNode::IESLightNode() : TextureNode(node_type)
slot = -1;
}
ShaderNode *IESLightNode::clone() const
ShaderNode *IESLightNode::clone(ShaderGraph *graph) const
{
IESLightNode *node = new IESLightNode(*this);
IESLightNode *node = graph->create_node<IESLightNode>(*this);
node->light_manager = NULL;
node->slot = -1;
@@ -1782,12 +1782,12 @@ PointDensityTextureNode::~PointDensityTextureNode()
{
}
ShaderNode *PointDensityTextureNode::clone() const
ShaderNode *PointDensityTextureNode::clone(ShaderGraph *graph) const
{
/* Increase image user count for new node. We need to ensure to not call
* add_image again, to work around access of freed data on the Blender
* side. A better solution should be found to avoid this. */
PointDensityTextureNode *node = new PointDensityTextureNode(*this);
PointDensityTextureNode *node = graph->create_node<PointDensityTextureNode>(*this);
node->handle = handle; /* TODO: not needed? */
return node;
}
@@ -2783,8 +2783,8 @@ void PrincipledBsdfNode::expand(ShaderGraph *graph)
ShaderInput *emission_in = input("Emission");
if (emission_in->link || emission != make_float3(0.0f, 0.0f, 0.0f)) {
/* Create add closure and emission. */
AddClosureNode *add = new AddClosureNode();
EmissionNode *emission_node = new EmissionNode();
AddClosureNode *add = graph->create_node<AddClosureNode>();
EmissionNode *emission_node = graph->create_node<EmissionNode>();
ShaderOutput *new_out = add->output("Closure");
graph->add(add);
@@ -2802,8 +2802,8 @@ void PrincipledBsdfNode::expand(ShaderGraph *graph)
ShaderInput *alpha_in = input("Alpha");
if (alpha_in->link || alpha != 1.0f) {
/* Create mix and transparent BSDF for alpha transparency. */
MixClosureNode *mix = new MixClosureNode();
TransparentBsdfNode *transparent = new TransparentBsdfNode();
MixClosureNode *mix = graph->create_node<MixClosureNode>();
TransparentBsdfNode *transparent = graph->create_node<TransparentBsdfNode>();
graph->add(mix);
graph->add(transparent);
@@ -4475,7 +4475,7 @@ void VolumeInfoNode::expand(ShaderGraph *graph)
{
ShaderOutput *color_out = output("Color");
if (!color_out->links.empty()) {
AttributeNode *attr = new AttributeNode();
AttributeNode *attr = graph->create_node<AttributeNode>();
attr->attribute = "color";
graph->add(attr);
graph->relink(color_out, attr->output("Color"));
@@ -4483,7 +4483,7 @@ void VolumeInfoNode::expand(ShaderGraph *graph)
ShaderOutput *density_out = output("Density");
if (!density_out->links.empty()) {
AttributeNode *attr = new AttributeNode();
AttributeNode *attr = graph->create_node<AttributeNode>();
attr->attribute = "density";
graph->add(attr);
graph->relink(density_out, attr->output("Fac"));
@@ -4491,7 +4491,7 @@ void VolumeInfoNode::expand(ShaderGraph *graph)
ShaderOutput *flame_out = output("Flame");
if (!flame_out->links.empty()) {
AttributeNode *attr = new AttributeNode();
AttributeNode *attr = graph->create_node<AttributeNode>();
attr->attribute = "flame";
graph->add(attr);
graph->relink(flame_out, attr->output("Fac"));
@@ -4499,7 +4499,7 @@ void VolumeInfoNode::expand(ShaderGraph *graph)
ShaderOutput *temperature_out = output("Temperature");
if (!temperature_out->links.empty()) {
AttributeNode *attr = new AttributeNode();
AttributeNode *attr = graph->create_node<AttributeNode>();
attr->attribute = "temperature";
graph->add(attr);
graph->relink(temperature_out, attr->output("Fac"));
@@ -5768,7 +5768,7 @@ void MapRangeNode::expand(ShaderGraph *graph)
if (clamp) {
ShaderOutput *result_out = output("Result");
if (!result_out->links.empty()) {
ClampNode *clamp_node = new ClampNode();
ClampNode *clamp_node = graph->create_node<ClampNode>();
clamp_node->type = NODE_CLAMP_RANGE;
graph->add(clamp_node);
graph->relink(result_out, clamp_node->output("Result"));
@@ -6009,7 +6009,7 @@ void MathNode::expand(ShaderGraph *graph)
if (use_clamp) {
ShaderOutput *result_out = output("Value");
if (!result_out->links.empty()) {
ClampNode *clamp_node = new ClampNode();
ClampNode *clamp_node = graph->create_node<ClampNode>();
clamp_node->type = NODE_CLAMP_MINMAX;
clamp_node->min = 0.0f;
clamp_node->max = 1.0f;
@@ -6337,7 +6337,7 @@ void BumpNode::constant_fold(const ConstantFolder &folder)
if (height_in->link == NULL) {
if (normal_in->link == NULL) {
GeometryNode *geom = new GeometryNode();
GeometryNode *geom = folder.graph->create_node<GeometryNode>();
folder.graph->add(geom);
folder.bypass(geom->output("Normal"));
}
@@ -6620,12 +6620,12 @@ OSLNode::~OSLNode()
delete type;
}
ShaderNode *OSLNode::clone() const
ShaderNode *OSLNode::clone(ShaderGraph *graph) const
{
return OSLNode::create(this->inputs.size(), this);
return OSLNode::create(graph, this->inputs.size(), this);
}
OSLNode *OSLNode::create(size_t num_inputs, const OSLNode *from)
OSLNode *OSLNode::create(ShaderGraph *graph, size_t num_inputs, const OSLNode *from)
{
/* allocate space for the node itself and parameters, aligned to 16 bytes
* assuming that's the most parameter types need */
@@ -6636,7 +6636,9 @@ OSLNode *OSLNode::create(size_t num_inputs, const OSLNode *from)
memset(node_memory, 0, node_size + inputs_size);
if (!from) {
return new (node_memory) OSLNode();
OSLNode *node = new (node_memory) OSLNode();
node->set_owner(graph);
return node;
}
else {
/* copy input default values and node type for cloning */
@@ -6644,6 +6646,7 @@ OSLNode *OSLNode::create(size_t num_inputs, const OSLNode *from)
OSLNode *node = new (node_memory) OSLNode(*from);
node->type = new NodeType(*(from->type));
node->set_owner(from->owner);
return node;
}
}

View File

@@ -92,7 +92,7 @@ class ImageSlotTextureNode : public TextureNode {
class ImageTextureNode : public ImageSlotTextureNode {
public:
SHADER_NODE_NO_CLONE_CLASS(ImageTextureNode)
ShaderNode *clone() const;
ShaderNode *clone(ShaderGraph *graph) const;
void attributes(Shader *shader, AttributeRequestSet *attributes);
bool has_attribute_dependency()
{
@@ -126,7 +126,7 @@ class ImageTextureNode : public ImageSlotTextureNode {
class EnvironmentTextureNode : public ImageSlotTextureNode {
public:
SHADER_NODE_NO_CLONE_CLASS(EnvironmentTextureNode)
ShaderNode *clone() const;
ShaderNode *clone(ShaderGraph *graph) const;
void attributes(Shader *shader, AttributeRequestSet *attributes);
bool has_attribute_dependency()
{
@@ -364,7 +364,7 @@ class PointDensityTextureNode : public ShaderNode {
}
~PointDensityTextureNode();
ShaderNode *clone() const;
ShaderNode *clone(ShaderGraph *graph) const;
void attributes(Shader *shader, AttributeRequestSet *attributes);
bool has_attribute_dependency()
{
@@ -400,7 +400,7 @@ class IESLightNode : public TextureNode {
SHADER_NODE_NO_CLONE_CLASS(IESLightNode)
~IESLightNode();
ShaderNode *clone() const;
ShaderNode *clone(ShaderGraph *graph) const;
virtual int get_group()
{
return NODE_GROUP_LEVEL_2;
@@ -1501,10 +1501,10 @@ class SetNormalNode : public ShaderNode {
class OSLNode : public ShaderNode {
public:
static OSLNode *create(size_t num_inputs, const OSLNode *from = NULL);
static OSLNode *create(ShaderGraph *graph, size_t num_inputs, const OSLNode *from = NULL);
~OSLNode();
ShaderNode *clone() const;
ShaderNode *clone(ShaderGraph *graph) const;
char *input_default_value();
void add_input(ustring name, SocketType::Type type);

View File

@@ -439,7 +439,8 @@ const char *OSLShaderManager::shader_load_bytecode(const string &hash, const str
/* This is a static function to avoid RTTI link errors with only this
* file being compiled without RTTI to match OSL and LLVM libraries. */
OSLNode *OSLShaderManager::osl_node(ShaderManager *manager,
OSLNode *OSLShaderManager::osl_node(ShaderGraph *graph,
ShaderManager *manager,
const std::string &filepath,
const std::string &bytecode_hash,
const std::string &bytecode)
@@ -482,7 +483,7 @@ OSLNode *OSLShaderManager::osl_node(ShaderManager *manager,
}
/* create node */
OSLNode *node = OSLNode::create(num_inputs);
OSLNode *node = OSLNode::create(graph, num_inputs);
/* add new sockets from parameters */
set<void *> used_sockets;

View File

@@ -93,7 +93,8 @@ class OSLShaderManager : public ShaderManager {
OSLShaderInfo *shader_loaded_info(const string &hash);
/* create OSL node using OSLQuery */
static OSLNode *osl_node(ShaderManager *manager,
static OSLNode *osl_node(ShaderGraph *graph,
ShaderManager *manager,
const std::string &filepath,
const std::string &bytecode_hash = "",
const std::string &bytecode = "");

View File

@@ -29,7 +29,13 @@ CCL_NAMESPACE_BEGIN
/* Particle System */
ParticleSystem::ParticleSystem()
NODE_DEFINE(ParticleSystem)
{
NodeType *type = NodeType::add("particle_system", create);
return type;
}
ParticleSystem::ParticleSystem() : Node(node_type)
{
}

View File

@@ -20,6 +20,8 @@
#include "util/util_array.h"
#include "util/util_types.h"
#include "graph/node.h"
CCL_NAMESPACE_BEGIN
class Device;
@@ -40,8 +42,10 @@ struct Particle {
float3 angular_velocity;
};
class ParticleSystem {
class ParticleSystem : public Node {
public:
NODE_DECLARE
ParticleSystem();
~ParticleSystem();

View File

@@ -33,6 +33,7 @@
#include "render/shader.h"
#include "render/svm.h"
#include "render/tables.h"
#include "render/volume.h"
#include "util/util_foreach.h"
#include "util/util_guarded_allocator.h"
@@ -98,15 +99,15 @@ Scene::Scene(const SceneParams &params_, Device *device)
{
memset((void *)&dscene.data, 0, sizeof(dscene.data));
camera = new Camera();
dicing_camera = new Camera();
camera = create_node<Camera>();
dicing_camera = create_node<Camera>();
lookup_tables = new LookupTables();
film = new Film();
background = new Background();
film = create_node<Film>();
background = create_node<Background>();
light_manager = new LightManager();
geometry_manager = new GeometryManager();
object_manager = new ObjectManager();
integrator = new Integrator();
integrator = create_node<Integrator>();
image_manager = new ImageManager(device->info);
particle_system_manager = new ParticleSystemManager();
bake_manager = new BakeManager();
@@ -560,4 +561,127 @@ int Scene::get_max_closure_count()
return max_closure_global;
}
template<> Light *Scene::create_node<Light>()
{
Light *node = new Light();
node->set_owner(this);
lights.push_back(node);
light_manager->tag_update(this);
return node;
}
template<> Mesh *Scene::create_node<Mesh>()
{
Mesh *node = new Mesh();
node->set_owner(this);
geometry.push_back(node);
geometry_manager->tag_update(this);
return node;
}
template<> Hair *Scene::create_node<Hair>()
{
Hair *node = new Hair();
node->set_owner(this);
geometry.push_back(node);
geometry_manager->tag_update(this);
return node;
}
template<> Volume *Scene::create_node<Volume>()
{
Volume *node = new Volume();
node->set_owner(this);
geometry.push_back(node);
geometry_manager->tag_update(this);
return node;
}
template<> Object *Scene::create_node<Object>()
{
Object *node = new Object();
node->set_owner(this);
objects.push_back(node);
object_manager->tag_update(this);
return node;
}
template<> ParticleSystem *Scene::create_node<ParticleSystem>()
{
ParticleSystem *node = new ParticleSystem();
node->set_owner(this);
particle_systems.push_back(node);
particle_system_manager->tag_update(this);
return node;
}
template<> Shader *Scene::create_node<Shader>()
{
Shader *node = new Shader();
node->set_owner(this);
shaders.push_back(node);
shader_manager->need_update = true;
return node;
}
template<typename T> void delete_node_from_array(vector<T> &nodes, T node)
{
for (size_t i = 0; i < nodes.size(); ++i) {
if (nodes[i] == node) {
std::swap(nodes[i], nodes[nodes.size() - 1]);
break;
}
}
nodes.resize(nodes.size() - 1);
delete node;
}
template<> void Scene::delete_node_impl(Light *node)
{
delete_node_from_array(lights, node);
light_manager->tag_update(this);
}
template<> void Scene::delete_node_impl(Mesh *node)
{
delete_node_from_array(geometry, static_cast<Geometry *>(node));
geometry_manager->tag_update(this);
}
template<> void Scene::delete_node_impl(Hair *node)
{
delete_node_from_array(geometry, static_cast<Geometry *>(node));
geometry_manager->tag_update(this);
}
template<> void Scene::delete_node_impl(Volume *node)
{
delete_node_from_array(geometry, static_cast<Geometry *>(node));
geometry_manager->tag_update(this);
}
template<> void Scene::delete_node_impl(Geometry *node)
{
delete_node_from_array(geometry, node);
geometry_manager->tag_update(this);
}
template<> void Scene::delete_node_impl(Object *node)
{
delete_node_from_array(objects, node);
object_manager->tag_update(this);
}
template<> void Scene::delete_node_impl(ParticleSystem *node)
{
delete_node_from_array(particle_systems, node);
particle_system_manager->tag_update(this);
}
template<> void Scene::delete_node_impl(Shader * /*node*/)
{
/* don't delete unused shaders, not supported */
}
CCL_NAMESPACE_END

View File

@@ -59,6 +59,7 @@ class Progress;
class BakeManager;
class BakeData;
class RenderStats;
class Volume;
/* Scene Device Data */
@@ -212,7 +213,7 @@ class SceneParams {
/* Scene */
class Scene {
class Scene : public NodeOwner {
public:
/* Optional name. Is used for logging and reporting. */
string name;
@@ -281,6 +282,40 @@ class Scene {
bool update(Progress &progress, bool &kernel_switch_needed);
/* This function is used to create a node of a specified type instead of
* calling 'new', and sets the scene as the owner of the node.
* The function has overloads that will also add the created node to the right
* node array (e.g. Scene::geometry for Geometry nodes) and tag the appropriate
* manager for an update.
*/
template<typename T, typename... Args> T *create_node(Args &&... args)
{
T *node = new T(args...);
node->set_owner(this);
return node;
}
/* This function is used to delete a node from the scene instead of calling 'delete'
* and manually removing the node from the data array. It also tags the
* appropriate manager for an update, if any, and checks that the scene is indeed
* the owner of the node. Calling this function on a node not owned by the scene
* will likely cause a crash which we want in order to detect such cases.
*/
template<typename T> void delete_node(T *node)
{
assert(node->get_owner() == this);
delete_node_impl(node);
}
/* Same as above, but specify the actual owner.
*/
template<typename T> void delete_node(T *node, const NodeOwner *owner)
{
assert(node->get_owner() == owner);
delete_node_impl(node);
(void)owner;
}
protected:
/* Check if some heavy data worth logging was updated.
* Mainly used to suppress extra annoying logging.
@@ -303,8 +338,43 @@ class Scene {
/* Get maximum number of closures to be used in kernel. */
int get_max_closure_count();
template<typename T> void delete_node_impl(T *node)
{
delete node;
}
};
template<> Light *Scene::create_node<Light>();
template<> Mesh *Scene::create_node<Mesh>();
template<> Object *Scene::create_node<Object>();
template<> Hair *Scene::create_node<Hair>();
template<> Volume *Scene::create_node<Volume>();
template<> ParticleSystem *Scene::create_node<ParticleSystem>();
template<> Shader *Scene::create_node<Shader>();
template<> void Scene::delete_node_impl(Light *node);
template<> void Scene::delete_node_impl(Mesh *node);
template<> void Scene::delete_node_impl(Volume *node);
template<> void Scene::delete_node_impl(Hair *node);
template<> void Scene::delete_node_impl(Geometry *node);
template<> void Scene::delete_node_impl(Object *node);
template<> void Scene::delete_node_impl(ParticleSystem *node);
template<> void Scene::delete_node_impl(Shader *node);
CCL_NAMESPACE_END
#endif /* __SCENE_H__ */

View File

@@ -624,16 +624,15 @@ void ShaderManager::add_default(Scene *scene)
{
ShaderGraph *graph = new ShaderGraph();
DiffuseBsdfNode *diffuse = new DiffuseBsdfNode();
DiffuseBsdfNode *diffuse = graph->create_node<DiffuseBsdfNode>();
diffuse->color = make_float3(0.8f, 0.8f, 0.8f);
graph->add(diffuse);
graph->connect(diffuse->output("BSDF"), graph->output()->input("Surface"));
Shader *shader = new Shader();
Shader *shader = scene->create_node<Shader>();
shader->name = "default_surface";
shader->set_graph(graph);
scene->shaders.push_back(shader);
scene->default_surface = shader;
shader->tag_update(scene);
}
@@ -642,15 +641,14 @@ void ShaderManager::add_default(Scene *scene)
{
ShaderGraph *graph = new ShaderGraph();
PrincipledVolumeNode *principled = new PrincipledVolumeNode();
PrincipledVolumeNode *principled = graph->create_node<PrincipledVolumeNode>();
graph->add(principled);
graph->connect(principled->output("Volume"), graph->output()->input("Volume"));
Shader *shader = new Shader();
Shader *shader = scene->create_node<Shader>();
shader->name = "default_volume";
shader->set_graph(graph);
scene->shaders.push_back(shader);
scene->default_volume = shader;
shader->tag_update(scene);
}
@@ -659,17 +657,16 @@ void ShaderManager::add_default(Scene *scene)
{
ShaderGraph *graph = new ShaderGraph();
EmissionNode *emission = new EmissionNode();
EmissionNode *emission = graph->create_node<EmissionNode>();
emission->color = make_float3(0.8f, 0.8f, 0.8f);
emission->strength = 0.0f;
graph->add(emission);
graph->connect(emission->output("Emission"), graph->output()->input("Surface"));
Shader *shader = new Shader();
Shader *shader = scene->create_node<Shader>();
shader->name = "default_light";
shader->set_graph(graph);
scene->shaders.push_back(shader);
scene->default_light = shader;
shader->tag_update(scene);
}
@@ -678,10 +675,9 @@ void ShaderManager::add_default(Scene *scene)
{
ShaderGraph *graph = new ShaderGraph();
Shader *shader = new Shader();
Shader *shader = scene->create_node<Shader>();
shader->name = "default_background";
shader->set_graph(graph);
scene->shaders.push_back(shader);
scene->default_background = shader;
shader->tag_update(scene);
}
@@ -690,10 +686,9 @@ void ShaderManager::add_default(Scene *scene)
{
ShaderGraph *graph = new ShaderGraph();
Shader *shader = new Shader();
Shader *shader = scene->create_node<Shader>();
shader->name = "default_empty";
shader->set_graph(graph);
scene->shaders.push_back(shader);
scene->default_empty = shader;
shader->tag_update(scene);
}

View File

@@ -202,7 +202,8 @@ extern GHOST_WindowHandle GHOST_CreateDialogWindow(GHOST_SystemHandle systemhand
* \param platform_support_callback An optional callback to check platform support
* \return A handle to the new context ( == NULL if creation failed).
*/
extern GHOST_ContextHandle GHOST_CreateOpenGLContext(GHOST_SystemHandle systemhandle);
extern GHOST_ContextHandle GHOST_CreateOpenGLContext(GHOST_SystemHandle systemhandle,
GHOST_GLSettings glSettings);
/**
* Dispose of a context.

View File

@@ -265,7 +265,7 @@ class GHOST_ISystem {
* Never explicitly delete the context, use disposeContext() instead.
* \return The new context (or 0 if creation failed).
*/
virtual GHOST_IContext *createOffscreenContext() = 0;
virtual GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings) = 0;
/**
* Dispose of a context.

View File

@@ -135,11 +135,12 @@ void GHOST_GetAllDisplayDimensions(GHOST_SystemHandle systemhandle,
system->getAllDisplayDimensions(*width, *height);
}
GHOST_ContextHandle GHOST_CreateOpenGLContext(GHOST_SystemHandle systemhandle)
GHOST_ContextHandle GHOST_CreateOpenGLContext(GHOST_SystemHandle systemhandle,
GHOST_GLSettings glSettings)
{
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
return (GHOST_ContextHandle)system->createOffscreenContext();
return (GHOST_ContextHandle)system->createOffscreenContext(glSettings);
}
GHOST_TSuccess GHOST_DisposeOpenGLContext(GHOST_SystemHandle systemhandle,

View File

@@ -115,7 +115,7 @@ class GHOST_System : public GHOST_ISystem {
* Never explicitly delete the context, use disposeContext() instead.
* \return The new context (or 0 if creation failed).
*/
virtual GHOST_IContext *createOffscreenContext() = 0;
virtual GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings) = 0;
/**
* Returns whether a window is valid.

View File

@@ -116,7 +116,7 @@ class GHOST_SystemCocoa : public GHOST_System {
* Never explicitly delete the context, use disposeContext() instead.
* \return The new context (or 0 if creation failed).
*/
GHOST_IContext *createOffscreenContext();
GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings);
/**
* Dispose of a context.

View File

@@ -765,7 +765,7 @@ GHOST_IWindow *GHOST_SystemCocoa::createWindow(const char *title,
* Never explicitly delete the context, use #disposeContext() instead.
* \return The new context (or 0 if creation failed).
*/
GHOST_IContext *GHOST_SystemCocoa::createOffscreenContext()
GHOST_IContext *GHOST_SystemCocoa::createOffscreenContext(GHOST_GLSettings glSettings)
{
GHOST_Context *context = new GHOST_ContextCGL(false, NULL, NULL, NULL);
if (context->initializeDrawingContext())

View File

@@ -81,7 +81,7 @@ class GHOST_SystemNULL : public GHOST_System {
void getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const
{ /* nop */
}
GHOST_IContext *createOffscreenContext()
GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings)
{
return NULL;
}

View File

@@ -139,7 +139,7 @@ GHOST_TUns8 GHOST_SystemSDL::getNumDisplays() const
return SDL_GetNumVideoDisplays();
}
GHOST_IContext *GHOST_SystemSDL::createOffscreenContext()
GHOST_IContext *GHOST_SystemSDL::createOffscreenContext(GHOST_GLSettings glSettings)
{
GHOST_Context *context = new GHOST_ContextSDL(0,
NULL,

View File

@@ -72,7 +72,7 @@ class GHOST_SystemSDL : public GHOST_System {
void getMainDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const;
GHOST_IContext *createOffscreenContext();
GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings);
GHOST_TSuccess disposeContext(GHOST_IContext *context);

View File

@@ -1481,7 +1481,7 @@ void GHOST_SystemWayland::getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUn
getMainDisplayDimensions(width, height);
}
GHOST_IContext *GHOST_SystemWayland::createOffscreenContext()
GHOST_IContext *GHOST_SystemWayland::createOffscreenContext(GHOST_GLSettings glSettings)
{
/* Create new off-screen window. */
wl_surface *os_surface = wl_compositor_create_surface(compositor());

View File

@@ -62,7 +62,7 @@ class GHOST_SystemWayland : public GHOST_System {
void getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const override;
GHOST_IContext *createOffscreenContext() override;
GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings) override;
GHOST_TSuccess disposeContext(GHOST_IContext *context) override;

View File

@@ -328,9 +328,9 @@ GHOST_IWindow *GHOST_SystemWin32::createWindow(const char *title,
* Never explicitly delete the window, use #disposeContext() instead.
* \return The new context (or 0 if creation failed).
*/
GHOST_IContext *GHOST_SystemWin32::createOffscreenContext()
GHOST_IContext *GHOST_SystemWin32::createOffscreenContext(GHOST_GLSettings glSettings)
{
bool debug_context = false; /* TODO: inform as a parameter */
const bool debug_context = (glSettings.flags & GHOST_glDebugContext) != 0;
GHOST_Context *context;

View File

@@ -142,7 +142,7 @@ class GHOST_SystemWin32 : public GHOST_System {
* Never explicitly delete the window, use disposeContext() instead.
* \return The new context (or 0 if creation failed).
*/
GHOST_IContext *createOffscreenContext();
GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings);
/**
* Dispose of a context.

View File

@@ -394,7 +394,7 @@ GHOST_IWindow *GHOST_SystemX11::createWindow(const char *title,
* Never explicitly delete the context, use disposeContext() instead.
* \return The new context (or 0 if creation failed).
*/
GHOST_IContext *GHOST_SystemX11::createOffscreenContext()
GHOST_IContext *GHOST_SystemX11::createOffscreenContext(GHOST_GLSettings glSettings)
{
// During development:
// try 4.x compatibility profile
@@ -406,6 +406,8 @@ GHOST_IContext *GHOST_SystemX11::createOffscreenContext()
// try 3.3 core profile
// no fallbacks
const bool debug_context = (glSettings.flags & GHOST_glDebugContext) != 0;
#if defined(WITH_GL_PROFILE_CORE)
{
const char *version_major = (char *)glewGetString(GLEW_VERSION_MAJOR);
@@ -446,7 +448,7 @@ GHOST_IContext *GHOST_SystemX11::createOffscreenContext()
4,
minor,
GHOST_OPENGL_EGL_CONTEXT_FLAGS |
(false ? EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR : 0),
(debug_context ? EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR : 0),
GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY,
EGL_OPENGL_API);
#else
@@ -458,7 +460,7 @@ GHOST_IContext *GHOST_SystemX11::createOffscreenContext()
4,
minor,
GHOST_OPENGL_GLX_CONTEXT_FLAGS |
(false ? GLX_CONTEXT_DEBUG_BIT_ARB : 0),
(debug_context ? GLX_CONTEXT_DEBUG_BIT_ARB : 0),
GHOST_OPENGL_GLX_RESET_NOTIFICATION_STRATEGY);
#endif
@@ -476,7 +478,7 @@ GHOST_IContext *GHOST_SystemX11::createOffscreenContext()
3,
3,
GHOST_OPENGL_EGL_CONTEXT_FLAGS |
(false ? EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR : 0),
(debug_context ? EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR : 0),
GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY,
EGL_OPENGL_API);
#else
@@ -488,7 +490,7 @@ GHOST_IContext *GHOST_SystemX11::createOffscreenContext()
3,
3,
GHOST_OPENGL_GLX_CONTEXT_FLAGS |
(false ? GLX_CONTEXT_DEBUG_BIT_ARB : 0),
(debug_context ? GLX_CONTEXT_DEBUG_BIT_ARB : 0),
GHOST_OPENGL_GLX_RESET_NOTIFICATION_STRATEGY);
#endif

View File

@@ -153,7 +153,7 @@ class GHOST_SystemX11 : public GHOST_System {
* Never explicitly delete the context, use disposeContext() instead.
* \return The new context (or 0 if creation failed).
*/
GHOST_IContext *createOffscreenContext();
GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings);
/**
* Dispose of a context.

View File

@@ -415,7 +415,7 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(GHOST_SystemCocoa *systemCocoa,
[parentWindow->getCocoaWindow() addChildWindow:m_window ordered:NSWindowAbove];
[m_window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenAuxiliary];
}
else if (state != GHOST_kWindowStateFullScreen) {
else {
[m_window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
}

View File

@@ -215,6 +215,11 @@ extern const char *(*MEM_name_ptr)(void *vmemh);
* about memory leaks will be printed on exit. */
void MEM_init_memleak_detection(void);
/** When this has been called and memory leaks have been detected, the process will have an exit
* code that indicates failure. This can be used for when checking for memory leaks with automated
* tests. */
void MEM_enable_fail_on_memleak(void);
/* Switch allocator to slower but fully guarded mode. */
void MEM_use_guarded_allocator(void);

View File

@@ -18,6 +18,8 @@
* \ingroup MEM
*/
#include <cstdlib>
#include "MEM_guardedalloc.h"
#include "mallocn_intern.h"
@@ -28,6 +30,9 @@ char free_after_leak_detection_message[] =
"error, use the 'construct on first use' idiom.";
namespace {
bool fail_on_memleak = false;
class MemLeakPrinter {
public:
~MemLeakPrinter()
@@ -42,6 +47,15 @@ class MemLeakPrinter {
leaked_blocks,
(double)mem_in_use / 1024 / 1024);
MEM_printmemlist();
if (fail_on_memleak) {
/* There are many other ways to change the exit code to failure here:
* - Make the destructor noexcept(false) and throw an exception.
* - Call exit(EXIT_FAILURE).
* - Call terminate().
*/
abort();
}
}
};
} // namespace
@@ -59,3 +73,8 @@ void MEM_init_memleak_detection(void)
*/
static MemLeakPrinter printer;
}
void MEM_enable_fail_on_memleak(void)
{
fail_on_memleak = true;
}

View File

@@ -1086,15 +1086,19 @@ string MANTA::parseScript(const string &setup_string, FluidModifierData *fmd)
}
/* Dirty hack: Needed to format paths from python code that is run via PyRun_SimpleString */
static string escapeSlashes(string const &s)
static string escapePath(string const &s)
{
string result = "";
for (string::const_iterator i = s.begin(), end = s.end(); i != end; ++i) {
unsigned char c = *i;
if (c == '\\')
for (char c : s) {
if (c == '\\') {
result += "\\\\";
else
}
else if (c == '\'') {
result += "\\\'";
}
else {
result += c;
}
}
return result;
}
@@ -1155,13 +1159,13 @@ bool MANTA::writeData(FluidModifierData *fmd, int framenr)
if (mUsingSmoke) {
ss.str("");
ss << "smoke_save_data_" << mCurrentID << "('" << escapeSlashes(directory) << "', " << framenr
ss << "smoke_save_data_" << mCurrentID << "('" << escapePath(directory) << "', " << framenr
<< ", '" << volume_format << "', " << resumable_cache << ")";
pythonCommands.push_back(ss.str());
}
if (mUsingLiquid) {
ss.str("");
ss << "liquid_save_data_" << mCurrentID << "('" << escapeSlashes(directory) << "', " << framenr
ss << "liquid_save_data_" << mCurrentID << "('" << escapePath(directory) << "', " << framenr
<< ", '" << volume_format << "', " << resumable_cache << ")";
pythonCommands.push_back(ss.str());
}
@@ -1183,7 +1187,7 @@ bool MANTA::writeNoise(FluidModifierData *fmd, int framenr)
if (mUsingSmoke && mUsingNoise) {
ss.str("");
ss << "smoke_save_noise_" << mCurrentID << "('" << escapeSlashes(directory) << "', " << framenr
ss << "smoke_save_noise_" << mCurrentID << "('" << escapePath(directory) << "', " << framenr
<< ", '" << volume_format << "', " << resumable_cache << ")";
pythonCommands.push_back(ss.str());
}
@@ -1256,7 +1260,7 @@ bool MANTA::readData(FluidModifierData *fmd, int framenr, bool resumable)
if (mUsingSmoke) {
ss.str("");
ss << "smoke_load_data_" << mCurrentID << "('" << escapeSlashes(directory) << "', " << framenr
ss << "smoke_load_data_" << mCurrentID << "('" << escapePath(directory) << "', " << framenr
<< ", '" << volume_format << "', " << resumable_cache << ")";
pythonCommands.push_back(ss.str());
result &= runPythonString(pythonCommands);
@@ -1264,7 +1268,7 @@ bool MANTA::readData(FluidModifierData *fmd, int framenr, bool resumable)
}
if (mUsingLiquid) {
ss.str("");
ss << "liquid_load_data_" << mCurrentID << "('" << escapeSlashes(directory) << "', " << framenr
ss << "liquid_load_data_" << mCurrentID << "('" << escapePath(directory) << "', " << framenr
<< ", '" << volume_format << "', " << resumable_cache << ")";
pythonCommands.push_back(ss.str());
result &= runPythonString(pythonCommands);
@@ -1298,7 +1302,7 @@ bool MANTA::readNoise(FluidModifierData *fmd, int framenr, bool resumable)
return false;
ss.str("");
ss << "smoke_load_noise_" << mCurrentID << "('" << escapeSlashes(directory) << "', " << framenr
ss << "smoke_load_noise_" << mCurrentID << "('" << escapePath(directory) << "', " << framenr
<< ", '" << volume_format << "', " << resumable_cache << ")";
pythonCommands.push_back(ss.str());
@@ -1326,14 +1330,14 @@ bool MANTA::readMesh(FluidModifierData *fmd, int framenr)
return false;
ss.str("");
ss << "liquid_load_mesh_" << mCurrentID << "('" << escapeSlashes(directory) << "', " << framenr
ss << "liquid_load_mesh_" << mCurrentID << "('" << escapePath(directory) << "', " << framenr
<< ", '" << mesh_format << "')";
pythonCommands.push_back(ss.str());
if (mUsingMVel) {
ss.str("");
ss << "liquid_load_meshvel_" << mCurrentID << "('" << escapeSlashes(directory) << "', "
<< framenr << ", '" << volume_format << "')";
ss << "liquid_load_meshvel_" << mCurrentID << "('" << escapePath(directory) << "', " << framenr
<< ", '" << volume_format << "')";
pythonCommands.push_back(ss.str());
}
@@ -1367,8 +1371,8 @@ bool MANTA::readParticles(FluidModifierData *fmd, int framenr, bool resumable)
return false;
ss.str("");
ss << "liquid_load_particles_" << mCurrentID << "('" << escapeSlashes(directory) << "', "
<< framenr << ", '" << volume_format << "', " << resumable_cache << ")";
ss << "liquid_load_particles_" << mCurrentID << "('" << escapePath(directory) << "', " << framenr
<< ", '" << volume_format << "', " << resumable_cache << ")";
pythonCommands.push_back(ss.str());
return (mParticlesFromFile = runPythonString(pythonCommands));
@@ -1399,13 +1403,13 @@ bool MANTA::readGuiding(FluidModifierData *fmd, int framenr, bool sourceDomain)
if (sourceDomain) {
ss.str("");
ss << "fluid_load_vel_" << mCurrentID << "('" << escapeSlashes(directory) << "', " << framenr
ss << "fluid_load_vel_" << mCurrentID << "('" << escapePath(directory) << "', " << framenr
<< ", '" << volume_format << "')";
}
else {
ss.str("");
ss << "fluid_load_guiding_" << mCurrentID << "('" << escapeSlashes(directory) << "', "
<< framenr << ", '" << volume_format << "')";
ss << "fluid_load_guiding_" << mCurrentID << "('" << escapePath(directory) << "', " << framenr
<< ", '" << volume_format << "')";
}
pythonCommands.push_back(ss.str());
@@ -1439,7 +1443,7 @@ bool MANTA::bakeData(FluidModifierData *fmd, int framenr)
BLI_path_make_safe(cacheDirGuiding);
ss.str("");
ss << "bake_fluid_data_" << mCurrentID << "('" << escapeSlashes(cacheDirData) << "', " << framenr
ss << "bake_fluid_data_" << mCurrentID << "('" << escapePath(cacheDirData) << "', " << framenr
<< ", '" << volume_format << "')";
pythonCommands.push_back(ss.str());
@@ -1465,7 +1469,7 @@ bool MANTA::bakeNoise(FluidModifierData *fmd, int framenr)
BLI_path_make_safe(cacheDirNoise);
ss.str("");
ss << "bake_noise_" << mCurrentID << "('" << escapeSlashes(cacheDirNoise) << "', " << framenr
ss << "bake_noise_" << mCurrentID << "('" << escapePath(cacheDirNoise) << "', " << framenr
<< ", '" << volume_format << "')";
pythonCommands.push_back(ss.str());
@@ -1492,8 +1496,8 @@ bool MANTA::bakeMesh(FluidModifierData *fmd, int framenr)
BLI_path_make_safe(cacheDirMesh);
ss.str("");
ss << "bake_mesh_" << mCurrentID << "('" << escapeSlashes(cacheDirMesh) << "', " << framenr
<< ", '" << volume_format << "', '" << mesh_format << "')";
ss << "bake_mesh_" << mCurrentID << "('" << escapePath(cacheDirMesh) << "', " << framenr << ", '"
<< volume_format << "', '" << mesh_format << "')";
pythonCommands.push_back(ss.str());
return runPythonString(pythonCommands);
@@ -1522,7 +1526,7 @@ bool MANTA::bakeParticles(FluidModifierData *fmd, int framenr)
BLI_path_make_safe(cacheDirParticles);
ss.str("");
ss << "bake_particles_" << mCurrentID << "('" << escapeSlashes(cacheDirParticles) << "', "
ss << "bake_particles_" << mCurrentID << "('" << escapePath(cacheDirParticles) << "', "
<< framenr << ", '" << volume_format << "', " << resumable_cache << ")";
pythonCommands.push_back(ss.str());
@@ -1552,7 +1556,7 @@ bool MANTA::bakeGuiding(FluidModifierData *fmd, int framenr)
BLI_path_make_safe(cacheDirGuiding);
ss.str("");
ss << "bake_guiding_" << mCurrentID << "('" << escapeSlashes(cacheDirGuiding) << "', " << framenr
ss << "bake_guiding_" << mCurrentID << "('" << escapePath(cacheDirGuiding) << "', " << framenr
<< ", '" << volume_format << "', " << resumable_cache << ")";
pythonCommands.push_back(ss.str());

View File

@@ -456,7 +456,7 @@ int manta_smoke_ensure_fire(MANTA *smoke, struct FluidModifierData *fmd)
if (!smoke || !fmd)
return 0;
int result = smoke->initFire(fmd);
bool result = smoke->initFire(fmd);
if (smoke->usingNoise()) {
result &= smoke->initFireHigh(fmd);
}
@@ -468,7 +468,7 @@ int manta_smoke_ensure_colors(MANTA *smoke, struct FluidModifierData *fmd)
if (!smoke || !fmd)
return 0;
int result = smoke->initColors(fmd);
bool result = smoke->initColors(fmd);
if (smoke->usingNoise()) {
result &= smoke->initColorsHigh(fmd);
}

View File

@@ -96,7 +96,7 @@
#elif defined(__QNXNTO__)
# define OS_QNX 1
#elif defined(__asmjs__) || defined(__wasm__)
# define OS_ASMJS
# define OS_ASMJS 1
#else
# error Please add support for your platform in build_config.h
#endif

View File

@@ -47,6 +47,7 @@
#include "GPU_immediate.h"
#include "GPU_shader.h"
#include "GPU_uniform_buffer.h"
using namespace OCIO_NAMESPACE;
@@ -119,8 +120,8 @@ struct OCIO_GLSLLut3d {
struct OCIO_GLSLCurveMappping {
/** Cache IDs */
size_t cacheId;
/** OpenGL Uniform Buffer handle. 0 if not allocated. */
GLuint buffer;
/** GPU Uniform Buffer handle. 0 if not allocated. */
GPUUniformBuf *buffer;
/** OpenGL Texture handles. 0 if not allocated. */
GLuint texture;
/** Error checking. */
@@ -370,10 +371,7 @@ static void ensureGLSLCurveMapping(OCIO_GLSLCurveMappping **curvemap_ptr,
allocateCurveMappingTexture(curvemap, curve_mapping_settings);
/* Uniform buffer object. */
glGenBuffers(1, &curvemap->buffer);
glBindBuffer(GL_UNIFORM_BUFFER, curvemap->buffer);
glBufferData(GL_UNIFORM_BUFFER, sizeof(OCIO_GLSLCurveMappingParameters), 0, GL_DYNAMIC_DRAW);
glBindBuffer(GL_UNIFORM_BUFFER, 0);
curvemap->buffer = GPU_uniformbuf_create(sizeof(OCIO_GLSLCurveMappingParameters));
curvemap->valid = (curvemap->texture != 0);
curvemap->cacheId = 0;
@@ -384,7 +382,7 @@ static void ensureGLSLCurveMapping(OCIO_GLSLCurveMappping **curvemap_ptr,
static void freeGLSLCurveMapping(OCIO_GLSLCurveMappping *curvemap)
{
glDeleteTextures(1, &curvemap->texture);
glDeleteBuffers(1, &curvemap->buffer);
GPU_uniformbuf_free(curvemap->buffer);
OBJECT_GUARDED_DELETE(curvemap, OCIO_GLSLCurveMappping);
}
@@ -438,9 +436,7 @@ static void updateGLSLCurveMapping(OCIO_GLSLCurveMappping *curvemap,
data.curve_mapping_lut_size = curve_mapping_settings->lut_size;
data.curve_mapping_use_extend_extrapolate = curve_mapping_settings->use_extend_extrapolate;
glBindBuffer(GL_UNIFORM_BUFFER, curvemap->buffer);
glBufferSubData(GL_UNIFORM_BUFFER, 0, sizeof(OCIO_GLSLCurveMappingParameters), &data);
glBindBuffer(GL_UNIFORM_BUFFER, 0);
GPU_uniformbuf_update(curvemap->buffer, &data);
curvemap->cacheId = cacheId;
}
@@ -597,7 +593,7 @@ bool OCIOImpl::setupGLSLDraw(OCIO_GLSLDrawState **state_r,
glActiveTexture(GL_TEXTURE0);
/* Bind UBO. */
glBindBufferBase(GL_UNIFORM_BUFFER, shader->ubo_bind, shader_curvemap->buffer);
GPU_uniformbuf_bind(shader_curvemap->buffer, shader->ubo_bind);
/* TODO(fclem) remove remains of IMM. */
immBindShader(shader->shader);

View File

@@ -81,7 +81,7 @@ struct rbRigidBody {
};
struct rbVert {
float x, y, z;
btScalar x, y, z;
};
struct rbTri {
int v0, v1, v2;
@@ -356,8 +356,8 @@ void RB_body_delete(rbRigidBody *object)
/* motion state */
btMotionState *ms = body->getMotionState();
if (ms)
delete ms;
delete ms;
/* collision shape is done elsewhere... */
@@ -399,8 +399,9 @@ float RB_body_get_mass(rbRigidBody *object)
*/
float value = (float)body->getInvMass();
if (value)
if (value) {
value = 1.0f / value;
}
return value;
}
@@ -551,10 +552,12 @@ void RB_body_set_angular_factor(rbRigidBody *object, float x, float y, float z)
void RB_body_set_kinematic_state(rbRigidBody *object, int kinematic)
{
btRigidBody *body = object->body;
if (kinematic)
if (kinematic) {
body->setCollisionFlags(body->getCollisionFlags() | btCollisionObject::CF_KINEMATIC_OBJECT);
else
}
else {
body->setCollisionFlags(body->getCollisionFlags() & ~btCollisionObject::CF_KINEMATIC_OBJECT);
}
}
/* ............ */
@@ -562,10 +565,12 @@ void RB_body_set_kinematic_state(rbRigidBody *object, int kinematic)
void RB_body_set_activation_state(rbRigidBody *object, int use_deactivation)
{
btRigidBody *body = object->body;
if (use_deactivation)
if (use_deactivation) {
body->forceActivationState(ACTIVE_TAG);
else
}
else {
body->setActivationState(DISABLE_DEACTIVATION);
}
}
void RB_body_activate(rbRigidBody *object)
{
@@ -621,8 +626,9 @@ void RB_body_set_scale(rbRigidBody *object, const float scale[3])
cshape->setLocalScaling(btVector3(scale[0], scale[1], scale[2]));
/* GIimpact shapes have to be updated to take scaling into account */
if (cshape->getShapeType() == GIMPACT_SHAPE_PROXYTYPE)
if (cshape->getShapeType() == GIMPACT_SHAPE_PROXYTYPE) {
((btGImpactMeshShape *)cshape)->updateBound();
}
}
}
@@ -778,7 +784,7 @@ void RB_trimesh_finish(rbMeshData *mesh)
(int *)mesh->triangles,
sizeof(rbTri),
mesh->num_vertices,
(float *)mesh->vertices,
(btScalar *)mesh->vertices,
sizeof(rbVert));
}
@@ -805,8 +811,9 @@ void RB_shape_trimesh_update(rbCollisionShape *shape,
float min[3],
float max[3])
{
if (shape->mesh == NULL || num_verts != shape->mesh->num_vertices)
if (shape->mesh == NULL || num_verts != shape->mesh->num_vertices) {
return;
}
for (int i = 0; i < num_verts; i++) {
float *vert = (float *)(((char *)vertices + i * vert_stride));
@@ -882,11 +889,12 @@ void RB_shape_delete(rbCollisionShape *shape)
if (shape->cshape->getShapeType() == SCALED_TRIANGLE_MESH_SHAPE_PROXYTYPE) {
btBvhTriangleMeshShape *child_shape =
((btScaledBvhTriangleMeshShape *)shape->cshape)->getChildShape();
if (child_shape)
delete child_shape;
delete child_shape;
}
if (shape->mesh)
if (shape->mesh) {
RB_trimesh_data_delete(shape->mesh);
}
delete shape->cshape;
/* Delete compound child shapes if there are any */

View File

@@ -238,11 +238,11 @@ const bTheme U_theme_default = {
.menu_shadow_fac = 0.3f,
.menu_shadow_width = 4,
.editor_outline = RGBA(0x1f1f1fff),
.icon_alpha = 1.0f,
.icon_saturation = 0.5f,
.transparent_checker_primary = RGBA(0x333333ff),
.transparent_checker_secondary = RGBA(0x262626ff),
.transparent_checker_size = 8,
.icon_alpha = 1.0f,
.icon_saturation = 0.5f,
.widget_text_cursor = RGBA(0x3399e6ff),
.xaxis = RGBA(0xff3352ff),
.yaxis = RGBA(0x8bdc00ff),
@@ -250,9 +250,9 @@ const bTheme U_theme_default = {
.gizmo_hi = RGBA(0xffffffff),
.gizmo_primary = RGBA(0xf5f14dff),
.gizmo_secondary = RGBA(0x63ffffff),
.gizmo_view_align = RGBA(0xffffffff),
.gizmo_a = RGBA(0x4da84dff),
.gizmo_b = RGBA(0xa33535ff),
.gizmo_view_align = RGBA(0xffffffff),
.icon_scene = RGBA(0xe6e6e6ff),
.icon_collection = RGBA(0xf4f4f4ff),
.icon_object = RGBA(0xee9e5dff),
@@ -379,7 +379,7 @@ const bTheme U_theme_default = {
.paint_curve_handle = RGBA(0x7fff7f7f),
},
.space_file = {
.back = RGBA(0x33333300),
.back = RGBA(0x28282800),
.title = RGBA(0xffffffff),
.text = RGBA(0xe6e6e6ff),
.text_hi = RGBA(0xffffffff),
@@ -404,6 +404,7 @@ const bTheme U_theme_default = {
.vertex_size = 3,
.outline_width = 1,
.facedot_size = 4,
.row_alternate = RGBA(0xffffff07),
},
.space_graph = {
.back = RGBA(0x42424200),
@@ -437,6 +438,7 @@ const bTheme U_theme_default = {
.group_active = RGBA(0x368024ff),
.vertex = RGBA(0x000000ff),
.vertex_select = RGBA(0xff8500ff),
.vertex_active = RGBA(0xffffffff),
.cframe = RGBA(0x5680c2ff),
.time_scrub_background = RGBA(0x292929e6),
.time_marker_line = RGBA(0x00000060),
@@ -710,7 +712,6 @@ const bTheme U_theme_default = {
.preview_stitch_unstitchable = RGBA(0xff0000ff),
.preview_stitch_active = RGBA(0xe1d2c323),
.uv_shadow = RGBA(0x707070ff),
.uv_others = RGBA(0x606060ff),
.paint_curve_pivot = RGBA(0xff7f7f7f),
.paint_curve_handle = RGBA(0x7fff7f7f),
.metadatatext = RGBA(0xffffffff),

View File

@@ -40,6 +40,31 @@
</screenshot>
</screenshots>
<releases>
<release version="2.90" date="2020-08-31">
<description>
<p>New features:</p>
<ul>
<li>Nishita sky texture for Cycles</li>
<li>EEVEE motion blur</li>
<li>Cloth filter</li>
<li>Ocean modifier spray</li>
<li>Correct face attributes modeling</li>
<li>OpenVDB fluid integration with mantaflow</li>
<li>Nuke lens distortion model for motion tracking</li>
</ul>
<p>Enhancements:</p>
<ul>
<li>Intel Embree for faster motion blur in Cycles</li>
<li>Viewport Intel OpenImageDenoise</li>
<li>Shadow terminator offset setting</li>
<li>NVLink support for CUDA and Optix</li>
<li>Multires unsubdivide, rebuild and modes</li>
<li>Pose brush transformations</li>
<li>Correct face attributes modeling</li>
<li>User interface improvements: new search, modifiers, headings, stats</li>
</ul>
</description>
</release>
<release version="2.83" date="2020-06-03">
<description>
<p>New features:</p>

View File

@@ -27,6 +27,7 @@ op_poll = ops_module.poll
op_call = ops_module.call
op_as_string = ops_module.as_string
op_get_rna_type = ops_module.get_rna_type
op_get_bl_options = ops_module.get_bl_options
class BPyOps:
@@ -209,6 +210,10 @@ class BPyOpsSubModOp:
"""Internal function for introspection"""
return op_get_rna_type(self.idname())
@property
def bl_options(self):
return op_get_bl_options(self.idname())
def __repr__(self): # useful display, repr(op)
# import bpy
return op_as_string(self.idname())

View File

@@ -534,13 +534,14 @@
</graph_editor>
<file_browser>
<ThemeFileBrowser
row_alternate="#ffffff0f"
selected_file="#5680c2"
>
<space>
<ThemeSpaceGeneric
back="#404040"
back="#999999"
title="#000000"
text="#eeeeee"
text="#000000"
text_hi="#ffffff"
header="#adadadff"
header_text="#000000"
@@ -735,7 +736,6 @@
preview_stitch_unstitchable="#ff0000ff"
preview_stitch_active="#e1d2c323"
uv_shadow="#707070ff"
uv_others="#606060ff"
frame_current="#5680c2"
metadatabg="#000000"
metadatatext="#ffffff"

View File

@@ -4952,6 +4952,7 @@ def km_transform_modal_map(_params):
("CONFIRM", {"type": 'LEFTMOUSE', "value": 'PRESS', "any": True}, None),
("CONFIRM", {"type": 'RET', "value": 'PRESS', "any": True}, None),
("CONFIRM", {"type": 'NUMPAD_ENTER', "value": 'PRESS', "any": True}, None),
("CONFIRM", {"type": 'SPACE', "value": 'PRESS', "any": True}, None),
("CANCEL", {"type": 'RIGHTMOUSE', "value": 'PRESS', "any": True}, None),
("CANCEL", {"type": 'ESC', "value": 'PRESS', "any": True}, None),
("AXIS_X", {"type": 'X', "value": 'PRESS', "repeat": False}, None),
@@ -4970,6 +4971,7 @@ def km_transform_modal_map(_params):
("SNAP_INV_ON", {"type": 'RIGHT_CTRL', "value": 'PRESS', "any": True}, None),
("SNAP_INV_OFF", {"type": 'RIGHT_CTRL', "value": 'RELEASE', "any": True}, None),
("ADD_SNAP", {"type": 'A', "value": 'PRESS', "repeat": False}, None),
("ADD_SNAP", {"type": 'A', "value": 'PRESS', "ctrl": True, "repeat": False}, None),
("REMOVE_SNAP", {"type": 'A', "value": 'PRESS', "alt": True, "repeat": False}, None),
("PROPORTIONAL_SIZE_UP", {"type": 'PAGE_UP', "value": 'PRESS'}, None),
("PROPORTIONAL_SIZE_DOWN", {"type": 'PAGE_DOWN', "value": 'PRESS'}, None),
@@ -4982,11 +4984,17 @@ def km_transform_modal_map(_params):
("PROPORTIONAL_SIZE", {"type": 'TRACKPADPAN', "value": 'ANY'}, None),
("EDGESLIDE_EDGE_NEXT", {"type": 'WHEELDOWNMOUSE', "value": 'PRESS', "alt": True}, None),
("EDGESLIDE_PREV_NEXT", {"type": 'WHEELUPMOUSE', "value": 'PRESS', "alt": True}, None),
("AUTOIK_CHAIN_LEN_UP", {"type": 'PAGE_UP', "value": 'PRESS'}, None),
("AUTOIK_CHAIN_LEN_DOWN", {"type": 'PAGE_DOWN', "value": 'PRESS'}, None),
("AUTOIK_CHAIN_LEN_UP", {"type": 'PAGE_UP', "value": 'PRESS', "shift": True}, None),
("AUTOIK_CHAIN_LEN_DOWN", {"type": 'PAGE_DOWN', "value": 'PRESS', "shift": True}, None),
("AUTOIK_CHAIN_LEN_UP", {"type": 'WHEELDOWNMOUSE', "value": 'PRESS'}, None),
("AUTOIK_CHAIN_LEN_DOWN", {"type": 'WHEELUPMOUSE', "value": 'PRESS'}, None),
("AUTOIK_CHAIN_LEN_UP", {"type": 'WHEELDOWNMOUSE', "value": 'PRESS', "shift": True}, None),
("AUTOIK_CHAIN_LEN_DOWN", {"type": 'WHEELUPMOUSE', "value": 'PRESS', "shift": True}, None),
("INSERTOFS_TOGGLE_DIR", {"type": 'T', "value": 'PRESS', "repeat": False}, None),
("AUTOCONSTRAIN", {"type": 'MIDDLEMOUSE', "value": 'PRESS', "repeat": False}, None),
("AUTOCONSTRAIN", {"type": 'MIDDLEMOUSE', "value": 'PRESS', "repeat": False, "shift": True}, None),
])
return keymap

View File

@@ -3894,6 +3894,7 @@ def km_transform_modal_map(_params):
("CONFIRM", {"type": 'LEFTMOUSE', "value": 'PRESS', "any": True}, None),
("CONFIRM", {"type": 'RET', "value": 'PRESS', "any": True}, None),
("CONFIRM", {"type": 'NUMPAD_ENTER', "value": 'PRESS', "any": True}, None),
("CONFIRM", {"type": 'SPACE', "value": 'PRESS', "any": True}, None),
("CANCEL", {"type": 'RIGHTMOUSE', "value": 'PRESS', "any": True}, None),
("CANCEL", {"type": 'ESC', "value": 'PRESS', "any": True}, None),
("AXIS_X", {"type": 'X', "value": 'PRESS'}, None),
@@ -3912,6 +3913,7 @@ def km_transform_modal_map(_params):
("SNAP_INV_ON", {"type": 'RIGHT_CTRL', "value": 'PRESS', "any": True}, None),
("SNAP_INV_OFF", {"type": 'RIGHT_CTRL', "value": 'RELEASE', "any": True}, None),
("ADD_SNAP", {"type": 'A', "value": 'PRESS'}, None),
("ADD_SNAP", {"type": 'A', "value": 'PRESS', "ctrl": True}, None),
("REMOVE_SNAP", {"type": 'A', "value": 'PRESS', "alt": True}, None),
("PROPORTIONAL_SIZE_UP", {"type": 'PAGE_UP', "value": 'PRESS'}, None),
("PROPORTIONAL_SIZE_DOWN", {"type": 'PAGE_DOWN', "value": 'PRESS'}, None),
@@ -3924,11 +3926,17 @@ def km_transform_modal_map(_params):
("PROPORTIONAL_SIZE", {"type": 'TRACKPADPAN', "value": 'ANY'}, None),
("EDGESLIDE_EDGE_NEXT", {"type": 'WHEELDOWNMOUSE', "value": 'PRESS', "alt": True}, None),
("EDGESLIDE_PREV_NEXT", {"type": 'WHEELUPMOUSE', "value": 'PRESS', "alt": True}, None),
("AUTOIK_CHAIN_LEN_UP", {"type": 'PAGE_UP', "value": 'PRESS'}, None),
("AUTOIK_CHAIN_LEN_DOWN", {"type": 'PAGE_DOWN', "value": 'PRESS'}, None),
("AUTOIK_CHAIN_LEN_UP", {"type": 'PAGE_UP', "value": 'PRESS', "shift": True}, None),
("AUTOIK_CHAIN_LEN_DOWN", {"type": 'PAGE_DOWN', "value": 'PRESS', "shift": True}, None),
("AUTOIK_CHAIN_LEN_UP", {"type": 'WHEELDOWNMOUSE', "value": 'PRESS'}, None),
("AUTOIK_CHAIN_LEN_DOWN", {"type": 'WHEELUPMOUSE', "value": 'PRESS'}, None),
("AUTOIK_CHAIN_LEN_UP", {"type": 'WHEELDOWNMOUSE', "value": 'PRESS', "shift": True}, None),
("AUTOIK_CHAIN_LEN_DOWN", {"type": 'WHEELUPMOUSE', "value": 'PRESS', "shift": True}, None),
("INSERTOFS_TOGGLE_DIR", {"type": 'T', "value": 'PRESS'}, None),
("AUTOCONSTRAIN", {"type": 'MIDDLEMOUSE', "value": 'PRESS'}, None),
("AUTOCONSTRAIN", {"type": 'MIDDLEMOUSE', "value": 'PRESS', "shift": True}, None),
])
return keymap

View File

@@ -151,7 +151,13 @@ class SequencerFadesClear(Operator):
return context.scene and context.scene.sequence_editor and context.scene.sequence_editor.active_strip
def execute(self, context):
fcurves = context.scene.animation_data.action.fcurves
animation_data = context.scene.animation_data
if animation_data is None:
return {'CANCELLED'}
action = animation_data.action
if action is None:
return {'CANCELLED'}
fcurves = action.fcurves
fcurve_map = {
curve.data_path: curve
for curve in fcurves

View File

@@ -1284,18 +1284,11 @@ class WM_OT_properties_edit(Operator):
prop_type_old = type(item[prop_old])
rna_idprop_ui_prop_clear(item, prop_old)
exec_str = "del item[%r]" % prop_old
# print(exec_str)
exec(exec_str)
del item[prop_old]
# Reassign
exec_str = "item[%r] = %s" % (prop, repr(value_eval))
# print(exec_str)
exec(exec_str)
exec_str = "item.property_overridable_library_set('[\"%s\"]', %s)" % (prop, self.is_overridable_library)
exec(exec_str)
item[prop] = value_eval
item.property_overridable_library_set('["%s"]' % prop, self.is_overridable_library)
rna_idprop_ui_prop_update(item, prop)
self._last_prop[:] = [prop]
@@ -1385,8 +1378,9 @@ class WM_OT_properties_edit(Operator):
return {'CANCELLED'}
# retrieve overridable static
exec_str = "item.is_property_overridable_library('[\"%s\"]')" % (self.property)
self.is_overridable_library = bool(eval(exec_str))
is_overridable = item.is_property_overridable_library('["%s"]' % self.property)
self.is_overridable_library = bool(is_overridable)
# default default value
prop_type, is_array = rna_idprop_value_item_type(self.get_value_eval())

View File

@@ -385,6 +385,15 @@ class DATA_PT_camera_display(CameraButtonsPanel, Panel):
col.prop(cam, "show_sensor", text="Sensor")
col.prop(cam, "show_name", text="Name")
col = layout.column(align=False, heading="Passepartout")
col.use_property_decorate = False
row = col.row(align=True)
sub = row.row(align=True)
sub.prop(cam, "show_passepartout", text="")
sub = sub.row(align=True)
sub.active = cam.show_passepartout
sub.prop(cam, "passepartout_alpha", text="")
row.prop_decorator(cam, "passepartout_alpha")
class DATA_PT_camera_display_composition_guides(CameraButtonsPanel, Panel):
bl_label = "Composition Guides"
@@ -414,27 +423,6 @@ class DATA_PT_camera_display_composition_guides(CameraButtonsPanel, Panel):
col.prop(cam, "show_composition_harmony_tri_b", text="Triangle B")
class DATA_PT_camera_display_passepartout(CameraButtonsPanel, Panel):
bl_label = "Passepartout"
bl_parent_id = "DATA_PT_camera_display"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
def draw_header(self, context):
cam = context.camera
self.layout.prop(cam, "show_passepartout", text="")
def draw(self, context):
layout = self.layout
layout.use_property_split = True
cam = context.camera
layout.active = cam.show_passepartout
layout.prop(cam, "passepartout_alpha", text="Opacity", slider=True)
class DATA_PT_camera_safe_areas(CameraButtonsPanel, Panel):
bl_label = "Safe Areas"
bl_options = {'DEFAULT_CLOSED'}
@@ -534,7 +522,6 @@ classes = (
DATA_PT_camera_background_image,
DATA_PT_camera_display,
DATA_PT_camera_display_composition_guides,
DATA_PT_camera_display_passepartout,
DATA_PT_custom_props_camera,
)

View File

@@ -920,9 +920,8 @@ class ShowHideMenu:
layout.operator("%s.hide" % self._operator_name, text="Hide Unselected").unselected = True
# Standard transforms which apply to all cases
# NOTE: this doesn't seem to be able to be used directly
class VIEW3D_MT_transform_base(Menu):
# Standard transforms which apply to all cases (mix-in class, not used directly).
class VIEW3D_MT_transform_base:
bl_label = "Transform"
bl_category = "View"
@@ -949,7 +948,7 @@ class VIEW3D_MT_transform_base(Menu):
# Generic transform menu - geometry types
class VIEW3D_MT_transform(VIEW3D_MT_transform_base):
class VIEW3D_MT_transform(VIEW3D_MT_transform_base, Menu):
def draw(self, context):
# base menu
VIEW3D_MT_transform_base.draw(self, context)
@@ -969,7 +968,7 @@ class VIEW3D_MT_transform(VIEW3D_MT_transform_base):
# Object-specific extensions to Transform menu
class VIEW3D_MT_transform_object(VIEW3D_MT_transform_base):
class VIEW3D_MT_transform_object(VIEW3D_MT_transform_base, Menu):
def draw(self, context):
layout = self.layout
@@ -1001,7 +1000,7 @@ class VIEW3D_MT_transform_object(VIEW3D_MT_transform_base):
# Armature EditMode extensions to Transform menu
class VIEW3D_MT_transform_armature(VIEW3D_MT_transform_base):
class VIEW3D_MT_transform_armature(VIEW3D_MT_transform_base, Menu):
def draw(self, context):
layout = self.layout
@@ -2287,6 +2286,7 @@ class VIEW3D_MT_object(Menu):
layout.separator()
layout.menu("VIEW3D_MT_object_showhide")
layout.menu("VIEW3D_MT_object_cleanup")
layout.separator()
@@ -2726,6 +2726,20 @@ class VIEW3D_MT_object_showhide(Menu):
layout.operator("object.hide_view_set", text="Hide Unselected").unselected = True
class VIEW3D_MT_object_cleanup(Menu):
bl_label = "Clean Up"
def draw(self, _context):
layout = self.layout
layout.operator("object.vertex_group_clean", text="Clean Vertex Group Weights").group_select_mode = 'ALL'
layout.operator("object.vertex_group_limit_total", text="Limit Total Vertex Groups").group_select_mode = 'ALL'
layout.separator()
layout.operator("object.material_slot_remove_unused", text="Remove Unused Material Slots")
class VIEW3D_MT_make_single_user(Menu):
bl_label = "Make Single User"
@@ -6486,7 +6500,7 @@ class VIEW3D_PT_overlay_vertex_paint(Panel):
col = layout.column()
col.active = display_all
col.prop(overlay, "vertex_paint_mode_opacity", text="Opacity")
col.prop(overlay, "vertex_paint_mode_opacity")
col.prop(overlay, "show_paint_wire")
@@ -7384,7 +7398,6 @@ classes = (
VIEW3D_HT_tool_header,
VIEW3D_MT_editor_menus,
VIEW3D_MT_transform,
VIEW3D_MT_transform_base,
VIEW3D_MT_transform_object,
VIEW3D_MT_transform_armature,
VIEW3D_MT_mirror,
@@ -7447,6 +7460,7 @@ classes = (
VIEW3D_MT_object_constraints,
VIEW3D_MT_object_quick_effects,
VIEW3D_MT_object_showhide,
VIEW3D_MT_object_cleanup,
VIEW3D_MT_make_single_user,
VIEW3D_MT_make_links,
VIEW3D_MT_brush_paint_modes,

View File

@@ -478,7 +478,7 @@ texture_node_categories = [
def not_implemented_node(idname):
NodeType = getattr(bpy.types, idname)
name = NodeType.bl_rna.name
label = f"{name} (mockup)"
label = "%s (mockup)" % name
return NodeItem(idname, label=label)
simulation_node_categories = [

View File

@@ -35,6 +35,10 @@ struct LibraryForeachIDData;
struct Main;
struct ReportList;
struct bAction;
struct BlendWriter;
struct BlendDataReader;
struct BlendLibReader;
struct BlendExpander;
/* ************************************* */
/* AnimData API */
@@ -94,6 +98,13 @@ void BKE_animdata_merge_copy(struct Main *bmain,
eAnimData_MergeCopy_Modes action_mode,
bool fix_drivers);
void BKE_animdata_blend_write(struct BlendWriter *writer, struct AnimData *adt);
void BKE_animdata_blend_read_data(struct BlendDataReader *reader, struct AnimData *adt);
void BKE_animdata_blend_read_lib(struct BlendLibReader *reader,
struct ID *id,
struct AnimData *adt);
void BKE_animdata_blend_read_expand(struct BlendExpander *expander, struct AnimData *adt);
#ifdef __cplusplus
}
#endif

View File

@@ -37,6 +37,8 @@ struct BMesh;
struct CustomData;
struct CustomData_MeshMasks;
struct ID;
struct BlendWriter;
struct BlendDataReader;
typedef uint64_t CustomDataMask;
/*a data type large enough to hold 1 element from any customdata layer type*/
@@ -571,6 +573,14 @@ typedef struct CustomDataTransferLayerMap {
void CustomData_data_transfer(const struct MeshPairRemap *me_remap,
const CustomDataTransferLayerMap *laymap);
/* .blend file I/O */
void CustomData_blend_write(struct BlendWriter *writer,
struct CustomData *data,
int count,
CustomDataMask cddata_mask,
struct ID *id);
void CustomData_blend_read(struct BlendDataReader *reader, struct CustomData *data, int count);
#ifdef __cplusplus
}
#endif

View File

@@ -35,6 +35,8 @@ struct MLoop;
struct MPoly;
struct Object;
struct bDeformGroup;
struct BlendWriter;
struct BlendDataReader;
struct bDeformGroup *BKE_object_defgroup_new(struct Object *ob, const char *name);
void BKE_defgroup_copy_list(struct ListBase *lb1, const struct ListBase *lb2);
@@ -162,6 +164,11 @@ void BKE_defvert_extract_vgroup_to_polyweights(struct MDeformVert *dvert,
void BKE_defvert_weight_to_rgb(float r_rgb[3], const float weight);
void BKE_defvert_blend_write(struct BlendWriter *writer, int count, struct MDeformVert *dvlist);
void BKE_defvert_blend_read(struct BlendDataReader *reader,
int count,
struct MDeformVert *mdverts);
#ifdef __cplusplus
}
#endif

View File

@@ -44,6 +44,10 @@ struct PropertyRNA;
struct StructRNA;
struct bAction;
struct bContext;
struct BlendWriter;
struct BlendDataReader;
struct BlendLibReader;
struct BlendExpander;
/* ************** Keyframe Tools ***************** */
@@ -311,6 +315,24 @@ float fcurve_samplingcb_evalcurve(struct FCurve *fcu, void *data, float evaltime
void fcurve_store_samples(
struct FCurve *fcu, void *data, int start, int end, FcuSampleFunc sample_cb);
/* ************* F-Curve .blend file API ******************** */
void BKE_fmodifiers_blend_write(struct BlendWriter *writer, struct ListBase *fmodifiers);
void BKE_fmodifiers_blend_read_data(struct BlendDataReader *reader,
ListBase *fmodifiers,
struct FCurve *curve);
void BKE_fmodifiers_blend_read_lib(struct BlendLibReader *reader,
struct ID *id,
struct ListBase *fmodifiers);
void BKE_fmodifiers_blend_read_expand(struct BlendExpander *expander, struct ListBase *fmodifiers);
void BKE_fcurve_blend_write(struct BlendWriter *writer, struct ListBase *fcurves);
void BKE_fcurve_blend_read_data(struct BlendDataReader *reader, struct ListBase *fcurves);
void BKE_fcurve_blend_read_lib(struct BlendLibReader *reader,
struct ID *id,
struct ListBase *fcurves);
void BKE_fcurve_blend_read_expand(struct BlendExpander *expander, struct ListBase *fcurves);
#ifdef __cplusplus
}
#endif

View File

@@ -71,7 +71,6 @@ typedef struct Global {
* * -1: Disable faster motion paths computation (since 08/2018).
* * 1 - 30: EEVEE debug/stats values (01/2018).
* * 101: Enable UI debug drawing of fullscreen area's corner widget (10/2014).
* * 527: Old mysterious switch in behavior of MeshDeform modifier (before 04/2010).
* * 666: Use quicker batch delete for outliners' delete hierarchy (01/2019).
* * 777: Enable UI node panel's sockets polling (11/2011).
* * 799: Enable some mysterious new depsgraph behavior (05/2015).

View File

@@ -30,6 +30,10 @@ extern "C" {
struct ID;
struct IDProperty;
struct BlendWriter;
struct BlendDataReader;
struct BlendLibReader;
struct BlendExpander;
typedef union IDPropertyTemplate {
int i;
@@ -196,6 +200,14 @@ void IDP_repr_fn(const IDProperty *prop,
void *user_data);
void IDP_print(const struct IDProperty *prop);
void IDP_BlendWrite(struct BlendWriter *writer, const struct IDProperty *prop);
void IDP_BlendReadData_impl(struct BlendDataReader *reader,
IDProperty **prop,
const char *caller_func_id);
#define IDP_BlendDataRead(reader, prop) IDP_BlendReadData_impl(reader, prop, __func__)
void IDP_BlendReadLib(struct BlendLibReader *reader, IDProperty *prop);
void IDP_BlendReadExpand(struct BlendExpander *expander, IDProperty *prop);
#ifdef __cplusplus
}
#endif

Some files were not shown because too many files have changed in this diff Show More