Commit Graph

14669 Commits

Author SHA1 Message Date
Campbell Barton
5a5ae824ce WIP fixes, still need to tidy up more.
* fix from last commit, threaded memarena wasnt used currectly in one case. (crashing blender)
* add a remove doubles and point on line test to face poly clipping function (fixes some cases where buckets are aligned with faces)
2008-12-06 01:21:42 +00:00
Campbell Barton
1159ccfd4d Use MEM_*alloc for some of the main arrays rather then MemArena (was waisting too much memory) 2008-12-05 13:00:14 +00:00
Campbell Barton
a9529ea727 * added uvco_to_wrapped_pxco to get the pixel x/y from a UV that could be outside 0-1 range.
* use 80deg rather then 90 for the "Normal" painting option, since painting faces that are very close to 90d to the view gives some artifacts.
* Brecht modified the Barycentric weights function to use a signed area. so BarycentricWeightsSimplePersp2f and BarycentricWeightsSimple2f these funcs are not needed anymore.

2 bugs with seams fixed
* triangle faces seams were not being filled correctly - causing visible seams
* the pretend 3D location for seam pixels was too close to the face edge - causing some pixels to be occluded by the adjacent face.
2008-12-03 17:36:50 +00:00
Campbell Barton
f8afbdce4f * remove warnings
* style fits with blenders more
* use rctf and rcti and rctf types rather then float[4]
* some loops were confusing, use for loops rather then while or do/while
2008-12-03 16:17:59 +00:00
Campbell Barton
d9950d2fd4 minor changes, (some comments and less warnings) 2008-11-26 23:57:44 +00:00
Campbell Barton
96d3d8426e use const where possible and removed some unneeded args (4.3% speedup) 2008-11-25 03:39:30 +00:00
Campbell Barton
9efb9adac7 minor changes
* less calls to BKE_image_get_ibuf when switching between images
* remove thread debug prints
* use own pixel blending funcs (IMB_blend_color isnt needed in some cases), slightly faster without this.
2008-11-24 22:06:09 +00:00
Campbell Barton
360d9acc0b backface culling wasnt working as it should in perspective view with the "Normal" option enabled. 2008-11-24 07:08:51 +00:00
Campbell Barton
a51f17bc30 painting onto faces was broken when the UV's or faces were flipped, reversing the order that LSCM and many other tools give. 2008-11-24 05:58:00 +00:00
Campbell Barton
5a87cfe4f8 * changed "Normal" falloff to only fade out at more extreme normals
* tooltip was wrong
2008-11-24 03:06:27 +00:00
Campbell Barton
6adeff5778 * brush and airbrush match The Gimp, where the total color applied to a pixel during a stroke is limited by the brush opacity. With the airbrush option enabled it will accumulation over the opacity level (as it did before, irrespective of the settings).
* float buffer support for all painting operation and undo.
* only run brush_sample_tex() for textures brushes.
* redraw the brush outline even when nothing is painted.
2008-11-24 02:13:24 +00:00
Campbell Barton
0cf9844d00 Only paint in the view clipped area when view clip is enabled (space defined by Alt+B). 2008-11-23 17:06:35 +00:00
Campbell Barton
f747629133 maximum polyline between clipped rectangle and triangle was 6, but in some cases 7 points were set. set the maximum size of the polyline at 8 to be safe. 2008-11-22 15:09:16 +00:00
Campbell Barton
923fb888d6 fix for painting onto faces from a side view in perspective mode, they would have jaggie clipping applied that looked bad.
The reason for this was with transforming screenspace points outside the face into UV space and when the bucket bounds was enough outside the face.
For faces viewed side on, this transformation would be applied incorrectly (a bit like trying to apply a projection matrix to a point behind the view), the buckets UV space coords would be incorrect and the wrong pixels would be initialized for that face.

solution is to clip the screenspace face with the bucket before getting the UVs. This should also be a bit faster since the clipped polyline will have a smaller bounding box.
2008-11-22 14:54:49 +00:00
Campbell Barton
bef72facd5 * smudge tool wanst working (forgot to set the precious mouse location)
* VecWeightf and Vec2Weightf didnt have return types defined.
2008-11-21 06:17:26 +00:00
Campbell Barton
ecfeed042d * added option "Normal", same as the vpaint option, gives more natural looking brush strokes.
* faces that were ignored were also not taken into acount when checking UV seams - causng bleed not to work properly in some cases.
* commented early pixel filling loop exit that fails in some cases.
2008-11-21 03:09:48 +00:00
Campbell Barton
5ab1256f5b * use utility function brush_painter_paint that runs the project_paint_op in a callback, (hopefully making tablets work properly)
* removed own interpolation function, use bilinear_interpolation_color instead.
2008-11-19 07:57:25 +00:00
Campbell Barton
e6a4f4cf29 svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r17471:HEAD 2008-11-19 03:43:03 +00:00
Campbell Barton
f8e56e96bf Split up the following imbuf functions in 2...
void bicubic_interpolation(struct ImBuf *in, struct ImBuf *out, float u, float v, int xout, int yout);
void neareast_interpolation(struct ImBuf *in, struct ImBuf *out, float u, float v, int xout, int yout);
void bilinear_interpolation(struct ImBuf *in, struct ImBuf *out, float u, float v, int xout, int yout);

Added...
void bicubic_interpolation_color(struct ImBuf *in, unsigned char *col, float *col_float, float u, float v);
void neareast_interpolation_color(struct ImBuf *in, unsigned char *col, float *col_float, float u, float v);
void bilinear_interpolation_color(struct ImBuf *in, unsigned char *col, float *col_float, float u, float v);

This is needed so for projection painting but generally useful if you want to get the interpolated color of a pixel in an image without having a destination imbuf.

While editing these I noticed the functons are a bit dodgy, they assume the input ImBuf has matching float/chr buffer to the output.
2008-11-19 03:28:07 +00:00
Campbell Barton
a4776347ea bicubic_interpolation - dont use pow(val, 3.0f) at all, do (val*val*val) instead,
Tested overall speedup is about 5x when scaling 4096x4096 -> 4000x4000 in the sequencer.

There were some artifacts in the resulting image but double checked and the old code gives the same problems.
Added back old code with #if 0's since its a bit more readable.
2008-11-19 02:07:23 +00:00
Campbell Barton
5c6fd58a79 Some improvements brecht suggested, only noticable change is faster multithreading
General optimizations
* Precompute 1/x when dividing by x multiple times.
* Use float constants like 0.0f instead of 0.0, avoids conversions from float to doubles and back.

ProjectPixel
* make pixel (and similar pointers elsewhere) a union with a float and unsigned int pointer to reduce the number of casts a little. generally there are a lot of casts going on in the code, makes it hard to read.

project_paint_begin()
* the perspective case checks with (*projScreenCo)[3] > 0.001) for faces behind the view. - Changed to use the clip start from get_view3d_viewplane 
* removed arbitrary check for brush size to disable threads.

imapaint_paint_sub_stroke_project()
* Make clone tool use IMB_blend_color to reduce the code and support blend modes.

imapaint_paint_sub_stroke_project_mt()
* Make threaded and non threaded mode use same function (just dont start threads when its set to 1)
* removed PIL_sleep_ms, was not needed and slowed down threading (my bad!, was copied from bake code).
2008-11-18 13:51:51 +00:00
Campbell Barton
bbc00befe7 some scons command line args were not working since recent changes-
scons CCFLAGS="-O0 -ggdp3" 
for example would pass on the args including the "'s to scons, causing the build to fail.
2008-11-18 05:47:19 +00:00
Campbell Barton
52ab2f5200 Added option to use another UV layer as a clone source, to paint from one uv layer's image and UVs into the active layer. 2008-11-18 03:28:50 +00:00
Campbell Barton
a54dc97c13 * Added buttons for accessing options "occlude", "backface cull" and "bleed", note that bleed is 0.0 by default, before it was always 2.0;
* use a faster method of getting a pixels screenspace location.
* check if its possible to break out of pixel to bucket/face intersection early - ~7% overall speedup (ignoring redraw time).
* removed scanline intersection function (added back incase they were needed but it looks like there not)
* speedup for painting with only 1 image (use a loop without context switching checks)
* more commenting + cleanup
2008-11-18 00:17:13 +00:00
Martin Poirier
826c6d935d QuatOne was so wrong is would make Hamilton cry.
Thankfully, very little code used it, the only exception being the retarget code in etch-a-ton.
2008-11-17 22:13:45 +00:00
Campbell Barton
3a1cfa5015 Added BF_PROFILE_LINKFLAGS, Compiling with BF_PROFILE=1 was also throwing a python error. 2008-11-17 10:43:12 +00:00
Martin Poirier
0bee65b624 Fix compilation on OS X
Patch by dfelinto
2008-11-17 00:54:45 +00:00
Remigiusz Fiedler
3a44c76246 DXF-Importer: updated version v1.12 - 2008.11.16 by migius
- remove try_finally: cause not supported in python <2.5
 - add Bezier curves bevel radius support (default 1.0)
2008-11-16 23:52:29 +00:00
Campbell Barton
a10d4192b5 disabled painting to offscreen buckets, was causing priblems when zooming in on large models. also simplified backface test. 2008-11-16 18:25:15 +00:00
Campbell Barton
a0a7018363 * fix "dot drawing" problem - draw lines inbetween updates when redrawing the view like how existing painting works. (this means slow systems wont have the problems when they would only see dots as they dragged their mouse around)
* bucket resolution is now set from the brush size so there is around 9 buckets under the brush - (previously was fixed to 128x128).
* brush sizes below 40 disable multithreading, since threads only speeds up cases where each bucket has enough pixels in it for each core to spend some time.
* make smear use bicubic pixel lookups so a low Spacing value works as expected.
* smear tool was darkening pixels a tiny bit.
* fix for simple mistake causing ProjectPaintImage arrays not to be thread safe.
2008-11-16 15:26:15 +00:00
Campbell Barton
63d3829144 svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r17443:HEAD 2008-11-15 16:55:37 +00:00
Campbell Barton
db434c3434 * clone tool didnt work when the object was not at the center point.
* added clone button to the paint editbuttons (was only in the image window before)
* ctrl+clicking to set the 3d cursor also sets its depth to the face its over (much more useful when cloning and rotating the view)
* support for painting and cloning for tiled textures (for UV's outside 0-1)
* more consistant veriable names, merged image arrays into a ProjectPaintImage type to be less confusing.
2008-11-15 16:20:37 +00:00
Hamed Zaghaghi
da1738377f 17973Patch by dfelinto, and also fixed a bug in 2d-filters 2008-11-15 12:10:16 +00:00
Campbell Barton
a92969e8f1 made undo on multiple images works 2008-11-15 02:58:47 +00:00
Campbell Barton
1462aa4bc3 tile based undo's now works while projection painting.
TODO - float buffer support & for some reason painting on multiple images at once dosnt restore the tiles to the right image then undoing.
2008-11-14 17:30:55 +00:00
Campbell Barton
7cce946de7 copy over pthread dll to the install dir with cross compiling,
eventually should copy more libs but for now this makes blenderlite work 
- (used for automatic blender builds on graphicall)
2008-11-14 03:21:06 +00:00
Martin Poirier
7401c57fb3 Transform Roll Fixes for editbone. Special case for rotation, we don't need to guess in those case and the result is better if we use the real rotation. 2008-11-14 03:13:40 +00:00
Joshua Leung
fece3f5e97 Bugfix:
Grease Pencil crashed after duplicating a screen-area, and deleting a layer from the original screen-area. The duplication code was not reassigning some pointers.
2008-11-14 02:13:10 +00:00
Campbell Barton
ff0c599c4b update for compiling cross compiling win32 on linux, had a lot of trouble with makesdna, the only way I could build and link was as a
win32 binary.
Still unable to link blender.exe
and run with wine.
2008-11-13 23:12:38 +00:00
Martin Poirier
dc4ef17eea ==Armature==
Fix the roll mess in transform. Since roll is based on an automatically calculated up axis, transforming bones would mess up bone orientation. This code automatically adjusts the roll value to keep bone orientation as consistant as possible. That works all around in transform for all transformations.

Doesn't work with x-axis mirror though as that doesn't use transform elements (fixing it would be nice for later)

Most interesting is that it works with the mirror tool (obviously), so you don't have to fix all the rolls after mirroring one side of an armature.

It could be made an option if someone presents a good enough point for that, but I can't see why you'd want the previous mess instead.

NB: this also ports a utility fonction from etch-a-ton to set bone roll from an up axis.
2008-11-13 22:35:40 +00:00
Martin Poirier
e76f7e7930 Normal Orientation on EditBones uses roll for Z axis. 2008-11-13 21:44:32 +00:00
Campbell Barton
bb6d39687a svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r17405:HEAD 2008-11-13 13:34:43 +00:00
Campbell Barton
1f3e4771b1 simple workaround slowdown with painting onto multiple parts of an image at once, just use a grid of boundboxes per image.
was also running undo calls when it shouldnt,
2008-11-13 13:17:04 +00:00
Campbell Barton
fb4ff9e514 * use the existing function to only update a part of the image, should increase speed a lot, except when painting on seams from opposite parts of the image. - can speed this up with multiple boundboxes - TODO.
* use brush spacing and airbrush settings
* draw a circle while in texture paint mode.
2008-11-13 11:30:34 +00:00
Robin Allen
c838ee9592 Removed support for nested texture trees, minor ui enhancements 2008-11-13 09:57:11 +00:00
Campbell Barton
934b21f5d9 for scons on linux and other *nux systems
only install locale data if international is enabled, only install fonts if freetype is enabled.
2008-11-13 02:18:35 +00:00
Campbell Barton
a35345f8ba 2 utility functions added for projection painting.
* BLI_linklist_index() - to get an items index in a  LinkList
* BLI_memarena_use_malloc() - BLI_memarena_use_calloc alredy existed but there was no way to switch back to malloc.

also added texnodes to cmake
2008-11-12 22:35:58 +00:00
Andrea Weikert
8449f0d776 == MSVC projectfiles ==
update for texture nodes
2008-11-12 21:03:42 +00:00
Andrea Weikert
ae3bb90975 fix bad level call in texture nodes
BIF_preview_changed wasn't needed after all.
2008-11-12 21:02:45 +00:00
Robin Allen
bc53b942fe Added stubs to fix linker errors in texnodes 2008-11-12 20:11:54 +00:00