Merging r49005 through r49019 from trunk into soc-2011-tomato

This commit is contained in:
Sergey Sharybin
2012-07-18 10:24:47 +00:00
14 changed files with 385 additions and 145 deletions

View File

@@ -133,9 +133,6 @@ def display_name(name):
mixed case names are kept as is. Intended for use with
filenames and module names.
"""
name = _os.path.splitext(name)[0]
# string replacements
name = name.replace("_colon_", ":")
@@ -154,7 +151,6 @@ def display_name_from_filepath(name):
ensured to be utf8 compatible.
"""
name = _os.path.splitext(basename(name))[0]
name = _clean_utf8(name)
return name

View File

@@ -177,6 +177,8 @@ typedef enum eObjectSet {
} eObjectSet;
struct LinkNode *BKE_object_relational_superset(struct Scene *scene, eObjectSet objectSet, eObRelationTypes includeFilter);
struct LinkNode *BKE_object_groups(struct Object *ob);
void BKE_object_groups_clear(struct Scene *scene, struct Base *base, struct Object *object);
#ifdef __cplusplus
}

View File

@@ -579,6 +579,13 @@ static void spline_feather_collapse_inner_loops(float (*feather_points)[2], int
max_delta = MAX2(max_delta_x, max_delta_y);
buckets_per_side = MIN2(512, 0.9f / max_delta);
if (buckets_per_side == 0) {
/* happens when some segment fills the whole bounding box across some of dimension */
buckets_per_side = 1;
}
tot_bucket = buckets_per_side * buckets_per_side;
bucket_size = 1.0f / buckets_per_side;

View File

@@ -57,6 +57,37 @@
#define TRI_TERMINATOR_ID ((unsigned int) -1)
#define TRI_VERT ((unsigned int) -1)
/* for debugging add... */
/* printf("%u %u %u %u\n", _t[0], _t[1], _t[2], _t[3]); \ */
#define FACE_ASSERT(face, vert_max) \
{ \
unsigned int *_t = face; \
BLI_assert(_t[0] < vert_max); \
BLI_assert(_t[1] < vert_max); \
BLI_assert(_t[2] < vert_max || _t[2] == TRI_VERT); \
} (void)0
void rotate_point(const float cent[2], const float angle, float p[2], const float asp[2])
{
const float s = sinf(angle);
const float c = cosf(angle);
float p_new[2];
/* translate point back to origin */
p[0] -= cent[0];
p[1] -= cent[1];
p[0] /= asp[0];
p[1] /= asp[1];
/* rotate point */
p_new[0] = ((p[0] * c) - (p[1] * s)) * asp[0];
p_new[1] = ((p[0] * s) + (p[1] * c)) * asp[1];
/* translate point back */
p[0] = p_new[0] + cent[0];
p[1] = p_new[1] + cent[1];
}
/* --------------------------------------------------------------------- */
/* local structs for mask rasterizeing */
@@ -690,10 +721,53 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas
tot_feather_quads -= 2;
}
/* ack these are infact tris, but they are extra faces so no matter,
* +1 becausing adding one vert results in 2 tris (joining the existing endpoints)
*/
// tot_feather_quads + ((SPLINE_RESOL_CAP + 1) * 2);
/*cap ends */
if (!is_cyclic) {
unsigned int k;
float asp[2] = {1.0f, 1.0f};
if (do_aspect_correct) {
if (width != height) {
if (width < height) {
asp[1] = (float)width / (float)height;
}
else {
asp[0] = (float)height / (float)width;
}
}
}
for (k = 1; k < SPLINE_RESOL_CAP; k++) {
const float angle = (float)k * (1.0f / SPLINE_RESOL_CAP) * (float)M_PI;
copy_v2_v2(co_feather, diff_feather_points[0]);
rotate_point(diff_points[0], angle, co_feather, asp);
sf_vert = BLI_scanfill_vert_add(&sf_ctx, co_feather);
sf_vert->tmp.u = sf_vert_tot;
sf_vert->keyindex = SF_KEYINDEX_TEMP_ID;
sf_vert_tot++;
}
tot_feather_quads += SPLINE_RESOL_CAP;
for (k = 1; k < SPLINE_RESOL_CAP; k++) {
const float angle = (float)k * (1.0f / SPLINE_RESOL_CAP) * (float)M_PI;
copy_v2_v2(co_feather, diff_feather_points[tot_diff_point - 1]);
rotate_point(diff_points[tot_diff_point - 1], -angle, co_feather, asp);
sf_vert = BLI_scanfill_vert_add(&sf_ctx, co_feather);
sf_vert->tmp.u = sf_vert_tot;
sf_vert->keyindex = SF_KEYINDEX_TEMP_ID;
sf_vert_tot++;
}
tot_feather_quads += SPLINE_RESOL_CAP;
}
/* end capping */
}
}
@@ -742,14 +816,17 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas
sf_tri_tot = BLI_scanfill_calc_ex(&sf_ctx, FALSE, zvec);
face_array = MEM_mallocN(sizeof(*face_array) * (sf_tri_tot + tot_feather_quads), "maskrast_face_index");
face_index = 0;
/* tri's */
face = (unsigned int *)face_array;
for (sf_tri = sf_ctx.fillfacebase.first, face_index = 0; sf_tri; sf_tri = sf_tri->next, face_index++) {
for (sf_tri = sf_ctx.fillfacebase.first; sf_tri; sf_tri = sf_tri->next) {
*(face++) = sf_tri->v3->tmp.u;
*(face++) = sf_tri->v2->tmp.u;
*(face++) = sf_tri->v1->tmp.u;
*(face++) = TRI_VERT;
face_index++;
FACE_ASSERT(face - 4, sf_vert_tot);
}
/* start of feather faces... if we have this set,
@@ -766,8 +843,8 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas
*(face++) = sf_edge->v2->tmp.u;
*(face++) = sf_edge->v2->keyindex;
*(face++) = sf_edge->v1->keyindex;
face_index++;
FACE_ASSERT(face - 4, sf_vert_tot);
}
}
}
@@ -789,15 +866,15 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas
*(face++) = j + 0; /* z 1 */
*(face++) = j + 1; /* z 0 */
*(face++) = j + 4; /* next span */ /* z 0 */
face_index++;
FACE_ASSERT(face - 4, sf_vert_tot);
*(face++) = j + 0; /* z 1 */
*(face++) = j + 3; /* next span */ /* z 1 */
*(face++) = j + 5; /* next span */ /* z 0 */
*(face++) = j + 2; /* z 0 */
face_index++;
FACE_ASSERT(face - 4, sf_vert_tot);
}
if (open_spline_ranges[open_spline_index].is_cyclic) {
@@ -805,15 +882,84 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas
*(face++) = j + 0; /* z 1 */
*(face++) = j + 1; /* z 0 */
*(face++) = start_vidx + 1; /* next span */ /* z 0 */
face_index++;
FACE_ASSERT(face - 4, sf_vert_tot);
*(face++) = j + 0; /* z 1 */
*(face++) = start_vidx + 0; /* next span */ /* z 1 */
*(face++) = start_vidx + 2; /* next span */ /* z 0 */
*(face++) = j + 2; /* z 0 */
face_index++;
FACE_ASSERT(face - 4, sf_vert_tot);
}
else {
unsigned int midvidx = start_vidx;
/***************
* cap end 'a' */
j = midvidx + (open_spline_ranges[open_spline_index].vertex_total * 3);
for (k = 0; k < SPLINE_RESOL_CAP - 2; k++, j++) {
*(face++) = midvidx + 0; /* z 1 */
*(face++) = midvidx + 0; /* z 1 */
*(face++) = j + 0; /* z 0 */
*(face++) = j + 1; /* z 0 */
face_index++;
FACE_ASSERT(face - 4, sf_vert_tot);
}
j = start_vidx + (open_spline_ranges[open_spline_index].vertex_total * 3);
/* 2 tris that join the original */
*(face++) = midvidx + 0; /* z 1 */
*(face++) = midvidx + 0; /* z 1 */
*(face++) = midvidx + 1; /* z 0 */
*(face++) = j + 0; /* z 0 */
face_index++;
FACE_ASSERT(face - 4, sf_vert_tot);
*(face++) = midvidx + 0; /* z 1 */
*(face++) = midvidx + 0; /* z 1 */
*(face++) = j + SPLINE_RESOL_CAP - 2; /* z 0 */
*(face++) = midvidx + 2; /* z 0 */
face_index++;
FACE_ASSERT(face - 4, sf_vert_tot);
/***************
* cap end 'b' */
/* ... same as previous but v 2-3 flipped, and different initial offsets */
j = start_vidx + (open_spline_ranges[open_spline_index].vertex_total * 3) + (SPLINE_RESOL_CAP - 1);
midvidx = start_vidx + (open_spline_ranges[open_spline_index].vertex_total * 3) - 3;
for (k = 0; k < SPLINE_RESOL_CAP - 2; k++, j++) {
*(face++) = midvidx; /* z 1 */
*(face++) = midvidx; /* z 1 */
*(face++) = j + 1; /* z 0 */
*(face++) = j + 0; /* z 0 */
face_index++;
FACE_ASSERT(face - 4, sf_vert_tot);
}
j = start_vidx + (open_spline_ranges[open_spline_index].vertex_total * 3) + (SPLINE_RESOL_CAP - 1);
/* 2 tris that join the original */
*(face++) = midvidx + 0; /* z 1 */
*(face++) = midvidx + 0; /* z 1 */
*(face++) = j + 0; /* z 0 */
*(face++) = midvidx + 1; /* z 0 */
face_index++;
FACE_ASSERT(face - 4, sf_vert_tot);
*(face++) = midvidx + 0; /* z 1 */
*(face++) = midvidx + 0; /* z 1 */
*(face++) = midvidx + 2; /* z 0 */
*(face++) = j + SPLINE_RESOL_CAP - 2; /* z 0 */
face_index++;
FACE_ASSERT(face - 4, sf_vert_tot);
}
}

View File

@@ -3156,7 +3156,7 @@ static void obrel_list_add(LinkNode **links, Object *ob)
* If OB_SET_VISIBLE or OB_SET_SELECTED are collected,
* then also add related objects according to the given includeFilters.
*/
struct LinkNode *BKE_object_relational_superset(struct Scene *scene, eObjectSet objectSet, eObRelationTypes includeFilter)
LinkNode *BKE_object_relational_superset(struct Scene *scene, eObjectSet objectSet, eObRelationTypes includeFilter)
{
LinkNode *links = NULL;
@@ -3235,3 +3235,32 @@ struct LinkNode *BKE_object_relational_superset(struct Scene *scene, eObjectSet
return links;
}
/**
* return all groups this object is apart of, caller must free.
*/
struct LinkNode *BKE_object_groups(Object *ob)
{
LinkNode *group_linknode = NULL;
Group *group = NULL;
while ((group = find_group(ob, group))) {
BLI_linklist_prepend(&group_linknode, group);
}
return group_linknode;
}
void BKE_object_groups_clear(Scene *scene, Base *base, Object *object)
{
Group *group = NULL;
BLI_assert(base->object == object);
if (scene && base == NULL) {
base = BKE_scene_base_find(scene, object);
}
while ((group = find_group(base->object, group))) {
rem_from_group(group, object, scene, base);
}
}

View File

@@ -1130,7 +1130,7 @@ static float turbulencep(float noisesize, float x, float y, float z, int nr)
/* VORONOI/WORLEY */
/******************/
/* distance metrics for voronoi, e parameter only used in Minkovsky */
/* distance metrics for voronoi, e parameter only used in Minkowski */
/* Camberra omitted, didn't seem useful */
/* distance squared */
@@ -1161,7 +1161,7 @@ static float dist_Chebychev(float x, float y, float z, float e)
return ((z > t) ? z : t);
}
/* minkovsky preset exponent 0.5 */
/* minkowski preset exponent 0.5 */
static float dist_MinkovskyH(float x, float y, float z, float e)
{
float d = sqrtf(fabsf(x)) + sqrtf(fabsf(y)) + sqrtf(fabsf(z));
@@ -1169,7 +1169,7 @@ static float dist_MinkovskyH(float x, float y, float z, float e)
return (d * d);
}
/* minkovsky preset exponent 4 */
/* minkowski preset exponent 4 */
static float dist_Minkovsky4(float x, float y, float z, float e)
{
(void)e;
@@ -1179,7 +1179,7 @@ static float dist_Minkovsky4(float x, float y, float z, float e)
return sqrtf(sqrtf(x * x + y * y + z * z));
}
/* Minkovsky, general case, slow, maybe too slow to be useful */
/* Minkowski, general case, slow, maybe too slow to be useful */
static float dist_Minkovsky(float x, float y, float z, float e)
{
return powf(powf(fabsf(x), e) + powf(fabsf(y), e) + powf(fabsf(z), e), 1.0f / e);

View File

@@ -375,7 +375,7 @@ typedef struct SlidePointData {
MaskSplinePointUW *uw;
float handle[2], no[2], feather[2];
int width, height;
float weight;
float weight, weight_scalar;
short curvature_only, accurate;
short initial_feather, overall_feather;
@@ -460,6 +460,7 @@ static void *slide_point_customdata(bContext *C, wmOperator *op, wmEvent *event)
float weight_scalar = BKE_mask_point_weight_scalar(spline, point, uw->u);
customdata->weight = uw->w;
customdata->weight_scalar = weight_scalar;
BKE_mask_point_segment_co(spline, point, uw->u, co);
BKE_mask_point_normal(spline, point, uw->u, customdata->no);
@@ -469,6 +470,7 @@ static void *slide_point_customdata(bContext *C, wmOperator *op, wmEvent *event)
BezTriple *bezt = &point->bezt;
customdata->weight = bezt->weight;
customdata->weight_scalar = 1.0f;
BKE_mask_point_normal(spline, point, 0.0f, customdata->no);
madd_v2_v2v2fl(customdata->feather, bezt->vec[1], customdata->no, bezt->weight);
@@ -710,13 +712,13 @@ static int slide_point_modal(bContext *C, wmOperator *op, wmEvent *event)
if (dot_v2v2(no, vec) <= 0.0f)
w = -w;
delta = w - data->weight;
delta = w - data->weight * data->weight_scalar;
if (data->orig_spline == NULL) {
/* restore weight for currently sliding point, so orig_spline would be created
* with original weights used
*/
*weight = data->weight * weight_scalar;
*weight = data->weight;
data->orig_spline = BKE_mask_spline_copy(data->spline);
}

View File

@@ -447,6 +447,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, wmEvent *event)
switch (event->type) {
case RETKEY:
case PADENTER:
case LEFTMOUSE: /* confirm */ // XXX hardcoded
if (event->val == KM_PRESS) {
/* finish */

View File

@@ -44,6 +44,7 @@
#include "BKE_group.h"
#include "BKE_main.h"
#include "BKE_report.h"
#include "BKE_object.h"
#include "ED_screen.h"
#include "ED_object.h"
@@ -59,57 +60,114 @@
/********************* 3d view operators ***********************/
static int objects_add_active_exec(bContext *C, wmOperator *op)
/* can be called with C == NULL */
static EnumPropertyItem *group_object_active_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
Object *ob = OBACT;
Group *group;
int ok = 0, cycle = 0;
if (!ob) return OPERATOR_CANCELLED;
/* linking to same group requires its own loop so we can avoid
* looking up the active objects groups each time */
Object *ob;
EnumPropertyItem *item = NULL, item_tmp = {0};
int totitem = 0;
for (group = bmain->group.first; group; group = group->id.next) {
if (object_in_group(ob, group)) {
/* Assign groups to selected objects */
CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases)
{
if (base->object->dup_group != group)
add_to_group(group, base->object, scene, base);
else
cycle = 1;
ok = 1;
}
CTX_DATA_END;
if (C == NULL) {
return DummyRNA_NULL_items;
}
ob = ED_object_context(C);
/* check that the action exists */
if (ob) {
Group *group = NULL;
int i = 0;
while ((group = find_group(ob, group))) {
item_tmp.identifier = item_tmp.name = group->id.name + 2;
/* item_tmp.icon = ICON_ARMATURE_DATA; */
item_tmp.value = i;
RNA_enum_item_add(&item, &totitem, &item_tmp);
i++;
}
}
if (!ok) BKE_report(op->reports, RPT_ERROR, "Active Object contains no groups");
if (cycle)
RNA_enum_item_end(&item, &totitem);
*free = 1;
return item;
}
/* get the group back from the enum index, quite awkward and UI specific */
static Group *group_object_active_find_index(Object *ob, const int group_object_index)
{
Group *group = NULL;
int i = 0;
while ((group = find_group(ob, group))) {
if (i == group_object_index) {
break;
}
i++;
}
return group;
}
static int objects_add_active_exec(bContext *C, wmOperator *op)
{
Object *ob = ED_object_context(C);
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
int group_object_index = RNA_enum_get(op->ptr, "group");
int is_cycle = FALSE;
if (ob) {
Group *group = group_object_active_find_index(ob, group_object_index);
/* now add all selected objects from the group */
if (group) {
CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases)
{
if (base->object->dup_group != group) {
add_to_group(group, base->object, scene, base);
}
else {
is_cycle = TRUE;
}
}
CTX_DATA_END;
DAG_scene_sort(bmain, scene);
WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
return OPERATOR_FINISHED;
}
}
if (is_cycle) {
BKE_report(op->reports, RPT_WARNING, "Skipped some groups because of cycle detected");
DAG_scene_sort(bmain, scene);
WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
return OPERATOR_FINISHED;
}
return OPERATOR_CANCELLED;
}
void GROUP_OT_objects_add_active(wmOperatorType *ot)
{
PropertyRNA *prop;
/* identifiers */
ot->name = "Add Selected To Active Group";
ot->description = "Add the object to an object group that contains the active object";
ot->idname = "GROUP_OT_objects_add_active";
/* api callbacks */
ot->exec = objects_add_active_exec;
ot->exec = objects_add_active_exec;
ot->invoke = WM_menu_invoke;
ot->poll = ED_operator_objectmode;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
prop = RNA_def_enum(ot->srna, "group", DummyRNA_NULL_items, 0, "Group", "The group to add other selected objects to");
RNA_def_enum_funcs(prop, group_object_active_itemf);
ot->prop = prop;
}
static int objects_remove_active_exec(bContext *C, wmOperator *op)
@@ -164,13 +222,10 @@ static int group_objects_remove_all_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
Group *group = NULL;
CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases)
{
group = NULL;
while ((group = find_group(base->object, group)))
rem_from_group(group, base->object, scene, base);
BKE_object_groups_clear(scene, base, base->object);
}
CTX_DATA_END;
@@ -202,17 +257,8 @@ static int group_objects_remove_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
int group_object_index = RNA_enum_get(op->ptr, "group");
/* first get the group back from the enum index, quite awkward and UI specific */
if (ob) {
Group *group = NULL;
int i = 0;
while ((group = find_group(ob, group))) {
if (i == group_object_index) {
break;
}
i++;
}
Group *group = group_object_active_find_index(ob, group_object_index);
/* now remove all selected objects from the group */
if (group) {
@@ -233,40 +279,6 @@ static int group_objects_remove_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
/* can be called with C == NULL */
static EnumPropertyItem *group_objects_remove_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
{
Object *ob;
EnumPropertyItem *item = NULL, item_tmp = {0};
int totitem = 0;
if (C == NULL) {
return DummyRNA_NULL_items;
}
ob = ED_object_context(C);
/* check that the action exists */
if (ob) {
Group *group = NULL;
int i = 0;
while ((group = find_group(ob, group))) {
item_tmp.identifier = item_tmp.name = group->id.name + 2;
/* item_tmp.icon = ICON_ARMATURE_DATA; */
item_tmp.value = i;
RNA_enum_item_add(&item, &totitem, &item_tmp);
i++;
}
}
RNA_enum_item_end(&item, &totitem);
*free = 1;
return item;
}
void GROUP_OT_objects_remove(wmOperatorType *ot)
{
PropertyRNA *prop;
@@ -286,7 +298,7 @@ void GROUP_OT_objects_remove(wmOperatorType *ot)
/* properties */
prop = RNA_def_enum(ot->srna, "group", DummyRNA_NULL_items, 0, "Group", "The group to remove this object from");
RNA_def_enum_funcs(prop, group_objects_remove_itemf);
RNA_def_enum_funcs(prop, group_object_active_itemf);
ot->prop = prop;
}

View File

@@ -50,6 +50,7 @@
#include "BLI_math.h"
#include "BLI_listbase.h"
#include "BLI_linklist.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
@@ -64,6 +65,7 @@
#include "BKE_DerivedMesh.h"
#include "BKE_displist.h"
#include "BKE_global.h"
#include "BKE_group.h"
#include "BKE_fcurve.h"
#include "BKE_lamp.h"
#include "BKE_lattice.h"
@@ -1277,14 +1279,15 @@ enum {
MAKE_LINKS_OBDATA = 1,
MAKE_LINKS_MATERIALS,
MAKE_LINKS_ANIMDATA,
MAKE_LINKS_GROUP,
MAKE_LINKS_DUPLIGROUP,
MAKE_LINKS_MODIFIERS
};
/* Return 1 if make link data is allow, zero otherwise */
static int allow_make_links_data(int ev, Object *ob, Object *obt)
static int allow_make_links_data(const int type, Object *ob, Object *obt)
{
switch (ev) {
switch (type) {
case MAKE_LINKS_OBDATA:
if (ob->type == obt->type && ob->type != OB_EMPTY)
return 1;
@@ -1297,6 +1300,7 @@ static int allow_make_links_data(int ev, Object *ob, Object *obt)
}
break;
case MAKE_LINKS_ANIMDATA:
case MAKE_LINKS_GROUP:
case MAKE_LINKS_DUPLIGROUP:
return 1;
case MAKE_LINKS_MODIFIERS:
@@ -1310,52 +1314,81 @@ static int allow_make_links_data(int ev, Object *ob, Object *obt)
static int make_links_data_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
int event = RNA_enum_get(op->ptr, "type");
Object *ob;
Scene *scene = CTX_data_scene(C);
const int type = RNA_enum_get(op->ptr, "type");
Object *ob_src;
ID *id;
int a;
ob = ED_object_active_context(C);
/* group */
LinkNode *ob_groups = NULL;
int is_cycle = FALSE;
CTX_DATA_BEGIN (C, Object *, obt, selected_editable_objects)
ob_src = ED_object_active_context(C);
/* avoid searching all groups in source object each time */
if (type == MAKE_LINKS_GROUP) {
ob_groups = BKE_object_groups(ob_src);
}
CTX_DATA_BEGIN (C, Base *, base_dst, selected_editable_bases)
{
if (ob != obt) {
if (allow_make_links_data(event, ob, obt)) {
switch (event) {
Object *ob_dst = base_dst->object;
if (ob_src != ob_dst) {
if (allow_make_links_data(type, ob_src, ob_dst)) {
switch (type) {
case MAKE_LINKS_OBDATA: /* obdata */
id = obt->data;
id = ob_dst->data;
id->us--;
id = ob->data;
id = ob_src->data;
id_us_plus(id);
obt->data = id;
ob_dst->data = id;
/* if amount of material indices changed: */
test_object_materials(obt->data);
test_object_materials(ob_dst->data);
obt->recalc |= OB_RECALC_DATA;
ob_dst->recalc |= OB_RECALC_DATA;
break;
case MAKE_LINKS_MATERIALS:
/* new approach, using functions from kernel */
for (a = 0; a < ob->totcol; a++) {
Material *ma = give_current_material(ob, a + 1);
assign_material(obt, ma, a + 1); /* also works with ma==NULL */
for (a = 0; a < ob_src->totcol; a++) {
Material *ma = give_current_material(ob_src, a + 1);
assign_material(ob_dst, ma, a + 1); /* also works with ma==NULL */
}
break;
case MAKE_LINKS_ANIMDATA:
BKE_copy_animdata_id((ID *)obt, (ID *)ob, FALSE);
BKE_copy_animdata_id((ID *)obt->data, (ID *)ob->data, FALSE);
BKE_copy_animdata_id((ID *)ob_dst, (ID *)ob_src, FALSE);
BKE_copy_animdata_id((ID *)ob_dst->data, (ID *)ob_src->data, FALSE);
break;
case MAKE_LINKS_GROUP:
{
LinkNode *group_node;
/* first clear groups */
BKE_object_groups_clear(scene, base_dst, ob_dst);
/* now add in the groups from the link nodes */
for (group_node = ob_groups; group_node; group_node = group_node->next) {
if (ob_dst->dup_group != group_node->link) {
add_to_group(group_node->link, ob_dst, scene, base_dst);
}
else {
is_cycle = TRUE;
}
}
}
case MAKE_LINKS_DUPLIGROUP:
obt->dup_group = ob->dup_group;
if (obt->dup_group) {
id_lib_extern(&obt->dup_group->id);
obt->transflag |= OB_DUPLIGROUP;
ob_dst->dup_group = ob_src->dup_group;
if (ob_dst->dup_group) {
id_lib_extern(&ob_dst->dup_group->id);
ob_dst->transflag |= OB_DUPLIGROUP;
}
break;
case MAKE_LINKS_MODIFIERS:
BKE_object_link_modifiers(obt, ob);
obt->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
BKE_object_link_modifiers(ob_dst, ob_src);
ob_dst->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
break;
}
}
@@ -1363,7 +1396,17 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
DAG_scene_sort(bmain, CTX_data_scene(C));
if (type == MAKE_LINKS_GROUP) {
if (ob_groups) {
BLI_linklist_free(ob_groups, NULL);
}
if (is_cycle) {
BKE_report(op->reports, RPT_WARNING, "Skipped some groups because of cycle detected");
}
}
DAG_scene_sort(bmain, scene);
DAG_ids_flush_update(bmain, 0);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C));
@@ -1400,6 +1443,7 @@ void OBJECT_OT_make_links_data(wmOperatorType *ot)
{MAKE_LINKS_OBDATA, "OBDATA", 0, "Object Data", ""},
{MAKE_LINKS_MATERIALS, "MATERIAL", 0, "Materials", ""},
{MAKE_LINKS_ANIMDATA, "ANIMATION", 0, "Animation Data", ""},
{MAKE_LINKS_GROUP, "GROUPS", 0, "Group", ""},
{MAKE_LINKS_DUPLIGROUP, "DUPLIGROUP", 0, "DupliGroup", ""},
{MAKE_LINKS_MODIFIERS, "MODIFIERS", 0, "Modifiers", ""},
{0, NULL, 0, NULL, NULL}};

View File

@@ -1443,12 +1443,12 @@ static void rna_def_texture_voronoi(BlenderRNA *brna)
"The length of the distance in axial directions"},
{TEX_CHEBYCHEV, "CHEBYCHEV", 0, "Chebychev",
"The length of the longest Axial journey"},
{TEX_MINKOVSKY_HALF, "MINKOVSKY_HALF", 0, "Minkovsky 1/2",
"Set Minkovsky variable to 0.5"},
{TEX_MINKOVSKY_FOUR, "MINKOVSKY_FOUR", 0, "Minkovsky 4",
"Set Minkovsky variable to 4"},
{TEX_MINKOVSKY, "MINKOVSKY", 0, "Minkovsky",
"Use the Minkowsky function to calculate distance "
{TEX_MINKOVSKY_HALF, "MINKOVSKY_HALF", 0, "Minkowski 1/2",
"Set Minkowski variable to 0.5"},
{TEX_MINKOVSKY_FOUR, "MINKOVSKY_FOUR", 0, "Minkowski 4",
"Set Minkowski variable to 4"},
{TEX_MINKOVSKY, "MINKOVSKY", 0, "Minkowski",
"Use the Minkowski function to calculate distance "
"(exponent value determines the shape of the boundaries)"},
{0, NULL, 0, NULL, NULL}
};
@@ -1494,7 +1494,7 @@ static void rna_def_texture_voronoi(BlenderRNA *brna)
prop = RNA_def_property(srna, "minkovsky_exponent", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "vn_mexp");
RNA_def_property_range(prop, 0.01, 10);
RNA_def_property_ui_text(prop, "Minkovsky Exponent", "Minkovsky exponent");
RNA_def_property_ui_text(prop, "Minkowski Exponent", "Minkowski exponent");
RNA_def_property_update(prop, 0, "rna_Texture_update");
prop = RNA_def_property(srna, "distance_metric", PROP_ENUM, PROP_NONE);

View File

@@ -79,7 +79,7 @@ static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd, Obj
if ((l1 = e->l) &&
(l2 = e->l->radial_next) != l1)
{
if (/* 3+ faces on thsi edge, always split */
if (/* 3+ faces on this edge, always split */
UNLIKELY(l1 != l2->radial_next) ||
/* 2 face edge - check angle*/
(dot_v3v3(l1->f->no, l2->f->no) < threshold))

View File

@@ -717,7 +717,7 @@ PyDoc_STRVAR(M_Noise_voronoi_doc,
" :type position: :class:`mathutils.Vector`\n"
" :arg distance_metric: Method of measuring distance.\n"
" :type distance_metric: Value in noise.distance_metrics or int\n"
" :arg exponent: The exponent for Minkovsky distance metric.\n"
" :arg exponent: The exponent for Minkowski distance metric.\n"
" :type exponent: float\n"
" :return: A list of distances to the four closest features and their locations.\n"
" :rtype: list of four floats, list of four :class:`mathutils.Vector` types\n"
@@ -729,7 +729,7 @@ static PyObject *M_Noise_voronoi(PyObject *UNUSED(self), PyObject *args)
float vec[3];
float da[4], pa[12];
int dtype = 0;
float me = 2.5f; /* default minkovsky exponent */
float me = 2.5f; /* default minkowski exponent */
int i;

View File

@@ -324,8 +324,8 @@ void RAS_2DFilterManager::SetupTextures(bool depth, bool luminance)
void RAS_2DFilterManager::UpdateOffsetMatrix(RAS_ICanvas* canvas)
{
/* RAS_Rect canvas_rect = canvas->GetWindowArea(); */ /* UNUSED */
texturewidth = canvas->GetWidth();
textureheight = canvas->GetHeight();
texturewidth = canvas->GetWidth()+1;
textureheight = canvas->GetHeight()+1;
GLint i,j;
if (!GL_ARB_texture_non_power_of_two)
@@ -402,6 +402,7 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas)
GLuint viewport[4]={0};
glGetIntegerv(GL_VIEWPORT,(GLint *)viewport);
RAS_Rect rect = canvas->GetWindowArea();
int rect_width = rect.GetWidth()+1, rect_height = rect.GetHeight()+1;
if (canvaswidth != canvas->GetWidth() || canvasheight != canvas->GetHeight())
{
@@ -419,19 +420,19 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas)
if (need_depth) {
glActiveTextureARB(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, texname[1]);
glCopyTexImage2D(GL_TEXTURE_2D,0,GL_DEPTH_COMPONENT, rect.GetLeft(), rect.GetBottom(), rect.GetWidth(), rect.GetHeight(), 0);
glCopyTexImage2D(GL_TEXTURE_2D,0,GL_DEPTH_COMPONENT, rect.GetLeft(), rect.GetBottom(), rect_width, rect_height, 0);
}
if (need_luminance) {
glActiveTextureARB(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D, texname[2]);
glCopyTexImage2D(GL_TEXTURE_2D,0,GL_LUMINANCE16, rect.GetLeft(), rect.GetBottom(), rect.GetWidth(), rect.GetHeight(), 0);
glCopyTexImage2D(GL_TEXTURE_2D,0,GL_LUMINANCE16, rect.GetLeft(), rect.GetBottom(), rect_width, rect_height, 0);
}
// reverting to texunit 0, without this we get bug [#28462]
glActiveTextureARB(GL_TEXTURE0);
glViewport(rect.GetLeft(), rect.GetBottom(), rect.GetWidth()+1, rect.GetHeight()+1);
glViewport(rect.GetLeft(), rect.GetBottom(), rect_width, rect.GetHeight()+1);
glDisable(GL_DEPTH_TEST);
// in case the previous material was wire
@@ -454,7 +455,7 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas)
glActiveTextureARB(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texname[0]);
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, rect.GetLeft(), rect.GetBottom(), rect.GetWidth(), rect.GetHeight(), 0); // Don't use texturewidth and textureheight in case we don't have NPOT support
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, rect.GetLeft(), rect.GetBottom(), rect_width, rect_height, 0); // Don't use texturewidth and textureheight in case we don't have NPOT support
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_QUADS);