svn merge ^/trunk/blender -r48691:48729

This commit is contained in:
Campbell Barton 2012-07-08 15:55:58 +00:00
commit 1bca7fe492
205 changed files with 2737 additions and 2481 deletions

@ -4223,6 +4223,10 @@ Game Types (bge.types)
This camera's 4x4 projection matrix.
.. note::
This is the identity matrix prior to rendering the first frame (any Python done on frame 1).
:type: 4x4 Matrix [[float]]
.. attribute:: modelview_matrix
@ -4233,7 +4237,7 @@ Game Types (bge.types)
.. note::
This matrix is regenerated every frame from the camera's position and orientation.
This matrix is regenerated every frame from the camera's position and orientation. Also, this is the identity matrix prior to rendering the first frame (any Python done on frame 1).
.. attribute:: camera_to_world

@ -419,8 +419,8 @@ GHOST_WindowX11(
x_image = XCreateImage(display, m_visual->visual, 24, ZPixmap, 0, NULL, BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT, 32, 0);
mask_image = XCreateImage(display, m_visual->visual, 1, ZPixmap, 0, NULL, BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT, 8, 0);
x_image->data = (char *)malloc(x_image->bytes_per_line * BLENDER_ICON_HEIGHT);
mask_image->data = (char *)malloc(mask_image->bytes_per_line * BLENDER_ICON_HEIGHT);
x_image->data = (char *)calloc(x_image->bytes_per_line * BLENDER_ICON_HEIGHT, 1);
mask_image->data = (char *)calloc(mask_image->bytes_per_line * BLENDER_ICON_HEIGHT, 1);
/* copy the BLENDER_ICON_48x48x24 into the XImage */
unsigned char *col = BLENDER_ICON_48x48x24;
@ -429,7 +429,11 @@ GHOST_WindowX11(
for (py = 0; py < BLENDER_ICON_HEIGHT; py++, col += 3) {
/* mask out pink */
if (col[0] == 255 && col[1] == 0 && col[2] == 255) {
#if 0
/* instead, use calloc above */
XPutPixel(x_image, px, py, 0); /* avoid uninitialized memory, otherwise not needed */
XPutPixel(mask_image, px, py, 0);
#endif
}
else {
XPutPixel(x_image, px, py, (col[0] << 16) + (col[1] << 8) + col[2]);
@ -1143,7 +1147,6 @@ GHOST_TSuccess GHOST_WindowX11::setState(GHOST_TWindowState state)
}
#include <iostream>
using namespace std;
GHOST_TSuccess
GHOST_WindowX11::

@ -63,14 +63,6 @@
#include <stdio.h> /* needed for FILE* */
#include "MEM_sys_types.h" /* needed for uintptr_t */
#ifndef WARN_UNUSED
# ifdef __GNUC__
# define WARN_UNUSED __attribute__((warn_unused_result))
# else
# define WARN_UNUSED
# endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
@ -78,14 +70,17 @@ extern "C" {
/** Returns the length of the allocated memory segment pointed at
* by vmemh. If the pointer was not previously allocated by this
* module, the result is undefined.*/
size_t MEM_allocN_len(void *vmemh) WARN_UNUSED;
size_t MEM_allocN_len(void *vmemh)
#ifdef __GNUC__
__attribute__((warn_unused_result))
#endif
;
/**
* Release memory previously allocatred by this module.
*/
short MEM_freeN(void *vmemh);
/**
* Return zero if memory is not in allocated list
*/
@ -94,30 +89,57 @@ extern "C" {
/**
* Duplicates a block of memory, and returns a pointer to the
* newly allocated block. */
void *MEM_dupallocN(void *vmemh) WARN_UNUSED;
void *MEM_dupallocN(void *vmemh)
#ifdef __GNUC__
__attribute__((warn_unused_result))
#endif
;
/**
* Reallocates a block of memory, and returns pointer to the newly
* allocated block, the old one is freed. this is not as optimized
* as a system realloc but just makes a new allocation and copies
* over from existing memory. */
void *MEM_reallocN(void *vmemh, size_t len) WARN_UNUSED;
void *MEM_reallocN(void *vmemh, size_t len)
#ifdef __GNUC__
__attribute__((warn_unused_result))
__attribute__((alloc_size(2)))
#endif
;
/**
* Allocate a block of memory of size len, with tag name str. The
* memory is cleared. The name must be static, because only a
* pointer to it is stored ! */
void *MEM_callocN(size_t len, const char * str) WARN_UNUSED;
void *MEM_callocN(size_t len, const char * str)
#ifdef __GNUC__
__attribute__((warn_unused_result))
__attribute__((nonnull))
__attribute__((alloc_size(1)))
#endif
;
/** Allocate a block of memory of size len, with tag name str. The
* name must be a static, because only a pointer to it is stored !
* */
void *MEM_mallocN(size_t len, const char * str) WARN_UNUSED;
void *MEM_mallocN(size_t len, const char * str)
#ifdef __GNUC__
__attribute__((warn_unused_result))
__attribute__((nonnull))
__attribute__((alloc_size(1)))
#endif
;
/** Same as callocN, clears memory and uses mmap (disk cached) if supported.
* Can be free'd with MEM_freeN as usual.
* */
void *MEM_mapallocN(size_t len, const char * str) WARN_UNUSED;
void *MEM_mapallocN(size_t len, const char * str)
#ifdef __GNUC__
__attribute__((warn_unused_result))
__attribute__((nonnull))
__attribute__((alloc_size(1)))
#endif
;
/** Print a list of the names and sizes of all allocated memory
* blocks. as a python dict for easy investigation */
@ -162,7 +184,11 @@ extern "C" {
void MEM_reset_peak_memory(void);
/** Get the peak memory usage in bytes, including mmap allocations. */
uintptr_t MEM_get_peak_memory(void) WARN_UNUSED;
uintptr_t MEM_get_peak_memory(void)
#ifdef __GNUC__
__attribute__((warn_unused_result))
#endif
;
#ifndef NDEBUG
const char *MEM_name_ptr(void *vmemh);

@ -163,6 +163,9 @@ static int malloc_debug_memset = 0;
/* implementation */
/* --------------------------------------------------------------------- */
#ifdef __GNUC__
__attribute__ ((format(printf, 1, 2)))
#endif
static void print_error(const char *str, ...)
{
char buf[512];

@ -25,8 +25,7 @@
import os
# XXX Relative import does not work here when used from Blender...
#from . import settings
import bl_i18n_utils.settings as settings
from bl_i18n_utils import settings
#classes = set()

@ -100,8 +100,11 @@ PYGETTEXT_KEYWORDS = (() +
tuple((r"{}\(\s*" + _ctxt_re + r"\s*,\s*"+ _msg_re + r"\s*\)").format(it)
for it in ("CTX_IFACE_", "CTX_TIP_", "CTX_N_"))
)
#GETTEXT_KEYWORDS = ("IFACE_", "CTX_IFACE_:1c,2", "TIP_", "CTX_TIP_:1c,2",
# "N_", "CTX_N_:1c,2")
ESCAPE_RE = (
('((?<!\\\\)"|(?<!\\\\)\\\\(?!\\\\|"))', r"\\\1"),
('\t', r"\\t"),
)
# Should po parser warn when finding a first letter not capitalized?
WARN_MSGID_NOT_CAPITALIZED = True

@ -71,6 +71,8 @@ def process_po(po, lang):
# update po file
cmd = (GETTEXT_MSGMERGE_EXECUTABLE,
"--update",
"-w", "1", # XXX Ugly hack to prevent msgmerge merging
# short source comments together!
"--no-wrap",
"--backup=none",
"--lang={}".format(lang),

@ -26,7 +26,6 @@ import subprocess
import os
import sys
import re
#from codecs import open
import tempfile
import argparse
import time
@ -40,14 +39,11 @@ COMMENT_PREFIX = settings.COMMENT_PREFIX
COMMENT_PREFIX_SOURCE = settings.COMMENT_PREFIX_SOURCE
CONTEXT_PREFIX = settings.CONTEXT_PREFIX
FILE_NAME_MESSAGES = settings.FILE_NAME_MESSAGES
#FILE_NAME_POTFILES = settings.FILE_NAME_POTFILES
FILE_NAME_POT = settings.FILE_NAME_POT
SOURCE_DIR = settings.SOURCE_DIR
POTFILES_DIR = settings.POTFILES_SOURCE_DIR
SRC_POTFILES = settings.FILE_NAME_SRC_POTFILES
#GETTEXT_XGETTEXT_EXECUTABLE = settings.GETTEXT_XGETTEXT_EXECUTABLE
#GETTEXT_KEYWORDS = settings.GETTEXT_KEYWORDS
CONTEXT_DEFAULT = settings.CONTEXT_DEFAULT
PYGETTEXT_ALLOWED_EXTS = settings.PYGETTEXT_ALLOWED_EXTS
@ -59,16 +55,6 @@ NC_ALLOWED = settings.WARN_MSGID_NOT_CAPITALIZED_ALLOWED
SPELL_CACHE = settings.SPELL_CACHE
#def generate_valid_potfiles(final_potfiles):
# "Generates a temp potfiles.in with aboslute paths."
# with open(FILE_NAME_POTFILES, 'r', 'utf-8') as f, \
# open(final_potfiles, 'w', 'utf-8') as w:
# for line in f:
# line = utils.stripeol(line)
# if line:
# w.write("".join((os.path.join(SOURCE_DIR,
# os.path.normpath(line)), "\n")))
# Do this only once!
# Get contexts defined in blf.
CONTEXTS = {}
@ -79,7 +65,7 @@ with open(os.path.join(SOURCE_DIR, settings.PYGETTEXT_CONTEXTS_DEFSRC)) as f:
# (key=C_macro_name, value=C_string).
CONTEXTS = dict(m.groups() for m in reg.finditer(f))
# Build regexes to extract messages (with optinal contexts) from C source.
# Build regexes to extract messages (with optional contexts) from C source.
pygettexts = tuple(re.compile(r).search
for r in settings.PYGETTEXT_KEYWORDS)
_clean_str = re.compile(settings.str_clean_re).finditer
@ -203,6 +189,8 @@ def gen_empty_pot():
return utils.gen_empty_messages(blender_rev, time_str, year_str)
escape_re = tuple(re.compile(r[0]) for r in settings.ESCAPE_RE)
escape = lambda s, n: escape_re[n].sub(settings.ESCAPE_RE[n][1], s)
def merge_messages(msgs, states, messages, do_checks, spell_cache):
num_added = num_present = 0
for (context, msgid), srcs in messages.items():
@ -214,9 +202,8 @@ def merge_messages(msgs, states, messages, do_checks, spell_cache):
print("\tFrom:\n\t\t" + "\n\t\t".join(srcs))
# Escape some chars in msgid!
msgid = msgid.replace("\\", "\\\\")
msgid = msgid.replace("\"", "\\\"")
msgid = msgid.replace("\t", "\\t")
for n in range(len(escape_re)):
msgid = escape(msgid, n)
srcs = [COMMENT_PREFIX_SOURCE + s for s in srcs]

@ -23,9 +23,8 @@
import os
import sys
import collections
from codecs import open
import settings
from bl_i18n_utils import settings
COMMENT_PREFIX = settings.COMMENT_PREFIX
@ -145,7 +144,7 @@ def parse_messages(fname):
clean_vars()
with open(fname, 'r', "utf-8") as f:
with open(fname, 'r', encoding="utf-8") as f:
for line_nr, line in enumerate(f):
line = stripeol(line)
if line == "":
@ -248,7 +247,7 @@ def write_messages(fname, messages, commented, fuzzy):
"returned values). commented and fuzzy are two sets containing msgid. " \
"Returns the number of written messages."
num = 0
with open(fname, 'w', "utf-8") as f:
with open(fname, 'w', encoding="utf-8") as f:
for msgkey, val in messages.items():
msgctxt, msgid = msgkey
f.write("\n".join(val["comment_lines"]))

@ -46,7 +46,7 @@ class MESH_OT_delete_edgeloop(Operator):
rna_path_prop = StringProperty(
name="Context Attributes",
description="rna context string",
description="RNA context string",
maxlen=1024,
)
@ -372,8 +372,8 @@ class WM_OT_context_toggle_enum(Operator):
class WM_OT_context_cycle_int(Operator):
"""Set a context value. Useful for cycling active material, """ \
"""vertex keys, groups' etc"""
"""Set a context value (useful for cycling active material, """ \
"""vertex keys, groups, etc.)"""
bl_idname = "wm.context_cycle_int"
bl_label = "Context Int Cycle"
bl_options = {'UNDO', 'INTERNAL'}

@ -870,7 +870,7 @@ AviError AVI_open_compress(char *name, AviMovie *movie, int streams, ...)
}
}
else if (movie->streams[i].sh.Type == FCC("auds")) {
// pass
/* pass */
}
#endif
}

@ -60,15 +60,30 @@ typedef union IDPropertyTemplate {
/* note: as a start to move away from the stupid IDP_New function, this type
* has it's own allocation function.*/
IDProperty *IDP_NewIDPArray(const char *name);
IDProperty *IDP_CopyIDPArray(IDProperty *array);
IDProperty *IDP_NewIDPArray(const char *name)
#ifdef __GNUC__
__attribute__((warn_unused_result))
__attribute__((nonnull))
#endif
;
IDProperty *IDP_CopyIDPArray(IDProperty *array)
#ifdef __GNUC__
__attribute__((warn_unused_result))
__attribute__((nonnull))
#endif
;
void IDP_FreeIDPArray(IDProperty *prop);
/* shallow copies item */
void IDP_SetIndexArray(struct IDProperty *prop, int index, struct IDProperty *item);
struct IDProperty *IDP_GetIndexArray(struct IDProperty *prop, int index);
struct IDProperty *IDP_AppendArray(struct IDProperty *prop, struct IDProperty *item);
struct IDProperty *IDP_GetIndexArray(struct IDProperty *prop, int index)
#ifdef __GNUC__
__attribute__((warn_unused_result))
__attribute__((nonnull))
#endif
;
void IDP_AppendArray(struct IDProperty *prop, struct IDProperty *item);
void IDP_ResizeIDPArray(struct IDProperty *prop, int len);
/* ----------- Numeric Array Type ----------- */
@ -77,11 +92,33 @@ void IDP_ResizeArray(struct IDProperty *prop, int newlen);
void IDP_FreeArray(struct IDProperty *prop);
/* ---------- String Type ------------ */
IDProperty *IDP_NewString(const char *st, const char *name, int maxlen); /* maxlen excludes '\0' */
void IDP_AssignString(struct IDProperty *prop, const char *st, int maxlen); /* maxlen excludes '\0' */
void IDP_ConcatStringC(struct IDProperty *prop, const char *st);
void IDP_ConcatString(struct IDProperty *str1, struct IDProperty *append);
void IDP_FreeString(struct IDProperty *prop);
IDProperty *IDP_NewString(const char *st, const char *name, int maxlen) /* maxlen excludes '\0' */
#ifdef __GNUC__
__attribute__((warn_unused_result))
__attribute__((nonnull))
#endif
;
void IDP_AssignString(struct IDProperty *prop, const char *st, int maxlen) /* maxlen excludes '\0' */
#ifdef __GNUC__
__attribute__((nonnull))
#endif
;
void IDP_ConcatStringC(struct IDProperty *prop, const char *st)
#ifdef __GNUC__
__attribute__((nonnull))
#endif
;
void IDP_ConcatString(struct IDProperty *str1, struct IDProperty *append)
#ifdef __GNUC__
__attribute__((nonnull))
#endif
;
void IDP_FreeString(struct IDProperty *prop)
#ifdef __GNUC__
__attribute__((nonnull))
#endif
;
/*-------- ID Type -------*/
void IDP_LinkID(struct IDProperty *prop, ID *id);
@ -90,17 +127,29 @@ void IDP_UnlinkID(struct IDProperty *prop);
/*-------- Group Functions -------*/
/** Sync values from one group to another, only where they match */
void IDP_SyncGroupValues(struct IDProperty *dest, struct IDProperty *src);
void IDP_SyncGroupValues(struct IDProperty *dest, struct IDProperty *src)
#ifdef __GNUC__
__attribute__((nonnull))
#endif
;
/**
* replaces all properties with the same name in a destination group from a source group.
*/
void IDP_ReplaceGroupInGroup(struct IDProperty *dest, struct IDProperty *src);
void IDP_ReplaceGroupInGroup(struct IDProperty *dest, struct IDProperty *src)
#ifdef __GNUC__
__attribute__((nonnull))
#endif
;
/**
* Checks if a property with the same name as prop exists, and if so replaces it.
* Use this to preserve order!*/
void IDP_ReplaceInGroup(struct IDProperty *group, struct IDProperty *prop);
void IDP_ReplaceInGroup(struct IDProperty *group, struct IDProperty *prop)
#ifdef __GNUC__
__attribute__((nonnull))
#endif
;
/**
* This function has a sanity check to make sure ID properties with the same name don't
@ -117,12 +166,20 @@ void IDP_ReplaceInGroup(struct IDProperty *group, struct IDProperty *prop);
* struct. In the future this will just be IDP_FreeProperty and the code will
* be reorganized to work properly.
*/
int IDP_AddToGroup(struct IDProperty *group, struct IDProperty *prop);
int IDP_AddToGroup(struct IDProperty *group, struct IDProperty *prop)
#ifdef __GNUC__
__attribute__((nonnull))
#endif
;
/** this is the same as IDP_AddToGroup, only you pass an item
* in the group list to be inserted after. */
int IDP_InsertToGroup(struct IDProperty *group, struct IDProperty *previous,
struct IDProperty *pnew);
struct IDProperty *pnew)
#ifdef __GNUC__
__attribute__((nonnull))
#endif
;
/** \note this does not free the property!!
*
@ -130,18 +187,36 @@ int IDP_InsertToGroup(struct IDProperty *group, struct IDProperty *previous,
* IDP_FreeProperty(prop); //free all subdata
* MEM_freeN(prop); //free property struct itself
*/
void IDP_RemFromGroup(struct IDProperty *group, struct IDProperty *prop);
void IDP_RemFromGroup(struct IDProperty *group, struct IDProperty *prop)
#ifdef __GNUC__
__attribute__((nonnull))
#endif
;
IDProperty *IDP_GetPropertyFromGroup(struct IDProperty *prop, const char *name);
IDProperty *IDP_GetPropertyFromGroup(struct IDProperty *prop, const char *name)
#ifdef __GNUC__
__attribute__((warn_unused_result))
__attribute__((nonnull))
#endif
;
/** same as above but ensure type match */
IDProperty *IDP_GetPropertyTypeFromGroup(struct IDProperty *prop, const char *name, const char type);
IDProperty *IDP_GetPropertyTypeFromGroup(struct IDProperty *prop, const char *name, const char type)
#ifdef __GNUC__
__attribute__((warn_unused_result))
__attribute__((nonnull))
#endif
;
/**
* Get an iterator to iterate over the members of an id property group.
* Note that this will automatically free the iterator once iteration is complete;
* if you stop the iteration before hitting the end, make sure to call
* IDP_FreeIterBeforeEnd(). */
void *IDP_GetGroupIterator(struct IDProperty *prop);
void *IDP_GetGroupIterator(struct IDProperty *prop)
#ifdef __GNUC__
__attribute__((warn_unused_result))
#endif
;
/**
* Returns the next item in the iteration. To use, simple for a loop like the following:
@ -149,21 +224,45 @@ void *IDP_GetGroupIterator(struct IDProperty *prop);
* ...
* }
*/
IDProperty *IDP_GroupIterNext(void *vself);
IDProperty *IDP_GroupIterNext(void *vself)
#ifdef __GNUC__
__attribute__((warn_unused_result))
__attribute__((nonnull))
#endif
;
/**
* Frees the iterator pointed to at vself, only use this if iteration is stopped early;
* when the iterator hits the end of the list it'll automatically free itself.*/
void IDP_FreeIterBeforeEnd(void *vself);
void IDP_FreeIterBeforeEnd(void *vself)
#ifdef __GNUC__
__attribute__((nonnull))
#endif
;
/*-------- Main Functions --------*/
/** Get the Group property that contains the id properties for ID id. Set create_if_needed
* to create the Group property and attach it to id if it doesn't exist; otherwise
* the function will return NULL if there's no Group property attached to the ID.*/
struct IDProperty *IDP_GetProperties(struct ID *id, int create_if_needed);
struct IDProperty *IDP_CopyProperty(struct IDProperty *prop);
struct IDProperty *IDP_GetProperties(struct ID *id, int create_if_needed)
#ifdef __GNUC__
__attribute__((warn_unused_result))
__attribute__((nonnull))
#endif
;
struct IDProperty *IDP_CopyProperty(struct IDProperty *prop)
#ifdef __GNUC__
__attribute__((warn_unused_result))
__attribute__((nonnull))
#endif
;
int IDP_EqualsProperties(struct IDProperty *prop1, struct IDProperty *prop2);
int IDP_EqualsProperties(struct IDProperty *prop1, struct IDProperty *prop2)
#ifdef __GNUC__
__attribute__((warn_unused_result))
__attribute__((nonnull))
#endif
;
/**
* Allocate a new ID.
@ -190,7 +289,12 @@ int IDP_EqualsProperties(struct IDProperty *prop1, struct IDProperty *prop2);
* IDP_AddToGroup or MEM_freeN the property, doing anything else might result in
* a memory leak.
*/
struct IDProperty *IDP_New(const int type, const IDPropertyTemplate *val, const char *name);
struct IDProperty *IDP_New(const int type, const IDPropertyTemplate *val, const char *name)
#ifdef __GNUC__
__attribute__((warn_unused_result))
__attribute__((nonnull))
#endif
;
/** \note this will free all child properties of list arrays and groups!
* Also, note that this does NOT unlink anything! Plus it doesn't free

@ -38,9 +38,9 @@ extern "C" {
struct Lamp;
void *BKE_lamp_add(const char *name);
struct Lamp *BKE_lamp_copy(struct Lamp *la);
struct Lamp *localize_lamp(struct Lamp *la);
struct Lamp *BKE_lamp_add(const char *name) WARN_UNUSED;
struct Lamp *BKE_lamp_copy(struct Lamp *la) WARN_UNUSED;
struct Lamp *localize_lamp(struct Lamp *la) WARN_UNUSED;
void BKE_lamp_make_local(struct Lamp *la);
void BKE_lamp_free(struct Lamp *la);

@ -45,8 +45,18 @@ struct bContext;
struct PointerRNA;
struct PropertyRNA;
void *BKE_libblock_alloc(struct ListBase *lb, short type, const char *name);
void *BKE_libblock_copy(struct ID *id);
void *BKE_libblock_alloc(struct ListBase *lb, short type, const char *name)
#ifdef __GNUC__
__attribute__((warn_unused_result))
__attribute__((nonnull))
#endif
;
void *BKE_libblock_copy(struct ID *id)
#ifdef __GNUC__
__attribute__((warn_unused_result))
__attribute__((nonnull))
#endif
;
void BKE_libblock_copy_data(struct ID *id, const struct ID *id_from, const short do_action);
void BKE_id_lib_local_paths(struct Main *bmain, struct Library *lib, struct ID *id);
@ -82,7 +92,12 @@ void name_uiprefix_id(char *name, struct ID *id);
void test_idbutton(char *name);
void text_idbutton(struct ID *id, char *text);
void BKE_library_make_local(struct Main *bmain, struct Library *lib, int untagged_only);
struct ID *BKE_libblock_find_name(const short type, const char *name);
struct ID *BKE_libblock_find_name(const short type, const char *name)
#ifdef __GNUC__
__attribute__((warn_unused_result))
__attribute__((nonnull))
#endif
;
void clear_id_newpoins(void);
void IDnames_to_pupstring(const char **str, const char *title, const char *extraops,

@ -2210,7 +2210,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss)
VertDataAdd(co, r, ss);
}
// edge flags cleared later
/* edge flags cleared later */
}
for (ptrIdx = 0; ptrIdx < numEffectedV; ptrIdx++) {
CCGVert *v = effectedV[ptrIdx];
@ -2337,7 +2337,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss)
VertDataAdd(nCo, r, ss);
}
// vert flags cleared later
/* vert flags cleared later */
}
if (ss->useAgeCounts) {

@ -74,7 +74,7 @@
static DerivedMesh *navmesh_dm_createNavMeshForVisualization(DerivedMesh *dm);
#endif
#include "BLO_sys_types.h" // for intptr_t support
#include "BLO_sys_types.h" /* for intptr_t support */
#include "GL/glew.h"
@ -956,22 +956,22 @@ void weight_to_rgb(float r_rgb[3], const float weight)
{
const float blend = ((weight / 2.0f) + 0.5f);
if (weight <= 0.25f) { // blue->cyan
if (weight <= 0.25f) { /* blue->cyan */
r_rgb[0] = 0.0f;
r_rgb[1] = blend * weight * 4.0f;
r_rgb[2] = blend;
}
else if (weight <= 0.50f) { // cyan->green
else if (weight <= 0.50f) { /* cyan->green */
r_rgb[0] = 0.0f;
r_rgb[1] = blend;
r_rgb[2] = blend * (1.0f - ((weight - 0.25f) * 4.0f));
}
else if (weight <= 0.75f) { // green->yellow
else if (weight <= 0.75f) { /* green->yellow */
r_rgb[0] = blend * ((weight - 0.50f) * 4.0f);
r_rgb[1] = blend;
r_rgb[2] = 0.0f;
}
else if (weight <= 1.0f) { // yellow->red
else if (weight <= 1.0f) { /* yellow->red */
r_rgb[0] = blend;
r_rgb[1] = blend * (1.0f - ((weight - 0.75f) * 4.0f));
r_rgb[2] = 0.0f;
@ -2379,16 +2379,16 @@ float *mesh_get_mapped_verts_nors(Scene *scene, Object *ob)
typedef struct {
float *precomputedFaceNormals;
MTFace *mtface; // texture coordinates
MFace *mface; // indices
MVert *mvert; // vertices & normals
MTFace *mtface; /* texture coordinates */
MFace *mface; /* indices */
MVert *mvert; /* vertices & normals */
float (*orco)[3];
float (*tangent)[4]; // destination
float (*tangent)[4]; /* destination */
int numTessFaces;
} SGLSLMeshToTangent;
// interface
/* interface */
#include "mikktspace.h"
static int GetNumFaces(const SMikkTSpaceContext *pContext)
@ -2508,7 +2508,7 @@ void DM_add_tangent_layer(DerivedMesh *dm)
BLI_memarena_use_calloc(arena);
vtangents = MEM_callocN(sizeof(VertexTangent *) * totvert, "VertexTangent");
// new computation method
/* new computation method */
iCalcNewMethod = 1;
if (iCalcNewMethod != 0) {
SGLSLMeshToTangent mesh2tangent = {0};
@ -2532,7 +2532,7 @@ void DM_add_tangent_layer(DerivedMesh *dm)
sInterface.m_getNormal = GetNormal;
sInterface.m_setTSpaceBasic = SetTSpace;
// 0 if failed
/* 0 if failed */
iCalcNewMethod = genTangSpaceDefault(&sContext);
}
@ -2638,7 +2638,7 @@ void DM_calc_auto_bump_scale(DerivedMesh *dm)
tex_coords[3] = mtface[f].uv[3];
}
// discard degenerate faces
/* discard degenerate faces */
is_degenerate = 0;
if (equals_v3v3(verts[0], verts[1]) || equals_v3v3(verts[0], verts[2]) || equals_v3v3(verts[1], verts[2]) ||
equals_v2v2(tex_coords[0], tex_coords[1]) || equals_v2v2(tex_coords[0], tex_coords[2]) || equals_v2v2(tex_coords[1], tex_coords[2]))
@ -2646,7 +2646,7 @@ void DM_calc_auto_bump_scale(DerivedMesh *dm)
is_degenerate = 1;
}
// verify last vertex as well if this is a quad
/* verify last vertex as well if this is a quad */
if (is_degenerate == 0 && nr_verts == 4) {
if (equals_v3v3(verts[3], verts[0]) || equals_v3v3(verts[3], verts[1]) || equals_v3v3(verts[3], verts[2]) ||
equals_v2v2(tex_coords[3], tex_coords[0]) || equals_v2v2(tex_coords[3], tex_coords[1]) || equals_v2v2(tex_coords[3], tex_coords[2]))
@ -2654,7 +2654,7 @@ void DM_calc_auto_bump_scale(DerivedMesh *dm)
is_degenerate = 1;
}
// verify the winding is consistent
/* verify the winding is consistent */
if (is_degenerate == 0) {
float prev_edge[2];
int is_signed = 0;
@ -2681,11 +2681,11 @@ void DM_calc_auto_bump_scale(DerivedMesh *dm)
}
}
// proceed if not a degenerate face
/* proceed if not a degenerate face */
if (is_degenerate == 0) {
int nr_tris_to_pile = 0;
// quads split at shortest diagonal
int offs = 0; // initial triangulation is 0,1,2 and 0, 2, 3
/* quads split at shortest diagonal */
int offs = 0; /* initial triangulation is 0,1,2 and 0, 2, 3 */
if (nr_verts == 4) {
float pos_len_diag0, pos_len_diag1;
float vtmp[3];
@ -2743,7 +2743,7 @@ void DM_calc_auto_bump_scale(DerivedMesh *dm)
}
}
// finalize
/* finalize */
{
const float avg_area_ratio = (nr_accumulated > 0) ? ((float)(dsum / nr_accumulated)) : 1.0f;
const float use_as_render_bump_scale = sqrtf(avg_area_ratio); // use width of average surface ratio as your bump scale

@ -134,7 +134,7 @@ void BKE_action_make_local(bAction *act)
if (act->id.lib == NULL)
return;
// XXX: double-check this; it used to be just single-user check, but that was when fake-users were still default
/* XXX: double-check this; it used to be just single-user check, but that was when fake-users were still default */
if ((act->id.flag & LIB_FAKEUSER) && (act->id.us <= 1)) {
id_clear_lib_data(bmain, &act->id);
return;
@ -547,7 +547,7 @@ void BKE_pose_copy_data(bPose **dst, bPose *src, int copycon)
outPose->ikparam = MEM_dupallocN(src->ikparam);
for (pchan = outPose->chanbase.first; pchan; pchan = pchan->next) {
// TODO: rename this argument...
/* TODO: rename this argument... */
if (copycon) {
copy_constraints(&listb, &pchan->constraints, TRUE); // copy_constraints NULLs listb
pchan->constraints = listb;
@ -807,7 +807,7 @@ void framechange_poses_clear_unkeyed(void)
bPoseChannel *pchan;
/* This needs to be done for each object that has a pose */
// TODO: proxies may/may not be correctly handled here... (this needs checking)
/* TODO: proxies may/may not be correctly handled here... (this needs checking) */
for (ob = G.main->object.first; ob; ob = ob->id.next) {
/* we only need to do this on objects with a pose */
if ( (pose = ob->pose) ) {
@ -907,7 +907,7 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_
float nmin, nmax;
/* get extents for this curve */
// TODO: allow enabling/disabling this?
/* TODO: allow enabling/disabling this? */
calc_fcurve_range(fcu, &nmin, &nmax, FALSE, TRUE);
/* compare to the running tally */
@ -949,7 +949,7 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_
}
break;
// TODO: function modifier may need some special limits
/* TODO: function modifier may need some special limits */
default: /* all other standard modifiers are on the infinite range... */
min = MINAFRAMEF;
@ -1129,7 +1129,7 @@ void BKE_pose_copy_result(bPose *to, bPose *from)
bPoseChannel *pchanto, *pchanfrom;
if (to == NULL || from == NULL) {
printf("pose result copy error to:%p from:%p\n", (void *)to, (void *)from); // debug temp
printf("pose result copy error to:%p from:%p\n", (void *)to, (void *)from); /* debug temp */
return;
}
@ -1378,12 +1378,12 @@ static float stridechannel_frame(Object *ob, float sizecorr, bActionStrip *strip
/* now we need to go pdist further (or less) on cu path */
where_on_path(ob, (pathdist) / path->totdist, vec1, dir); /* vec needs size 4 */
if (pdistNewNormalized <= 1) {
// search for correction in positive path-direction
/* search for correction in positive path-direction */
where_on_path(ob, pdistNewNormalized, vec2, dir); /* vec needs size 4 */
sub_v3_v3v3(stride_offset, vec2, vec1);
}
else {
// we reached the end of the path, search backwards instead
/* we reached the end of the path, search backwards instead */
where_on_path(ob, (pathdist - pdist) / path->totdist, vec2, dir); /* vec needs size 4 */
sub_v3_v3v3(stride_offset, vec1, vec2);
}

@ -90,8 +90,8 @@ void animviz_settings_init(bAnimVizSettings *avs)
/* ghosting settings */
avs->ghost_bc = avs->ghost_ac = 10;
avs->ghost_sf = 1; // xxx - take from scene instead?
avs->ghost_ef = 250; // xxx - take from scene instead?
avs->ghost_sf = 1; /* xxx - take from scene instead? */
avs->ghost_ef = 250; /* xxx - take from scene instead? */
avs->ghost_step = 1;
@ -99,8 +99,8 @@ void animviz_settings_init(bAnimVizSettings *avs)
/* path settings */
avs->path_bc = avs->path_ac = 10;
avs->path_sf = 1; // xxx - take from scene instead?
avs->path_ef = 250; // xxx - take from scene instead?
avs->path_sf = 1; /* xxx - take from scene instead? */
avs->path_ef = 250; /* xxx - take from scene instead? */
avs->path_viewflag = (MOTIONPATH_VIEW_KFRAS | MOTIONPATH_VIEW_KFNOS);
@ -246,7 +246,7 @@ typedef struct MPathTarget {
/* get list of motion paths to be baked for the given object
* - assumes the given list is ready to be used
*/
// TODO: it would be nice in future to be able to update objects dependent on these bones too?
/* TODO: it would be nice in future to be able to update objects dependent on these bones too? */
void animviz_get_object_motionpaths(Object *ob, ListBase *targets)
{
MPathTarget *mpt;
@ -309,7 +309,9 @@ static void motionpaths_calc_optimise_depsgraph(Scene *scene, ListBase *targets)
BLI_addhead(&scene->base, base);
mpt->ob->flag |= BA_TEMP_TAG;
break; // we really don't need to continue anymore once this happens, but this line might really 'break'
/* we really don't need to continue anymore once this happens, but this line might really 'break' */
break;
}
}
}
@ -330,15 +332,15 @@ static void motionpaths_calc_update_scene(Scene *scene)
/* find the last object with the tag
* - all those afterwards are assumed to not be relevant for our calculations
*/
// optimize further by moving out...
/* optimize further by moving out... */
for (base = scene->base.first; base; base = base->next) {
if (base->object->flag & BA_TEMP_TAG)
last = base;
}
/* perform updates for tagged objects */
// XXX: this will break if rigs depend on scene or other data that
// is animated but not attached to/updatable from objects
/* XXX: this will break if rigs depend on scene or other data that
* is animated but not attached to/updatable from objects */
for (base = scene->base.first; base; base = base->next) {
/* update this object */
BKE_object_handle_update(scene, base->object);
@ -353,7 +355,7 @@ static void motionpaths_calc_update_scene(Scene *scene)
* that doesn't force complete update, but for now, this is the
* most accurate way!
*/
BKE_scene_update_for_newframe(G.main, scene, scene->lay); // XXX this is the best way we can get anything moving
BKE_scene_update_for_newframe(G.main, scene, scene->lay); /* XXX this is the best way we can get anything moving */
#endif
}
@ -403,7 +405,7 @@ static void motionpaths_calc_bake_targets(Scene *scene, ListBase *targets)
* - ob: object whose flagged motionpaths should get calculated
* - recalc: whether we need to
*/
// TODO: include reports pointer?
/* TODO: include reports pointer? */
void animviz_calc_motionpaths(Scene *scene, ListBase *targets)
{
MPathTarget *mpt;
@ -418,9 +420,9 @@ void animviz_calc_motionpaths(Scene *scene, ListBase *targets)
cfra = CFRA;
sfra = efra = cfra;
// TODO: this method could be improved...
// 1) max range for standard baking
// 2) minimum range for recalc baking (i.e. between keyframes, but how?)
/* TODO: this method could be improved...
* 1) max range for standard baking
* 2) minimum range for recalc baking (i.e. between keyframes, but how?) */
for (mpt = targets->first; mpt; mpt = mpt->next) {
/* try to increase area to do (only as much as needed) */
sfra = MIN2(sfra, mpt->mpath->start_frame);
@ -429,7 +431,7 @@ void animviz_calc_motionpaths(Scene *scene, ListBase *targets)
if (efra <= sfra) return;
/* optimize the depsgraph for faster updates */
// TODO: whether this is used should depend on some setting for the level of optimisations used
/* TODO: whether this is used should depend on some setting for the level of optimisations used */
motionpaths_calc_optimise_depsgraph(scene, targets);
/* calculate path over requested range */

@ -78,7 +78,7 @@ short id_type_can_have_animdata(ID *id)
return 0;
/* Only some ID-blocks have this info for now */
// TODO: finish adding this for the other blocktypes
/* TODO: finish adding this for the other blocktypes */
switch (GS(id->name)) {
/* has AnimData */
case ID_OB:
@ -231,7 +231,7 @@ void BKE_free_animdata(ID *id)
free_fcurves(&adt->drivers);
/* free overrides */
// TODO...
/* TODO... */
/* free animdata now */
MEM_freeN(adt);
@ -334,7 +334,7 @@ void BKE_animdata_make_local(AnimData *adt)
if (adt->remap && adt->remap->target) BKE_action_make_local(adt->remap->target);
/* Drivers */
// TODO: need to remap the ID-targets too?
/* TODO: need to remap the ID-targets too? */
/* NLA Data */
for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next)
@ -506,7 +506,7 @@ void BKE_animdata_separate_by_basepath(ID *srcID, ID *dstID, ListBase *basepaths
printf("Argh! Source and Destination share animation! ('%s' and '%s' both use '%s') Making new empty action\n",
srcID->name, dstID->name, srcAdt->action->id.name);
// TODO: review this...
/* TODO: review this... */
id_us_min(&dstAdt->action->id);
dstAdt->action = add_empty_action(dstAdt->action->id.name + 2);
}
@ -535,7 +535,7 @@ void BKE_animdata_separate_by_basepath(ID *srcID, ID *dstID, ListBase *basepaths
BLI_remlink(&srcAdt->drivers, fcu);
BLI_addtail(&dstAdt->drivers, fcu);
// TODO: add depsgraph flushing calls?
/* TODO: add depsgraph flushing calls? */
/* can stop now, as moved already */
break;
@ -603,7 +603,7 @@ static char *rna_path_rename_fix(ID *owner_id, const char *prefix, const char *o
BLI_dynstr_free(ds);
/* check if the new path will solve our problems */
// TODO: will need to check whether this step really helps in practice
/* TODO: will need to check whether this step really helps in practice */
if (!verify_paths || check_rna_path_is_valid(owner_id, newPath)) {
/* free the old path, and return the new one, since we've solved the issues */
MEM_freeN(oldpath);
@ -907,7 +907,7 @@ void BKE_all_animdata_fix_paths_rename(ID *ref_id, const char *prefix, const cha
/* Finding Tools --------------------------- */
/* Find the first path that matches the given criteria */
// TODO: do we want some method to perform partial matches too?
/* TODO: do we want some method to perform partial matches too? */
KS_Path *BKE_keyingset_find_path(KeyingSet *ks, ID *id, const char group_name[], const char rna_path[], int array_index, int UNUSED(group_mode))
{
KS_Path *ksp;
@ -936,7 +936,7 @@ KS_Path *BKE_keyingset_find_path(KeyingSet *ks, ID *id, const char group_name[],
/* group */
if (group_name) {
// FIXME: these checks need to be coded... for now, it's not too important though
/* FIXME: these checks need to be coded... for now, it's not too important though */
}
/* if all aspects are ok, return */
@ -1019,7 +1019,7 @@ KS_Path *BKE_keyingset_add_path(KeyingSet *ks, ID *id, const char group_name[],
ksp->idtype = GS(id->name);
/* just copy path info */
// TODO: should array index be checked too?
/* TODO: should array index be checked too? */
ksp->rna_path = BLI_strdupn(rna_path, strlen(rna_path));
ksp->array_index = array_index;
@ -1116,10 +1116,12 @@ void BKE_keyingsets_free(ListBase *list)
static short animsys_remap_path(AnimMapper *UNUSED(remap), char *path, char **dst)
{
/* is there a valid remapping table to use? */
//if (remap) {
#if 0
if (remap) {
/* find a matching entry... to use to remap */
// ...TODO...
//}
/* ...TODO... */
}
#endif
/* nothing suitable found, so just set dst to look at path (i.e. no alloc/free needed) */
*dst = path;
@ -1216,8 +1218,8 @@ static short animsys_write_rna_setting(PointerRNA *ptr, char *path, int array_in
}
else {
/* failed to get path */
// XXX don't tag as failed yet though, as there are some legit situations (Action Constraint)
// where some channels will not exist, but shouldn't lock up Action
/* XXX don't tag as failed yet though, as there are some legit situations (Action Constraint)
* where some channels will not exist, but shouldn't lock up Action */
if (G.debug & G_DEBUG) {
printf("Animato: Invalid path. ID = '%s', '%s[%d]'\n",
(ptr && ptr->id.data) ? (((ID *)ptr->id.data)->name + 2) : "<No ID>",
@ -1429,7 +1431,7 @@ static void nlastrip_evaluate_controls(NlaStrip *strip, float ctime)
* to lie within extents of the action-clip, so that a steady changing rate of progress through several cycles of the clip
* can be achieved easily
*/
// NOTE: if we add any more of these special cases, we better group them up nicely...
/* NOTE: if we add any more of these special cases, we better group them up nicely... */
if ((strip->flag & NLASTRIP_FLAG_USR_TIME) && (strip->flag & NLASTRIP_FLAG_USR_TIME_CYCLIC))
strip->strip_time = fmod(strip->strip_time - strip->actstart, strip->actend - strip->actstart);
}
@ -1511,7 +1513,7 @@ NlaEvalStrip *nlastrips_ctime_get_strip(ListBase *list, ListBase *strips, short
* - skip if no influence (i.e. same effect as muting the strip)
* - negative influence is not supported yet... how would that be defined?
*/
// TODO: this sounds a bit hacky having a few isolated F-Curves stuck on some data it operates on...
/* TODO: this sounds a bit hacky having a few isolated F-Curves stuck on some data it operates on... */
nlastrip_evaluate_controls(estrip, ctime);
if (estrip->influence <= 0.0f)
return NULL;
@ -1668,7 +1670,7 @@ static void nlaevalchan_accumulate(NlaEvalChannel *nec, NlaEvalStrip *nes, short
break;
case NLASTRIP_MODE_REPLACE:
default: // TODO: do we really want to blend by default? it seems more uses might prefer add...
default: /* TODO: do we really want to blend by default? it seems more uses might prefer add... */
/* do linear interpolation
* - the influence of the accumulated data (elsewhere, that is called dstweight)
* is 1 - influence, since the strip's influence is srcweight
@ -1864,7 +1866,7 @@ static void nlastrip_evaluate_transition(PointerRNA *ptr, ListBase *channels, Li
tmp_nes = *nes;
/* evaluate these strips into a temp-buffer (tmp_channels) */
// FIXME: modifier evalation here needs some work...
/* FIXME: modifier evalation here needs some work... */
/* first strip */
tmp_nes.strip_mode = NES_TIME_TRANSITION_START;
tmp_nes.strip = s1;
@ -1932,7 +1934,7 @@ void nlastrip_evaluate(PointerRNA *ptr, ListBase *channels, ListBase *modifiers,
/* to prevent potential infinite recursion problems (i.e. transition strip, beside meta strip containing a transition
* several levels deep inside it), we tag the current strip as being evaluated, and clear this when we leave
*/
// TODO: be careful with this flag, since some edit tools may be running and have set this while animplayback was running
/* TODO: be careful with this flag, since some edit tools may be running and have set this while animplayback was running */
if (strip->flag & NLASTRIP_FLAG_EDIT_TOUCHED)
return;
strip->flag |= NLASTRIP_FLAG_EDIT_TOUCHED;
@ -1997,7 +1999,7 @@ void nladata_flush_channels(ListBase *channels)
RNA_property_enum_set(ptr, prop, (int)value);
break;
default:
// can't do anything with other types of property....
/* can't do anything with other types of property.... */
break;
}
}
@ -2081,7 +2083,7 @@ static void animsys_evaluate_nla(ListBase *echannels, PointerRNA *ptr, AnimData
}
else {
/* special case - evaluate as if there isn't any NLA data */
// TODO: this is really just a stop-gap measure...
/* TODO: this is really just a stop-gap measure... */
animsys_evaluate_action(ptr, adt->action, adt->remap, ctime);
return;
}
@ -2108,8 +2110,8 @@ static void animsys_calculate_nla(PointerRNA *ptr, AnimData *adt, float ctime)
{
ListBase echannels = {NULL, NULL};
// TODO: need to zero out all channels used, otherwise we have problems with threadsafety
// and also when the user jumps between different times instead of moving sequentially...
/* TODO: need to zero out all channels used, otherwise we have problems with threadsafety
* and also when the user jumps between different times instead of moving sequentially... */
/* evaluate the NLA stack, obtaining a set of values to flush */
animsys_evaluate_nla(&echannels, ptr, adt, ctime);
@ -2130,7 +2132,7 @@ static void animsys_calculate_nla(PointerRNA *ptr, AnimData *adt, float ctime)
#if 0
AnimOverride *BKE_animsys_validate_override(PointerRNA *UNUSED(ptr), char *UNUSED(path), int UNUSED(array_index))
{
// FIXME: need to define how to get overrides
/* FIXME: need to define how to get overrides */
return NULL;
}
#endif
@ -2202,7 +2204,7 @@ void BKE_animsys_evaluate_animdata(Scene *scene, ID *id, AnimData *adt, float ct
* - NLA before Active Action, as Active Action behaves as 'tweaking track'
* that overrides 'rough' work in NLA
*/
// TODO: need to double check that this all works correctly
/* TODO: need to double check that this all works correctly */
if ((recalc & ADT_RECALC_ANIM) || (adt->recalc & ADT_RECALC_ANIM)) {
/* evaluate NLA data */
if ((adt->nla_tracks.first) && !(adt->flag & ADT_NLA_EVAL_OFF)) {

@ -2049,7 +2049,8 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o
cross_v3_v3v3(raxis, rmat[1], splineVec);
rangle = dot_v3v3(rmat[1], splineVec);
rangle = acos(MAX2(-1.0f, MIN2(1.0f, rangle)));
CLAMP(rangle, -1.0f, 1.0f);
rangle = acosf(rangle);
/* multiply the magnitude of the angle by the influence of the constraint to
* control the influence of the SplineIK effect

@ -303,8 +303,8 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
//setscreen(G.curscreen);
}
// FIXME: this version patching should really be part of the file-reading code,
// but we still get too many unrelated data-corruption crashes otherwise...
/* FIXME: this version patching should really be part of the file-reading code,
* but we still get too many unrelated data-corruption crashes otherwise... */
if (G.main->versionfile < 250)
do_versions_ipos_to_animato(G.main);

@ -96,9 +96,9 @@ void readBitmapFontVersion0(ImBuf * ibuf, unsigned char * rect, int step)
ysize = (bytes + (ibuf->x - 1)) / ibuf->x;
if (ysize < ibuf->y) {
// we're first going to copy all data into a liniar buffer.
// step can be 4 or 1 bytes, and the data is not sequential because
// the bitmap was flipped vertically.
/* we're first going to copy all data into a liniar buffer.
* step can be 4 or 1 bytes, and the data is not sequential because
* the bitmap was flipped vertically. */
buffer = MEM_mallocN(bytes, "readBitmapFontVersion0:buffer");
@ -107,18 +107,18 @@ void readBitmapFontVersion0(ImBuf * ibuf, unsigned char * rect, int step)
buffer[i] = rect[index];
index += step;
if (index >= linelength) {
// we've read one line, no skip to the line *before* that
/* we've read one line, no skip to the line *before* that */
rect -= linelength;
index -= linelength;
}
}
// we're now going to endian convert the data
/* we're now going to endian convert the data */
bmfont = MEM_mallocN(bytes, "readBitmapFontVersion0:bmfont");
index = 0;
// first read the header
/* first read the header */
bmfont->magic[0] = buffer[index++];
bmfont->magic[1] = buffer[index++];
bmfont->magic[2] = buffer[index++];
@ -151,16 +151,16 @@ void readBitmapFontVersion0(ImBuf * ibuf, unsigned char * rect, int step)
printf("bytes = %d\n", bytes);
}
// we've read the data from the image. Now we're going
// to crop the image vertically so only the bitmap data
// remains visible
/* we've read the data from the image. Now we're going
* to crop the image vertically so only the bitmap data
* remains visible */
ibuf->y -= ysize;
ibuf->userdata = bmfont;
ibuf->userflags |= IB_BITMAPFONT;
if (ibuf->planes < 32) {
// we're going to fake alpha here:
/* we're going to fake alpha here: */
calcAlpha(ibuf);
}
}
@ -176,21 +176,21 @@ void detectBitmapFont(ImBuf *ibuf)
int i;
if (ibuf != NULL && ibuf->rect != NULL) {
// bitmap must have an x size that is a power of two
/* bitmap must have an x size that is a power of two */
if (is_power_of_two(ibuf->x)) {
rect = (unsigned char *) (ibuf->rect + (ibuf->x * (ibuf->y - 1)));
// printf ("starts with: %s %c %c %c %c\n", rect, rect[0], rect[1], rect[2], rect[3]);
/* printf ("starts with: %s %c %c %c %c\n", rect, rect[0], rect[1], rect[2], rect[3]); */
if (rect[0] == 'B' && rect[1] == 'F' && rect[2] == 'N' && rect[3] == 'T') {
// printf("found 8bit font !\n");
// round y size down
// do the 8 bit font stuff. (not yet)
/* printf("found 8bit font !\n");
* round y size down
* do the 8 bit font stuff. (not yet) */
}
else {
// we try all 4 possible combinations
/* we try all 4 possible combinations */
for (i = 0; i < 4; i++) {
if (rect[0] == 'B' && rect[4] == 'F' && rect[8] == 'N' && rect[12] == 'T') {
// printf("found 24bit font !\n");
// We're going to parse the file:
/* printf("found 24bit font !\n");
* We're going to parse the file: */
version = (rect[16] << 8) | rect[20];
@ -201,7 +201,7 @@ void detectBitmapFont(ImBuf *ibuf)
printf("detectBitmapFont :Unsupported version %d\n", version);
}
// on succes ibuf->userdata points to the bitmapfont
/* on succes ibuf->userdata points to the bitmapfont */
if (ibuf->userdata) {
break;
}
@ -221,23 +221,23 @@ int locateGlyph(bmFont *bmfont, unsigned short unicode)
min = 0;
max = bmfont->glyphcount;
while (1) {
// look halfway for glyph
/* look halfway for glyph */
current = (min + max) >> 1;
if (bmfont->glyphs[current].unicode == unicode) {
break;
}
else if (bmfont->glyphs[current].unicode < unicode) {
// have to move up
/* have to move up */
min = current;
}
else {
// have to move down
/* have to move down */
max = current;
}
if (max - min <= 1) {
// unable to locate glyph
/* unable to locate glyph */
current = 0;
break;
}
@ -278,7 +278,7 @@ void matrixGlyph(ImBuf * ibuf, unsigned short unicode,
*centerx = bmfont->glyphs[0].locx / (float) ibuf->x;
*centery = (ibuf->y - bmfont->glyphs[0].locy) / (float) ibuf->y;
// 2.0 units is the default size of an object
/* 2.0 units is the default size of an object */
*movey = 1.0f - *sizey + 2.0f * (bmfont->glyphs[index].ofsy - bmfont->glyphs[0].ofsy) / (float) bmfont->glyphs[0].sizey;
*movex = *sizex - 1.0f + 2.0f * (bmfont->glyphs[index].ofsx - bmfont->glyphs[0].ofsx) / (float) bmfont->glyphs[0].sizex;

@ -44,18 +44,18 @@
CSG_DestroyMeshDescriptor(
CSG_MeshDescriptor *mesh
) {
// Call mesh descriptors destroy function....
/* Call mesh descriptors destroy function.... */
mesh->m_destroy_func(mesh);
}
// Destroy function for blender mesh internals.
/* Destroy function for blender mesh internals. */
static
void
CSG_DestroyBlenderMeshInternals(
CSG_MeshDescriptor *mesh
) {
// Free face and vertex iterators.
/* Free face and vertex iterators. */
FreeMeshDescriptors(&(mesh->m_face_iterator),&(mesh->m_vertex_iterator));
}
@ -140,18 +140,18 @@ CSG_AddMeshToBlender(
invert_m4_m4(inv_mat,mesh->base->object->obmat);
// Create a new blender mesh object - using 'base' as
// a template for the new object.
/* Create a new blender mesh object - using 'base' as
* a template for the new object. */
ob_new= AddNewBlenderMesh(mesh->base);
me_new = ob_new->data;
// make sure the iterators are reset.
/* make sure the iterators are reset. */
mesh->m_face_iterator.Reset(mesh->m_face_iterator.it);
mesh->m_vertex_iterator.Reset(mesh->m_vertex_iterator.it);
// iterate through results of operation and insert into new object
// see subsurf.c
/* iterate through results of operation and insert into new object
* see subsurf.c */
ConvertCSGDescriptorsToMeshObject(
ob_new,
@ -195,7 +195,7 @@ CSG_PerformOp(
output->base = mesh1->base;
if (output->m_descriptor.user_face_vertex_data_size) {
// Then use the only interp function supported
/* Then use the only interp function supported */
success =
CSG_PerformBooleanOperation(
bool_op,
@ -226,7 +226,7 @@ CSG_PerformOp(
return 0;
}
// get the ouput mesh descriptors.
/* get the ouput mesh descriptors. */
CSG_OutputFaceDescriptor(bool_op,&(output->m_face_iterator));
CSG_OutputVertexDescriptor(bool_op,&(output->m_vertex_iterator));

@ -1074,7 +1074,7 @@ void BKE_brush_jitter_pos(const Scene *scene, Brush *brush, const float pos[2],
const int radius = BKE_brush_size_get(scene, brush);
const int diameter = 2 * radius;
// find random position within a circle of diameter 1
/* find random position within a circle of diameter 1 */
do {
rand_pos[0] = BLI_frand() - 0.5f;
rand_pos[1] = BLI_frand() - 0.5f;

@ -330,7 +330,7 @@ float nearest_point_in_tri_surface(const float v0[3], const float v1[3], const f
}
}
// Account for numerical round-off error
/* Account for numerical round-off error */
if (sqrDist < FLT_EPSILON)
sqrDist = 0.0f;

@ -224,14 +224,14 @@ static BVHTree *bvhtree_build_from_cloth (ClothModifierData *clmd, float epsilon
verts = cloth->verts;
mfaces = cloth->mfaces;
// in the moment, return zero if no faces there
/* in the moment, return zero if no faces there */
if (!cloth->numfaces)
return NULL;
// create quadtree with k=26
/* create quadtree with k=26 */
bvhtree = BLI_bvhtree_new(cloth->numfaces, epsilon, 4, 26);
// fill tree
/* fill tree */
for (i = 0; i < cloth->numfaces; i++, mfaces++) {
copy_v3_v3(&co[0*3], verts[mfaces->v1].xold);
copy_v3_v3(&co[1*3], verts[mfaces->v2].xold);
@ -243,7 +243,7 @@ static BVHTree *bvhtree_build_from_cloth (ClothModifierData *clmd, float epsilon
BLI_bvhtree_insert(bvhtree, i, co, (mfaces->v4 ? 4 : 3));
}
// balance tree
/* balance tree */
BLI_bvhtree_balance(bvhtree);
return bvhtree;

@ -226,69 +226,69 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM
zero_v3(i2);
zero_v3(i3);
// only handle static collisions here
/* only handle static collisions here */
if ( collpair->flag & COLLISION_IN_FUTURE )
continue;
// compute barycentric coordinates for both collision points
/* compute barycentric coordinates for both collision points */
collision_compute_barycentric ( collpair->pa,
cloth1->verts[collpair->ap1].txold,
cloth1->verts[collpair->ap2].txold,
cloth1->verts[collpair->ap3].txold,
&w1, &w2, &w3 );
// was: txold
/* was: txold */
collision_compute_barycentric ( collpair->pb,
collmd->current_x[collpair->bp1].co,
collmd->current_x[collpair->bp2].co,
collmd->current_x[collpair->bp3].co,
&u1, &u2, &u3 );
// Calculate relative "velocity".
/* Calculate relative "velocity". */
collision_interpolateOnTriangle ( v1, cloth1->verts[collpair->ap1].tv, cloth1->verts[collpair->ap2].tv, cloth1->verts[collpair->ap3].tv, w1, w2, w3 );
collision_interpolateOnTriangle ( v2, collmd->current_v[collpair->bp1].co, collmd->current_v[collpair->bp2].co, collmd->current_v[collpair->bp3].co, u1, u2, u3 );
sub_v3_v3v3(relativeVelocity, v2, v1);
// Calculate the normal component of the relative velocity (actually only the magnitude - the direction is stored in 'normal').
/* Calculate the normal component of the relative velocity (actually only the magnitude - the direction is stored in 'normal'). */
magrelVel = dot_v3v3(relativeVelocity, collpair->normal);
// printf("magrelVel: %f\n", magrelVel);
/* printf("magrelVel: %f\n", magrelVel); */
// Calculate masses of points.
// TODO
/* Calculate masses of points.
* TODO */
// If v_n_mag < 0 the edges are approaching each other.
/* If v_n_mag < 0 the edges are approaching each other. */
if ( magrelVel > ALMOST_ZERO ) {
// Calculate Impulse magnitude to stop all motion in normal direction.
/* Calculate Impulse magnitude to stop all motion in normal direction. */
float magtangent = 0, repulse = 0, d = 0;
double impulse = 0.0;
float vrel_t_pre[3];
float temp[3], spf;
// calculate tangential velocity
/* calculate tangential velocity */
copy_v3_v3 ( temp, collpair->normal );
mul_v3_fl(temp, magrelVel);
sub_v3_v3v3(vrel_t_pre, relativeVelocity, temp);
// Decrease in magnitude of relative tangential velocity due to coulomb friction
// in original formula "magrelVel" should be the "change of relative velocity in normal direction"
magtangent = MIN2(clmd->coll_parms->friction * 0.01f * magrelVel, sqrtf(dot_v3v3(vrel_t_pre, vrel_t_pre)));
/* Decrease in magnitude of relative tangential velocity due to coulomb friction
* in original formula "magrelVel" should be the "change of relative velocity in normal direction" */
magtangent = minf(clmd->coll_parms->friction * 0.01f * magrelVel, sqrtf(dot_v3v3(vrel_t_pre, vrel_t_pre)));
// Apply friction impulse.
/* Apply friction impulse. */
if ( magtangent > ALMOST_ZERO ) {
normalize_v3(vrel_t_pre);
impulse = magtangent / ( 1.0f + w1*w1 + w2*w2 + w3*w3 ); // 2.0 *
impulse = magtangent / ( 1.0f + w1*w1 + w2*w2 + w3*w3 ); /* 2.0 * */
VECADDMUL ( i1, vrel_t_pre, w1 * impulse );
VECADDMUL ( i2, vrel_t_pre, w2 * impulse );
VECADDMUL ( i3, vrel_t_pre, w3 * impulse );
}
// Apply velocity stopping impulse
// I_c = m * v_N / 2.0
// no 2.0 * magrelVel normally, but looks nicer DG
/* Apply velocity stopping impulse
* I_c = m * v_N / 2.0
* no 2.0 * magrelVel normally, but looks nicer DG */
impulse = magrelVel / ( 1.0 + w1*w1 + w2*w2 + w3*w3 );
VECADDMUL ( i1, collpair->normal, w1 * impulse );
@ -300,24 +300,24 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM
VECADDMUL ( i3, collpair->normal, w3 * impulse );
cloth1->verts[collpair->ap3].impulse_count++;
// Apply repulse impulse if distance too short
// I_r = -min(dt*kd, m(0, 1d/dt - v_n))
// DG: this formula ineeds to be changed for this code since we apply impulses/repulses like this:
// v += impulse; x_new = x + v;
// We don't use dt!!
// DG TODO: Fix usage of dt here!
/* Apply repulse impulse if distance too short
* I_r = -min(dt*kd, m(0, 1d/dt - v_n))
* DG: this formula ineeds to be changed for this code since we apply impulses/repulses like this:
* v += impulse; x_new = x + v;
* We don't use dt!!
* DG TODO: Fix usage of dt here! */
spf = (float)clmd->sim_parms->stepsPerFrame / clmd->sim_parms->timescale;
d = clmd->coll_parms->epsilon*8.0f/9.0f + epsilon2*8.0f/9.0f - collpair->distance;
if ( ( magrelVel < 0.1f*d*spf ) && ( d > ALMOST_ZERO ) ) {
repulse = MIN2 ( d*1.0f/spf, 0.1f*d*spf - magrelVel );
// stay on the safe side and clamp repulse
/* stay on the safe side and clamp repulse */
if ( impulse > ALMOST_ZERO )
repulse = MIN2 ( repulse, 5.0*impulse );
repulse = MAX2 ( impulse, repulse );
impulse = repulse / ( 1.0f + w1*w1 + w2*w2 + w3*w3 ); // original 2.0 / 0.25
impulse = repulse / ( 1.0f + w1*w1 + w2*w2 + w3*w3 ); /* original 2.0 / 0.25 */
VECADDMUL ( i1, collpair->normal, impulse );
VECADDMUL ( i2, collpair->normal, impulse );
VECADDMUL ( i3, collpair->normal, impulse );
@ -326,19 +326,19 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM
result = 1;
}
else {
// Apply repulse impulse if distance too short
// I_r = -min(dt*kd, max(0, 1d/dt - v_n))
// DG: this formula ineeds to be changed for this code since we apply impulses/repulses like this:
// v += impulse; x_new = x + v;
// We don't use dt!!
/* Apply repulse impulse if distance too short
* I_r = -min(dt*kd, max(0, 1d/dt - v_n))
* DG: this formula ineeds to be changed for this code since we apply impulses/repulses like this:
* v += impulse; x_new = x + v;
* We don't use dt!! */
float spf = (float)clmd->sim_parms->stepsPerFrame / clmd->sim_parms->timescale;
float d = clmd->coll_parms->epsilon*8.0f/9.0f + epsilon2*8.0f/9.0f - collpair->distance;
if ( d > ALMOST_ZERO) {
// stay on the safe side and clamp repulse
/* stay on the safe side and clamp repulse */
float repulse = d*1.0f/spf;
float impulse = repulse / ( 3.0 * ( 1.0f + w1*w1 + w2*w2 + w3*w3 )); // original 2.0 / 0.25
float impulse = repulse / ( 3.0 * ( 1.0f + w1*w1 + w2*w2 + w3*w3 )); /* original 2.0 / 0.25 */
VECADDMUL ( i1, collpair->normal, impulse );
VECADDMUL ( i2, collpair->normal, impulse );
@ -805,7 +805,7 @@ int cloth_bvh_objcollision(Object *ob, ClothModifierData * clmd, float step, flo
////////////////////////////////////////////////////////////
if ( clmd->coll_parms->flags & CLOTH_COLLSETTINGS_FLAG_SELF ) {
for (l = 0; l < (unsigned int)clmd->coll_parms->self_loop_count; l++) {
// TODO: add coll quality rounds again
/* TODO: add coll quality rounds again */
BVHTreeOverlap *overlap = NULL;
unsigned int result = 0;

@ -1316,7 +1316,7 @@ static void followpath_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *
bFollowPathConstraint *data = con->data;
/* get Object transform (loc/rot/size) to determine transformation from path */
// TODO: this used to be local at one point, but is probably more useful as-is
/* TODO: this used to be local at one point, but is probably more useful as-is */
copy_m4_m4(obmat, cob->matrix);
/* get scaling of object before applying constraint */
@ -2163,7 +2163,7 @@ static void actcon_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstraintT
Object workob;
/* evaluate using workob */
// FIXME: we don't have any consistent standards on limiting effects on object...
/* FIXME: we don't have any consistent standards on limiting effects on object... */
what_does_obaction(cob->ob, &workob, NULL, data->act, NULL, t);
BKE_object_to_mat4(&workob, ct->matrix);
}
@ -2623,7 +2623,7 @@ static void distlimit_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
}
/* if soft-distance is enabled, start fading once owner is dist-soft from the target */
else if (data->flag & LIMITDIST_USESOFT) {
// FIXME: there's a problem with "jumping" when this kicks in
/* FIXME: there's a problem with "jumping" when this kicks in */
if (dist >= (data->dist - data->soft)) {
sfac = (float)(data->soft * (1.0f - expf(-(dist - data->dist) / data->soft)) + data->dist);
if (dist != 0.0f) sfac /= dist;
@ -2989,7 +2989,7 @@ static void rbj_new_data(void *cdata)
{
bRigidBodyJointConstraint *data = (bRigidBodyJointConstraint *)cdata;
// removed code which set target of this constraint
/* removed code which set target of this constraint */
data->type = 1;
}
@ -3608,7 +3608,7 @@ static void damptrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
if (normalize_v3(tarvec) == 0.0f) {
/* the target is sitting on the owner, so just make them use the same direction vectors */
// FIXME: or would it be better to use the pure direction vector?
/* FIXME: or would it be better to use the pure direction vector? */
copy_v3_v3(tarvec, obvec);
//copy_v3_v3(tarvec, track_dir_vecs[data->trackflag]);
}
@ -3839,7 +3839,7 @@ static void pivotcon_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *ta
}
/* get rotation matrix representing the rotation of the owner */
// TODO: perhaps we might want to include scaling based on the pivot too?
/* TODO: perhaps we might want to include scaling based on the pivot too? */
copy_m3_m4(rotMat, cob->matrix);
normalize_m3(rotMat);
@ -4395,7 +4395,7 @@ static bConstraint *add_new_constraint_internal(const char *name, short type)
}
else {
/* if no name is provided, use the generic "Const" name */
// NOTE: any constraint type that gets here really shouldn't get added...
/* NOTE: any constraint type that gets here really shouldn't get added... */
newName = (name && name[0]) ? name : "Const";
}
@ -4437,7 +4437,7 @@ static bConstraint *add_new_constraint(Object *ob, bPoseChannel *pchan, const ch
}
/* set type+owner specific immutable settings */
// TODO: does action constraint need anything here - i.e. spaceonce?
/* TODO: does action constraint need anything here - i.e. spaceonce? */
switch (type) {
case CONSTRAINT_TYPE_CHILDOF:
{

@ -337,12 +337,12 @@ static void layerSwap_tface(void *data, const int *corner_indices)
copy_v2_v2(uv[j], tf->uv[source_index]);
// swap pinning flags around
/* swap pinning flags around */
if (tf->unwrap & pin_flags[source_index]) {
unwrap |= pin_flags[j];
}
// swap selection flags around
/* swap selection flags around */
if (tf->flag & sel_flags[source_index]) {
flag |= sel_flags[j];
}

@ -320,7 +320,7 @@ static void dag_add_driver_relation(AnimData *adt, DagForest *dag, DagNode *node
DRIVER_TARGETS_USED_LOOPER(dvar)
{
if (dtar->id) {
// FIXME: other data types need to be added here so that they can work!
/* FIXME: other data types need to be added here so that they can work! */
if (GS(dtar->id->name) == ID_OB) {
Object *ob = (Object *)dtar->id;
@ -399,8 +399,8 @@ static void dag_add_collision_field_relation(DagForest *dag, Scene *scene, Objec
Base *base;
DagNode *node2;
// would be nice to have a list of colliders here
// so for now walk all objects in scene check 'same layer rule'
/* would be nice to have a list of colliders here
* so for now walk all objects in scene check 'same layer rule' */
for (base = scene->base.first; base; base = base->next) {
if ((base->lay & ob->lay) && base->object->pd) {
Object *ob1 = base->object;
@ -858,7 +858,7 @@ DagForest *build_dag(Main *bmain, Scene *sce, short mask)
}
}
// cycle detection and solving
/* cycle detection and solving */
// solve_cycles(dag);
return dag;
@ -1567,7 +1567,7 @@ DagNodeQueue *get_first_ancestors(struct DagForest *dag, void *ob)
node = dag_find_node(dag, ob);
// need to go over the whole dag for adj list
/* need to go over the whole dag for adj list */
nqueue = queue_create(node->ancestor_count);
node1 = dag->DagNode.first;
@ -2205,8 +2205,8 @@ static int object_modifiers_use_time(Object *ob)
return 1;
}
// XXX: also, should check NLA strips, though for now assume that nobody uses
// that and we can omit that for performance reasons...
/* XXX: also, should check NLA strips, though for now assume that nobody uses
* that and we can omit that for performance reasons... */
}
return 0;

@ -1386,17 +1386,18 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
ListBase top_capbase = {NULL, NULL};
for (dlb = dlbev.first; dlb; dlb = dlb->next) {
int i, start, steps;
float bevfac1 = MIN2(cu->bevfac1, cu->bevfac2), bevfac2 = MAX2(cu->bevfac1, cu->bevfac2);
const float bevfac1 = minf(cu->bevfac1, cu->bevfac2);
const float bevfac2 = maxf(cu->bevfac1, cu->bevfac2);
float firstblend = 0.0f, lastblend = 0.0f;
int i, start, steps;
if (cu->bevfac1 - cu->bevfac2 == 0.0f)
if (bevfac2 - bevfac1 == 0.0f)
continue;
start = (int)(bevfac1 * (bl->nr - 1));
steps = 2 + (int)((bevfac2) * (bl->nr - 1)) - start;
firstblend = 1.0f - ((float)bevfac1 * (bl->nr - 1) - (int)((float)bevfac1 * (bl->nr - 1)));
lastblend = (float)bevfac2 * (bl->nr - 1) - (int)((float)bevfac2 * (bl->nr - 1));
firstblend = 1.0f - (bevfac1 * (bl->nr - 1) - (int)(bevfac1 * (bl->nr - 1)));
lastblend = bevfac2 * (bl->nr - 1) - (int)(bevfac2 * (bl->nr - 1));
if (steps > bl->nr) {
steps = bl->nr;

@ -3417,7 +3417,9 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface,
sampleStrength *= sample_factor;
}
else continue;
else {
continue;
}
/* velocity brush, only do on main sample */
if (brush->flags & MOD_DPAINT_USES_VELOCITY && ss == 0 && brushVelocity) {

@ -393,7 +393,7 @@ void pd_point_from_soft(Scene *scene, float *loc, float *vel, int index, Effecte
// triangle - ray callback function
static void eff_tri_ray_hit(void *UNUSED(userData), int UNUSED(index), const BVHTreeRay *UNUSED(ray), BVHTreeRayHit *hit)
{
// whenever we hit a bounding box, we don't check further
/* whenever we hit a bounding box, we don't check further */
hit->dist = -1;
hit->index = 1;
}
@ -418,7 +418,7 @@ static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, Effect
negate_v3_v3(norm, efd->vec_to_point);
len = normalize_v3(norm);
// check all collision objects
/* check all collision objects */
for (col = colls->first; col; col = col->next) {
CollisionModifierData *collmd = col->collmd;
@ -431,11 +431,11 @@ static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, Effect
hit.index = -1;
hit.dist = len + FLT_EPSILON;
// check if the way is blocked
/* check if the way is blocked */
if (BLI_bvhtree_ray_cast(collmd->bvhtree, point->loc, norm, 0.0f, &hit, eff_tri_ray_hit, NULL)>=0) {
absorption= col->ob->pd->absorption;
// visibility is only between 0 and 1, calculated from 1-absorption
/* visibility is only between 0 and 1, calculated from 1-absorption */
visibility *= CLAMPIS(1.0f-absorption, 0.0f, 1.0f);
if (visibility <= 0.0f)
@ -1006,7 +1006,7 @@ void pdDoEffectors(ListBase *effectors, ListBase *colliders, EffectorWeights *we
do_physical_effector(eff, &efd, point, force);
// for softbody backward compatibility
/* for softbody backward compatibility */
if (point->flag & PE_WIND_AS_SPEED && impulse) {
sub_v3_v3v3(temp2, force, temp1);
sub_v3_v3v3(impulse, impulse, temp2);

@ -422,7 +422,7 @@ int binarysearch_bezt_index(BezTriple array[], float frame, int arraylen, short
if (loopbreaker == (maxloop - 1)) {
printf("Error: binarysearch_bezt_index() was taking too long\n");
// include debug info
/* include debug info */
printf("\tround = %d: start = %d, end = %d, arraylen = %d\n", loopbreaker, start, end, arraylen);
}
@ -636,7 +636,7 @@ short fcurve_are_keyframes_usable(FCurve *fcu)
FModifier *fcm;
/* check modifiers from last to first, as last will be more influential */
// TODO: optionally, only check modifier if it is the active one...
/* TODO: optionally, only check modifier if it is the active one... */
for (fcm = fcu->modifiers.last; fcm; fcm = fcm->prev) {
/* ignore if muted/disabled */
if (fcm->flag & (FMODIFIER_FLAG_DISABLED | FMODIFIER_FLAG_MUTED))
@ -748,7 +748,7 @@ void fcurve_store_samples(FCurve *fcu, void *data, int start, int end, FcuSample
int cfra;
/* sanity checks */
// TODO: make these tests report errors using reports not printf's
/* TODO: make these tests report errors using reports not printf's */
if (ELEM(NULL, fcu, sample_cb)) {
printf("Error: No F-Curve with F-Curve Modifiers to Bake\n");
return;
@ -1018,7 +1018,7 @@ static float dtar_get_prop_val(ChannelDriver *driver, DriverTarget *dtar)
id = dtar_id_ensure_proxy_from(dtar->id);
/* error check for missing pointer... */
// TODO: tag the specific target too as having issues
/* TODO: tag the specific target too as having issues */
if (id == NULL) {
printf("Error: driver has an invalid target to use\n");
if (G.debug & G_DEBUG) printf("\tpath = %s\n", dtar->rna_path);
@ -1152,14 +1152,14 @@ static float dvar_eval_rotDiff(ChannelDriver *driver, DriverVar *dvar)
}
/* evaluate 'location difference' driver variable */
// TODO: this needs to take into account space conversions...
/* TODO: this needs to take into account space conversions... */
static float dvar_eval_locDiff(ChannelDriver *driver, DriverVar *dvar)
{
float loc1[3] = {0.0f, 0.0f, 0.0f};
float loc2[3] = {0.0f, 0.0f, 0.0f};
/* get two location values */
// NOTE: for now, these are all just worldspace
/* NOTE: for now, these are all just worldspace */
DRIVER_TARGETS_USED_LOOPER(dvar)
{
/* get pointer to loc values to store in */
@ -1206,7 +1206,7 @@ static float dvar_eval_locDiff(ChannelDriver *driver, DriverVar *dvar)
/* object */
if (dtar->flag & DTAR_FLAG_LOCALSPACE) {
if (dtar->flag & DTAR_FLAG_LOCAL_CONSTS) {
// XXX: this should practically be the same as transform space...
/* XXX: this should practically be the same as transform space... */
float mat[4][4];
/* extract transform just like how the constraints do it! */
@ -1796,7 +1796,7 @@ static int findzero(float x, float q0, float q1, float q2, float q3, float *o)
c = c0;
if (a != 0.0) {
// discriminant
/* discriminant */
p = b * b - 4 * a * c;
if (p > 0) {

@ -433,7 +433,7 @@ static void fcm_envelope_verify(FModifier *fcm)
/* if the are points, perform bubble-sort on them, as user may have changed the order */
if (env->data) {
// XXX todo...
/* XXX todo... */
}
}
@ -463,7 +463,7 @@ static void fcm_envelope_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float *cv
}
else {
/* evaltime occurs somewhere between segments */
// TODO: implement binary search for this to make it faster?
/* TODO: implement binary search for this to make it faster? */
for (a = 0; prevfed && fed && (a < env->totvert - 1); a++, prevfed = fed, fed++) {
/* evaltime occurs within the interval defined by these two envelope points */
if ((prevfed->time <= evaltime) && (fed->time >= evaltime)) {
@ -539,7 +539,7 @@ static float fcm_cycles_time(FCurve *fcu, FModifier *fcm, float UNUSED(cvalue),
int cycles = 0, ofs = 0;
/* check if modifier is first in stack, otherwise disable ourself... */
// FIXME...
/* FIXME... */
if (fcm->prev) {
fcm->flag |= FMODIFIER_FLAG_DISABLED;
return evaltime;
@ -883,7 +883,7 @@ static void fcm_stepped_new_data(void *mdata)
FMod_Stepped *data = (FMod_Stepped *)mdata;
/* just need to set the step-size to 2-frames by default */
// XXX: or would 5 be more normal?
/* XXX: or would 5 be more normal? */
data->step_size = 2.0f;
}
@ -1005,7 +1005,7 @@ FModifier *add_fmodifier(ListBase *modifiers, int type)
/* special checks for whether modifier can be added */
if ((modifiers->first) && (type == FMODIFIER_TYPE_CYCLES)) {
/* cycles modifier must be first in stack, so for now, don't add if it can't be */
// TODO: perhaps there is some better way, but for now,
/* TODO: perhaps there is some better way, but for now, */
printf("Error: Cannot add 'Cycles' modifier to F-Curve, as 'Cycles' modifier can only be first in stack.\n");
return NULL;
}
@ -1104,7 +1104,7 @@ int remove_fmodifier(ListBase *modifiers, FModifier *fcm)
return 1;
}
else {
// XXX this case can probably be removed some day, as it shouldn't happen...
/* XXX this case can probably be removed some day, as it shouldn't happen... */
printf("remove_fmodifier() - no modifier stack given\n");
MEM_freeN(fcm);
return 0;
@ -1343,7 +1343,7 @@ void fcurve_bake_modifiers(FCurve *fcu, int start, int end)
ChannelDriver *driver;
/* sanity checks */
// TODO: make these tests report errors using reports not printf's
/* TODO: make these tests report errors using reports not printf's */
if (ELEM(NULL, fcu, fcu->modifiers.first)) {
printf("Error: No F-Curve with F-Curve Modifiers to Bake\n");
return;

@ -133,7 +133,7 @@ struct TmpFont *BKE_vfont_find_tmpfont(VFont *vfont)
if (vfont == NULL) return NULL;
// Try finding the font from font list
/* Try finding the font from font list */
tmpfnt = ttfdata.first;
while (tmpfnt) {
if (tmpfnt->vfont == vfont)
@ -150,10 +150,10 @@ static VFontData *vfont_get_data(Main *bmain, VFont *vfont)
if (vfont == NULL) return NULL;
// Try finding the font from font list
/* Try finding the font from font list */
tmpfnt = BKE_vfont_find_tmpfont(vfont);
// And then set the data
/* And then set the data */
if (!vfont->data) {
PackedFile *pf;
@ -164,14 +164,14 @@ static VFontData *vfont_get_data(Main *bmain, VFont *vfont)
if (vfont->packedfile) {
pf = vfont->packedfile;
// We need to copy a tmp font to memory unless it is already there
/* We need to copy a tmp font to memory unless it is already there */
if (!tmpfnt) {
tpf = MEM_callocN(sizeof(*tpf), "PackedFile");
tpf->data = MEM_mallocN(pf->size, "packFile");
tpf->size = pf->size;
memcpy(tpf->data, pf->data, pf->size);
// Add temporary packed file to globals
/* Add temporary packed file to globals */
tmpfnt = (struct TmpFont *) MEM_callocN(sizeof(struct TmpFont), "temp_font");
tmpfnt->pf = tpf;
tmpfnt->vfont = vfont;
@ -184,7 +184,7 @@ static VFontData *vfont_get_data(Main *bmain, VFont *vfont)
if (!tmpfnt) {
tpf = newPackedFile(NULL, vfont->name, ID_BLEND_PATH(bmain, &vfont->id));
// Add temporary packed file to globals
/* Add temporary packed file to globals */
tmpfnt = (struct TmpFont *) MEM_callocN(sizeof(struct TmpFont), "temp_font");
tmpfnt->pf = tpf;
tmpfnt->vfont = vfont;
@ -251,12 +251,12 @@ VFont *BKE_vfont_load(Main *bmain, const char *name)
}
BLI_strncpy(vfont->name, name, sizeof(vfont->name));
// if autopack is on store the packedfile in de font structure
/* if autopack is on store the packedfile in de font structure */
if (!is_builtin && (G.fileflags & G_AUTOPACK)) {
vfont->packedfile = pf;
}
// Do not add FO_BUILTIN_NAME to temporary listbase
/* Do not add FO_BUILTIN_NAME to temporary listbase */
if (strcmp(filename, FO_BUILTIN_NAME)) {
tmpfnt = (struct TmpFont *) MEM_callocN(sizeof(struct TmpFont), "temp_font");
tmpfnt->pf = tpf;
@ -265,7 +265,7 @@ VFont *BKE_vfont_load(Main *bmain, const char *name)
}
}
// Free the packed file
/* Free the packed file */
if (!vfont || vfont->packedfile != pf) {
freePackedFile(pf);
}
@ -390,11 +390,11 @@ static void buildchar(Main *bmain, Curve *cu, unsigned long character, CharInfo
che = find_vfont_char(vfd, character);
// Select the glyph data
/* Select the glyph data */
if (che)
nu1 = che->nurbsbase.first;
// Create the character
/* Create the character */
while (nu1) {
bezt1 = nu1->bezt;
if (bezt1) {
@ -508,7 +508,7 @@ int BKE_vfont_select_get(Object *ob, int *start, int *end)
static float char_width(Curve *cu, VChar *che, CharInfo *info)
{
// The character wasn't found, propably ascii = 0, then the width shall be 0 as well
/* The character wasn't found, propably ascii = 0, then the width shall be 0 as well */
if (che == NULL) {
return 0.0f;
}
@ -543,20 +543,20 @@ struct chartrans *BKE_vfont_to_curve(Main *bmain, Scene *scene, Object *ob, int
if (ob->type != OB_FONT) return NULL;
// Set font data
/* Set font data */
cu = (Curve *) ob->data;
vfont = cu->vfont;
if (cu->str == NULL) return NULL;
if (vfont == NULL) return NULL;
// Create unicode string
/* Create unicode string */
utf8len = BLI_strlen_utf8(cu->str);
mem = MEM_callocN(((utf8len + 1) * sizeof(wchar_t)), "convertedmem");
BLI_strncpy_wchar_from_utf8(mem, cu->str, utf8len + 1);
// Count the wchar_t string length
/* Count the wchar_t string length */
slen = wcslen(mem);
if (cu->ulheight == 0.0f)
@ -612,7 +612,7 @@ struct chartrans *BKE_vfont_to_curve(Main *bmain, Scene *scene, Object *ob, int
curbox = 0;
for (i = 0; i <= slen; i++) {
makebreak:
// Characters in the list
/* Characters in the list */
info = &(custrinfo[i]);
ascii = mem[i];
if (info->flag & CU_CHINFO_SMALLCAPS) {
@ -664,7 +664,7 @@ makebreak:
twidth = char_width(cu, che, info);
// Calculate positions
/* Calculate positions */
if ((tb->w != 0.0f) && (ct->dobreak == 0) && ((xof - (tb->x / cu->fsize) + twidth) * cu->fsize) > tb->w + cu->xof * cu->fsize) {
// fprintf(stderr, "linewidth exceeded: %c%c%c...\n", mem[i], mem[i+1], mem[i+2]);
for (j = i; j && (mem[j] != '\n') && (mem[j] != '\r') && (chartransdata[j].dobreak == 0); j--) {
@ -699,7 +699,7 @@ makebreak:
yof -= linedist;
maxlen = MAX2(maxlen, (xof - tb->x / cu->fsize));
maxlen = maxf(maxlen, (xof - tb->x / cu->fsize));
linedata[lnr] = xof - tb->x / cu->fsize;
linedata2[lnr] = cnr;
linedata3[lnr] = tb->w / cu->fsize;
@ -762,7 +762,7 @@ makebreak:
}
else wsfac = 1.0f;
// Set the width of the character
/* Set the width of the character */
twidth = char_width(cu, che, info);
xof += (twidth * wsfac * (1.0f + (info->kern / 40.0f)) ) + xtrax;
@ -781,10 +781,10 @@ makebreak:
if (ascii == '\n' || ascii == '\r' || ct->dobreak) cu->lines++;
}
// linedata is now: width of line
// linedata2 is now: number of characters
// linedata3 is now: maxlen of that line
// linedata4 is now: number of whitespaces of line
/* linedata is now: width of line
* linedata2 is now: number of characters
* linedata3 is now: maxlen of that line
* linedata4 is now: number of whitespaces of line */
if (cu->spacemode != CU_LEFT) {
ct = chartransdata;
@ -1023,7 +1023,7 @@ makebreak:
/* printf("Error: Illegal material index (%d) in text object, setting to 0\n", info->mat_nr); */
info->mat_nr = 0;
}
// We do not want to see any character for \n or \r
/* We do not want to see any character for \n or \r */
if (cha != '\n' && cha != '\r')
buildchar(bmain, cu, cha, info, ct->xof, ct->yof, ct->rot, i);
@ -1035,8 +1035,8 @@ makebreak:
{
uloverlap = xtrax + 0.1f;
}
// Find the character, the characters has to be in the memory already
// since character checking has been done earlier already.
/* Find the character, the characters has to be in the memory already
* since character checking has been done earlier already. */
che = find_vfont_char(vfd, cha);
twidth = char_width(cu, che, info);

@ -33,11 +33,13 @@
#include <stddef.h>
#include <string.h>
#include "BLI_utildefines.h"
#include "BLI_string.h"
#include "BLI_listbase.h"
#include "BKE_idprop.h"
#include "BKE_library.h"
#include "BLI_blenlib.h"
#include "MEM_guardedalloc.h"
/* IDPropertyTemplate is a union in DNA_ID.h */
@ -122,11 +124,10 @@ IDProperty *IDP_GetIndexArray(IDProperty *prop, int index)
return GETPROP(prop, index);
}
IDProperty *IDP_AppendArray(IDProperty *prop, IDProperty *item)
void IDP_AppendArray(IDProperty *prop, IDProperty *item)
{
IDP_ResizeIDPArray(prop, prop->len + 1);
IDP_SetIndexArray(prop, prop->len - 1, item);
return item;
}
void IDP_ResizeIDPArray(IDProperty *prop, int newlen)

@ -1230,7 +1230,7 @@ void BKE_imbuf_to_image_format(struct ImageFormatData *im_format, const ImBuf *i
{
BKE_imformat_defaults(im_format);
// file type
/* file type */
if (imbuf->ftype == IMAGIC)
im_format->imtype = R_IMF_IMTYPE_IRIS;
@ -1311,7 +1311,7 @@ void BKE_imbuf_to_image_format(struct ImageFormatData *im_format, const ImBuf *i
im_format->quality = imbuf->ftype & ~JPG_MSK;
}
// planes
/* planes */
switch (imbuf->channels) {
case 0:
case 4: im_format->planes = R_IMF_PLANES_RGBA;

@ -185,7 +185,7 @@ DO_INLINE void print_lfvector(float (*fLongVector)[3], unsigned int verts)
/* create long vector */
DO_INLINE lfVector *create_lfvector(unsigned int verts)
{
// TODO: check if memory allocation was successfull */
/* TODO: check if memory allocation was successfull */
return (lfVector *)MEM_callocN(verts * sizeof(lfVector), "cloth_implicit_alloc_vector");
// return (lfVector *)cloth_aligned_malloc(&MEMORY_BASE, verts * sizeof(lfVector));
}

@ -895,7 +895,7 @@ static char *get_rna_access(int blocktype, int adrcode, char actname[], char con
/* special case for rotdiff drivers... we don't need a property for this... */
break;
// TODO... add other blocktypes...
/* TODO... add other blocktypes... */
default:
printf("IPO2ANIMATO WARNING: No path for blocktype %d, adrcode %d yet\n", blocktype, adrcode);
break;
@ -1588,9 +1588,9 @@ static void action_to_animdata(ID *id, bAction *act)
/* ------------------------- */
// TODO:
// - NLA group duplicators info
// - NLA curve/stride modifiers...
/* TODO:
* - NLA group duplicators info
* - NLA curve/stride modifiers... */
/* Convert NLA-Strip to new system */
static void nlastrips_to_animdata(ID *id, ListBase *strips)

@ -51,7 +51,7 @@
#include "BKE_main.h"
#include "BKE_node.h"
void *BKE_lamp_add(const char *name)
Lamp *BKE_lamp_add(const char *name)
{
Lamp *la;

@ -1342,7 +1342,7 @@ static void lib_indirect_test_id(ID *id, Library *lib)
int a;
#if 0 /* XXX OLD ANIMSYS, NLASTRIPS ARE NO LONGER USED */
// XXX old animation system! --------------------------------------
/* XXX old animation system! -------------------------------------- */
{
bActionStrip *strip;
for (strip = ob->nlastrips.first; strip; strip = strip->next) {
@ -1351,7 +1351,7 @@ static void lib_indirect_test_id(ID *id, Library *lib)
LIBTAG(strip->ipo);
}
}
// XXX: new animation system needs something like this?
/* XXX: new animation system needs something like this? */
#endif
for (a = 0; a < ob->totcol; a++) {

@ -1618,13 +1618,13 @@ static void decode_tfaceflag(Material *ma, int flag, int convertall)
/* boolean check to see if the mesh needs a material */
static int check_tfaceneedmaterial(int flag)
{
// check if the flags we have are not deprecated != than default material options
// also if only flags are visible and collision see if all objects using this mesh have this option in physics
/* check if the flags we have are not deprecated != than default material options
* also if only flags are visible and collision see if all objects using this mesh have this option in physics */
/* flag is shifted in 1 to make 0 != no flag yet (see encode_tfaceflag) */
flag -= 1;
// deprecated flags
/* deprecated flags */
flag &= ~TF_OBCOL;
flag &= ~TF_SHAREDVERT;
flag &= ~TF_SHAREDCOL;
@ -1632,12 +1632,12 @@ static int check_tfaceneedmaterial(int flag)
/* light tface flag is ignored in GLSL mode */
flag &= ~TF_LIGHT;
// automatic detected if tex image has alpha
/* automatic detected if tex image has alpha */
flag &= ~(TF_ALPHA << 15);
// automatic detected if using texture
/* automatic detected if using texture */
flag &= ~TF_TEX;
// settings for the default NoMaterial
/* settings for the default NoMaterial */
if (flag == TF_DYNAMIC)
return 0;
@ -1646,7 +1646,7 @@ static int check_tfaceneedmaterial(int flag)
}
/* return number of digits of an integer */
// XXX to be optmized or replaced by an equivalent blender internal function
/* XXX to be optmized or replaced by an equivalent blender internal function */
static int integer_getdigits(int number)
{
int i = 0;
@ -1661,9 +1661,9 @@ static int integer_getdigits(int number)
static void calculate_tface_materialname(char *matname, char *newname, int flag)
{
// if flag has only light and collision and material matches those values
// you can do strcpy(name, mat_name);
// otherwise do:
/* if flag has only light and collision and material matches those values
* you can do strcpy(name, mat_name);
* otherwise do: */
int digits = integer_getdigits(flag);
/* clamp the old name, remove the MA prefix and add the .TF.flag suffix
* e.g. matname = "MALoooooooooooooongName"; newname = "Loooooooooooooon.TF.2" */
@ -1736,9 +1736,9 @@ static short convert_tfacenomaterial(Main *main, Mesh *me, MTFace *tf, int flag)
set_facetexture_flags(ma, tf->tpage);
decode_tfaceflag(ma, flag, 1);
// the final decoding will happen after, outside the main loop
// for now store the flag into the material and change light/tex/collision
// store the flag as a negative number
/* the final decoding will happen after, outside the main loop
* for now store the flag into the material and change light/tex/collision
* store the flag as a negative number */
ma->game.flag = -flag;
id_us_min((ID *)ma);
}

@ -407,7 +407,7 @@ static float nlastrip_get_frame_actionclip(NlaStrip *strip, float cframe, short
/* reversed = play strip backwards */
if (strip->flag & NLASTRIP_FLAG_REVERSE) {
// FIXME: this won't work right with Graph Editor?
/* FIXME: this won't work right with Graph Editor? */
if (mode == NLATIME_CONVERT_MAP) {
return strip->end - scale * (cframe - strip->actstart);
}
@ -1154,7 +1154,7 @@ static short nlastrip_is_first(AnimData *adt, NlaStrip *strip)
return 0;
/* check other tracks to see if they have a strip that's earlier */
// TODO: or should we check that the strip's track is also the first?
/* TODO: or should we check that the strip's track is also the first? */
for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
/* only check the first strip, assuming that they're all in order */
ns = nlt->strips.first;
@ -1234,7 +1234,7 @@ void BKE_nlastrip_validate_fcurves(NlaStrip *strip)
/* store path - make copy, and store that */
fcu->rna_path = BLI_strdupn("influence", 9);
// TODO: insert a few keyframes to ensure default behavior?
/* TODO: insert a few keyframes to ensure default behavior? */
}
}
@ -1255,7 +1255,7 @@ void BKE_nlastrip_validate_fcurves(NlaStrip *strip)
/* store path - make copy, and store that */
fcu->rna_path = BLI_strdupn("strip_time", 10);
// TODO: insert a few keyframes to ensure default behavior?
/* TODO: insert a few keyframes to ensure default behavior? */
}
}
}
@ -1340,7 +1340,7 @@ static void nlastrip_get_endpoint_overlaps(NlaStrip *strip, NlaTrack *track, flo
/* find strips that overlap over the start/end of the given strip,
* but which don't cover the entire length
*/
// TODO: this scheme could get quite slow for doing this on many strips...
/* TODO: this scheme could get quite slow for doing this on many strips... */
for (nls = track->strips.first; nls; nls = nls->next) {
/* check if strip overlaps (extends over or exactly on) the entire range of the strip we're validating */
if ((nls->start <= strip->start) && (nls->end >= strip->end)) {
@ -1443,7 +1443,7 @@ void BKE_nla_validate_state(AnimData *adt)
/* apart from 'nothing' option which user has to explicitly choose, we don't really know if
* we should be overwriting the extend setting (but assume that's what the user wanted)
*/
// TODO: 1 solution is to tie this in with auto-blending...
/* TODO: 1 solution is to tie this in with auto-blending... */
if (strip->extendmode != NLASTRIP_EXTEND_NOTHING) {
/* 1) First strip must be set to extend hold, otherwise, stuff before acts dodgy
* 2) Only overwrite extend mode if *not* changing it will most probably result in
@ -1469,20 +1469,20 @@ void BKE_nla_validate_state(AnimData *adt)
* for normal editing only (i.e. not in editmode for some strip's action),
* so no checks for this are performed.
*/
// TODO: maybe we should have checks for this too...
/* TODO: maybe we should have checks for this too... */
void BKE_nla_action_pushdown(AnimData *adt)
{
NlaStrip *strip;
/* sanity checks */
// TODO: need to report the error for this
/* TODO: need to report the error for this */
if (ELEM(NULL, adt, adt->action))
return;
/* if the action is empty, we also shouldn't try to add to stack,
* as that will cause us grief down the track
*/
// TODO: what about modifiers?
/* TODO: what about modifiers? */
if (action_has_motion(adt->action) == 0) {
printf("BKE_nla_action_pushdown(): action has no data\n");
return;
@ -1505,7 +1505,7 @@ void BKE_nla_action_pushdown(AnimData *adt)
/* not first, so extend mode can only be NLASTRIP_EXTEND_HOLD_FORWARD not NLASTRIP_EXTEND_HOLD,
* so that it doesn't override strips in previous tracks
*/
// FIXME: this needs to be more automated, since user can rearrange strips
/* FIXME: this needs to be more automated, since user can rearrange strips */
strip->extendmode = NLASTRIP_EXTEND_HOLD_FORWARD;
}
@ -1632,7 +1632,7 @@ void BKE_nla_tweakmode_exit(AnimData *adt)
if ((adt->flag & ADT_NLA_EDIT_ON) == 0)
return;
// TODO: need to sync the user-strip with the new state of the action!
/* TODO: need to sync the user-strip with the new state of the action! */
/* for all Tracks, clear the 'disabled' flag
* for all Strips, clear the 'tweak-user' flag

@ -223,7 +223,7 @@ void BKE_object_link_modifiers(struct Object *ob, struct Object *from)
BKE_object_copy_particlesystems(ob, from);
BKE_object_copy_softbody(ob, from);
// TODO: smoke?, cloth?
/* TODO: smoke?, cloth? */
}
/* here we will collect all local displist stuff */
@ -376,7 +376,7 @@ void BKE_object_unlink(Object *ob)
unlink_actuators(&ob->actuators);
/* check all objects: parents en bevels and fields, also from libraries */
// FIXME: need to check all animation blocks (drivers)
/* FIXME: need to check all animation blocks (drivers) */
obt = bmain->object.first;
while (obt) {
if (obt->proxy == ob)
@ -1376,7 +1376,7 @@ void BKE_object_make_proxy(Object *ob, Object *target, Object *gob)
BKE_object_copy_proxy_drivers(ob, target);
/* skip constraints? */
// FIXME: this is considered by many as a bug
/* FIXME: this is considered by many as a bug */
/* set object type and link to data */
ob->type = target->type;
@ -1958,7 +1958,7 @@ static void solve_parenting(Scene *scene, Object *ob, Object *par, float obmat[]
break;
}
// total
/* total */
mul_serie_m4(tmat, totmat, ob->parentinv,
NULL, NULL, NULL, NULL, NULL, NULL);
mul_serie_m4(obmat, tmat, locmat,
@ -1968,10 +1968,10 @@ static void solve_parenting(Scene *scene, Object *ob, Object *par, float obmat[]
}
else {
// external usable originmat
/* external usable originmat */
copy_m3_m4(originmat, tmat);
// origin, voor help line
/* origin, for help line */
if ((ob->partype & PARTYPE) == PARSKEL) {
copy_v3_v3(ob->orig, par->obmat[3]);
}
@ -1987,7 +1987,7 @@ static int where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[
float fac1, fac2;
int a;
// include framerate
/* include framerate */
fac1 = (1.0f / (1.0f + fabsf(ob->sf)) );
if (fac1 >= 1.0f) return 0;
fac2 = 1.0f - fac1;
@ -2503,7 +2503,7 @@ void BKE_object_handle_update(Scene *scene, Object *ob)
/* XXX new animsys warning: depsgraph tag OB_RECALC_DATA should not skip drivers,
* which is only in BKE_object_where_is_calc now */
// XXX: should this case be OB_RECALC_OB instead?
/* XXX: should this case be OB_RECALC_OB instead? */
if (ob->recalc & OB_RECALC_ALL) {
if (G.debug & G_DEBUG)
@ -2539,7 +2539,7 @@ void BKE_object_handle_update(Scene *scene, Object *ob)
if (adt) {
/* evaluate drivers - datalevel */
// XXX: for mesh types, should we push this to derivedmesh instead?
/* XXX: for mesh types, should we push this to derivedmesh instead? */
BKE_animsys_evaluate_animdata(scene, data_id, adt, ctime, ADT_RECALC_DRIVERS);
}
@ -3163,7 +3163,7 @@ struct LinkNode *BKE_object_relational_superset(struct Scene *scene, eObjectSet
/* iterate over all selected and visible objects */
for (base = scene->base.first; base; base = base->next) {
if (objectSet == OB_SET_ALL) {
// as we get all anyways just add it
/* as we get all anyways just add it */
Object *ob = base->object;
obrel_list_add(&links, ob);
}

@ -132,7 +132,7 @@ int countPackedFiles(Main *bmain)
bSound *sound;
int count = 0;
// let's check if there are packed files...
/* let's check if there are packed files... */
for (ima = bmain->image.first; ima; ima = ima->id.next)
if (ima->packedfile)
count++;
@ -181,13 +181,13 @@ PackedFile *newPackedFile(ReportList *reports, const char *filename, const char
//XXX waitcursor(1);
// convert relative filenames to absolute filenames
/* convert relative filenames to absolute filenames */
BLI_strncpy(name, filename, sizeof(name));
BLI_path_abs(name, basepath);
// open the file
// and create a PackedFile structure
/* open the file
* and create a PackedFile structure */
file = BLI_open(name, O_BINARY | O_RDONLY, 0);
if (file <= 0) {
@ -197,8 +197,8 @@ PackedFile *newPackedFile(ReportList *reports, const char *filename, const char
filelen = BLI_file_descriptor_size(file);
if (filelen == 0) {
// MEM_mallocN complains about MEM_mallocN(0, "bla");
// we don't care....
/* MEM_mallocN complains about MEM_mallocN(0, "bla");
* we don't care.... */
data = MEM_mallocN(1, "packFile");
}
else {
@ -294,7 +294,7 @@ int writePackedFile(ReportList *reports, const char *filename, PackedFile *pf, i
}
}
// make sure the path to the file exists...
/* make sure the path to the file exists... */
BLI_make_existing_file(name);
file = BLI_open(name, O_BINARY + O_WRONLY + O_CREAT + O_TRUNC, 0666);
@ -354,7 +354,7 @@ int checkPackedFile(const char *filename, PackedFile *pf)
ret_val = PF_DIFFERS;
}
else {
// we'll have to compare the two...
/* we'll have to compare the two... */
file = BLI_open(name, O_BINARY | O_RDONLY, 0);
if (file < 0) {
@ -370,7 +370,7 @@ int checkPackedFile(const char *filename, PackedFile *pf)
}
if (read(file, buf, len) != len) {
// read error ...
/* read error ... */
ret_val = PF_DIFFERS;
break;
}
@ -412,24 +412,24 @@ char *unpackFile(ReportList *reports, const char *abs_name, const char *local_na
temp = abs_name;
break;
case PF_USE_LOCAL:
// if file exists use it
/* if file exists use it */
if (BLI_exists(local_name)) {
temp = local_name;
break;
}
// else fall through and create it
/* else fall through and create it */
case PF_WRITE_LOCAL:
if (writePackedFile(reports, local_name, pf, 1) == RET_OK) {
temp = local_name;
}
break;
case PF_USE_ORIGINAL:
// if file exists use it
/* if file exists use it */
if (BLI_exists(abs_name)) {
temp = abs_name;
break;
}
// else fall through and create it
/* else fall through and create it */
case PF_WRITE_ORIGINAL:
if (writePackedFile(reports, abs_name, pf, 1) == RET_OK) {
temp = abs_name;

@ -546,7 +546,7 @@ void psys_free(Object *ob, ParticleSystem *psys)
psys->totchild = 0;
}
// check if we are last non-visible particle system
/* check if we are last non-visible particle system */
for (tpsys = ob->particlesystem.first; tpsys; tpsys = tpsys->next) {
if (tpsys->part) {
if (ELEM(tpsys->part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) {
@ -555,7 +555,7 @@ void psys_free(Object *ob, ParticleSystem *psys)
}
}
}
// clear do-not-draw-flag
/* clear do-not-draw-flag */
if (!nr)
ob->transflag &= ~OB_DUPLIPARTS;

@ -223,8 +223,8 @@ int compare_property(bProperty *prop, const char *str)
case GPROP_FLOAT:
case GPROP_TIME:
// WARNING: untested for GPROP_TIME
// function isn't used currently
/* WARNING: untested for GPROP_TIME
* function isn't used currently */
fvalue = *((float *)&prop->data);
ftest = (float)atof(str);
if (fvalue > ftest) return 1;

@ -257,10 +257,10 @@ void BKE_scene_free(Scene *sce)
/* do not free objects! */
if (sce->gpd) {
#if 0 // removed since this can be invalid memory when freeing everything
// since the grease pencil data is freed before the scene.
// since grease pencil data is not (yet?), shared between objects
// its probably safe not to do this, some save and reload will free this.
#if 0 /* removed since this can be invalid memory when freeing everything */
/* since the grease pencil data is freed before the scene.
* since grease pencil data is not (yet?), shared between objects
* its probably safe not to do this, some save and reload will free this. */
sce->gpd->id.us--;
#endif
sce->gpd = NULL;
@ -954,7 +954,7 @@ static void scene_update_drivers(Main *UNUSED(bmain), Scene *scene)
}
/* world */
// TODO: what about world textures? but then those have nodes too...
/* TODO: what about world textures? but then those have nodes too... */
if (scene->world) {
ID *wid = (ID *)scene->world;
AnimData *adt = BKE_animdata_from_id(wid);
@ -1060,7 +1060,7 @@ void BKE_scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay)
sound_set_cfra(sce->r.cfra);
/* clear animation overrides */
// XXX TODO...
/* XXX TODO... */
for (sce_iter = sce; sce_iter; sce_iter = sce_iter->set) {
if (sce_iter->theDag == NULL)

@ -1848,7 +1848,7 @@ static void do_transform(Scene *scene, Sequence *seq, float UNUSED(facf0), int x
TransformVars *transform = (TransformVars *)seq->effectdata;
float scale_x, scale_y, translate_x, translate_y, rotate_radians;
// Scale
/* Scale */
if (transform->uniform_scale) {
scale_x = scale_y = transform->ScalexIni;
}
@ -1857,7 +1857,7 @@ static void do_transform(Scene *scene, Sequence *seq, float UNUSED(facf0), int x
scale_y = transform->ScaleyIni;
}
// Translate
/* Translate */
if (!transform->percent) {
float rd_s = (scene->r.size / 100.0f);
@ -1869,7 +1869,7 @@ static void do_transform(Scene *scene, Sequence *seq, float UNUSED(facf0), int x
translate_y = y * (transform->yIni / 100.0f) + (y / 2.0f);
}
// Rotate
/* Rotate */
rotate_radians = DEG2RADF(transform->rotIni);
transform_image(x, y, ibuf1, out, scale_x, scale_y, translate_x, translate_y, rotate_radians, transform->interpolation);

@ -2528,7 +2528,7 @@ static ImBuf *seq_render_strip_stack(
#if 0 /* commentind since this breaks keyframing, since it resets the value on draw */
if (scene->r.cfra != cfra) {
// XXX for prefetch and overlay offset!..., very bad!!!
/* XXX for prefetch and overlay offset!..., very bad!!! */
AnimData *adt = BKE_animdata_from_id(&scene->id);
BKE_animsys_evaluate_animdata(scene, &scene->id, adt, cfra, ADT_RECALC_ANIM);
}

@ -120,13 +120,13 @@ void space_transform_invert(const SpaceTransform *data, float co[3])
static void space_transform_apply_normal(const SpaceTransform *data, float no[3])
{
mul_mat3_m4_v3(((SpaceTransform *)data)->local2target, no);
normalize_v3(no); // TODO: could we just determine de scale value from the matrix?
normalize_v3(no); /* TODO: could we just determine de scale value from the matrix? */
}
static void space_transform_invert_normal(const SpaceTransform *data, float no[3])
{
mul_mat3_m4_v3(((SpaceTransform *)data)->target2local, no);
normalize_v3(no); // TODO: could we just determine de scale value from the matrix?
normalize_v3(no); /* TODO: could we just determine de scale value from the matrix? */
}
/*

@ -141,7 +141,7 @@ struct SmokeModifierData;
/* forward declerations */
static void calcTriangleDivs(Object *ob, MVert *verts, int numverts, MFace *tris, int numfaces, int numtris, int **tridivs, float cell_len);
static void get_cell(float *p0, int res[3], float dx, float *pos, int *cell, int correct);
static void get_cell(const float p0[3], const int res[3], float dx, const float pos[3], int cell[3], int correct);
static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs);
#else /* WITH_SMOKE */
@ -1977,7 +1977,7 @@ static void bresenham_linie_3D(int x1, int y1, int z1, int x2, int y2, int z2, f
cb(result, input, res, pixel, tRay, correct);
}
static void get_cell(float *p0, int res[3], float dx, float *pos, int *cell, int correct)
static void get_cell(const float p0[3], const int res[3], float dx, const float pos[3], int cell[3], int correct)
{
float tmp[3];

@ -1718,15 +1718,15 @@ static int choose_winner(float*w, float* pos, float*a, float*b, float*c, float*c
{
float mindist, cp;
int winner =1;
mindist = ABS(dot_v3v3(pos, a));
mindist = fabsf(dot_v3v3(pos, a));
cp = ABS(dot_v3v3(pos, b));
cp = fabsf(dot_v3v3(pos, b));
if ( mindist < cp ) {
mindist = cp;
winner =2;
}
cp = ABS(dot_v3v3(pos, c));
cp = fabsf(dot_v3v3(pos, c));
if (mindist < cp ) {
mindist = cp;
winner =3;

@ -1413,11 +1413,11 @@ int BKE_texture_dependsOnTime(const struct Tex *texture)
return 1;
}
else if (texture->adt) {
// assume anything in adt means the texture is animated
/* assume anything in adt means the texture is animated */
return 1;
}
else if (texture->type == TEX_NOISE) {
// noise always varies with time
/* noise always varies with time */
return 1;
}
return 0;

@ -2315,10 +2315,10 @@ static int tracking_check_marker_margin(MovieTrackingTrack *track, MovieTracking
/* margin from frame boundaries */
BKE_tracking_marker_pattern_minmax(marker, pat_min, pat_max);
sub_v2_v2v2(dim, pat_max, pat_min);
margin[0] = margin[1] = MAX2(dim[0], dim[1]) / 2.0f;
margin[0] = margin[1] = maxf(dim[0], dim[1]) / 2.0f;
margin[0] = MAX2(margin[0], (float)track->margin / frame_width);
margin[1] = MAX2(margin[1], (float)track->margin / frame_height);
margin[0] = maxf(margin[0], (float)track->margin / frame_width);
margin[1] = maxf(margin[1], (float)track->margin / frame_height);
/* do not track markers which are too close to boundary */
if (marker->pos[0] < margin[0] || marker->pos[0] > 1.0f - margin[0] ||

@ -516,7 +516,7 @@ static AVStream *alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
c->qmax = 51;
}
// Keep lossless encodes in the RGB domain.
/* Keep lossless encodes in the RGB domain. */
if (codec_id == CODEC_ID_HUFFYUV) {
/* HUFFYUV was PIX_FMT_YUV422P before */
c->pix_fmt = PIX_FMT_RGB32;
@ -572,12 +572,12 @@ static AVStream *alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
}
if (codec_id == CODEC_ID_QTRLE) {
// normally it should be enough to have buffer with actual image size,
// but some codecs like QTRLE might store extra information in this buffer,
// so it should be a way larger
/* normally it should be enough to have buffer with actual image size,
* but some codecs like QTRLE might store extra information in this buffer,
* so it should be a way larger */
// maximum video buffer size is 6-bytes per pixel, plus DPX header size (1664)
// (from FFmpeg sources)
/* maximum video buffer size is 6-bytes per pixel, plus DPX header size (1664)
* (from FFmpeg sources) */
int size = c->width * c->height;
video_buffersize = 7 * size + 10000;
}

@ -43,7 +43,12 @@ extern "C" {
* \param str The string to be duplicated
* \retval Returns the duplicated string
*/
char *BLI_strdup(const char *str);
char *BLI_strdup(const char *str)
#ifdef __GNUC__
__attribute__((warn_unused_result))
__attribute__((nonnull))
#endif
;
/**
* Duplicates the first \a len bytes of cstring \a str
@ -54,7 +59,12 @@ char *BLI_strdup(const char *str);
* \param len The number of bytes to duplicate
* \retval Returns the duplicated string
*/
char *BLI_strdupn(const char *str, const size_t len);
char *BLI_strdupn(const char *str, const size_t len)
#ifdef __GNUC__
__attribute__((warn_unused_result))
__attribute__((nonnull))
#endif
;
/**
* Appends the two strings, and returns new mallocN'ed string
@ -62,7 +72,12 @@ char *BLI_strdupn(const char *str, const size_t len);
* \param str2 second string for append
* \retval Returns dst
*/
char *BLI_strdupcat(const char *str1, const char *str2);
char *BLI_strdupcat(const char *str1, const char *str2)
#ifdef __GNUC__
__attribute__((warn_unused_result))
__attribute__((nonnull))
#endif
;
/**
* Like strncpy but ensures dst is always
@ -74,9 +89,14 @@ char *BLI_strdupcat(const char *str1, const char *str2);
* the size of dst)
* \retval Returns dst
*/
char *BLI_strncpy(char *dst, const char *src, const size_t maxncpy);
char *BLI_strncpy(char *dst, const char *src, const size_t maxncpy)
#ifdef __GNUC__
__attribute__((nonnull))
#endif
;
/* Makes a copy of the text within the "" that appear after some text 'blahblah'
/**
*Makes a copy of the text within the "" that appear after some text 'blahblah'
* i.e. for string 'pose["apples"]' with prefix 'pose[', it should grab "apples"
*
* - str: is the entire string to chop
@ -85,7 +105,12 @@ char *BLI_strncpy(char *dst, const char *src, const size_t maxncpy);
* Assume that the strings returned must be freed afterwards, and that the inputs will contain
* data we want...
*/
char *BLI_getQuotedStr(const char *str, const char *prefix);
char *BLI_getQuotedStr(const char *str, const char *prefix)
#ifdef __GNUC__
__attribute__((warn_unused_result))
__attribute__((nonnull))
#endif
;
/**
* Returns a copy of the cstring \a str into a newly mallocN'd
@ -97,7 +122,12 @@ char *BLI_getQuotedStr(const char *str, const char *prefix);
* \param newText The text in the string to find and replace
* \retval Returns the duplicated string
*/
char *BLI_replacestr(char *str, const char *oldText, const char *newText);
char *BLI_replacestr(char *str, const char *oldText, const char *newText)
#ifdef __GNUC__
__attribute__((warn_unused_result))
__attribute__((nonnull))
#endif
;
/*
* Replacement for snprintf
@ -105,6 +135,7 @@ char *BLI_replacestr(char *str, const char *oldText, const char *newText);
size_t BLI_snprintf(char *buffer, size_t len, const char *format, ...)
#ifdef __GNUC__
__attribute__ ((format(printf, 3, 4)))
__attribute__((nonnull))
#endif
;
@ -115,27 +146,75 @@ __attribute__ ((format(printf, 3, 4)))
char *BLI_sprintfN(const char *format, ...)
#ifdef __GNUC__
__attribute__ ((format(printf, 1, 2)))
__attribute__((warn_unused_result))
__attribute__((nonnull))
#endif
;
size_t BLI_strescape(char *dst, const char *src, const size_t maxlen);
size_t BLI_strescape(char *dst, const char *src, const size_t maxlen)
#ifdef __GNUC__
__attribute__((nonnull))
#endif
;
/**
* Compare two strings without regard to case.
*
* \retval True if the strings are equal, false otherwise.
*/
int BLI_strcaseeq(const char *a, const char *b);
int BLI_strcaseeq(const char *a, const char *b)
#ifdef __GNUC__
__attribute__((warn_unused_result))
__attribute__((nonnull))
#endif
;
char *BLI_strcasestr(const char *s, const char *find);
int BLI_strcasecmp(const char *s1, const char *s2);
int BLI_strncasecmp(const char *s1, const char *s2, size_t len);
int BLI_natstrcmp(const char *s1, const char *s2);
size_t BLI_strnlen(const char *str, size_t maxlen);
void BLI_timestr(double _time, char *str); /* time var is global */
char *BLI_strcasestr(const char *s, const char *find)
#ifdef __GNUC__
__attribute__((warn_unused_result))
__attribute__((nonnull))
#endif
;
int BLI_strcasecmp(const char *s1, const char *s2)
#ifdef __GNUC__
__attribute__((warn_unused_result))
__attribute__((nonnull))
#endif
;
int BLI_strncasecmp(const char *s1, const char *s2, size_t len)
#ifdef __GNUC__
__attribute__((warn_unused_result))
__attribute__((nonnull))
#endif
;
int BLI_natstrcmp(const char *s1, const char *s2)
#ifdef __GNUC__
__attribute__((warn_unused_result))
__attribute__((nonnull))
#endif
;
size_t BLI_strnlen(const char *str, size_t maxlen)
#ifdef __GNUC__
__attribute__((warn_unused_result))
__attribute__((nonnull))
#endif
;
void BLI_timestr(double _time, char *str)
#ifdef __GNUC__
__attribute__((nonnull))
#endif
; /* time var is global */
void BLI_ascii_strtolower(char *str, int len);
void BLI_ascii_strtoupper(char *str, int len);
void BLI_ascii_strtolower(char *str, int len)
#ifdef __GNUC__
__attribute__((nonnull))
#endif
;
void BLI_ascii_strtoupper(char *str, int len)
#ifdef __GNUC__
__attribute__((nonnull))
#endif
;
#ifdef __cplusplus
}

@ -35,8 +35,6 @@
#include "MEM_guardedalloc.h"
// #include "BLI_blenlib.h"
#include "BLI_utildefines.h"
#include "BLI_mempool.h"
#include "BLI_ghash.h"

@ -29,15 +29,11 @@
* \ingroup bli
*/
#include <assert.h>
#include "MEM_guardedalloc.h"
#include "BLI_utildefines.h"
#include "BLI_kdopbvh.h"
#include "BLI_math.h"
@ -45,14 +41,12 @@
#include <omp.h>
#endif
#define MAX_TREETYPE 32
#define DEFAULT_FIND_NEAREST_HEAP_SIZE 1024
typedef struct BVHNode {
struct BVHNode **children;
struct BVHNode *parent; // some user defined traversed need that
struct BVHNode *parent; /* some user defined traversed need that */
struct BVHNode *skip[2];
float *bv; /* Bounding volume of all nodes, max 13 axis */
int index; /* face, edge, vertex index */
@ -104,16 +98,15 @@ typedef struct BVHRayCastData {
BVHTreeRayHit hit;
} BVHRayCastData;
////////////////////////////////////////m
////////////////////////////////////////////////////////////////////////
// Bounding Volume Hierarchy Definition
//
// Notes: From OBB until 26-DOP --> all bounding volumes possible, just choose type below
// Notes: You have to choose the type at compile time ITM
// Notes: You can choose the tree type --> binary, quad, octree, choose below
////////////////////////////////////////////////////////////////////////
/*
* Bounding Volume Hierarchy Definition
*
* Notes: From OBB until 26-DOP --> all bounding volumes possible, just choose type below
* Notes: You have to choose the type at compile time ITM
* Notes: You can choose the tree type --> binary, quad, octree, choose below
*/
static float KDOP_AXES[13][3] = {
{1.0, 0, 0}, {0, 1.0, 0}, {0, 0, 1.0}, {1.0, 1.0, 1.0}, {1.0, -1.0, 1.0}, {1.0, 1.0, -1.0},
@ -188,13 +181,15 @@ static int ADJUST_MEMORY(void *local_memblock, void **memblock, int new_size, in
}
#endif
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Introsort
// with permission deriven from the following Java code:
// http://ralphunden.net/content/tutorials/a-guide-to-introsort/
// and he derived it from the SUN STL
//////////////////////////////////////////////////////////////////////////////////////////////////////
/*
* Introsort
* with permission deriven from the following Java code:
* http://ralphunden.net/content/tutorials/a-guide-to-introsort/
* and he derived it from the SUN STL
*/
//static int size_threshold = 16;
/*
* Common methods for all algorithms
*/
@ -336,9 +331,9 @@ static void sort_along_axis(BVHTree *tree, int start, int end, int axis)
}
#endif
//after a call to this function you can expect one of:
// every node to left of a[n] are smaller or equal to it
// every node to the right of a[n] are greater or equal to it
/* after a call to this function you can expect one of:
* - every node to left of a[n] are smaller or equal to it
* - every node to the right of a[n] are greater or equal to it */
static int partition_nth_element(BVHNode **a, int _begin, int _end, int n, int axis)
{
int begin = _begin, end = _end, cut;
@ -354,7 +349,7 @@ static int partition_nth_element(BVHNode **a, int _begin, int _end, int n, int a
return n;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
/* --- */
static void build_skip_links(BVHTree *tree, BVHNode *node, BVHNode *left, BVHNode *right)
{
int i;
@ -381,7 +376,7 @@ static void create_kdop_hull(BVHTree *tree, BVHNode *node, const float *co, int
float *bv = node->bv;
int i, k;
// don't init boudings for the moving case
/* don't init boudings for the moving case */
if (!moving) {
for (i = tree->start_axis; i < tree->stop_axis; i++) {
bv[2 * i] = FLT_MAX;
@ -401,7 +396,7 @@ static void create_kdop_hull(BVHTree *tree, BVHNode *node, const float *co, int
}
}
// depends on the fact that the BVH's for each face is already build
/* depends on the fact that the BVH's for each face is already build */
static void refit_kdop_hull(BVHTree *tree, BVHNode *node, int start, int end)
{
float newmin, newmax;
@ -429,31 +424,31 @@ static void refit_kdop_hull(BVHTree *tree, BVHNode *node, int start, int end)
}
// only supports x,y,z axis in the moment
// but we should use a plain and simple function here for speed sake
/* only supports x,y,z axis in the moment
* but we should use a plain and simple function here for speed sake */
static char get_largest_axis(float *bv)
{
float middle_point[3];
middle_point[0] = (bv[1]) - (bv[0]); // x axis
middle_point[1] = (bv[3]) - (bv[2]); // y axis
middle_point[2] = (bv[5]) - (bv[4]); // z axis
middle_point[0] = (bv[1]) - (bv[0]); /* x axis */
middle_point[1] = (bv[3]) - (bv[2]); /* y axis */
middle_point[2] = (bv[5]) - (bv[4]); /* z axis */
if (middle_point[0] > middle_point[1]) {
if (middle_point[0] > middle_point[2])
return 1; // max x axis
return 1; /* max x axis */
else
return 5; // max z axis
return 5; /* max z axis */
}
else {
if (middle_point[1] > middle_point[2])
return 3; // max y axis
return 3; /* max y axis */
else
return 5; // max z axis
return 5; /* max z axis */
}
}
// bottom-up update of bvh node BV
// join the children on the parent BV
/* bottom-up update of bvh node BV
* join the children on the parent BV */
static void node_join(BVHTree *tree, BVHNode *node)
{
int i, j;
@ -466,11 +461,11 @@ static void node_join(BVHTree *tree, BVHNode *node)
for (i = 0; i < tree->tree_type; i++) {
if (node->children[i]) {
for (j = tree->start_axis; j < tree->stop_axis; j++) {
// update minimum
/* update minimum */
if (node->children[i]->bv[(2 * j)] < node->bv[(2 * j)])
node->bv[(2 * j)] = node->children[i]->bv[(2 * j)];
// update maximum
/* update maximum */
if (node->children[i]->bv[(2 * j) + 1] > node->bv[(2 * j) + 1])
node->bv[(2 * j) + 1] = node->children[i]->bv[(2 * j) + 1];
}
@ -523,7 +518,7 @@ static void verify_tree(BVHTree *tree)
{
int i, j, check = 0;
// check the pointer list
/* check the pointer list */
for (i = 0; i < tree->totleaf; i++)
{
if (tree->nodes[i]->parent == NULL) {
@ -543,7 +538,7 @@ static void verify_tree(BVHTree *tree)
}
}
// check the leaf list
/* check the leaf list */
for (i = 0; i < tree->totleaf; i++)
{
if (tree->nodearray[i].parent == NULL) {
@ -567,8 +562,8 @@ static void verify_tree(BVHTree *tree)
}
#endif
//Helper data and structures to build a min-leaf generalized implicit tree
//This code can be easily reduced (basicly this is only method to calculate pow(k, n) in O(1).. and stuff like that)
/* Helper data and structures to build a min-leaf generalized implicit tree
* This code can be easily reduced (basicly this is only method to calculate pow(k, n) in O(1).. and stuff like that) */
typedef struct BVHBuildHelper {
int tree_type; /* */
int totleafs; /* */
@ -589,7 +584,7 @@ static void build_implicit_tree_helper(BVHTree *tree, BVHBuildHelper *data)
data->totleafs = tree->totleaf;
data->tree_type = tree->tree_type;
//Calculate the smallest tree_type^n such that tree_type^n >= num_leafs
/* Calculate the smallest tree_type^n such that tree_type^n >= num_leafs */
for (data->leafs_per_child[0] = 1;
data->leafs_per_child[0] < data->totleafs;
data->leafs_per_child[0] *= data->tree_type)
@ -599,7 +594,7 @@ static void build_implicit_tree_helper(BVHTree *tree, BVHBuildHelper *data)
data->branches_on_level[0] = 1;
//We could stop the loop first (but I am lazy to find out when)
/* We could stop the loop first (but I am lazy to find out when) */
for (depth = 1; depth < 32; depth++) {
data->branches_on_level[depth] = data->branches_on_level[depth - 1] * data->tree_type;
data->leafs_per_child[depth] = data->leafs_per_child[depth - 1] / data->tree_type;
@ -700,18 +695,18 @@ static void non_recursive_bvh_div_nodes(BVHTree *tree, BVHNode *branches_array,
int i;
const int tree_type = tree->tree_type;
const int tree_offset = 2 - tree->tree_type; //this value is 0 (on binary trees) and negative on the others
const int tree_offset = 2 - tree->tree_type; /* this value is 0 (on binary trees) and negative on the others */
const int num_branches = implicit_needed_branches(tree_type, num_leafs);
BVHBuildHelper data;
int depth;
// set parent from root node to NULL
/* set parent from root node to NULL */
BVHNode *tmp = branches_array + 0;
tmp->parent = NULL;
//Most of bvhtree code relies on 1-leaf trees having at least one branch
//We handle that special case here
/*Most of bvhtree code relies on 1-leaf trees having at least one branch
*We handle that special case here */
if (num_leafs == 1) {
BVHNode *root = branches_array + 0;
refit_kdop_hull(tree, root, 0, num_leafs);
@ -722,17 +717,17 @@ static void non_recursive_bvh_div_nodes(BVHTree *tree, BVHNode *branches_array,
return;
}
branches_array--; //Implicit trees use 1-based indexs
branches_array--; /* Implicit trees use 1-based indexs */
build_implicit_tree_helper(tree, &data);
//Loop tree levels (log N) loops
/* Loop tree levels (log N) loops */
for (i = 1, depth = 1; i <= num_branches; i = i * tree_type + tree_offset, depth++) {
const int first_of_next_level = i * tree_type + tree_offset;
const int end_j = MIN2(first_of_next_level, num_branches + 1); //index of last branch on this level
const int end_j = MIN2(first_of_next_level, num_branches + 1); /* index of last branch on this level */
int j;
//Loop all branches on this level
/* Loop all branches on this level */
#pragma omp parallel for private(j) schedule(static)
for (j = i; j < end_j; j++) {
int k;
@ -744,34 +739,34 @@ static void non_recursive_bvh_div_nodes(BVHTree *tree, BVHNode *branches_array,
int parent_leafs_begin = implicit_leafs_index(&data, depth, parent_level_index);
int parent_leafs_end = implicit_leafs_index(&data, depth, parent_level_index + 1);
//This calculates the bounding box of this branch
//and chooses the largest axis as the axis to divide leafs
/* This calculates the bounding box of this branch
* and chooses the largest axis as the axis to divide leafs */
refit_kdop_hull(tree, parent, parent_leafs_begin, parent_leafs_end);
split_axis = get_largest_axis(parent->bv);
//Save split axis (this can be used on raytracing to speedup the query time)
/* Save split axis (this can be used on raytracing to speedup the query time) */
parent->main_axis = split_axis / 2;
//Split the childs along the split_axis, note: its not needed to sort the whole leafs array
//Only to assure that the elements are partioned on a way that each child takes the elements
//it would take in case the whole array was sorted.
//Split_leafs takes care of that "sort" problem.
/* Split the childs along the split_axis, note: its not needed to sort the whole leafs array
* Only to assure that the elements are partioned on a way that each child takes the elements
* it would take in case the whole array was sorted.
* Split_leafs takes care of that "sort" problem. */
nth_positions[0] = parent_leafs_begin;
nth_positions[tree_type] = parent_leafs_end;
for (k = 1; k < tree_type; k++) {
int child_index = j * tree_type + tree_offset + k;
int child_level_index = child_index - first_of_next_level; //child level index
int child_level_index = child_index - first_of_next_level; /* child level index */
nth_positions[k] = implicit_leafs_index(&data, depth + 1, child_level_index);
}
split_leafs(leafs_array, nth_positions, tree_type, split_axis);
//Setup children and totnode counters
//Not really needed but currently most of BVH code relies on having an explicit children structure
/* Setup children and totnode counters
* Not really needed but currently most of BVH code relies on having an explicit children structure */
for (k = 0; k < tree_type; k++) {
int child_index = j * tree_type + tree_offset + k;
int child_level_index = child_index - first_of_next_level; //child level index
int child_level_index = child_index - first_of_next_level; /* child level index */
int child_leafs_begin = implicit_leafs_index(&data, depth + 1, child_level_index);
int child_leafs_end = implicit_leafs_index(&data, depth + 1, child_level_index + 1);
@ -803,7 +798,7 @@ BVHTree *BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis)
BVHTree *tree;
int numnodes, i;
// theres not support for trees below binary-trees :P
/* theres not support for trees below binary-trees :P */
if (tree_type < 2)
return NULL;
@ -812,9 +807,9 @@ BVHTree *BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis)
tree = (BVHTree *)MEM_callocN(sizeof(BVHTree), "BVHTree");
//tree epsilon must be >= FLT_EPSILON
//so that tangent rays can still hit a bounding volume..
//this bug would show up when casting a ray aligned with a kdop-axis and with an edge of 2 faces
/* tree epsilon must be >= FLT_EPSILON
* so that tangent rays can still hit a bounding volume..
* this bug would show up when casting a ray aligned with a kdop-axis and with an edge of 2 faces */
epsilon = MAX2(FLT_EPSILON, epsilon);
if (tree) {
@ -910,20 +905,20 @@ void BLI_bvhtree_balance(BVHTree *tree)
BVHNode *branches_array = tree->nodearray + tree->totleaf;
BVHNode **leafs_array = tree->nodes;
//This function should only be called once (some big bug goes here if its being called more than once per tree)
/* This function should only be called once (some big bug goes here if its being called more than once per tree) */
assert(tree->totbranch == 0);
//Build the implicit tree
/* Build the implicit tree */
non_recursive_bvh_div_nodes(tree, branches_array, leafs_array, tree->totleaf);
//current code expects the branches to be linked to the nodes array
//we perform that linkage here
/*current code expects the branches to be linked to the nodes array
*we perform that linkage here */
tree->totbranch = implicit_needed_branches(tree->tree_type, tree->totleaf);
for (i = 0; i < tree->totbranch; i++)
tree->nodes[tree->totleaf + i] = branches_array + i;
build_skip_links(tree, tree->nodes[tree->totleaf], NULL, NULL);
//bvhtree_info(tree);
/* bvhtree_info(tree); */
}
int BLI_bvhtree_insert(BVHTree *tree, int index, const float *co, int numpoints)
@ -931,14 +926,14 @@ int BLI_bvhtree_insert(BVHTree *tree, int index, const float *co, int numpoints)
int i;
BVHNode *node = NULL;
// insert should only possible as long as tree->totbranch is 0
/* insert should only possible as long as tree->totbranch is 0 */
if (tree->totbranch > 0)
return 0;
if (tree->totleaf + 1 >= MEM_allocN_len(tree->nodes) / sizeof(*(tree->nodes)))
return 0;
// TODO check if have enough nodes in array
/* TODO check if have enough nodes in array */
node = tree->nodes[tree->totleaf] = &(tree->nodearray[tree->totleaf]);
tree->totleaf++;
@ -946,23 +941,23 @@ int BLI_bvhtree_insert(BVHTree *tree, int index, const float *co, int numpoints)
create_kdop_hull(tree, node, co, numpoints, 0);
node->index = index;
// inflate the bv with some epsilon
/* inflate the bv with some epsilon */
for (i = tree->start_axis; i < tree->stop_axis; i++) {
node->bv[(2 * i)] -= tree->epsilon; // minimum
node->bv[(2 * i) + 1] += tree->epsilon; // maximum
node->bv[(2 * i)] -= tree->epsilon; /* minimum */
node->bv[(2 * i) + 1] += tree->epsilon; /* maximum */
}
return 1;
}
// call before BLI_bvhtree_update_tree()
/* call before BLI_bvhtree_update_tree() */
int BLI_bvhtree_update_node(BVHTree *tree, int index, const float *co, const float *co_moving, int numpoints)
{
int i;
BVHNode *node = NULL;
// check if index exists
/* check if index exists */
if (index > tree->totleaf)
return 0;
@ -982,12 +977,12 @@ int BLI_bvhtree_update_node(BVHTree *tree, int index, const float *co, const flo
return 1;
}
// call BLI_bvhtree_update_node() first for every node/point/triangle
/* call BLI_bvhtree_update_node() first for every node/point/triangle */
void BLI_bvhtree_update_tree(BVHTree *tree)
{
//Update bottom=>top
//TRICKY: the way we build the tree all the childs have an index greater than the parent
//This allows us todo a bottom up update by starting on the biger numbered branch
/* Update bottom=>top
* TRICKY: the way we build the tree all the childs have an index greater than the parent
* This allows us todo a bottom up update by starting on the biger numbered branch */
BVHNode **root = tree->nodes + tree->totleaf;
BVHNode **index = tree->nodes + tree->totleaf + tree->totbranch - 1;
@ -1004,8 +999,8 @@ float BLI_bvhtree_getepsilon(BVHTree *tree)
/*
* BLI_bvhtree_overlap
*/
// overlap - is it possbile for 2 bv's to collide ?
*
* overlap - is it possbile for 2 bv's to collide ? */
static int tree_overlap(BVHNode *node1, BVHNode *node2, int start_axis, int stop_axis)
{
float *bv1 = node1->bv;
@ -1016,7 +1011,7 @@ static int tree_overlap(BVHNode *node1, BVHNode *node2, int start_axis, int stop
bv1 += start_axis << 1;
bv2 += start_axis << 1;
// test all axis if min + max overlap
/* test all axis if min + max overlap */
for (; bv1 != bv1_end; bv1 += 2, bv2 += 2) {
if ((*(bv1) > *(bv2 + 1)) || (*(bv2) > *(bv1 + 1)))
return 0;
@ -1030,9 +1025,9 @@ static void traverse(BVHOverlapData *data, BVHNode *node1, BVHNode *node2)
int j;
if (tree_overlap(node1, node2, data->start_axis, data->stop_axis)) {
// check if node1 is a leaf
/* check if node1 is a leaf */
if (!node1->totnode) {
// check if node2 is a leaf
/* check if node2 is a leaf */
if (!node2->totnode) {
if (node1 == node2) {
@ -1040,7 +1035,7 @@ static void traverse(BVHOverlapData *data, BVHNode *node1, BVHNode *node2)
}
if (data->i >= data->max_overlap) {
// try to make alloc'ed memory bigger
/* try to make alloc'ed memory bigger */
data->overlap = realloc(data->overlap, sizeof(BVHTreeOverlap) * data->max_overlap * 2);
if (!data->overlap) {
@ -1222,14 +1217,14 @@ PUSH_HEAP_BODY(NodeDistance, NodeDistance_priority, heap, heap_size)
static void NodeDistance_pop_heap(NodeDistance *heap, int heap_size)
POP_HEAP_BODY(NodeDistance, NodeDistance_priority, heap, heap_size)
//NN function that uses an heap.. this functions leads to an optimal number of min-distance
//but for normal tri-faces and BV 6-dop.. a simple dfs with local heuristics (as implemented
//in source/blender/blenkernel/intern/shrinkwrap.c) works faster.
//
//It may make sense to use this function if the callback queries are very slow.. or if its impossible
//to get a nice heuristic
//
//this function uses "malloc/free" instead of the MEM_* because it intends to be openmp safe
/* NN function that uses an heap.. this functions leads to an optimal number of min-distance
* but for normal tri-faces and BV 6-dop.. a simple dfs with local heuristics (as implemented
* in source/blender/blenkernel/intern/shrinkwrap.c) works faster.
*
* It may make sense to use this function if the callback queries are very slow.. or if its impossible
* to get a nice heuristic
*
* this function uses "malloc/free" instead of the MEM_* because it intends to be openmp safe */
static void bfs_find_nearest(BVHNearestData *data, BVHNode *node)
{
int i;
@ -1327,11 +1322,11 @@ int BLI_bvhtree_find_nearest(BVHTree *tree, const float co[3], BVHTreeNearest *n
data.nearest.dist = FLT_MAX;
}
//dfs search
/* dfs search */
if (root)
dfs_find_nearest_begin(&data, root);
//copy back results
/* copy back results */
if (nearest) {
memcpy(nearest, &data.nearest, sizeof(*nearest));
}
@ -1347,7 +1342,7 @@ int BLI_bvhtree_find_nearest(BVHTree *tree, const float co[3], BVHTreeNearest *n
*/
//Determines the distance that the ray must travel to hit the bounding volume of the given node
/* Determines the distance that the ray must travel to hit the bounding volume of the given node */
static float ray_nearest_hit(BVHRayCastData *data, float *bv)
{
int i;
@ -1382,11 +1377,11 @@ static float ray_nearest_hit(BVHRayCastData *data, float *bv)
return low;
}
//Determines the distance that the ray must travel to hit the bounding volume of the given node
//Based on Tactical Optimization of Ray/Box Intersection, by Graham Fyffe
//[http://tog.acm.org/resources/RTNews/html/rtnv21n1.html#art9]
//
//TODO this doens't has data->ray.radius in consideration
/* Determines the distance that the ray must travel to hit the bounding volume of the given node
* Based on Tactical Optimization of Ray/Box Intersection, by Graham Fyffe
* [http://tog.acm.org/resources/RTNews/html/rtnv21n1.html#art9]
*
* TODO this doens't has data->ray.radius in consideration */
static float fast_ray_nearest_hit(const BVHRayCastData *data, const BVHNode *node)
{
const float *bv = node->bv;
@ -1413,8 +1408,8 @@ static void dfs_raycast(BVHRayCastData *data, BVHNode *node)
{
int i;
//ray-bv is really fast.. and simple tests revealed its worth to test it
//before calling the ray-primitive functions
/* ray-bv is really fast.. and simple tests revealed its worth to test it
* before calling the ray-primitive functions */
/* XXX: temporary solution for particles until fast_ray_nearest_hit supports ray.radius */
float dist = (data->ray.radius > 0.0f) ? ray_nearest_hit(data, node->bv) : fast_ray_nearest_hit(data, node);
if (dist >= data->hit.dist) return;
@ -1430,7 +1425,7 @@ static void dfs_raycast(BVHRayCastData *data, BVHNode *node)
}
}
else {
//pick loop direction to dive into the tree (based on ray direction and split axis)
/* pick loop direction to dive into the tree (based on ray direction and split axis) */
if (data->ray_dot_axis[(int)node->main_axis] > 0.0f) {
for (i = 0; i != node->totnode; i++) {
dfs_raycast(data, node->children[i]);

@ -136,7 +136,7 @@ DLRBT_Node *BLI_dlrbTree_search(DLRBT_Tree *tree, DLRBT_Comparator_FP cmp_cb, vo
short found = 0;
/* check that there is a comparator to use */
// TODO: if no comparator is supplied, try using the one supplied with the tree...
/* TODO: if no comparator is supplied, try using the one supplied with the tree... */
if (cmp_cb == NULL)
return NULL;
@ -177,7 +177,7 @@ DLRBT_Node *BLI_dlrbTree_search_exact(DLRBT_Tree *tree, DLRBT_Comparator_FP cmp_
short found = 0;
/* check that there is a comparator to use */
// TODO: if no comparator is supplied, try using the one supplied with the tree...
/* TODO: if no comparator is supplied, try using the one supplied with the tree... */
if (cmp_cb == NULL)
return NULL;
@ -217,7 +217,7 @@ DLRBT_Node *BLI_dlrbTree_search_prev(DLRBT_Tree *tree, DLRBT_Comparator_FP cmp_c
DLRBT_Node *node;
/* check that there is a comparator to use */
// TODO: if no comparator is supplied, try using the one supplied with the tree...
/* TODO: if no comparator is supplied, try using the one supplied with the tree... */
if (cmp_cb == NULL)
return NULL;
@ -230,7 +230,7 @@ DLRBT_Node *BLI_dlrbTree_search_prev(DLRBT_Tree *tree, DLRBT_Comparator_FP cmp_c
return node;
/* return the previous node otherwise */
// NOTE: what happens if there is no previous node?
/* NOTE: what happens if there is no previous node? */
return node->prev;
}
@ -244,7 +244,7 @@ DLRBT_Node *BLI_dlrbTree_search_next(DLRBT_Tree *tree, DLRBT_Comparator_FP cmp_c
DLRBT_Node *node;
/* check that there is a comparator to use */
// TODO: if no comparator is supplied, try using the one supplied with the tree...
/* TODO: if no comparator is supplied, try using the one supplied with the tree... */
if (cmp_cb == NULL)
return NULL;
@ -257,7 +257,7 @@ DLRBT_Node *BLI_dlrbTree_search_next(DLRBT_Tree *tree, DLRBT_Comparator_FP cmp_c
return node;
/* return the previous node otherwise */
// NOTE: what happens if there is no previous node?
/* NOTE: what happens if there is no previous node? */
return node->next;
}
@ -513,13 +513,13 @@ DLRBT_Node *BLI_dlrbTree_add(DLRBT_Tree *tree, DLRBT_Comparator_FP cmp_cb,
if (tree == NULL)
return NULL;
// TODO: if no comparator is supplied, try using the one supplied with the tree...
/* TODO: if no comparator is supplied, try using the one supplied with the tree... */
if (cmp_cb == NULL)
return NULL;
// TODO: if no allocator is supplied, try using the one supplied with the tree...
/* TODO: if no allocator is supplied, try using the one supplied with the tree... */
if (new_cb == NULL)
return NULL;
// TODO: if no updater is supplied, try using the one supplied with the tree...
/* TODO: if no updater is supplied, try using the one supplied with the tree... */
/* try to find the nearest node to this one */
parNode = BLI_dlrbTree_search(tree, cmp_cb, data);
@ -586,6 +586,6 @@ DLRBT_Node *BLI_dlrbTree_add(DLRBT_Tree *tree, DLRBT_Comparator_FP cmp_cb,
/* *********************************************** */
/* Remove */
// TODO: this hasn't been coded yet, since this functionality was not needed by the author
/* TODO: this hasn't been coded yet, since this functionality was not needed by the author */
/* *********************************************** */

@ -274,12 +274,12 @@ int BLI_move(const char *file, const char *to)
{
int err;
// windows doesn't support moveing to a directory
// it has to be 'mv filename filename' and not
// 'mv filename destdir'
/* windows doesn't support moveing to a directory
* it has to be 'mv filename filename' and not
* 'mv filename destdir' */
BLI_strncpy(str, to, sizeof(str));
// points 'to' to a directory ?
/* points 'to' to a directory ? */
if (BLI_last_slash(str) == (str + strlen(str) - 1)) {
if (BLI_last_slash(file) != NULL) {
strcat(str, BLI_last_slash(file) + 1);
@ -305,12 +305,12 @@ int BLI_copy(const char *file, const char *to)
{
int err;
// windows doesn't support copying to a directory
// it has to be 'cp filename filename' and not
// 'cp filename destdir'
/* windows doesn't support copying to a directory
* it has to be 'cp filename filename' and not
* 'cp filename destdir' */
BLI_strncpy(str, to, sizeof(str));
// points 'to' to a directory ?
/* points 'to' to a directory ? */
if (BLI_last_slash(str) == (str + strlen(str) - 1)) {
if (BLI_last_slash(file) != NULL) {
strcat(str, BLI_last_slash(file) + 1);

@ -71,12 +71,12 @@ static FT_Error err;
static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vfd)
{
// Blender
/* Blender */
struct Nurb *nu;
struct VChar *che;
struct BezTriple *bezt;
// Freetype2
/* Freetype2 */
FT_GlyphSlot glyph;
FT_UInt glyph_index;
FT_Outline ftoutline;
@ -84,42 +84,42 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
float dx, dy;
int j, k, l, m = 0;
// adjust font size
/* adjust font size */
height = ((double) face->bbox.yMax - (double) face->bbox.yMin);
if (height != 0.0f)
scale = 1.0f / height;
else
scale = 1.0f / 1000.0f;
//
// Generate the character 3D data
//
// Get the FT Glyph index and load the Glyph
/*
* Generate the character 3D data
*
* Get the FT Glyph index and load the Glyph */
glyph_index = FT_Get_Char_Index(face, charcode);
err = FT_Load_Glyph(face, glyph_index, FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP);
// If loading succeeded, convert the FT glyph to the internal format
/* If loading succeeded, convert the FT glyph to the internal format */
if (!err) {
int *npoints;
int *onpoints;
// First we create entry for the new character to the character list
/* First we create entry for the new character to the character list */
che = (VChar *) MEM_callocN(sizeof(struct VChar), "objfnt_char");
BLI_addtail(&vfd->characters, che);
// Take some data for modifying purposes
/* Take some data for modifying purposes */
glyph = face->glyph;
ftoutline = glyph->outline;
// Set the width and character code
/* Set the width and character code */
che->index = charcode;
che->width = glyph->advance.x * scale;
// Start converting the FT data
/* Start converting the FT data */
npoints = (int *)MEM_callocN((ftoutline.n_contours) * sizeof(int), "endpoints");
onpoints = (int *)MEM_callocN((ftoutline.n_contours) * sizeof(int), "onpoints");
// calculate total points of each contour
/* calculate total points of each contour */
for (j = 0; j < ftoutline.n_contours; j++) {
if (j == 0)
npoints[j] = ftoutline.contours[j] + 1;
@ -127,7 +127,7 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
npoints[j] = ftoutline.contours[j] - ftoutline.contours[j - 1];
}
// get number of on-curve points for beziertriples (including conic virtual on-points)
/* get number of on-curve points for beziertriples (including conic virtual on-points) */
for (j = 0; j < ftoutline.n_contours; j++) {
for (k = 0; k < npoints[j]; k++) {
l = (j > 0) ? (k + ftoutline.contours[j - 1] + 1) : k;
@ -145,9 +145,9 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
}
}
//contour loop, bezier & conic styles merged
/* contour loop, bezier & conic styles merged */
for (j = 0; j < ftoutline.n_contours; j++) {
// add new curve
/* add new curve */
nu = (Nurb *)MEM_callocN(sizeof(struct Nurb), "objfnt_nurb");
bezt = (BezTriple *)MEM_callocN((onpoints[j]) * sizeof(BezTriple), "objfnt_bezt");
BLI_addtail(&che->nurbsbase, nu);
@ -159,26 +159,26 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
nu->flagu = CU_NURB_CYCLIC;
nu->bezt = bezt;
//individual curve loop, start-end
/* individual curve loop, start-end */
for (k = 0; k < npoints[j]; k++) {
if (j > 0) l = k + ftoutline.contours[j - 1] + 1; else l = k;
if (k == 0) m = l;
//virtual conic on-curve points
/* virtual conic on-curve points */
if (k < npoints[j] - 1) {
if (ftoutline.tags[l] == FT_Curve_Tag_Conic && ftoutline.tags[l + 1] == FT_Curve_Tag_Conic) {
dx = (ftoutline.points[l].x + ftoutline.points[l + 1].x) * scale / 2.0f;
dy = (ftoutline.points[l].y + ftoutline.points[l + 1].y) * scale / 2.0f;
//left handle
/* left handle */
bezt->vec[0][0] = (dx + (2 * ftoutline.points[l].x) * scale) / 3.0f;
bezt->vec[0][1] = (dy + (2 * ftoutline.points[l].y) * scale) / 3.0f;
//midpoint (virtual on-curve point)
/* midpoint (virtual on-curve point) */
bezt->vec[1][0] = dx;
bezt->vec[1][1] = dy;
//right handle
/* right handle */
bezt->vec[2][0] = (dx + (2 * ftoutline.points[l + 1].x) * scale) / 3.0f;
bezt->vec[2][1] = (dy + (2 * ftoutline.points[l + 1].y) * scale) / 3.0f;
@ -188,9 +188,9 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
}
}
//on-curve points
/* on-curve points */
if (ftoutline.tags[l] == FT_Curve_Tag_On) {
//left handle
/* left handle */
if (k > 0) {
if (ftoutline.tags[l - 1] == FT_Curve_Tag_Cubic) {
bezt->vec[0][0] = ftoutline.points[l - 1].x * scale;
@ -208,7 +208,7 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
bezt->h1 = HD_VECT;
}
}
else { //first point on curve
else { /* first point on curve */
if (ftoutline.tags[ftoutline.contours[j]] == FT_Curve_Tag_Cubic) {
bezt->vec[0][0] = ftoutline.points[ftoutline.contours[j]].x * scale;
bezt->vec[0][1] = ftoutline.points[ftoutline.contours[j]].y * scale;
@ -226,11 +226,11 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
}
}
//midpoint (on-curve point)
/* midpoint (on-curve point) */
bezt->vec[1][0] = ftoutline.points[l].x * scale;
bezt->vec[1][1] = ftoutline.points[l].y * scale;
//right handle
/* right handle */
if (k < (npoints[j] - 1)) {
if (ftoutline.tags[l + 1] == FT_Curve_Tag_Cubic) {
bezt->vec[2][0] = ftoutline.points[l + 1].x * scale;
@ -248,7 +248,7 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
bezt->h2 = HD_VECT;
}
}
else { //last point on curve
else { /* last point on curve */
if (ftoutline.tags[m] == FT_Curve_Tag_Cubic) {
bezt->vec[2][0] = ftoutline.points[m].x * scale;
bezt->vec[2][1] = ftoutline.points[m].y * scale;
@ -266,17 +266,19 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
}
}
// get the handles that are aligned, tricky...
// dist_to_line_v2, check if the three beztriple points are on one line
// len_squared_v2v2, see if there's a distance between the three points
// len_squared_v2v2 again, to check the angle between the handles
// finally, check if one of them is a vector handle
if ((dist_to_line_v2(bezt->vec[0], bezt->vec[1], bezt->vec[2]) < 0.001f) &&
/* get the handles that are aligned, tricky...
* dist_to_line_v2, check if the three beztriple points are on one line
* len_squared_v2v2, see if there's a distance between the three points
* len_squared_v2v2 again, to check the angle between the handles
* finally, check if one of them is a vector handle */
if ((bezt->h1 != HD_VECT && bezt->h2 != HD_VECT) &&
(dist_to_line_v2(bezt->vec[0], bezt->vec[1], bezt->vec[2]) < 0.001f) &&
(len_squared_v2v2(bezt->vec[0], bezt->vec[1]) > 0.0001f * 0.0001f) &&
(len_squared_v2v2(bezt->vec[1], bezt->vec[2]) > 0.0001f * 0.0001f) &&
(len_squared_v2v2(bezt->vec[0], bezt->vec[2]) > 0.0002f * 0.0001f) &&
(len_squared_v2v2(bezt->vec[0], bezt->vec[2]) > MAX2(len_squared_v2v2(bezt->vec[0], bezt->vec[1]), len_squared_v2v2(bezt->vec[1], bezt->vec[2]))) &&
bezt->h1 != HD_VECT && bezt->h2 != HD_VECT)
(len_squared_v2v2(bezt->vec[0], bezt->vec[2]) >
maxf(len_squared_v2v2(bezt->vec[0], bezt->vec[1]),
len_squared_v2v2(bezt->vec[1], bezt->vec[2]))))
{
bezt->h1 = bezt->h2 = HD_ALIGN;
}
@ -292,17 +294,17 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
static int objchr_to_ftvfontdata(VFont *vfont, FT_ULong charcode)
{
// Freetype2
/* Freetype2 */
FT_Face face;
struct TmpFont *tf;
// Find the correct FreeType font
/* Find the correct FreeType font */
tf = BKE_vfont_find_tmpfont(vfont);
// What, no font found. Something strange here
/* What, no font found. Something strange here */
if (!tf) return FALSE;
// Load the font to memory
/* Load the font to memory */
if (tf->pf) {
err = FT_New_Memory_Face(library,
tf->pf->data,
@ -316,17 +318,17 @@ static int objchr_to_ftvfontdata(VFont *vfont, FT_ULong charcode)
return FALSE;
}
// Read the char
/* Read the char */
freetypechar_to_vchar(face, charcode, vfont->data);
// And everything went ok
/* And everything went ok */
return TRUE;
}
static VFontData *objfnt_to_ftvfontdata(PackedFile *pf)
{
// Variables
/* Variables */
FT_Face face;
FT_ULong charcode = 0, lcode;
FT_UInt glyph_index;
@ -341,7 +343,7 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile *pf)
int n;
#endif
// load the freetype font
/* load the freetype font */
err = FT_New_Memory_Face(library,
pf->data,
pf->size,
@ -364,22 +366,22 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile *pf)
if (!found) { return NULL; }
// now, select the charmap for the face object
/* now, select the charmap for the face object */
err = FT_Set_Charmap(face, found);
if (err) { return NULL; }
#endif
// allocate blender font
/* allocate blender font */
vfd = MEM_callocN(sizeof(*vfd), "FTVFontData");
// get the name
/* get the name */
fontname = FT_Get_Postscript_Name(face);
BLI_strncpy(vfd->name, (fontname == NULL) ? "" : fontname, sizeof(vfd->name));
// Extract the first 256 character from TTF
/* Extract the first 256 character from TTF */
lcode = charcode = FT_Get_First_Char(face, &glyph_index);
// No charmap found from the ttf so we need to figure it out
/* No charmap found from the ttf so we need to figure it out */
if (glyph_index == 0) {
FT_CharMap found = NULL;
FT_CharMap charmap;
@ -401,15 +403,15 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile *pf)
lcode = charcode = FT_Get_First_Char(face, &glyph_index);
}
// Load characters
/* Load characters */
while (charcode < 256) {
// Generate the font data
/* Generate the font data */
freetypechar_to_vchar(face, charcode, vfd);
// Next glyph
/* Next glyph */
charcode = FT_Get_Next_Char(face, charcode, &glyph_index);
// Check that we won't start infinite loop
/* Check that we won't start infinite loop */
if (charcode <= lcode)
break;
lcode = charcode;
@ -455,7 +457,7 @@ static int check_freetypefont(PackedFile *pf)
if (!found) { return 0; }
// now, select the charmap for the face object
/* now, select the charmap for the face object */
err = FT_Set_Charmap(face, found);
if (err) { return 0; }
#endif
@ -509,21 +511,21 @@ int BLI_vfontchar_from_freetypefont(VFont *vfont, unsigned long character)
if (!vfont) return FALSE;
// Init Freetype
/* Init Freetype */
err = FT_Init_FreeType(&library);
if (err) {
//XXX error("Failed to load the Freetype font library");
/* XXX error("Failed to load the Freetype font library"); */
return 0;
}
// Load the character
/* Load the character */
success = objchr_to_ftvfontdata(vfont, character);
if (success == FALSE) return FALSE;
// Free Freetype
/* Free Freetype */
FT_Done_FreeType(library);
// Ahh everything ok
/* Ahh everything ok */
return TRUE;
}

@ -554,29 +554,29 @@ static short IsectLLPt2Df(const float x0, const float y0, const float x1, const
* compute slopes, note the cludge for infinity, however, this will
* be close enough
*/
if (fabs(x1 - x0) > 0.000001)
if (fabs(x1 - x0) > 0.000001f)
m1 = (y1 - y0) / (x1 - x0);
else
return -1; /*m1 = (float)1e+10;*/ // close enough to infinity
return -1; /*m1 = (float)1e+10;*/ /* close enough to infinity */
if (fabs(x3 - x2) > 0.000001)
if (fabs(x3 - x2) > 0.000001f)
m2 = (y3 - y2) / (x3 - x2);
else
return -1; /*m2 = (float)1e+10;*/ // close enough to infinity
return -1; /*m2 = (float)1e+10;*/ /* close enough to infinity */
if (fabs(m1 - m2) < 0.000001)
if (fabs(m1 - m2) < 0.000001f)
return -1; /* parallel lines */
// compute constants
/* compute constants */
c1 = (y0 - m1 * x0);
c2 = (y2 - m2 * x2);
// compute the inverse of the determinate
/* compute the inverse of the determinate */
det_inv = 1.0f / (-m1 + m2);
// use Kramers rule to compute xi and yi
/* use Kramers rule to compute xi and yi */
*xi = ((-c2 + c1) * det_inv);
*yi = ((m2 * c1 - m1 * c2) * det_inv);
@ -1123,15 +1123,17 @@ int isect_axial_line_tri_v3(const int axis, const float p1[3], const float p2[3]
float u, v, f;
int a0 = axis, a1 = (axis + 1) % 3, a2 = (axis + 2) % 3;
//return isect_line_tri_v3(p1,p2,v0,v1,v2,lambda);
#if 0
return isect_line_tri_v3(p1,p2,v0,v1,v2,lambda);
///* first a simple bounding box test */
//if (MIN3(v0[a1],v1[a1],v2[a1]) > p1[a1]) return 0;
//if (MIN3(v0[a2],v1[a2],v2[a2]) > p1[a2]) return 0;
//if (MAX3(v0[a1],v1[a1],v2[a1]) < p1[a1]) return 0;
//if (MAX3(v0[a2],v1[a2],v2[a2]) < p1[a2]) return 0;
/* first a simple bounding box test */
if (MIN3(v0[a1],v1[a1],v2[a1]) > p1[a1]) return 0;
if (MIN3(v0[a2],v1[a2],v2[a2]) > p1[a2]) return 0;
if (MAX3(v0[a1],v1[a1],v2[a1]) < p1[a1]) return 0;
if (MAX3(v0[a2],v1[a2],v2[a2]) < p1[a2]) return 0;
///* then a full intersection test */
/* then a full intersection test */
#endif
sub_v3_v3v3(e1, v1, v0);
sub_v3_v3v3(e2, v2, v0);
@ -1331,8 +1333,8 @@ int isect_ray_aabb(const IsectRayAABBData *data, const float bb_min[3],
if (tzmin > tmin)
tmin = tzmin;
// XXX jwilkins: tmax does not need to be updated since we don't use it
// keeping this here for future reference
/* XXX jwilkins: tmax does not need to be updated since we don't use it
* keeping this here for future reference */
//if (tzmax < tmax) tmax = tzmax;
if (tmin_out)
@ -2803,21 +2805,21 @@ static int ff_visible_quad(const float p[3], const float n[3],
if (sd[0] > 0) {
if (sd[1] > 0) {
if (sd[2] > 0) {
// +++
/* +++ */
copy_v3_v3(q0, v0);
copy_v3_v3(q1, v1);
copy_v3_v3(q2, v2);
copy_v3_v3(q3, q2);
}
else if (sd[2] < 0) {
// ++-
/* ++- */
copy_v3_v3(q0, v0);
copy_v3_v3(q1, v1);
vec_add_dir(q2, v1, v2, (sd[1] / (sd[1] - sd[2])));
vec_add_dir(q3, v0, v2, (sd[0] / (sd[0] - sd[2])));
}
else {
// ++0
/* ++0 */
copy_v3_v3(q0, v0);
copy_v3_v3(q1, v1);
copy_v3_v3(q2, v2);
@ -2826,21 +2828,21 @@ static int ff_visible_quad(const float p[3], const float n[3],
}
else if (sd[1] < 0) {
if (sd[2] > 0) {
// +-+
/* +-+ */
copy_v3_v3(q0, v0);
vec_add_dir(q1, v0, v1, (sd[0] / (sd[0] - sd[1])));
vec_add_dir(q2, v1, v2, (sd[1] / (sd[1] - sd[2])));
copy_v3_v3(q3, v2);
}
else if (sd[2] < 0) {
// +--
/* +-- */
copy_v3_v3(q0, v0);
vec_add_dir(q1, v0, v1, (sd[0] / (sd[0] - sd[1])));
vec_add_dir(q2, v0, v2, (sd[0] / (sd[0] - sd[2])));
copy_v3_v3(q3, q2);
}
else {
// +-0
/* +-0 */
copy_v3_v3(q0, v0);
vec_add_dir(q1, v0, v1, (sd[0] / (sd[0] - sd[1])));
copy_v3_v3(q2, v2);
@ -2849,21 +2851,21 @@ static int ff_visible_quad(const float p[3], const float n[3],
}
else {
if (sd[2] > 0) {
// +0+
/* +0+ */
copy_v3_v3(q0, v0);
copy_v3_v3(q1, v1);
copy_v3_v3(q2, v2);
copy_v3_v3(q3, q2);
}
else if (sd[2] < 0) {
// +0-
/* +0- */
copy_v3_v3(q0, v0);
copy_v3_v3(q1, v1);
vec_add_dir(q2, v0, v2, (sd[0] / (sd[0] - sd[2])));
copy_v3_v3(q3, q2);
}
else {
// +00
/* +00 */
copy_v3_v3(q0, v0);
copy_v3_v3(q1, v1);
copy_v3_v3(q2, v2);
@ -2874,21 +2876,21 @@ static int ff_visible_quad(const float p[3], const float n[3],
else if (sd[0] < 0) {
if (sd[1] > 0) {
if (sd[2] > 0) {
// -++
/* -++ */
vec_add_dir(q0, v0, v1, (sd[0] / (sd[0] - sd[1])));
copy_v3_v3(q1, v1);
copy_v3_v3(q2, v2);
vec_add_dir(q3, v0, v2, (sd[0] / (sd[0] - sd[2])));
}
else if (sd[2] < 0) {
// -+-
/* -+- */
vec_add_dir(q0, v0, v1, (sd[0] / (sd[0] - sd[1])));
copy_v3_v3(q1, v1);
vec_add_dir(q2, v1, v2, (sd[1] / (sd[1] - sd[2])));
copy_v3_v3(q3, q2);
}
else {
// -+0
/* -+0 */
vec_add_dir(q0, v0, v1, (sd[0] / (sd[0] - sd[1])));
copy_v3_v3(q1, v1);
copy_v3_v3(q2, v2);
@ -2897,35 +2899,35 @@ static int ff_visible_quad(const float p[3], const float n[3],
}
else if (sd[1] < 0) {
if (sd[2] > 0) {
// --+
/* --+ */
vec_add_dir(q0, v0, v2, (sd[0] / (sd[0] - sd[2])));
vec_add_dir(q1, v1, v2, (sd[1] / (sd[1] - sd[2])));
copy_v3_v3(q2, v2);
copy_v3_v3(q3, q2);
}
else if (sd[2] < 0) {
// ---
/* --- */
return 0;
}
else {
// --0
/* --0 */
return 0;
}
}
else {
if (sd[2] > 0) {
// -0+
/* -0+ */
vec_add_dir(q0, v0, v2, (sd[0] / (sd[0] - sd[2])));
copy_v3_v3(q1, v1);
copy_v3_v3(q2, v2);
copy_v3_v3(q3, q2);
}
else if (sd[2] < 0) {
// -0-
/* -0- */
return 0;
}
else {
// -00
/* -00 */
return 0;
}
}
@ -2933,21 +2935,21 @@ static int ff_visible_quad(const float p[3], const float n[3],
else {
if (sd[1] > 0) {
if (sd[2] > 0) {
// 0++
/* 0++ */
copy_v3_v3(q0, v0);
copy_v3_v3(q1, v1);
copy_v3_v3(q2, v2);
copy_v3_v3(q3, q2);
}
else if (sd[2] < 0) {
// 0+-
/* 0+- */
copy_v3_v3(q0, v0);
copy_v3_v3(q1, v1);
vec_add_dir(q2, v1, v2, (sd[1] / (sd[1] - sd[2])));
copy_v3_v3(q3, q2);
}
else {
// 0+0
/* 0+0 */
copy_v3_v3(q0, v0);
copy_v3_v3(q1, v1);
copy_v3_v3(q2, v2);
@ -2956,35 +2958,35 @@ static int ff_visible_quad(const float p[3], const float n[3],
}
else if (sd[1] < 0) {
if (sd[2] > 0) {
// 0-+
/* 0-+ */
copy_v3_v3(q0, v0);
vec_add_dir(q1, v1, v2, (sd[1] / (sd[1] - sd[2])));
copy_v3_v3(q2, v2);
copy_v3_v3(q3, q2);
}
else if (sd[2] < 0) {
// 0--
/* 0-- */
return 0;
}
else {
// 0-0
/* 0-0 */
return 0;
}
}
else {
if (sd[2] > 0) {
// 00+
/* 00+ */
copy_v3_v3(q0, v0);
copy_v3_v3(q1, v1);
copy_v3_v3(q2, v2);
copy_v3_v3(q3, q2);
}
else if (sd[2] < 0) {
// 00-
/* 00- */
return 0;
}
else {
// 000
/* 000 */
return 0;
}
}

@ -1271,7 +1271,7 @@ int is_negative_m4(float mat[][4])
/* make a 4x4 matrix out of 3 transform components */
/* matrices are made in the order: scale * rot * loc */
// TODO: need to have a version that allows for rotation order...
/* TODO: need to have a version that allows for rotation order... */
void loc_eul_size_to_mat4(float mat[4][4], const float loc[3], const float eul[3], const float size[3])
{

@ -1199,12 +1199,12 @@ typedef struct RotOrderInfo {
*/
static RotOrderInfo rotOrders[] = {
/* i, j, k, n */
{{0, 1, 2}, 0}, // XYZ
{{0, 2, 1}, 1}, // XZY
{{1, 0, 2}, 1}, // YXZ
{{1, 2, 0}, 0}, // YZX
{{2, 0, 1}, 0}, // ZXY
{{2, 1, 0}, 1} // ZYX
{{0, 1, 2}, 0}, /* XYZ */
{{0, 2, 1}, 1}, /* XZY */
{{1, 0, 2}, 1}, /* YXZ */
{{1, 2, 0}, 0}, /* YZX */
{{2, 0, 1}, 0}, /* ZXY */
{{2, 1, 0}, 1} /* ZYX */
};
/* Get relevant pointer to rotation order set from the array

@ -282,8 +282,8 @@ static float npfade(float t)
static float grad(int hash, float x, float y, float z)
{
int h = hash & 15; // CONVERT LO 4 BITS OF HASH CODE
float u = h < 8 ? x : y, // INTO 12 GRADIENT DIRECTIONS.
int h = hash & 15; /* CONVERT LO 4 BITS OF HASH CODE */
float u = h < 8 ? x : y, /* INTO 12 GRADIENT DIRECTIONS. */
v = h < 4 ? y : h == 12 || h == 14 ? x : z;
return ((h & 1) == 0 ? u : -u) + ((h & 2) == 0 ? v : -v);
}
@ -293,21 +293,21 @@ static float newPerlin(float x, float y, float z)
{
int A, AA, AB, B, BA, BB;
float u = floor(x), v = floor(y), w = floor(z);
int X = ((int)u) & 255, Y = ((int)v) & 255, Z = ((int)w) & 255; // FIND UNIT CUBE THAT CONTAINS POINT
x -= u; // FIND RELATIVE X,Y,Z
y -= v; // OF POINT IN CUBE.
int X = ((int)u) & 255, Y = ((int)v) & 255, Z = ((int)w) & 255; /* FIND UNIT CUBE THAT CONTAINS POINT */
x -= u; /* FIND RELATIVE X,Y,Z */
y -= v; /* OF POINT IN CUBE. */
z -= w;
u = npfade(x); // COMPUTE FADE CURVES
v = npfade(y); // FOR EACH OF X,Y,Z.
u = npfade(x); /* COMPUTE FADE CURVES */
v = npfade(y); /* FOR EACH OF X,Y,Z. */
w = npfade(z);
A = hash[X ]+Y; AA = hash[A]+Z; AB = hash[A+1]+Z; // HASH COORDINATES OF
B = hash[X+1]+Y; BA = hash[B]+Z; BB = hash[B+1]+Z; // THE 8 CUBE CORNERS,
return lerp(w, lerp(v, lerp(u, grad(hash[AA ], x, y, z ), // AND ADD
grad(hash[BA ], x - 1, y, z )), // BLENDED
lerp(u, grad(hash[AB ], x, y - 1, z ), // RESULTS
grad(hash[BB ], x - 1, y - 1, z ))), // FROM 8
lerp(v, lerp(u, grad(hash[AA + 1], x, y, z - 1), // CORNERS
grad(hash[BA + 1], x - 1, y, z - 1)), // OF CUBE
A = hash[X ]+Y; AA = hash[A]+Z; AB = hash[A+1]+Z; /* HASH COORDINATES OF */
B = hash[X+1]+Y; BA = hash[B]+Z; BB = hash[B+1]+Z; /* THE 8 CUBE CORNERS, */
return lerp(w, lerp(v, lerp(u, grad(hash[AA ], x, y, z ), /* AND ADD */
grad(hash[BA ], x - 1, y, z )), /* BLENDED */
lerp(u, grad(hash[AB ], x, y - 1, z ), /* RESULTS */
grad(hash[BB ], x - 1, y - 1, z ))), /* FROM 8 */
lerp(v, lerp(u, grad(hash[AA + 1], x, y, z - 1), /* CORNERS */
grad(hash[BA + 1], x - 1, y, z - 1)), /* OF CUBE */
lerp(u, grad(hash[AB + 1], x, y - 1, z - 1),
grad(hash[BB + 1], x - 1, y - 1, z - 1))));
}

@ -178,7 +178,7 @@ char *BLI_getQuotedStr(const char *str, const char *prefix)
startMatch = strstr(str, prefix) + prefixLen + 1;
/* get the end point (i.e. where the next occurance of " is after the starting point) */
endMatch = strchr(startMatch, '"'); // " NOTE: this comment here is just so that my text editor still shows the functions ok...
endMatch = strchr(startMatch, '"'); /* " NOTE: this comment here is just so that my text editor still shows the functions ok... */
/* return the slice indicated */
return BLI_strdupn(startMatch, (size_t)(endMatch - startMatch));
@ -187,8 +187,9 @@ char *BLI_getQuotedStr(const char *str, const char *prefix)
/* Replaces all occurrences of oldText with newText in str, returning a new string that doesn't
* contain the 'replaced' occurrences.
*/
// A rather wasteful string-replacement utility, though this shall do for now...
// Feel free to replace this with an even safe + nicer alternative
/* A rather wasteful string-replacement utility, though this shall do for now...
* Feel free to replace this with an even safe + nicer alternative */
char *BLI_replacestr(char *str, const char *oldText, const char *newText)
{
DynStr *ds = NULL;

@ -56,15 +56,18 @@ float BLI_voxel_sample_nearest(float *data, const int res[3], const float co[3])
return D(data, res, xi, yi, zi);
}
// returns highest integer <= x as integer (slightly faster than floor())
/* returns highest integer <= x as integer (slightly faster than floor()) */
BLI_INLINE int FLOORI(float x)
{
const int r = (int)x;
return ((x >= 0.f) || (float)r == x) ? r : (r - 1);
}
// clamp function, cannot use the CLAMPIS macro, it sometimes returns unwanted results apparently related to gcc optimization flag -fstrict-overflow which is enabled at -O2
// this causes the test (x + 2) < 0 with int x == 2147483647 to return false (x being an integer, x + 2 should wrap around to -2147483647 so the test < 0 should return true, which it doesn't)
/* clamp function, cannot use the CLAMPIS macro, it sometimes returns unwanted results apparently related to
* gcc optimization flag -fstrict-overflow which is enabled at -O2
*
* this causes the test (x + 2) < 0 with int x == 2147483647 to return false (x being an integer,
* x + 2 should wrap around to -2147483647 so the test < 0 should return true, which it doesn't) */
BLI_INLINE int _clamp(int a, int b, int c)
{
return (a < b) ? b : ((a > c) ? c : a);

@ -98,10 +98,10 @@ void RegisterBlendExtension(void)
printf("Registering file extension...");
GetModuleFileName(0, BlPath, MAX_PATH);
// root is HKLM by default
/* root is HKLM by default */
lresult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Classes", 0, KEY_ALL_ACCESS, &root);
if (lresult != ERROR_SUCCESS) {
// try HKCU on failure
/* try HKCU on failure */
usr_mode = TRUE;
lresult = RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Classes", 0, KEY_ALL_ACCESS, &root);
if (lresult != ERROR_SUCCESS)

@ -99,11 +99,11 @@
*/
static BMOpDefine bmo_smooth_vert_def = {
"smooth_vert",
{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, //input vertices
{BMO_OP_SLOT_BOOL, "mirror_clip_x"}, //set vertices close to the x axis before the operation to 0
{BMO_OP_SLOT_BOOL, "mirror_clip_y"}, //set vertices close to the y axis before the operation to 0
{BMO_OP_SLOT_BOOL, "mirror_clip_z"}, //set vertices close to the z axis before the operation to 0
{BMO_OP_SLOT_FLT, "clipdist"}, //clipping threshod for the above three slots
{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertices */
{BMO_OP_SLOT_BOOL, "mirror_clip_x"}, /* set vertices close to the x axis before the operation to 0 */
{BMO_OP_SLOT_BOOL, "mirror_clip_y"}, /* set vertices close to the y axis before the operation to 0 */
{BMO_OP_SLOT_BOOL, "mirror_clip_z"}, /* set vertices close to the z axis before the operation to 0 */
{BMO_OP_SLOT_FLT, "clipdist"}, /* clipping threshod for the above three slots */
{0} /* null-terminating sentinel */,
},
bmo_smooth_vert_exec,
@ -119,7 +119,7 @@ static BMOpDefine bmo_smooth_vert_def = {
static BMOpDefine bmo_recalc_face_normals_def = {
"recalc_face_normals",
{{BMO_OP_SLOT_ELEMENT_BUF, "faces"},
{BMO_OP_SLOT_BOOL, "do_flip"}, //internal flag, used by bmesh_rationalize_normals
{BMO_OP_SLOT_BOOL, "do_flip"}, /* internal flag, used by bmesh_rationalize_normals */
{0} /* null-terminating sentinel */,
},
bmo_recalc_face_normals_exec,
@ -138,10 +138,10 @@ static BMOpDefine bmo_recalc_face_normals_def = {
*/
static BMOpDefine bmo_region_extend_def = {
"region_extend",
{{BMO_OP_SLOT_ELEMENT_BUF, "geom"}, //input geometry
{BMO_OP_SLOT_ELEMENT_BUF, "geomout"}, //output slot, computed boundary geometry.
{BMO_OP_SLOT_BOOL, "constrict"}, //find boundary inside the regions, not outside.
{BMO_OP_SLOT_BOOL, "use_faces"}, //extend from faces instead of edges
{{BMO_OP_SLOT_ELEMENT_BUF, "geom"}, /* input geometry */
{BMO_OP_SLOT_ELEMENT_BUF, "geomout"}, /* output slot, computed boundary geometry. */
{BMO_OP_SLOT_BOOL, "constrict"}, /* find boundary inside the regions, not outside. */
{BMO_OP_SLOT_BOOL, "use_faces"}, /* extend from faces instead of edges */
{0} /* null-terminating sentinel */,
},
bmo_region_extend_exec,
@ -156,9 +156,9 @@ static BMOpDefine bmo_region_extend_def = {
*/
static BMOpDefine bmo_rotate_edges_def = {
"rotate_edges",
{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, //input edges
{BMO_OP_SLOT_ELEMENT_BUF, "edgeout"}, //newly spun edges
{BMO_OP_SLOT_BOOL, "ccw"}, //rotate edge counter-clockwise if true, othewise clockwise
{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edges */
{BMO_OP_SLOT_ELEMENT_BUF, "edgeout"}, /* newly spun edges */
{BMO_OP_SLOT_BOOL, "ccw"}, /* rotate edge counter-clockwise if true, othewise clockwise */
{0} /* null-terminating sentinel */,
},
bmo_rotate_edges_exec,
@ -173,7 +173,7 @@ static BMOpDefine bmo_rotate_edges_def = {
*/
static BMOpDefine bmo_reverse_faces_def = {
"reverse_faces",
{{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, //input faces
{{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
{0} /* null-terminating sentinel */,
},
bmo_reverse_faces_exec,
@ -188,9 +188,9 @@ static BMOpDefine bmo_reverse_faces_def = {
*/
static BMOpDefine bmo_bisect_edges_def = {
"bisect_edges",
{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, //input edges
{BMO_OP_SLOT_INT, "numcuts"}, //number of cuts
{BMO_OP_SLOT_ELEMENT_BUF, "outsplit"}, //newly created vertices and edges
{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edges */
{BMO_OP_SLOT_INT, "numcuts"}, /* number of cuts */
{BMO_OP_SLOT_ELEMENT_BUF, "outsplit"}, /* newly created vertices and edges */
{0} /* null-terminating sentinel */,
},
bmo_bisect_edges_exec,
@ -207,13 +207,13 @@ static BMOpDefine bmo_bisect_edges_def = {
static BMOpDefine bmo_mirror_def = {
"mirror",
{{BMO_OP_SLOT_ELEMENT_BUF, "geom"}, //input geometry
{BMO_OP_SLOT_MAT, "mat"}, //matrix defining the mirror transformation
{BMO_OP_SLOT_FLT, "mergedist"}, //maximum distance for merging. does no merging if 0.
{BMO_OP_SLOT_ELEMENT_BUF, "newout"}, //output geometry, mirrored
{BMO_OP_SLOT_INT, "axis"}, //the axis to use, 0, 1, or 2 for x, y, z
{BMO_OP_SLOT_BOOL, "mirror_u"}, //mirror UVs across the u axis
{BMO_OP_SLOT_BOOL, "mirror_v"}, //mirror UVs across the v axis
{{BMO_OP_SLOT_ELEMENT_BUF, "geom"}, /* input geometry */
{BMO_OP_SLOT_MAT, "mat"}, /* matrix defining the mirror transformation */
{BMO_OP_SLOT_FLT, "mergedist"}, /* maximum distance for merging. does no merging if 0. */
{BMO_OP_SLOT_ELEMENT_BUF, "newout"}, /* output geometry, mirrored */
{BMO_OP_SLOT_INT, "axis"}, /* the axis to use, 0, 1, or 2 for x, y, z */
{BMO_OP_SLOT_BOOL, "mirror_u"}, /* mirror UVs across the u axis */
{BMO_OP_SLOT_BOOL, "mirror_v"}, /* mirror UVs across the v axis */
{0, /* null-terminating sentinel */}},
bmo_mirror_exec,
0,
@ -230,9 +230,9 @@ static BMOpDefine bmo_mirror_def = {
*/
static BMOpDefine bmo_find_doubles_def = {
"find_doubles",
{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, //input vertices
{BMO_OP_SLOT_ELEMENT_BUF, "keep_verts"}, //list of verts to keep
{BMO_OP_SLOT_FLT, "dist"}, //minimum distance
{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertices */
{BMO_OP_SLOT_ELEMENT_BUF, "keep_verts"}, /* list of verts to keep */
{BMO_OP_SLOT_FLT, "dist"}, /* minimum distance */
{BMO_OP_SLOT_MAPPING, "targetmapout"},
{0, /* null-terminating sentinel */}},
bmo_find_doubles_exec,
@ -247,8 +247,8 @@ static BMOpDefine bmo_find_doubles_def = {
*/
static BMOpDefine bmo_remove_doubles_def = {
"remove_doubles",
{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, //input verts
{BMO_OP_SLOT_FLT, "dist"}, //minimum distance
{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input verts */
{BMO_OP_SLOT_FLT, "dist"}, /* minimum distance */
{0, /* null-terminating sentinel */}},
bmo_remove_doubles_exec,
BMO_OP_FLAG_UNTAN_MULTIRES,
@ -263,8 +263,8 @@ static BMOpDefine bmo_remove_doubles_def = {
*/
static BMOpDefine bmo_automerge_def = {
"automerge",
{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, //input verts
{BMO_OP_SLOT_FLT, "dist"}, //minimum distance
{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input verts */
{BMO_OP_SLOT_FLT, "dist"}, /* minimum distance */
{0, /* null-terminating sentinel */}},
bmo_automerge_exec,
BMO_OP_FLAG_UNTAN_MULTIRES,
@ -916,11 +916,11 @@ static BMOpDefine bmo_split_edges_def = {
*/
static BMOpDefine bmo_create_grid_def = {
"create_grid",
{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, //output verts
{BMO_OP_SLOT_INT, "xsegments"}, //number of x segments
{BMO_OP_SLOT_INT, "ysegments"}, //number of y segments
{BMO_OP_SLOT_FLT, "size"}, //size of the grid
{BMO_OP_SLOT_MAT, "mat"}, //matrix to multiply the new geometry with
{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output verts */
{BMO_OP_SLOT_INT, "xsegments"}, /* number of x segments */
{BMO_OP_SLOT_INT, "ysegments"}, /* number of y segments */
{BMO_OP_SLOT_FLT, "size"}, /* size of the grid */
{BMO_OP_SLOT_MAT, "mat"}, /* matrix to multiply the new geometry with */
{0, /* null-terminating sentinel */}},
bmo_create_grid_exec,
0,
@ -933,11 +933,11 @@ static BMOpDefine bmo_create_grid_def = {
*/
static BMOpDefine bmo_create_uvsphere_def = {
"create_uvsphere",
{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, //output verts
{BMO_OP_SLOT_INT, "segments"}, //number of u segments
{BMO_OP_SLOT_INT, "revolutions"}, //number of v segment
{BMO_OP_SLOT_FLT, "diameter"}, //diameter
{BMO_OP_SLOT_MAT, "mat"}, //matrix to multiply the new geometry with--
{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output verts */
{BMO_OP_SLOT_INT, "segments"}, /* number of u segments */
{BMO_OP_SLOT_INT, "revolutions"}, /* number of v segment */
{BMO_OP_SLOT_FLT, "diameter"}, /* diameter */
{BMO_OP_SLOT_MAT, "mat"}, /* matrix to multiply the new geometry with-- */
{0, /* null-terminating sentinel */}},
bmo_create_uvsphere_exec,
0,
@ -950,10 +950,10 @@ static BMOpDefine bmo_create_uvsphere_def = {
*/
static BMOpDefine bmo_create_icosphere_def = {
"create_icosphere",
{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, //output verts
{BMO_OP_SLOT_INT, "subdivisions"}, //how many times to recursively subdivide the sphere
{BMO_OP_SLOT_FLT, "diameter"}, //diameter
{BMO_OP_SLOT_MAT, "mat"}, //matrix to multiply the new geometry with
{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output verts */
{BMO_OP_SLOT_INT, "subdivisions"}, /* how many times to recursively subdivide the sphere */
{BMO_OP_SLOT_FLT, "diameter"}, /* diameter */
{BMO_OP_SLOT_MAT, "mat"}, /* matrix to multiply the new geometry with */
{0, /* null-terminating sentinel */}},
bmo_create_icosphere_exec,
0,
@ -966,8 +966,8 @@ static BMOpDefine bmo_create_icosphere_def = {
*/
static BMOpDefine bmo_create_monkey_def = {
"create_monkey",
{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, //output verts
{BMO_OP_SLOT_MAT, "mat"}, //matrix to multiply the new geometry with--
{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output verts */
{BMO_OP_SLOT_MAT, "mat"}, /* matrix to multiply the new geometry with-- */
{0, /* null-terminating sentinel */}},
bmo_create_monkey_exec,
0,
@ -980,14 +980,14 @@ static BMOpDefine bmo_create_monkey_def = {
*/
static BMOpDefine bmo_create_cone_def = {
"create_cone",
{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, //output verts
{BMO_OP_SLOT_BOOL, "cap_ends"}, //wheter or not to fill in the ends with faces
{BMO_OP_SLOT_BOOL, "cap_tris"}, //fill ends with triangles instead of ngons
{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output verts */
{BMO_OP_SLOT_BOOL, "cap_ends"}, /* wheter or not to fill in the ends with faces */
{BMO_OP_SLOT_BOOL, "cap_tris"}, /* fill ends with triangles instead of ngons */
{BMO_OP_SLOT_INT, "segments"},
{BMO_OP_SLOT_FLT, "diameter1"}, //diameter of one end
{BMO_OP_SLOT_FLT, "diameter2"}, //diameter of the opposite
{BMO_OP_SLOT_FLT, "depth"}, //distance between ends
{BMO_OP_SLOT_MAT, "mat"}, //matrix to multiply the new geometry with--
{BMO_OP_SLOT_FLT, "diameter1"}, /* diameter of one end */
{BMO_OP_SLOT_FLT, "diameter2"}, /* diameter of the opposite */
{BMO_OP_SLOT_FLT, "depth"}, /* distance between ends */
{BMO_OP_SLOT_MAT, "mat"}, /* matrix to multiply the new geometry with-- */
{0, /* null-terminating sentinel */}},
bmo_create_cone_exec,
0,
@ -998,12 +998,12 @@ static BMOpDefine bmo_create_cone_def = {
*/
static BMOpDefine bmo_create_circle_def = {
"create_circle",
{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, //output verts
{BMO_OP_SLOT_BOOL, "cap_ends"}, //wheter or not to fill in the ends with faces
{BMO_OP_SLOT_BOOL, "cap_tris"}, //fill ends with triangles instead of ngons
{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output verts */
{BMO_OP_SLOT_BOOL, "cap_ends"}, /* wheter or not to fill in the ends with faces */
{BMO_OP_SLOT_BOOL, "cap_tris"}, /* fill ends with triangles instead of ngons */
{BMO_OP_SLOT_INT, "segments"},
{BMO_OP_SLOT_FLT, "diameter"}, //diameter of one end
{BMO_OP_SLOT_MAT, "mat"}, //matrix to multiply the new geometry with--
{BMO_OP_SLOT_FLT, "diameter"}, /* diameter of one end */
{BMO_OP_SLOT_MAT, "mat"}, /* matrix to multiply the new geometry with-- */
{0, /* null-terminating sentinel */}},
bmo_create_circle_exec,
0,
@ -1016,9 +1016,9 @@ static BMOpDefine bmo_create_circle_def = {
*/
static BMOpDefine bmo_create_cube_def = {
"create_cube",
{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, //output verts
{BMO_OP_SLOT_FLT, "size"}, //size of the cube
{BMO_OP_SLOT_MAT, "mat"}, //matrix to multiply the new geometry with--
{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output verts */
{BMO_OP_SLOT_FLT, "size"}, /* size of the cube */
{BMO_OP_SLOT_MAT, "mat"}, /* matrix to multiply the new geometry with-- */
{0, /* null-terminating sentinel */}},
bmo_create_cube_exec,
0,

@ -31,6 +31,13 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
/*XXX: This operator doesn't work well (at all?) for flat surfaces with
* >3 sides - creating overlapping faces at times.
* An easy workaround is to add in some noise but this is
* weak and unreliable, ideally this would detect flat surfaces
* (possibly making them into ngons) - see
*/
/* XXX: using 128 for totelem and pchunk of mempool, no idea what good
* values would be though */
#include "BLI_mempool.h"

@ -160,15 +160,13 @@ bool BokehBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffe
return false;
}
static cl_kernel kernel = 0;
void BokehBlurOperation::executeOpenCL(OpenCLDevice* device,
MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer,
MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp,
list<cl_kernel> *clKernelsToCleanUp)
{
if (!kernel) {
kernel = device->COM_clCreateKernel("bokehBlurKernel", NULL);
}
cl_kernel kernel = device->COM_clCreateKernel("bokehBlurKernel", NULL);
cl_int radius = this->getWidth() * this->m_size / 100.0f;
cl_int step = this->getStep();

@ -234,15 +234,13 @@ bool DilateDistanceOperation::determineDependingAreaOfInterest(rcti *input, Read
return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
}
static cl_kernel dilateKernel = 0;
void DilateDistanceOperation::executeOpenCL(OpenCLDevice* device,
MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer,
MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp,
list<cl_kernel> *clKernelsToCleanUp)
{
if (!dilateKernel) {
dilateKernel = device->COM_clCreateKernel("dilateKernel", NULL);
}
cl_kernel dilateKernel = device->COM_clCreateKernel("dilateKernel", NULL);
cl_int distanceSquared = this->m_distance * this->m_distance;
cl_int scope = this->m_scope;
@ -293,15 +291,13 @@ void ErodeDistanceOperation::executePixel(float *color, int x, int y, MemoryBuff
color[0] = value;
}
static cl_kernel erodeKernel = 0;
void ErodeDistanceOperation::executeOpenCL(OpenCLDevice* device,
MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer,
MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp,
list<cl_kernel> *clKernelsToCleanUp)
{
if (!erodeKernel) {
erodeKernel = device->COM_clCreateKernel("erodeKernel", NULL);
}
cl_kernel erodeKernel = device->COM_clCreateKernel("erodeKernel", NULL);
cl_int distanceSquared = this->m_distance * this->m_distance;
cl_int scope = this->m_scope;

@ -130,15 +130,13 @@ void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, Me
}
static cl_kernel defocusKernel = 0;
void VariableSizeBokehBlurOperation::executeOpenCL(OpenCLDevice* device,
MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer,
MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp,
list<cl_kernel> *clKernelsToCleanUp)
{
if (!defocusKernel) {
defocusKernel = device->COM_clCreateKernel("defocusKernel", NULL);
}
cl_kernel defocusKernel = device->COM_clCreateKernel("defocusKernel", NULL);
cl_int step = this->getStep();
cl_int maxBlur = this->m_maxBlur;
cl_float threshold = this->m_threshold;

@ -3011,12 +3011,12 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
}
/* step 5) draw name ............................................... */
// TODO: when renaming, we might not want to draw this, especially if name happens to be longer than channel
/* TODO: when renaming, we might not want to draw this, especially if name happens to be longer than channel */
if (acf->name) {
char name[ANIM_CHAN_NAME_SIZE]; /* hopefully this will be enough! */
/* set text color */
// XXX: if active, highlight differently?
/* XXX: if active, highlight differently? */
if (selected)
UI_ThemeColor(TH_TEXT_HI);
else
@ -3030,7 +3030,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
/* draw red underline if channel is disabled */
if ((ale->type == ANIMTYPE_FCURVE) && (ale->flag & FCURVE_DISABLED)) {
// FIXME: replace hardcoded color here, and check on extents!
/* FIXME: replace hardcoded color here, and check on extents! */
glColor3f(1.0f, 0.0f, 0.0f);
glLineWidth(2.0);
fdrawline((float)(offset), yminc,
@ -3043,7 +3043,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
/* reset offset - now goes from RHS of panel */
offset = 0;
// TODO: when drawing sliders, make those draw instead of these toggles if not enough space
/* TODO: when drawing sliders, make those draw instead of these toggles if not enough space */
if (v2d) {
short draw_sliders = 0;

@ -400,7 +400,7 @@ void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAn
/* compare data, and type as main way of identifying the channel */
if ((ale->data == ale_setting->data) && (ale->type == ale_setting->type)) {
/* we also have to check the ID, this is assigned to, since a block may have multiple users */
// TODO: is the owner-data more revealing?
/* TODO: is the owner-data more revealing? */
if (ale->id == ale_setting->id) {
match = ale;
break;
@ -576,7 +576,7 @@ static int animedit_poll_channels_active(bContext *C)
ScrArea *sa = CTX_wm_area(C);
/* channels region test */
// TODO: could enhance with actually testing if channels region?
/* TODO: could enhance with actually testing if channels region? */
if (ELEM(NULL, sa, CTX_wm_region(C)))
return 0;
/* animation editor test */
@ -593,7 +593,7 @@ static int animedit_poll_channels_nla_tweakmode_off(bContext *C)
Scene *scene = CTX_data_scene(C);
/* channels region test */
// TODO: could enhance with actually testing if channels region?
/* TODO: could enhance with actually testing if channels region? */
if (ELEM(NULL, sa, CTX_wm_region(C)))
return 0;
/* animation editor test */
@ -1317,7 +1317,7 @@ static int animchannels_visibility_set_exec(bContext *C, wmOperator *UNUSED(op))
for (ale = anim_data.first; ale; ale = ale->next) {
/* hack: skip object channels for now, since flushing those will always flush everything, but they are always included */
// TODO: find out why this is the case, and fix that
/* TODO: find out why this is the case, and fix that */
if (ale->type == ANIMTYPE_OBJECT)
continue;
@ -1394,7 +1394,7 @@ static int animchannels_visibility_toggle_exec(bContext *C, wmOperator *UNUSED(o
/* Now set the flags */
for (ale = anim_data.first; ale; ale = ale->next) {
/* hack: skip object channels for now, since flushing those will always flush everything, but they are always included */
// TODO: find out why this is the case, and fix that
/* TODO: find out why this is the case, and fix that */
if (ale->type == ANIMTYPE_OBJECT)
continue;
@ -1736,7 +1736,7 @@ static int animchannels_enable_poll(bContext *C)
ScrArea *sa = CTX_wm_area(C);
/* channels region test */
// TODO: could enhance with actually testing if channels region?
/* TODO: could enhance with actually testing if channels region? */
if (ELEM(NULL, sa, CTX_wm_region(C)))
return 0;
@ -2105,7 +2105,7 @@ static int mouse_anim_channels(bAnimContext *ac, float UNUSED(x), int channel_in
}
/* selectmode -1 is a special case for ActionGroups only, which selects all of the channels underneath it only... */
// TODO: should this feature be extended to work with other channel types too?
/* TODO: should this feature be extended to work with other channel types too? */
if ((selectmode == -1) && (ale->type != ANIMTYPE_GROUP)) {
/* normal channels should not behave normally in this case */
BLI_freelistN(&anim_data);
@ -2113,7 +2113,7 @@ static int mouse_anim_channels(bAnimContext *ac, float UNUSED(x), int channel_in
}
/* action to take depends on what channel we've got */
// WARNING: must keep this in sync with the equivalent function in nla_channels.c
/* WARNING: must keep this in sync with the equivalent function in nla_channels.c */
switch (ale->type) {
case ANIMTYPE_SCENE:
{
@ -2154,7 +2154,7 @@ static int mouse_anim_channels(bAnimContext *ac, float UNUSED(x), int channel_in
Base *b;
/* deselect all */
// TODO: should this deselect all other types of channels too?
/* TODO: should this deselect all other types of channels too? */
for (b = sce->base.first; b; b = b->next) {
b->flag &= ~SELECT;
b->object->flag = b->flag;
@ -2441,7 +2441,7 @@ void ED_operatortypes_animchannels(void)
WM_operatortype_append(ANIM_OT_channels_delete);
// XXX does this need to be a separate operator?
/* XXX does this need to be a separate operator? */
WM_operatortype_append(ANIM_OT_channels_editable_toggle);
WM_operatortype_append(ANIM_OT_channels_move);
@ -2463,7 +2463,7 @@ void ED_keymap_animchannels(wmKeyConfig *keyconf)
/* selection */
/* click-select */
// XXX for now, only leftmouse....
/* XXX for now, only leftmouse.... */
WM_keymap_add_item(keymap, "ANIM_OT_channels_click", LEFTMOUSE, KM_PRESS, 0, 0);
RNA_boolean_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_click", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", TRUE);
RNA_boolean_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_click", LEFTMOUSE, KM_PRESS, KM_CTRL | KM_SHIFT, 0)->ptr, "children_only", TRUE);

@ -382,7 +382,7 @@ float ANIM_unit_mapping_get_factor(Scene *scene, ID *id, FCurve *fcu, short rest
}
}
// TODO: other rotation types here as necessary
/* TODO: other rotation types here as necessary */
}
}

@ -165,7 +165,7 @@ static short actedit_get_context(bAnimContext *ac, SpaceAction *saction)
ac->mode = saction->mode;
return 1;
case SACTCONT_GPENCIL: /* Grease Pencil */ // XXX review how this mode is handled...
case SACTCONT_GPENCIL: /* Grease Pencil */ /* XXX review how this mode is handled... */
/* update scene-pointer (no need to check for pinning yet, as not implemented) */
saction->ads.source = (ID *)ac->scene;
@ -175,10 +175,10 @@ static short actedit_get_context(bAnimContext *ac, SpaceAction *saction)
ac->mode = saction->mode;
return 1;
case SACTCONT_MASK: /* Grease Pencil */ // XXX review how this mode is handled...
case SACTCONT_MASK: /* Grease Pencil */ /* XXX review how this mode is handled... */
/* update scene-pointer (no need to check for pinning yet, as not implemented) */
{
// TODO, other methods to get the mask
/* TODO, other methods to get the mask */
// Sequence *seq = BKE_sequencer_active_get(ac->scene);
//MovieClip *clip = ac->scene->clip;
// struct Mask *mask = seq ? seq->mask : NULL;
@ -1892,7 +1892,7 @@ static size_t animdata_filter_ds_obanim(bAnimContext *ac, ListBase *anim_data, b
void *cdata = NULL;
/* determine the type of expander channels to use */
// this is the best way to do this for now...
/* this is the best way to do this for now... */
ANIMDATA_FILTER_CASES(ob,
{ /* AnimData - no channel, but consider data */ },
{ /* NLA - no channel, but consider data */ },
@ -2123,7 +2123,7 @@ static size_t animdata_filter_dopesheet_scene(bAnimContext *ac, ListBase *anim_d
tmp_items += animdata_filter_ds_nodetree(ac, &tmp_data, ads, (ID *)sce, ntree, filter_mode);
}
// TODO: one day, when sequencer becomes its own datatype, perhaps it should be included here
/* TODO: one day, when sequencer becomes its own datatype, perhaps it should be included here */
}
END_ANIMFILTER_SUBCHANNELS;

@ -145,8 +145,8 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
}
/* putting this all together into the buffer */
// XXX we need to check for invalid names...
// XXX the name length limit needs to be passed in or as some define
/* XXX we need to check for invalid names...
* XXX the name length limit needs to be passed in or as some define */
if (structname)
BLI_snprintf(name, 256, "%s%s (%s)", arrayname, propname, structname);
else
@ -172,7 +172,7 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
BLI_snprintf(name, 256, "\"%s[%d]\"", fcu->rna_path, fcu->array_index);
/* icon for this should be the icon for the base ID */
// TODO: or should we just use the error icon?
/* TODO: or should we just use the error icon? */
icon = RNA_struct_ui_icon(id_ptr.type);
/* tag F-Curve as disabled - as not usable path */

@ -508,8 +508,8 @@ static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, sh
uiItemR(row, &ptr, "default_max", 0, IFACE_("Max"), ICON_NONE);
/* control points header */
// TODO: move this control-point control stuff to using the new special widgets for lists
// the current way is far too cramped
/* TODO: move this control-point control stuff to using the new special widgets for lists
* the current way is far too cramped */
row = uiLayoutRow(layout, FALSE);
block = uiLayoutGetBlock(row);

@ -673,7 +673,7 @@ static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, floa
/* draw keys */
if (keys) {
/* locked channels are less strongly shown, as feedback for locked channels in DopeSheet */
// TODO: allow this opacity factor to be themed?
/* TODO: allow this opacity factor to be themed? */
float kalpha = (channelLocked) ? 0.35f : 1.0f;
for (ak = keys->first; ak; ak = ak->next) {
@ -684,8 +684,8 @@ static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, floa
continue;
/* draw using OpenGL - uglier but faster */
// NOTE1: a previous version of this didn't work nice for some intel cards
// NOTE2: if we wanted to go back to icons, these are icon = (ak->sel & SELECT) ? ICON_SPACE2 : ICON_SPACE3;
/* NOTE1: a previous version of this didn't work nice for some intel cards
* NOTE2: if we wanted to go back to icons, these are icon = (ak->sel & SELECT) ? ICON_SPACE2 : ICON_SPACE3; */
draw_keyframe_shape(ak->cfra, ypos, xscale, 5.0f, (ak->sel & SELECT), ak->key_type, KEYFRAME_SHAPE_BOTH, kalpha);
}
}

@ -136,7 +136,7 @@ bAction *verify_adt_action(ID *id, short add)
}
/* init action if none available yet */
// TODO: need some wizardry to handle NLA stuff correct
/* TODO: need some wizardry to handle NLA stuff correct */
if ((adt->action == NULL) && (add)) {
char actname[sizeof(id->name) - 2];
BLI_snprintf(actname, sizeof(actname), "%sAction", id->name + 2);
@ -257,7 +257,7 @@ int insert_bezt_fcurve(FCurve *fcu, BezTriple *bezt, short flag)
dst->f2 = bezt->f2;
dst->f3 = bezt->f3;
// TODO: perform some other operations?
/* TODO: perform some other operations? */
}
}
/* keyframing modes allow to not replace keyframe */
@ -1693,7 +1693,7 @@ static short object_frame_has_keyframe(Object *ob, float frame, short filter)
return 1;
/* 2. test for time */
// TODO... yet to be implemented (this feature may evolve before then anyway)
/* TODO... yet to be implemented (this feature may evolve before then anyway) */
}
/* try materials */

@ -599,8 +599,8 @@ void ANIM_keyingset_info_unregister(Main *bmain, KeyingSetInfo *ksi)
KeyingSet *ks, *ksn;
/* find relevant builtin KeyingSets which use this, and remove them */
// TODO: this isn't done now, since unregister is really only used atm when we
// reload the scripts, which kindof defeats the purpose of "builtin"?
/* TODO: this isn't done now, since unregister is really only used atm when we
* reload the scripts, which kindof defeats the purpose of "builtin"? */
for (ks = builtin_keyingsets.first; ks; ks = ksn) {
ksn = ks->next;
@ -791,7 +791,7 @@ short ANIM_keyingset_context_ok_poll(bContext *C, KeyingSet *ks)
/* get the associated 'type info' for this KeyingSet */
if (ksi == NULL)
return 0;
// TODO: check for missing callbacks!
/* TODO: check for missing callbacks! */
/* check if it can be used in the current context */
return (ksi->poll(ksi, C));
@ -878,7 +878,7 @@ short ANIM_validate_keyingset(bContext *C, ListBase *dsources, KeyingSet *ks)
/* get the associated 'type info' for this KeyingSet */
if (ksi == NULL)
return MODIFYKEY_MISSING_TYPEINFO;
// TODO: check for missing callbacks!
/* TODO: check for missing callbacks! */
/* check if it can be used in the current context */
if (ksi->poll(ksi, C)) {

@ -191,8 +191,8 @@ void ED_operatormacros_armature(void)
RNA_enum_set(otmacro->ptr, "proportional", 0);
}
// XXX would it be nicer to just be able to have standard extrude_move, but set the forked property separate?
// that would require fixing a properties bug 19733
/* XXX would it be nicer to just be able to have standard extrude_move, but set the forked property separate?
* that would require fixing a properties bug 19733 */
ot = WM_operatortype_append_macro("ARMATURE_OT_extrude_forked", "Extrude Forked",
"Create new bones from the selected joints and move them",
OPTYPE_UNDO | OPTYPE_REGISTER);
@ -218,7 +218,7 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "SKETCH_OT_delete", DELKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "SKETCH_OT_finish_stroke", RIGHTMOUSE, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "SKETCH_OT_cancel_stroke", ESCKEY, KM_PRESS, 0, 0);
// Already part of view3d select
/* Already part of view3d select */
//WM_keymap_add_item(keymap, "SKETCH_OT_select", SELECTMOUSE, KM_PRESS, 0, 0);
/* sketch poll checks mode */
@ -321,7 +321,7 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
WM_keymap_add_menu(keymap, "VIEW3D_MT_pose_apply", AKEY, KM_PRESS, KM_CTRL, 0);
// TODO: clear pose
/* TODO: clear pose */
WM_keymap_add_item(keymap, "POSE_OT_rot_clear", RKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "POSE_OT_loc_clear", GKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "POSE_OT_scale_clear", SKEY, KM_PRESS, KM_ALT, 0);

@ -659,7 +659,7 @@ static int apply_armature_pose2bones_exec(bContext *C, wmOperator *op)
}
/* helpful warnings... */
// TODO: add warnings to be careful about actions, applying deforms first, etc.
/* TODO: add warnings to be careful about actions, applying deforms first, etc. */
if (ob->adt && ob->adt->action)
BKE_report(op->reports, RPT_WARNING, "Actions on this armature will be destroyed by this new rest pose as the transforms stored are relative to the old rest pose");
@ -1194,7 +1194,7 @@ static int separate_armature_exec(bContext *C, wmOperator *UNUSED(op))
*/
/* 1) only edit-base selected */
// TODO: use context iterators for this?
/* TODO: use context iterators for this? */
CTX_DATA_BEGIN(C, Base *, base, visible_bases)
{
if (base->object == obedit) base->flag |= 1;
@ -1402,7 +1402,7 @@ static void selectconnected_posebonechildren(Object *ob, Bone *bone, int extend)
if (!(bone->flag & BONE_CONNECTED) || (bone->flag & BONE_UNSELECTABLE))
return;
// XXX old cruft! use notifiers instead
/* XXX old cruft! use notifiers instead */
//select_actionchannel_by_name (ob->action, bone->name, !(shift));
if (extend)
@ -5404,7 +5404,7 @@ static int hide_unselected_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr
bArmature *arm = ob->data;
if (arm->layer & bone->layer) {
// hrm... typo here?
/* hrm... typo here? */
if ((bone->flag & BONE_SELECTED) == 0) {
bone->flag |= BONE_HIDDEN_P;
if (arm->act_bone == bone)

@ -243,7 +243,7 @@ static void pose_slide_apply_val(tPoseSlideOp *pso, FCurve *fcu, float *val)
* - numerator should be larger than denominator to 'expand' the result
* - perform this weighting a number of times given by the percentage...
*/
int iters = (int)ceil(10.0f * pso->percentage); // TODO: maybe a sensitivity ctrl on top of this is needed
int iters = (int)ceil(10.0f * pso->percentage); /* TODO: maybe a sensitivity ctrl on top of this is needed */
while (iters-- > 0) {
(*val) = (-((sVal * w2) + (eVal * w1)) + ((*val) * 6.0f) ) / 5.0f;
@ -257,7 +257,7 @@ static void pose_slide_apply_val(tPoseSlideOp *pso, FCurve *fcu, float *val)
* - numerator should be smaller than denominator to 'relax' the result
* - perform this weighting a number of times given by the percentage...
*/
int iters = (int)ceil(10.0f * pso->percentage); // TODO: maybe a sensitivity ctrl on top of this is needed
int iters = (int)ceil(10.0f * pso->percentage); /* TODO: maybe a sensitivity ctrl on top of this is needed */
while (iters-- > 0) {
(*val) = ( ((sVal * w2) + (eVal * w1)) + ((*val) * 5.0f) ) / 6.0f;
@ -268,7 +268,7 @@ static void pose_slide_apply_val(tPoseSlideOp *pso, FCurve *fcu, float *val)
case POSESLIDE_BREAKDOWN: /* make the current pose slide around between the endpoints */
{
/* perform simple linear interpolation - coefficient for start must come from pso->percentage... */
// TODO: make this use some kind of spline interpolation instead?
/* TODO: make this use some kind of spline interpolation instead? */
(*val) = ((sVal * w2) + (eVal * w1));
}
break;
@ -417,7 +417,7 @@ static void pose_slide_apply_quat(tPoseSlideOp *pso, tPChanFCurveLink *pfl)
float quat_diff[4], quat_orig[4];
/* calculate the delta transform from the previous to the current */
// TODO: investigate ways to favour one transform more?
/* TODO: investigate ways to favour one transform more? */
sub_qt_qtqt(quat_diff, pchan->quat, quat_prev);
/* make a copy of the original rotation */
@ -428,7 +428,7 @@ static void pose_slide_apply_quat(tPoseSlideOp *pso, tPChanFCurveLink *pfl)
}
else {
float quat_interp[4], quat_orig[4];
int iters = (int)ceil(10.0f * pso->percentage); // TODO: maybe a sensitivity ctrl on top of this is needed
int iters = (int)ceil(10.0f * pso->percentage); /* TODO: maybe a sensitivity ctrl on top of this is needed */
/* perform this blending several times until a satisfactory result is reached */
while (iters-- > 0) {

@ -185,7 +185,7 @@ void poseAnim_mapping_refresh(bContext *C, Scene *scene, Object *ob)
/* old optimize trick... this enforces to bypass the depgraph
* - note: code copied from transform_generics.c -> recalcData()
*/
// FIXME: shouldn't this use the builtin stuff?
/* FIXME: shouldn't this use the builtin stuff? */
if ((arm->flag & ARM_DELAYDEFORM) == 0)
DAG_id_tag_update(&ob->id, OB_RECALC_DATA); /* sets recalc flags */
else

@ -310,7 +310,7 @@ static int poselib_sanitize_exec(bContext *C, wmOperator *op)
/* for each key, make sure there is a corresponding pose */
for (ak = keys.first; ak; ak = ak->next) {
/* check if any pose matches this */
// TODO: don't go looking through the list like this every time...
/* TODO: don't go looking through the list like this every time... */
for (marker = act->markers.first; marker; marker = marker->next) {
if (IS_EQ(marker->frame, (double)ak->cfra)) {
marker->flag = -1;
@ -472,8 +472,8 @@ static int poselib_add_exec(bContext *C, wmOperator *op)
BLI_uniquename(&act->markers, marker, "Pose", '.', offsetof(TimeMarker, name), sizeof(marker->name));
/* use Keying Set to determine what to store for the pose */
// FIXME: in the past, the Keying Set respected selections (LocRotScale), but the current one doesn't (WholeCharacter)
// so perhaps we need either a new Keying Set, or just to add overrides here...
/* FIXME: in the past, the Keying Set respected selections (LocRotScale), but the current one doesn't
* (WholeCharacter) so perhaps we need either a new Keying Set, or just to add overrides here... */
ANIM_apply_keyingset(C, NULL, act, ks, MODIFYKEY_MODE_INSERT, (float)frame);
/* store new 'active' pose number */
@ -824,7 +824,7 @@ static void poselib_backup_restore(tPoseLib_PreviewData *pld)
if (plb->oldprops)
IDP_SyncGroupValues(plb->pchan->prop, plb->oldprops);
// TODO: constraints settings aren't restored yet, even though these could change (though not that likely)
/* TODO: constraints settings aren't restored yet, even though these could change (though not that likely) */
}
}
@ -1663,6 +1663,6 @@ void POSELIB_OT_apply_pose(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
// TODO: make the pose_index into a proper enum instead of a cryptic int...
/* TODO: make the pose_index into a proper enum instead of a cryptic int... */
ot->prop = RNA_def_int(ot->srna, "pose_index", -1, -2, INT_MAX, "Pose", "Index of the pose to apply (-2 for no change to pose, -1 for poselib active pose)", 0, INT_MAX);
}

@ -103,7 +103,7 @@ void ED_armature_enter_posemode(bContext *C, Base *base)
return;
}
// XXX: disabled as this would otherwise cause a nasty loop...
/* XXX: disabled as this would otherwise cause a nasty loop... */
//ED_object_toggle_modes(C, ob->mode);
}
@ -255,7 +255,7 @@ static int pose_calculate_paths_exec(bContext *C, wmOperator *op)
CTX_DATA_END;
/* calculate the bones that now have motionpaths... */
// TODO: only make for the selected bones?
/* TODO: only make for the selected bones? */
ED_pose_recalculate_paths(scene, ob);
/* notifiers for updates */
@ -301,7 +301,7 @@ static int pose_update_paths_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
/* calculate the bones that now have motionpaths... */
// TODO: only make for the selected bones?
/* TODO: only make for the selected bones? */
ED_pose_recalculate_paths(scene, ob);
/* notifiers for updates */

@ -1764,7 +1764,7 @@ int filterSmartReebGraph(ReebGraph *UNUSED(rg), float UNUSED(threshold))
ReebNode *removedNode = NULL;
int merging = 0;
// Assign terminal and middle nodes
/* Assign terminal and middle nodes */
if (arc->head->degree == 1) {
terminalNode = arc->head;
middleNode = arc->tail;
@ -1774,30 +1774,30 @@ int filterSmartReebGraph(ReebGraph *UNUSED(rg), float UNUSED(threshold))
middleNode = arc->head;
}
// If middle node is a normal node, merge to terminal node
/* If middle node is a normal node, merge to terminal node */
if (middleNode->degree == 2) {
merging = 1;
newNode = terminalNode;
removedNode = middleNode;
}
// Otherwise, just plain remove of the arc
/* Otherwise, just plain remove of the arc */
else {
merging = 0;
newNode = middleNode;
removedNode = terminalNode;
}
// Merging arc
/* Merging arc */
if (merging) {
filterArc(rg, newNode, removedNode, arc, 1);
}
else {
// removing arc, so we need to decrease the degree of the remaining node
//newNode->degree--;
/* removing arc, so we need to decrease the degree of the remaining node
*newNode->degree--; */
NodeDegreeDecrement(rg, newNode);
}
// Reset nextArc, it might have changed
/* Reset nextArc, it might have changed */
nextArc = arc->next;
BLI_remlink(&rg->arcs, arc);

@ -215,16 +215,16 @@ static void update_string(Curve *cu)
EditFont *ef = cu->editfont;
int len;
// Free the old curve string
/* Free the old curve string */
MEM_freeN(cu->str);
// Calculate the actual string length in UTF-8 variable characters
/* Calculate the actual string length in UTF-8 variable characters */
len = BLI_wstrlen_utf8(ef->textbuf);
// Alloc memory for UTF-8 variable char length string
/* Alloc memory for UTF-8 variable char length string */
cu->str = MEM_callocN(len + sizeof(wchar_t), "str");
// Copy the wchar to UTF-8
/* Copy the wchar to UTF-8 */
BLI_strncpy_wchar_as_utf8(cu->str, ef->textbuf, len + 1);
}
@ -362,8 +362,8 @@ static int paste_file(bContext *C, ReportList *reports, const char *filename)
strp = MEM_callocN(filelen + 4, "tempstr");
// fread() instead of read(), because windows read() converts text
// to DOS \r\n linebreaks, causing double linebreaks in the 3d text
/* fread() instead of read(), because windows read() converts text
* to DOS \r\n linebreaks, causing double linebreaks in the 3d text */
filelen = fread(strp, 1, filelen, fp);
fclose(fp);
strp[filelen] = 0;
@ -753,7 +753,7 @@ static int paste_selection(Object *obedit, ReportList *reports)
EditFont *ef = cu->editfont;
int len = wcslen(ef->copybuf);
// Verify that the copy buffer => [copy buffer len] + cu->len < MAXTEXT
/* Verify that the copy buffer => [copy buffer len] + cu->len < MAXTEXT */
if (cu->len + len <= MAXTEXT) {
if (len) {
int size = (cu->len * sizeof(wchar_t)) - (cu->pos * sizeof(wchar_t)) + sizeof(wchar_t);
@ -1452,7 +1452,7 @@ void make_editText(Object *obedit)
ef->oldstrinfo = MEM_callocN((MAXTEXT + 4) * sizeof(CharInfo), "oldstrbuf");
}
// Convert the original text to wchar_t
/* Convert the original text to wchar_t */
BLI_strncpy_wchar_from_utf8(ef->textbuf, cu->str, MAXTEXT + 4); /* length is bogus */
wcscpy(ef->oldstr, ef->textbuf);
@ -1468,7 +1468,7 @@ void make_editText(Object *obedit)
else
cu->curinfo = ef->textbufinfo[0];
// Convert to UTF-8
/* Convert to UTF-8 */
update_string(cu);
}
@ -1773,10 +1773,10 @@ static void *editFont_to_undoFont(void *ecu, void *UNUSED(obdata))
EditFont *ef = cu->editfont;
char *str;
// The undo buffer includes [MAXTEXT+6]=actual string and [MAXTEXT+4]*sizeof(CharInfo)=charinfo
/* The undo buffer includes [MAXTEXT+6]=actual string and [MAXTEXT+4]*sizeof(CharInfo)=charinfo */
str = MEM_callocN((MAXTEXT + 6) * sizeof(wchar_t) + (MAXTEXT + 4) * sizeof(CharInfo), "string undo");
// Copy the string and string information
/* Copy the string and string information */
memcpy(str + 4, ef->textbuf, (cu->len + 1) * sizeof(wchar_t));
memcpy(str + 4 + (cu->len + 1) * sizeof(wchar_t), ef->textbufinfo, cu->len * sizeof(CharInfo));

@ -683,7 +683,7 @@ void draw_gpencil_2dimage(const bContext *C)
{
/* just draw using standard scaling (settings here are currently ignored anyways) */
// FIXME: the opengl poly-strokes don't draw at right thickness when done this way, so disabled
/* FIXME: the opengl poly-strokes don't draw at right thickness when done this way, so disabled */
offsx = 0;
offsy = 0;
sizex = ar->winx;
@ -740,7 +740,7 @@ void draw_gpencil_view2d(const bContext *C, short onlyv2d)
if (gpd == NULL) return;
/* special hack for Image Editor */
// FIXME: the opengl poly-strokes don't draw at right thickness when done this way, so disabled
/* FIXME: the opengl poly-strokes don't draw at right thickness when done this way, so disabled */
if (ELEM(sa->spacetype, SPACE_IMAGE, SPACE_CLIP))
dflag |= GP_DRAWDATA_IEDITHACK;

@ -93,7 +93,7 @@ bGPdata **gpencil_data_get_pointers(const bContext *C, PointerRNA *ptr)
{
Object *ob = CTX_data_active_object(C);
// TODO: we can include other data-types such as bones later if need be...
/* TODO: we can include other data-types such as bones later if need be... */
/* just in case no active object */
if (ob) {
@ -126,7 +126,7 @@ bGPdata **gpencil_data_get_pointers(const bContext *C, PointerRNA *ptr)
SpaceSeq *sseq = (SpaceSeq *)CTX_wm_space_data(C);
/* for now, Grease Pencil data is associated with the space (actually preview region only) */
// XXX our convention for everything else is to link to data though...
/* XXX our convention for everything else is to link to data though... */
if (ptr) RNA_pointer_create(screen_id, &RNA_SpaceSequenceEditor, sseq, ptr);
return &sseq->gpd;
}
@ -137,7 +137,7 @@ bGPdata **gpencil_data_get_pointers(const bContext *C, PointerRNA *ptr)
SpaceImage *sima = (SpaceImage *)CTX_wm_space_data(C);
/* for now, Grease Pencil data is associated with the space... */
// XXX our convention for everything else is to link to data though...
/* XXX our convention for everything else is to link to data though... */
if (ptr) RNA_pointer_create(screen_id, &RNA_SpaceImageEditor, sima, ptr);
return &sima->gpd;
}

@ -1624,10 +1624,10 @@ static int gpencil_draw_invoke(bContext *C, wmOperator *op, wmEvent *event)
else
p = op->customdata;
// TODO: set any additional settings that we can take from the events?
// TODO? if tablet is erasing, force eraser to be on?
/* TODO: set any additional settings that we can take from the events?
* TODO? if tablet is erasing, force eraser to be on? */
// TODO: move cursor setting stuff to stroke-start so that paintmode can be changed midway...
/* TODO: move cursor setting stuff to stroke-start so that paintmode can be changed midway... */
/* if eraser is on, draw radial aid */
if (p->paintmode == GP_PAINTMODE_ERASER) {
@ -1692,8 +1692,8 @@ static tGPsdata *gpencil_stroke_begin(bContext *C, wmOperator *op)
//printf("\t\tGP - start stroke\n");
/* we may need to set up paint env again if we're resuming */
// XXX: watch it with the paintmode! in future, it'd be nice to allow changing paint-mode when in sketching-sessions
// XXX: with tablet events, we may event want to check for eraser here, for nicer tablet support
/* XXX: watch it with the paintmode! in future, it'd be nice to allow changing paint-mode when in sketching-sessions */
/* XXX: with tablet events, we may event want to check for eraser here, for nicer tablet support */
if (gp_session_initdata(C, p))
gp_paint_initstroke(p, p->paintmode);
@ -1727,17 +1727,17 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, wmEvent *event)
tGPsdata *p = op->customdata;
int estate = OPERATOR_PASS_THROUGH; /* default exit state - not handled, so let others have a share of the pie */
// if (event->type == NDOF_MOTION)
// return OPERATOR_PASS_THROUGH;
// -------------------------------
// [mce] Not quite what I was looking
// for, but a good start! GP continues to
// draw on the screen while the 3D mouse
// moves the viewpoint. Problem is that
// the stroke is converted to 3D only after
// it is finished. This approach should work
// better in tools that immediately apply
// in 3D space.
/* if (event->type == NDOF_MOTION)
* return OPERATOR_PASS_THROUGH;
* -------------------------------
* [mce] Not quite what I was looking
* for, but a good start! GP continues to
* draw on the screen while the 3D mouse
* moves the viewpoint. Problem is that
* the stroke is converted to 3D only after
* it is finished. This approach should work
* better in tools that immediately apply
* in 3D space. */
//printf("\tGP - handle modal event...\n");

@ -524,8 +524,8 @@ static void ui_draw_links(uiBlock *block)
uiBut *but;
uiLinkLine *line;
// Draw the inactive lines (lines with neither button being hovered over).
// As we go, remember if we see any active or selected lines.
/* Draw the inactive lines (lines with neither button being hovered over).
* As we go, remember if we see any active or selected lines. */
int foundselectline = 0;
int foundactiveline = 0;
for (but = block->buttons.first; but; but = but->next) {
@ -542,8 +542,8 @@ static void ui_draw_links(uiBlock *block)
}
}
// Draw any active lines (lines with either button being hovered over).
// Do this last so they appear on top of inactive lines.
/* Draw any active lines (lines with either button being hovered over).
* Do this last so they appear on top of inactive lines. */
if (foundactiveline) {
for (but = block->buttons.first; but; but = but->next) {
if (but->type == LINK && but->link) {
@ -2486,7 +2486,7 @@ static void ui_block_do_align_but(uiBut *first, short nr)
/* merge coordinates */
if (prev) {
// simple cases
/* simple cases */
if (rows == 0) {
but->x1 = (prev->x2 + but->x1) / 2.0f;
prev->x2 = but->x1;
@ -3432,7 +3432,7 @@ int uiButGetUnitType(uiBut *but)
/* own unit define always takes precedence over RNA provided, allowing for overriding
* default value provided in RNA in a few special cases (i.e. Active Keyframe in Graph Edit)
*/
// XXX: this doesn't allow clearing unit completely, though the same could be said for icons
/* XXX: this doesn't allow clearing unit completely, though the same could be said for icons */
if ((ownUnit != 0) || (but->rnaprop == NULL)) {
return ownUnit << 16;
}

@ -141,7 +141,7 @@ int ui_but_anim_expression_create(uiBut *but, const char *str)
}
/* make sure we have animdata for this */
// FIXME: until materials can be handled by depsgraph, don't allow drivers to be created for them
/* FIXME: until materials can be handled by depsgraph, don't allow drivers to be created for them */
id = (ID *)but->rnapoin.id.data;
if ((id == NULL) || (GS(id->name) == ID_MA) || (GS(id->name) == ID_TE)) {
if (G.debug & G_DEBUG)
@ -162,7 +162,7 @@ int ui_but_anim_expression_create(uiBut *but, const char *str)
driver->type = DRIVER_TYPE_PYTHON;
/* set the expression */
// TODO: need some way of identifying variables used
/* TODO: need some way of identifying variables used */
BLI_strncpy_utf8(driver->expression, str, sizeof(driver->expression));
/* updates */
@ -188,7 +188,7 @@ void ui_but_anim_autokey(bContext *C, uiBut *but, Scene *scene, float cfra)
if (fcu && !driven) {
id = but->rnapoin.id.data;
// TODO: this should probably respect the keyingset only option for anim
/* TODO: this should probably respect the keyingset only option for anim */
if (autokeyframe_cfra_can_key(scene, id)) {
ReportList *reports = CTX_wm_reports(C);
short flag = ANIM_get_keyframing_flags(scene, 1);

@ -441,7 +441,7 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(w
w = (rect->xmax - rect->xmin);
h = (rect->ymax - rect->ymin);
// prevent drawing outside widget area
/* prevent drawing outside widget area */
glGetIntegerv(GL_SCISSOR_BOX, scissor);
glScissor(ar->winrct.xmin + rect->xmin, ar->winrct.ymin + rect->ymin, w, h);
#endif
@ -509,7 +509,7 @@ static void ui_draw_but_CHARTAB(uiBut *but)
/* Set the font, in case it is not FO_BUILTIN_NAME font */
if (G.selfont && strcmp(G.selfont->name, FO_BUILTIN_NAME)) {
// Is the font file packed, if so then use the packed file
/* Is the font file packed, if so then use the packed file */
if (G.selfont->packedfile) {
pf = G.selfont->packedfile;
FTF_SetFont(pf->data, pf->size, 14.0);
@ -537,15 +537,15 @@ static void ui_draw_but_CHARTAB(uiBut *but)
glColor3ub(0, 0, 0);
for (y = 0; y < 6; y++) {
// Do not draw more than the category allows
/* Do not draw more than the category allows */
if (cs > charmax) break;
for (x = 0; x < 12; x++)
{
// Do not draw more than the category allows
/* Do not draw more than the category allows */
if (cs > charmax) break;
// Draw one grid cell
/* Draw one grid cell */
glBegin(GL_LINE_LOOP);
glVertex2f(sx, sy);
glVertex2f(ex, sy);
@ -553,11 +553,11 @@ static void ui_draw_but_CHARTAB(uiBut *but)
glVertex2f(sx, ey);
glEnd();
// Draw character inside the cell
/* Draw character inside the cell */
memset(wstr, 0, sizeof(wchar_t) * 2);
memset(ustr, 0, 16);
// Set the font to be either unicode or FO_BUILTIN_NAME
/* Set the font to be either unicode or FO_BUILTIN_NAME */
wstr[0] = cs;
if (strcmp(G.selfont->name, FO_BUILTIN_NAME)) {
BLI_strncpy_wchar_as_utf8((char *)ustr, (wchar_t *)wstr, sizeof(ustr));
@ -580,17 +580,17 @@ static void ui_draw_but_CHARTAB(uiBut *but)
float dx, dy;
float px, py;
// Calculate the position
/* Calculate the position */
wid = FTF_GetStringWidth((char *) ustr, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
FTF_GetBoundingBox((char *) ustr, &llx, &lly, &llz, &urx, &ury, &urz, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
dx = urx - llx;
dy = ury - lly;
// This isn't fully functional since the but->aspect isn't working like I suspected
/* This isn't fully functional since the but->aspect isn't working like I suspected */
px = sx + ((butw / but->aspect) - dx) / 2;
py = sy + ((buth / but->aspect) - dy) / 2;
// Set the position and draw the character
/* Set the position and draw the character */
ui_rasterpos_safe(px, py, but->aspect);
FTF_DrawString((char *) ustr, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
}
@ -599,7 +599,7 @@ static void ui_draw_but_CHARTAB(uiBut *but)
UI_DrawString(but->font, (char *) ustr, 0);
}
// Calculate the next position and character
/* Calculate the next position and character */
sx += butw; ex += butw;
cs++;
}
@ -1571,9 +1571,9 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc
if (tmpibuf->rect_float)
IMB_rect_from_float(tmpibuf);
// XXX: for debug only
// tmpibuf->ftype = PNG;
// IMB_saveiff(tmpibuf, "sample.png", IB_rect);
/* XXX: for debug only
* tmpibuf->ftype = PNG;
* IMB_saveiff(tmpibuf, "sample.png", IB_rect); */
if (tmpibuf->rect)
scopes->track_preview = tmpibuf;

@ -804,7 +804,7 @@ static void ui_add_smart_controller(bContext *C, uiBut *from, uiBut *to)
break;
}
// only works if the sensor and the actuator are from the same object
/* only works if the sensor and the actuator are from the same object */
if (!act_iter) return;
/* (3) add a new controller */
@ -3478,13 +3478,13 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle
else if (event->type == WHEELDOWNMOUSE) {
float *hsv = ui_block_hsv_get(but->block);
hsv[2] = CLAMPIS(hsv[2] - 0.05f, 0.0f, 1.0f);
ui_set_but_hsv(but); // converts to rgb
ui_set_but_hsv(but); /* converts to rgb */
ui_numedit_apply(C, block, but, data);
}
else if (event->type == WHEELUPMOUSE) {
float *hsv = ui_block_hsv_get(but->block);
hsv[2] = CLAMPIS(hsv[2] + 0.05f, 0.0f, 1.0f);
ui_set_but_hsv(but); // converts to rgb
ui_set_but_hsv(but); /* converts to rgb */
ui_numedit_apply(C, block, but, data);
}
else if (event->type == MOUSEMOVE) {
@ -3810,7 +3810,7 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
static int in_scope_resize_zone(uiBut *but, int UNUSED(x), int y)
{
// bottom corner return (x > but->x2 - SCOPE_RESIZE_PAD) && (y < but->y1 + SCOPE_RESIZE_PAD);
/* bottom corner return (x > but->x2 - SCOPE_RESIZE_PAD) && (y < but->y1 + SCOPE_RESIZE_PAD); */
return (y < but->y1 + SCOPE_RESIZE_PAD);
}
@ -3833,7 +3833,7 @@ static int ui_numedit_but_HISTOGRAM(uiBut *but, uiHandleButtonData *data, int mx
}
else {
/* scale histogram values */
const float yfac = MIN2(powf(hist->ymax, 2.f), 1.f) * 0.5f;
const float yfac = minf(powf(hist->ymax, 2.0f), 1.0f) * 0.5f;
hist->ymax += dy * yfac;
CLAMP(hist->ymax, 1.f, 100.f);
@ -4505,7 +4505,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
}
/* Keying Sets */
// TODO: check on modifyability of Keying Set when doing this
/* TODO: check on modifyability of Keying Set when doing this */
if (is_anim) {
uiItemS(layout);
@ -4529,8 +4529,8 @@ static int ui_but_menu(bContext *C, uiBut *but)
/* Property Operators */
//Copy Property Value
//Paste Property Value
/*Copy Property Value
*Paste Property Value */
if (length) {
uiItemBooleanO(layout, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Reset All to Default Values"),
@ -4566,7 +4566,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
/* keyboard shortcuts */
if ((kmi) && ISKEYBOARD(kmi->type)) {
// would rather use a block but, but gets weirdly positioned...
/* would rather use a block but, but gets weirdly positioned... */
//uiDefBlockBut(block, menu_change_shortcut, but, "Change Shortcut", 0, 0, uiLayoutGetWidth(layout), UI_UNIT_Y, "");
but2 = uiDefIconTextBut(block, BUT, 0, 0, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Change Shortcut"),

@ -1454,21 +1454,21 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
/* when you are outside parent button, safety there should be smaller */
// parent button to left
/* parent button to left */
if (midx < block->minx) block->safety.xmin = block->minx - 3;
else block->safety.xmin = block->minx - 40;
// parent button to right
/* parent button to right */
if (midx > block->maxx) block->safety.xmax = block->maxx + 3;
else block->safety.xmax = block->maxx + 40;
// parent button on bottom
/* parent button on bottom */
if (midy < block->miny) block->safety.ymin = block->miny - 3;
else block->safety.ymin = block->miny - 40;
// parent button on top
/* parent button on top */
if (midy > block->maxy) block->safety.ymax = block->maxy + 3;
else block->safety.ymax = block->maxy + 40;
// exception for switched pulldowns...
/* exception for switched pulldowns... */
if (dir1 && (dir1 & block->direction) == 0) {
if (dir2 == UI_RIGHT) block->safety.xmax = block->maxx + 3;
if (dir2 == UI_LEFT) block->safety.xmin = block->minx - 3;
@ -1862,7 +1862,7 @@ static void ui_update_block_buts_rgb(uiBlock *block, const float rgb[3])
*/
rgb_to_hsv_compat_v(rgb, hsv);
// this updates button strings, is hackish... but button pointers are on stack of caller function
/* this updates button strings, is hackish... but button pointers are on stack of caller function */
for (bt = block->buttons.first; bt; bt = bt->next) {
if (bt->rnaprop) {
@ -2130,8 +2130,8 @@ static void uiBlockPicker(uiBlock *block, float rgba[4], PointerRNA *ptr, Proper
bt = uiDefButR_prop(block, NUMSLI, 0, IFACE_("B "), 0, -100, butwidth, UI_UNIT_Y, ptr, prop, 2, 0.0, 0.0, 0, 3, TIP_("Blue"));
uiButSetFunc(bt, do_picker_rna_cb, bt, NULL);
// could use uiItemFullR(col, ptr, prop, -1, 0, UI_ITEM_R_EXPAND|UI_ITEM_R_SLIDER, "", ICON_NONE);
// but need to use uiButSetFunc for updating other fake buttons
/* could use uiItemFullR(col, ptr, prop, -1, 0, UI_ITEM_R_EXPAND|UI_ITEM_R_SLIDER, "", ICON_NONE);
* but need to use uiButSetFunc for updating other fake buttons */
/* HSV values */
uiBlockBeginAlign(block);

Some files were not shown because too many files have changed in this diff Show More