2011-02-18 13:05:18 +00:00
|
|
|
/*
|
2008-04-16 22:40:48 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
2008-04-16 22:40:48 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* The Original Code is: all of this file.
|
|
|
|
|
*
|
|
|
|
|
* Contributor(s): none yet.
|
|
|
|
|
*
|
2008-04-16 22:40:48 +00:00
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
2002-10-12 11:37:38 +00:00
|
|
|
*/
|
2012-02-17 18:59:41 +00:00
|
|
|
#ifndef __BKE_GROUP_H__
|
|
|
|
|
#define __BKE_GROUP_H__
|
2002-11-25 11:16:17 +00:00
|
|
|
|
2011-02-18 13:05:18 +00:00
|
|
|
/** \file BKE_group.h
|
|
|
|
|
* \ingroup bke
|
|
|
|
|
* \since March 2001
|
|
|
|
|
* \author nzc
|
|
|
|
|
*/
|
|
|
|
|
|
2010-04-15 10:28:32 +00:00
|
|
|
struct Base;
|
2018-04-06 12:07:27 +02:00
|
|
|
struct Depsgraph;
|
2002-10-12 11:37:38 +00:00
|
|
|
struct Group;
|
2013-02-05 12:46:15 +00:00
|
|
|
struct Main;
|
2002-10-12 11:37:38 +00:00
|
|
|
struct Object;
|
2009-01-04 14:14:06 +00:00
|
|
|
struct Scene;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2013-04-03 11:28:42 +00:00
|
|
|
void BKE_group_free(struct Group *group);
|
2017-12-01 11:24:21 -02:00
|
|
|
void BKE_group_init(struct Group *group);
|
2013-04-03 11:28:42 +00:00
|
|
|
struct Group *BKE_group_add(struct Main *bmain, const char *name);
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
void BKE_group_copy_data(struct Main *bmain, struct Group *group_dst, const struct Group *group_src, const int flag);
|
2017-06-14 22:36:30 +02:00
|
|
|
struct Group *BKE_group_copy(struct Main *bmain, const struct Group *group);
|
2016-07-21 16:09:08 +02:00
|
|
|
void BKE_group_make_local(struct Main *bmain, struct Group *group, const bool lib_local);
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
bool BKE_group_object_add(struct Group *group, struct Object *ob);
|
|
|
|
|
bool BKE_group_object_unlink(struct Group *group, struct Object *ob);
|
2013-04-03 11:28:42 +00:00
|
|
|
struct Group *BKE_group_object_find(struct Group *group, struct Object *ob);
|
|
|
|
|
bool BKE_group_object_exists(struct Group *group, struct Object *ob);
|
2015-02-06 18:10:46 +11:00
|
|
|
bool BKE_group_object_cyclic_check(struct Main *bmain, struct Object *object, struct Group *group);
|
2013-04-03 11:28:42 +00:00
|
|
|
bool BKE_group_is_animated(struct Group *group, struct Object *parent);
|
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
|
|
|
|
2018-04-06 12:07:27 +02:00
|
|
|
void BKE_group_handle_recalc_and_update(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *parent, struct Group *group);
|
2002-10-30 02:07:20 +00:00
|
|
|
|
2017-12-08 14:45:15 +01:00
|
|
|
/* Dependency graph evaluation. */
|
|
|
|
|
|
2018-04-06 12:07:27 +02:00
|
|
|
void BKE_group_eval_view_layers(struct Depsgraph *depsgraph,
|
2017-12-08 14:45:15 +01:00
|
|
|
struct Group *group);
|
|
|
|
|
|
|
|
|
|
/* Helper macros. */
|
|
|
|
|
|
2018-03-07 20:46:27 +11:00
|
|
|
#define FOREACH_GROUP_BASE_BEGIN(_group, _base) \
|
2017-12-01 11:24:21 -02:00
|
|
|
for (Base *_base = (Base *)(_group)->view_layer->object_bases.first; \
|
|
|
|
|
_base; \
|
2017-12-08 16:03:56 +01:00
|
|
|
_base = _base->next) \
|
2017-12-01 11:24:21 -02:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
#define FOREACH_GROUP_BASE_END \
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-07 20:46:27 +11:00
|
|
|
#define FOREACH_GROUP_OBJECT_BEGIN(_group, _object) \
|
2017-12-01 11:24:21 -02:00
|
|
|
for (Base *_base = (Base *)(_group)->view_layer->object_bases.first; \
|
|
|
|
|
_base; \
|
2017-12-08 16:03:56 +01:00
|
|
|
_base = _base->next) \
|
2017-12-01 11:24:21 -02:00
|
|
|
{ \
|
|
|
|
|
Object *_object = _base->object; \
|
|
|
|
|
BLI_assert(_object != NULL);
|
|
|
|
|
|
|
|
|
|
#define FOREACH_GROUP_OBJECT_END \
|
2018-03-09 11:44:42 +11:00
|
|
|
} ((void)0)
|
2017-12-01 11:24:21 -02:00
|
|
|
|
2013-04-03 11:28:42 +00:00
|
|
|
#endif /* __BKE_GROUP_H__ */
|