forked from bartvdbraak/blender
Massive Code cleanup:
* Remove all code for Texture and Sequencer plugin system, this never worked in 2.5x / 2.6x and is therefore not needed anymore. * DNA structures are kept, all read/writefile code is gone.
This commit is contained in:
parent
df8880a81f
commit
16117143d8
@ -1,36 +0,0 @@
|
||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# The Original Code is: all of this file.
|
||||
#
|
||||
# Contributor(s): none yet.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
all: textures sequences
|
||||
|
||||
textures:
|
||||
$(MAKE) -C texture
|
||||
|
||||
sequences:
|
||||
$(MAKE) -C sequence
|
||||
|
||||
clean:
|
||||
$(MAKE) -C texture clean
|
||||
$(MAKE) -C sequence clean
|
@ -1,141 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# The Original Code is: all of this file.
|
||||
#
|
||||
# Contributor(s): none yet.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
# detect the system
|
||||
|
||||
UNAME=`uname`
|
||||
EXT="so";
|
||||
if ( test "WIN32" = "$TARGET" ) then
|
||||
CC="gcc";
|
||||
CFLAGS="-funsigned-char -O2";
|
||||
|
||||
LD="ld";
|
||||
LDFLAGS="-Bshareable -lm";
|
||||
elif ( test $UNAME = "IRIX64" -o $UNAME = "IRIX" ) then
|
||||
CC="cc";
|
||||
CFLAGS="-KPIC -O2 -mips3";
|
||||
|
||||
LD="ld";
|
||||
LDFLAGS="-shared -U";
|
||||
elif ( test $UNAME = "FreeBSD" ) then
|
||||
CC="gcc";
|
||||
CFLAGS="-fPIC -funsigned-char -O2";
|
||||
|
||||
LD="ld";
|
||||
LDFLAGS="-Bshareable";
|
||||
elif ( test $UNAME = "OpenBSD" ) then
|
||||
CC="gcc";
|
||||
CFLAGS="-fPIC -funsigned-char -O2";
|
||||
|
||||
LD="ld";
|
||||
LDFLAGS="-Bshareable";
|
||||
elif ( test $UNAME = "Linux" ) then
|
||||
CC="gcc";
|
||||
CFLAGS="-fPIC -funsigned-char -O2";
|
||||
|
||||
LD="ld";
|
||||
LDFLAGS="-Bshareable";
|
||||
elif ( test $UNAME = "SunOS" ) then
|
||||
CC="cc";
|
||||
CFLAGS="-O";
|
||||
|
||||
LD="ld";
|
||||
LDFLAGS="-r";
|
||||
elif ( test $UNAME = "Darwin" ) then
|
||||
CC="cc";
|
||||
CFLAGS="-fPIC -funsigned-char -O2 -fno-common";
|
||||
LD="cc";
|
||||
LDFLAGS="-flat_namespace -bundle -bundle_loader ../../blender.app/Contents/MacOS/blender -lm";
|
||||
EXT="so";
|
||||
fi
|
||||
|
||||
if ( test "$#" = "1" ) then
|
||||
if ( test -f $1 ) then
|
||||
BASE_FILE=`echo $1 | sed -e "1 s/\.c//g"`;
|
||||
else
|
||||
BASE_FILE=$1;
|
||||
fi
|
||||
|
||||
CFILE="$BASE_FILE.c"
|
||||
OFILE="$BASE_FILE.o"
|
||||
SOFILE="$BASE_FILE.$EXT"
|
||||
else
|
||||
if ( test -f $1$2 ) then
|
||||
BASE_FILE=`echo $2 | sed -e "1 s/\.c//g"`;
|
||||
else
|
||||
BASE_FILE=$2;
|
||||
fi
|
||||
|
||||
CFILE="$1$BASE_FILE.c"
|
||||
if (test "$TARGET" = "WIN32" ) then
|
||||
DLLFILE="$BASE_FILE.dll";
|
||||
fi
|
||||
OFILE="$BASE_FILE.o"
|
||||
SOFILE="$BASE_FILE.$EXT"
|
||||
fi
|
||||
|
||||
INCLUDES=
|
||||
if ( test -f plugin.h ) then
|
||||
INCLUDES=-I.;
|
||||
elif ( test -f "include/plugin.h" ) then
|
||||
INCLUDES=-Iinclude/
|
||||
elif ( test -f "../plugin.h" ) then
|
||||
INCLUDES=-I..;
|
||||
elif ( test -f "../include/plugin.h" ) then
|
||||
INCLUDES=-I../include
|
||||
else
|
||||
echo "Couldn't find plugin.h";
|
||||
exit;
|
||||
fi
|
||||
|
||||
LIBM=`fgrep "#include <math.h>" $CFILE`
|
||||
LIBC=`fgrep "#include <std" $CFILE`
|
||||
|
||||
LIBS=
|
||||
|
||||
if ( test -n "$LIBM" ) then
|
||||
LIBS="$LIBS -lm";
|
||||
fi
|
||||
if ( test -n "$LIBC" ) then
|
||||
LIBS="$LIBS -lc";
|
||||
fi
|
||||
|
||||
echo "$CC $CFLAGS -c $CFILE $INCLUDES"
|
||||
$CC $CFLAGS -c $CFILE $INCLUDES
|
||||
|
||||
if ( test "$?" != "0") then
|
||||
echo "Compile error";
|
||||
exit;
|
||||
fi
|
||||
|
||||
echo "$LD $LDFLAGS $OFILE -o $SOFILE $LIBS"
|
||||
$LD $LDFLAGS $OFILE -o $SOFILE $LIBS
|
||||
|
||||
if ( test "$?" != "0") then
|
||||
echo "Link error";
|
||||
exit;
|
||||
fi
|
@ -1,32 +0,0 @@
|
||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# The Original Code is: all of this file.
|
||||
#
|
||||
# Contributor(s): none yet.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
all: plugins
|
||||
|
||||
plugins:
|
||||
@/bin/sh -c 'for i in *.c; do ../bmake $$i; done;'
|
||||
|
||||
clean:
|
||||
rm -rf *.o *.so
|
@ -1,284 +0,0 @@
|
||||
/**
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "plugin.h"
|
||||
|
||||
/* ******************** GLOBAL VARIABLES ***************** */
|
||||
|
||||
|
||||
char name[24] = "Blur";
|
||||
|
||||
/* structure for buttons,
|
||||
* butcode name default min max 0
|
||||
*/
|
||||
|
||||
VarStruct varstr[] = {
|
||||
LABEL, "Input: 1 strip", 0.0, 0.0, 0.0, "",
|
||||
NUMSLI | FLO, "Blur", 0.5, 0.0, 10.0, "Maximum filtersize",
|
||||
NUMSLI | FLO, "Gamma", 1.0, 0.4, 2.0, "Gamma correction",
|
||||
TOG | INT, "Animated", 0.0, 0.0, 1.0, "For (Ipo) animated blur",
|
||||
NUM | INT, "debug", 0.0, 0.0, 2.0,
|
||||
"0:off 1: show primary blur buffer 2: show 2nd blur buffer",
|
||||
|
||||
};
|
||||
|
||||
/* The cast struct is for input in the main doit function
|
||||
Varstr and Cast must have the same variables in the same order */
|
||||
|
||||
typedef struct Cast {
|
||||
int dummy; /* because of the 'label' button */
|
||||
float blur;
|
||||
float gamma;
|
||||
float use_ipo;
|
||||
int show;
|
||||
} Cast;
|
||||
|
||||
|
||||
/* cfra: the current frame */
|
||||
|
||||
float cfra;
|
||||
|
||||
void plugin_seq_doit(Cast *, float, float, int, int, ImBuf *, ImBuf *, ImBuf *, ImBuf *);
|
||||
|
||||
/* ******************** Fixed functions ***************** */
|
||||
|
||||
int plugin_seq_getversion(void)
|
||||
{
|
||||
return B_PLUGIN_VERSION;
|
||||
}
|
||||
|
||||
void plugin_but_changed(int but)
|
||||
{
|
||||
}
|
||||
|
||||
void plugin_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
void plugin_getinfo(PluginInfo *info)
|
||||
{
|
||||
info->name = name;
|
||||
info->nvars = sizeof(varstr) / sizeof(VarStruct);
|
||||
info->cfra = &cfra;
|
||||
|
||||
info->varstr = varstr;
|
||||
|
||||
info->init = plugin_init;
|
||||
info->seq_doit = (SeqDoit) plugin_seq_doit;
|
||||
info->callback = plugin_but_changed;
|
||||
}
|
||||
|
||||
|
||||
void blurbuf(struct ImBuf *ibuf, int nr, Cast *cast)
|
||||
{
|
||||
/* nr = number of blurs */
|
||||
/* the ibuf->rect is replaced */
|
||||
struct ImBuf *tbuf, *ttbuf;
|
||||
int i, x4;
|
||||
|
||||
tbuf = dupImBuf(ibuf);
|
||||
x4 = ibuf->x / 4;
|
||||
|
||||
/* This doesn't seem to work... paprmh */
|
||||
if (cast->gamma != 1.0) gamwarp(tbuf, cast->gamma);
|
||||
|
||||
/* reduce */
|
||||
for (i = 0; i < nr; i++) {
|
||||
ttbuf = onehalf(tbuf);
|
||||
if (ttbuf) {
|
||||
freeImBuf(tbuf);
|
||||
tbuf = ttbuf;
|
||||
}
|
||||
if (tbuf->x < 4 || tbuf->y < 4) break;
|
||||
}
|
||||
|
||||
/* enlarge */
|
||||
for (i = 0; i < nr; i++) {
|
||||
ttbuf = double_x(tbuf);
|
||||
if (ttbuf) {
|
||||
freeImBuf(tbuf);
|
||||
tbuf = ttbuf;
|
||||
}
|
||||
ttbuf = double_y(tbuf);
|
||||
if (ttbuf) {
|
||||
freeImBuf(tbuf);
|
||||
tbuf = ttbuf;
|
||||
}
|
||||
if (tbuf->x > x4) {
|
||||
scaleImBuf(tbuf, ibuf->x, ibuf->y);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* this doesn't seem to work...paprmh*/
|
||||
if (cast->gamma != 1.0) gamwarp(tbuf, 1.0 / cast->gamma);
|
||||
|
||||
if (ibuf->rect) memcpy(ibuf->rect, tbuf->rect, 4 * ibuf->x * ibuf->y);
|
||||
|
||||
if (ibuf->rect_float)
|
||||
memcpy(ibuf->rect_float, tbuf->rect_float, 4 * ibuf->x * ibuf->y * sizeof(float));
|
||||
|
||||
freeImBuf(tbuf);
|
||||
|
||||
}
|
||||
|
||||
void doblur(struct ImBuf *mbuf, float fac, Cast *cast)
|
||||
{
|
||||
/* make two filtered images, like a mipmap structure
|
||||
* fac is filtersize in pixels
|
||||
*/
|
||||
struct ImBuf *ibuf, *pbuf;
|
||||
float ifac, pfac, infac;
|
||||
int n, b1, b2;
|
||||
char *irect, *prect, *mrect;
|
||||
float *irectf, *prectf, *mrectf;
|
||||
|
||||
/* which buffers ? */
|
||||
|
||||
if (fac > 7.0) fac = 7.0;
|
||||
if (fac <= 1.0) return;
|
||||
|
||||
pfac = 2.0;
|
||||
pbuf = dupImBuf(mbuf);
|
||||
n = 1;
|
||||
while (pfac < fac) {
|
||||
blurbuf(pbuf, n, cast);
|
||||
blurbuf(pbuf, n, cast);
|
||||
|
||||
n++;
|
||||
pfac += 1.0;
|
||||
}
|
||||
|
||||
ifac = pfac;
|
||||
pfac -= 1.0;
|
||||
|
||||
ibuf = dupImBuf(pbuf);
|
||||
blurbuf(ibuf, n, cast);
|
||||
blurbuf(ibuf, n, cast);
|
||||
|
||||
fac = (fac - pfac) / (ifac - pfac);
|
||||
n = mbuf->x * mbuf->y;
|
||||
|
||||
if (cast->show) fac = cast->show - 1;
|
||||
|
||||
if (mbuf->rect_float) {
|
||||
if (fac >= 1) {
|
||||
memcpy(mbuf->rect_float, ibuf->rect_float, 4 * n * sizeof(float));
|
||||
}
|
||||
else if (fac <= 0) {
|
||||
memcpy(mbuf->rect_float, pbuf->rect_float, 4 * n * sizeof(float));
|
||||
}
|
||||
else { /* interpolate */
|
||||
infac = 1 - fac;
|
||||
|
||||
irectf = (float *)ibuf->rect_float;
|
||||
prectf = (float *)pbuf->rect_float;
|
||||
mrectf = (float *)mbuf->rect_float;
|
||||
while (n--) {
|
||||
mrectf[0] = irectf[0] * fac + prectf[0] * infac;
|
||||
mrectf[1] = irectf[1] * fac + prectf[1] * infac;
|
||||
mrectf[2] = irectf[2] * fac + prectf[2] * infac;
|
||||
mrectf[3] = irectf[3] * fac + prectf[3] * infac;
|
||||
mrectf += 4;
|
||||
irectf += 4;
|
||||
prectf += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (mbuf->rect) {
|
||||
b1 = (int)fac * 255.0;
|
||||
if (b1 > 255) b1 = 255;
|
||||
b2 = 255 - b1;
|
||||
|
||||
if (b1 == 255) {
|
||||
memcpy(mbuf->rect, ibuf->rect, 4 * n);
|
||||
}
|
||||
else if (b1 == 0) {
|
||||
memcpy(mbuf->rect, pbuf->rect, 4 * n);
|
||||
}
|
||||
else { /* interpolate */
|
||||
irect = (char *)ibuf->rect;
|
||||
prect = (char *)pbuf->rect;
|
||||
mrect = (char *)mbuf->rect;
|
||||
while (n--) {
|
||||
mrect[0] = (irect[0] * b1 + prect[0] * b2) >> 8;
|
||||
mrect[1] = (irect[1] * b1 + prect[1] * b2) >> 8;
|
||||
mrect[2] = (irect[2] * b1 + prect[2] * b2) >> 8;
|
||||
mrect[3] = (irect[3] * b1 + prect[3] * b2) >> 8;
|
||||
mrect += 4;
|
||||
irect += 4;
|
||||
prect += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
freeImBuf(ibuf);
|
||||
freeImBuf(pbuf);
|
||||
}
|
||||
|
||||
|
||||
void plugin_seq_doit(Cast *cast, float facf0, float facf1, int x, int y, ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *out, ImBuf *use)
|
||||
{
|
||||
float bfacf0, bfacf1;
|
||||
|
||||
if (cast->use_ipo == 0) {
|
||||
bfacf0 = bfacf1 = cast->blur + 1.0;
|
||||
}
|
||||
else {
|
||||
bfacf0 = (facf0 * 6.0) + 1.0;
|
||||
bfacf1 = (facf1 * 6.0) + 1.0;
|
||||
}
|
||||
|
||||
if (out->rect) memcpy(out->rect, ibuf1->rect, 4 * out->x * out->y);
|
||||
if (out->rect_float) memcpy(out->rect_float, ibuf1->rect_float, 4 * out->x * out->y * sizeof(float));
|
||||
|
||||
/****************I can't get this field code to work... works ok without...paprmh****************/
|
||||
|
||||
|
||||
/* it blurs interlaced, only tested with even fields */
|
||||
|
||||
/* de_interlace(out);*/
|
||||
/* otherwise scaling goes wrong */
|
||||
/* out->flags &= ~IB_fields;*/
|
||||
|
||||
doblur(out, bfacf0, cast); /*fieldA*/
|
||||
|
||||
/* if (out->rect)out->rect += out->x * out->y;
|
||||
if (out->rect_float)out->rect_float += out->x * out->y;
|
||||
|
||||
doblur(out, bfacf1, cast);*/ /*fieldB*/
|
||||
|
||||
/* if (out->rect)out->rect -= out->x * out->y;
|
||||
if (out->rect_float)out->rect_float -= out->x * out->y;
|
||||
out->flags |= IB_fields;
|
||||
|
||||
interlace(out);*/
|
||||
|
||||
}
|
||||
|
@ -1,299 +0,0 @@
|
||||
/*
|
||||
* Color Correction Plugin (YUV Version) 0.01
|
||||
*
|
||||
* Copyright (c) 2005 Peter Schlaile
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include "plugin.h"
|
||||
#include <stdio.h>
|
||||
|
||||
char name[] = "Color Correction";
|
||||
|
||||
VarStruct varstr[] = {
|
||||
{ NUMSLI | FLO, "St Y:", 0.0, -1.0, 1.0, "Setup Y"},
|
||||
{ NUMSLI | FLO, "Gn Y:", 1.0, 0.0, 10.0, "Gain Y"},
|
||||
{ NUMSLI | FLO, "Ga Y:", 1.0, 0.0, 10.0, "Gamma Y"},
|
||||
|
||||
{ NUMSLI | FLO, "Lo S:", 1.0, 0.0, 10.0, "Saturation Shadows"},
|
||||
{ NUMSLI | FLO, "Md S:", 1.0, 0.0, 10.0, "Saturation Midtones"},
|
||||
{ NUMSLI | FLO, "Hi S:", 1.0, 0.0, 10.0, "Saturation Highlights"},
|
||||
|
||||
{ NUMSLI | FLO, "MA S:", 1.0, 0.0, 10.0, "Master Saturation"},
|
||||
|
||||
{ NUMSLI | FLO, "Lo T:", 0.25, 0.0, 1.0,
|
||||
"Saturation Shadow Thres"},
|
||||
{ NUMSLI | FLO, "Hi T:", 0.75, 0.0, 1.0,
|
||||
"Saturation Highlights Thres"},
|
||||
{ TOG | INT, "Debug", 0.0, 0.0, 1.0,
|
||||
"Show curves as overlay"},
|
||||
};
|
||||
|
||||
typedef struct Cast {
|
||||
float setup_y;
|
||||
float gain_y;
|
||||
float gamma_y;
|
||||
float sat_shadows;
|
||||
float sat_midtones;
|
||||
float sat_highlights;
|
||||
|
||||
float master_sat;
|
||||
float lo_thres;
|
||||
float hi_thres;
|
||||
int debug;
|
||||
} Cast;
|
||||
|
||||
float cfra;
|
||||
|
||||
void plugin_seq_doit(Cast *, float, float, int, int, ImBuf *, ImBuf *, ImBuf *, ImBuf *);
|
||||
|
||||
int plugin_seq_getversion(void)
|
||||
{
|
||||
return B_PLUGIN_VERSION;
|
||||
}
|
||||
void plugin_but_changed(int but) {}
|
||||
void plugin_init() {}
|
||||
|
||||
void plugin_getinfo(PluginInfo *info)
|
||||
{
|
||||
info->name = name;
|
||||
info->nvars = sizeof(varstr) / sizeof(VarStruct);
|
||||
info->cfra = &cfra;
|
||||
|
||||
info->varstr = varstr;
|
||||
|
||||
info->init = plugin_init;
|
||||
info->seq_doit = (SeqDoit) plugin_seq_doit;
|
||||
info->callback = plugin_but_changed;
|
||||
}
|
||||
|
||||
static void hsv_to_rgb(double h, double s, double v,
|
||||
double *r, double *g, double *b)
|
||||
{
|
||||
int i;
|
||||
double f, w, q, t;
|
||||
|
||||
if (s == 0.0)
|
||||
s = 0.000001;
|
||||
|
||||
if (h == -1.0)
|
||||
{
|
||||
*r = v;
|
||||
*g = v;
|
||||
*b = v;
|
||||
}
|
||||
else {
|
||||
if (h == 360.0)
|
||||
h = 0.0;
|
||||
h = h / 60.0;
|
||||
i = (int) h;
|
||||
f = h - i;
|
||||
w = v * (1.0 - s);
|
||||
q = v * (1.0 - (s * f));
|
||||
t = v * (1.0 - (s * (1.0 - f)));
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
*r = v;
|
||||
*g = t;
|
||||
*b = w;
|
||||
break;
|
||||
case 1:
|
||||
*r = q;
|
||||
*g = v;
|
||||
*b = w;
|
||||
break;
|
||||
case 2:
|
||||
*r = w;
|
||||
*g = v;
|
||||
*b = t;
|
||||
break;
|
||||
case 3:
|
||||
*r = w;
|
||||
*g = q;
|
||||
*b = v;
|
||||
break;
|
||||
case 4:
|
||||
*r = t;
|
||||
*g = w;
|
||||
*b = v;
|
||||
break;
|
||||
case 5:
|
||||
*r = v;
|
||||
*g = w;
|
||||
*b = q;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void rgb_to_hsv(double r, double g, double b,
|
||||
double *h, double *s, double *v)
|
||||
{
|
||||
double max, min, delta;
|
||||
|
||||
max = r;
|
||||
if (g > max)
|
||||
max = g;
|
||||
if (b > max)
|
||||
max = b;
|
||||
|
||||
min = r;
|
||||
if (g < min)
|
||||
min = g;
|
||||
if (b < min)
|
||||
min = b;
|
||||
|
||||
*v = max;
|
||||
|
||||
if (max != 0.0)
|
||||
*s = (max - min) / max;
|
||||
else
|
||||
*s = 0.0;
|
||||
|
||||
if (*s == 0.0)
|
||||
*h = -1.0;
|
||||
else {
|
||||
delta = max - min;
|
||||
|
||||
if (r == max)
|
||||
*h = (g - b) / delta;
|
||||
else if (g == max)
|
||||
*h = 2.0 + (b - r) / delta;
|
||||
else if (b == max)
|
||||
*h = 4.0 + (r - g) / delta;
|
||||
|
||||
*h = *h * 60.0;
|
||||
|
||||
if (*h < 0.0)
|
||||
*h = *h + 360;
|
||||
}
|
||||
}
|
||||
|
||||
void plugin_seq_doit(Cast *cast, float facf0, float facf1, int width,
|
||||
int height, ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *out, ImBuf *use)
|
||||
{
|
||||
char *dest, *src1;
|
||||
int x, y, c;
|
||||
double gamma_table[256];
|
||||
double uv_table[256];
|
||||
float *destf = out->rect_float;
|
||||
float *src1f;
|
||||
|
||||
if (!ibuf1) return;
|
||||
|
||||
dest = (char *) out->rect;
|
||||
src1 = (char *) ibuf1->rect;
|
||||
src1f = ibuf1->rect_float;
|
||||
|
||||
for (y = 0; y < 256; y++) {
|
||||
float v = 1.0 * y / 255;
|
||||
v += cast->setup_y;
|
||||
v *= cast->gain_y;
|
||||
v = pow(v, cast->gamma_y);
|
||||
if (v > 1.0) {
|
||||
v = 1.0;
|
||||
}
|
||||
else if (v < 0.0) {
|
||||
v = 0.0;
|
||||
}
|
||||
gamma_table[y] = v * 255;
|
||||
}
|
||||
|
||||
for (y = 0; y < 256; y++) {
|
||||
float v = 1.0;
|
||||
v *= cast->master_sat;
|
||||
if (y < cast->lo_thres * 255) {
|
||||
v *= cast->sat_shadows;
|
||||
}
|
||||
else if (y > cast->hi_thres * 255) {
|
||||
v *= cast->sat_highlights;
|
||||
}
|
||||
else {
|
||||
v *= cast->sat_midtones;
|
||||
}
|
||||
uv_table[y] = v;
|
||||
}
|
||||
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
for (x = 0; x < width; x++) {
|
||||
double h, s, v, r, g, b;
|
||||
double fac;
|
||||
|
||||
if (ibuf1->rect_float) rgb_to_hsv(src1f[0], src1f[1],
|
||||
src1f[2], &h, &s, &v);
|
||||
else rgb_to_hsv((double) src1[0] / 255.0,
|
||||
(double) src1[1] / 255.0,
|
||||
(double) src1[2] / 255.0,
|
||||
&h, &s, &v);
|
||||
v = gamma_table[(int) (v * 255.0)] / 255.0;
|
||||
|
||||
fac = uv_table[(int) (255.0 * v)];
|
||||
|
||||
s *= fac;
|
||||
if (s >= 1.0) {
|
||||
s = 1.0;
|
||||
}
|
||||
hsv_to_rgb(h, s, v, &r, &g, &b);
|
||||
|
||||
if (out->rect_float) {
|
||||
destf[0] = r;
|
||||
destf[1] = g;
|
||||
destf[2] = b;
|
||||
destf = destf + 4;
|
||||
src1f += 4;
|
||||
}
|
||||
else {
|
||||
dest[0] = r * 255.0;
|
||||
dest[1] = g * 255.0;
|
||||
dest[2] = b * 255.0;
|
||||
dest += 4;
|
||||
}
|
||||
|
||||
src1 += 4;
|
||||
}
|
||||
}
|
||||
|
||||
if (cast->debug) {
|
||||
dest = (char *) out->rect;
|
||||
for (c = 0; c < 10; c++) {
|
||||
x = 0;
|
||||
for (y = 0; y < 256; y++) {
|
||||
char val = gamma_table[y];
|
||||
while (x < y * width / 255) {
|
||||
*dest++ = val;
|
||||
*dest++ = val;
|
||||
*dest++ = val;
|
||||
dest++;
|
||||
x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (c = 0; c < 10; c++) {
|
||||
x = 0;
|
||||
for (y = 0; y < 256; y++) {
|
||||
char val = uv_table[y] * 255.0 / 10.0;
|
||||
while (x < y * width / 255) {
|
||||
*dest++ = val;
|
||||
*dest++ = val;
|
||||
*dest++ = val;
|
||||
dest++;
|
||||
x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,239 +0,0 @@
|
||||
/*
|
||||
* Color Correction Plugin (YUV Version) 0.01
|
||||
*
|
||||
* Copyright (c) 2005 Peter Schlaile
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include "plugin.h"
|
||||
#include <stdio.h>
|
||||
|
||||
char name[]= "Color Correction";
|
||||
|
||||
VarStruct varstr[]= {
|
||||
{ NUMSLI|FLO, "St Y:", 0.0, -1.0, 1.0, "Setup Y"},
|
||||
{ NUMSLI|FLO, "Gn Y:", 1.0, 0.0, 10.0,"Gain Y"},
|
||||
{ NUMSLI|FLO, "Ga Y:", 1.0, 0.0, 10.0, "Gamma Y"},
|
||||
|
||||
{ NUMSLI|FLO, "Lo S:", 1.0, 0.0, 10.0,"Saturation Shadows"},
|
||||
{ NUMSLI|FLO, "Md S:", 1.0, 0.0, 10.0,"Saturation Midtones"},
|
||||
{ NUMSLI|FLO, "Hi S:", 1.0, 0.0, 10.0,"Saturation Highlights"},
|
||||
|
||||
{ NUMSLI|FLO, "MA S:", 1.0, 0.0, 10.0,"Master Saturation"},
|
||||
{ NUMSLI|FLO, "Lo T:", 0.25, 0.0, 1.0,
|
||||
"Saturation Shadow Thres"},
|
||||
{ NUMSLI|FLO, "Hi T:", 0.75, 0.0, 1.0,
|
||||
"Saturation Highlights Thres"},
|
||||
{ TOG|INT, "Debug", 0.0, 0.0, 1.0,
|
||||
"Show curves as overlay"},
|
||||
};
|
||||
|
||||
typedef struct Cast {
|
||||
float setup_y;
|
||||
float gain_y;
|
||||
float gamma_y;
|
||||
|
||||
float sat_shadows;
|
||||
float sat_midtones;
|
||||
float sat_highlights;
|
||||
|
||||
float master_sat;
|
||||
float lo_thres;
|
||||
float hi_thres;
|
||||
int debug;
|
||||
} Cast;
|
||||
|
||||
float cfra;
|
||||
|
||||
void plugin_seq_doit(Cast *, float, float, int, int, ImBuf *, ImBuf *, ImBuf *, ImBuf *);
|
||||
|
||||
int plugin_seq_getversion(void) { return B_PLUGIN_VERSION;}
|
||||
void plugin_but_changed(int but) {}
|
||||
void plugin_init() {}
|
||||
|
||||
void plugin_getinfo(PluginInfo *info)
|
||||
{
|
||||
info->name= name;
|
||||
info->nvars= sizeof(varstr)/sizeof(VarStruct);
|
||||
info->cfra= &cfra;
|
||||
|
||||
info->varstr= varstr;
|
||||
|
||||
info->init= plugin_init;
|
||||
info->seq_doit= (SeqDoit) plugin_seq_doit;
|
||||
info->callback= plugin_but_changed;
|
||||
}
|
||||
|
||||
static void rgb_to_yuv(float rgb[3], float yuv[3])
|
||||
{
|
||||
yuv[0]= 0.299*rgb[0] + 0.587*rgb[1] + 0.114*rgb[2];
|
||||
yuv[1]= 0.492*(rgb[2] - yuv[0]);
|
||||
yuv[2]= 0.877*(rgb[0] - yuv[0]);
|
||||
|
||||
/* Normalize */
|
||||
yuv[1] /= 0.436;
|
||||
yuv[2] /= 0.615;
|
||||
}
|
||||
|
||||
static void yuv_to_rgb(float yuv[3], float rgb[3])
|
||||
{
|
||||
yuv[1] *= 0.436;
|
||||
yuv[2] *= 0.615;
|
||||
|
||||
rgb[0] = yuv[2]/0.877 + yuv[0];
|
||||
rgb[2] = yuv[1]/0.492 + yuv[0];
|
||||
rgb[1] = (yuv[0] - 0.299*rgb[0] - 0.114*rgb[2]) / 0.587;
|
||||
if (rgb[0] > 1.0) {
|
||||
rgb[0] = 1.0;
|
||||
}
|
||||
if (rgb[0] < 0.0) {
|
||||
rgb[0] = 0.0;
|
||||
}
|
||||
if (rgb[1] > 1.0) {
|
||||
rgb[1] = 1.0;
|
||||
}
|
||||
if (rgb[1] < 0.0) {
|
||||
rgb[1] = 0.0;
|
||||
}
|
||||
if (rgb[2] > 1.0) {
|
||||
rgb[2] = 1.0;
|
||||
}
|
||||
if (rgb[2] < 0.0) {
|
||||
rgb[2] = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
void plugin_seq_doit(Cast *cast, float facf0, float facf1, int width,
|
||||
int height, ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *out, ImBuf *use) {
|
||||
char *dest, *src1, *src2;
|
||||
int x, y, c;
|
||||
float rgb[3];
|
||||
float yuv[3];
|
||||
float gamma_table[256];
|
||||
float uv_table[256];
|
||||
float *destf = out->rect_float;
|
||||
float *src1f;
|
||||
|
||||
if (!ibuf1) return;
|
||||
|
||||
dest= (char *) out->rect;
|
||||
src1= (char *) ibuf1->rect;
|
||||
src1f= ibuf1->rect_float;
|
||||
|
||||
for (y = 0; y < 256; y++) {
|
||||
float v = 1.0 * y / 255;
|
||||
v += cast->setup_y;
|
||||
v *= cast->gain_y;
|
||||
v = pow(v, cast->gamma_y);
|
||||
if ( v > 1.0) {
|
||||
v = 1.0;
|
||||
} else if (v < 0.0) {
|
||||
v = 0.0;
|
||||
}
|
||||
gamma_table[y] = v * 255;
|
||||
}
|
||||
|
||||
for (y = 0; y < 256; y++) {
|
||||
float v = 1.0;
|
||||
v *= cast->master_sat;
|
||||
if (y < cast->lo_thres * 255) {
|
||||
v *= cast->sat_shadows;
|
||||
} else if (y > cast->hi_thres * 255) {
|
||||
v *= cast->sat_highlights;
|
||||
} else {
|
||||
v *= cast->sat_midtones;
|
||||
}
|
||||
uv_table[y] = v;
|
||||
}
|
||||
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
for (x = 0; x < width; x++) {
|
||||
float fac;
|
||||
if (out->rect_float) {
|
||||
rgb[0]= (float)src1f[0]/255.0;
|
||||
rgb[1]= (float)src1f[1]/255.0;
|
||||
rgb[2]= (float)src1f[2]/255.0;
|
||||
} else {
|
||||
rgb[0]= (float)src1[0]/255.0;
|
||||
rgb[1]= (float)src1[1]/255.0;
|
||||
rgb[2]= (float)src1[2]/255.0;
|
||||
}
|
||||
rgb_to_yuv(rgb, yuv);
|
||||
|
||||
yuv[0] = gamma_table[(int) (yuv[0] * 255.0)] / 255.0;
|
||||
fac = uv_table[(int) (255.0 * yuv[0])];
|
||||
|
||||
yuv[1] = yuv[1] * fac;
|
||||
yuv[2] = yuv[2] * fac;
|
||||
if (yuv[1] > 1.0) {
|
||||
yuv[1] = 1.0;
|
||||
}
|
||||
if (yuv[1] < -1.0) {
|
||||
yuv[1] = -1.0;
|
||||
}
|
||||
if (yuv[2] > 1.0) {
|
||||
yuv[2] = 1.0;
|
||||
}
|
||||
if (yuv[2] < -1.0) {
|
||||
yuv[2] = -1.0;
|
||||
}
|
||||
yuv_to_rgb(yuv, rgb);
|
||||
|
||||
if (out->rect_float) {
|
||||
*destf++ = rgb[0];
|
||||
*destf++ = rgb[1];
|
||||
*destf++ = rgb[2];
|
||||
destf++;
|
||||
src1f += 4;
|
||||
} else {
|
||||
*dest++ = rgb[0]*255.0;
|
||||
*dest++ = rgb[1]*255.0;
|
||||
*dest++ = rgb[2]*255.0;
|
||||
dest++;
|
||||
src1 += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cast->debug) {
|
||||
dest= (char *) out->rect;
|
||||
for (c = 0; c < 10; c++) {
|
||||
x = 0;
|
||||
for (y = 0; y < 256; y++) {
|
||||
char val = gamma_table[y];
|
||||
while (x < y * width / 255) {
|
||||
*dest++ = val;
|
||||
*dest++ = val;
|
||||
*dest++ = val;
|
||||
dest++;
|
||||
x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (c = 0; c < 10; c++) {
|
||||
x = 0;
|
||||
for (y = 0; y < 256; y++) {
|
||||
char val = uv_table[y] * 255.0/10.0;
|
||||
while (x < y * width / 255) {
|
||||
*dest++ = val;
|
||||
*dest++ = val;
|
||||
*dest++ = val;
|
||||
dest++;
|
||||
x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,151 +0,0 @@
|
||||
/*
|
||||
* Dynamic Noise Reduction (based on the VirtualDub filter by Steven Don)
|
||||
*
|
||||
* Copyright (c) 2005 Peter Schlaile
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include "plugin.h"
|
||||
#include <stdio.h>
|
||||
|
||||
char name[]= "Dynamic Noise Reduction";
|
||||
|
||||
VarStruct varstr[]= {
|
||||
{ NUMSLI|INT, "Level:", 10.0, 0.0, 15.0, "Level"},
|
||||
};
|
||||
|
||||
typedef struct Cast {
|
||||
int level;
|
||||
} Cast;
|
||||
|
||||
float cfra;
|
||||
void * plugin_private_data;
|
||||
|
||||
struct my_data {
|
||||
unsigned char lookup_table[65536];
|
||||
int last_level;
|
||||
float last_cfra;
|
||||
int last_width;
|
||||
int last_height;
|
||||
unsigned char * last_frame;
|
||||
};
|
||||
|
||||
void plugin_seq_doit(Cast *, float, float, int, int,
|
||||
ImBuf *, ImBuf *, ImBuf *, ImBuf *);
|
||||
|
||||
int plugin_seq_getversion(void) { return B_PLUGIN_VERSION;}
|
||||
|
||||
static void precalculate(unsigned char * table, int level)
|
||||
{
|
||||
int ap_, bp;
|
||||
|
||||
for (ap_ = 0; ap_ < 256; ap_++) {
|
||||
for (bp = 0; bp < 256; bp++) {
|
||||
int ap = ap_;
|
||||
int diff = ap - bp;
|
||||
if (diff < 0) {
|
||||
diff = -diff;
|
||||
}
|
||||
if (diff < level) {
|
||||
if (diff > (level >> 1)) {
|
||||
ap = (ap + ap + bp)/3;
|
||||
} else {
|
||||
ap = bp;
|
||||
}
|
||||
}
|
||||
|
||||
*table++ = ap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void plugin_but_changed(int but) { }
|
||||
void plugin_init() { }
|
||||
|
||||
void * plugin_seq_alloc_private_data()
|
||||
{
|
||||
struct my_data * result = (struct my_data*) calloc(
|
||||
sizeof(struct my_data), 1);
|
||||
result->last_cfra = -1;
|
||||
return result;
|
||||
}
|
||||
|
||||
void plugin_seq_free_private_data(void * data)
|
||||
{
|
||||
struct my_data * d = (struct my_data*) data;
|
||||
if (d->last_frame) {
|
||||
free(d->last_frame);
|
||||
}
|
||||
free(d);
|
||||
}
|
||||
|
||||
void plugin_getinfo(PluginInfo *info)
|
||||
{
|
||||
info->name= name;
|
||||
info->nvars= sizeof(varstr)/sizeof(VarStruct);
|
||||
info->cfra= &cfra;
|
||||
|
||||
info->varstr= varstr;
|
||||
|
||||
info->init= plugin_init;
|
||||
info->seq_doit= (SeqDoit) plugin_seq_doit;
|
||||
info->callback= plugin_but_changed;
|
||||
}
|
||||
|
||||
static void doit(unsigned char * src_, unsigned char * dst_,
|
||||
unsigned char * table, int width, int height)
|
||||
{
|
||||
int count = width * height;
|
||||
unsigned char * src = src_;
|
||||
unsigned char * dst = dst_;
|
||||
|
||||
while (count--) {
|
||||
*dst = table[(*src++ << 8) | *dst]; dst++;
|
||||
*dst = table[(*src++ << 8) | *dst]; dst++;
|
||||
*dst = table[(*src++ << 8) | *dst]; dst++;
|
||||
*dst++ = *src++;
|
||||
}
|
||||
|
||||
memcpy(src_, dst_, width * height * 4);
|
||||
}
|
||||
|
||||
void plugin_seq_doit(Cast *cast, float facf0, float facf1, int width,
|
||||
int height, ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *out, ImBuf *use) {
|
||||
|
||||
struct my_data * d = (struct my_data*) plugin_private_data;
|
||||
|
||||
if (!ibuf1) return;
|
||||
|
||||
if (cast->level != d->last_level) {
|
||||
precalculate(d->lookup_table, cast->level);
|
||||
d->last_level = cast->level;
|
||||
}
|
||||
|
||||
if (width != d->last_width || height != d->last_height ||
|
||||
cfra != d->last_cfra + 1)
|
||||
{
|
||||
free(d->last_frame);
|
||||
d->last_frame = (unsigned char*) calloc(width * height, 4);
|
||||
|
||||
d->last_width = width;
|
||||
d->last_height = height;
|
||||
}
|
||||
|
||||
memcpy(out->rect, ibuf1->rect, width * height * 4);
|
||||
|
||||
doit((unsigned char*) out->rect,
|
||||
d->last_frame, d->lookup_table, width, height);
|
||||
|
||||
d->last_cfra = cfra;
|
||||
}
|
@ -1,183 +0,0 @@
|
||||
/*
|
||||
* Gamma Correction Plugin (RGB Version) 0.01
|
||||
*
|
||||
* Copyright (c) 2005 Peter Schlaile
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include "plugin.h"
|
||||
#include "util.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#define alpha_epsilon 0.0001f
|
||||
char name[]= "Gamma Correction";
|
||||
|
||||
VarStruct varstr[]= {
|
||||
{ NUMSLI|FLO, "St M:", 0.0, -1.0, 1.0, "Setup Main"},
|
||||
{ NUMSLI|FLO, "Gn M:", 1.0, 0.0, 10.0,"Gain Main"},
|
||||
{ NUMSLI|FLO, "Ga M:", 1.0, 0.0, 10.0, "Gamma Main"},
|
||||
|
||||
{ NUMSLI|FLO, "St R:", 0.0, -1.0, 1.0, "Setup Red"},
|
||||
{ NUMSLI|FLO, "Gn R:", 1.0, 0.0, 10.0,"Gain Red"},
|
||||
{ NUMSLI|FLO, "Ga R:", 1.0, 0.0, 10.0, "Gamma Red"},
|
||||
|
||||
{ NUMSLI|FLO, "St G:", 0.0, -1.0, 1.0, "Setup Green"},
|
||||
{ NUMSLI|FLO, "Gn G:", 1.0, 0.0, 10.0,"Gain Green"},
|
||||
{ NUMSLI|FLO, "Ga G:", 1.0, 0.0, 10.0, "Gamma Green"},
|
||||
|
||||
{ NUMSLI|FLO, "St B:", 0.0, -1.0, 1.0, "Setup Blue"},
|
||||
{ NUMSLI|FLO, "Gn B:", 1.0, 0.0, 10.0,"Gain Blue"},
|
||||
{ NUMSLI|FLO, "Ga B:", 1.0, 0.0, 10.0, "Gamma Blue"},
|
||||
};
|
||||
|
||||
typedef struct Cast {
|
||||
float setup_m;
|
||||
float gain_m;
|
||||
float gamma_m;
|
||||
|
||||
float setup_r;
|
||||
float gain_r;
|
||||
float gamma_r;
|
||||
|
||||
float setup_g;
|
||||
float gain_g;
|
||||
float gamma_g;
|
||||
|
||||
float setup_b;
|
||||
float gain_b;
|
||||
float gamma_b;
|
||||
} Cast;
|
||||
|
||||
float cfra;
|
||||
|
||||
void plugin_seq_doit(Cast *, float, float, int, int, ImBuf *, ImBuf *, ImBuf *, ImBuf *);
|
||||
|
||||
int plugin_seq_getversion(void) { return B_PLUGIN_VERSION; }
|
||||
void plugin_but_changed(int but) {}
|
||||
void plugin_init() {}
|
||||
|
||||
void plugin_getinfo(PluginInfo *info)
|
||||
{
|
||||
info->name= name;
|
||||
info->nvars= sizeof(varstr)/sizeof(VarStruct);
|
||||
info->cfra= &cfra;
|
||||
|
||||
info->varstr= varstr;
|
||||
|
||||
info->init= plugin_init;
|
||||
info->seq_doit= (SeqDoit) plugin_seq_doit;
|
||||
info->callback= plugin_but_changed;
|
||||
}
|
||||
|
||||
static void make_gamma_table(float setup, float gain, float gamma,
|
||||
unsigned char * table)
|
||||
{
|
||||
int y;
|
||||
|
||||
for (y = 0; y < 256; y++) {
|
||||
float v = 1.0 * y / 255;
|
||||
v += setup;
|
||||
v *= gain;
|
||||
v = pow(v, gamma);
|
||||
if ( v > 1.0) {
|
||||
v = 1.0;
|
||||
} else if (v < 0.0) {
|
||||
v = 0.0;
|
||||
}
|
||||
table[y] = v * 255;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void plugin_seq_doit(Cast *cast, float facf0, float facf1, int width,
|
||||
int height, ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *out, ImBuf *use) {
|
||||
if (!out->rect_float)
|
||||
{
|
||||
unsigned char *dest, *src1, *src2;
|
||||
int x, y, c;
|
||||
unsigned char gamma_table_m[256];
|
||||
unsigned char gamma_table_r[256];
|
||||
unsigned char gamma_table_g[256];
|
||||
unsigned char gamma_table_b[256];
|
||||
|
||||
if (!ibuf1) return;
|
||||
|
||||
dest= (unsigned char *) out->rect;
|
||||
src1= (unsigned char *) ibuf1->rect;
|
||||
|
||||
make_gamma_table(cast->setup_m, cast->gain_m, cast->gamma_m,
|
||||
gamma_table_m);
|
||||
make_gamma_table(cast->setup_r, cast->gain_r, cast->gamma_r,
|
||||
gamma_table_r);
|
||||
make_gamma_table(cast->setup_g, cast->gain_g, cast->gamma_g,
|
||||
gamma_table_g);
|
||||
make_gamma_table(cast->setup_b, cast->gain_b, cast->gamma_b,
|
||||
gamma_table_b);
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
for (x = 0; x < width; x++) {
|
||||
*dest++ = gamma_table_r[gamma_table_m[*src1++]];
|
||||
*dest++ = gamma_table_g[gamma_table_m[*src1++]];
|
||||
*dest++ = gamma_table_b[gamma_table_m[*src1++]];
|
||||
dest++; src1++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float *i=ibuf1->rect_float;
|
||||
float *o=out->rect_float;
|
||||
unsigned int size=width*height;
|
||||
unsigned int k;
|
||||
float val_r[3]={cast->setup_r,cast->gain_r,cast->gamma_r};
|
||||
float val_g[3]={cast->setup_g,cast->gain_g,cast->gamma_g};
|
||||
float val_b[3]={cast->setup_b,cast->gain_b,cast->gamma_b};
|
||||
float *vals[3]={val_r,val_g,val_b};
|
||||
for (k=0;k<size;++k)
|
||||
{
|
||||
if (cast->gamma_m!=1.f || cast->setup_m!=0.f || cast->gain_m!=1.f)
|
||||
{
|
||||
float alpha=CLAMP(i[3],0.f,1.f);
|
||||
if (alpha>alpha_epsilon) {
|
||||
int l;
|
||||
for (l=0;l<3;++l)
|
||||
{
|
||||
float *val=vals[l];
|
||||
o[l]=i[l]/alpha;
|
||||
o[l]=pow((o[l]+cast->setup_m)*cast->gain_m,cast->gamma_m);
|
||||
if (val[2]!=1.f || val[0]!=0.f || val[1]!=1.f)
|
||||
{
|
||||
o[l]=pow((o[l]+val[0])*val[1],val[2]);
|
||||
}
|
||||
o[l]*=alpha;
|
||||
o[l]=CLAMP(o[l],0.f,1.f);
|
||||
}
|
||||
} else {
|
||||
o[0]=o[1]=o[2]=0.0;
|
||||
}
|
||||
o[3]=1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int l;
|
||||
for (l=0;l<3;++l)
|
||||
o[l]=CLAMP(i[l],0.f,1.f);
|
||||
o[3]=1.0;
|
||||
}
|
||||
i += 4;
|
||||
o += 4;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,263 +0,0 @@
|
||||
/**
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include "plugin.h"
|
||||
|
||||
/* ******************** GLOBAL VARIABLES ***************** */
|
||||
|
||||
|
||||
char name[24] = "scatter";
|
||||
|
||||
/* structure for buttons,
|
||||
* butcode name default min max 0
|
||||
*/
|
||||
|
||||
VarStruct varstr[] = {
|
||||
LABEL, "Input: 1 strip", 0.0, 0.0, 0.0, "",
|
||||
NUM | INT, "seed: ", 1.0, 0.0, 10.0, "Offset in random table",
|
||||
NUMSLI | FLO, "swing: ", 1.0, 0.0, 3.0, "The amplitude, width of the effect",
|
||||
TOG | INT, "wrap", 0.0, 0.0, 1.0, "Cyclic wrap around the left/right edges",
|
||||
NUM | INT, "type: ", 1.0, 0.0, 1.0, "Type 1 is random for each frame",
|
||||
};
|
||||
|
||||
/* The cast struct is for input in the main doit function
|
||||
Varstr and Cast must have the same variables in the same order */
|
||||
|
||||
typedef struct Cast {
|
||||
int dummy; /* because of the 'label' button */
|
||||
int seed;
|
||||
float swing;
|
||||
int wrap;
|
||||
int type;
|
||||
} Cast;
|
||||
|
||||
/* cfra: the current frame */
|
||||
|
||||
float cfra;
|
||||
|
||||
void plugin_seq_doit(Cast *, float, float, int, int, ImBuf *, ImBuf *, ImBuf *, ImBuf *);
|
||||
|
||||
|
||||
/* ******************** Fixed functions ***************** */
|
||||
|
||||
int plugin_seq_getversion(void)
|
||||
{
|
||||
return B_PLUGIN_VERSION;
|
||||
}
|
||||
|
||||
void plugin_but_changed(int but)
|
||||
{
|
||||
}
|
||||
|
||||
void plugin_init()
|
||||
{
|
||||
}
|
||||
|
||||
void plugin_getinfo(PluginInfo *info)
|
||||
{
|
||||
info->name = name;
|
||||
info->nvars = sizeof(varstr) / sizeof(VarStruct);
|
||||
info->cfra = &cfra;
|
||||
|
||||
info->varstr = varstr;
|
||||
|
||||
info->init = plugin_init;
|
||||
info->seq_doit = (SeqDoit) plugin_seq_doit;
|
||||
info->callback = plugin_but_changed;
|
||||
}
|
||||
|
||||
|
||||
/* ************************************************************
|
||||
Scatter
|
||||
|
||||
************************************************************ */
|
||||
|
||||
static void rectcpy(ImBuf *dbuf, ImBuf *sbuf,
|
||||
int destx, int desty,
|
||||
int srcx, int srcy, int width, int height)
|
||||
{
|
||||
uint *drect, *srect;
|
||||
float *dfrect, *sfrect;
|
||||
int tmp;
|
||||
|
||||
if (dbuf == 0) return;
|
||||
|
||||
if (destx < 0) {
|
||||
srcx -= destx;
|
||||
width += destx;
|
||||
destx = 0;
|
||||
}
|
||||
if (srcx < 0) {
|
||||
destx -= srcx;
|
||||
width += destx;
|
||||
srcx = 0;
|
||||
}
|
||||
if (desty < 0) {
|
||||
srcy -= desty;
|
||||
height += desty;
|
||||
desty = 0;
|
||||
}
|
||||
if (srcy < 0) {
|
||||
desty -= srcy;
|
||||
height += desty;
|
||||
srcy = 0;
|
||||
}
|
||||
|
||||
if (width > dbuf->x - destx) width = dbuf->x - destx;
|
||||
if (height > dbuf->y - desty) height = dbuf->y - desty;
|
||||
if (sbuf) {
|
||||
if (width > sbuf->x - srcx) width = sbuf->x - srcx;
|
||||
if (height > sbuf->y - srcy) height = sbuf->y - srcy;
|
||||
srect = sbuf->rect;
|
||||
sfrect = sbuf->rect_float;
|
||||
}
|
||||
|
||||
if (width <= 0) return;
|
||||
if (height <= 0) return;
|
||||
|
||||
drect = dbuf->rect;
|
||||
dfrect = dbuf->rect_float;
|
||||
|
||||
tmp = (desty * dbuf->x + destx);
|
||||
|
||||
if (dbuf->rect_float) dfrect += 4 * tmp;
|
||||
else drect += tmp;
|
||||
|
||||
destx = dbuf->x;
|
||||
|
||||
if (sbuf) {
|
||||
tmp = (srcy * sbuf->x + srcx);
|
||||
if (dbuf->rect_float) sfrect += 4 * tmp;
|
||||
else srect += tmp;
|
||||
srcx = sbuf->x;
|
||||
}
|
||||
else {
|
||||
if (dbuf->rect_float) sfrect = dfrect;
|
||||
else srect = drect;
|
||||
srcx = destx;
|
||||
}
|
||||
|
||||
for (; height > 0; height--) {
|
||||
if (dbuf->rect_float) {
|
||||
memcpy(dfrect, sfrect, 4 * width * sizeof(float));
|
||||
dfrect += destx;
|
||||
sfrect += srcx;
|
||||
}
|
||||
else {
|
||||
memcpy(drect, srect, width * sizeof(int));
|
||||
drect += destx;
|
||||
srect += srcx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void fill_out(ImBuf *out, float r, float g, float b, float a)
|
||||
{
|
||||
int tot, x;
|
||||
float *rectf = out->rect_float;
|
||||
unsigned char *rect = (unsigned char *)out->rect;
|
||||
|
||||
tot = out->x * out->y;
|
||||
if (out->rect_float) {
|
||||
for (x = 0; x < tot; x++) {
|
||||
rectf[0] = r;
|
||||
rectf[1] = g;
|
||||
rectf[2] = b;
|
||||
rectf[3] = a;
|
||||
rectf += 4;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (x = 0; x < tot; x++) {
|
||||
rect[0] = (int)(r * 255);
|
||||
rect[1] = (int)(g * 255);
|
||||
rect[2] = (int)(b * 255);
|
||||
rect[3] = (int)(a * 255);
|
||||
rect += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void plugin_seq_doit(Cast *cast, float facf0, float facf1, int sx, int sy, ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *out, ImBuf *use)
|
||||
{
|
||||
float f1, f2, t1, t2, t3;
|
||||
int x, y, lr;
|
||||
|
||||
/* fill imbuf 'out' with black */
|
||||
fill_out(out, 0, 0, 0, 0);
|
||||
|
||||
|
||||
switch (cast->type) {
|
||||
case 0:
|
||||
srand48(cast->seed);
|
||||
break;
|
||||
case 1:
|
||||
srand48(cast->seed + facf0 * 1000);
|
||||
break;
|
||||
}
|
||||
|
||||
for (y = 0; y < sy; y++) {
|
||||
switch (cast->type) {
|
||||
case 0:
|
||||
if ((y & 1) == 0) {
|
||||
f1 = drand48() - 0.5;
|
||||
f2 = drand48() - 0.5;
|
||||
f1 = cast->swing * f1;
|
||||
f2 = cast->swing * f2;
|
||||
if (cast->wrap) f2 += 1.0;
|
||||
lr = drand48() > 0.5;
|
||||
t1 = facf0;
|
||||
}
|
||||
else t1 = facf1;
|
||||
|
||||
t2 = 1.0 - t1;
|
||||
t3 = 3.0 * (f1 * t1 * t1 * t2 + f2 * t1 * t2 * t2);
|
||||
if (cast->wrap) t3 += t2 * t2 * t2;
|
||||
x = sx * t3;
|
||||
if (lr) x = -x;
|
||||
break;
|
||||
case 1:
|
||||
f1 = drand48() - 0.5;
|
||||
f1 = f1 * cast->swing;
|
||||
if ((y & 1) == 0) f1 *= facf0;
|
||||
else f1 *= facf1;
|
||||
x = f1 * sx;
|
||||
break;
|
||||
}
|
||||
|
||||
rectcpy(out, ibuf1, 0, y, x, y, 32767, 1);
|
||||
if (cast->wrap) {
|
||||
rectcpy(out, ibuf1, 0, y, x + sx, y, 32767, 1);
|
||||
rectcpy(out, ibuf1, 0, y, x + sx + sx, y, 32767, 1);
|
||||
rectcpy(out, ibuf1, 0, y, x - sx, y, 32767, 1);
|
||||
rectcpy(out, ibuf1, 0, y, x - sx - sx, y, 32767, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,32 +0,0 @@
|
||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# The Original Code is: all of this file.
|
||||
#
|
||||
# Contributor(s): none yet.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
all: plugins
|
||||
|
||||
plugins:
|
||||
@/bin/sh -c 'for i in *.c; do ../bmake $$i; done;'
|
||||
|
||||
clean:
|
||||
rm -rf *.o *.so
|
@ -1,178 +0,0 @@
|
||||
/**
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include "plugin.h"
|
||||
|
||||
/* ******************** GLOBAL VARIABLES ***************** */
|
||||
|
||||
/* Texture name */
|
||||
|
||||
char name[24]= "Clouds2";
|
||||
|
||||
/* Subtype names must be less than 15 characters */
|
||||
|
||||
#define NR_TYPES 3
|
||||
char stnames[NR_TYPES][16]= {"Intens", "Col", "Bump" };
|
||||
|
||||
/* Structure for buttons,
|
||||
* butcode name default min max 0
|
||||
*/
|
||||
|
||||
VarStruct varstr[]= {
|
||||
{ NUM|FLO, "Offset", -0.5, -20.0, 20.0, ""},
|
||||
{ NUM|INT, "Depth", 8.0, 1.0, 12.0, ""},
|
||||
{ NUM|FLO, "Scale", 2.2, -20.0, 20.0, ""},
|
||||
{ NUM|FLO, "Falloff", 1.0, -20.0, 20.0, ""}
|
||||
};
|
||||
|
||||
/* The cast struct is for input in the main doit function
|
||||
Varstr and Cast must have the same variables in the same order,
|
||||
INCLUDING dummy variables for label fields. */
|
||||
|
||||
typedef struct Cast {
|
||||
float offset;
|
||||
int depth;
|
||||
float txtscale;
|
||||
float falloff;
|
||||
} Cast;
|
||||
|
||||
/* result:
|
||||
Intensity, R, G, B, Alpha, nor.x, nor.y, nor.z
|
||||
*/
|
||||
|
||||
float result[8];
|
||||
|
||||
/* cfra: the current frame */
|
||||
|
||||
float cfra;
|
||||
|
||||
int plugin_tex_doit(int, Cast*, float*, float*, float*, float*);
|
||||
void plugin_instance_init(Cast*);
|
||||
|
||||
/* ******************** Fixed functions ***************** */
|
||||
|
||||
int plugin_tex_getversion(void)
|
||||
{
|
||||
return B_PLUGIN_VERSION;
|
||||
}
|
||||
|
||||
void plugin_but_changed(int but)
|
||||
{
|
||||
}
|
||||
|
||||
void plugin_init(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* initialize any data for a particular instance of
|
||||
* the plugin here
|
||||
*/
|
||||
void plugin_instance_init(Cast *cast)
|
||||
{
|
||||
}
|
||||
|
||||
/* this function should not be changed: */
|
||||
|
||||
void plugin_getinfo(PluginInfo *info)
|
||||
{
|
||||
info->name= name;
|
||||
info->stypes= NR_TYPES;
|
||||
info->nvars= sizeof(varstr)/sizeof(VarStruct);
|
||||
|
||||
info->snames= stnames[0];
|
||||
info->result= result;
|
||||
info->cfra= &cfra;
|
||||
info->varstr= varstr;
|
||||
|
||||
info->init= plugin_init;
|
||||
info->tex_doit= (TexDoit) plugin_tex_doit;
|
||||
info->callback= plugin_but_changed;
|
||||
info->instance_init= (void (*)(void *)) plugin_instance_init;
|
||||
}
|
||||
|
||||
/* ********************* the texture ******************** */
|
||||
|
||||
|
||||
int plugin_tex_doit(int stype, Cast *cast, float *texvec, float *dxt, float *dyt, float *result)
|
||||
{
|
||||
float val = 0.0;
|
||||
float a = 1.0;
|
||||
float p[3];
|
||||
float tv[3];
|
||||
int i;
|
||||
int res = TEX_INT;
|
||||
|
||||
tv[0]=(texvec[0]+1.0)/2.0;
|
||||
tv[1]=(texvec[1]+1.0)/2.0;
|
||||
tv[2]=(texvec[2]+1.0)/2.0;
|
||||
|
||||
p[0] = cast->txtscale * tv[0];
|
||||
p[1] = cast->txtscale * tv[1];
|
||||
p[2] = cast->txtscale * tv[2];
|
||||
|
||||
for (i=0; i<cast->depth; i++) {
|
||||
val += a * hnoise(1.0, p[0], p[1], p[2]);
|
||||
|
||||
p[0] *= 2.0;
|
||||
p[1] *= 2.0;
|
||||
p[2] *= 2.0;
|
||||
a *= 0.5;
|
||||
}
|
||||
|
||||
/* always return this value */
|
||||
result[0] = CLAMP (val+cast->offset, 0.0, 1.0) * pow (fabs(sqrt(tv[0]*tv[0]+tv[1]*tv[1]+tv[2]*tv[2])), cast->falloff);
|
||||
|
||||
if (stype==1) {
|
||||
/*
|
||||
* this is r, g, b, a:
|
||||
*/
|
||||
result[1]= 0.5*result[0];
|
||||
result[2]= 1.0-val;
|
||||
result[3]= fsqrt(fabs(result[0]));
|
||||
result[4]= 1.0;
|
||||
|
||||
res |= TEX_RGB;
|
||||
}
|
||||
if (stype==2) {
|
||||
/*
|
||||
* This value is the displacement of the actual normal in
|
||||
* the Material calculation.
|
||||
*/
|
||||
result[5]+= val;
|
||||
result[6]+= 1.0-val;
|
||||
result[7]= 0.0;
|
||||
|
||||
res |= TEX_NOR;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -1,177 +0,0 @@
|
||||
/**
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include "plugin.h"
|
||||
|
||||
/* ******************** GLOBAL VARIABLES ***************** */
|
||||
|
||||
char name[]= "tiles";
|
||||
|
||||
/* Subtype names must be less than 15 characters */
|
||||
|
||||
#define NR_TYPES 2
|
||||
char stnames[NR_TYPES][16]= {"Square", "Deformed"};
|
||||
|
||||
VarStruct varstr[]= {
|
||||
NUM|FLO, "size", 1.0, 0.0, 1.0, "The size of each tile",
|
||||
NUM|FLO, "Noise", 1.0, 0.01, 10.0, ""
|
||||
};
|
||||
|
||||
/* The cast struct is for input in the main doit function
|
||||
Varstr and Cast must have the same variables in the same order */
|
||||
|
||||
typedef struct Cast {
|
||||
float size;
|
||||
float noise;
|
||||
} Cast;
|
||||
|
||||
/* result:
|
||||
Intensity, R, G, B, Alpha, nor.x, nor.y, nor.z
|
||||
*/
|
||||
|
||||
float result[8];
|
||||
|
||||
/* cfra: the current frame */
|
||||
|
||||
float cfra;
|
||||
|
||||
int plugin_tex_doit(int, Cast *, float *, float *, float *, float *);
|
||||
void plugin_instance_init(Cast*);
|
||||
|
||||
/* ******************** Fixed functions ***************** */
|
||||
|
||||
int plugin_tex_getversion(void)
|
||||
{
|
||||
return B_PLUGIN_VERSION;
|
||||
}
|
||||
|
||||
void plugin_but_changed(int but)
|
||||
{
|
||||
}
|
||||
|
||||
void plugin_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* initialize any data for a particular instance of
|
||||
* the plugin here
|
||||
*/
|
||||
void plugin_instance_init(Cast *cast)
|
||||
{
|
||||
}
|
||||
|
||||
/* this function should not be changed: */
|
||||
|
||||
void plugin_getinfo(PluginInfo *info)
|
||||
{
|
||||
info->name= name;
|
||||
info->stypes= NR_TYPES;
|
||||
info->nvars= sizeof(varstr)/sizeof(VarStruct);
|
||||
|
||||
info->snames= stnames[0];
|
||||
info->result= result;
|
||||
info->cfra= &cfra;
|
||||
info->varstr= varstr;
|
||||
|
||||
info->init= plugin_init;
|
||||
info->tex_doit= (TexDoit) plugin_tex_doit;
|
||||
info->callback= plugin_but_changed;
|
||||
info->instance_init= (void (*)(void *)) plugin_instance_init;
|
||||
|
||||
}
|
||||
|
||||
/* ************************************************************
|
||||
Tiles
|
||||
|
||||
Demonstration of a simple square wave function sampled
|
||||
with anti-aliasing.
|
||||
It is not mipmapped yet...
|
||||
|
||||
************************************************************ */
|
||||
|
||||
|
||||
/* square wave, antialiased, no mipmap! */
|
||||
|
||||
float sample_wave(float freq, float coord, float pixsize)
|
||||
{
|
||||
float fac, frac, retval;
|
||||
int part1, part2;
|
||||
|
||||
if (pixsize > freq) return 0.5;
|
||||
|
||||
pixsize/= freq;
|
||||
|
||||
fac= coord/freq;
|
||||
part1= ffloor(fac);
|
||||
frac= fac - part1;
|
||||
|
||||
if (part1 & 1) retval= 0.0;
|
||||
else retval = 1.0;
|
||||
|
||||
if (pixsize != 0.0) {
|
||||
|
||||
/* is coord+pixsize another value? */
|
||||
|
||||
part2= ffloor(fac + pixsize);
|
||||
if (part1==part2) return retval;
|
||||
|
||||
/* antialias */
|
||||
if (retval == 1.0) retval= (1.0 - frac) / pixsize;
|
||||
else retval= 1.0 - (1.0 - frac) / pixsize;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
int plugin_tex_doit(int stype, Cast *cast, float *texvec, float *dxt, float *dyt, float *result)
|
||||
{
|
||||
float xwave, ywave;
|
||||
|
||||
if (stype==1) {
|
||||
texvec[0]+= hnoise(cast->noise, texvec[0], texvec[1], texvec[2]);
|
||||
texvec[1]+= hnoise(cast->noise, texvec[1], texvec[2], texvec[0]);
|
||||
}
|
||||
|
||||
if (dxt && dyt) {
|
||||
xwave= sample_wave(cast->size, texvec[0], fabs(dxt[0]) + fabs(dyt[0]) );
|
||||
ywave= sample_wave(cast->size, texvec[1], fabs(dxt[1]) + fabs(dyt[1]) );
|
||||
|
||||
if (xwave > ywave) result[0]= xwave-ywave;
|
||||
else result[0]= ywave-xwave;
|
||||
}
|
||||
else {
|
||||
xwave= sample_wave(cast->size, texvec[0], 0.0 );
|
||||
ywave= sample_wave(cast->size, texvec[1], 0.0 );
|
||||
|
||||
if (xwave > ywave) result[0]= xwave-ywave;
|
||||
else result[0]= ywave-xwave;
|
||||
}
|
||||
|
||||
return TEX_INT;
|
||||
}
|
@ -97,7 +97,6 @@ add_subdirectory(render)
|
||||
add_subdirectory(compositor)
|
||||
add_subdirectory(blenfont)
|
||||
add_subdirectory(blenloader)
|
||||
add_subdirectory(blenpluginapi)
|
||||
add_subdirectory(ikplugin)
|
||||
add_subdirectory(gpu)
|
||||
add_subdirectory(opencl)
|
||||
|
@ -7,7 +7,6 @@ SConscript(['avi/SConscript',
|
||||
'blenkernel/SConscript',
|
||||
'blenlib/SConscript',
|
||||
'blenloader/SConscript',
|
||||
'blenpluginapi/SConscript',
|
||||
'gpu/SConscript',
|
||||
'opencl/SConscript',
|
||||
'editors/SConscript',
|
||||
|
@ -1,68 +0,0 @@
|
||||
/*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
#ifndef __BKE_PLUGIN_TYPES_H__
|
||||
#define __BKE_PLUGIN_TYPES_H__
|
||||
|
||||
/** \file BKE_plugin_types.h
|
||||
* \ingroup bke
|
||||
* \author nzc
|
||||
*/
|
||||
|
||||
struct ImBuf;
|
||||
|
||||
typedef int (*TexDoitold)(int stype, void *cast, float *texvec, float *dxt, float *dyt);
|
||||
typedef int (*TexDoit)(int stype, void *cast, float *texvec, float *dxt, float *dyt, float *result);
|
||||
typedef void (*SeqDoit)(void *, float, float, int, int,
|
||||
struct ImBuf *, struct ImBuf *,
|
||||
struct ImBuf *, struct ImBuf *);
|
||||
|
||||
typedef struct VarStruct {
|
||||
int type;
|
||||
char name[16];
|
||||
float def, min, max;
|
||||
char tip[80];
|
||||
} VarStruct;
|
||||
|
||||
typedef struct _PluginInfo {
|
||||
char *name;
|
||||
char *snames;
|
||||
|
||||
int stypes;
|
||||
int nvars;
|
||||
VarStruct *varstr;
|
||||
float *result;
|
||||
float *cfra;
|
||||
|
||||
void (*init)(void);
|
||||
void (*callback)(int);
|
||||
void (*tex_doit)(void *);
|
||||
SeqDoit seq_doit;
|
||||
void (*instance_init)(void *);
|
||||
} PluginInfo;
|
||||
|
||||
#endif
|
||||
|
@ -113,9 +113,8 @@ enum {
|
||||
|
||||
struct SeqEffectHandle {
|
||||
/* constructors & destructor */
|
||||
/* init & init_plugin are _only_ called on first creation */
|
||||
/* init is _only_ called on first creation */
|
||||
void (*init)(struct Sequence *seq);
|
||||
void (*init_plugin)(struct Sequence *seq, const char *fname);
|
||||
|
||||
/* number of input strips needed
|
||||
* (called directly after construction) */
|
||||
|
@ -48,7 +48,6 @@ struct Material;
|
||||
struct MTex;
|
||||
struct OceanTex;
|
||||
struct ParticleSettings;
|
||||
struct PluginTex;
|
||||
struct PointDensity;
|
||||
struct Tex;
|
||||
struct TexMapping;
|
||||
@ -60,10 +59,6 @@ struct World;
|
||||
|
||||
|
||||
void BKE_texture_free(struct Tex *t);
|
||||
int test_dlerr(const char *name, const char *symbol);
|
||||
void open_plugin_tex(struct PluginTex *pit);
|
||||
struct PluginTex *add_plugin_tex(char *str);
|
||||
void free_plugin_tex(struct PluginTex *pit);
|
||||
|
||||
void init_colorband(struct ColorBand *coba, int rangetype);
|
||||
struct ColorBand *add_colorband(int rangetype);
|
||||
|
@ -201,7 +201,6 @@ set(SRC
|
||||
BKE_packedFile.h
|
||||
BKE_paint.h
|
||||
BKE_particle.h
|
||||
BKE_plugin_types.h
|
||||
BKE_pointcache.h
|
||||
BKE_property.h
|
||||
BKE_report.h
|
||||
|
@ -903,7 +903,7 @@ static void do_init_render_material(Material *ma, int r_mode, float *amb)
|
||||
ma->mapto |= mtex->mapto;
|
||||
|
||||
/* always get derivatives for these textures */
|
||||
if (ELEM3(mtex->tex->type, TEX_IMAGE, TEX_PLUGIN, TEX_ENVMAP)) ma->texco |= TEXCO_OSA;
|
||||
if (ELEM(mtex->tex->type, TEX_IMAGE, TEX_ENVMAP)) ma->texco |= TEXCO_OSA;
|
||||
else if (mtex->texflag & (MTEX_COMPAT_BUMP | MTEX_3TAP_BUMP | MTEX_5TAP_BUMP | MTEX_BICUBIC_BUMP)) ma->texco |= TEXCO_OSA;
|
||||
|
||||
if (ma->texco & (TEXCO_ORCO | TEXCO_REFL | TEXCO_NORM | TEXCO_STRAND | TEXCO_STRESS)) needuv = 1;
|
||||
|
@ -47,7 +47,6 @@
|
||||
|
||||
#include "BKE_fcurve.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_plugin_types.h"
|
||||
#include "BKE_sequencer.h"
|
||||
#include "BKE_texture.h"
|
||||
#include "BKE_utildefines.h"
|
||||
@ -60,11 +59,6 @@
|
||||
/* **** XXX **** */
|
||||
static void error(const char *UNUSED(error), ...) {}
|
||||
|
||||
#define INT 96
|
||||
#define FLO 128
|
||||
|
||||
/* **** XXX **** */
|
||||
|
||||
/* Glow effect */
|
||||
enum {
|
||||
GlowR = 0,
|
||||
@ -121,281 +115,6 @@ static ImBuf *prepare_effect_imbufs(
|
||||
return out;
|
||||
}
|
||||
|
||||
/* **********************************************************************
|
||||
* PLUGINS
|
||||
* ********************************************************************** */
|
||||
|
||||
static void open_plugin_seq(PluginSeq *pis, const char *seqname)
|
||||
{
|
||||
int (*version)(void);
|
||||
void * (*alloc_private)(void);
|
||||
char *cp;
|
||||
|
||||
/* to be sure: (is tested for) */
|
||||
pis->doit = NULL;
|
||||
pis->pname = NULL;
|
||||
pis->varstr = NULL;
|
||||
pis->cfra = NULL;
|
||||
pis->version = 0;
|
||||
pis->instance_private_data = NULL;
|
||||
|
||||
/* clear the error list */
|
||||
BLI_dynlib_get_error_as_string(NULL);
|
||||
|
||||
/* if (pis->handle) BLI_dynlib_close(pis->handle); */
|
||||
/* pis->handle = 0; */
|
||||
|
||||
/* open the needed object */
|
||||
pis->handle = BLI_dynlib_open(pis->name);
|
||||
if (test_dlerr(pis->name, pis->name)) return;
|
||||
|
||||
if (pis->handle != NULL) {
|
||||
/* find the address of the version function */
|
||||
version = (int (*)(void))BLI_dynlib_find_symbol(pis->handle, "plugin_seq_getversion");
|
||||
if (test_dlerr(pis->name, "plugin_seq_getversion")) return;
|
||||
|
||||
if (version != NULL) {
|
||||
pis->version = version();
|
||||
if (pis->version >= 2 && pis->version <= 6) {
|
||||
int (*info_func)(PluginInfo *);
|
||||
PluginInfo *info = (PluginInfo *) MEM_mallocN(sizeof(PluginInfo), "plugin_info");
|
||||
|
||||
info_func = (int (*)(PluginInfo *))BLI_dynlib_find_symbol(pis->handle, "plugin_getinfo");
|
||||
|
||||
if (info_func == NULL) error("No info func");
|
||||
else {
|
||||
info_func(info);
|
||||
|
||||
pis->pname = info->name;
|
||||
pis->vars = info->nvars;
|
||||
pis->cfra = info->cfra;
|
||||
|
||||
pis->varstr = info->varstr;
|
||||
|
||||
pis->doit = (void (*)(void))info->seq_doit;
|
||||
if (info->init)
|
||||
info->init();
|
||||
}
|
||||
MEM_freeN(info);
|
||||
|
||||
cp = BLI_dynlib_find_symbol(pis->handle, "seqname");
|
||||
if (cp) BLI_strncpy(cp, seqname, SEQ_NAME_MAXSTR);
|
||||
}
|
||||
else {
|
||||
printf("Plugin returned unrecognized version number\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
alloc_private = (void * (*)(void))BLI_dynlib_find_symbol(
|
||||
pis->handle, "plugin_seq_alloc_private_data");
|
||||
if (alloc_private) {
|
||||
pis->instance_private_data = alloc_private();
|
||||
}
|
||||
|
||||
pis->current_private_data = (void **)
|
||||
BLI_dynlib_find_symbol(pis->handle, "plugin_private_data");
|
||||
}
|
||||
}
|
||||
|
||||
static PluginSeq *add_plugin_seq(const char *str, const char *seqname)
|
||||
{
|
||||
PluginSeq *pis;
|
||||
VarStruct *varstr;
|
||||
int a;
|
||||
|
||||
pis = MEM_callocN(sizeof(PluginSeq), "PluginSeq");
|
||||
|
||||
BLI_strncpy(pis->name, str, FILE_MAX);
|
||||
open_plugin_seq(pis, seqname);
|
||||
|
||||
if (pis->doit == NULL) {
|
||||
if (pis->handle == NULL) error("no plugin: %s", str);
|
||||
else error("in plugin: %s", str);
|
||||
MEM_freeN(pis);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* default values */
|
||||
varstr = pis->varstr;
|
||||
for (a = 0; a < pis->vars; a++, varstr++) {
|
||||
if ( (varstr->type & FLO) == FLO)
|
||||
pis->data[a] = varstr->def;
|
||||
else if ( (varstr->type & INT) == INT)
|
||||
*((int *)(pis->data + a)) = (int) varstr->def;
|
||||
}
|
||||
|
||||
return pis;
|
||||
}
|
||||
|
||||
static void free_plugin_seq(PluginSeq *pis)
|
||||
{
|
||||
if (pis == NULL) return;
|
||||
|
||||
/* no BLI_dynlib_close: same plugin can be opened multiple times with 1 handle */
|
||||
|
||||
if (pis->instance_private_data) {
|
||||
void (*free_private)(void *);
|
||||
|
||||
free_private = (void (*)(void *))BLI_dynlib_find_symbol(
|
||||
pis->handle, "plugin_seq_free_private_data");
|
||||
if (free_private) {
|
||||
free_private(pis->instance_private_data);
|
||||
}
|
||||
}
|
||||
|
||||
MEM_freeN(pis);
|
||||
}
|
||||
|
||||
static void init_plugin(Sequence *seq, const char *fname)
|
||||
{
|
||||
seq->plugin = (PluginSeq *)add_plugin_seq(fname, seq->name + 2);
|
||||
}
|
||||
|
||||
/*
|
||||
* FIXME: should query plugin! Could be generator, that needs zero inputs...
|
||||
*/
|
||||
static int num_inputs_plugin(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void load_plugin(Sequence *seq)
|
||||
{
|
||||
if (seq) {
|
||||
open_plugin_seq(seq->plugin, seq->name + 2);
|
||||
}
|
||||
}
|
||||
|
||||
static void copy_plugin(Sequence *dst, Sequence *src)
|
||||
{
|
||||
if (src->plugin) {
|
||||
dst->plugin = MEM_dupallocN(src->plugin);
|
||||
open_plugin_seq(dst->plugin, dst->name + 2);
|
||||
}
|
||||
}
|
||||
|
||||
static ImBuf *IMB_cast_away_list(ImBuf *i)
|
||||
{
|
||||
if (!i) {
|
||||
return NULL;
|
||||
}
|
||||
return (ImBuf *) (((void **) i) + 2);
|
||||
}
|
||||
|
||||
static ImBuf *do_plugin_effect(
|
||||
SeqRenderData context, Sequence *seq, float cfra,
|
||||
float facf0, float facf1,
|
||||
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
|
||||
struct ImBuf *ibuf3)
|
||||
{
|
||||
char *cp;
|
||||
int float_rendering;
|
||||
int use_temp_bufs = FALSE; /* Are needed since blur.c (and maybe some other
|
||||
* old plugins) do very bad stuff
|
||||
* with imbuf-internals */
|
||||
|
||||
struct ImBuf *out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3);
|
||||
int x = context.rectx;
|
||||
int y = context.recty;
|
||||
|
||||
if (seq->plugin && seq->plugin->doit) {
|
||||
|
||||
if (seq->plugin->cfra)
|
||||
*(seq->plugin->cfra) = cfra;
|
||||
|
||||
cp = BLI_dynlib_find_symbol(
|
||||
seq->plugin->handle, "seqname");
|
||||
|
||||
/* XXX: it's crappy to limit copying buffer by it's lemgth,
|
||||
* but assuming plugin stuff is using correct buffer size
|
||||
* it should be fine */
|
||||
if (cp) strncpy(cp, seq->name + 2, sizeof(seq->name) - 2);
|
||||
|
||||
if (seq->plugin->current_private_data) {
|
||||
*seq->plugin->current_private_data = seq->plugin->instance_private_data;
|
||||
}
|
||||
|
||||
float_rendering = (out->rect_float != NULL);
|
||||
|
||||
if (seq->plugin->version <= 3 && float_rendering) {
|
||||
use_temp_bufs = TRUE;
|
||||
|
||||
if (ibuf1) {
|
||||
ibuf1 = IMB_dupImBuf(ibuf1);
|
||||
IMB_rect_from_float(ibuf1);
|
||||
imb_freerectfloatImBuf(ibuf1);
|
||||
ibuf1->flags &= ~IB_rectfloat;
|
||||
}
|
||||
if (ibuf2) {
|
||||
ibuf2 = IMB_dupImBuf(ibuf2);
|
||||
IMB_rect_from_float(ibuf2);
|
||||
imb_freerectfloatImBuf(ibuf2);
|
||||
ibuf2->flags &= ~IB_rectfloat;
|
||||
}
|
||||
if (ibuf3) {
|
||||
ibuf3 = IMB_dupImBuf(ibuf3);
|
||||
IMB_rect_from_float(ibuf3);
|
||||
imb_freerectfloatImBuf(ibuf3);
|
||||
ibuf3->flags &= ~IB_rectfloat;
|
||||
}
|
||||
if (!out->rect) imb_addrectImBuf(out);
|
||||
imb_freerectfloatImBuf(out);
|
||||
out->flags &= ~IB_rectfloat;
|
||||
}
|
||||
|
||||
if (seq->plugin->version <= 2) {
|
||||
if (ibuf1) IMB_convert_rgba_to_abgr(ibuf1);
|
||||
if (ibuf2) IMB_convert_rgba_to_abgr(ibuf2);
|
||||
if (ibuf3) IMB_convert_rgba_to_abgr(ibuf3);
|
||||
}
|
||||
|
||||
if (seq->plugin->version <= 4) {
|
||||
((SeqDoit)seq->plugin->doit)(
|
||||
seq->plugin->data, facf0, facf1, x, y,
|
||||
IMB_cast_away_list(ibuf1),
|
||||
IMB_cast_away_list(ibuf2),
|
||||
IMB_cast_away_list(out),
|
||||
IMB_cast_away_list(ibuf3));
|
||||
}
|
||||
else {
|
||||
((SeqDoit)seq->plugin->doit)(
|
||||
seq->plugin->data, facf0, facf1, x, y,
|
||||
ibuf1, ibuf2, out, ibuf3);
|
||||
}
|
||||
|
||||
if (seq->plugin->version <= 2) {
|
||||
if (!use_temp_bufs) {
|
||||
if (ibuf1) IMB_convert_rgba_to_abgr(ibuf1);
|
||||
if (ibuf2) IMB_convert_rgba_to_abgr(ibuf2);
|
||||
if (ibuf3) IMB_convert_rgba_to_abgr(ibuf3);
|
||||
}
|
||||
IMB_convert_rgba_to_abgr(out);
|
||||
}
|
||||
if (seq->plugin->version <= 3 && float_rendering) {
|
||||
IMB_float_from_rect_simple(out);
|
||||
}
|
||||
|
||||
if (use_temp_bufs) {
|
||||
if (ibuf1) IMB_freeImBuf(ibuf1);
|
||||
if (ibuf2) IMB_freeImBuf(ibuf2);
|
||||
if (ibuf3) IMB_freeImBuf(ibuf3);
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
static int do_plugin_early_out(struct Sequence *UNUSED(seq),
|
||||
float UNUSED(facf0), float UNUSED(facf1))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void free_plugin(struct Sequence *seq)
|
||||
{
|
||||
free_plugin_seq(seq->plugin);
|
||||
seq->plugin = NULL;
|
||||
}
|
||||
|
||||
/* **********************************************************************
|
||||
* ALPHA OVER
|
||||
* ********************************************************************** */
|
||||
@ -3158,11 +2877,6 @@ static void load_noop(struct Sequence *UNUSED(seq))
|
||||
|
||||
}
|
||||
|
||||
static void init_plugin_noop(struct Sequence *UNUSED(seq), const char *UNUSED(fname))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void free_noop(struct Sequence *UNUSED(seq))
|
||||
{
|
||||
|
||||
@ -3264,7 +2978,6 @@ static struct SeqEffectHandle get_sequence_effect_impl(int seq_type)
|
||||
int sequence_type = seq_type;
|
||||
|
||||
rval.init = init_noop;
|
||||
rval.init_plugin = init_plugin_noop;
|
||||
rval.num_inputs = num_inputs_default;
|
||||
rval.load = load_noop;
|
||||
rval.free = free_noop;
|
||||
@ -3352,16 +3065,6 @@ static struct SeqEffectHandle get_sequence_effect_impl(int seq_type)
|
||||
rval.copy = copy_solid_color;
|
||||
rval.execute = do_solid_color;
|
||||
break;
|
||||
case SEQ_PLUGIN:
|
||||
rval.init_plugin = init_plugin;
|
||||
rval.num_inputs = num_inputs_plugin;
|
||||
rval.load = load_plugin;
|
||||
rval.free = free_plugin;
|
||||
rval.copy = copy_plugin;
|
||||
rval.execute = do_plugin_effect;
|
||||
rval.early_out = do_plugin_early_out;
|
||||
rval.get_default_fac = get_default_fac_fade;
|
||||
break;
|
||||
case SEQ_MULTICAM:
|
||||
rval.num_inputs = num_inputs_multicam;
|
||||
rval.early_out = early_out_multicam;
|
||||
|
@ -929,16 +929,6 @@ const char *give_seqname(Sequence *seq)
|
||||
if (seq->type < SEQ_EFFECT) {
|
||||
return seq->strip->dir;
|
||||
}
|
||||
else if (seq->type == SEQ_PLUGIN) {
|
||||
if (!(seq->flag & SEQ_EFFECT_NOT_LOADED) &&
|
||||
seq->plugin && seq->plugin->doit)
|
||||
{
|
||||
return seq->plugin->pname;
|
||||
}
|
||||
else {
|
||||
return "Plugin";
|
||||
}
|
||||
}
|
||||
else {
|
||||
return "Effect";
|
||||
}
|
||||
|
@ -56,7 +56,6 @@
|
||||
|
||||
#include "IMB_imbuf.h"
|
||||
|
||||
#include "BKE_plugin_types.h"
|
||||
#include "BKE_utildefines.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_main.h"
|
||||
@ -72,137 +71,6 @@
|
||||
#include "BKE_animsys.h"
|
||||
#include "BKE_colortools.h"
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/* All support for plugin textures: */
|
||||
int test_dlerr(const char *name, const char *symbol)
|
||||
{
|
||||
char *err;
|
||||
|
||||
err = BLI_dynlib_get_error_as_string(NULL);
|
||||
if (err) {
|
||||
printf("var1: %s, var2: %s, var3: %s\n", name, symbol, err);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
void open_plugin_tex(PluginTex *pit)
|
||||
{
|
||||
int (*version)(void);
|
||||
|
||||
/* init all the happy variables */
|
||||
pit->doit = NULL;
|
||||
pit->pname = NULL;
|
||||
pit->stnames = NULL;
|
||||
pit->varstr = NULL;
|
||||
pit->result = NULL;
|
||||
pit->cfra = NULL;
|
||||
pit->version = 0;
|
||||
pit->instance_init = NULL;
|
||||
|
||||
/* clear the error list */
|
||||
BLI_dynlib_get_error_as_string(NULL);
|
||||
|
||||
/* no BLI_dynlib_close! multiple opened plugins... */
|
||||
/* if (pit->handle) BLI_dynlib_close(pit->handle); */
|
||||
/* pit->handle= 0; */
|
||||
|
||||
/* open the needed object */
|
||||
pit->handle = BLI_dynlib_open(pit->name);
|
||||
if (test_dlerr(pit->name, pit->name)) return;
|
||||
|
||||
if (pit->handle != NULL) {
|
||||
/* find the address of the version function */
|
||||
version = (int (*)(void))BLI_dynlib_find_symbol(pit->handle, "plugin_tex_getversion");
|
||||
if (test_dlerr(pit->name, "plugin_tex_getversion")) return;
|
||||
|
||||
if (version != NULL) {
|
||||
pit->version = version();
|
||||
if (pit->version >= 2 && pit->version <= 6) {
|
||||
int (*info_func)(PluginInfo *);
|
||||
PluginInfo *info = (PluginInfo *) MEM_mallocN(sizeof(PluginInfo), "plugin_info");
|
||||
|
||||
info_func = (int (*)(PluginInfo *))BLI_dynlib_find_symbol(pit->handle, "plugin_getinfo");
|
||||
if (!test_dlerr(pit->name, "plugin_getinfo")) {
|
||||
info->instance_init = NULL;
|
||||
|
||||
info_func(info);
|
||||
|
||||
pit->doit = (int (*)(void))info->tex_doit;
|
||||
pit->callback = (void (*)(unsigned short))info->callback;
|
||||
pit->stypes = info->stypes;
|
||||
pit->vars = info->nvars;
|
||||
pit->pname = info->name;
|
||||
pit->stnames = info->snames;
|
||||
pit->varstr = info->varstr;
|
||||
pit->result = info->result;
|
||||
pit->cfra = info->cfra;
|
||||
pit->instance_init = info->instance_init;
|
||||
if (info->init) info->init();
|
||||
}
|
||||
MEM_freeN(info);
|
||||
}
|
||||
else {
|
||||
printf("Plugin returned unrecognized version number\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/* very badlevel define to bypass linking with BIF_interface.h */
|
||||
#define INT 96
|
||||
#define FLO 128
|
||||
|
||||
PluginTex *add_plugin_tex(char *str)
|
||||
{
|
||||
PluginTex *pit;
|
||||
VarStruct *varstr;
|
||||
int a;
|
||||
|
||||
pit = MEM_callocN(sizeof(PluginTex), "plugintex");
|
||||
|
||||
BLI_strncpy(pit->name, str, sizeof(pit->name));
|
||||
open_plugin_tex(pit);
|
||||
|
||||
if (pit->doit == NULL) {
|
||||
if (pit->handle == NULL) {; } //XXX error("no plugin: %s", str);
|
||||
else {; } //XXX error("in plugin: %s", str);
|
||||
MEM_freeN(pit);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
varstr = pit->varstr;
|
||||
for (a = 0; a < pit->vars; a++, varstr++) {
|
||||
if ( (varstr->type & FLO) == FLO)
|
||||
pit->data[a] = varstr->def;
|
||||
else if ( (varstr->type & INT) == INT)
|
||||
*((int *)(pit->data + a)) = (int) varstr->def;
|
||||
}
|
||||
|
||||
if (pit->instance_init)
|
||||
pit->instance_init((void *) pit->data);
|
||||
|
||||
return pit;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
void free_plugin_tex(PluginTex *pit)
|
||||
{
|
||||
if (pit == NULL) return;
|
||||
|
||||
/* no BLI_dynlib_close: same plugin can be opened multiple times, 1 handle */
|
||||
MEM_freeN(pit);
|
||||
}
|
||||
|
||||
/* ****************** Mapping ******************* */
|
||||
|
||||
TexMapping *add_tex_mapping(void)
|
||||
@ -550,8 +418,6 @@ int colorband_element_remove(struct ColorBand *coba, int index)
|
||||
|
||||
void BKE_texture_free(Tex *tex)
|
||||
{
|
||||
free_plugin_tex(tex->plugin);
|
||||
|
||||
if (tex->coba) MEM_freeN(tex->coba);
|
||||
if (tex->env) BKE_free_envmap(tex->env);
|
||||
if (tex->pd) BKE_free_pointdensity(tex->pd);
|
||||
@ -573,10 +439,6 @@ void BKE_texture_free(Tex *tex)
|
||||
|
||||
void default_tex(Tex *tex)
|
||||
{
|
||||
PluginTex *pit;
|
||||
VarStruct *varstr;
|
||||
int a;
|
||||
|
||||
tex->type = TEX_CLOUDS;
|
||||
tex->stype = 0;
|
||||
tex->flag = TEX_CHECKER_ODD;
|
||||
@ -644,15 +506,6 @@ void default_tex(Tex *tex)
|
||||
tex->ot->output = TEX_OCN_DISPLACEMENT;
|
||||
tex->ot->object = NULL;
|
||||
}
|
||||
pit = tex->plugin;
|
||||
if (pit) {
|
||||
varstr = pit->varstr;
|
||||
if (varstr) {
|
||||
for (a = 0; a < pit->vars; a++, varstr++) {
|
||||
pit->data[a] = varstr->def;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tex->iuser.fie_ima = 2;
|
||||
tex->iuser.ok = 1;
|
||||
@ -833,11 +686,6 @@ Tex *BKE_texture_copy(Tex *tex)
|
||||
if (texn->type == TEX_IMAGE) id_us_plus((ID *)texn->ima);
|
||||
else texn->ima = NULL;
|
||||
|
||||
if (texn->plugin) {
|
||||
texn->plugin = MEM_dupallocN(texn->plugin);
|
||||
open_plugin_tex(texn->plugin);
|
||||
}
|
||||
|
||||
if (texn->coba) texn->coba = MEM_dupallocN(texn->coba);
|
||||
if (texn->env) texn->env = BKE_copy_envmap(texn->env);
|
||||
if (texn->pd) texn->pd = BKE_copy_pointdensity(texn->pd);
|
||||
@ -865,11 +713,6 @@ Tex *localize_texture(Tex *tex)
|
||||
|
||||
/* image texture: BKE_texture_free also doesn't decrease */
|
||||
|
||||
if (texn->plugin) {
|
||||
texn->plugin = MEM_dupallocN(texn->plugin);
|
||||
open_plugin_tex(texn->plugin);
|
||||
}
|
||||
|
||||
if (texn->coba) texn->coba = MEM_dupallocN(texn->coba);
|
||||
if (texn->env) {
|
||||
texn->env = BKE_copy_envmap(texn->env);
|
||||
@ -1058,7 +901,7 @@ void autotexname(Tex *tex)
|
||||
{
|
||||
Main *bmain = G.main;
|
||||
char texstr[20][15] = {"None", "Clouds", "Wood", "Marble", "Magic", "Blend",
|
||||
"Stucci", "Noise", "Image", "Plugin", "EnvMap", "Musgrave",
|
||||
"Stucci", "Noise", "Image", "EnvMap", "Musgrave",
|
||||
"Voronoi", "DistNoise", "Point Density", "Voxel Data", "Ocean", "", "", ""};
|
||||
Image *ima;
|
||||
char di[FILE_MAXDIR], fi[FILE_MAXFILE];
|
||||
@ -1079,7 +922,6 @@ void autotexname(Tex *tex)
|
||||
}
|
||||
else new_id(&bmain->tex, (ID *)tex, texstr[tex->type]);
|
||||
}
|
||||
else if (tex->type == TEX_PLUGIN && tex->plugin) new_id(&bmain->tex, (ID *)tex, tex->plugin->pname);
|
||||
else new_id(&bmain->tex, (ID *)tex, texstr[tex->type]);
|
||||
}
|
||||
}
|
||||
@ -1565,11 +1407,7 @@ void BKE_free_oceantex(struct OceanTex *ot)
|
||||
/* ------------------------------------------------------------------------- */
|
||||
int BKE_texture_dependsOnTime(const struct Tex *texture)
|
||||
{
|
||||
if (texture->plugin) {
|
||||
// assume all plugins depend on time
|
||||
return 1;
|
||||
}
|
||||
else if (texture->ima &&
|
||||
if (texture->ima &&
|
||||
ELEM(texture->ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE))
|
||||
{
|
||||
return 1;
|
||||
|
@ -493,11 +493,6 @@ void BLI_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int
|
||||
case ID_TE:
|
||||
{
|
||||
Tex *tex = (Tex *)id;
|
||||
if (tex->plugin) {
|
||||
/* FIXME: rewrite_path assumes path length of FILE_MAX, but
|
||||
* tex->plugin->name is 160. ... is this field even a path? */
|
||||
//rewrite_path(tex->plugin->name, visit_cb, bpath_user_data);
|
||||
}
|
||||
if (tex->type == TEX_VOXELDATA && TEX_VD_IS_SOURCE_PATH(tex->vd->file_format)) {
|
||||
rewrite_path_fixed(tex->vd->source_path, visit_cb, absbase, bpath_user_data);
|
||||
}
|
||||
@ -538,9 +533,6 @@ void BLI_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int
|
||||
rewrite_path_fixed(seq->strip->dir, visit_cb, absbase, bpath_user_data);
|
||||
}
|
||||
}
|
||||
else if (seq->plugin) {
|
||||
rewrite_path_fixed(seq->plugin->name, visit_cb, absbase, bpath_user_data);
|
||||
}
|
||||
|
||||
}
|
||||
SEQ_END
|
||||
|
@ -138,7 +138,6 @@
|
||||
#include "BKE_screen.h"
|
||||
#include "BKE_sequencer.h"
|
||||
#include "BKE_text.h" // for txt_extended_ascii_as_utf8
|
||||
#include "BKE_texture.h" // for open_plugin_tex
|
||||
#include "BKE_tracking.h"
|
||||
#include "BKE_utildefines.h" // SWITCH_INT DATA ENDB DNA1 O_BINARY GLOB USER TEST REND
|
||||
#include "BKE_sound.h"
|
||||
@ -3164,17 +3163,7 @@ static void direct_link_texture(FileData *fd, Tex *tex)
|
||||
{
|
||||
tex->adt = newdataadr(fd, tex->adt);
|
||||
direct_link_animdata(fd, tex->adt);
|
||||
|
||||
tex->plugin = newdataadr(fd, tex->plugin);
|
||||
if (tex->plugin) {
|
||||
tex->plugin->handle = NULL;
|
||||
open_plugin_tex(tex->plugin);
|
||||
/* initialize data for this instance, if an initialization
|
||||
* function exists.
|
||||
*/
|
||||
if (tex->plugin->instance_init)
|
||||
tex->plugin->instance_init((void *)tex->plugin->data);
|
||||
}
|
||||
|
||||
tex->coba = newdataadr(fd, tex->coba);
|
||||
tex->env = newdataadr(fd, tex->env);
|
||||
if (tex->env) {
|
||||
@ -4957,7 +4946,6 @@ static void direct_link_scene(FileData *fd, Scene *sce)
|
||||
/* a patch: after introduction of effects with 3 input strips */
|
||||
if (seq->seq3 == NULL) seq->seq3 = seq->seq2;
|
||||
|
||||
seq->plugin = newdataadr(fd, seq->plugin);
|
||||
seq->effectdata = newdataadr(fd, seq->effectdata);
|
||||
|
||||
if (seq->type & SEQ_EFFECT)
|
||||
|
@ -88,7 +88,7 @@
|
||||
#include "BKE_pointcache.h"
|
||||
#include "BKE_screen.h"
|
||||
#include "BKE_sequencer.h"
|
||||
#include "BKE_texture.h" // for open_plugin_tex
|
||||
#include "BKE_texture.h"
|
||||
#include "BKE_utildefines.h" // SWITCH_INT DATA ENDB DNA1 O_BINARY GLOB USER TEST REND
|
||||
#include "BKE_sound.h"
|
||||
|
||||
|
@ -1957,7 +1957,6 @@ static void write_textures(WriteData *wd, ListBase *idbase)
|
||||
if (tex->adt) write_animdata(wd, tex->adt);
|
||||
|
||||
/* direct data */
|
||||
if (tex->type == TEX_PLUGIN && tex->plugin) writestruct(wd, DATA, "PluginTex", 1, tex->plugin);
|
||||
if (tex->coba) writestruct(wd, DATA, "ColorBand", 1, tex->coba);
|
||||
if (tex->type == TEX_ENVMAP && tex->env) writestruct(wd, DATA, "EnvMap", 1, tex->env);
|
||||
if (tex->type == TEX_POINTDENSITY && tex->pd) {
|
||||
@ -2151,7 +2150,6 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
|
||||
if (seq->strip && seq->strip->done==0) {
|
||||
/* write strip with 'done' at 0 because readfile */
|
||||
|
||||
if (seq->plugin) writestruct(wd, DATA, "PluginSeq", 1, seq->plugin);
|
||||
if (seq->effectdata) {
|
||||
switch (seq->type) {
|
||||
case SEQ_COLOR:
|
||||
|
@ -1,58 +0,0 @@
|
||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# 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) 2006, Blender Foundation
|
||||
# All rights reserved.
|
||||
#
|
||||
# The Original Code is: all of this file.
|
||||
#
|
||||
# Contributor(s): Jacques Beaurain.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
set(INC
|
||||
.
|
||||
..
|
||||
../blenlib
|
||||
../blenloader
|
||||
../imbuf
|
||||
../makesdna
|
||||
../../../intern/guardedalloc
|
||||
)
|
||||
|
||||
set(INC_SYS
|
||||
|
||||
)
|
||||
|
||||
set(SRC
|
||||
intern/pluginapi.c
|
||||
|
||||
documentation.h
|
||||
externdef.h
|
||||
floatpatch.h
|
||||
iff.h
|
||||
plugin.h
|
||||
util.h
|
||||
)
|
||||
|
||||
if(WITH_CODEC_QUICKTIME)
|
||||
list(APPEND INC_SYS
|
||||
${QUICKTIME_INCLUDE_DIRS}
|
||||
)
|
||||
add_definitions(-DWITH_QUICKTIME)
|
||||
endif()
|
||||
|
||||
blender_add_lib(bf_blenpluginapi "${SRC}" "${INC}" "${INC_SYS}")
|
@ -1,23 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
Import ('env')
|
||||
|
||||
sources = env.Glob('intern/*.c')
|
||||
|
||||
incs = '. .. #/intern/guardedalloc ../blenlib ../imbuf ../makesdna ../blenloader'
|
||||
|
||||
defs = []
|
||||
|
||||
incs += ' ' + env["BF_PTHREADS_INC"]
|
||||
|
||||
if env['WITH_BF_QUICKTIME']:
|
||||
defs.append('WITH_QUICKTIME')
|
||||
incs += ' ' + env['BF_QUICKTIME_INC']
|
||||
|
||||
if env['OURPLATFORM'] == 'linux':
|
||||
cflags='-pthread'
|
||||
incs += ' ../../../extern/binreloc/include'
|
||||
|
||||
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
|
||||
incs += ' ' + env['BF_PTHREADS_INC']
|
||||
|
||||
env.BlenderLib ( libname = 'bf_blenpluginapi', sources = sources, includes = Split(incs), defines = defs, libtype=['core'], priority = [170] )
|
@ -1,71 +0,0 @@
|
||||
/*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file blender/blenpluginapi/documentation.h
|
||||
* \ingroup blpluginapi
|
||||
*
|
||||
* \mainpage plugin API - the access point for texture and sequence
|
||||
* plugins
|
||||
*
|
||||
* \section about About the plugin API
|
||||
*
|
||||
* This API wraps functions that are used by texture and sequence
|
||||
* plugins. They are explicitly wrapped in order to make the
|
||||
* dependencies to the rest of the system clear.
|
||||
*
|
||||
* \section issues Known issues with the plugin API
|
||||
*
|
||||
* - It can be difficult at times to get access to the API functions
|
||||
* linked into the final executable. On gcc, the -fpic and -shared
|
||||
* flags take care of this. On Irix, -shared is needed, but you also
|
||||
* need a reference to the function to get the handle. This has
|
||||
* momentarily been taken care of by pluginapi_force_ref().
|
||||
*
|
||||
* - Plugins need to define three functions that are needed for
|
||||
* version bookkeeping and information. The plugin loading code
|
||||
* explicitly checks for these functions. The nanes depend on whether
|
||||
* it is a texture or sequence plugin.
|
||||
*
|
||||
* - The plugin loading occurs in sequence.c and texture.c. The
|
||||
* following functions are involved:
|
||||
* - open_plugin_seq() (used in readfile.c, editseq.c, sequence.c)
|
||||
* - add_plugin_seq() (used in editseq.c, sequence.c)
|
||||
* - free_plugin_seq() (used in editseq.c, sequence.c)
|
||||
* - open_plugin_tex() (used in texture.c, readfile.c)
|
||||
* - add_plugin_tex() (used in texture.c, buttons.c)
|
||||
* - free_plugin_tex() (used in texture.c, buttons.c)
|
||||
* - test_dlerr() (used in texture.c, sequence.c)
|
||||
* Since the plugins are about to phase out, we will not sanitize this
|
||||
* code. It will be removed as soon as the replacing system is in
|
||||
* place.
|
||||
*
|
||||
* \section dependencies Dependencies
|
||||
*
|
||||
* The plugins wraps functions from IMB and BLI. In addition, they
|
||||
* define some useful variables.
|
||||
*/
|
@ -1,50 +0,0 @@
|
||||
/* Copyright (c) 1999, Not a Number / NeoGeo b.v.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Contact: info@blender.org
|
||||
* Information: http://www.blender.org
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __EXTERNDEF_H__
|
||||
#define __EXTERNDEF_H__
|
||||
|
||||
/** \file blender/blenpluginapi/externdef.h
|
||||
* \ingroup blpluginapi
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef PLUGIN_INTERN
|
||||
#define LIBEXPORT __declspec(dllexport)
|
||||
#define LIBIMPORT __declspec(dllexport)
|
||||
#else
|
||||
#define LIBEXPORT __declspec(dllexport)
|
||||
#define LIBIMPORT extern __declspec(dllimport)
|
||||
#endif
|
||||
#elif !defined(WIN32)
|
||||
#define LIBEXPORT extern
|
||||
#define LIBIMPORT extern
|
||||
#endif
|
||||
|
||||
#endif /* __EXTERNDEF_H__ */
|
@ -1,93 +0,0 @@
|
||||
/* Copyright (c) 1999, Not a Number / NeoGeo b.v.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Contact: info@blender.org
|
||||
* Information: http://www.blender.org
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __FLOATPATCH_H__
|
||||
#define __FLOATPATCH_H__
|
||||
|
||||
/** \file blender/blenpluginapi/floatpatch.h
|
||||
* \ingroup blpluginapi
|
||||
*/
|
||||
|
||||
/* floating point libs differ at systems... with these defines it comilies at all! */
|
||||
|
||||
#ifdef MIPS1
|
||||
#else
|
||||
|
||||
#define fabsf(a) fabs((double)(a))
|
||||
|
||||
#define facos acosf
|
||||
#define acosf(a) acos((double)(a))
|
||||
|
||||
#define fasin asinf
|
||||
#define asinf(a) asin((double)(a))
|
||||
|
||||
#define fatan atanf
|
||||
#define atanf(a) atan((double)(a))
|
||||
|
||||
#define fatan2 atan2f
|
||||
#define atan2f(a, b) atan2((double)(a), (double)(b))
|
||||
|
||||
#define fmodf(a, b) fmod((double)(a), (double)(b))
|
||||
|
||||
#define fcos cosf
|
||||
#define cosf(a) cos((double)(a))
|
||||
|
||||
#define fsin sinf
|
||||
#define sinf(a) sin((double)(a))
|
||||
|
||||
#define ftan tanf
|
||||
#define tanf(a) tan((double)(a))
|
||||
|
||||
#define fexp expf
|
||||
#define expf(a) exp((double)(a))
|
||||
|
||||
#define flog logf
|
||||
#define logf(a) log((double)(a))
|
||||
|
||||
#define flog10 log10f
|
||||
#define log10f(a) log10((double)(a))
|
||||
|
||||
#define fsqrt sqrtf
|
||||
#define sqrtf(a) sqrt((double)(a))
|
||||
|
||||
#define fceil ceilf
|
||||
#define ceilf(a) ceil((double)(a))
|
||||
|
||||
#define ffloor floorf
|
||||
#define floorf(a) floor((double)(a))
|
||||
|
||||
#define fpow powf
|
||||
#define powf(a, b) pow((double)(a), (double)(b))
|
||||
|
||||
/* #endif */
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __FLOATPATCH_H__ */
|
||||
|
@ -1,122 +0,0 @@
|
||||
/* Copyright (c) 1999, Not a Number / NeoGeo b.v.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Contact: info@blender.org
|
||||
* Information: http://www.blender.org
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __IFF_H__
|
||||
#define __IFF_H__
|
||||
|
||||
/** \file blender/blenpluginapi/iff.h
|
||||
* \ingroup blpluginapi
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "util.h"
|
||||
#include "externdef.h"
|
||||
|
||||
struct ImMetaData;
|
||||
|
||||
#define IB_MIPMAP_LEVELS 20
|
||||
#define IB_FILENAME_SIZE 1023
|
||||
|
||||
typedef struct ImBuf {
|
||||
struct ImBuf *next, *prev; /**< allow lists of ImBufs, for caches or flipbooks */
|
||||
short x, y; /**< width and Height of our image buffer */
|
||||
unsigned char depth; /**< Active amount of bits/bitplanes */
|
||||
unsigned int *rect; /**< pixel values stored here */
|
||||
unsigned int *crect; /**< color corrected pixel values stored here */
|
||||
int flags; /**< Controls which components should exist. */
|
||||
int mall; /**< what is malloced internal, and can be freed */
|
||||
int *zbuf; /**< z buffer data, original zbuffer */
|
||||
float *zbuf_float; /**< z buffer data, camera coordinates */
|
||||
void *userdata; /**< temporary storage, only used by baking at the moment */
|
||||
unsigned char *encodedbuffer; /**< Compressed image only used with png currently */
|
||||
unsigned int encodedsize; /**< Size of data written to encodedbuffer */
|
||||
unsigned int encodedbuffersize; /**< Size of encodedbuffer */
|
||||
|
||||
float *rect_float; /** < floating point Rect equivalent
|
||||
* Linear RGB color space - may need gamma correction to
|
||||
* sRGB when generating 8bit representations */
|
||||
int channels; /**< amount of channels in rect_float (0 = 4 channel default) */
|
||||
float dither; /**< random dither value, for conversion from float -> byte rect */
|
||||
short profile; /** color space/profile preset that the byte rect buffer represents */
|
||||
char profile_filename[1024]; /** to be implemented properly, specific filename for custom profiles */
|
||||
|
||||
/* mipmapping */
|
||||
struct ImBuf *mipmap[IB_MIPMAP_LEVELS]; /**< MipMap levels, a series of halved images */
|
||||
int miplevels;
|
||||
|
||||
/* externally used flags */
|
||||
int index; /* reference index for ImBuf lists */
|
||||
int userflags; /* used to set imbuf to dirty and other stuff */
|
||||
struct ImMetaData *metadata;
|
||||
|
||||
/* file information */
|
||||
int ftype; /* file type we are going to save as */
|
||||
char name[IB_FILENAME_SIZE]; /* filename associated with this image */
|
||||
|
||||
/* memory cache limiter */
|
||||
struct MEM_CacheLimiterHandle_s *c_handle; /* handle for cache limiter */
|
||||
int refcounter; /* reference counter for multiple users */
|
||||
} ImBuf;
|
||||
|
||||
LIBIMPORT struct ImBuf *allocImBuf(short, short, uchar, uint);
|
||||
LIBIMPORT struct ImBuf *dupImBuf(struct ImBuf *);
|
||||
LIBIMPORT void freeImBuf(struct ImBuf*);
|
||||
|
||||
LIBIMPORT short saveiff(struct ImBuf *, char *, int);
|
||||
|
||||
LIBIMPORT struct ImBuf *loadifffile(int, int);
|
||||
LIBIMPORT struct ImBuf *loadiffname(char *, int);
|
||||
LIBIMPORT struct ImBuf *testiffname(char *, int);
|
||||
|
||||
LIBIMPORT struct ImBuf *onehalf(struct ImBuf *);
|
||||
LIBIMPORT struct ImBuf *half_x(struct ImBuf *);
|
||||
LIBIMPORT struct ImBuf *half_y(struct ImBuf *);
|
||||
LIBIMPORT struct ImBuf *double_x(struct ImBuf *);
|
||||
LIBIMPORT struct ImBuf *double_y(struct ImBuf *);
|
||||
LIBIMPORT struct ImBuf *double_fast_x(struct ImBuf *);
|
||||
LIBIMPORT struct ImBuf *double_fast_y(struct ImBuf *);
|
||||
|
||||
LIBIMPORT int ispic(char *);
|
||||
|
||||
LIBIMPORT struct ImBuf *scaleImBuf(struct ImBuf *, short, short);
|
||||
LIBIMPORT struct ImBuf *scalefastImBuf(struct ImBuf *, short, short);
|
||||
|
||||
LIBIMPORT void de_interlace(struct ImBuf *ib);
|
||||
LIBIMPORT void interlace(struct ImBuf *ib);
|
||||
|
||||
LIBIMPORT void IMB_rectcpy(struct ImBuf *dbuf, struct ImBuf *sbuf,
|
||||
int destx, int desty, int srcx, int srcy, int width, int height);
|
||||
|
||||
LIBIMPORT void IMB_rectfill(struct ImBuf *drect, const float col[4]);
|
||||
LIBIMPORT void IMB_rectfill_area(struct ImBuf *ibuf, const float col[4], int x1, int y1, int x2, int y2);
|
||||
LIBIMPORT void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, const float col[4], int x1, int y1, int x2, int y2);
|
||||
LIBIMPORT void IMB_rectfill_alpha(struct ImBuf *drect, const float value);
|
||||
|
||||
#endif /* __IFF_H__ */
|
||||
|
@ -1,305 +0,0 @@
|
||||
/*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
* Wrappers for the plugin api. This api is up for removal.
|
||||
*/
|
||||
|
||||
/** \file blender/blenpluginapi/intern/pluginapi.c
|
||||
* \ingroup blenpluginapi
|
||||
*/
|
||||
|
||||
|
||||
/* There are four headers making up the plugin api:
|
||||
* - floatpatch.h : Wraps math functions for mips platforms, no code
|
||||
* required.
|
||||
* - iff.h : Defines, macros and functions for dealing
|
||||
* with image buffer things.
|
||||
* - plugin.h : Wraps some plugin handling types, accesses noise
|
||||
* functions.
|
||||
* - util.h : Useful defines, memory management.
|
||||
*/
|
||||
|
||||
#define PLUGIN_INTERN /* This tells the LIBEXPORT macro to compile with
|
||||
* dll export set on windows */
|
||||
|
||||
#ifdef WIN32
|
||||
#include "blenpluginapi/util.h"
|
||||
#else
|
||||
#include "blenpluginapi/util.h"
|
||||
#endif
|
||||
#include "iff.h"
|
||||
#include "plugin.h"
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BLO_sys_types.h" // needed for intptr_t
|
||||
|
||||
#include "BLI_blenlib.h" /* util and noise functions */
|
||||
#include "BLI_threads.h" /* For threadsfe guardedalloc malloc/calloc/free */
|
||||
#include "IMB_imbuf.h" /* image buffer stuff */
|
||||
#define GET_INT_FROM_POINTER(i) ((int)(intptr_t)(i)) /* should use BKE_utildefines.h */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* stuff from util.h */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
LIBEXPORT void *mallocN(int len, char *str)
|
||||
{
|
||||
return MEM_mallocN(len, str);
|
||||
}
|
||||
|
||||
LIBEXPORT void *callocN(int len, char *str)
|
||||
{
|
||||
return MEM_callocN(len, str);
|
||||
}
|
||||
|
||||
LIBEXPORT short freeN(void *vmemh)
|
||||
{
|
||||
return MEM_freeN(vmemh);
|
||||
}
|
||||
|
||||
/* these are not needed anymore, mallocN/callocN/freeN is now threadsafe */
|
||||
LIBEXPORT void *mallocT(int len, char *str)
|
||||
{
|
||||
return MEM_mallocN(len, str);
|
||||
}
|
||||
|
||||
LIBEXPORT void *callocT(int len, char *str)
|
||||
{
|
||||
return MEM_callocN(len, str);
|
||||
}
|
||||
|
||||
LIBEXPORT void freeT(void *vmemh)
|
||||
{
|
||||
MEM_freeN(vmemh);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* stuff from iff.h */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
LIBEXPORT struct ImBuf *allocImBuf(short x,
|
||||
short y,
|
||||
uchar d,
|
||||
uint flags)
|
||||
{
|
||||
return IMB_allocImBuf(x, y, d, flags);
|
||||
}
|
||||
|
||||
|
||||
LIBEXPORT struct ImBuf *dupImBuf(struct ImBuf *ib)
|
||||
{
|
||||
return IMB_dupImBuf(ib);
|
||||
}
|
||||
|
||||
LIBEXPORT void freeImBuf(struct ImBuf* ib)
|
||||
{
|
||||
IMB_freeImBuf(ib);
|
||||
}
|
||||
|
||||
LIBEXPORT short saveiff(struct ImBuf *ib,
|
||||
char *c,
|
||||
int i)
|
||||
{
|
||||
return IMB_saveiff(ib, c, i);
|
||||
}
|
||||
|
||||
LIBEXPORT struct ImBuf *loadifffile(int a,
|
||||
int b)
|
||||
{
|
||||
return IMB_loadifffile(a, b, "loadifffile");
|
||||
}
|
||||
|
||||
LIBEXPORT struct ImBuf *loadiffname(char *n,
|
||||
int flags)
|
||||
{
|
||||
return IMB_loadiffname(n, flags);
|
||||
}
|
||||
|
||||
LIBEXPORT struct ImBuf *testiffname(char *n,
|
||||
int flags)
|
||||
{
|
||||
return IMB_testiffname(n, flags);
|
||||
}
|
||||
|
||||
LIBEXPORT struct ImBuf *onehalf(struct ImBuf *ib)
|
||||
{
|
||||
return IMB_onehalf(ib);
|
||||
}
|
||||
|
||||
LIBEXPORT struct ImBuf *half_x(struct ImBuf *ib)
|
||||
{
|
||||
return IMB_half_x(ib);
|
||||
}
|
||||
|
||||
LIBEXPORT struct ImBuf *half_y(struct ImBuf *ib)
|
||||
{
|
||||
return IMB_half_y(ib);
|
||||
}
|
||||
|
||||
LIBEXPORT struct ImBuf *double_x(struct ImBuf *ib)
|
||||
{
|
||||
return IMB_double_x(ib);
|
||||
}
|
||||
|
||||
LIBEXPORT struct ImBuf *double_y(struct ImBuf *ib)
|
||||
{
|
||||
return IMB_double_y(ib);
|
||||
}
|
||||
|
||||
LIBEXPORT struct ImBuf *double_fast_x(struct ImBuf *ib)
|
||||
{
|
||||
return IMB_double_fast_x(ib);
|
||||
}
|
||||
|
||||
LIBEXPORT struct ImBuf *double_fast_y(struct ImBuf *ib)
|
||||
{
|
||||
return IMB_double_fast_y(ib);
|
||||
}
|
||||
|
||||
LIBEXPORT int ispic(char * name)
|
||||
{
|
||||
return IMB_ispic(name);
|
||||
}
|
||||
|
||||
/* still the same name */
|
||||
/* void (*ditherfunc)(struct ImBuf *, short, short) {} */
|
||||
|
||||
LIBEXPORT struct ImBuf *scaleImBuf(struct ImBuf *ib,
|
||||
short nx,
|
||||
short ny)
|
||||
{
|
||||
return IMB_scaleImBuf(ib, nx, ny);
|
||||
}
|
||||
|
||||
LIBEXPORT struct ImBuf *scalefastImBuf(struct ImBuf *ib,
|
||||
short x,
|
||||
short y)
|
||||
{
|
||||
return IMB_scalefastImBuf(ib, x, y);
|
||||
}
|
||||
|
||||
/* Extra ones that some NaN (read Ton) plugins use,
|
||||
* even though they aren't in the header
|
||||
*/
|
||||
|
||||
LIBEXPORT void interlace(struct ImBuf *ibuf)
|
||||
{
|
||||
IMB_interlace(ibuf);
|
||||
}
|
||||
|
||||
LIBEXPORT void de_interlace(struct ImBuf *ib)
|
||||
{
|
||||
IMB_de_interlace(ib);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* stuff from plugin.h */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* These three need to be defined in the plugin itself. The plugin
|
||||
* loader looks for these functions to check whether it can use the
|
||||
* plugin. For sequences, something similar exists. */
|
||||
/* int plugin_tex_getversion(void); */
|
||||
/* int plugin_seq_getversion(void); */
|
||||
/* void plugin_getinfo(PluginInfo *); */
|
||||
|
||||
LIBEXPORT float hnoise(float noisesize,
|
||||
float x,
|
||||
float y,
|
||||
float z)
|
||||
{
|
||||
return BLI_hnoise(noisesize, x, y, z);
|
||||
}
|
||||
|
||||
LIBEXPORT float hnoisep(float noisesize,
|
||||
float x,
|
||||
float y,
|
||||
float z)
|
||||
{
|
||||
return BLI_hnoisep(noisesize, x, y, z);
|
||||
}
|
||||
|
||||
LIBEXPORT float turbulence(float noisesize,
|
||||
float x,
|
||||
float y,
|
||||
float z,
|
||||
int depth)
|
||||
{
|
||||
return BLI_turbulence(noisesize, x, y, z, depth);
|
||||
}
|
||||
|
||||
LIBEXPORT float turbulence1(float noisesize,
|
||||
float x,
|
||||
float y,
|
||||
float z,
|
||||
int depth)
|
||||
{
|
||||
return BLI_turbulence1(noisesize, x, y, z, depth);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* Stupid hack - force the inclusion of all of the
|
||||
* above functions in the binary by 'using' each one...
|
||||
* Otherwise they will not be imported from the archive
|
||||
* library on Unix. -zr
|
||||
*/
|
||||
int pluginapi_force_ref(void);
|
||||
|
||||
int pluginapi_force_ref(void)
|
||||
{
|
||||
return
|
||||
GET_INT_FROM_POINTER(mallocN) +
|
||||
GET_INT_FROM_POINTER(callocN) +
|
||||
GET_INT_FROM_POINTER(freeN) +
|
||||
GET_INT_FROM_POINTER(mallocT) +
|
||||
GET_INT_FROM_POINTER(callocT) +
|
||||
GET_INT_FROM_POINTER(freeT) +
|
||||
GET_INT_FROM_POINTER(allocImBuf) +
|
||||
GET_INT_FROM_POINTER(dupImBuf) +
|
||||
GET_INT_FROM_POINTER(freeImBuf) +
|
||||
GET_INT_FROM_POINTER(saveiff) +
|
||||
GET_INT_FROM_POINTER(loadifffile) +
|
||||
GET_INT_FROM_POINTER(loadiffname) +
|
||||
GET_INT_FROM_POINTER(testiffname) +
|
||||
GET_INT_FROM_POINTER(onehalf) +
|
||||
GET_INT_FROM_POINTER(half_x) +
|
||||
GET_INT_FROM_POINTER(half_y) +
|
||||
GET_INT_FROM_POINTER(double_x) +
|
||||
GET_INT_FROM_POINTER(double_y) +
|
||||
GET_INT_FROM_POINTER(double_fast_x) +
|
||||
GET_INT_FROM_POINTER(double_fast_y) +
|
||||
GET_INT_FROM_POINTER(ispic) +
|
||||
GET_INT_FROM_POINTER(scaleImBuf) +
|
||||
GET_INT_FROM_POINTER(scalefastImBuf) +
|
||||
GET_INT_FROM_POINTER(hnoise) +
|
||||
GET_INT_FROM_POINTER(hnoisep) +
|
||||
GET_INT_FROM_POINTER(turbulence) +
|
||||
GET_INT_FROM_POINTER(turbulence1) +
|
||||
GET_INT_FROM_POINTER(de_interlace) +
|
||||
GET_INT_FROM_POINTER(interlace);
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
LIBRARY
|
||||
EXPORTS
|
||||
mallocN
|
||||
callocN
|
||||
freeN
|
||||
mallocT
|
||||
callocT
|
||||
freeT
|
||||
hnoise
|
||||
hnoisep
|
||||
turbulence
|
||||
turbulence1
|
||||
allocImBuf
|
||||
dupImBuf
|
||||
freeImBuf
|
||||
converttocmap
|
||||
saveiff
|
||||
loadiffmem
|
||||
loadifffile
|
||||
loadiffname
|
||||
testiffname
|
||||
onehalf
|
||||
onethird
|
||||
halflace
|
||||
half_x
|
||||
half_y
|
||||
double_x
|
||||
double_y
|
||||
double_fast_x
|
||||
double_fast_y
|
||||
ispic
|
||||
dit2
|
||||
dit0
|
||||
scaleImBuf
|
||||
scalefastImBuf
|
||||
scalefieldImBuf
|
||||
scalefastfieldImBuf
|
||||
de_interlace
|
||||
interlace
|
||||
gamwarp
|
@ -1,107 +0,0 @@
|
||||
/* Copyright (c) 1999, Not a Number / NeoGeo b.v.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Contact: info@blender.org
|
||||
* Information: http://www.blender.org
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __PLUGIN_H__
|
||||
#define __PLUGIN_H__
|
||||
|
||||
/** \file blender/blenpluginapi/plugin.h
|
||||
* \ingroup blpluginapi
|
||||
*/
|
||||
|
||||
#include "externdef.h"
|
||||
#include "iff.h"
|
||||
#include "util.h"
|
||||
#include "floatpatch.h"
|
||||
|
||||
#define B_PLUGIN_VERSION 6
|
||||
|
||||
typedef int (*TexDoit)(int, void*, float*, float*, float*, float*);
|
||||
typedef int (*TexDoitold)(int, void*, float*, float*, float*);
|
||||
typedef void (*SeqDoit)(void*, float, float, int, int, ImBuf*, ImBuf*, ImBuf*, ImBuf*);
|
||||
|
||||
typedef struct VarStruct {
|
||||
int type;
|
||||
char name[16];
|
||||
float def, min, max;
|
||||
char tip[80];
|
||||
} VarStruct;
|
||||
|
||||
typedef struct _PluginInfo {
|
||||
char *name;
|
||||
char *snames;
|
||||
|
||||
int stypes;
|
||||
int nvars;
|
||||
VarStruct *varstr;
|
||||
float *result;
|
||||
float *cfra;
|
||||
|
||||
void (*init)(void);
|
||||
void (*callback)(int);
|
||||
TexDoit tex_doit;
|
||||
SeqDoit seq_doit;
|
||||
|
||||
void (*instance_init)(void *);
|
||||
} PluginInfo;
|
||||
|
||||
LIBEXPORT int plugin_tex_getversion(void);
|
||||
LIBEXPORT int plugin_seq_getversion(void);
|
||||
LIBEXPORT void plugin_getinfo(PluginInfo *);
|
||||
|
||||
/* *************** defines for button types ************** */
|
||||
|
||||
#define CHA 32
|
||||
#define INT 96
|
||||
#define FLO 128
|
||||
|
||||
#define TOG (3<<9)
|
||||
#define NUM (5<<9)
|
||||
#define LABEL (10<<9)
|
||||
#define NUMSLI (14<<9)
|
||||
#define COL (15<<9)
|
||||
|
||||
/* return values (bitfield like) for textures (DNA_texture_types.h) */
|
||||
#define TEX_INT 0
|
||||
#define TEX_RGB 1
|
||||
#define TEX_NOR 2
|
||||
|
||||
/* *************** API functions ******************** */
|
||||
|
||||
/* derived from the famous Perlin noise */
|
||||
LIBIMPORT float hnoise(float noisesize, float x, float y, float z);
|
||||
/* the original Perlin noise */
|
||||
LIBIMPORT float hnoisep(float noisesize, float x, float y, float z);
|
||||
|
||||
/* soft turbulence */
|
||||
LIBIMPORT float turbulence(float noisesize, float x, float y, float z, int depth);
|
||||
/* hard turbulence */
|
||||
LIBIMPORT float turbulence1(float noisesize, float x, float y, float z, int depth);
|
||||
|
||||
#endif /* __PLUGIN_H__ */
|
||||
|
@ -1,103 +0,0 @@
|
||||
/* Copyright (c) 1999, Not a Number / NeoGeo b.v.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Contact: info@blender.org
|
||||
* Information: http://www.blender.org
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/** \file blender/blenpluginapi/util.h
|
||||
* \ingroup blpluginapi
|
||||
*/
|
||||
|
||||
#ifndef __UTIL_H__
|
||||
#define __UTIL_H__
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "externdef.h"
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#ifndef ulong
|
||||
#define ulong unsigned long
|
||||
#endif
|
||||
|
||||
#ifndef ushort
|
||||
#define ushort unsigned short
|
||||
#endif
|
||||
|
||||
#ifndef uchar
|
||||
#define uchar unsigned char
|
||||
#endif
|
||||
|
||||
#ifndef uint
|
||||
#define uint unsigned int
|
||||
#endif
|
||||
|
||||
#define MIN2(x,y) ( (x)<(y) ? (x) : (y) )
|
||||
#define MIN3(x,y,z) MIN2( MIN2((x),(y)) , (z) )
|
||||
#define MIN4(x,y,z,a) MIN2( MIN2((x),(y)) , MIN2((z),(a)) )
|
||||
|
||||
#define MAX2(x,y) ( (x)>(y) ? (x) : (y) )
|
||||
#define MAX3(x,y,z) MAX2( MAX2((x),(y)) , (z) )
|
||||
#define MAX4(x,y,z,a) MAX2( MAX2((x),(y)) , MAX2((z),(a)) )
|
||||
|
||||
#define SWAP(type, a, b) { type sw_ap; sw_ap=(a); (a)=(b); (b)=sw_ap; } (void)0
|
||||
|
||||
#define ABS(x) ((x) < 0 ? -(x) : (x))
|
||||
#define FLOOR(x) ((int)(x) - ((x) < 0 && (x) != (int)(x)))
|
||||
#define CEIL(x) ((int)(x) + ((x) > 0 && (x) != (int)(x)))
|
||||
#define STEP(a,b) ( (a)>(b) ? (1) : (0) )
|
||||
#define CLAMP(val, low, high) ((val>high)?high:((val<low)?low:val))
|
||||
#define LERP(t,x0,x1) ((x0) + (t)*((x1)-(x0)))
|
||||
#define PULSE(a,b,x) (STEP((a),(x)) - STEP((b),(x)))
|
||||
#define BOXSTEP(a,b,x) CLAMP(((x)-(a))/((b)-(a)),0,1)
|
||||
|
||||
#define PRINT(d, var1) printf(# var1 ":%" # d "\n", var1)
|
||||
#define PRINT2(d, e, var1, var2) printf(# var1 ":%" # d " " # var2 ":%" # e "\n", var1, var2)
|
||||
#define PRINT3(d, e, f, var1, var2, var3) printf(# var1 ":%" # d " " # var2 ":%" # e " " # var3 ":%" # f "\n", var1, var2, var3)
|
||||
#define PRINT4(d, e, f, g, var1, var2, var3, var4) printf(# var1 ":%" # d " " # var2 ":%" # e " " # var3 ":%" # f " " # var4 ":%" # g "\n", var1, var2, var3, var4)
|
||||
|
||||
LIBEXPORT void *mallocN(int len, char *str);
|
||||
LIBEXPORT void *callocN(int len, char *str);
|
||||
LIBEXPORT short freeN(void *vmemh);
|
||||
|
||||
LIBEXPORT void *mallocT(int len, char *str);
|
||||
LIBEXPORT void *callocT(int len, char *str);
|
||||
LIBEXPORT void freeT(void *vmemh);
|
||||
|
||||
#endif /* __UTIL_H__ */
|
||||
|
@ -154,7 +154,6 @@ enum {
|
||||
TH_SEQ_SCENE,
|
||||
TH_SEQ_AUDIO,
|
||||
TH_SEQ_EFFECT,
|
||||
TH_SEQ_PLUGIN,
|
||||
TH_SEQ_TRANSITION,
|
||||
TH_SEQ_META,
|
||||
TH_SEQ_PREVIEW,
|
||||
|
@ -378,8 +378,6 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
|
||||
cp = ts->audio; break;
|
||||
case TH_SEQ_EFFECT:
|
||||
cp = ts->effect; break;
|
||||
case TH_SEQ_PLUGIN:
|
||||
cp = ts->plugin; break;
|
||||
case TH_SEQ_TRANSITION:
|
||||
cp = ts->transition; break;
|
||||
case TH_SEQ_META:
|
||||
@ -775,7 +773,6 @@ void ui_theme_init_default(void)
|
||||
rgba_char_args_set(btheme->tseq.scene, 78, 152, 62, 255);
|
||||
rgba_char_args_set(btheme->tseq.audio, 46, 143, 143, 255);
|
||||
rgba_char_args_set(btheme->tseq.effect, 169, 84, 124, 255);
|
||||
rgba_char_args_set(btheme->tseq.plugin, 126, 126, 80, 255);
|
||||
rgba_char_args_set(btheme->tseq.transition, 162, 95, 111, 255);
|
||||
rgba_char_args_set(btheme->tseq.meta, 109, 145, 131, 255);
|
||||
rgba_char_args_set(btheme->tseq.preview_back, 0, 0, 0, 255);
|
||||
@ -1369,7 +1366,6 @@ void init_userdef_do_versions(void)
|
||||
rgba_char_args_set(btheme->tseq.scene, 78, 152, 62, 255);
|
||||
rgba_char_args_set(btheme->tseq.audio, 46, 143, 143, 255);
|
||||
rgba_char_args_set(btheme->tseq.effect, 169, 84, 124, 255);
|
||||
rgba_char_args_set(btheme->tseq.plugin, 126, 126, 80, 255);
|
||||
rgba_char_args_set(btheme->tseq.transition, 162, 95, 111, 255);
|
||||
rgba_char_args_set(btheme->tseq.meta, 109, 145, 131, 255);
|
||||
}
|
||||
|
@ -740,20 +740,7 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
|
||||
seq->strip = strip = MEM_callocN(sizeof(Strip), "strip");
|
||||
strip->us = 1;
|
||||
|
||||
if (seq->type == SEQ_PLUGIN) {
|
||||
char path[FILE_MAX];
|
||||
RNA_string_get(op->ptr, "filepath", path);
|
||||
|
||||
sh.init_plugin(seq, path);
|
||||
|
||||
if (seq->plugin == NULL) {
|
||||
BLI_remlink(ed->seqbasep, seq);
|
||||
seq_free_sequence(scene, seq);
|
||||
BKE_reportf(op->reports, RPT_ERROR, "Sequencer plugin \"%s\" could not load", path);
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
}
|
||||
else if (seq->type == SEQ_COLOR) {
|
||||
if (seq->type == SEQ_COLOR) {
|
||||
SolidColorVars *colvars = (SolidColorVars *)seq->effectdata;
|
||||
RNA_float_get_array(op->ptr, "color", colvars->col);
|
||||
seq->blend_mode = SEQ_CROSS; /* so alpha adjustment fade to the strip below */
|
||||
@ -824,14 +811,7 @@ static int sequencer_add_effect_strip_invoke(bContext *C, wmOperator *op, wmEven
|
||||
|
||||
sequencer_generic_invoke_xy__internal(C, op, event, prop_flag);
|
||||
|
||||
if (is_type_set && type == SEQ_PLUGIN) {
|
||||
/* only plugins need the file selector */
|
||||
WM_event_add_fileselect(C, op);
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
}
|
||||
else {
|
||||
return sequencer_add_effect_strip_exec(C, op);
|
||||
}
|
||||
return sequencer_add_effect_strip_exec(C, op);
|
||||
}
|
||||
|
||||
void SEQUENCER_OT_effect_strip_add(struct wmOperatorType *ot)
|
||||
|
@ -153,10 +153,6 @@ static void get_seq_color3ubv(Scene *curscene, Sequence *seq, unsigned char col[
|
||||
col[0] = col[1] = col[2] = 128;
|
||||
}
|
||||
break;
|
||||
|
||||
case SEQ_PLUGIN:
|
||||
UI_GetThemeColor3ubv(TH_SEQ_PLUGIN, col);
|
||||
break;
|
||||
|
||||
case SEQ_SOUND:
|
||||
UI_GetThemeColor3ubv(TH_SEQ_AUDIO, col);
|
||||
@ -563,22 +559,8 @@ static void draw_seq_text(View2D *v2d, Sequence *seq, float x1, float x2, float
|
||||
seq->len, name, seq->strip->dir, seq->strip->stripdata->name);
|
||||
}
|
||||
else if (seq->type & SEQ_EFFECT) {
|
||||
int can_float = (seq->type != SEQ_PLUGIN) || (seq->plugin && seq->plugin->version >= 4);
|
||||
|
||||
if (seq->seq3 != seq->seq2 && seq->seq1 != seq->seq3) {
|
||||
BLI_snprintf(str, sizeof(str), "%d | %s: %d>%d (use %d)%s",
|
||||
seq->len, name, seq->seq1->machine, seq->seq2->machine, seq->seq3->machine,
|
||||
can_float ? "" : " No float, upgrade plugin!");
|
||||
}
|
||||
else if (seq->seq1 && seq->seq2) {
|
||||
BLI_snprintf(str, sizeof(str), "%d | %s: %d>%d%s",
|
||||
seq->len, name, seq->seq1->machine, seq->seq2->machine,
|
||||
can_float ? "" : " No float, upgrade plugin!");
|
||||
}
|
||||
else {
|
||||
BLI_snprintf(str, sizeof(str), "%d | %s",
|
||||
BLI_snprintf(str, sizeof(str), "%d | %s",
|
||||
seq->len, name);
|
||||
}
|
||||
}
|
||||
else if (seq->type == SEQ_SOUND) {
|
||||
if (seq->sound)
|
||||
|
@ -231,27 +231,6 @@ void seq_rectf(Sequence *seq, rctf *rectf)
|
||||
rectf->ymax = seq->machine + SEQ_STRIP_OFSTOP;
|
||||
}
|
||||
|
||||
static void UNUSED_FUNCTION(change_plugin_seq) (Scene * scene, char *str) /* called from fileselect */
|
||||
{
|
||||
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
||||
struct SeqEffectHandle sh;
|
||||
Sequence *last_seq = BKE_sequencer_active_get(scene);
|
||||
|
||||
if (last_seq == NULL || last_seq->type != SEQ_PLUGIN) return;
|
||||
|
||||
sh = get_sequence_effect(last_seq);
|
||||
sh.free(last_seq);
|
||||
sh.init_plugin(last_seq, str);
|
||||
|
||||
last_seq->machine = MAX3(last_seq->seq1->machine,
|
||||
last_seq->seq2->machine,
|
||||
last_seq->seq3->machine);
|
||||
|
||||
if (seq_test_overlap(ed->seqbasep, last_seq) ) shuffle_seq(ed->seqbasep, last_seq, scene);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void boundbox_seq(Scene *scene, rctf *rect)
|
||||
{
|
||||
Sequence *seq;
|
||||
|
@ -55,13 +55,8 @@ struct ImMetaData;
|
||||
* This is the abstraction of an image. ImBuf is the basic type used for all
|
||||
* imbuf operations.
|
||||
*
|
||||
* REMINDER: if any changes take place, they need to be carried over
|
||||
* to source/blender/blenpluginapi/iff.h too, OTHERWISE PLUGINS WON'T
|
||||
* WORK CORRECTLY!
|
||||
*
|
||||
* Also; add new variables to the end to save pain!
|
||||
*
|
||||
* Also, that iff.h needs to be in the final release "plugins/include" dir, too!
|
||||
*/
|
||||
typedef struct ImBuf {
|
||||
struct ImBuf *next, *prev; /**< allow lists of ImBufs, for caches or flipbooks */
|
||||
|
@ -339,7 +339,7 @@ typedef struct SpeedControlVars {
|
||||
#define SEQ_GAMCROSS 13
|
||||
#define SEQ_MUL 14
|
||||
#define SEQ_OVERDROP 15
|
||||
#define SEQ_PLUGIN 24
|
||||
// #define SEQ_PLUGIN 24 /* Deprecated */
|
||||
#define SEQ_WIPE 25
|
||||
#define SEQ_GLOW 26
|
||||
#define SEQ_TRANSFORM 27
|
||||
|
@ -324,7 +324,7 @@ typedef struct ColorMapping {
|
||||
#define TEX_STUCCI 6
|
||||
#define TEX_NOISE 7
|
||||
#define TEX_IMAGE 8
|
||||
#define TEX_PLUGIN 9
|
||||
//#define TEX_PLUGIN 9 /* Deprecated */
|
||||
#define TEX_ENVMAP 10
|
||||
#define TEX_MUSGRAVE 11
|
||||
#define TEX_VORONOI 12
|
||||
|
@ -390,8 +390,6 @@ extern StructRNA RNA_ParticleSystem;
|
||||
extern StructRNA RNA_ParticleSystemModifier;
|
||||
extern StructRNA RNA_ParticleTarget;
|
||||
extern StructRNA RNA_PivotConstraint;
|
||||
extern StructRNA RNA_PluginSequence;
|
||||
extern StructRNA RNA_PluginTexture;
|
||||
extern StructRNA RNA_PointCache;
|
||||
extern StructRNA RNA_PointDensity;
|
||||
extern StructRNA RNA_PointDensityTexture;
|
||||
|
@ -998,7 +998,6 @@ static void rna_def_sequence(BlenderRNA *brna)
|
||||
{SEQ_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", ""},
|
||||
{SEQ_MUL, "MULTIPLY", 0, "Multiply", ""},
|
||||
{SEQ_OVERDROP, "OVER_DROP", 0, "Over Drop", ""},
|
||||
{SEQ_PLUGIN, "PLUGIN", 0, "Plugin", ""},
|
||||
{SEQ_WIPE, "WIPE", 0, "Wipe", ""},
|
||||
{SEQ_GLOW, "GLOW", 0, "Glow", ""},
|
||||
{SEQ_TRANSFORM, "TRANSFORM", 0, "Transform", ""},
|
||||
|
@ -413,7 +413,6 @@ void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
{SEQ_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", ""},
|
||||
{SEQ_MUL, "MULTIPLY", 0, "Multiply", ""},
|
||||
{SEQ_OVERDROP, "OVER_DROP", 0, "Over Drop", ""},
|
||||
// {SEQ_PLUGIN, "PLUGIN", 0, "Plugin", ""},
|
||||
{SEQ_WIPE, "WIPE", 0, "Wipe", ""},
|
||||
{SEQ_GLOW, "GLOW", 0, "Glow", ""},
|
||||
{SEQ_TRANSFORM, "TRANSFORM", 0, "Transform", ""},
|
||||
|
@ -68,7 +68,6 @@ EnumPropertyItem texture_type_items[] = {
|
||||
{TEX_MUSGRAVE, "MUSGRAVE", ICON_TEXTURE, "Musgrave", "Procedural - highly flexible fractal noise texture"},
|
||||
{TEX_NOISE, "NOISE", ICON_TEXTURE, "Noise",
|
||||
"Procedural - random noise, gives a different result every time, for every frame, for every pixel"},
|
||||
/*{TEX_PLUGIN, "PLUGIN", ICON_PLUGIN, "Plugin", ""}, *//* Nothing yet */
|
||||
{TEX_POINTDENSITY, "POINT_DENSITY", ICON_TEXTURE, "Point Density", ""},
|
||||
{TEX_STUCCI, "STUCCI", ICON_TEXTURE, "Stucci", "Procedural - create a fractal noise texture"},
|
||||
{TEX_VORONOI, "VORONOI", ICON_TEXTURE, "Voronoi", "Procedural - create cell-like patterns based on Worley noise"},
|
||||
|
@ -88,7 +88,7 @@ void ntreeShaderGetTexcoMode(bNodeTree *ntree, int r_mode, short *texco, int *mo
|
||||
if (node->type==SH_NODE_TEXTURE) {
|
||||
if ((r_mode & R_OSA) && node->id) {
|
||||
Tex *tex= (Tex *)node->id;
|
||||
if (ELEM3(tex->type, TEX_IMAGE, TEX_PLUGIN, TEX_ENVMAP)) {
|
||||
if (ELEM(tex->type, TEX_IMAGE, TEX_ENVMAP)) {
|
||||
*texco |= TEXCO_OSA|NEED_UV;
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,6 @@
|
||||
#include "BKE_colortools.h"
|
||||
#include "BKE_image.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_plugin_types.h"
|
||||
|
||||
#include "BKE_animsys.h"
|
||||
#include "BKE_DerivedMesh.h"
|
||||
@ -103,13 +102,6 @@ static void init_render_texture(Render *re, Tex *tex)
|
||||
BKE_image_user_frame_calc(&tex->iuser, cfra, re?re->flag & R_SEC_FIELD:0);
|
||||
}
|
||||
|
||||
if (tex->type==TEX_PLUGIN) {
|
||||
if (tex->plugin && tex->plugin->doit) {
|
||||
if (tex->plugin->cfra) {
|
||||
*(tex->plugin->cfra)= (float)cfra; //BKE_scene_frame_get(re->scene); // XXX old animsys - timing stuff to be fixed
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (tex->type==TEX_ENVMAP) {
|
||||
/* just in case */
|
||||
tex->imaflag |= TEX_INTERPOL | TEX_MIPMAP;
|
||||
@ -747,73 +739,6 @@ static int texnoise(Tex *tex, TexResult *texres)
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
static int plugintex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexResult *texres)
|
||||
{
|
||||
PluginTex *pit;
|
||||
int rgbnor=0;
|
||||
float result[8]= {0.0f};
|
||||
|
||||
texres->tin= 0.0;
|
||||
|
||||
pit= tex->plugin;
|
||||
if (pit && pit->doit) {
|
||||
if (texres->nor) {
|
||||
if (pit->version < 6) {
|
||||
copy_v3_v3(pit->result+5, texres->nor);
|
||||
}
|
||||
else {
|
||||
copy_v3_v3(result+5, texres->nor);
|
||||
}
|
||||
}
|
||||
if (pit->version < 6) {
|
||||
if (osatex) rgbnor= ((TexDoitold)pit->doit)(tex->stype,
|
||||
pit->data, texvec, dxt, dyt);
|
||||
else rgbnor= ((TexDoitold)pit->doit)(tex->stype,
|
||||
pit->data, texvec, NULL, NULL);
|
||||
}
|
||||
else {
|
||||
if (osatex) rgbnor= ((TexDoit)pit->doit)(tex->stype,
|
||||
pit->data, texvec, dxt, dyt, result);
|
||||
else rgbnor= ((TexDoit)pit->doit)(tex->stype,
|
||||
pit->data, texvec, NULL, NULL, result);
|
||||
}
|
||||
|
||||
if (pit->version < 6) {
|
||||
texres->tin = pit->result[0];
|
||||
}
|
||||
else {
|
||||
texres->tin = result[0]; /* XXX, assigning garbage value, fixme! */
|
||||
}
|
||||
|
||||
if (rgbnor & TEX_NOR) {
|
||||
if (texres->nor) {
|
||||
if (pit->version < 6) {
|
||||
copy_v3_v3(texres->nor, pit->result+5);
|
||||
}
|
||||
else {
|
||||
copy_v3_v3(texres->nor, result+5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (rgbnor & TEX_RGB) {
|
||||
if (pit->version < 6) {
|
||||
copy_v4_v4(&texres->tr, pit->result + 1);
|
||||
}
|
||||
else {
|
||||
copy_v4_v4(&texres->tr, result + 1);
|
||||
}
|
||||
|
||||
BRICONTRGB;
|
||||
}
|
||||
|
||||
BRICONT;
|
||||
}
|
||||
|
||||
return rgbnor;
|
||||
}
|
||||
|
||||
|
||||
static int cubemap_glob(const float n[3], float x, float y, float z, float *adr1, float *adr2)
|
||||
{
|
||||
float x1, y1, z1, nor[3];
|
||||
@ -1210,9 +1135,6 @@ static int multitex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex,
|
||||
else retval= imagewrap(tex, tex->ima, NULL, texvec, texres);
|
||||
BKE_image_tag_time(tex->ima); /* tag image as having being used */
|
||||
break;
|
||||
case TEX_PLUGIN:
|
||||
retval= plugintex(tex, texvec, dxt, dyt, osatex, texres);
|
||||
break;
|
||||
case TEX_ENVMAP:
|
||||
retval= envmaptex(tex, texvec, dxt, dyt, osatex, texres);
|
||||
break;
|
||||
|
@ -150,8 +150,6 @@ static int print_version(int argc, const char **argv, void *data);
|
||||
|
||||
/* for the callbacks: */
|
||||
|
||||
extern int pluginapi_force_ref(void); /* from blenpluginapi:pluginapi.c */
|
||||
|
||||
#define BLEND_VERSION_STRING_FMT \
|
||||
"Blender %d.%02d (sub %d)\n", \
|
||||
BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION \
|
||||
@ -1257,11 +1255,6 @@ int main(int argc, const char **argv)
|
||||
RNA_init();
|
||||
RE_engines_init();
|
||||
|
||||
/* Hack - force inclusion of the plugin api functions,
|
||||
* see blenpluginapi:pluginapi.c
|
||||
*/
|
||||
pluginapi_force_ref();
|
||||
|
||||
init_nodesystem();
|
||||
|
||||
initglobals(); /* blender.c */
|
||||
|
Loading…
Reference in New Issue
Block a user