Merged revision(s) 58994-59032 from trunk/blender into soc-2013-dingto.

This commit is contained in:
Thomas Dinges
2013-08-09 17:30:21 +00:00
23 changed files with 299 additions and 184 deletions

View File

@@ -416,6 +416,10 @@ if(WITH_PYTHON_MODULE)
set(WITH_HEADLESS ON)
endif()
if(NOT WITH_PYTHON)
set(WITH_CYCLES OFF)
endif()
# enable boost for cycles, booleans, audaspace or i18n
# otherwise if the user disabled
if(NOT WITH_BOOST)

View File

@@ -44,6 +44,7 @@ USE_QUIET = (os.environ.get("QUIET", None) is not None)
def main():
source_info = project_source_info.build_info(use_cxx=False, ignore_prefix_list=CHECKER_IGNORE_PREFIX)
source_defines = project_source_info.build_defines_as_args()
check_commands = []
for c, inc_dirs, defs in source_info:
@@ -52,7 +53,8 @@ def main():
CHECKER_ARGS +
[c] +
[("-I%s" % i) for i in inc_dirs] +
[("-D%s" % d) for d in defs]
[("-D%s" % d) for d in defs] +
source_defines
)
check_commands.append((c, cmd))

View File

@@ -42,6 +42,7 @@ USE_QUIET = (os.environ.get("QUIET", None) is not None)
def main():
source_info = project_source_info.build_info(use_cxx=False, ignore_prefix_list=CHECKER_IGNORE_PREFIX)
source_defines = project_source_info.build_defines_as_args()
check_commands = []
for c, inc_dirs, defs in source_info:
@@ -50,7 +51,8 @@ def main():
CHECKER_ARGS +
[c] +
[("-I%s" % i) for i in inc_dirs] +
[("-D%s" % d) for d in defs]
[("-D%s" % d) for d in defs] +
source_defines
)
check_commands.append((c, cmd))

View File

@@ -171,6 +171,26 @@ def build_info(use_c=True, use_cxx=True, ignore_prefix_list=None):
return source
def build_defines_as_source():
"""
Returns a string formatted as an include:
'#defines A=B\n#define....'
"""
import subprocess
# works for both gcc and clang
cmd = (cmake_cache_var("CMAKE_C_COMPILER"), "-dM", "-E", "-")
return subprocess.Popen(cmd,
stdout=subprocess.PIPE,
stdin=subprocess.DEVNULL,
).stdout.read().strip().decode('ascii')
def build_defines_as_args():
return [("-D" + "=".join(l.split(maxsplit=2)[1:]))
for l in build_defines_as_source().split("\n")
if l.startswith('#define')]
# could be moved elsewhere!, this just happens to be used by scripts that also
# use this module.
def queue_processes(process_funcs, job_total=-1):

View File

@@ -348,32 +348,41 @@ static bool object_render_hide(BL::Object b_ob, bool top_level, bool parent_hide
bool hair_present = false;
bool show_emitter = false;
bool hide = false;
bool hide_as_dupli_parent = false;
bool hide_as_dupli_child_original = false;
for(b_ob.particle_systems.begin(b_psys); b_psys != b_ob.particle_systems.end(); ++b_psys) {
if((b_psys->settings().render_type() == BL::ParticleSettings::render_type_PATH) &&
(b_psys->settings().type()==BL::ParticleSettings::type_HAIR))
hair_present = true;
if(b_psys->settings().use_render_emitter()) {
hide = false;
if(b_psys->settings().use_render_emitter())
show_emitter = true;
}
}
/* duplicators hidden by default, except dupliframes which duplicate self */
if(b_ob.is_duplicator())
if(top_level || b_ob.dupli_type() != BL::Object::dupli_type_FRAMES)
hide = true;
hide_as_dupli_parent = true;
/* hide original object for duplis */
BL::Object parent = b_ob.parent();
if(parent && object_render_hide_original(b_ob.type(), parent.dupli_type()))
if(parent_hide)
hide = true;
hide_triangles = (hair_present && !show_emitter);
return hide && !show_emitter;
hide_as_dupli_child_original = true;
if(show_emitter) {
hide_triangles = false;
return (hide_as_dupli_parent || hide_as_dupli_child_original);
}
else if(hair_present) {
hide_triangles = true;
return hide_as_dupli_child_original;
}
else {
hide_triangles = false;
return (hide_as_dupli_parent || hide_as_dupli_child_original);
}
}
static bool object_render_hide_duplis(BL::Object b_ob)

View File

@@ -161,7 +161,7 @@ struct Image *BKE_image_load(struct Main *bmain, const char *filepath);
struct Image *BKE_image_load_exists(const char *filepath);
/* adds image, adds ibuf, generates color or pattern */
struct Image *BKE_image_add_generated(struct Main *bmain, unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short gen_type, float color[4]);
struct Image *BKE_image_add_generated(struct Main *bmain, unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short gen_type, const float color[4]);
/* adds image from imbuf, owns imbuf */
struct Image *BKE_image_add_from_imbuf(struct ImBuf *ibuf);

View File

@@ -1990,36 +1990,35 @@ static void alfa_bezpart(BezTriple *prevbezt, BezTriple *bezt, Nurb *nu, float *
/* make_bevel_list_3D_* funcs, at a minimum these must
* fill in the bezp->quat and bezp->dir values */
/* correct non-cyclic cases by copying direction and rotation
* values onto the first & last end-points */
static void bevel_list_cyclic_fix_3D(BevList *bl)
{
BevPoint *bevp, *bevp1;
bevp = (BevPoint *)(bl + 1);
bevp1 = bevp + 1;
copy_qt_qt(bevp->quat, bevp1->quat);
copy_v3_v3(bevp->dir, bevp1->dir);
copy_v3_v3(bevp->tan, bevp1->tan);
bevp = (BevPoint *)(bl + 1);
bevp += (bl->nr - 1);
bevp1 = bevp - 1;
copy_qt_qt(bevp->quat, bevp1->quat);
copy_v3_v3(bevp->dir, bevp1->dir);
copy_v3_v3(bevp->tan, bevp1->tan);
}
/* utility for make_bevel_list_3D_* funcs */
static void bevel_list_calc_bisect(BevList *bl)
{
BevPoint *bevp2, *bevp1, *bevp0;
int nr;
bool is_cyclic = bl->poly != -1;
bevp2 = (BevPoint *)(bl + 1);
bevp1 = bevp2 + (bl->nr - 1);
bevp0 = bevp1 - 1;
if (is_cyclic) {
bevp2 = (BevPoint *)(bl + 1);
bevp1 = bevp2 + (bl->nr - 1);
bevp0 = bevp1 - 1;
nr = bl->nr;
}
else {
/* If spline is not cyclic, direction of first and
* last bevel points matches direction of CV handle.
*
* This is getting calculated earlier when we know
* CV's handles and here we might simply skip evaluation
* of direction for this guys.
*/
bevp0 = (BevPoint *)(bl + 1);
bevp1 = bevp0 + 1;
bevp2 = bevp1 + 1;
nr = bl->nr - 2;
}
nr = bl->nr;
while (nr--) {
/* totally simple */
bisect_v3_v3v3v3(bevp1->dir, bevp0->vec, bevp1->vec, bevp2->vec);
@@ -2125,22 +2124,30 @@ static void bevel_list_smooth(BevList *bl, int smooth_iter)
static void make_bevel_list_3D_zup(BevList *bl)
{
BevPoint *bevp2, *bevp1, *bevp0; /* standard for all make_bevel_list_3D_* funcs */
int nr;
BevPoint *bevp = (BevPoint *)(bl + 1);
int nr = bl->nr;
bevp2 = (BevPoint *)(bl + 1);
bevp1 = bevp2 + (bl->nr - 1);
bevp0 = bevp1 - 1;
bevel_list_calc_bisect(bl);
nr = bl->nr;
while (nr--) {
/* totally simple */
bisect_v3_v3v3v3(bevp1->dir, bevp0->vec, bevp1->vec, bevp2->vec);
vec_to_quat(bevp1->quat, bevp1->dir, 5, 1);
vec_to_quat(bevp->quat, bevp->dir, 5, 1);
bevp++;
}
}
bevp0 = bevp1;
bevp1 = bevp2;
bevp2++;
static void minimum_twist_between_two_points(BevPoint *current_point, BevPoint *previous_point)
{
float angle = angle_normalized_v3v3(previous_point->dir, current_point->dir);
float q[4];
if (angle > 0.0f) { /* otherwise we can keep as is */
float cross_tmp[3];
cross_v3_v3v3(cross_tmp, previous_point->dir, current_point->dir);
axis_angle_to_quat(q, cross_tmp, angle);
mul_qt_qtqt(current_point->quat, q, previous_point->quat);
}
else {
copy_qt_qt(current_point->quat, previous_point->quat);
}
}
@@ -2163,17 +2170,7 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl)
vec_to_quat(bevp1->quat, bevp1->dir, 5, 1);
}
else {
float angle = angle_normalized_v3v3(bevp0->dir, bevp1->dir);
if (angle > 0.0f) { /* otherwise we can keep as is */
float cross_tmp[3];
cross_v3_v3v3(cross_tmp, bevp0->dir, bevp1->dir);
axis_angle_to_quat(q, cross_tmp, angle);
mul_qt_qtqt(bevp1->quat, q, bevp0->quat);
}
else {
copy_qt_qt(bevp1->quat, bevp0->quat);
}
minimum_twist_between_two_points(bevp1, bevp0);
}
bevp0 = bevp1;
@@ -2244,6 +2241,18 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl)
bevp2++;
}
}
else {
/* Need to correct quat for the last point,
* this is so because previously it was only calculated
* using it's own direction, which might not correspond
* the twist of previous point.
*/
bevp2 = (BevPoint *)(bl + 1);
bevp1 = bevp2 + (bl->nr - 1);
bevp0 = bevp1 - 1;
minimum_twist_between_two_points(bevp1, bevp0);
}
}
static void make_bevel_list_3D_tangent(BevList *bl)
@@ -2254,8 +2263,6 @@ static void make_bevel_list_3D_tangent(BevList *bl)
float bevp0_tan[3];
bevel_list_calc_bisect(bl);
if (bl->poly == -1) /* check its not cyclic */
bevel_list_cyclic_fix_3D(bl); // XXX - run this now so tangents will be right before doing the flipping
bevel_list_flip_tangents(bl);
/* correct the tangents */
@@ -2313,9 +2320,6 @@ static void make_bevel_list_3D(BevList *bl, int smooth_iter, int twist_mode)
break;
}
if (bl->poly == -1) /* check its not cyclic */
bevel_list_cyclic_fix_3D(bl);
if (smooth_iter)
bevel_list_smooth(bl, smooth_iter);
@@ -2401,9 +2405,6 @@ static void make_bevel_list_2D(BevList *bl)
bevp1 = bevp - 1;
bevp->sina = bevp1->sina;
bevp->cosa = bevp1->cosa;
/* correct for the dir/quat, see above why its needed */
bevel_list_cyclic_fix_3D(bl);
}
}
@@ -2512,6 +2513,9 @@ void BKE_curve_bevelList_make(Object *ob)
bezt++;
}
sub_v3_v3v3(bevp->dir, prevbezt->vec[2], prevbezt->vec[1]);
normalize_v3(bevp->dir);
while (a--) {
if (prevbezt->h2 == HD_VECT && bezt->h1 == HD_VECT) {
@@ -2573,6 +2577,10 @@ void BKE_curve_bevelList_make(Object *ob)
bevp->alfa = prevbezt->alfa;
bevp->radius = prevbezt->radius;
bevp->weight = prevbezt->weight;
sub_v3_v3v3(bevp->dir, prevbezt->vec[1], prevbezt->vec[0]);
normalize_v3(bevp->dir);
bl->nr++;
}
}

View File

@@ -653,7 +653,7 @@ Image *BKE_image_load_exists(const char *filepath)
}
static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short gen_type,
float color[4], ColorManagedColorspaceSettings *colorspace_settings)
const float color[4], ColorManagedColorspaceSettings *colorspace_settings)
{
ImBuf *ibuf;
unsigned char *rect = NULL;
@@ -710,7 +710,7 @@ static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, const char
}
/* adds new image block, creates ImBuf and initializes color */
Image *BKE_image_add_generated(Main *bmain, unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short gen_type, float color[4])
Image *BKE_image_add_generated(Main *bmain, unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short gen_type, const float color[4])
{
/* on save, type is changed to FILE in editsima.c */
Image *ima = image_alloc(bmain, name, IMA_SRC_GENERATED, IMA_TYPE_UV_TEST);

View File

@@ -3836,7 +3836,7 @@ static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSetti
for (m = 0; m < MAX_MTEX; m++, mtexp++) {
mtex = *mtexp;
if (mtex && mtex->mapto) {
if (mtex && mtex->tex && mtex->mapto) {
float def = mtex->def_var;
short blend = mtex->blendtype;
short texco = mtex->texco;
@@ -3904,7 +3904,7 @@ void psys_get_texture(ParticleSimulationData *sim, ParticleData *pa, ParticleTex
for (m = 0; m < MAX_MTEX; m++, mtexp++) {
mtex = *mtexp;
if (mtex && mtex->mapto) {
if (mtex && mtex->tex && mtex->mapto) {
float def = mtex->def_var;
short blend = mtex->blendtype;
short texco = mtex->texco;

View File

@@ -328,7 +328,7 @@ void blo_do_versions_oldnewmap_insert(OldNewMap *onm, void *oldaddr, void *newad
oldnewmap_insert(onm, oldaddr, newaddr, nr);
}
static void *oldnewmap_lookup_and_inc(OldNewMap *onm, void *addr)
static void *oldnewmap_lookup_and_inc(OldNewMap *onm, void *addr, bool increase_users)
{
int i;
@@ -338,7 +338,8 @@ static void *oldnewmap_lookup_and_inc(OldNewMap *onm, void *addr)
OldNew *entry = &onm->entries[++onm->lasthit];
if (entry->old == addr) {
entry->nr++;
if (increase_users)
entry->nr++;
return entry->newp;
}
}
@@ -349,7 +350,8 @@ static void *oldnewmap_lookup_and_inc(OldNewMap *onm, void *addr)
if (entry->old == addr) {
onm->lasthit = i;
entry->nr++;
if (increase_users)
entry->nr++;
return entry->newp;
}
}
@@ -1201,34 +1203,39 @@ int BLO_is_a_library(const char *path, char *dir, char *group)
static void *newdataadr(FileData *fd, void *adr) /* only direct databocks */
{
return oldnewmap_lookup_and_inc(fd->datamap, adr);
return oldnewmap_lookup_and_inc(fd->datamap, adr, true);
}
static void *newdataadr_no_us(FileData *fd, void *adr) /* only direct databocks */
{
return oldnewmap_lookup_and_inc(fd->datamap, adr, false);
}
static void *newglobadr(FileData *fd, void *adr) /* direct datablocks with global linking */
{
return oldnewmap_lookup_and_inc(fd->globmap, adr);
return oldnewmap_lookup_and_inc(fd->globmap, adr, true);
}
static void *newimaadr(FileData *fd, void *adr) /* used to restore image data after undo */
{
if (fd->imamap && adr)
return oldnewmap_lookup_and_inc(fd->imamap, adr);
return oldnewmap_lookup_and_inc(fd->imamap, adr, true);
return NULL;
}
static void *newmclipadr(FileData *fd, void *adr) /* used to restore movie clip data after undo */
{
if (fd->movieclipmap && adr)
return oldnewmap_lookup_and_inc(fd->movieclipmap, adr);
return oldnewmap_lookup_and_inc(fd->movieclipmap, adr, true);
return NULL;
}
static void *newpackedadr(FileData *fd, void *adr) /* used to restore packed data after undo */
{
if (fd->packedmap && adr)
return oldnewmap_lookup_and_inc(fd->packedmap, adr);
return oldnewmap_lookup_and_inc(fd->packedmap, adr, true);
return oldnewmap_lookup_and_inc(fd->datamap, adr);
return oldnewmap_lookup_and_inc(fd->datamap, adr, true);
}
@@ -6301,10 +6308,14 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
else if (sl->spacetype == SPACE_OUTLINER) {
SpaceOops *soops = (SpaceOops *) sl;
TreeStore *ts = newdataadr(fd, soops->treestore);
/* use newdataadr_no_us and do not free old memory avoidign double
* frees and use of freed memory. this could happen because of a
* bug fixed in revision 58959 where the treestore memory address
* was not unique */
TreeStore *ts = newdataadr_no_us(fd, soops->treestore);
soops->treestore = NULL;
if (ts) {
TreeStoreElem *elems = newdataadr(fd, ts->data);
TreeStoreElem *elems = newdataadr_no_us(fd, ts->data);
soops->treestore = BLI_mempool_create(sizeof(TreeStoreElem), ts->usedelem,
512, BLI_MEMPOOL_ALLOW_ITER);
@@ -6314,12 +6325,9 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
TreeStoreElem *new_elem = BLI_mempool_alloc(soops->treestore);
*new_elem = elems[i];
}
MEM_freeN(elems);
}
/* we only saved what was used */
soops->storeflag |= SO_TREESTORE_CLEANUP; // at first draw
MEM_freeN(ts);
}
soops->treehash = NULL;
soops->tree.first = soops->tree.last= NULL;
@@ -10164,6 +10172,7 @@ static void expand_texture(FileData *fd, Main *mainvar, Tex *tex)
static void expand_brush(FileData *fd, Main *mainvar, Brush *brush)
{
expand_doit(fd, mainvar, brush->mtex.tex);
expand_doit(fd, mainvar, brush->mask_mtex.tex);
expand_doit(fd, mainvar, brush->clone.image);
}

View File

@@ -66,8 +66,7 @@ void SplitViewerNode::convertToOperations(ExecutionSystem *graph, CompositorCont
addLink(graph, splitViewerOperation->getOutputSocket(), viewerOperation->getInputSocket(0));
if (is_active)
addPreviewOperation(graph, context, viewerOperation->getInputSocket(0));
addPreviewOperation(graph, context, viewerOperation->getInputSocket(0));
graph->addOperation(splitViewerOperation);
graph->addOperation(viewerOperation);

View File

@@ -1147,7 +1147,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
uiBlockSetEmboss(block, UI_EMBOSS);
/* name */
uiDefBut(block, LABEL, B_CONSTRAINT_TEST, typestr, xco + 10, yco, 100, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
uiDefBut(block, LABEL, B_CONSTRAINT_TEST, typestr, xco + 0.5f*UI_UNIT_X, yco, 5 * UI_UNIT_X, 0.9f*UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "");
if (con->flag & CONSTRAINT_DISABLE)
uiLayoutSetRedAlert(row, TRUE);
@@ -1165,9 +1165,9 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
uiBlockSetEmboss(block, UI_EMBOSSN);
/* draw a ghost icon (for proxy) and also a lock beside it, to show that constraint is "proxy locked" */
uiDefIconBut(block, BUT, B_CONSTRAINT_TEST, ICON_GHOST, xco + 244, yco, 19, 19,
uiDefIconBut(block, BUT, B_CONSTRAINT_TEST, ICON_GHOST, xco + 12.2f * UI_UNIT_X, yco, 0.95f * UI_UNIT_X, 0.95f * UI_UNIT_Y,
NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Proxy Protected"));
uiDefIconBut(block, BUT, B_CONSTRAINT_TEST, ICON_LOCKED, xco + 262, yco, 19, 19,
uiDefIconBut(block, BUT, B_CONSTRAINT_TEST, ICON_LOCKED, xco + 13.1f * UI_UNIT_X, yco, 0.95f * UI_UNIT_X, 0.95f * UI_UNIT_Y,
NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Proxy Protected"));
uiBlockSetEmboss(block, UI_EMBOSS);
@@ -1226,7 +1226,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
/* Draw constraint data */
if ((con->flag & CONSTRAINT_EXPAND) == 0) {
(yco) -= 21;
(yco) -= 10.5f * UI_UNIT_Y;
}
else {
box = uiLayoutBox(col);

View File

@@ -61,6 +61,49 @@
/********************* 3d view operators ***********************/
static bool group_link_early_exit_check(Group *group, Object *object)
{
GroupObject *group_object;
for (group_object = group->gobject.first; group_object; group_object = group_object->next) {
if (group_object->ob == object) {
return true;
}
}
return false;
}
static bool check_group_contains_object_recursive(Group *group, Object *object)
{
GroupObject *group_object;
if ((group->id.flag & LIB_DOIT) == 0) {
/* Cycle already exists in groups, let's prevent further crappyness */
return true;
}
group->id.flag &= ~LIB_DOIT;
for (group_object = group->gobject.first; group_object; group_object = group_object->next) {
Object *current_object = group_object->ob;
if (current_object == object) {
return true;
}
if (current_object->dup_group) {
if (check_group_contains_object_recursive(current_object->dup_group, object)) {
return true;
}
}
}
group->id.flag |= LIB_DOIT;
return false;
}
/* can be called with C == NULL */
static EnumPropertyItem *group_object_active_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
{
@@ -123,9 +166,15 @@ static int objects_add_active_exec(bContext *C, wmOperator *op)
/* now add all selected objects from the group */
if (group) {
/* for recursive check */
tag_main_lb(&bmain->group, TRUE);
CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases)
{
if (base->object->dup_group != group) {
if (group_link_early_exit_check(group, base->object))
continue;
if (base->object->dup_group != group && !check_group_contains_object_recursive(group, base->object)) {
BKE_group_object_add(group, base->object, scene, base);
}
else {
@@ -378,47 +427,6 @@ void OBJECT_OT_group_add(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static bool group_link_early_exit_check(Group *group, Object *object)
{
GroupObject *group_object;
for (group_object = group->gobject.first; group_object; group_object = group_object->next) {
if (group_object->ob == object) {
return true;
}
}
return false;
}
static bool check_group_contains_object_recursive(Group *group, Object *object)
{
GroupObject *group_object;
if ((group->id.flag & LIB_DOIT) == 0) {
/* Cycle already exists in groups, let's prevent further crappyness */
return true;
}
group->id.flag &= ~LIB_DOIT;
for (group_object = group->gobject.first; group_object; group_object = group_object->next) {
Object *current_object = group_object->ob;
if (current_object == object) {
return true;
}
if (current_object->dup_group) {
if (check_group_contains_object_recursive(current_object->dup_group, object)) {
return true;
}
}
}
return false;
}
static int group_link_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);

View File

@@ -1378,10 +1378,7 @@ void ED_screen_set(bContext *C, bScreen *sc)
if (id == NULL)
return;
/* check for valid winid */
if (sc->winid != 0 && sc->winid != win->winid)
return;
if (sc->full) { /* find associated full */
bScreen *sc1;
for (sc1 = bmain->screen.first; sc1; sc1 = sc1->id.next) {
@@ -1392,6 +1389,10 @@ void ED_screen_set(bContext *C, bScreen *sc)
}
}
}
/* check for valid winid */
if (sc->winid != 0 && sc->winid != win->winid)
return;
if (oldscreen != sc) {
wmTimer *wt = oldscreen->animtimer;

View File

@@ -420,6 +420,9 @@ static void time_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn)
case NC_SCENE:
{
switch (wmn->data) {
case ND_RENDER_RESULT:
ED_area_tag_redraw(sa);
break;
case ND_OB_ACTIVE:
case ND_FRAME:
ED_area_tag_refresh(sa);
@@ -588,6 +591,7 @@ static void time_header_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa),
case NC_SCENE:
{
switch (wmn->data) {
case ND_RENDER_RESULT:
case ND_OB_SELECT:
case ND_FRAME:
case ND_FRAME_RANGE:

View File

@@ -135,7 +135,7 @@ static int CurvePoint_init(BPy_CurvePoint *self, PyObject *args, PyObject *kwds)
PyDoc_STRVAR(CurvePoint_first_svertex_doc,
"The first SVertex upon which the CurvePoint is built.\n"
"\n"
":type: int");
":type: :class:`SVertex`");
static PyObject *CurvePoint_first_svertex_get(BPy_CurvePoint *self, void *UNUSED(closure))
{
@@ -158,7 +158,7 @@ static int CurvePoint_first_svertex_set(BPy_CurvePoint *self, PyObject *value, v
PyDoc_STRVAR(CurvePoint_second_svertex_doc,
"The second SVertex upon which the CurvePoint is built.\n"
"\n"
":type: int");
":type: :class:`SVertex`");
static PyObject *CurvePoint_second_svertex_get(BPy_CurvePoint *self, void *UNUSED(closure))
{

View File

@@ -371,6 +371,7 @@ static PyObject *SVertex_normals_size_get(BPy_SVertex *self, void *UNUSED(closur
PyDoc_STRVAR(SVertex_viewvertex_doc,
"If this SVertex is also a ViewVertex, this property refers to the\n"
"ViewVertex, and None otherwise.\n"
"\n"
":type: :class:`ViewVertex`");
static PyObject *SVertex_viewvertex_get(BPy_SVertex *self, void *UNUSED(closure))

View File

@@ -164,6 +164,22 @@ static int rna_Meta_is_editmode_get(PointerRNA *ptr)
return (mb->editelems != NULL);
}
static char *rna_MetaElement_path(PointerRNA *ptr)
{
MetaBall *mb = ptr->id.data;
MetaElem *ml = ptr->data;
int index = -1;
if (mb->editelems)
index = BLI_findindex(mb->editelems, ml);
if (index == -1)
index = BLI_findindex(&mb->elems, ml);
if (index == -1)
return NULL;
return BLI_sprintfN("elements[%d]", index);
}
#else
static void rna_def_metaelement(BlenderRNA *brna)
@@ -174,6 +190,7 @@ static void rna_def_metaelement(BlenderRNA *brna)
srna = RNA_def_struct(brna, "MetaElement", NULL);
RNA_def_struct_sdna(srna, "MetaElem");
RNA_def_struct_ui_text(srna, "Meta Element", "Blobby element in a Metaball datablock");
RNA_def_struct_path_func(srna, "rna_MetaElement_path");
RNA_def_struct_ui_icon(srna, ICON_OUTLINER_DATA_META);
/* enums */

View File

@@ -135,6 +135,7 @@ void weightvg_do_mask(int num, const int *indices, float *org_w, const float *ne
/* See mapping note below... */
MappingInfoModifierData t_map;
float (*v_co)[3];
int numVerts = dm->getNumVerts(dm);
/* Use new generic get_texture_coords, but do not modify our DNA struct for it...
* XXX Why use a ModifierData stuff here ? Why not a simple, generic struct for parameters ?
@@ -145,9 +146,9 @@ void weightvg_do_mask(int num, const int *indices, float *org_w, const float *ne
t_map.map_object = tex_map_object;
BLI_strncpy(t_map.uvlayer_name, tex_uvlayer_name, sizeof(t_map.uvlayer_name));
t_map.texmapping = tex_mapping;
v_co = MEM_mallocN(sizeof(*v_co) * num, "WeightVG Modifier, TEX mode, v_co");
v_co = MEM_mallocN(sizeof(*v_co) * numVerts, "WeightVG Modifier, TEX mode, v_co");
dm->getVertCos(dm, v_co);
tex_co = MEM_callocN(sizeof(*tex_co) * num, "WeightVG Modifier, TEX mode, tex_co");
tex_co = MEM_callocN(sizeof(*tex_co) * numVerts, "WeightVG Modifier, TEX mode, tex_co");
get_texture_coords(&t_map, ob, dm, v_co, tex_co, num);
MEM_freeN(v_co);

View File

@@ -31,7 +31,7 @@
static bNodeSocketTemplate sh_node_subsurface_scattering_in[] = {
{ SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("Scale"), 1.0, 0.0f, 0.0f, 0.0f, 0.0f, 1000000.0f},
{ SOCK_FLOAT, 1, N_("Scale"), 1.0, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
{ SOCK_VECTOR, 1, N_("Radius"), 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 100.0f},
//{ SOCK_FLOAT, 1, N_("IOR"), 1.3f, 0.0f, 0.0f, 0.0f, 1.0f, 1000.0f},
{ SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},

View File

@@ -120,8 +120,9 @@ typedef struct ZSpan {
} ZSpan;
/* exported to shadbuf.c */
void zbufclip4(struct ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3, float *f4,
int c1, int c2, int c3, int c4);
void zbufclip4(struct ZSpan *zspan, int obi, int zvlnr,
const float f1[4], const float f2[4], const float f3[4], const float f4[4],
const int c1, const int c2, const int c3, const int c4);
void zbuf_free_span(struct ZSpan *zspan);
void freepsA(struct ListBase *lb);
@@ -130,10 +131,13 @@ void zspan_scanconvert(struct ZSpan *zpan, void *handle, float *v1, float *v2, f
void (*func)(void *, int, int, float, float) );
/* exported to edge render... */
void zbufclip(struct ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3, int c1, int c2, int c3);
void zbufclip(struct ZSpan *zspan, int obi, int zvlnr,
const float f1[4], const float f2[4], const float f3[4],
const int c1, const int c2, const int c3);
void zbuf_alloc_span(struct ZSpan *zspan, int rectx, int recty, float clipcrop);
void zbufclipwire(struct ZSpan *zspan, int obi, int zvlnr, int ec,
float *ho1, float *ho2, float *ho3, float *ho4, int c1, int c2, int c3, int c4);
const float ho1[4], const float ho2[4], const float ho3[4], const float ho4[4],
const int c1, const int c2, const int c3, const int c4);
/* exported to shadeinput.c */
void zbuf_make_winmat(Render *re, float winmat[4][4]);

View File

@@ -107,6 +107,7 @@ static void pointdensity_cache_psys(Render *re, PointDensity *pd, Object *ob, Pa
{
DerivedMesh* dm;
ParticleKey state;
ParticleCacheKey *cache;
ParticleSimulationData sim= {NULL};
ParticleData *pa=NULL;
float cfra = BKE_scene_frame_get(re->scene);
@@ -153,44 +154,62 @@ static void pointdensity_cache_psys(Render *re, PointDensity *pd, Object *ob, Pa
for (i=0, pa=psys->particles; i < total_particles; i++, pa++) {
state.time = cfra;
if (psys_get_particle_state(&sim, i, &state, 0)) {
copy_v3_v3(partco, state.co);
if (pd->psys_cache_space == TEX_PD_OBJECTSPACE)
mul_m4_v3(ob->imat, partco);
else if (pd->psys_cache_space == TEX_PD_OBJECTLOC) {
sub_v3_v3(partco, ob->loc);
}
else {
/* TEX_PD_WORLDSPACE */
}
BLI_bvhtree_insert(pd->point_tree, i, partco, 1);
if (data_used & POINT_DATA_VEL) {
pd->point_data[i*3 + 0] = state.vel[0];
pd->point_data[i*3 + 1] = state.vel[1];
pd->point_data[i*3 + 2] = state.vel[2];
}
if (psys->part->type == PART_HAIR) {
/* hair particles */
if (i < psys->totpart && psys->pathcache)
cache = psys->pathcache[i];
else if (i >= psys->totpart && psys->childcache)
cache = psys->childcache[i - psys->totpart];
else
continue;
cache += cache->steps; /* use endpoint */
copy_v3_v3(state.co, cache->co);
zero_v3(state.vel);
state.time = 0.0f;
}
else {
/* emitter particles */
state.time = cfra;
if (!psys_get_particle_state(&sim, i, &state, 0))
continue;
if (data_used & POINT_DATA_LIFE) {
float pa_time;
if (i < psys->totpart) {
pa_time = (cfra - pa->time)/pa->lifetime;
state.time = (cfra - pa->time)/pa->lifetime;
}
else {
ChildParticle *cpa= (psys->child + i) - psys->totpart;
float pa_birthtime, pa_dietime;
pa_time = psys_get_child_time(psys, cpa, cfra, &pa_birthtime, &pa_dietime);
state.time = psys_get_child_time(psys, cpa, cfra, &pa_birthtime, &pa_dietime);
}
pd->point_data[offset + i] = pa_time;
}
}
copy_v3_v3(partco, state.co);
if (pd->psys_cache_space == TEX_PD_OBJECTSPACE)
mul_m4_v3(ob->imat, partco);
else if (pd->psys_cache_space == TEX_PD_OBJECTLOC) {
sub_v3_v3(partco, ob->loc);
}
else {
/* TEX_PD_WORLDSPACE */
}
BLI_bvhtree_insert(pd->point_tree, i, partco, 1);
if (data_used & POINT_DATA_VEL) {
pd->point_data[i*3 + 0] = state.vel[0];
pd->point_data[i*3 + 1] = state.vel[1];
pd->point_data[i*3 + 2] = state.vel[2];
}
if (data_used & POINT_DATA_LIFE) {
pd->point_data[offset + i] = state.time;
}
}
BLI_bvhtree_balance(pd->point_tree);

View File

@@ -121,7 +121,7 @@ static void zbuf_init_span(ZSpan *zspan)
zspan->minp1= zspan->maxp1= zspan->minp2= zspan->maxp2= NULL;
}
static void zbuf_add_to_span(ZSpan *zspan, const float *v1, const float *v2)
static void zbuf_add_to_span(ZSpan *zspan, const float v1[2], const float v2[2])
{
const float *minv, *maxv;
float *span;
@@ -909,7 +909,9 @@ void hoco_to_zco(ZSpan *zspan, float zco[3], const float hoco[4])
zco[2]= 0x7FFFFFFF *(hoco[2]*div);
}
void zbufclipwire(ZSpan *zspan, int obi, int zvlnr, int ec, float *ho1, float *ho2, float *ho3, float *ho4, int c1, int c2, int c3, int c4)
void zbufclipwire(ZSpan *zspan, int obi, int zvlnr, int ec,
const float ho1[4], const float ho2[4], const float ho3[4], const float ho4[4],
int c1, int c2, int c3, int c4)
{
float vez[20];
int and, or;
@@ -1845,7 +1847,9 @@ void zbuf_make_winmat(Render *re, float winmat[4][4])
/* do zbuffering and clip, f1 f2 f3 are hocos, c1 c2 c3 are clipping flags */
void zbufclip(ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3, int c1, int c2, int c3)
void zbufclip(ZSpan *zspan, int obi, int zvlnr,
const float f1[4], const float f2[4], const float f3[4],
const int c1, const int c2, const int c3)
{
float *vlzp[32][3], lambda[3][2];
float vez[400], *trias[40];
@@ -1856,6 +1860,7 @@ void zbufclip(ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3,
}
else { /* clipping */
int arg, v, b, clipflag[3], b1, b2, b3, c4, clve=3, clvlo, clvl=1;
float *fp;
vez[0]= f1[0]; vez[1]= f1[1]; vez[2]= f1[2]; vez[3]= f1[3];
vez[4]= f2[0]; vez[5]= f2[1]; vez[6]= f2[2]; vez[7]= f2[3];
@@ -1936,16 +1941,16 @@ void zbufclip(ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3,
}
}
/* warning, this should never happen! */
if (clve>38 || clvl>31) printf("clip overflow: clve clvl %d %d\n", clve, clvl);
/* warning, clip overflow, this should never happen! */
BLI_assert(!(clve > 38 || clvl > 31));
/* perspective division */
f1=vez;
for (c1=0;c1<clve;c1++) {
hoco_to_zco(zspan, f1, f1);
f1+=4;
fp = vez;
for (b = 0; b < clve; b++) {
hoco_to_zco(zspan, fp, fp);
fp += 4;
}
for (b=1;b<clvl;b++) {
for (b = 1; b < clvl; b++) {
if (vlzp[b][0]) {
zspan->zbuffunc(zspan, obi, zvlnr, vlzp[b][0], vlzp[b][1], vlzp[b][2], NULL);
}
@@ -1961,7 +1966,9 @@ void zbufclip(ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3,
zspan->zbuffunc(zspan, obi, zvlnr, vez, vez+4, vez+8, NULL);
}
void zbufclip4(ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3, float *f4, int c1, int c2, int c3, int c4)
void zbufclip4(ZSpan *zspan, int obi, int zvlnr,
const float f1[4], const float f2[4], const float f3[4], const float f4[4],
const int c1, const int c2, const int c3, const int c4)
{
float vez[16];