Commit Graph

12589 Commits

Author SHA1 Message Date
Campbell Barton
6d8a2dd9ef * added an option not to use projection painting (use existing 3D paint)
* further tweak limits to get rid of some face clipping problems.
2008-12-06 19:19:54 +00:00
Campbell Barton
d138a6d43c * fixed crash when a mesh with no UVs was painted.
* fixed more bugs in face clipping, clip_line wasnt working when the line was horiz/vertical. unning exactly on the clipping rectangle bounds.
* testing if a point was inside a triangle didnt work if the point was touching the triangles edge, added IsectPT2Df_limit(...) for this rather then using 3 point/line intersection checks.
...Cant find anymore bugs in face clipping now :)
2008-12-06 17:53:08 +00:00
Campbell Barton
2b7098820d * Patch from Michael Fox to set the normal angle (was fixed at 80 before)
* Fixed another face clipping bug (some artifacts still when using screen aligned faces)
* Removed Soften and Warp buttons on the panit panel since they are not used for projection painting
* added do_versions to initialize bleed and normal values
2008-12-06 13:42:55 +00:00
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
Benoit Bolsee
2746034295 BGE bug #17731 fixed: No sleeping Button disables dynamics of an object if it's parented+unparented 2008-12-05 23:13:23 +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
Benoit Bolsee
149d231d69 VideoTexture: new ImageMirror class for easy mirror (and portal) creation
The new class VideoTexture.ImageMirror() is available to perform
automatic mirror rendering.

Constructor:

  VideoTexture.ImageMirror(scene,observer,mirror,material)
    scene:    reference to the scene that will be rendered.
              Both observer and mirror must be part of that scene.
    observer: reference to a game object used as view point for
              mirror rendering: the scene will be rendered through
              the mirror as if the active camera was at the observer 
              location. Usually the observer is the active camera
              but you can use any game obejct.
    mirror:   reference to the mesh object holding the mirror.
    material: material ID of the mirror texture as returned by 
              VideoTexture.materialID(). The mirror is formed by 
              the polygons mapped to that material.

There are no specific methods or attributes. ImageMirror inherits 
all methods and attributes from ImageRender. You must refresh the
parent VideoTexture.Texture object regularly to update the mirror 
rendering.

Guidelines on how to create a working mirror:
- Use a texture that is specific to the mirror so that the mirror 
  rendering only appears on the mirror.
- The mirror must be planar; the algorithm works well only for planar
  or quasi planar mirror. For spherical mirror, you will get better
  results with ImageRender and a camera at the center of the mirror. 
  ImageMirror automatically computes the mirror orientation and 
  position. The mirror doesn't need to be rectangular, it can be 
  circular or take any form provided it is planar.
- The mirror up direction must be along the Z axis in local mesh
  coordinates. If the mirror is not vertical, ImageMirror will 
  compute the up direction as being the projection of the Z axis
  on the mirror plane.
- UV mapping must be set right to get correct mirror rendering:
  - make a planar projection of the mirror polygons (Unwrap or projection from view)
  - eventually rotate the projection so that UV up direction corresponds to the mesh Z axis
  - scale the projection so that the extreme points touch the border of the texture
  - flip the UV projection horizontally (scale -1 on X axis). This is needed
    because the mirror texture is rendered from the back of the mirror and
    thus is reversed from the view point of the observer. Horizontal flip 
    in the UV map restores the correct orientation.

Besides these simple rules, the mirror rendering is completely automatic. 
In particular, you don't need to allocate a camera for the rendering, 
ImageMirror creates dynamically a camera for that. The reflection is correct
even on large angles. The mirror can be a dynamic and moving object, the 
algorithm always computes the correct camera position based on observer 
relative position. You don't have to worry about mirror position in the scene: 
the algorithm automatically computes the camera frustum so that any object 
behind the mirror is not rendered.

Warnings:
- observer and mirror are references to game objects. ImageMirror keeps
  a pointer to them but does not increment the reference count. You must ensure 
  that these game objects are not deleted as long as you refresh() the ImageMirror
  object. You must release the ImageMirror object before you delete the game
  objects. To release the ImageMirror object (normally stored in GameLogic),
  just assign it to None.
- Mirror rendering is automatically skipped when the observer is behind the mirror
  but it is not disabled when the mirror is out of sight of the observer.
  You should only refresh the mirror when you know that the observer is likely to see it.
  For example, no need to refresh a car inner mirror when the player is not in the car.

Example:

  contr = GameLogic.getCurrentController()
  # object holding the mirror
  mirror = contr.getOwner()
  scene = GameLogic.getCurrentScene()
  # observer will be the active camere
  camera = scene.getObjectList()['OBCamera']
  matID = VideoTexture.materialID(mirror, 'IMmirror.png')
  GameLogic.mirror = VideoTexture.Texture(mirror, matID)
  GameLogic.mirror.source = VideoTexture.ImageMirror(scene,camera,mirror,matID)
  # to render the mirror, just call GameLogic.mirror.refresh(True) on each frame.

You can download a demo game (with a video file) here:

  http://home.scarlet.be/~tsi46445/blender/VideoTextureDemo.zip

For those who have already downloaded the demo, you can just update the blend file:

  http://home.scarlet.be/~tsi46445/blender/MirrorTextureDemo.blend
2008-12-04 16:07:46 +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
aed82a1863 Added Blender.sys.relpath(path, start='//')
similar to os.path.relpath but uses blendfile path rather then the current working directory.

Also use python exceptions rather then providing our own ones.
2008-12-03 06:09:07 +00:00
Robin Allen
6fbeed1355 Changed vector math to use library functions. 2008-11-29 16:52:06 +00:00
Campbell Barton
d9950d2fd4 minor changes, (some comments and less warnings) 2008-11-26 23:57:44 +00:00
Benoit Bolsee
6a51ba54cd VideoTexture: new ImageRender class for Render To Texture
The new class VideoTexture.ImageRender() is available to perform
render to texture in the GE.

Constructor:

  VideoTexture.ImageRender(scene,cam)
    cam  : camera object that will be used for the render.
           It must be an inactive camera.
    scene: reference to the scene that will be rendered.
           The camera must be part of that scene.
  Returns an object that can be used as a source of a VideoTexture.Texture object

Methods: none

Attributes:

  background: 
     4-tuple representing the background color of the rendering
     as RGBA color components, each component being an integer 
     between 0 and 255. 
     Default value = [0,0,255,255] (=saturated blue)
     Note: athough the alpha component can be specified, it is not
           supported at the moment, the alpha channel of the rendered
           texture will always be 255. You can however introduce an
           alpha channel by appending a FilterBlueScreen() filter, it
           will set the alpha to 0 (transparent) on all pixels that were
           not rendered.

  capsize:
     2-tuple representing the size of the render area as [x,y] number of pixels.
     Default value = largest rectangle with power of 2 dimensions that fits in the canvas 
     You may want to reduce the render area to increase performance. For example,
     a render area of [256,128] is probably sufficient to implement a car inner mirror.
     For best performance, use power of 2 dimensions and don't set any filter: this
     allows direct transfer between the GPU frame buffer and texture memory
     without going through the host.

  alpha: 
     Boolean indicating if the render alpha channel should be copied to the texture.
     Default value: False
     Experimental, do not use.

  whole:
     Boolean indicating if the entire canvas should be used for the rendering. 
     Default value: False
     Note: There is no reason to set this attribute to True: the rendering will
           in any case be scaled down to the largest rectangle with power of 2
           dimensions before transfering to the texture.

Attributes inherited from the ImageBase class:

  image : image binary data, read-only
  size  : [x,y] size of the texture, read-only
  scale : set to True for fast scale down in case the render area dimensions are not power of 2
  flip  : set to True for vertical flip. 
  filter: set a post-processing filter on the render.

Notes:

* Aspect Ratio
For consistent results in Blender and Blenderplayer, the same aspect ratio used
by Blender to draw the camera viewport (Scene(F10)->Format tab->Size X/Size Y) 
is also used during the rendering. You can control the portion of the scene that
will be rendered by "looking through the camera": the zone inside the outer dotted 
rectangle will be rendered to the texture.
In order to reproduce the scene without X/Y distortion, you must apply the texture
on an object or portion of object that has the same aspect ratio.

* Order of rendering
The rendereing is performed when you call the refresh() method of the parent 
Texture object. This happens outside the normal frame rendering and will have no 
effect on it.
However, if you want to use ImageViewport and ImageRender at the same time, be 
sure to refresh the viewport texture before the render texture because the latter
will destroy the frame buffer that is used by the former to update the texture.

* Scene status
The meshes are not updated during the render to texture: the rendered texture
is one frame late to the rendered frame with regards to mesh deformation.

* Example:

  cont = GameLogic.getCurrentController()
  # object that receives the texture
  obj = contr.getOwner()
  scene = GameLogic.getCurrentScene()
  # camera used for the render
  tvcam = scene.getObjectList()['OBtvcam']
  # assume obj has some faces UV assigned to tv.png
  matID = VideoTexture.materialID(obj, 'IMtv.png')
  GameLogic.tv = VideoTexture.Texture(obj, matID)
  GameLogic.tv.source = VideoTexture.ImageRender(scene,tvcam)
  GameLogic.tv.source.capsize = [256,256]
  # to render the texture, just call GameLogic.tv.refresh(True) on each frame.

You can download a demo game (with a video file) here:

  http://home.scarlet.be/~tsi46445/blender/VideoTextureDemo.zip

For those who have already downloaded the demo, you can just update the blend file:

  http://home.scarlet.be/~tsi46445/blender/VideoTextureDemo.blend
2008-11-26 17:47:42 +00:00
Benoit Bolsee
15e193f253 BGE update: helper functions for VideoTexture render to texture feature. 2008-11-26 17:38:54 +00:00
Benoit Bolsee
650ac62919 BGE bug fix: culling algorithm didn't used the correct camera. 2008-11-26 17:35:53 +00:00
Robin Allen
402fbd95cc 2 things:
* Patch #17998
* tex_input_vec now takes 3-vector as first argument (was 4-vector).
2008-11-26 13:07:24 +00:00
Matt Ebb
d6ba347266 * Added a new Timeline menu entry: Playback -> Sync Playback to Frames/Sec. It's
more convenient and sensible to find this feature, than over in the audio settings 
(dropping frames in playback is not just for audio!)
2008-11-26 00:47:38 +00:00
Matt Ebb
00fae51fc1 * Added 'Particle System' entries as children of particle system modifiers in the
outliner. Clicking on one activates it and takes you to the object buttons - it's a 
lot better to see what's going on than a little < 1 Part 5 > that gives very little 
indication.
2008-11-25 23:14:00 +00:00
Stefan Gartner
376ba4ac14 * fix path to openexr on irix
* added missing define in storage.c
2008-11-25 12:53:13 +00:00
Nathan Letwory
cac2a438ae * make sure Bullet is enabled when WITH_BF_BULLET=True 2008-11-25 08:00:58 +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
Stefan Gartner
f1474648d3 patch #8583: Add support for gcc on irix
to compile blender with gcc on IRIX, IRIX_USE_GCC needs to be set to true in
user-def.mk.

Other changes related to irix:
 * compile solid from extern/
 * don't build plugins (yet) with "make release" when using gcc (the shell
   script used assumes MIPSpro is installed)
 * use statvfs instead of statfs on irix, like done on solaris
 * use external libs from $(LCGDIR) instead of /usr/freeware
 * use glew header files from $(LCGDIR)/glew instead of the ones installed on
   the system (this applies to other platforms as well)
 * ffmpeg support currently is disabled on irix
2008-11-24 14:15:05 +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
Martin Poirier
1a28bf797e [#18021] Rotating gets locked to axis after trackball rotate mode is entered
Reset transform restriction flags when switching to other transformations while running.

Also don't draw constraint if no constraint flag is on (old annoyance).
2008-11-23 15:27:53 +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
Martin Poirier
520a5b0926 Crasher fix.
If vertex groups had % in them, the function making the menu string would crash (in release only).
2008-11-20 21:45:22 +00:00
Campbell Barton
935ed8a53b commit yesterday broke scaling in the sequencer (dumb mistake)
also changed 3 if's into a switch statement for selecting the interpolation.
2008-11-20 00:34:24 +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
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
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
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
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
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
Ton Roosendaal
0509409c6b Bah, two more files! 2008-11-12 19:14:46 +00:00
Ton Roosendaal
8030cb03fd Patch #7897 Texture Nodes!
Robin (Frrr) Allen did a decent job on this, so we can also welcome him
as a member in the svn committers team to maintain it!

I do the first commit with some minor fixes:
- get Makefiles work
- fix rounding issue with tiles on unit faces
- removed UI includes from tex node

A nice doc in wiki is here:
http://wiki.blender.org/index.php/User:Frr/TexnodeManual

On the todo for Robin is:
- When using one or more Texture-input nodes, you cannot edit them by activating
  (as works now for Material nodes).
- The new "output node" option fails on the default case, when only one
  output node is active. It then shows often a blank menu. Will get fixed asap.
- When using a NodeTree-Texture as input node, the menu for 'active output'
  should not show. NodeTree should ignore other nodetrees to keep things sane
  for now.
- On a future todo is proper usage of "Dxt" and "Dyt" texture vectors for
  superior antialising of checkers/bricks.

General note; I know people are dying to get a full integrated shader system
with nodes. In theory we could merge this with Material Nodetrees... but I 
rather wait for a solid and very well thought out design proposal for this, 
also including design ideas for unifying with a shader language (GPU, CPU).
For the time being this is a nice extension of current textures. :)
2008-11-12 19:03:50 +00:00
Campbell Barton
c63c99d49e Option to have painting multi-threaded.
Each thread process the next free bucket the brush is over until they are all done.
2008-11-12 05:56:37 +00:00
Nathan Letwory
b8fb31e236 Remove BGE defines from highest level and define only there where needed. This prevents scons from doing complete rebuilds when toggling BGE related options. 2008-11-11 22:48:47 +00:00
Nathan Letwory
7e4db234ce previous commits showed that the absolute path problem was even deeper. This should fix yet again some of the problems with giving them to BF_BUILDDIR 2008-11-11 21:37:53 +00:00
Nathan Letwory
7f3b158030 fix problem with giving absolute paths to BF_BUILDDIR 2008-11-11 20:26:53 +00:00
Campbell Barton
483136c8e4 Adjusted scons files so disabling quicktime, python and sdl also removes their includes when building.
writefile.c had usless include.
2008-11-11 14:14:22 +00:00
Campbell Barton
58b861170c svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r17335:HEAD 2008-11-11 12:56:57 +00:00
Campbell Barton
aac928d5bc last commit before some optimizations.
setting RT to 123 will paint from grease pencil (for benchmarking).
2008-11-11 12:35:52 +00:00
Campbell Barton
8a61376c65 wasnt setting the struct size for normal brush types (was testing smear + clone but not paint)
some disabled WIP too
2008-11-11 09:24:34 +00:00
Campbell Barton
db67426dbf fix for [#17959] NURBS Circle: pie-shaped deformation, sticking to object origin 2008-11-11 05:03:03 +00:00
Campbell Barton
13fe65cf46 removed some warnings 2008-11-11 04:42:15 +00:00
Campbell Barton
a331848092 * float image buffer support
* bicubic interpolation for the clone tool
2008-11-11 03:43:21 +00:00
Martin Poirier
8b32ad784b Median center didn't use TD_NOCENTER properly, making it work incorrectly with hinge bones (and with chain rotations). 2008-11-11 03:12:31 +00:00
Campbell Barton
a00e63a542 bicubic_interpolation function was re-calculating a variable it didnt need to - (was calling 32 pow()'s per pixel, now only 8 - approx 3-4x speedup on my system). 2008-11-11 01:13:05 +00:00
Benoit Bolsee
773824bbea VideoTexture: support VideoTexture in blenderplayer 2008-11-10 22:17:40 +00:00
Martin Poirier
3c69864540 Chain rotations for objects and pose bones (for teamto)
This commit adds an exception for rotations (standard rotation and tracball) to still work on children of transformed objects and bones in an expected fashion. That is, you can select a chain of finger bones and rotate to flex them all at once.

Notes:
[1] This could be expended to other transformations if needed.
[2] Center of transformation is determined using the same principle as hinge bones (transformed children aren't taken into account)
2008-11-10 21:23:54 +00:00
Ton Roosendaal
8fc7d4640c Bugfix #17965
Most Surface (NURBS) tools in buttons didn't add undo pushes.
2008-11-10 10:05:09 +00:00
Matt Ebb
ac224d0b89 Patch #17971 by Nathan Vegdahl:
Makes colorband GUI display proper color interpolation

(for real this time)
2008-11-10 05:42:07 +00:00
Benoit Bolsee
2de476c88f VideoTexture: Preserve alpha channel if present in video, images and sequences. Better detection of end of video. 2008-11-09 21:42:30 +00:00
Campbell Barton
16443062a9 * clone tool didnt work when objects center was not 0,0,0
* made backface culling work as expected in perspective view.
2008-11-09 14:34:32 +00:00
Campbell Barton
4caedd34d7 Perspective mode painting works again
SeamBleed in perspective mode mostly working (some small artifacts but generally looks ok)

Added BarycentricWeightsPersp2f and BarycentricWeightsSimplePersp2f for getting weights from verts with perspective matrix applied.
2008-11-09 12:59:01 +00:00
Campbell Barton
7403fc923f triangles were could not be painted onto at all (serves me right for testing with subsurf) 2008-11-09 04:08:08 +00:00
Campbell Barton
74d1a04f30 changes to projection painting
* initializing a bucket only initializes pixels from that bucket (was initializing all pixels in intersecting faces before which made large faces slow to paint onto)
* removed scanline functions, they are not as useful when initializing small areas. 
* UV seam checking also sets the seam flag on the adjacent face to avoid double lookups.

TODO - uv seam bleed doesn't work in perspective mode.
2008-11-09 02:47:30 +00:00
Nathan Letwory
d5ae032a60 * typo fix 2008-11-08 13:39:37 +00:00
Nathan Letwory
d1248ff6d8 === BPy API ===
* add two optional arguments to control click step and precision of Number buttons.
2008-11-08 13:38:21 +00:00
Campbell Barton
37c1fd2303 [#17958] Windows path fix for image_edit.py script.
Modified to work in linux too,  on my system subprocess.Popen(appstring) only works when appstring is a list.

Blenders __import__ didnt support keywords like pythons causing the subprocess module to fail for me.
added keywords to blenders c/api import to match pythons.
2008-11-07 15:16:30 +00:00
Benoit Bolsee
8b2811d9d5 VideoTexture: VideoTexture.materialID() can now take texture image name.
You can specify a image name (starting with 'IM') instead of a material
name in VideoTexture.materialID() and return the material ID matching
this texture.
The advantage of this method is that is works with blender material
and UV texture. In case of UV texture, it grabs the internal material
corresponding to the faces that are assigned to this texture. In case
of blender material, it grabs the material that has an image texture
matching the name as first texture channel.
In both cases, the texture id used in VideoTexture.Texture() should be 0.

Ex:

matID = VideoTexture.materialID(obj,'IMvideo.png')
GameLogic.video = VideoTexture.Texture(obj, matID, 0)
2008-11-07 10:54:32 +00:00
Campbell Barton
f7135d981a simple mistake broke clone tool. 2008-11-07 06:50:19 +00:00
Benoit Bolsee
5567f3dded VideoTexture: comment was misplaced after previous commit. 2008-11-06 23:52:47 +00:00
Diego Borghetti
7b15e8cd64 Bugfix #17524
The problem is that the audio_fill_seq function try to load the hd file
if the sequence don't have it, but it join the two string (directory path +
file path) without the / (Linux... \ Windows), so the result is a wrong path.

 I change the the strncpy and strncat function for a BLI_join_dirfile (like
the reload_sequence_new_file) and all work fine now.

 Also note that the "them go" that Luca report is (or what happen here) the
ctrl+z function, and now both case work fine here.

(interesting.. date from Feb 05.. 2006 ;)
2008-11-06 18:49:53 +00:00
Benoit Bolsee
87538be426 VideoTexture: fix compile error when FFmpeg is disabled. 2008-11-06 16:01:17 +00:00
Campbell Barton
4d460369c0 WIP commit before some optimizations,
fix for possible divide by zero.
added BarryCentricWeights2f(), returns weights for points outside the triangle.
2008-11-06 08:01:11 +00:00
Campbell Barton
f018a3b5bb added support for smear brush type 2008-11-06 02:08:41 +00:00
Campbell Barton
5b6708c278 support for brush blend modes (Mix, Multiply, Darken etc) 2008-11-05 23:24:52 +00:00
Campbell Barton
769a43d3c0 painting onto multiple images wasnt working, faces with different images are treated as seams even if their UV's match. 2008-11-05 22:27:45 +00:00
Benoit Bolsee
ce1625ebc0 VideoTexture: new VideoTexture.ImageFFmpeg to load and reload images.
The FFmpeg library allows to load image files. Although it is possible
to load images using the VideoFFmpeg class, it is not very efficient.
The new class VideoTexture.ImageFFmpeg is dedicated to image management.

Constructor:
-----------
VideoTexture.ImageFFmpeg('image_file_name')
  Opens the file but does not load the texture yet.
  The file name can also be a network address. It can also be a video
  file name; in that case only the first image is loaded.

Methods:
-------
refresh(True)
  Loads the image to texture. 
  You just need to call it once, the file is automatically closed after
  that and calling refresh() again will have no effect.

reload('new_file_name')
  Reloads the image (if new_file_name is omitted) or loads a new image.
  The file is opened but the texture is not updated yet, you need
  to call refresh() once to load the texture.

Attributes:
----------
status
  returns the image status:
    2 : file opened, texture not loaded
    3 : file closed, texture loaded

image
  returns the image data as a string of RGBA pixel

size
  returns the image size [x,y]

scale
  get/set the scale flag. 
  If the scale flag is False, the image is rescale to texture format
  using gluScaleImage() function, slow but good quality.
  If the scale flag is True, the image is rescaled using a fast but
  less accurate algorithm.

flip
  get/set Y-flip flag.
  Set to True by default as FFmpeg always provides the image upside down

filter
  get/set filter(s) on the image.

Example:
2008-11-05 21:53:22 +00:00
Benoit Bolsee
0ade815aff VideoTexture: fixing a crash when loading an image as a video file - yes it works, provided that you don't set repeat and also no need to refresh all the time. 2008-11-05 17:38:31 +00:00
Campbell Barton
aa1ba2f3fb svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r17279:HEAD
somehow scripts line endings change is messing things up, these changes wont be included
error is:
svn: File 'release/scripts/scripttemplate_metaball_create.py' has inconsistent newlines
svn: Inconsistent line ending style
svn: Error reading spooled REPORT request response
2008-11-05 15:11:40 +00:00
Campbell Barton
b98b4e8be8 projection painting clone tool - gives a similar work flow to cloning in the gimp, Ctrl+Click to set the cursor source, then paint from this location.
todo...
* pixel interpolation.
* clone option can currently only be set from the image paint panel.
* only initialize clone pixels under the mouse.
* overlap between source/target while painting could cause problems. need to look into this.

also fixed some cashes in painting normally.
2008-11-05 14:45:54 +00:00
Benoit Bolsee
8916f84622 VideoTexture: Add support for GLSL. FIx small printout bug in Exception printout 2008-11-05 13:22:10 +00:00
Campbell Barton
ea168748eb error in last commit, scanlines had extra offset causing overlapping lines between faces without seams 2008-11-05 05:08:07 +00:00
Campbell Barton
b1653b5f98 fix for pixels not being drawn in 2 cases.
1 issue was caused by detecting 2d horizontal line intersections for lines that had points equal to the horizontal Y value -  solved by detecting point on line cases.
Another was because the 2D bounding box for painting could have faces edges running along it - solved by adding a small margin to the bounding box.
2008-11-05 03:12:59 +00:00
Nathan Letwory
f59f5e67a5 * doing some warning cleaning
* accidently left priority tests around.
2008-11-04 23:46:01 +00:00
Nathan Letwory
beea73b110 * enable openjpeg building for win32/msvc
* add support for building redcode on win32/msvc, but disabled for now, as there are linking problems
  - I cleaned the redcode sconscript - the copying of headers within the source tree is not a clean solution
    This needs to be fixed later on. For now, lets use redcode from extern/ until a better way is found.
2008-11-04 23:04:15 +00:00
Matt Ebb
a19366f34a * Changed the constant colorband interpolation to work left->right,
rather than right -> left. This is how it works now:

http://mke3.net/blender/etc/constant_ss.png
2008-11-04 22:16:57 +00:00
Benoit Bolsee
1886b7bf52 VideoTexture: fix RGB/BGR confusion, make code compatible with big endian CPU, add RGBA source filter. 2008-11-04 12:04:59 +00:00
Campbell Barton
aa7357b692 perspective mode now works with seam bleeding. 2008-11-04 10:17:43 +00:00
Benoit Bolsee
6eb3bf53dd VideoTexture: Bug report #17946: add (char*) casting to fix compile error with Python get-set method and module object. 2008-11-04 09:21:27 +00:00
Campbell Barton
c00b7f33e5 optional uv seem bleed so painting across seams wont give artifacts (like with baking), no UI yet, set to 2 by default.
Does not work yet with perspective view yet, there are still some issue with pixel alignment.
2008-11-04 05:29:36 +00:00
Andre Susano Pinto
ca80578e4e Simple warning fixes 2008-11-04 01:05:44 +00:00
Matt Ebb
1f83dffeb4 Added a new interpolation type for colorbands: Constant
This can be useful for toon shading etc.

Example: http://mke3.net/blender/etc/constant_ss.png
2008-11-04 00:15:27 +00:00
Kent Mein
b7fdf2ab50 Add's GSR's INT64_C fix and removes dos line endings...
Kent
2008-11-03 23:35:41 +00:00
Andre Susano Pinto
ec462b8cea Added Lattice vgroup support to shrinkwrap and simple deform modifier. 2008-11-03 23:17:36 +00:00
Campbell Barton
5be471d29c fix for compile error in last commit + some WIP functions. 2008-11-03 22:27:55 +00:00
Martin Poirier
6cc1466c61 Moving silence_log_ffmpeg to imbuf (it fits better there and fixes the link error in blenderplayer) 2008-11-03 13:33:11 +00:00
Ton Roosendaal
858e2ec776 Bugfix #17921
ALT+select face-loop on mesh with hidden faces ignored the hidden part.
Also caused errors on deleting faces that way.
2008-11-03 13:00:39 +00:00
Campbell Barton
8cecbf9cbd last commit broke projection painting in perspective mode. 2008-11-03 11:06:22 +00:00
Campbell Barton
2ff6d5c06e made scanling creation into its own function project_face_scanline,
speedup adding ProjectPixel's by interpolating the screen coords rather then getting the pixels worldcoord and projecting it into screenspace.
2008-11-03 09:59:08 +00:00
Benoit Bolsee
17296efd62 VideoTexture: fix compile error with GLint in ImageViewport under osx, part 2 2008-11-02 18:41:24 +00:00
Benoit Bolsee
7d63f5a7fe VideoTexture: fix compile error with GLint in ImageViewport under osx. 2008-11-02 18:31:54 +00:00
Ton Roosendaal
db24487449 Makefile fixes for compiling with new videotexture code.
Also: buttons for logic, controllers, didn't line up correct when 
multiple objects were selected (too little space)
2008-11-02 18:12:45 +00:00
Ton Roosendaal
a775719e23 Bugfix #17942
Python dict error: when trying to access a Bone via a key, and the key
was not found, a wrong error message got printed. Fix provided by
reporter Gregor Riepl. Thanks!
2008-11-02 18:05:11 +00:00
Benoit Bolsee
2973bd8ea2 VideoTexture: use PyObjectPlus.h instead of Python.h for compatibility with Python2.3 2008-11-02 18:02:31 +00:00
Martin Poirier
f180702a12 Quiet ffmpeg log by default. No more ugly stream info in console.
Starting Blender with -d turns info logging back on.
2008-11-02 16:28:34 +00:00
Enrico Fracasso
407e38a744 Added bf_videotex to unix libraries (linking error) 2008-11-02 14:54:44 +00:00
Martin Poirier
12b2f1c83c Include path for numpy no longer needed. 2008-11-02 14:36:32 +00:00
Ton Roosendaal
fdc1ef2c25 Bugfix #17902
Black dots appearing in mirroring 3d beveled curves, when using orco
texture coords. Appeared there was memory read just outside of the 
allocation.
2008-11-02 14:03:47 +00:00
Daniel Genrich
752920c531 python25.zip wasn't copied using cmake. Should fix win64 python e.g. "import random" problem 2008-11-02 12:50:11 +00:00
Ton Roosendaal
30016909c7 Bugfix #17920
When entering a wrong expression (or garbish) in a Nkey panel button,
the cursor jumps to the place where the button was clicked. On failure
the button could return a B_NOP, not a 0
2008-11-02 12:27:25 +00:00
Brecht Van Lommel
a4f8f06479 Fix for two proxy + undo related crashes:
* When making a proxy, the lib linked IPO driver was also changed to
  point to the proxy object, and after undo this local proxy object
  was replaced so the pointer became invalid. In fact it is not needed
  at all to change this because the IPO code maps the pointer to the
  local proxy object already.
* Undoing the make proxy operation would crash because the proxy_from
  pointer in the library linked object would still point to the removed
  object. Now it clears all these pointers before undo, because on each
  undo memory file read they will be set again anyway.
2008-11-02 00:25:39 +00:00
Benoit Bolsee
68f50e0c6b VideoTexture: remove numpy dependency. 2008-11-01 22:28:27 +00:00
Campbell Barton
3c9520f92f svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r17236:HEAD 2008-11-01 22:04:41 +00:00
Benoit Bolsee
e72d6c7bfa VideoTexture: fix NULL pointer crash when material name is not found. 2008-11-01 20:18:15 +00:00
Martin Poirier
b24c6ef70d Adding include path for numpy to sconscript. There must be a better way to do this. 2008-11-01 17:44:12 +00:00
Benoit Bolsee
19cdef1f71 VideoTexture: typo in linux code 2008-11-01 17:26:34 +00:00
Benoit Bolsee
e6a2ab319f VideoTexture: AVFormatContext::pb is not a pointer for avformat library older than 52 (linux uses 51) 2008-11-01 17:15:17 +00:00
Brecht Van Lommel
4870db578b Bug #17912: fix for some SSS floating point precision issues, and also
fix a divide by zero in the subsurf code found in the process.
2008-11-01 17:07:24 +00:00
Martin Poirier
58d0dc21aa Getting video texture closer to compiling under linux 2008-11-01 17:06:36 +00:00
Ton Roosendaal
0aff409d54 Bugfix #17913
Bah... fix for envmaps just before 2.48 release gave good looking envmaps 
only when there was no sky involved...

The alpha in environment maps should be reset to 255... something that was 
never done before, but also didn't show errors until other fixes in image 
rendering were done.
2008-11-01 16:09:36 +00:00
Benoit Bolsee
bd81d96b78 Video Texture: missing newlines at the end of several files. 2008-11-01 15:58:49 +00:00
Benoit Bolsee
5cb16c2d03 Video Texture: remove support for capture device, the linux ffmpeg repository is not ready yet. 2008-11-01 15:42:03 +00:00
Campbell Barton
5b205ce852 Speedup collecting pixels from a faces UV, was using 'point-in-tri' (IsectPQ2Df) for every pixel in the UV Bounds of a face, replace this with intersection tests that use scanlines to get the x-range of pixels for each Y increment. 2008-11-01 15:35:07 +00:00
Brecht Van Lommel
00b02f055a Patch 17909: 2D Filter texture coordinates changes, by Dalai Felinto:
* The second opengl texture coordinate (gl_TexCoord[1]) are now filled
  in as well, and will give canvas coordinates from 0.0 to 1.0. The
  first texture coordinates still give the coordinates in the texture
  that is being used, which may not match the canvas exactly, so both
  coordinates are needed.
* Also optimization to allow using smaller texture sizes with multiple
  smaller viewports.
* Print the detailed GLSL shader errors (once), for easier debugging.
2008-11-01 14:00:16 +00:00
Benoit Bolsee
54401d36aa BGE Video Texture: fix constant initializer problem with Exception description. Uniformized the line ending. 2008-11-01 12:48:46 +00:00
Remigiusz Fiedler
b590b121d3 fix a bug in matrix.invert() for 2x2 matrices
reported by Hans in http://blenderartists.org/forum/showthread.php?t=139748
2008-11-01 11:35:08 +00:00