Commit Graph

238 Commits

Author SHA1 Message Date
faaaf7ee1f Possible NULL de-reference on fullsceen check
Also quiet some other minor warnings
2015-02-03 16:42:22 +11:00
81f97692ae cleanup: style/spelling 2015-02-02 23:29:53 +11:00
91b70d3c56 New operator for copying (hair) particle systems from one object to
another, including edit data (grooming).

This uses basically the same method as the existing connect/disconnect
feature. The main difference is that it allows working with multiple
objects and transferring the //particle/hair data// instead of the
//mesh// data (which is what connect/disconnect expects). This is a much
more realistic workflow when rigging, topology etc. changes and
groomed hair has to be transferred to the changed model.
2015-01-20 09:30:11 +01:00
7740b1671c Pampering the stupid MSVC compiler again, it fails to build valid C code. 2015-01-20 09:30:06 +01:00
4ff68d031d Fix for warnings/errors
Conflicts:
	source/blender/blenkernel/intern/key.c
	source/blender/blenkernel/intern/particle_system.c
	source/blender/makesrna/intern/rna_particle.c
2015-01-20 09:30:05 +01:00
f03fc27bf7 Removed unused line. 2015-01-20 09:30:04 +01:00
c01ed4875b New hair editing feature "Shape Cut", for cutting hair based on a mesh
shape instead of a brush tool.

The brush cutting tool for hair, while useful, is not very accurate and
often requires rotating the model constantly to get the right trimming
on every side. This makes adjustments to a hair shape a very tedious
process.

On the other hand, making proxy meshes for hair shapes is a common
workflow. The new operator allows using such rough meshes as boundaries
for hair. All hairs that are outside the shape mesh are removed, while
those cutting it at some length are shortened accordingly.

The operator can be accessed in the particle edit mode toolbar via the
"Shape Cut" button. The "Shape Object" must be set first and stays
selected as a tool setting for repeatedly applying the shape.
2015-01-20 09:30:04 +01:00
9c97624fc9 Select Random in Particle Edit Mode, by jezv
Added the select random functionality in particle edit mode for hairs or control points.

Reviewers: campbellbarton, lukastoenne

Reviewed By: lukastoenne

Subscribers: campbellbarton, kevindietrich, jezv

Projects: #quick_hacks, #bf_blender, #physics

Maniphest Tasks: T37873

Differential Revision: https://developer.blender.org/D809
2014-10-08 18:10:27 +02:00
3a40aed3d5 Cleanup: use float versions of functions when in/output are floats 2014-09-24 14:55:02 +10:00
259a436197 Fix T40815: Particle birth times not initialized correctly.
In rB78c491e the `initialize_particle` function was split into 2 parts for particle texture initialization.
The texture init part however also initializes birth times, which is now missing in the main init function
in some cases (notably when setting start/end directly without a subsequent time step).
2014-07-02 12:20:51 +02:00
1b76c638ad Code cleanup: remove MAT3/4_UNITY defines, just call unit_m3/4 2014-06-26 16:09:59 +10:00
4ca67869cc Code cleanup: remove unused includes
Opted to keep includes if they are used indirectly (even if removing is possible).
2014-05-01 04:47:51 +10:00
c67bd49e56 Code cleanup: use 'const' for arrays (editors) 2014-04-27 00:25:15 +10:00
617557b08e Code cleanup: remove TRUE/FALSE & WITH_BOOL_COMPAT define 2014-04-01 15:22:28 +11:00
eca6264ab0 Fix T38928 Particle add brush would generate trash on meshes with use_modifier_stack enabled
Issue here is complex (Of course, this is particles!)

First issue is that use_modifier_stack will use the num parameter of the
particles instead of num_dmcache, something the brush code did not
account for at all. Now correctly set DMCACHE_ISCHILD in that case.

Second issue is that make_derived_deform will return a mesh with less
indices than the particle system derived mesh. This would mean that
subsequent sampling of the particle derived mesh to initialize the
particles woould also produce garbage. This was being done for
optimization but in that case it broke the system.

Reviewers: lukastoenne

Differential Revision: https://developer.blender.org/D429
2014-03-27 11:44:23 +02:00
7da2175271 KDTree: deprecate 'normal' argument
Normals for each kdtree node were allocated but never used,
and search args only use in particles/boids code.
2014-03-18 09:14:47 +11:00
2cbbaea44e Fix for particle edit mode using wrong pixel distances.
rB57dba739176153e052d77611ff0e554f05984686 unified pixel distance values
but omitted a factor 100 for particle edit.
2014-03-12 11:54:49 +01:00
57dba73917 View3d: take pixelsize into account for selection distance 2014-03-11 15:34:19 +11:00
519ee151a3 Fix for memory leak in particle brush 2014-03-01 16:25:37 +11:00
b3afbcab8f ListBase API: add utility api funcs for clearing and checking empty 2014-02-08 06:24:05 +11:00
78c491e62a Fix T35247: Particle texture behaves incorrectly after changing the number of particles
Root of the issue goes to the order of particle initialization which does
texture evaluation (which does depend on particle coordinate) and particle
birth coordinate calculation. So basically what happened is:

* Changing number of particles re-allocated all the particles,
  which sets their coordinate to (0,0,0)
* Texture evaluation used this non-initialized coordinate
* Coordinates were calculated for particles

Reshuffled code a bit so now texture evaluation happens after particles.
coordinate calculation. Basically moved texture evaluation to particle
reset function. Reset happens after initialization anyway and it does
know particle coordinates. Also, if reset is being called without init
then it's also kind of logical to re-evaluate texture because particle
coordinates might change.
2014-02-05 23:46:01 +06:00
37026b12ec Code cleanup: use bool for static methods 2014-02-05 22:36:15 +11:00
c78d9a3184 Fix T38233: Right click in Particle Edit mode closes application
It was wrong memory access in selection operators when point doesn't
have keys.
2014-01-16 01:34:08 +06:00
63caaa2b12 Code Cleanup: rename vars for detecting change to be more consistent
rename change/is_change/is_changed/modified -> changed
also use bools over int/short/char and once accidental float.
2013-11-26 06:39:14 +11:00
7267221715 remove return argument from wmOperatorType->cancel, was only ever returning OPERATOR_CANCELLED. 2013-10-30 23:08:53 +00:00
Lukas Toenne
169b4e8118 Fix #36853, Undo not working for Particles Hair - Free Edit.
Resetting the particle system without losing edit undo is not so easy. Just added a confirm message for now to warn user about loss of particle edit undo.
2013-09-30 09:51:25 +00:00
36065ee4f4 use strict flags for kdtree, and replace ints with unsigned ints where possible.
also replace callocs with mallocs since zeroing memory can be avoided.
2013-09-01 20:17:56 +00:00
291ad172a1 follow up on r59628, setting modes now ensures that other modes exit first,
this was only done in some cases before and it was possible to enable weightpaint+sculpt at the same time when enabling sculpt by directly running the mode switching operator.

add generic function to ensure a compatible mode before entering the new mode (added to each operators exec function)
2013-08-29 10:34:09 +00:00
974ec7ddcf fix for particle lasso-select inverting the selection. 2013-07-10 05:01:49 +00:00
34fc990997 fix [#35406] Hair puff brush bug
- puff was interpolating hair that made longer strands cirl up.
- also fixed problem with puff-volume option, it was over-accumulating so unselected parts of the hair would have too much offset applied.
2013-07-10 04:54:14 +00:00
00f0ac8107 Fix #35368:
* Editing number of segments for particle hair did not update the viewport.
* Hidden particles were confusing, the paths were drawn but without the points.
  Now it draws the path faded to indicate that they are hidden/locked.
* Select tips/roots operators now have options to select/deselect/toggle/invert.
2013-05-16 00:07:01 +00:00
36e7a98459 fix [#35007] clipping border error
add clip option to ED_view3d_win_to_ray(), ED_view3d_win_to_segment()
2013-04-22 20:00:37 +00:00
afb4b65167 Random number generator: replace a bunch of usage of the global random number
generator with a local one. It's not thread safe and will not give repeatable
results, so in most cases it should not be used.

Also fixes #34992 where the noise texture of a displacement modifier was not
properly random in opengl animation render, because the seed got reset to a
fixed value by an unrelated function while for final render it changed each
frame.
2013-04-15 23:12:40 +00:00
97a6965da9 fix for various crashes from incorrect poll functions.
- bevel had incorrect cancel when initialization failed which could crash (own mistake).
- main particle poll function didnt check if the area/region were NULL.
- some uv operators needed space image but didnt check for it. also use uv_ prefix for most operator functions.
2013-04-08 10:03:51 +00:00
e8d532f1dd style cleanup 2013-03-31 03:28:46 +00:00
e7c15beaf6 code cleanup: use booleans for mesh and selection code. 2013-03-19 23:17:44 +00:00
2d21e6521f Fix: multisample viewport drawing didn't work well with selection or particle
brushes, due to issues with color coded drawing or slow/buggy reading from such
a buffer on some systems.

In case multisample is enabled now, it uses an offscreen buffer for such drawing,
which is not multisampled and so should not cause issues. This does mean there is
some extra GPU memory usage when multisample is enabled, and we could optimize
triple buffer to work together here somehow to share buffers, but it's better than
having selection not working.
2013-03-15 19:56:33 +00:00
aaa8a13c49 code cleanup: use const events for modal and invoke operators. 2013-03-13 09:03:46 +00:00
abd1748e48 code cleanup: move runtime var zfac out of RegionView3D. rename initgrabz() -> ED_view3d_calc_zfac() and have it return the zfac to use. 2013-03-09 11:40:42 +00:00
e3944f5bfa Divide by 3 instead of multiplying by variations of 0.333
Fixes small precision problems.
2013-02-14 17:35:43 +00:00
69993c5d40 style cleanup: spaces -> tabs 2013-02-04 00:18:09 +00:00
6fca85780b style cleanup: also correct doc example for 'foreach_get/set' 2013-02-02 00:34:34 +00:00
4245a107cf Revert r54058, caused crash when adding paritcles in particle edit mode
MEM_recallocN() doesn't allocate memory when used on a null pointer.

Just revert commit since there is no real benefit to using
MEM_recallocN() in this case.
2013-01-26 12:30:44 +00:00
dccec5727e replace calloc + memcpy with recalloc. 2013-01-24 00:46:51 +00:00
555ae1f4b0 Fix #33896: particle add brush with radius 1 would give duplicated and NaN hairs. 2013-01-23 19:40:52 +00:00
e224996f3d Avoid using python keyword as operator property name 2013-01-21 12:44:40 +00:00
159507dc2c fix for possible null pointer dereference in PE_create_particle_edit 2013-01-20 14:10:10 +00:00
c9b8839237 Bug fix #33647
Particle combing didn't always respond as expected. The combed effect was 
depending on the center of object in view, instead of on the center of 
selected hairs. That made combing in certain close ups impossible.

Same was actually true for transform tools for hairs!

And even worse - there was an optimize break in calculating center
which wasn't true even. Causing centers for transform to fail similar
in other cases.
2012-12-21 17:47:50 +00:00
c27d22ab71 fix own regression in 2.65 [#33643] Rotation does not work at certain zoom level
caused by not projecting points behind the perspective view,
even though this worked in 2.64 the values were flipped (rotating direction was reversed and the center point was flipped).

added V3D_PROJ_TEST_CLIP_NEAR, when omitted ED_view3d_project_*** will project points from behind a perspective view plane.
2012-12-21 03:49:47 +00:00
0990c84f3f Fixes for correct UI scaling display:
- Move to layer (and more popups) didn't scale yet
- User Prefs and render window now open on right location on Mac Retinas
- Brush sizes for painting now scale for Mac Retina
2012-12-14 15:09:59 +00:00