Previously, the Point Instance node in geometry nodes could only instance existing objects or collections. The reason was that large parts of Blender worked under the assumption that objects are the main unit of instancing. Now we also want to instance geometry within an object, so a slightly larger refactor was necessary. This should not affect files that do not use the new kind of instances. The main change is a redefinition of what "instanced data" is. Now, an instances is a cow-object + object-data (the geometry). This can be nicely seen in `struct DupliObject`. This allows the same object to generate multiple geometries of different types which can be instanced individually. A nice side effect of this refactor is that having multiple geometry components is not a special case in the depsgraph object iterator anymore, because those components are integrated with the `DupliObject` system. Unfortunately, different systems that work with instances in Blender (e.g. render engines and exporters) often work under the assumption that objects are the main unit of instancing. So those have to be updated as well to be able to handle the new instances. This patch updates Cycles, EEVEE and other viewport engines. Exporters have not been updated yet. Some minimal (not master-ready) changes to update the obj and alembic exporters can be found in P2336 and P2335. Different file formats may want to handle these new instances in different ways. For users, the only thing that changed is that the Point Instance node now has a geometry mode. This also fixes T88454. Differential Revision: https://developer.blender.org/D11841
70 lines
2.0 KiB
C++
70 lines
2.0 KiB
C++
/*
|
|
* 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
|
|
* of the License, or (at your option) any later version.
|
|
*
|
|
* 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,
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
*
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
* All rights reserved.
|
|
*/
|
|
#pragma once
|
|
|
|
/** \file
|
|
* \ingroup bke
|
|
*/
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
struct Depsgraph;
|
|
struct ListBase;
|
|
struct Object;
|
|
struct ParticleSystem;
|
|
struct Scene;
|
|
struct ID;
|
|
|
|
/* ---------------------------------------------------- */
|
|
/* Dupli-Geometry */
|
|
|
|
struct ListBase *object_duplilist(struct Depsgraph *depsgraph,
|
|
struct Scene *sce,
|
|
struct Object *ob);
|
|
void free_object_duplilist(struct ListBase *lb);
|
|
|
|
typedef struct DupliObject {
|
|
struct DupliObject *next, *prev;
|
|
/* Object whose geometry is instanced. */
|
|
struct Object *ob;
|
|
/* Data owned by the object above that is instanced. This might not be the same as `ob->data`. */
|
|
struct ID *ob_data;
|
|
float mat[4][4];
|
|
float orco[3], uv[2];
|
|
|
|
short type; /* from Object.transflag */
|
|
char no_draw;
|
|
|
|
/* Persistent identifier for a dupli object, for inter-frame matching of
|
|
* objects with motion blur, or inter-update matching for syncing. */
|
|
int persistent_id[8]; /* MAX_DUPLI_RECUR */
|
|
|
|
/* Particle this dupli was generated from. */
|
|
struct ParticleSystem *particle_system;
|
|
|
|
/* Random ID for shading */
|
|
unsigned int random_id;
|
|
} DupliObject;
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|