2011-10-23 17:52:20 +00:00
|
|
|
/*
|
2011-09-05 21:01:50 +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
|
2012-10-15 23:11:59 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2011-09-05 21:01:50 +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,
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2007 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*/
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
* \ingroup nodes
|
2011-09-05 21:01:50 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "DNA_texture_types.h"
|
|
|
|
#include "DNA_node_types.h"
|
2013-03-18 16:34:57 +00:00
|
|
|
#include "DNA_space_types.h"
|
2011-09-05 21:01:50 +00:00
|
|
|
|
|
|
|
#include "BLI_listbase.h"
|
|
|
|
#include "BLI_threads.h"
|
|
|
|
#include "BLI_utildefines.h"
|
|
|
|
|
2015-08-16 17:32:01 +10:00
|
|
|
#include "BLT_translation.h"
|
2011-11-09 15:00:11 +00:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
#include "BKE_context.h"
|
2014-07-16 13:36:39 +09:00
|
|
|
#include "BKE_linestyle.h"
|
2011-09-05 21:01:50 +00:00
|
|
|
#include "BKE_node.h"
|
2013-03-18 16:34:57 +00:00
|
|
|
#include "BKE_paint.h"
|
2011-09-05 21:01:50 +00:00
|
|
|
|
2012-08-06 18:49:28 +00:00
|
|
|
#include "node_common.h"
|
2011-09-05 21:01:50 +00:00
|
|
|
#include "node_exec.h"
|
|
|
|
#include "node_util.h"
|
|
|
|
#include "NOD_texture.h"
|
|
|
|
#include "node_texture_util.h"
|
|
|
|
|
2018-02-06 17:28:00 +11:00
|
|
|
#include "DEG_depsgraph.h"
|
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
#include "RNA_access.h"
|
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
#include "RE_shader_ext.h"
|
|
|
|
|
2018-02-06 17:28:00 +11:00
|
|
|
static void texture_get_from_context(
|
|
|
|
const bContext *C, bNodeTreeType *UNUSED(treetype), bNodeTree **r_ntree, ID **r_id, ID **r_from)
|
2011-09-05 21:01:50 +00:00
|
|
|
{
|
2013-03-18 16:34:57 +00:00
|
|
|
SpaceNode *snode = CTX_wm_space_node(C);
|
|
|
|
Scene *scene = CTX_data_scene(C);
|
2017-11-22 10:52:39 -02:00
|
|
|
ViewLayer *view_layer = CTX_data_view_layer(C);
|
|
|
|
Object *ob = OBACT(view_layer);
|
2013-03-18 16:34:57 +00:00
|
|
|
Tex *tx = NULL;
|
|
|
|
|
Remove Blender Internal and legacy viewport from Blender 2.8.
Brecht authored this commit, but he gave me the honours to actually
do it. Here it goes; Blender Internal. Bye bye, you did great!
* Point density, voxel data, ocean, environment map textures were removed,
as these only worked within BI rendering. Note that the ocean modifier
and the Cycles point density shader node continue to work.
* Dynamic paint using material shading was removed, as this only worked
with BI. If we ever wanted to support this again probably it should go
through the baking API.
* GPU shader export through the Python API was removed. This only worked
for the old BI GLSL shaders, which no longer exists. Doing something
similar for Eevee would be significantly more complicated because it
uses a lot of multiplass rendering and logic outside the shader, it's
probably impractical.
* Collada material import / export code is mostly gone, as it only worked
for BI materials. We need to add Cycles / Eevee material support at some
point.
* The mesh noise operator was removed since it only worked with BI
material texture slots. A displacement modifier can be used instead.
* The delete texture paint slot operator was removed since it only worked
for BI material texture slots. Could be added back with node support.
* Not all legacy viewport features are supported in the new viewport, but
their code was removed. If we need to bring anything back we can look at
older git revisions.
* There is some legacy viewport code that I could not remove yet, and some
that I probably missed.
* Shader node execution code was left mostly intact, even though it is not
used anywhere now. We may eventually use this to replace the texture
nodes with Cycles / Eevee shader nodes.
* The Cycles Bake panel now includes settings for baking multires normal
and displacement maps. The underlying code needs to be merged properly,
and we plan to add back support for multires AO baking and add support
to Cycles baking for features like vertex color, displacement, and other
missing baking features.
* This commit removes DNA and the Python API for BI material, lamp, world
and scene settings. This breaks a lot of addons.
* There is more DNA that can be removed or renamed, where Cycles or Eevee
are reusing some old BI properties but the names are not really correct
anymore.
* Texture slots for materials, lamps and world were removed. They remain
for brushes, particles and freestyle linestyles.
* 'BLENDER_RENDER' remains in the COMPAT_ENGINES of UI panels. Cycles and
other renderers use this to find all panels to show, minus a few panels
that they have their own replacement for.
2018-04-19 17:34:44 +02:00
|
|
|
if (snode->texfrom == SNODE_TEX_BRUSH) {
|
2013-03-18 16:34:57 +00:00
|
|
|
struct Brush *brush = NULL;
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2018-04-05 18:20:27 +02:00
|
|
|
if (ob && (ob->mode & OB_MODE_SCULPT))
|
Paint refactoring commit, non-disruptive (in theory :p)
* Fix precision overflow issue with overlay previews,
* Expose alpha mask mapping to UI (still not functional but coming soon).
* More overlay refactoring:
Overlay now does minimal checking for texture refresh.
Instead, we now have invalidation flags to set an aspect of the brush
overlay as invalid. This is necessary because this way we will be able to
separate and preview different brush attributes on the overlays, using
different textures:
These attributes/aspects are:
Primary texture (main texture for sculpt, vertex, imapaint)
Secondary texture (mask/alpha texture for imapaint)
Cursor texture (cursor texture. It involves brush strength and curves)
Modified the relevant RNA property update functions and C update callback
functions to call the relevant cursor invalidation functions instead
of checking every frame for multiple properties.
Properties that affect this are:
Image changes, if image is used by current brush,
Texture slot changes, similarly
Curve changes,
Object mode change invalidates the cursor
Paint tool change invalidates the cursor.
These changes give slightly more invalidation cases than simply
comparing the relevant properties each frame, but these do not occur in
performance critical moments and it's a much more elegant system than
adding more variables to check per frame each time we add something on
the system.
2013-04-12 17:21:31 +00:00
|
|
|
brush = BKE_paint_brush(&scene->toolsettings->sculpt->paint);
|
2013-03-18 16:34:57 +00:00
|
|
|
else
|
Paint refactoring commit, non-disruptive (in theory :p)
* Fix precision overflow issue with overlay previews,
* Expose alpha mask mapping to UI (still not functional but coming soon).
* More overlay refactoring:
Overlay now does minimal checking for texture refresh.
Instead, we now have invalidation flags to set an aspect of the brush
overlay as invalid. This is necessary because this way we will be able to
separate and preview different brush attributes on the overlays, using
different textures:
These attributes/aspects are:
Primary texture (main texture for sculpt, vertex, imapaint)
Secondary texture (mask/alpha texture for imapaint)
Cursor texture (cursor texture. It involves brush strength and curves)
Modified the relevant RNA property update functions and C update callback
functions to call the relevant cursor invalidation functions instead
of checking every frame for multiple properties.
Properties that affect this are:
Image changes, if image is used by current brush,
Texture slot changes, similarly
Curve changes,
Object mode change invalidates the cursor
Paint tool change invalidates the cursor.
These changes give slightly more invalidation cases than simply
comparing the relevant properties each frame, but these do not occur in
performance critical moments and it's a much more elegant system than
adding more variables to check per frame each time we add something on
the system.
2013-04-12 17:21:31 +00:00
|
|
|
brush = BKE_paint_brush(&scene->toolsettings->imapaint.paint);
|
2013-03-18 16:34:57 +00:00
|
|
|
|
|
|
|
if (brush) {
|
|
|
|
*r_from = (ID *)brush;
|
|
|
|
tx = give_current_brush_texture(brush);
|
|
|
|
if (tx) {
|
|
|
|
*r_id = &tx->id;
|
|
|
|
*r_ntree = tx->nodetree;
|
2014-05-03 18:51:53 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (snode->texfrom == SNODE_TEX_LINESTYLE) {
|
2018-04-24 15:20:17 +02:00
|
|
|
FreestyleLineStyle *linestyle = BKE_linestyle_active_from_view_layer(view_layer);
|
2014-05-03 18:51:53 +09:00
|
|
|
if (linestyle) {
|
|
|
|
*r_from = (ID *)linestyle;
|
|
|
|
tx = give_current_linestyle_texture(linestyle);
|
|
|
|
if (tx) {
|
|
|
|
*r_id = &tx->id;
|
|
|
|
*r_ntree = tx->nodetree;
|
2013-03-18 16:34:57 +00:00
|
|
|
}
|
2011-09-05 21:01:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-17 13:35:05 +02:00
|
|
|
static void foreach_nodeclass(Scene *UNUSED(scene), void *calldata, bNodeClassCallback func)
|
2011-11-07 22:14:48 +00:00
|
|
|
{
|
2012-05-16 15:01:46 +00:00
|
|
|
func(calldata, NODE_CLASS_INPUT, N_("Input"));
|
|
|
|
func(calldata, NODE_CLASS_OUTPUT, N_("Output"));
|
|
|
|
func(calldata, NODE_CLASS_OP_COLOR, N_("Color"));
|
|
|
|
func(calldata, NODE_CLASS_PATTERN, N_("Patterns"));
|
|
|
|
func(calldata, NODE_CLASS_TEXTURE, N_("Textures"));
|
|
|
|
func(calldata, NODE_CLASS_CONVERTOR, N_("Convertor"));
|
|
|
|
func(calldata, NODE_CLASS_DISTORT, N_("Distort"));
|
|
|
|
func(calldata, NODE_CLASS_GROUP, N_("Group"));
|
2013-03-18 16:34:57 +00:00
|
|
|
func(calldata, NODE_CLASS_INTERFACE, N_("Interface"));
|
2012-05-16 15:01:46 +00:00
|
|
|
func(calldata, NODE_CLASS_LAYOUT, N_("Layout"));
|
2011-11-07 22:14:48 +00:00
|
|
|
}
|
|
|
|
|
2014-08-12 12:41:26 +02:00
|
|
|
/* XXX muting disabled in previews because of threading issues with the main execution
|
|
|
|
* it works here, but disabled for consistency
|
|
|
|
*/
|
2014-09-17 18:27:05 +02:00
|
|
|
#if 1
|
2012-02-27 17:38:16 +00:00
|
|
|
static void localize(bNodeTree *localtree, bNodeTree *UNUSED(ntree))
|
|
|
|
{
|
|
|
|
bNode *node, *node_next;
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2012-06-01 12:38:03 +00:00
|
|
|
/* replace muted nodes and reroute nodes by internal links */
|
2012-09-03 02:41:12 +00:00
|
|
|
for (node = localtree->nodes.first; node; node = node_next) {
|
2012-02-27 17:38:16 +00:00
|
|
|
node_next = node->next;
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2012-06-01 12:38:03 +00:00
|
|
|
if (node->flag & NODE_MUTED || node->type == NODE_REROUTE) {
|
2012-02-27 17:38:16 +00:00
|
|
|
nodeInternalRelink(localtree, node);
|
2019-03-16 18:54:00 +01:00
|
|
|
ntreeFreeLocalNode(localtree, node);
|
2012-02-27 17:38:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-08-12 12:41:26 +02:00
|
|
|
#else
|
|
|
|
static void localize(bNodeTree *UNUSED(localtree), bNodeTree *UNUSED(ntree))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
#endif
|
2012-02-27 17:38:16 +00:00
|
|
|
|
2013-03-22 10:34:52 +00:00
|
|
|
static void local_sync(bNodeTree *localtree, bNodeTree *ntree)
|
2011-09-05 21:01:50 +00:00
|
|
|
{
|
2013-03-22 10:34:52 +00:00
|
|
|
BKE_node_preview_sync_tree(ntree, localtree);
|
|
|
|
}
|
|
|
|
|
2018-06-11 15:40:37 +02:00
|
|
|
static void local_merge(Main *UNUSED(bmain), bNodeTree *localtree, bNodeTree *ntree)
|
2013-03-22 10:34:52 +00:00
|
|
|
{
|
|
|
|
BKE_node_preview_merge_tree(ntree, localtree, true);
|
2011-09-05 21:01:50 +00:00
|
|
|
}
|
|
|
|
|
2012-08-06 18:49:28 +00:00
|
|
|
static void update(bNodeTree *ntree)
|
|
|
|
{
|
|
|
|
ntree_update_reroute_nodes(ntree);
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
if (ntree->update & NTREE_UPDATE_NODES) {
|
|
|
|
/* clean up preview cache, in case nodes have been removed */
|
|
|
|
BKE_node_preview_remove_unused(ntree);
|
|
|
|
}
|
2012-08-06 18:49:28 +00:00
|
|
|
}
|
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
bNodeTreeType *ntreeType_Texture;
|
|
|
|
|
2013-03-18 18:25:05 +00:00
|
|
|
void register_node_tree_type_tex(void)
|
2013-03-18 16:34:57 +00:00
|
|
|
{
|
|
|
|
bNodeTreeType *tt = ntreeType_Texture = MEM_callocN(sizeof(bNodeTreeType), "texture node tree type");
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
tt->type = NTREE_TEXTURE;
|
|
|
|
strcpy(tt->idname, "TextureNodeTree");
|
2019-02-13 16:18:19 +01:00
|
|
|
strcpy(tt->ui_name, N_("Texture Node Editor"));
|
2013-05-27 08:04:07 +00:00
|
|
|
tt->ui_icon = 0; /* defined in drawnode.c */
|
2019-02-13 16:18:19 +01:00
|
|
|
strcpy(tt->ui_description, N_("Texture nodes"));
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
tt->foreach_nodeclass = foreach_nodeclass;
|
|
|
|
tt->update = update;
|
|
|
|
tt->localize = localize;
|
|
|
|
tt->local_sync = local_sync;
|
2013-03-22 10:34:52 +00:00
|
|
|
tt->local_merge = local_merge;
|
2013-03-18 16:34:57 +00:00
|
|
|
tt->get_from_context = texture_get_from_context;
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
tt->ext.srna = &RNA_TextureNodeTree;
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
ntreeTypeAdd(tt);
|
|
|
|
}
|
2011-09-05 21:01:50 +00:00
|
|
|
|
|
|
|
int ntreeTexTagAnimated(bNodeTree *ntree)
|
|
|
|
{
|
|
|
|
bNode *node;
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2012-09-03 02:41:12 +00:00
|
|
|
if (ntree == NULL) return 0;
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2012-09-03 02:41:12 +00:00
|
|
|
for (node = ntree->nodes.first; node; node = node->next) {
|
|
|
|
if (node->type == TEX_NODE_CURVE_TIME) {
|
2011-10-19 17:08:35 +00:00
|
|
|
nodeUpdate(ntree, node);
|
2011-09-05 21:01:50 +00:00
|
|
|
return 1;
|
|
|
|
}
|
2012-09-03 02:41:12 +00:00
|
|
|
else if (node->type == NODE_GROUP) {
|
|
|
|
if (ntreeTexTagAnimated((bNodeTree *)node->id) ) {
|
2011-09-05 21:01:50 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
bNodeTreeExec *ntreeTexBeginExecTree_internal(bNodeExecContext *context, bNodeTree *ntree, bNodeInstanceKey parent_key)
|
2011-09-05 21:01:50 +00:00
|
|
|
{
|
|
|
|
bNodeTreeExec *exec;
|
|
|
|
bNode *node;
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
/* common base initialization */
|
2013-03-18 16:34:57 +00:00
|
|
|
exec = ntree_exec_begin(context, ntree, parent_key);
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
/* allocate the thread stack listbase array */
|
2015-06-08 13:46:33 +02:00
|
|
|
exec->threadstack = MEM_callocN(BLENDER_MAX_THREADS * sizeof(ListBase), "thread stack array");
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2012-09-03 02:41:12 +00:00
|
|
|
for (node = exec->nodetree->nodes.first; node; node = node->next)
|
|
|
|
node->need_exec = 1;
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
return exec;
|
|
|
|
}
|
|
|
|
|
|
|
|
bNodeTreeExec *ntreeTexBeginExecTree(bNodeTree *ntree)
|
|
|
|
{
|
|
|
|
bNodeExecContext context;
|
|
|
|
bNodeTreeExec *exec;
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
/* XXX hack: prevent exec data from being generated twice.
|
|
|
|
* this should be handled by the renderer!
|
|
|
|
*/
|
|
|
|
if (ntree->execdata)
|
|
|
|
return ntree->execdata;
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
context.previews = ntree->previews;
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
exec = ntreeTexBeginExecTree_internal(&context, ntree, NODE_INSTANCE_KEY_BASE);
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
/* XXX this should not be necessary, but is still used for cmp/sha/tex nodes,
|
|
|
|
* which only store the ntree pointer. Should be fixed at some point!
|
|
|
|
*/
|
|
|
|
ntree->execdata = exec;
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
return exec;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* free texture delegates */
|
|
|
|
static void tex_free_delegates(bNodeTreeExec *exec)
|
|
|
|
{
|
|
|
|
bNodeThreadStack *nts;
|
|
|
|
bNodeStack *ns;
|
|
|
|
int th, a;
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2015-06-08 13:46:33 +02:00
|
|
|
for (th = 0; th < BLENDER_MAX_THREADS; th++)
|
2012-09-03 02:41:12 +00:00
|
|
|
for (nts = exec->threadstack[th].first; nts; nts = nts->next)
|
|
|
|
for (ns = nts->stack, a = 0; a < exec->stacksize; a++, ns++)
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ns->data && !ns->is_copy)
|
2011-09-05 21:01:50 +00:00
|
|
|
MEM_freeN(ns->data);
|
|
|
|
}
|
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
void ntreeTexEndExecTree_internal(bNodeTreeExec *exec)
|
2011-09-05 21:01:50 +00:00
|
|
|
{
|
2013-03-18 16:34:57 +00:00
|
|
|
bNodeThreadStack *nts;
|
|
|
|
int a;
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
if (exec->threadstack) {
|
|
|
|
tex_free_delegates(exec);
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2015-06-08 13:46:33 +02:00
|
|
|
for (a = 0; a < BLENDER_MAX_THREADS; a++) {
|
2013-03-18 16:34:57 +00:00
|
|
|
for (nts = exec->threadstack[a].first; nts; nts = nts->next)
|
|
|
|
if (nts->stack) MEM_freeN(nts->stack);
|
|
|
|
BLI_freelistN(&exec->threadstack[a]);
|
2011-09-05 21:01:50 +00:00
|
|
|
}
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
MEM_freeN(exec->threadstack);
|
|
|
|
exec->threadstack = NULL;
|
|
|
|
}
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
ntree_exec_end(exec);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ntreeTexEndExecTree(bNodeTreeExec *exec)
|
|
|
|
{
|
|
|
|
if (exec) {
|
2013-07-27 08:21:43 +00:00
|
|
|
/* exec may get freed, so assign ntree */
|
|
|
|
bNodeTree *ntree = exec->nodetree;
|
2013-03-18 16:34:57 +00:00
|
|
|
ntreeTexEndExecTree_internal(exec);
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
/* XXX clear nodetree backpointer to exec data, same problem as noted in ntreeBeginExecTree */
|
2013-07-27 08:21:43 +00:00
|
|
|
ntree->execdata = NULL;
|
2011-09-05 21:01:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int ntreeTexExecTree(
|
2012-10-15 23:11:59 +00:00
|
|
|
bNodeTree *nodes,
|
|
|
|
TexResult *texres,
|
|
|
|
float co[3],
|
|
|
|
float dxt[3], float dyt[3],
|
|
|
|
int osatex,
|
|
|
|
const short thread,
|
|
|
|
Tex *UNUSED(tex),
|
|
|
|
short which_output,
|
|
|
|
int cfra,
|
|
|
|
int preview,
|
|
|
|
MTex *mtex)
|
|
|
|
{
|
2011-09-05 21:01:50 +00:00
|
|
|
TexCallData data;
|
2012-09-03 02:41:12 +00:00
|
|
|
float *nor = texres->nor;
|
2011-09-05 21:01:50 +00:00
|
|
|
int retval = TEX_INT;
|
|
|
|
bNodeThreadStack *nts = NULL;
|
2012-09-03 02:41:12 +00:00
|
|
|
bNodeTreeExec *exec = nodes->execdata;
|
2011-09-05 21:01:50 +00:00
|
|
|
|
|
|
|
data.co = co;
|
|
|
|
data.dxt = dxt;
|
|
|
|
data.dyt = dyt;
|
|
|
|
data.osatex = osatex;
|
|
|
|
data.target = texres;
|
|
|
|
data.do_preview = preview;
|
Remove Blender Internal and legacy viewport from Blender 2.8.
Brecht authored this commit, but he gave me the honours to actually
do it. Here it goes; Blender Internal. Bye bye, you did great!
* Point density, voxel data, ocean, environment map textures were removed,
as these only worked within BI rendering. Note that the ocean modifier
and the Cycles point density shader node continue to work.
* Dynamic paint using material shading was removed, as this only worked
with BI. If we ever wanted to support this again probably it should go
through the baking API.
* GPU shader export through the Python API was removed. This only worked
for the old BI GLSL shaders, which no longer exists. Doing something
similar for Eevee would be significantly more complicated because it
uses a lot of multiplass rendering and logic outside the shader, it's
probably impractical.
* Collada material import / export code is mostly gone, as it only worked
for BI materials. We need to add Cycles / Eevee material support at some
point.
* The mesh noise operator was removed since it only worked with BI
material texture slots. A displacement modifier can be used instead.
* The delete texture paint slot operator was removed since it only worked
for BI material texture slots. Could be added back with node support.
* Not all legacy viewport features are supported in the new viewport, but
their code was removed. If we need to bring anything back we can look at
older git revisions.
* There is some legacy viewport code that I could not remove yet, and some
that I probably missed.
* Shader node execution code was left mostly intact, even though it is not
used anywhere now. We may eventually use this to replace the texture
nodes with Cycles / Eevee shader nodes.
* The Cycles Bake panel now includes settings for baking multires normal
and displacement maps. The underlying code needs to be merged properly,
and we plan to add back support for multires AO baking and add support
to Cycles baking for features like vertex color, displacement, and other
missing baking features.
* This commit removes DNA and the Python API for BI material, lamp, world
and scene settings. This breaks a lot of addons.
* There is more DNA that can be removed or renamed, where Cycles or Eevee
are reusing some old BI properties but the names are not really correct
anymore.
* Texture slots for materials, lamps and world were removed. They remain
for brushes, particles and freestyle linestyles.
* 'BLENDER_RENDER' remains in the COMPAT_ENGINES of UI panels. Cycles and
other renderers use this to find all panels to show, minus a few panels
that they have their own replacement for.
2018-04-19 17:34:44 +02:00
|
|
|
data.do_manage = true;
|
2011-09-05 21:01:50 +00:00
|
|
|
data.thread = thread;
|
|
|
|
data.which_output = which_output;
|
2012-09-03 02:41:12 +00:00
|
|
|
data.cfra = cfra;
|
|
|
|
data.mtex = mtex;
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2011-10-31 17:00:59 +00:00
|
|
|
/* ensure execdata is only initialized once */
|
|
|
|
if (!exec) {
|
2018-02-16 01:13:46 +11:00
|
|
|
BLI_thread_lock(LOCK_NODES);
|
2012-03-24 06:38:07 +00:00
|
|
|
if (!nodes->execdata)
|
2013-03-18 16:34:57 +00:00
|
|
|
ntreeTexBeginExecTree(nodes);
|
2018-02-16 01:13:46 +11:00
|
|
|
BLI_thread_unlock(LOCK_NODES);
|
2011-10-31 17:00:59 +00:00
|
|
|
|
2012-09-03 02:41:12 +00:00
|
|
|
exec = nodes->execdata;
|
2011-10-31 17:00:59 +00:00
|
|
|
}
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2012-09-03 02:41:12 +00:00
|
|
|
nts = ntreeGetThreadStack(exec, thread);
|
2011-09-05 21:01:50 +00:00
|
|
|
ntreeExecThreadNodes(exec, nts, &data, thread);
|
|
|
|
ntreeReleaseThreadStack(nts);
|
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (texres->nor) retval |= TEX_NOR;
|
2011-09-05 21:01:50 +00:00
|
|
|
retval |= TEX_RGB;
|
|
|
|
/* confusing stuff; the texture output node sets this to NULL to indicate no normal socket was set
|
2012-06-30 22:49:33 +00:00
|
|
|
* however, the texture code checks this for other reasons (namely, a normal is required for material) */
|
2012-09-03 02:41:12 +00:00
|
|
|
texres->nor = nor;
|
2011-09-05 21:01:50 +00:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|