Commit Graph

32 Commits

Author SHA1 Message Date
Campbell Barton b1d758ae6b Cleanup: redundant struct declarations 2015-03-29 03:56:39 +11:00
Campbell Barton 61c66a996c Outliner: DragDrop objects to groups
Support drag&drop objects to groups in the outliner.

D989 by @lichtwerk
2015-02-06 19:03:09 +11:00
Sergey Sharybin 709041ed0b Threaded object update and EvaluationContext
Summary:
Made objects update happening from multiple threads. It is a task-based
scheduling system which uses current dependency graph for spawning new
tasks. This means threading happens on object level, but the system is
flexible enough for higher granularity.

Technical details:

- Uses task scheduler which was recently committed to trunk
  (that one which Brecht ported from Cycles).

- Added two utility functions to dependency graph:
  * DAG_threaded_update_begin, which is called to  initialize threaded
    objects update. It will also schedule root DAG node to the queue,
    hence starting evaluation process.

    Initialization will calculate how much parents are to be evaluation
    before current DAG node can be scheduled. This value is used by task
    threads for faster detecting which nodes might be scheduled.

  * DAG_threaded_update_handle_node_updated which is  called from task
    thread function when node was fully handled.

	This function decreases num_pending_parents of node children and
	schedules children with zero valency.

    As it might have become clear, task thread receives DAG nodes and
    decides which callback to call for it.

    Currently only BKE_object_handle_update is called for object nodes.

    In the future it'll call node->callback() from Ali's new DAG.

- This required adding some workarounds to the render pipeline.
  Mainly to stop using get_object_dm() from modifiers' apply callback.
  Such a call was only a workaround for dependency graph glitch when
  rendering scene with, say, boolean modifiers before displaying
  this scene.

  Such change moves workaround from one place to another, so overall
  hackentropy remains the same.

- Added paradigm of EvaluaitonContext. Currently it's more like just a
  more reliable replacement for G.is_rendering which fails in some
  circumstances.

  Future idea of this context is to also store all the local data needed
  for objects evaluation such as local time, Copy-on-Write data and so.

  There're two types of EvaluationContext:

  * Context used for viewport updated and owned by Main. In the future
    this context might be easily moved to Window or Screen to allo
    per-window/per-screen local time.

  * Context used by render engines to evaluate objects for render purposes.
    Render engine is an owner of this context.

  This context is passed to all object update routines.

Reviewers: brecht, campbellbarton

Reviewed By: brecht

CC: lukastoenne

Differential Revision: https://developer.blender.org/D94
2013-12-26 17:24:42 +06:00
Campbell Barton d407aeecc7 code cleanup: use more (blender) conventional naming for group functions.
also change dump_rna2xml.py to dump bpy.data by default.
2013-04-03 11:28:42 +00:00
Sergey Sharybin fdfa5910b5 Fix #34040: Moving Normal Node with enabled Cycles Material Preview crashes
Issue was caused by couple of circumstances:

- Normal Map node requires tesselated faces to compute tangent space
- All temporary meshes needed for Cycles export were adding to G.main
- Undo pushes would temporary set meshes tessfaces to NULL
- Moving node will cause undo push and tree re-evaluate fr preview

All this leads to threading conflict between preview render and undo
system.

Solved it in  way that all temporary meshes are adding to that exact
Main which was passed to Cycles via BlendData. This required couple
of mechanic changes like adding extra parameter to *_add() functions
and adding some *_ex() functions to make it possible RNA adds objects
to Main passed to new() RNA function.

This was tricky to pass Main to RNA function and IMO that's not so
nice to pass main to function, so ended up with such decision:

- Object.to_mesh() will add temp mesh to G.main
- Added Main.meshes.new_from_object() which does the same as to_mesh,
  but adds temporary mesh to specified Main.

So now all temporary meshes needed for preview render would be added
to preview_main which does not conflict with undo pushes.

Viewport render shall not be an issue because object sync happens from
main thread in this case.

It could be some issues with final render, but that's not so much
likely to happen, so shall be fine.

Thanks to Brecht for review!
2013-02-05 12:46:15 +00:00
Joshua Leung 58d520324e Code cleanup - remove some obsolete code 2012-09-16 07:14:15 +00:00
Campbell Barton 9892736206 code cleanup: header cleanup and remove some duplicate defines. 2012-05-12 20:39:39 +00:00
Campbell Barton a731e13043 code cleanup: function naming, use BKE_*type* prefix. 2012-05-05 14:03:12 +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
Campbell Barton cbd5b492b1 remove use of deprecated struct members
- editmesh smooth & subdivide were using old mirror axis flag still.
- removed colbits from outliner and object code.
- commented some other parts of the code which access deprecated members and aren't called anywhere.
2011-12-04 06:39:35 +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
Nathan Letwory 22638e22ea doxygen: blenkernel under core as module. 2011-02-18 13:05:18 +00:00
Campbell Barton 51dcbdde03 use 'const char *' by default with RNA functions except when the value is flagged as PROP_THICK_WRAP.
Also use const char in many other parts of blenders code.

Currently this gives warnings for setting operator id, label and description since these are an exception and allocated beforehand.
2010-11-17 09:45:45 +00:00
Brecht Van Lommel 9a85013692 Merge various small changes from render branch:
* Division by zero fix for TNT SVD code.
* Sound fix, in case ffmpeg decode fails, don't use the samples.
* Fix for incorrect bounds of transformed objects in new raytracing code.
* Gave memory arena's a name used for allocations for easier memory
  usage debugging.
* Dupligroup no_draw option was using layers but not restrict view/render
  setting. (not a bugfix exactly but would do display list context switching
  while drawing for no reason).
* Fix objects instanced on hair particles not giving consistent results
  when the object is transformed.
* New math functions: madd_v4_v4fl, len_squared_v3v3, interp_v4_v4v4v4,
  mul_v4_m4v4, SH and form factor functions, box_minmax_bounds_m4.
* mul_m4_m4m4 and mul_m3_m3m3 now accept the same pointers for multiple
  arguments.
* endjob callback for WM jobs system.
* Geometry node uv/color layer now has search list/autocomplete.
* Various small buildsystem tweaks, not strictly needed yet in trunk.
2010-04-15 10:28:32 +00:00
Campbell Barton 081c1205a3 correct fsf address 2010-02-12 13:34:04 +00:00
Campbell Barton 78798ba4df rename free_group to free_group_objects since it doesnt free the group its self. 2010-01-12 13:42:13 +00:00
Campbell Barton bc6190f3e3 python api for collection add()/remove()
Added a group example
 C = bpy.context
 ob = C.active_object
 bpy.data.groups[0].objects.add(ob)

- add_to_group and rem_from_group now take optional scene and base flags and deal with updating the object & base flags
- operators that add objects to groups were setting ob->recalc= OB_RECALC_OB; looks like its not needed.
- previously add() ignored python args, now add and remove are called like any other FunctionRNA from python.
- made the pyrna api use tp_getset's for collestions active/add()/remove()
2009-11-11 16:28:53 +00:00
Brecht Van Lommel 5dd9f7635a 2.5
Make local and make single user are back for ID template.

Internally these calls got unified, id_make_local and
id_copy are now used to do these operations for all types
that support it. Also reveals that for some ID types the
implementation is still missing.

Further, some small changes:

* unlink_text is now in blenkernel.
* copy_group was implemented.
* ID template now has an open operator again.
* fix preview to not change material reference count,
  even if temporary it shows up with threaded preview.
* id_unlink unifies unlink for text, object and group.
2009-09-04 21:02:43 +00:00
Ton Roosendaal f7cb86df3a 2.5
Think global, act local!

The old favorite G.scene gone! Man... that took almost 2 days.
Also removed G.curscreen and G.edbo.

Not everything could get solved; here's some notes.
- modifiers now store current scene in ModifierData. This is not
  meant for permanent, but it can probably stick there until we
  cleaned the anim system and depsgraph to cope better with
  timing issues.
- Game engine G.scene should become an argument for staring it.
  Didn't solve this yet.
- Texture nodes should get scene cfra, but the current implementation
  is too tightly wrapped to do it easily.
2009-01-04 14:14:06 +00:00
Chris Want 5d0a207ecb Patch from GSR that a) fixes a whole bunch of GPL/BL license
blocks that were previously missed; and b) greatly increase my
ohloh stats!
2008-04-16 22:40:48 +00:00
Campbell Barton a9518afc67 feature request from peach, remove selected objects from 1 group.
Also made rem_from_group return if it removed the object which save some looping.

Added a node in the blender help message that background mode dosnt load the .B.blend file as a bug was reported recently because of this.
2008-02-03 19:03:18 +00:00
Brecht Van Lommel 9dd1bcfdfb Render instancing can now also handle the same object in multiple,
non-animated dupligroups.
2008-01-21 22:10:14 +00:00
Campbell Barton 7b6c88473c find_group would only return the first group, this let to the assumption that an object was only in 1 group, made it easy to loop through all groups an object is in.
group = NULL;
while( (group = find_group(base->object, group)) ) {
	...
}
2008-01-19 15:13:42 +00:00
Campbell Barton e0c77c0f14 made all data adding functions accept a name such as add_mesh or add_curve, previously only some datatypes adding functions accepted a name.
also updated the Bpy.py epydocs
2007-03-11 16:25:17 +00:00
Ton Roosendaal e65e6237a2 Orange; Magical Group relink option. :)
This is the case:

- Empty has Group duplicator
- Empty has NLA strips to animate the group

On linking the Empty to another group (with button in ObjectButtons), it
checks for the current strips in NLA, and tries to find the proper objects
in the new Group, based on name matches.
If not found, it sets the strip-objects to zero.
2005-12-14 15:58:52 +00:00
Ton Roosendaal d7bee8c117 Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
   enables to control the entire animation system of the Group.

Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
   to override NLA/action of any Grouped Object.

For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.

Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.

Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.

-> Recoded entire duplicator system

The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.

By centralizing the code for duplicating, more options can be easier added.
Features to note:

- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too

Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.

-> Library System

- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.

-> Fixes

- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
  causing unnecessary slowdown on reading.

Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
Ton Roosendaal 6555ddbcd8 Orange:
Series of fixes in Library linking of groups;

- On library-linking (SHIFT-F1) a Group, the Objects now don't get a "Base"
  anymore, meaning they won't show up as Objects in the Scene.
  This ensures you can use the linked Group as duplicator without having
  your file polluted with new (and linked) objects.
  (I realize it should be possible to have it with Base too, will check)
- On append or file-read, the linked Group Objects get drawn properly,
  but the animation system doesn't run yet.
- Group buttons (F7) now shows if a Group is from Library
- Outliner draws Library linked data with blue-ish text

Other fixes;

- Using group-duplicator, with originals in hidden layer, now shows and
  updates animated Objects correctly.
- All of Object button panels did not have a proper protection against
  editing Library data.
2005-12-06 15:39:25 +00:00
Ton Roosendaal d024452ebf Orange branch: Revived hidden treasure, the Groups!
Previous experiment (in 2000) didn't satisfy, it had even some primitive
NLA option in groups... so, cleaned up the old code (removed most) and
integrated it back in a more useful way.

Usage:
- CTRL+G gives menu to add group, add to existing group, or remove from
  groups.
- In Object buttons, a new (should become first) Panel was added, showing
  not only Object "ID button" and Parent, but also the Groups the Object
  Belongs to. These buttons also allow rename, assigning or removing.
- To indicate Objects are grouped, they're drawn in a (not theme yet, so
  temporal?) green wire color.
- Use ALT+SHIFT mouse-select to (de)select an entire group

But, the real power of groups is in the following features:

-> Particle Force field and Guide control
In the "Particle Motion" Panel, you can indicate a Group name, this then
limits force fields or guides to members of that Group. (Note that layers
still work on top of that... not sure about that).

-> Light Groups
In the Material "Shaders" Panel, you can indicate a Group name to limit
lighting for the Material to lamps in this group. The Lights in a Group do
need to be 'visible' for the Scene to be rendered (as usual).

-> Group Duplicator
In the Object "Anim" Panel, you can set any Object (use Empty!) to
duplicate an entire Group. It will make copies of all Objects in that Group.
Also works for animated Objects, but it will copy the current positions or
deforms. Control over 'local timing' (so we can do Massive anims!) will be
added later.
(Note; this commit won't render Group duplicators yet, a fix in bf-blender
will enable that, next commit will sync)

-> Library Appending
In the SHIFT-F1 or SHIFT+F4 browsers, you can also find the Groups listed.
By appending or linking the Group itself, and use the Group Duplicator, you
now can animate and position linked Objects. The nice thing is that the
local saved file itself will only store the Group name that was linked, so
on a next file read, the Group Objects will be re-read as stored (changed)
in the Library file.
(Note; current implementation also "gives a base" to linked Group Objects,
to show them as Objects in the current Scene. Need that now for testing
purposes, but probably will be removed later).

-> Outliner
Outliner now shows Groups as optio too, nice to organize your data a bit too!

In General, Groups have a very good potential... for example, it could
become default for MetaBall Objects too (jiri, I can help you later on how
this works). All current 'layer relationships' in Blender should be dropped
in time, I guess...
2005-12-06 10:55:30 +00:00
Kent Mein f1c4f705a1 Removed the config.h thing from the .h's in the source dir.
So we should be all set now :)

Kent
--
mein@cs.umn.edu
2002-12-27 13:11:01 +00:00
Kent Mein b9a19f1ea7 Did all of the .h's in source
(adding)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

also the Makefile.in's were from previous patch adding
the system depend stuff to configure.ac

Kent
--
mein@cs.umn.edu
2002-11-25 11:16:17 +00:00
Kent Mein 01bff70383 fixed spacing in the headers to get rid of some warnings and some other
little minor spacing issues.
2002-10-30 02:07:20 +00:00
Hans Lambermont 12315f4d0e Initial revision 2002-10-12 11:37:38 +00:00