Merge branch 'master' into blender2.8

Conflicts:
	source/blender/blenloader/intern/versioning_270.c
This commit is contained in:
Bastien Montagne 2017-05-22 22:49:02 +02:00
commit 44f91a9a18
30 changed files with 1403 additions and 47 deletions

View File

@ -1356,7 +1356,10 @@ if(CMAKE_COMPILER_IS_GNUCC)
# flags to undo strict flags
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_DEPRECATED_DECLARATIONS -Wno-deprecated-declarations)
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_IMPLICIT_FALLTHROUGH -Wno-implicit-fallthrough)
if(CMAKE_COMPILER_IS_GNUCC AND (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "7.0"))
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_IMPLICIT_FALLTHROUGH -Wno-implicit-fallthrough)
endif()
if(NOT APPLE)
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_ERROR_UNUSED_BUT_SET_VARIABLE -Wno-error=unused-but-set-variable)

View File

@ -532,9 +532,8 @@ public:
bool denoising_combine_halves(device_ptr a_ptr, device_ptr b_ptr,
device_ptr mean_ptr, device_ptr variance_ptr,
int r, int4 rect, DenoisingTask *task)
int r, int4 rect, DenoisingTask * /*task*/)
{
(void) task;
for(int y = rect.y; y < rect.w; y++) {
for(int x = rect.x; x < rect.z; x++) {
filter_combine_halves_kernel()(x, y,

View File

@ -225,6 +225,9 @@ public:
cuDevice = 0;
cuContext = 0;
cuModule = 0;
cuFilterModule = 0;
split_kernel = NULL;
need_bindless_mapping = false;
@ -487,6 +490,16 @@ public:
bool load_kernels(const DeviceRequestedFeatures& requested_features)
{
/* TODO(sergey): Support kernels re-load for CUDA devices.
*
* Currently re-loading kernel will invalidate memory pointers,
* causing problems in cuCtxSynchronize.
*/
if(cuFilterModule && cuModule) {
VLOG(1) << "Skipping kernel reload, not currently supported.";
return true;
}
/* check if cuda init succeeded */
if(cuContext == 0)
return false;
@ -1148,8 +1161,6 @@ public:
device_ptr mean_ptr, device_ptr variance_ptr,
int r, int4 rect, DenoisingTask *task)
{
(void) task;
if(have_error())
return false;
@ -1179,8 +1190,6 @@ public:
device_ptr sample_variance_ptr, device_ptr sv_variance_ptr,
device_ptr buffer_variance_ptr, DenoisingTask *task)
{
(void) task;
if(have_error())
return false;

View File

@ -817,8 +817,6 @@ bool OpenCLDeviceBase::denoising_combine_halves(device_ptr a_ptr,
int r, int4 rect,
DenoisingTask *task)
{
(void) task;
cl_mem a_mem = CL_MEM_PTR(a_ptr);
cl_mem b_mem = CL_MEM_PTR(b_ptr);
cl_mem mean_mem = CL_MEM_PTR(mean_ptr);
@ -847,8 +845,6 @@ bool OpenCLDeviceBase::denoising_divide_shadow(device_ptr a_ptr,
device_ptr buffer_variance_ptr,
DenoisingTask *task)
{
(void) task;
cl_mem a_mem = CL_MEM_PTR(a_ptr);
cl_mem b_mem = CL_MEM_PTR(b_ptr);
cl_mem sample_variance_mem = CL_MEM_PTR(sample_variance_ptr);

View File

@ -55,9 +55,14 @@ ccl_device_inline void kernel_filter_construct_gramian(int x, int y,
float q_std_dev = sqrtf(filter_get_pixel_variance(variance_pass + q_offset, pass_stride));
/* If the pixel was flagged as an outlier during prefiltering, skip it.
* Otherwise, perform the regular confidence interval test. */
if(ccl_get_feature(buffer + q_offset, 0) < 0.0f ||
average(fabs(p_color - q_color)) > 2.0f*(p_std_dev + q_std_dev + 1e-3f)) {
* Otherwise, perform the regular confidence interval test unless
* the center pixel is an outlier (in that case, using the confidence
* interval test could result in no pixels being used at all). */
bool p_outlier = (ccl_get_feature(buffer + p_offset, 0) < 0.0f);
bool q_outlier = (ccl_get_feature(buffer + q_offset, 0) < 0.0f);
bool outside_of_interval = (average(fabs(p_color - q_color)) > 2.0f*(p_std_dev + q_std_dev + 1e-3f));
if(q_outlier || (!p_outlier && outside_of_interval)) {
return;
}

View File

@ -152,6 +152,11 @@ ccl_device_inline void kernel_update_denoising_features(KernelGlobals *kg,
L->denoising_depth += ensure_finite(state->denoising_feature_weight * sd->ray_length);
/* Skip implicitly transparent surfaces. */
if(sd->flag & SD_HAS_ONLY_VOLUME) {
return;
}
float3 normal = make_float3(0.0f, 0.0f, 0.0f);
float3 albedo = make_float3(0.0f, 0.0f, 0.0f);
float sum_weight = 0.0f, sum_nonspecular_weight = 0.0f;

View File

@ -335,11 +335,14 @@ ShaderManager *ShaderManager::create(Scene *scene, int shadingsystem)
(void)shadingsystem; /* Ignored when built without OSL. */
#ifdef WITH_OSL
if(shadingsystem == SHADINGSYSTEM_OSL)
if(shadingsystem == SHADINGSYSTEM_OSL) {
manager = new OSLShaderManager();
}
else
#endif
{
manager = new SVMShaderManager();
}
add_default(scene);

View File

@ -50,9 +50,9 @@ public:
T *allocate(size_t n, const void *hint = 0)
{
(void)hint;
size_t size = n * sizeof(T);
util_guarded_mem_alloc(size);
(void)hint;
if(n == 0) {
return NULL;
}

View File

@ -42,7 +42,7 @@ def draw_color_balance(layout, color_balance):
col.label(text="Lift:")
col.separator()
col.separator()
col.prop(color_balance, "")
col.prop(color_balance, "lift", text="")
col.prop(color_balance, "invert_lift", text="Invert", icon="ARROW_LEFTRIGHT")
split.template_color_picker(color_balance, "lift", value_slider=True, cubic=True)
@ -52,7 +52,7 @@ def draw_color_balance(layout, color_balance):
col.label(text="Gamma:")
col.separator()
col.separator()
col.prop(color_balance, "")
col.prop(color_balance, "gamma", text="")
col.prop(color_balance, "invert_gamma", text="Invert", icon="ARROW_LEFTRIGHT")
split.template_color_picker(color_balance, "gamma", value_slider=True, lock_luminosity=True, cubic=True)

View File

@ -692,7 +692,7 @@ void *BLI_rfindptr(const ListBase *listbase, const void *ptr, const int offset)
}
/**
* Returns the 1-based index of the first element of listbase which contains the specified
* Returns the 0-based index of the first element of listbase which contains the specified
* null-terminated string at the specified offset, or -1 if not found.
*/
int BLI_findstringindex(const ListBase *listbase, const char *id, const int offset)

View File

@ -1644,6 +1644,11 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
}
}
/* Fix related to VGroup modifiers creating named defgroup CD layers! See T51520. */
for (Mesh *me = main->mesh.first; me; me = me->id.next) {
CustomData_set_layer_name(&me->vdata, CD_MDEFORMVERT, 0, "");
}
if (!DNA_struct_elem_find(fd->filesdna, "View3DDebug", "char", "background")) {
bScreen *screen;

View File

@ -31,7 +31,9 @@ BrightnessNode::BrightnessNode(bNode *editorNode) : Node(editorNode)
void BrightnessNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const
{
bNode *bnode = this->getbNode();
BrightnessOperation *operation = new BrightnessOperation();
operation->setUsePremultiply((bnode->custom1 & 1) != 0);
converter.addOperation(operation);
converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0));

View File

@ -29,7 +29,14 @@ BrightnessOperation::BrightnessOperation() : NodeOperation()
this->addInputSocket(COM_DT_VALUE);
this->addOutputSocket(COM_DT_COLOR);
this->m_inputProgram = NULL;
this->m_use_premultiply = false;
}
void BrightnessOperation::setUsePremultiply(bool use_premultiply)
{
this->m_use_premultiply = use_premultiply;
}
void BrightnessOperation::initExecution()
{
this->m_inputProgram = this->getInputSocketReader(0);
@ -64,11 +71,16 @@ void BrightnessOperation::executePixelSampled(float output[4], float x, float y,
delta *= -1;
b = a * (brightness + delta);
}
if (this->m_use_premultiply) {
premul_to_straight_v4(inputValue);
}
output[0] = a * inputValue[0] + b;
output[1] = a * inputValue[1] + b;
output[2] = a * inputValue[2] + b;
output[3] = inputValue[3];
if (this->m_use_premultiply) {
straight_to_premul_v4(output);
}
}
void BrightnessOperation::deinitExecution()

View File

@ -34,6 +34,8 @@ private:
SocketReader *m_inputBrightnessProgram;
SocketReader *m_inputContrastProgram;
bool m_use_premultiply;
public:
BrightnessOperation();
@ -52,5 +54,6 @@ public:
*/
void deinitExecution();
void setUsePremultiply(bool use_premultiply);
};
#endif

View File

@ -104,22 +104,26 @@ static void join_mesh_single(
/* vertex groups */
MDeformVert *dvert = CustomData_get(vdata, *vertofs, CD_MDEFORMVERT);
MDeformVert *dvert_src = CustomData_get(&me->vdata, 0, CD_MDEFORMVERT);
/* NB: vertex groups here are new version */
if (dvert) {
for (a = 0; a < me->totvert; a++) {
for (b = 0; b < dvert[a].totweight; b++) {
/* Find the old vertex group */
bDeformGroup *dg, *odg = BLI_findlink(&base_src->object->defbase, dvert[a].dw[b].def_nr);
int index;
if (odg) {
/* Search for a match in the new object, and set new index */
for (dg = ob_dst->defbase.first, index = 0; dg; dg = dg->next, index++) {
if (STREQ(dg->name, odg->name)) {
dvert[a].dw[b].def_nr = index;
break;
}
}
/* Remap to correct new vgroup indices, if needed. */
if (dvert_src) {
BLI_assert(dvert != NULL);
/* Build src to merged mapping of vgroup indices. */
bDeformGroup *dg_src;
int *vgroup_index_map = alloca(sizeof(*vgroup_index_map) * BLI_listbase_count(&base_src->object->defbase));
bool is_vgroup_remap_needed = false;
for (dg_src = base_src->object->defbase.first, b = 0; dg_src; dg_src = dg_src->next, b++) {
vgroup_index_map[b] = defgroup_name_index(ob_dst, dg_src->name);
is_vgroup_remap_needed = is_vgroup_remap_needed || (vgroup_index_map[b] != b);
}
if (is_vgroup_remap_needed) {
for (a = 0; a < me->totvert; a++) {
for (b = 0; b < dvert[a].totweight; b++) {
dvert[a].dw[b].def_nr = vgroup_index_map[dvert_src[a].dw[b].def_nr];
}
}
}

View File

@ -766,7 +766,9 @@ static void screen_test_scale(bScreen *sc, int winsize_x, int winsize_y)
/* lower edge */
const int yval = sa->v2->vec.y - headery_init;
se = screen_findedge(sc, sa->v4, sa->v1);
select_connected_scredge(sc, se);
if (se != NULL) {
select_connected_scredge(sc, se);
}
for (sv = sc->vertbase.first; sv; sv = sv->next) {
if (sv != sa->v2 && sv != sa->v3) {
if (sv->flag) {
@ -779,7 +781,9 @@ static void screen_test_scale(bScreen *sc, int winsize_x, int winsize_y)
/* upper edge */
const int yval = sa->v1->vec.y + headery_init;
se = screen_findedge(sc, sa->v2, sa->v3);
select_connected_scredge(sc, se);
if (se != NULL) {
select_connected_scredge(sc, se);
}
for (sv = sc->vertbase.first; sv; sv = sv->next) {
if (sv != sa->v1 && sv != sa->v4) {
if (sv->flag) {

View File

@ -2446,6 +2446,11 @@ static void node_composit_buts_sunbeams(uiLayout *layout, bContext *UNUSED(C), P
uiItemR(layout, ptr, "ray_length", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
}
static void node_composit_buts_brightcontrast(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "use_premultiply", 0, NULL, ICON_NONE);
}
/* only once called */
static void node_composit_set_butfunc(bNodeType *ntype)
{
@ -2673,6 +2678,8 @@ static void node_composit_set_butfunc(bNodeType *ntype)
case CMP_NODE_SUNBEAMS:
ntype->draw_buttons = node_composit_buts_sunbeams;
break;
case CMP_NODE_BRIGHTCONTRAST:
ntype->draw_buttons = node_composit_buts_brightcontrast;
}
}

View File

@ -43,6 +43,8 @@ set(SRC
text_format.c
text_format_lua.c
text_format_osl.c
text_format_pov.c
text_format_pov_ini.c
text_format_py.c
text_header.c
text_ops.c

View File

@ -636,5 +636,7 @@ void ED_spacetype_text(void)
ED_text_format_register_py();
ED_text_format_register_osl();
ED_text_format_register_lua();
ED_text_format_register_pov();
ED_text_format_register_pov_ini();
}

View File

@ -102,6 +102,8 @@ void ED_text_format_register(TextFormatType *tft);
void ED_text_format_register_py(void);
void ED_text_format_register_osl(void);
void ED_text_format_register_lua(void);
void ED_text_format_register_pov(void);
void ED_text_format_register_pov_ini(void);
#define STR_LITERAL_STARTSWITH(str, str_literal, len_var) \
(strncmp(str, str_literal, len_var = (sizeof(str_literal) - 1)) == 0)

View File

@ -0,0 +1,789 @@
/*
* ***** 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
* 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.
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/editors/space_text/text_format_pov.c
* \ingroup sptext
*/
#include <string.h>
#include "BLI_blenlib.h"
#include "DNA_text_types.h"
#include "DNA_space_types.h"
#include "BKE_text.h"
#include "text_format.h"
/* *** POV Keywords (for format_line) *** */
/* Checks the specified source string for a POV keyword (minus boolean & 'nil').
* This name must start at the beginning of the source string and must be
* followed by a non-identifier (see text_check_identifier(char)) or null char.
*
* If a keyword is found, the length of the matching word is returned.
* Otherwise, -1 is returned.
*
* See:
* http://www.povray.org/documentation/view/3.7.0/212/
*/
static int txtfmt_pov_find_keyword(const char *string)
{
int i, len;
/* Language Directives */
if (STR_LITERAL_STARTSWITH(string, "append", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "break", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "case", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "debug", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "declare", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "default", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "deprecated", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "else", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "elseif", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "end", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "error", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "fclose", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "fopen", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "for", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "if", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ifdef", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ifndef", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "include", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "local", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "macro", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "range", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "read", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "render", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "statistics", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "switch", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "undef", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "version", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "warning", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "while", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "write", len)) i = len;
else i = 0;
/* If next source char is an identifier (eg. 'i' in "definate") no match */
return (i == 0 || text_check_identifier(string[i])) ? -1 : i;
}
static int txtfmt_pov_find_reserved(const char *string)
{
int i, len;
/* POV-Ray Built-in Variables
* list is from...
* http://www.povray.org/documentation/view/3.7.0/212/
*/
if (STR_LITERAL_STARTSWITH(string, "clock", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "clock_delta", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "clock_on", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "final_clock", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "final_frame", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "frame_number", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "initial_clock", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "initial_frame", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "image_height", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "image_width", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "input_file_name", len)) i = len;
/* Language Keywords */
else if (STR_LITERAL_STARTSWITH(string, "aa_level", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "aa_threshold", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "absorption", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "accuracy", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "adc_bailout", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "albedo", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "all", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "all_intersections", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "alpha", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "altitude", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "always_sample", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ambient", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ambient_light", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "angle", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "aperture", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "arc_angle", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "area_light", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "area_illumination", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "array", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "assumed_gamma", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "autostop", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "black_hole", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "blur_samples", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "brightness", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "brilliance", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "caustics", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "charset", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "collect", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "component", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "composite", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "confidence", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "conserve_energy", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "contained_by", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "coords", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "count", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "crand", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "cube", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "cutaway_textures", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "diffuse", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "direction", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "dispersion", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "dispersion_samples", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "dist_exp", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "distance", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "eccentricity", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "emission", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "error_bound", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "evaluate", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "expand_thresholds", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "exponent", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "exterior", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "extinction", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "face_indices", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "falloff", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "falloff_angle", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "file_gamma", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "finish", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "flatness", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "flip", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "focal_point", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "fog_alt", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "fog_offset", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "fog_type", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "form", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "fresnel", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "function", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "gamma", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "gather", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "global_settings", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "gray_threshold", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "hf_gray_16", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "hierarchy", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "hypercomplex", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "importance", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "inside_vector", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "internal", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "intervals", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ior", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "irid", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "irid_wavelength", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "load_file", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "location", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "look_at", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "looks_like", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "low_error_factor", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "major_radius", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "max_distance", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "max_extent", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "max_gradient", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "max_intersections", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "max_iteration", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "max_sample", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "max_trace", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "max_trace_level", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "maximum_reuse", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "metallic", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "method", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "metric", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "minimum_reuse", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "nearest_count", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "normal_indices", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "normal_vectors", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "now", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "number_of_waves", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "offset", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "open", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "orientation", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "pass_through", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "pattern", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "phong", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "phong_size", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "point_at", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "pot", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "precision", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "precompute", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "pretrace_end", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "pretrace_start", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "prod", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "pwr", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "quaternion", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "radiosity", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "radius", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ratio", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "reciprocal", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "recursion_limit", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "reflection", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "reflection_exponent", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "refraction", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "repeat", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "right", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "roughness", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "samples", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "save_file", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "scattering", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "size", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sky", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "slice", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "smooth", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "solid", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "spacing", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "specular", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "split_union", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "spotlight", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "strength", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sturm", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sum", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "target", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "texture_list", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "thickness", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "threshold", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "tightness", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "tolerance", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "toroidal", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ttf", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "turb_depth", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "type", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "u_steps", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "up", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "use_alpha", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "uv_indices", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "uv_vectors", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "v_steps", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "variance", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "vertex_vectors", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "water_level", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "width", len)) i = len;
/* Built-in Vectors */
else if (STR_LITERAL_STARTSWITH(string, "t", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "u", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "v", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "x", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "y", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "z", len)) i = len;
/* Color Identifiers */
else if (STR_LITERAL_STARTSWITH(string, "blue", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "filter", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "gray", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "green", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "red", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "rgb", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "rgbf", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "rgbft", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "rgbt", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "srgb", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sRGB", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "SRGB", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "srgbf", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "srgbft", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "srgbt", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "transmit", len)) i = len;
/* Patterns */
else if (STR_LITERAL_STARTSWITH(string, "agate", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "aoi", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "average", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "boxed", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "bozo", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "brick", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "bumps", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "cells", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "checker", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "crackle", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "cubic", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "cylindrical", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "density_file", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "dents", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "facets", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "gradient", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "granite", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "hexagon", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "image_pattern", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "julia", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "leopard", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "magnet", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "mandel", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "marble", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "onion", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "pavement", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "pigment_pattern", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "planar", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "quilted", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "radial", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ripples", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "slope", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "spherical", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "spiral1", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "spiral2", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "spotted", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "square", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "tile2", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "tiling", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "tiles", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "triangular", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "waves", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "wood", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "wrinkles", len)) i = len;
/* Objects */
else if (STR_LITERAL_STARTSWITH(string, "background", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "bicubic_patch", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "blob", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "box", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "camera", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "cone", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "cubic", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "cylinder", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "difference", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "disc", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "fog", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "height_field", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "intersection", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "isosurface", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "julia_fractal", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "lathe", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "light_group", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "light_source", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "merge", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "mesh", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "mesh2", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "object", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ovus", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "parametric", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "plane", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "poly", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "polygon", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "polynomial", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "prism", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "quadric", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "quartic", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "rainbow", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sky_sphere", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "smooth_triangle", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sphere", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sphere_sweep", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "spline", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "superellipsoid", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sor", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "text", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "torus", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "triangle", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "union", len)) i = len;
/* Filetypes */
else if (STR_LITERAL_STARTSWITH(string, "df3", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "exr", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "gif", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "hdr", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "iff", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "jpeg", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "pgm", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "png", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ppm", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sys", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "tga", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "tiff", len)) i = len;
/* Spline Identifiers */
else if (STR_LITERAL_STARTSWITH(string, "b_spline", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "bezier_spline", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "conic_sweep", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "cubic_spline", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "linear_spline", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "linear_sweep", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "natural_spline", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "quadratic_spline", len)) i = len;
/* Encodings */
else if (STR_LITERAL_STARTSWITH(string, "ascii", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "utf8", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "uint8", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "uint16be", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "uint16le", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sint8", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sint16be", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sint16le", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sint32be", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sint32le", len)) i = len;
/* Camera Types */
else if (STR_LITERAL_STARTSWITH(string, "fisheye", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "mesh_camera", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "omnimax", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "orthographic", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "panoramic", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "perspective", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ultra_wide_angle", len)) i = len;
else i = 0;
/* If next source char is an identifier (eg. 'i' in "definate") no match */
return (i == 0 || text_check_identifier(string[i])) ? -1 : i;
}
/* Checks the specified source string for a POV modifiers. This
* name must start at the beginning of the source string and must be followed
* by a non-identifier (see text_check_identifier(char)) or null character.
*
* If a special name is found, the length of the matching name is returned.
* Otherwise, -1 is returned.
*
* See:
* http://www.povray.org/documentation/view/3.7.0/212/
*/
static int txtfmt_pov_find_specialvar(const char *string)
{
int i, len;
/* Modifiers */
if (STR_LITERAL_STARTSWITH(string, "adaptive", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "agate_turb", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "bounded_by", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "brick_size", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "bump_map", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "bump_size", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "circular", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "clipped_by", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "cubic", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "color", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "color_map", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "colour", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "colour_map", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "control0", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "control1", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "cubic_wave", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "density", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "density_map", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "double_illuminate", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "fade_color", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "fade_colour", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "fade_distance", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "fade_power", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "frequency", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "global_lights", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "hollow", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "image_map", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "interior", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "interior_texture", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "interpolate", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "inverse", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "jitter", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "lambda", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "map_type", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "material", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "material_map", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "matrix", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "media", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "media_attenuation", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "media_interaction", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "mm_per_unit", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "mortar", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "no_bump_scale", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "no_image", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "no_radiosity", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "no_reflection", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "no_shadow", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "noise_generator", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "normal", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "normal_map", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "octaves", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "omega", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "once", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "orient", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "parallel", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "phase", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "photons", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "pigment", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "pigment_map", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "poly_wave", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "projected_through", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "quick_color", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "quick_colour", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ramp_wave", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "rotate", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "scale", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "scallop_wave", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "shadowless", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sine_wave", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "slope_map", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "subsurface", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "texture", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "texture_map", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "transform", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "translate", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "triangle_wave", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "turbulence", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "use_color", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "use_colour", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "use_index", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "uv_mapping", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "warp", len)) i = len;
/* Float Functions */
else if (STR_LITERAL_STARTSWITH(string, "abs", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "acos", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "acosh", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "asc", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "asin", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "asinh", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "atan", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "atan2", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "atand", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "atanh", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "bitwise_and", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "bitwise_or", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "bitwise_xor", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ceil", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "cos", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "cosh", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "defined", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "degrees", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "dimension_size", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "dimensions", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "div", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "exp", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "file_exists", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "floor", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "inside", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "int", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ln", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "log", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "max", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "min", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "mod", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "pow", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "radians", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "rand", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "seed", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "select", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sin", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sinh", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sqr", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sqrt", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "strcmp", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "strlen", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "tan", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "tanh", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "val", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "vdot", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "vlength", len)) i = len;
/* Vector Functions */
else if (STR_LITERAL_STARTSWITH(string, "max_extent", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "min_extent", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "trace", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "vaxis_rotate", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "vcross", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "vnormalize", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "vrotate", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "vturbulence", len)) i = len;
/* String Functions */
else if (STR_LITERAL_STARTSWITH(string, "chr", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "concat", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "datetime", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "str", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "strlwr", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "strupr", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "substr", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "vstr", len)) i = len;
else i = 0;
/* If next source char is an identifier (eg. 'i' in "definate") no match */
return (i == 0 || text_check_identifier(string[i])) ? -1 : i;
}
static int txtfmt_pov_find_bool(const char *string)
{
int i, len;
/*Built-in Constants*/
if (STR_LITERAL_STARTSWITH(string, "false", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "no", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "off", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "true", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "yes", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "on", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "pi", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "tau", len)) i = len;
else i = 0;
/* If next source char is an identifier (eg. 'i' in "Nonetheless") no match */
return (i == 0 || text_check_identifier(string[i])) ? -1 : i;
}
static char txtfmt_pov_format_identifier(const char *str)
{
char fmt;
if ((txtfmt_pov_find_specialvar(str)) != -1) fmt = FMT_TYPE_SPECIAL;
else if ((txtfmt_pov_find_keyword(str)) != -1) fmt = FMT_TYPE_KEYWORD;
else if ((txtfmt_pov_find_reserved(str)) != -1) fmt = FMT_TYPE_RESERVED;
else fmt = FMT_TYPE_DEFAULT;
return fmt;
}
static void txtfmt_pov_format_line(SpaceText *st, TextLine *line, const bool do_next)
{
FlattenString fs;
const char *str;
char *fmt;
char cont_orig, cont, find, prev = ' ';
int len, i;
/* Get continuation from previous line */
if (line->prev && line->prev->format != NULL) {
fmt = line->prev->format;
cont = fmt[strlen(fmt) + 1]; /* Just after the null-terminator */
BLI_assert((FMT_CONT_ALL & cont) == cont);
}
else {
cont = FMT_CONT_NOP;
}
/* Get original continuation from this line */
if (line->format != NULL) {
fmt = line->format;
cont_orig = fmt[strlen(fmt) + 1]; /* Just after the null-terminator */
BLI_assert((FMT_CONT_ALL & cont_orig) == cont_orig);
}
else {
cont_orig = 0xFF;
}
len = flatten_string(st, &fs, line->line);
str = fs.buf;
if (!text_check_format_len(line, len)) {
flatten_string_free(&fs);
return;
}
fmt = line->format;
while (*str) {
/* Handle escape sequences by skipping both \ and next char */
if (*str == '\\') {
*fmt = prev; fmt++; str++;
if (*str == '\0') break;
*fmt = prev; fmt++; str += BLI_str_utf8_size_safe(str);
continue;
}
/* Handle continuations */
else if (cont) {
/* Multi-line comments */
if (cont & FMT_CONT_COMMENT_C) {
if (*str == ']' && *(str + 1) == ']') {
*fmt = FMT_TYPE_COMMENT; fmt++; str++;
*fmt = FMT_TYPE_COMMENT;
cont = FMT_CONT_NOP;
}
else {
*fmt = FMT_TYPE_COMMENT;
}
/* Handle other comments */
}
else {
find = (cont & FMT_CONT_QUOTEDOUBLE) ? '"' : '\'';
if (*str == find) cont = 0;
*fmt = FMT_TYPE_STRING;
}
str += BLI_str_utf8_size_safe(str) - 1;
}
/* Not in a string... */
else {
/* C-Style (multi-line) comments */
if (*str == '/' && *(str + 1) == '*') {
cont = FMT_CONT_COMMENT_C;
*fmt = FMT_TYPE_COMMENT; fmt++; str++;
*fmt = FMT_TYPE_COMMENT;
}
/* Single line comment */
else if (*str == '/' && *(str + 1) == '/') {
text_format_fill(&str, &fmt, FMT_TYPE_COMMENT, len - (int)(fmt - line->format));
}
else if (*str == '"' || *str == '\'') {
/* Strings */
find = *str;
cont = (*str == '"') ? FMT_CONT_QUOTEDOUBLE : FMT_CONT_QUOTESINGLE;
*fmt = FMT_TYPE_STRING;
}
/* Whitespace (all ws. has been converted to spaces) */
else if (*str == ' ') {
*fmt = FMT_TYPE_WHITESPACE;
}
/* Numbers (digits not part of an identifier and periods followed by digits) */
else if ((prev != FMT_TYPE_DEFAULT && text_check_digit(*str)) ||
(*str == '.' && text_check_digit(*(str + 1))))
{
*fmt = FMT_TYPE_NUMERAL;
}
/* Booleans */
else if (prev != FMT_TYPE_DEFAULT && (i = txtfmt_pov_find_bool(str)) != -1) {
if (i > 0) {
text_format_fill_ascii(&str, &fmt, FMT_TYPE_NUMERAL, i);
}
else {
str += BLI_str_utf8_size_safe(str) - 1;
*fmt = FMT_TYPE_DEFAULT;
}
}
/* Punctuation */
else if ((*str != '#') && text_check_delim(*str)) {
*fmt = FMT_TYPE_SYMBOL;
}
/* Identifiers and other text (no previous ws. or delims. so text continues) */
else if (prev == FMT_TYPE_DEFAULT) {
str += BLI_str_utf8_size_safe(str) - 1;
*fmt = FMT_TYPE_DEFAULT;
}
/* Not ws, a digit, punct, or continuing text. Must be new, check for special words */
else {
/* Special vars(v) or built-in keywords(b) */
/* keep in sync with 'txtfmt_pov_format_identifier()' */
if ((i = txtfmt_pov_find_specialvar(str)) != -1) prev = FMT_TYPE_SPECIAL;
else if ((i = txtfmt_pov_find_keyword(str)) != -1) prev = FMT_TYPE_KEYWORD;
else if ((i = txtfmt_pov_find_reserved(str)) != -1) prev = FMT_TYPE_RESERVED;
if (i > 0) {
text_format_fill_ascii(&str, &fmt, prev, i);
}
else {
str += BLI_str_utf8_size_safe(str) - 1;
*fmt = FMT_TYPE_DEFAULT;
}
}
}
prev = *fmt; fmt++; str++;
}
/* Terminate and add continuation char */
*fmt = '\0'; fmt++;
*fmt = cont;
/* If continuation has changed and we're allowed, process the next line */
if (cont != cont_orig && do_next && line->next) {
txtfmt_pov_format_line(st, line->next, do_next);
}
flatten_string_free(&fs);
}
void ED_text_format_register_pov(void)
{
static TextFormatType tft = {NULL};
static const char *ext[] = {"pov", "inc", "mcr", "mac", NULL};
tft.format_identifier = txtfmt_pov_format_identifier;
tft.format_line = txtfmt_pov_format_line;
tft.ext = ext;
ED_text_format_register(&tft);
}

View File

@ -0,0 +1,486 @@
/*
* ***** 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
* 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.
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/editors/space_text/text_format_pov_ini.c
* \ingroup sptext
*/
#include <string.h>
#include "BLI_blenlib.h"
#include "DNA_text_types.h"
#include "DNA_space_types.h"
#include "BKE_text.h"
#include "text_format.h"
/* *** POV INI Keywords (for format_line) *** */
/* Checks the specified source string for a POV INI keyword (minus boolean & 'nil').
* This name must start at the beginning of the source string and must be
* followed by a non-identifier (see text_check_identifier(char)) or null char.
*
* If a keyword is found, the length of the matching word is returned.
* Otherwise, -1 is returned.
*
* See:
* http://www.povray.org/documentation/view/3.7.0/212/
*/
static int txtfmt_ini_find_keyword(const char *string)
{
int i, len;
/* Language Directives */
if (STR_LITERAL_STARTSWITH(string, "append", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "break", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "case", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "debug", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "declare", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "default", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "deprecated", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "else", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "elseif", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "end", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "error", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "fclose", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "fopen", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "for", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "if", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ifdef", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ifndef", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "include", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "local", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "macro", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "range", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "read", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "render", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "statistics", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "switch", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "undef", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "version", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "warning", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "while", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "write", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "I", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "S", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "A", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Q", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "U", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "F", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "C", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "N", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "P", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "T", len)) i = len;
else i = 0;
/* If next source char is an identifier (eg. 'i' in "definate") no match */
return (i == 0 || text_check_identifier(string[i])) ? -1 : i;
}
static int txtfmt_ini_find_reserved(const char *string)
{
int i, len;
/* POV-Ray Built-in INI Variables
* list is from...
* http://www.povray.org/documentation/view/3.7.0/212/
*/
if (STR_LITERAL_STARTSWITH(string, "clock", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "clock_delta", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "clock_on", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "final_clock", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "final_frame", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "frame_number", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "initial_clock", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "initial_frame", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "image_height", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "image_width", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "input_file_name", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Subset_Start_Frame", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Subset_End_Frame", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Frame_Step", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Cyclic_Animation", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Field_Render", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Odd_Field", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Height", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Width", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Start_Column", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Start_Row", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "End_Column", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "End_Row", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Test_Abort", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Test_Abort_Count", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Continue_Trace", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Create_Continue_Trace_Log", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Create_Ini", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Display", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Display_Gamma", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Pause_When_Done", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Verbose", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Preview_Start_Size", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Preview_End_Size", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Output_to_File", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Input_File_Name", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Output_File_Name", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Output_File_Type", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Output_Alpha", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Bits_Per_Color", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Compression", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Dither", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Dither_Method", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Pre_Scene_Command", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Pre_Frame_Command", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Post_Scene_Command", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Post_Frame_Command", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "User_Abort_Command", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Fatal_Error_Command", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Pre_Scene_Return", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Pre_Frame_Return", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Post_Scene_Return", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Post_Frame_Return", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "User_Abort_Return", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Fatal_Error_Return", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Include_Header", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Library_Path", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Debug_Console", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Fatal_Console", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Render_Console", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Statistic_Console", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Warning_Console", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Warning_Level", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "All_Console", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Debug_File", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Fatal_File", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Render_File", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Statistic_File", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Warning_File", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "All_File", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "All_File", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "All_File", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Quality", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Bounding", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Bounding_Threshold", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Light_Buffer", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Vista_Buffer", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Remove_Bounds", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Split_Unions", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Antialias", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Sampling_Method", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Antialias_Threshold", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Jitter", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Jitter_Amount", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Antialias_Depth", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "CheckNewVersion", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "RunCount", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "CommandLine", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "TextColour", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "WarningColour", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ErrorColour", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "BackgroundColour", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "DropToEditor", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "LastRenderName", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "LastRenderPath", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "LastQueuePath", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "SecondaryINISection", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "BetaVersionNo64", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "LastBitmapName", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "LastBitmapPath", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "LastINIPath", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "SecondaryINIFile", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "BackgroundFile", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "SaveSettingsOnExit", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "TileBackground", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "HideNewUserHelp", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "SendSystemInfo", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ItsAboutTime", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "LastPath", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Band0Width", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Band1Width", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Band2Width", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Band3Width", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Band4Width", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ShowCmd", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "NormalPositionLeft", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "NormalPositionTop", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "NormalPositionRight", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "NormalPositionBottom", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "UseToolbar", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "UseTooltips", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "NormalPositionX", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "NormalPositionY", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Flags", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Transparency", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Use8BitMode", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "MakeActive", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "KeepAboveMain", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "HideWhenMainMinimized", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "AutoClose", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "PreserveBitmap", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "FontSize", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "FontWeight", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Font", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "KeepMessages", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "AlertSound", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Completion", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Priority", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "DutyCycle", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "AlertOnCompletion", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "AutoRender", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "PreventSleep", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "NoShelloutWait", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "SystemNoActive", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "RenderCompleteSoundEnabled", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ParseErrorSoundEnabled", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "RenderErrorSoundEnabled", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "RenderCompleteSound", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ParseErrorSound", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "RenderErrorSound", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "UseExtensions", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ReadWriteSourceDir", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "NoShellOuts", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "VideoSource", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "SceneFile", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "OutputFile", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "IniOutputFile", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "CurrentDirectory", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "SourceFile", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Rendering", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "RenderwinClose", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Append_File", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Warning Level", len)) i = len;
/* Filetypes */
else if (STR_LITERAL_STARTSWITH(string, "df3", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "exr", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "gif", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "hdr", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "iff", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "jpeg", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "pgm", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "png", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ppm", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sys", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "tga", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "tiff", len)) i = len;
/* Encodings */
else if (STR_LITERAL_STARTSWITH(string, "ascii", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "utf8", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "uint8", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "uint16be", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "uint16le", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sint8", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sint16be", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sint16le", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sint32be", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sint32le", len)) i = len;
else i = 0;
/* If next source char is an identifier (eg. 'i' in "definate") no match */
return (i == 0 || text_check_identifier(string[i])) ? -1 : i;
}
static int txtfmt_ini_find_bool(const char *string)
{
int i, len;
/* Built-in Constants */
if (STR_LITERAL_STARTSWITH(string, "false", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "no", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "off", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "true", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "yes", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "on", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "pi", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "tau", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "%o", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "%s", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "%n", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "%k", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "%h", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "%w", len)) i = len;
else i = 0;
/* If next source char is an identifier (eg. 'i' in "Nonetheless") no match */
return (i == 0 || text_check_identifier(string[i])) ? -1 : i;
}
static char txtfmt_pov_ini_format_identifier(const char *str)
{
char fmt;
if ((txtfmt_ini_find_keyword(str)) != -1) fmt = FMT_TYPE_KEYWORD;
else if ((txtfmt_ini_find_reserved(str)) != -1) fmt = FMT_TYPE_RESERVED;
else fmt = FMT_TYPE_DEFAULT;
return fmt;
}
static void txtfmt_pov_ini_format_line(SpaceText *st, TextLine *line, const bool do_next)
{
FlattenString fs;
const char *str;
char *fmt;
char cont_orig, cont, find, prev = ' ';
int len, i;
/* Get continuation from previous line */
if (line->prev && line->prev->format != NULL) {
fmt = line->prev->format;
cont = fmt[strlen(fmt) + 1]; /* Just after the null-terminator */
BLI_assert((FMT_CONT_ALL & cont) == cont);
}
else {
cont = FMT_CONT_NOP;
}
/* Get original continuation from this line */
if (line->format != NULL) {
fmt = line->format;
cont_orig = fmt[strlen(fmt) + 1]; /* Just after the null-terminator */
BLI_assert((FMT_CONT_ALL & cont_orig) == cont_orig);
}
else {
cont_orig = 0xFF;
}
len = flatten_string(st, &fs, line->line);
str = fs.buf;
if (!text_check_format_len(line, len)) {
flatten_string_free(&fs);
return;
}
fmt = line->format;
while (*str) {
/* Handle escape sequences by skipping both \ and next char */
if (*str == '\\') {
*fmt = prev; fmt++; str++;
if (*str == '\0') break;
*fmt = prev; fmt++; str += BLI_str_utf8_size_safe(str);
continue;
}
/* Handle continuations */
else if (cont) {
/* Multi-line comments */
if (cont & FMT_CONT_COMMENT_C) {
if (*str == ']' && *(str + 1) == ']') {
*fmt = FMT_TYPE_COMMENT; fmt++; str++;
*fmt = FMT_TYPE_COMMENT;
cont = FMT_CONT_NOP;
}
else {
*fmt = FMT_TYPE_COMMENT;
}
/* Handle other comments */
}
else {
find = (cont & FMT_CONT_QUOTEDOUBLE) ? '"' : '\'';
if (*str == find) cont = 0;
*fmt = FMT_TYPE_STRING;
}
str += BLI_str_utf8_size_safe(str) - 1;
}
/* Not in a string... */
else {
/* Multi-line comments not supported */
/* Single line comment */
if (*str == ';') {
text_format_fill(&str, &fmt, FMT_TYPE_COMMENT, len - (int)(fmt - line->format));
}
else if (*str == '"' || *str == '\'') {
/* Strings */
find = *str;
cont = (*str == '"') ? FMT_CONT_QUOTEDOUBLE : FMT_CONT_QUOTESINGLE;
*fmt = FMT_TYPE_STRING;
}
/* Whitespace (all ws. has been converted to spaces) */
else if (*str == ' ') {
*fmt = FMT_TYPE_WHITESPACE;
}
/* Numbers (digits not part of an identifier and periods followed by digits) */
else if ((prev != FMT_TYPE_DEFAULT && text_check_digit(*str)) ||
(*str == '.' && text_check_digit(*(str + 1))))
{
*fmt = FMT_TYPE_NUMERAL;
}
/* Booleans */
else if (prev != FMT_TYPE_DEFAULT && (i = txtfmt_ini_find_bool(str)) != -1) {
if (i > 0) {
text_format_fill_ascii(&str, &fmt, FMT_TYPE_NUMERAL, i);
}
else {
str += BLI_str_utf8_size_safe(str) - 1;
*fmt = FMT_TYPE_DEFAULT;
}
}
/* Punctuation */
else if ((*str != '#') && text_check_delim(*str)) {
*fmt = FMT_TYPE_SYMBOL;
}
/* Identifiers and other text (no previous ws. or delims. so text continues) */
else if (prev == FMT_TYPE_DEFAULT) {
str += BLI_str_utf8_size_safe(str) - 1;
*fmt = FMT_TYPE_DEFAULT;
}
/* Not ws, a digit, punct, or continuing text. Must be new, check for special words */
else {
/* Special vars(v) or built-in keywords(b) */
/* keep in sync with 'txtfmt_ini_format_identifier()' */
if ((i = txtfmt_ini_find_keyword(str)) != -1) prev = FMT_TYPE_KEYWORD;
else if ((i = txtfmt_ini_find_reserved(str)) != -1) prev = FMT_TYPE_RESERVED;
if (i > 0) {
text_format_fill_ascii(&str, &fmt, prev, i);
}
else {
str += BLI_str_utf8_size_safe(str) - 1;
*fmt = FMT_TYPE_DEFAULT;
}
}
}
prev = *fmt; fmt++; str++;
}
/* Terminate and add continuation char */
*fmt = '\0'; fmt++;
*fmt = cont;
/* If continuation has changed and we're allowed, process the next line */
if (cont != cont_orig && do_next && line->next) {
txtfmt_pov_ini_format_line(st, line->next, do_next);
}
flatten_string_free(&fs);
}
void ED_text_format_register_pov_ini(void)
{
static TextFormatType tft = {NULL};
static const char *ext[] = {"ini", NULL};
tft.format_identifier = txtfmt_pov_ini_format_identifier;
tft.format_line = txtfmt_pov_ini_format_line;
tft.ext = ext;
ED_text_format_register(&tft);
}

View File

@ -4969,7 +4969,7 @@ static void initPushPull(TransInfo *t)
static void applyPushPull(TransInfo *t, const int UNUSED(mval[2]))
{
float vec[3], axis[3];
float vec[3], axis_global[3];
float distance;
int i;
char str[UI_MAX_DRAW_STR];
@ -4997,7 +4997,7 @@ static void applyPushPull(TransInfo *t, const int UNUSED(mval[2]))
}
if (t->con.applyRot && t->con.mode & CON_APPLY) {
t->con.applyRot(t, NULL, axis, NULL);
t->con.applyRot(t, NULL, axis_global, NULL);
}
for (i = 0; i < t->total; i++, td++) {
@ -5009,7 +5009,11 @@ static void applyPushPull(TransInfo *t, const int UNUSED(mval[2]))
sub_v3_v3v3(vec, t->center, td->center);
if (t->con.applyRot && t->con.mode & CON_APPLY) {
float axis[3];
copy_v3_v3(axis, axis_global);
t->con.applyRot(t, td, axis, NULL);
mul_m3_v3(td->smtx, axis);
if (isLockConstraint(t)) {
float dvec[3];
project_v3_v3v3(dvec, vec, axis);

View File

@ -5239,6 +5239,16 @@ static void def_cmp_luma_matte(StructRNA *srna)
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_brightcontrast(StructRNA *srna)
{
PropertyRNA *prop;
prop = RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
RNA_def_property_ui_text(prop, "Convert Premul", "Keep output image premultiplied alpha");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_chroma_matte(StructRNA *srna)
{
PropertyRNA *prop;

View File

@ -1140,7 +1140,8 @@ static EnumPropertyItem *rna_SpaceProperties_context_itemf(bContext *UNUSED(C),
static void rna_SpaceProperties_context_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
SpaceButs *sbuts = (SpaceButs *)(ptr->data);
if (ELEM(sbuts->mainb, BCONTEXT_WORLD, BCONTEXT_MATERIAL, BCONTEXT_TEXTURE)) {
/* XXX BCONTEXT_DATA is ugly, but required for lamps... See T51318. */
if (ELEM(sbuts->mainb, BCONTEXT_WORLD, BCONTEXT_MATERIAL, BCONTEXT_TEXTURE, BCONTEXT_DATA)) {
sbuts->preview = 1;
}
}

View File

@ -205,8 +205,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
if (!do_add)
return dm;
/* Else, add a valid data layer! */
dvert = CustomData_add_layer_named(&dm->vertData, CD_MDEFORMVERT, CD_CALLOC,
NULL, numVerts, wmd->defgrp_name);
dvert = CustomData_add_layer(&dm->vertData, CD_MDEFORMVERT, CD_CALLOC, NULL, numVerts);
/* Ultimate security check. */
if (!dvert)
return dm;

View File

@ -261,8 +261,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
if (wmd->mix_set != MOD_WVG_SET_ALL)
return dm;
/* Else, add a valid data layer! */
dvert = CustomData_add_layer_named(&dm->vertData, CD_MDEFORMVERT, CD_CALLOC,
NULL, numVerts, wmd->defgrp_name_a);
dvert = CustomData_add_layer(&dm->vertData, CD_MDEFORMVERT, CD_CALLOC, NULL, numVerts);
/* Ultimate security check. */
if (!dvert)
return dm;

View File

@ -181,7 +181,7 @@ DefNode( CompositorNode, CMP_NODE_DISPLACE, 0, "DISPL
DefNode( CompositorNode, CMP_NODE_COMBHSVA, 0, "COMBHSVA", CombHSVA, "Combine HSVA", "" )
DefNode( CompositorNode, CMP_NODE_MATH, def_math, "MATH", Math, "Math", "" )
DefNode( CompositorNode, CMP_NODE_LUMA_MATTE, def_cmp_luma_matte, "LUMA_MATTE", LumaMatte, "Luminance Key", "" )
DefNode( CompositorNode, CMP_NODE_BRIGHTCONTRAST, 0, "BRIGHTCONTRAST", BrightContrast, "Bright/Contrast", "" )
DefNode( CompositorNode, CMP_NODE_BRIGHTCONTRAST, def_cmp_brightcontrast, "BRIGHTCONTRAST", BrightContrast, "Bright/Contrast", "" )
DefNode( CompositorNode, CMP_NODE_GAMMA, 0, "GAMMA", Gamma, "Gamma", "" )
DefNode( CompositorNode, CMP_NODE_INVERT, def_cmp_invert, "INVERT", Invert, "Invert", "" )
DefNode( CompositorNode, CMP_NODE_NORMALIZE, 0, "NORMALIZE", Normalize, "Normalize", "" )

View File

@ -46,6 +46,10 @@ static bNodeSocketTemplate cmp_node_brightcontrast_out[] = {
{ -1, 0, "" }
};
static void node_composit_init_brightcontrast(bNodeTree *UNUSED(ntree), bNode *node)
{
node->custom1 = 1;
}
void register_node_type_cmp_brightcontrast(void)
{
@ -53,6 +57,7 @@ void register_node_type_cmp_brightcontrast(void)
cmp_node_type_base(&ntype, CMP_NODE_BRIGHTCONTRAST, "Bright/Contrast", NODE_CLASS_OP_COLOR, 0);
node_type_socket_templates(&ntype, cmp_node_brightcontrast_in, cmp_node_brightcontrast_out);
node_type_init(&ntype, node_composit_init_brightcontrast);
nodeRegisterType(&ntype);
}

View File

@ -721,9 +721,9 @@ elseif(WIN32)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib/site-packages/numpy
COMMAND ${CMAKE_COMMAND} -E
tar xzvf "${LIBDIR}/release/python${_PYTHON_VERSION_NO_DOTS}_numpy_${PYTHON_NUMPY_VERSION}.tar.gz"
tar xzvf "${LIBDIR}/release/python${_PYTHON_VERSION_NO_DOTS}_numpy_${PYTHON_NUMPY_VERSION}$<$<CONFIG:Debug>:d>.tar.gz"
DEPENDS
${LIBDIR}/release/python${_PYTHON_VERSION_NO_DOTS}_numpy_${PYTHON_NUMPY_VERSION}.tar.gz
${LIBDIR}/release/python${_PYTHON_VERSION_NO_DOTS}_numpy_${PYTHON_NUMPY_VERSION}$<$<CONFIG:Debug>:d>.tar.gz
${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib/site-packages
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib/site-packages
)