Commit Graph

227 Commits

Author SHA1 Message Date
Campbell Barton 7ad59c4e2c fix odd (intentional) behavior with vertex parent,
curve children of a triangle vertex parent would only display their relationship line to the first vertex. (confusing)

also added OB_TYPE_SUPPORT_PARVERT macro.
2013-09-01 22:38:41 +00:00
Bastien Montagne 79835d53fb Cleanup: move defines into anon enums, as suggested by Joshua, thx.
Note I let a few as defines for now (esp. base options are not clear to me, how they should be aranged in groups).
2013-08-26 14:30:00 +00:00
Bastien Montagne 49ae48bc16 Cleanup (bitflags are *so much* easy to handle and clear as bit-shift operations than raw values!). 2013-08-26 13:50:25 +00:00
Sergey Sharybin f030758515 Tag object-data level boundbox as invalid rather than freeing it
Object update used to free object-data level bounding box to trigger
it's re-calculation in the future. Such a freeing performed from
object update isn't thread-safe because mesh could be shared between
multiple objects.

Rather than freeing bounding box, tag it's as invalid, this is safe
from threading point of view and also prevents unnecessary memory
re-allocation.

Object-level bounding box is still reallocating, but think we could
change this easily in the future as well.

--
svn merge -r58154:58156 -r59258:59259 ^/branches/soc-2013-depsgraph_mt
2013-08-19 09:58:28 +00:00
Sergey Sharybin 527ddb0a5b Move bevel list and path from Curve to Object datablock
I know this is not so much nice to have this guys hanging
around in a general Object datablock and ideally they better
be wrapped around into a structure like DerivedMesh or
something like this. But this is pure runtime only stuff and
we could re-wrap them around later.

Main purpose of this is making curves more thread safe,
so no separate threads will ever start freeing the same path
or the same bevel list.

It also makes sense because path and bevel shall include
deformation coming from modifiers which are applying on
pre-tesselation point and different objects could have
different set of modifiers. This used to be really confusing
in the past and now data which depends on object is stored
in an object, making things clear for understanding even.

This doesn't make curve code fully thread-safe due to
pre-tesselation modifiers still modifies actual nurbs and
lock is still needed in makeDispListsCurveTypes, but this
change makes usage of paths safe for threading.

Once modifiers will stop modifying actual nurbs, curves
will be fully safe for threading.

Actually, this commit also contains wrapping runtime curve
members into own structure

This allows easier assignment on file loading, keeps curve-
specific runtime data grouped and saves couple of bytes in
Object for non-curve types.

--
svn merge -r57938:57939 ^/branches/soc-2013-depsgraph_mt
svn merge -r57957:57958^/branches/soc-2013-depsgraph_mt
2013-08-19 09:25:24 +00:00
Campbell Barton 69900035b3 fix for G,G causing vertex slide in UV/Image window, also comment unused defines/enums. 2013-01-24 08:49:40 +00:00
Sergej Reich 47c96081d0 rigidbody: Add rigid body constraints
Constraints connect two rigid bodies.
Depending on which constraint is used different degrees of freedom
are limited, e.g. a hinge constraint only allows the objects to rotate
around a common axis.

Constraints are implemented as individual objects and bahave similar to
rigid bodies in terms of adding/removing/validating.

The position and orientation of the constraint object is the pivot point
of the constraint.

Constraints have their own group in the rigid body world.

To make connecting rigid bodies easier, there is a "Connect" operator that
creates an empty objects with a rigid body constraint connecting the selected
objects to active.

Currently the following constraints are implemented:
* Fixed
* Point
* Hinge
* Slider
* Piston
* Generic

Note: constraint limits aren't animatable yet).
2013-01-23 05:56:56 +00:00
Sergej Reich 27601aaf01 rigidbody: Add DNA/RNA/BKE infrastructure for the rigid body sim
This is just the basic structure, the simulation isn't hooked up yet.

Scenes get a pointer to a rigid body world that holds rigid body objects.
Objects get a pointer to a rigdid body object.

Both rigid body world and objects aren't used directly in the simulation
and only hold information to create the actual physics objects.

Physics objects are created when rigid body objects are validated.
In order to keep blender and bullet objects in sync care has to be taken
to either call appropriate set functions or flag objects for validation.

Part of GSoC 2010 and 2012.
Authors: Joshua Leung (aligorith), Sergej Reich (sergof)
2013-01-23 05:56:22 +00:00
Campbell Barton d1a211188b property change reporting now uses the context again, rather then checking a dir() on context, hard-code common paths.
eg:
  bpy.context.scene.render.resolution_x = 1921
  bpy.context.object.data.use_auto_smooth = True
  bpy.context.object.active_material.diffuse_intensity = 1
  bpy.context.scene.world.exposure = 0.1

also remove duplicate GS() defines
2013-01-22 04:24:01 +00:00
Campbell Barton 5f9ea0d7eb move draw all edges into the object settings (object panel), makes more sense here since its next to draw extra wire 2013-01-18 19:01:26 +00:00
Ton Roosendaal 70a59a3262 Depsgraph hack feature - experimental
Many depsgraph failures are because some data in the graph is being
recalculated too early (or not at all).

Since we better support animators with working renders, here's a hack to
allow manual additional updates on frame changes.

In Property Editor, Object, Panel "Relations Extra" you now have two
buttons:
- Extra Object Update
- Extra Data Update

This will do an extra update of object and/or its data ONLY on frame changes.
Update happens as last.

Tested on files collected in Wiki todo, several cases now work OK, especially
the lags on updates.
2013-01-10 18:20:29 +00:00
Brecht Van Lommel 863291bc8e Fix #33113: cycles not rendering motion blur correct with dying particles.
There were a bunch of other issues with dupli motion blur and syncing, the problem
being that there was no proper way to detect corresponding duplis between frames
or updates. As a solution, a persistent_id was added to the DupliObject. It's an
extension of the previous index value, with one index for each dupli level. This
can be used to reliably find matching dupli objects between frames. Works with
nested duplis, multiple particle systems, etc.
2012-11-08 16:35:28 +00:00
Campbell Barton ec1f69ffce style cleanup & re-use DNA pad var with new collision group object settings. 2012-10-30 16:33:40 +00:00
Mitchell Stokes 3bf9bb3b13 BGE: Adding support for Bullet's collision masks. Each object now has a collision mask and a collision group. Object A and object B collide if object A's groups is in object B's mask and object B's group is in object A's mask. In other words, the group defines what the object is (collision wise) and the group defines what the object can collide with.
The majority of this patch was provided by Kupoman with some edits from me and heavy testing by z0r.
2012-10-30 15:44:16 +00:00
Lukas Toenne d3eb9dddd6 Better fix for #32846. Instead of using time change or object recalc condition, set an explicit object flag to disable particle system modifier update during dupli list creation. This is more transparent and should prevent issues with hair path generation being skipped. 2012-10-18 15:54:24 +00:00
Campbell Barton aa49ca25d5 incorrect spelling in comments 2012-09-26 20:05:38 +00:00
Campbell Barton ca7d1ec39d style cleanup: use <pre> for doxygen ascii art 2012-08-13 15:17:15 +00:00
Campbell Barton 32254596d4 replace ELEM8(gs, ID_ME, ID_CU, ID_MB, ID_LT, ID_LA, ID_CA, ID_TXT, ID_SPK) with macro: OB_DATA_SUPPORT_ID() 2012-08-12 14:57:19 +00:00
Mitchell Stokes 47c7266522 Accidentally did a commit when I wanted to revert... (ignore my last revision) 2012-08-08 01:29:20 +00:00
Mitchell Stokes 843b45cafa 2012-08-08 01:24:48 +00:00
Bastien Montagne 468ef74ed7 More spell and typo fixes (mostly visualise->visualize, grey->gray, normalise->normalize). 2012-07-03 19:09:07 +00:00
Campbell Barton 74c9c24d27 style cleanyp 2012-06-23 23:22:19 +00:00
Sergey Sharybin ff998e15a7 Fixes for 8vytes scalar types used in DNA (int64 and double)
- makesdna wasn't checking whether such scalars are aligned to 8 bytes.
  Now it should be handled correct.
- Some scalars in Object structure weren't 8 bytes aligned, which lead
  to some incorrectly loaded files.

  Fixed by adding void *pad. It's a bit tricky part of patch, but can't
  see clearer way to make alignment correct

  Usually ints/chars were used for padding, but in this case there are
  some leading pointer properties before int64 properties and using
  pointer as a padding resolves alignment on both 32 and 64 bit
  platforms.

  Using pointers as padding weren't needed before, because all types
  were correctly aligned independent of whether pointers are 4 or 8
  bytes.

This fixes #31774: Empty offset Y parameter is resetting
2012-06-21 10:52:23 +00:00
Campbell Barton cf6aefcce6 shrink the object struct 8 bytes - remove unused ctime variable. 2012-06-16 16:50:23 +00:00
Lukas Toenne 5e1bbde01d Particle Info node for Cycles. This can be used to access particle information in material shaders for dupli objects. For now only the particle Age and individual Lifetime (in frames) are supported, more attributes can be added when needed.
The particle data is stored in a separate texture if any of the dupli objects uses particle info nodes in shaders. To map dupli objects onto particles the store an additional particle_index value, which is different from the simple dupli object index (only visible particles, also works for particle dupli groups mode).

Some simple use cases on the code.blender.org blog:
http://code.blender.org/index.php/2012/05/particle-info-node/
2012-06-08 16:17:57 +00:00
Benoit Bolsee 58bc424b3c BGE #30734: add support for physics linear and angular thresholds and deactivation time from python and GUI.
========================
The linear and angular thresholds set the speed limit (in m/s) and rotation limit (in rad/s)
under which a rigid body will go to sleep (stop moving) if it stays below the limits for a 
time equal or longer than the deactivation time (sleeping is disabled is deactivation time is 
set to 0).
These settings help reducing the processing spent on Physics during the game.

Previously they were only accessible from python but not working because of a bug. 
Now the python functions are working and the settings are available in the Physics panel
of the World settings when using the Blender Game render engine.

Python API:
  import PhysicsConstraints
  PhysicsConstraints.setDeactivationLinearTreshold(float)
  PhysicsConstraints.setDeactivationAngularTreshold(float)
2012-05-29 20:30:33 +00:00
Benoit Bolsee dfc19a1ff7 BGE patch #28476: Character object physics type
===============================================
This patch adds a new "Character" BGE physics type which uses Bullet's btKinematicCharacter for simulation instead of full-blown dynamics. It is appropiate for (player-controlled) characters, for which the other physics types often result unexpected results (bouncing off walls, sliding etc.) and for which simple kinematics offers much more precision.

"Character" can be chosen like any other physics type in the "Physics" section of the properties window. Current settings for tweaking are "Step Height" (to make the object automatically climb small steps if it collides with them), "Fall Speed" (the maximum speed that the object can have when falling) and "Jump Speed", which is currently not used.

See http://projects.blender.org/tracker/?func=detail&atid=127&aid=28476&group_id=9
for sample blends and a discussion on the patch: how to use it and what influences the behavior of the character object.

Known problem: there is a crash if the "compound" option is set in the physics panel of the Character object.
2012-05-28 21:36:29 +00:00
Campbell Barton 3896ad4cbb code cleanup: spelling 2012-05-20 21:23:26 +00:00
Campbell Barton 9e3523b556 code cleanup: documentation commit 2012-05-06 16:28:52 +00:00
Campbell Barton 9caab2e265 code cleanup: replace some long ELEM7 checks with macro OB_TYPE_SUPPORT_EDITMODE() 2012-04-28 10:33:32 +00:00
Campbell Barton ca05219f3e fix [#30651] bpy.ops.object.mode_set(...) editmode removes faces.
problem was that BMesh had tessellation call when undo pushes were called.

if python called an operator with no undo push, tessfaces would not be created.

fix this by making it the responsibility of each editmesh operator to re-tessellate, as it is with notifiers and depsgraph.
added EDBM_update_generic() function to add notifier, tag for depsgraph update and optionally re-tessellate.
2012-03-27 00:01:35 +00:00
Campbell Barton ea13ec1699 Spelling Cleanup 2012-03-01 12:20:18 +00:00
Campbell Barton 6ca7d82932 code cleanup: white space, spelling & ';;' end of lines. 2012-02-25 16:04:03 +00:00
Campbell Barton 2b7ca2304a unify include guard defines, __$FILENAME__
without the underscores these clogged up the namespace for autocompleation which was annoying.
2012-02-17 18:59:41 +00:00
Sergey Sharybin 51bada696f Longer names support for all ID and other object names
This commit extends limit of ID and objects to 64 (it means 63 meaning
characters and 1 for zero-terminator). CustomData layers names are also
extended.
Changed DNA structures and all places where length constants were hardcoded.

All names which are "generating" from ID block should be limited by MAX_ID_NAME-2,
all non-id names now has got own define called MAX_NAME which should be used all
over for non-id names to make further name migration stuff easier.

All name fields in DNA now have comment with constant which corresponds to
hardcoded numeric value which should make it easier to further update this
limits or even switch to non-hardcoded values in DNA.

Special thanks to Campbell who helped figuring out some issues and helped a lot
in finding all cases where hardcoded valued were still used in code.

Both of forwards and backwards compatibility is stored with blender versions newer
than January 5, 2011. Older versions had issue with placing null-terminator to
DNA strings on file load which will lead to some unpredictable behavior or even
crashes.
2012-01-11 08:51:06 +00:00
Campbell Barton ca629d5ccc minor dna header cleanup 2011-12-30 07:25:49 +00:00
Campbell Barton eb3beca8d4 replace u_int64_t with cc99's uint64_t as suggested by Nicholas Bishop. 2011-12-24 03:03:42 +00:00
Campbell Barton ddcf56366d change customdata mask from an 'unsigned int' to an 'u_int64_t', since BMesh branch has run out of bits 2011-12-23 20:30:23 +00:00
Campbell Barton 6f7ae034fd fix for noise module in driver namespace (was infact mathutils). 2011-12-07 00:36:57 +00:00
Campbell Barton eb233d9332 syncing some minor formatting edits from bmesh branch. 2011-12-04 23:04:43 +00:00
Campbell Barton 31ff21d735 add define for deprecated DNA struct members: DNA_DEPRECATED,
this means use of deprecated struct members gives a warning.

- makesdna.c preprocessor skips this.
- DNA_DEPRECATED_ALLOW is used so readfile.c can do versioning without warnings.
- this exposes some use of deprecated struct members, will deal with this after.
2011-12-04 06:05:48 +00:00
Campbell Barton 3fdc28b736 add a new object member to store the dsize, since with my recent commit broke forward compatibility. now the new values are copied into 'dscale' and existing ones remain.
this is annoying since now we have dsize and dscale, will look into a way to deprecate struct members next.
2011-12-04 03:35:54 +00:00
Joshua Leung 440c1c2c17 As discussed on the mailing list, removing the non-functional,
incompatible, and unmaintainable Time Offset cruft.

- Slow Parenting lives another day (just), although it now carries
appropriate cautionary disclaimers. It's only really for the Game
Engine nowadays, as that's the only place where it can possibly work
with any reliability.
- "Animation Hacks" panel is now "Relations Extras". I could've merged
the two panels, though I figured these options weren't that frequently
used to justify taking up screen-space by default along with the panel
2011-11-06 05:46:45 +00:00
Campbell Barton cc7e79f372 more DNA object edits
- remove 'path' pointer, wasnt used anywhere.
- remove comments about what each game flag 'bit' does, these are defines now.
- reduce the size of DupliObject 8 bytes.
also commented some of the struct members.
2011-11-05 03:02:55 +00:00
Campbell Barton b0adf37ef9 - view bounds (now split from collision bounds) was still being used for bge physics in one place, comparison was incorrectly treating it as a flag too.
- cleanup Object struct - remove pad and unused flags, convert some shot's to char's, saving 24 bytes.
2011-11-05 02:30:25 +00:00
Sergey Sharybin 77934cfaed Fix #28865: Draw_bounds_type does not display Polyhedron or Capsule types
Separate DNA properties for bounding box used for bounding box display
in 3d viewport and bounding box used for collision detection in game engine.

Bumped subversion for proper updating old files to new system, but it
need more complex testing.
2011-11-04 15:53:34 +00:00
Brecht Van Lommel 97a0ae3e1b RenderEngine api: support for viewport rendering, details here:
http://wiki.blender.org/index.php/Dev:2.6/Source/Render/RenderEngineAPI

* This adds a Rendered draw type in the 3D view, only available when
  the render engine implements the view_draw callback.
* 3D view now stores a pointer to a RenderEngine.

* view_draw() callback will do OpenGL drawing instead of the viewport.
* view_update() callback is called after depsgraph updates.
2011-11-02 18:20:53 +00:00
Campbell Barton bcdcbb65c1 macro to check if an object type supports vgroups 2011-11-01 06:45:36 +00:00
Campbell Barton 4a04f72069 remove $Id: tags after discussion on the mailign list: http://markmail.org/message/fp7ozcywxum3ar7n 2011-10-23 17:52:20 +00:00
Campbell Barton d893ac690c rename confusing constants (no functional change)
- OB_BOUND_POLYT --> OB_BOUND_CONVEX_HULL
- OB_BOUND_POLYH --> OB_BOUND_TRIANGLE_MESH
2011-10-13 22:14:41 +00:00