hexsha
stringlengths 40
40
| repo
stringlengths 5
105
| path
stringlengths 3
173
| license
sequence | language
stringclasses 1
value | identifier
stringlengths 1
438
| return_type
stringlengths 1
106
⌀ | original_string
stringlengths 21
40.7k
| original_docstring
stringlengths 18
13.4k
| docstring
stringlengths 11
3.24k
| docstring_tokens
sequence | code
stringlengths 14
20.4k
| code_tokens
sequence | short_docstring
stringlengths 0
4.36k
| short_docstring_tokens
sequence | comment
sequence | parameters
list | docstring_params
dict |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
797e2ca864e674d30732f6f1e8ff98ecac74b2ed | DemonRem/blender | source/blender/bmesh/tools/bmesh_bevel.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | closer_v3_v3v3v3 | void | static void closer_v3_v3v3v3(float r[3], float a[3], float b[3], float v[3])
{
if (len_squared_v3v3(a, v) <= len_squared_v3v3(b, v)) {
copy_v3_v3(r, a);
}
else {
copy_v3_v3(r, b);
}
} | /* copy whichever of a and b is closer to v into r */ | copy whichever of a and b is closer to v into r | [
"copy",
"whichever",
"of",
"a",
"and",
"b",
"is",
"closer",
"to",
"v",
"into",
"r"
] | static void closer_v3_v3v3v3(float r[3], float a[3], float b[3], float v[3])
{
if (len_squared_v3v3(a, v) <= len_squared_v3v3(b, v)) {
copy_v3_v3(r, a);
}
else {
copy_v3_v3(r, b);
}
} | [
"static",
"void",
"closer_v3_v3v3v3",
"(",
"float",
"r",
"[",
"3",
"]",
",",
"float",
"a",
"[",
"3",
"]",
",",
"float",
"b",
"[",
"3",
"]",
",",
"float",
"v",
"[",
"3",
"]",
")",
"{",
"if",
"(",
"len_squared_v3v3",
"(",
"a",
",",
"v",
")",
"<=",
"len_squared_v3v3",
"(",
"b",
",",
"v",
")",
")",
"{",
"copy_v3_v3",
"(",
"r",
",",
"a",
")",
";",
"}",
"else",
"{",
"copy_v3_v3",
"(",
"r",
",",
"b",
")",
";",
"}",
"}"
] | copy whichever of a and b is closer to v into r | [
"copy",
"whichever",
"of",
"a",
"and",
"b",
"is",
"closer",
"to",
"v",
"into",
"r"
] | [] | [
{
"param": "r",
"type": "float"
},
{
"param": "a",
"type": "float"
},
{
"param": "b",
"type": "float"
},
{
"param": "v",
"type": "float"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "r",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "a",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "b",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "v",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
797e2ca864e674d30732f6f1e8ff98ecac74b2ed | DemonRem/blender | source/blender/bmesh/tools/bmesh_bevel.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | is_bad_uv_poly | bool | static bool is_bad_uv_poly(BevVert *bv, BMFace *frep)
{
BoundVert *v;
BMEdge *snape, *firste;
float co[3];
VMesh *vm = bv->vmesh;
float d2;
v = vm->boundstart;
d2 = snap_face_dist_squared(v->nv.v->co, frep, &firste, co);
if (d2 > BEVEL_EPSILON_BIG_SQ || firste == NULL) {
return false;
}
for (v = v->next; v != vm->boundstart; v = v->next) {
snap_face_dist_squared(v->nv.v->co, frep, &snape, co);
if (snape != firste) {
d2 = dist_to_line_v3(co, firste->v1->co, firste->v2->co);
if (d2 > BEVEL_EPSILON_BIG_SQ) {
return false;
}
}
}
return true;
} | /* If we make a poly out of verts around bv, snapping to rep frep, will uv poly have zero area?
* The uv poly is made by snapping all outside-of-frep vertices to the closest edge in frep.
* Assume that this function is called when the only inside-of-frep vertex is vm->boundstart.
* The poly will have zero area if the distance of that first vertex to some edge e is zero,
* and all the other vertices snap to e or snap to an edge
* at a point that is essentially on e too. */ | If we make a poly out of verts around bv, snapping to rep frep, will uv poly have zero area.
The uv poly is made by snapping all outside-of-frep vertices to the closest edge in frep.
Assume that this function is called when the only inside-of-frep vertex is vm->boundstart.
The poly will have zero area if the distance of that first vertex to some edge e is zero,
and all the other vertices snap to e or snap to an edge
at a point that is essentially on e too. | [
"If",
"we",
"make",
"a",
"poly",
"out",
"of",
"verts",
"around",
"bv",
"snapping",
"to",
"rep",
"frep",
"will",
"uv",
"poly",
"have",
"zero",
"area",
".",
"The",
"uv",
"poly",
"is",
"made",
"by",
"snapping",
"all",
"outside",
"-",
"of",
"-",
"frep",
"vertices",
"to",
"the",
"closest",
"edge",
"in",
"frep",
".",
"Assume",
"that",
"this",
"function",
"is",
"called",
"when",
"the",
"only",
"inside",
"-",
"of",
"-",
"frep",
"vertex",
"is",
"vm",
"-",
">",
"boundstart",
".",
"The",
"poly",
"will",
"have",
"zero",
"area",
"if",
"the",
"distance",
"of",
"that",
"first",
"vertex",
"to",
"some",
"edge",
"e",
"is",
"zero",
"and",
"all",
"the",
"other",
"vertices",
"snap",
"to",
"e",
"or",
"snap",
"to",
"an",
"edge",
"at",
"a",
"point",
"that",
"is",
"essentially",
"on",
"e",
"too",
"."
] | static bool is_bad_uv_poly(BevVert *bv, BMFace *frep)
{
BoundVert *v;
BMEdge *snape, *firste;
float co[3];
VMesh *vm = bv->vmesh;
float d2;
v = vm->boundstart;
d2 = snap_face_dist_squared(v->nv.v->co, frep, &firste, co);
if (d2 > BEVEL_EPSILON_BIG_SQ || firste == NULL) {
return false;
}
for (v = v->next; v != vm->boundstart; v = v->next) {
snap_face_dist_squared(v->nv.v->co, frep, &snape, co);
if (snape != firste) {
d2 = dist_to_line_v3(co, firste->v1->co, firste->v2->co);
if (d2 > BEVEL_EPSILON_BIG_SQ) {
return false;
}
}
}
return true;
} | [
"static",
"bool",
"is_bad_uv_poly",
"(",
"BevVert",
"*",
"bv",
",",
"BMFace",
"*",
"frep",
")",
"{",
"BoundVert",
"*",
"v",
";",
"BMEdge",
"*",
"snape",
",",
"*",
"firste",
";",
"float",
"co",
"[",
"3",
"]",
";",
"VMesh",
"*",
"vm",
"=",
"bv",
"->",
"vmesh",
";",
"float",
"d2",
";",
"v",
"=",
"vm",
"->",
"boundstart",
";",
"d2",
"=",
"snap_face_dist_squared",
"(",
"v",
"->",
"nv",
".",
"v",
"->",
"co",
",",
"frep",
",",
"&",
"firste",
",",
"co",
")",
";",
"if",
"(",
"d2",
">",
"BEVEL_EPSILON_BIG_SQ",
"||",
"firste",
"==",
"NULL",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"v",
"=",
"v",
"->",
"next",
";",
"v",
"!=",
"vm",
"->",
"boundstart",
";",
"v",
"=",
"v",
"->",
"next",
")",
"{",
"snap_face_dist_squared",
"(",
"v",
"->",
"nv",
".",
"v",
"->",
"co",
",",
"frep",
",",
"&",
"snape",
",",
"co",
")",
";",
"if",
"(",
"snape",
"!=",
"firste",
")",
"{",
"d2",
"=",
"dist_to_line_v3",
"(",
"co",
",",
"firste",
"->",
"v1",
"->",
"co",
",",
"firste",
"->",
"v2",
"->",
"co",
")",
";",
"if",
"(",
"d2",
">",
"BEVEL_EPSILON_BIG_SQ",
")",
"{",
"return",
"false",
";",
"}",
"}",
"}",
"return",
"true",
";",
"}"
] | If we make a poly out of verts around bv, snapping to rep frep, will uv poly have zero area? | [
"If",
"we",
"make",
"a",
"poly",
"out",
"of",
"verts",
"around",
"bv",
"snapping",
"to",
"rep",
"frep",
"will",
"uv",
"poly",
"have",
"zero",
"area?"
] | [] | [
{
"param": "bv",
"type": "BevVert"
},
{
"param": "frep",
"type": "BMFace"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bv",
"type": "BevVert",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "frep",
"type": "BMFace",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
797e2ca864e674d30732f6f1e8ff98ecac74b2ed | DemonRem/blender | source/blender/bmesh/tools/bmesh_bevel.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | bevel_vert_two_edges | void | static void bevel_vert_two_edges(BevelParams *bp, BMesh *bm, BevVert *bv)
{
VMesh *vm = bv->vmesh;
BMVert *v1, *v2;
BMEdge *e_eg, *bme;
Profile *pro;
float co[3];
BoundVert *bndv;
int ns, k;
BLI_assert(vm->count == 2 && bp->vertex_only);
v1 = mesh_vert(vm, 0, 0, 0)->v;
v2 = mesh_vert(vm, 1, 0, 0)->v;
ns = vm->seg;
if (ns > 1) {
/* Set up profile parameters */
bndv = vm->boundstart;
pro = &bndv->profile;
pro->super_r = bp->pro_super_r;
copy_v3_v3(pro->coa, v1->co);
copy_v3_v3(pro->cob, v2->co);
copy_v3_v3(pro->midco, bv->v->co);
/* don't use projection */
zero_v3(pro->plane_co);
zero_v3(pro->plane_no);
zero_v3(pro->proj_dir);
calculate_profile(bp, bndv);
for (k = 1; k < ns; k++) {
get_profile_point(bp, pro, k, ns, co);
copy_v3_v3(mesh_vert(vm, 0, 0, k)->co, co);
create_mesh_bmvert(bm, vm, 0, 0, k, bv->v);
}
copy_v3_v3(mesh_vert(vm, 0, 0, ns)->co, v2->co);
for (k = 1; k < ns; k++) {
copy_mesh_vert(vm, 1, 0, ns - k, 0, 0, k);
}
}
if (BM_vert_face_check(bv->v) == false) {
e_eg = bv->edges[0].e;
BLI_assert(e_eg != NULL);
for (k = 0; k < ns; k++) {
v1 = mesh_vert(vm, 0, 0, k)->v;
v2 = mesh_vert(vm, 0, 0, k + 1)->v;
BLI_assert(v1 != NULL && v2 != NULL);
bme = BM_edge_create(bm, v1, v2, e_eg, BM_CREATE_NO_DOUBLE);
if (bme) {
flag_out_edge(bm, bme);
}
}
}
} | /* Special case: vertex bevel with only two boundary verts.
* Want to make a curved edge if seg > 0.
* If there are no faces in the original mesh at the original vertex,
* there will be no rebuilt face to make the edge between the boundary verts,
* we have to make it here. */ | Special case: vertex bevel with only two boundary verts.
Want to make a curved edge if seg > 0.
If there are no faces in the original mesh at the original vertex,
there will be no rebuilt face to make the edge between the boundary verts,
we have to make it here. | [
"Special",
"case",
":",
"vertex",
"bevel",
"with",
"only",
"two",
"boundary",
"verts",
".",
"Want",
"to",
"make",
"a",
"curved",
"edge",
"if",
"seg",
">",
"0",
".",
"If",
"there",
"are",
"no",
"faces",
"in",
"the",
"original",
"mesh",
"at",
"the",
"original",
"vertex",
"there",
"will",
"be",
"no",
"rebuilt",
"face",
"to",
"make",
"the",
"edge",
"between",
"the",
"boundary",
"verts",
"we",
"have",
"to",
"make",
"it",
"here",
"."
] | static void bevel_vert_two_edges(BevelParams *bp, BMesh *bm, BevVert *bv)
{
VMesh *vm = bv->vmesh;
BMVert *v1, *v2;
BMEdge *e_eg, *bme;
Profile *pro;
float co[3];
BoundVert *bndv;
int ns, k;
BLI_assert(vm->count == 2 && bp->vertex_only);
v1 = mesh_vert(vm, 0, 0, 0)->v;
v2 = mesh_vert(vm, 1, 0, 0)->v;
ns = vm->seg;
if (ns > 1) {
bndv = vm->boundstart;
pro = &bndv->profile;
pro->super_r = bp->pro_super_r;
copy_v3_v3(pro->coa, v1->co);
copy_v3_v3(pro->cob, v2->co);
copy_v3_v3(pro->midco, bv->v->co);
zero_v3(pro->plane_co);
zero_v3(pro->plane_no);
zero_v3(pro->proj_dir);
calculate_profile(bp, bndv);
for (k = 1; k < ns; k++) {
get_profile_point(bp, pro, k, ns, co);
copy_v3_v3(mesh_vert(vm, 0, 0, k)->co, co);
create_mesh_bmvert(bm, vm, 0, 0, k, bv->v);
}
copy_v3_v3(mesh_vert(vm, 0, 0, ns)->co, v2->co);
for (k = 1; k < ns; k++) {
copy_mesh_vert(vm, 1, 0, ns - k, 0, 0, k);
}
}
if (BM_vert_face_check(bv->v) == false) {
e_eg = bv->edges[0].e;
BLI_assert(e_eg != NULL);
for (k = 0; k < ns; k++) {
v1 = mesh_vert(vm, 0, 0, k)->v;
v2 = mesh_vert(vm, 0, 0, k + 1)->v;
BLI_assert(v1 != NULL && v2 != NULL);
bme = BM_edge_create(bm, v1, v2, e_eg, BM_CREATE_NO_DOUBLE);
if (bme) {
flag_out_edge(bm, bme);
}
}
}
} | [
"static",
"void",
"bevel_vert_two_edges",
"(",
"BevelParams",
"*",
"bp",
",",
"BMesh",
"*",
"bm",
",",
"BevVert",
"*",
"bv",
")",
"{",
"VMesh",
"*",
"vm",
"=",
"bv",
"->",
"vmesh",
";",
"BMVert",
"*",
"v1",
",",
"*",
"v2",
";",
"BMEdge",
"*",
"e_eg",
",",
"*",
"bme",
";",
"Profile",
"*",
"pro",
";",
"float",
"co",
"[",
"3",
"]",
";",
"BoundVert",
"*",
"bndv",
";",
"int",
"ns",
",",
"k",
";",
"BLI_assert",
"(",
"vm",
"->",
"count",
"==",
"2",
"&&",
"bp",
"->",
"vertex_only",
")",
";",
"v1",
"=",
"mesh_vert",
"(",
"vm",
",",
"0",
",",
"0",
",",
"0",
")",
"->",
"v",
";",
"v2",
"=",
"mesh_vert",
"(",
"vm",
",",
"1",
",",
"0",
",",
"0",
")",
"->",
"v",
";",
"ns",
"=",
"vm",
"->",
"seg",
";",
"if",
"(",
"ns",
">",
"1",
")",
"{",
"bndv",
"=",
"vm",
"->",
"boundstart",
";",
"pro",
"=",
"&",
"bndv",
"->",
"profile",
";",
"pro",
"->",
"super_r",
"=",
"bp",
"->",
"pro_super_r",
";",
"copy_v3_v3",
"(",
"pro",
"->",
"coa",
",",
"v1",
"->",
"co",
")",
";",
"copy_v3_v3",
"(",
"pro",
"->",
"cob",
",",
"v2",
"->",
"co",
")",
";",
"copy_v3_v3",
"(",
"pro",
"->",
"midco",
",",
"bv",
"->",
"v",
"->",
"co",
")",
";",
"zero_v3",
"(",
"pro",
"->",
"plane_co",
")",
";",
"zero_v3",
"(",
"pro",
"->",
"plane_no",
")",
";",
"zero_v3",
"(",
"pro",
"->",
"proj_dir",
")",
";",
"calculate_profile",
"(",
"bp",
",",
"bndv",
")",
";",
"for",
"(",
"k",
"=",
"1",
";",
"k",
"<",
"ns",
";",
"k",
"++",
")",
"{",
"get_profile_point",
"(",
"bp",
",",
"pro",
",",
"k",
",",
"ns",
",",
"co",
")",
";",
"copy_v3_v3",
"(",
"mesh_vert",
"(",
"vm",
",",
"0",
",",
"0",
",",
"k",
")",
"->",
"co",
",",
"co",
")",
";",
"create_mesh_bmvert",
"(",
"bm",
",",
"vm",
",",
"0",
",",
"0",
",",
"k",
",",
"bv",
"->",
"v",
")",
";",
"}",
"copy_v3_v3",
"(",
"mesh_vert",
"(",
"vm",
",",
"0",
",",
"0",
",",
"ns",
")",
"->",
"co",
",",
"v2",
"->",
"co",
")",
";",
"for",
"(",
"k",
"=",
"1",
";",
"k",
"<",
"ns",
";",
"k",
"++",
")",
"{",
"copy_mesh_vert",
"(",
"vm",
",",
"1",
",",
"0",
",",
"ns",
"-",
"k",
",",
"0",
",",
"0",
",",
"k",
")",
";",
"}",
"}",
"if",
"(",
"BM_vert_face_check",
"(",
"bv",
"->",
"v",
")",
"==",
"false",
")",
"{",
"e_eg",
"=",
"bv",
"->",
"edges",
"[",
"0",
"]",
".",
"e",
";",
"BLI_assert",
"(",
"e_eg",
"!=",
"NULL",
")",
";",
"for",
"(",
"k",
"=",
"0",
";",
"k",
"<",
"ns",
";",
"k",
"++",
")",
"{",
"v1",
"=",
"mesh_vert",
"(",
"vm",
",",
"0",
",",
"0",
",",
"k",
")",
"->",
"v",
";",
"v2",
"=",
"mesh_vert",
"(",
"vm",
",",
"0",
",",
"0",
",",
"k",
"+",
"1",
")",
"->",
"v",
";",
"BLI_assert",
"(",
"v1",
"!=",
"NULL",
"&&",
"v2",
"!=",
"NULL",
")",
";",
"bme",
"=",
"BM_edge_create",
"(",
"bm",
",",
"v1",
",",
"v2",
",",
"e_eg",
",",
"BM_CREATE_NO_DOUBLE",
")",
";",
"if",
"(",
"bme",
")",
"{",
"flag_out_edge",
"(",
"bm",
",",
"bme",
")",
";",
"}",
"}",
"}",
"}"
] | Special case: vertex bevel with only two boundary verts. | [
"Special",
"case",
":",
"vertex",
"bevel",
"with",
"only",
"two",
"boundary",
"verts",
"."
] | [
"/* Set up profile parameters */",
"/* don't use projection */"
] | [
{
"param": "bp",
"type": "BevelParams"
},
{
"param": "bm",
"type": "BMesh"
},
{
"param": "bv",
"type": "BevVert"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bp",
"type": "BevelParams",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bm",
"type": "BMesh",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bv",
"type": "BevVert",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
797e2ca864e674d30732f6f1e8ff98ecac74b2ed | DemonRem/blender | source/blender/bmesh/tools/bmesh_bevel.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | build_vmesh | void | static void build_vmesh(BevelParams *bp, BMesh *bm, BevVert *bv)
{
MemArena *mem_arena = bp->mem_arena;
VMesh *vm = bv->vmesh;
BoundVert *v, *weld1, *weld2;
int n, ns, ns2, i, k, weld;
float *va, *vb, co[3];
n = vm->count;
ns = vm->seg;
ns2 = ns / 2;
vm->mesh = (NewVert *)BLI_memarena_alloc(mem_arena, n * (ns2 + 1) * (ns + 1) * sizeof(NewVert));
/* special case: two beveled ends welded together */
weld = (bv->selcount == 2) && (vm->count == 2);
weld1 = weld2 = NULL; /* will hold two BoundVerts involved in weld */
/* make (i, 0, 0) mesh verts for all i */
v = vm->boundstart;
do {
i = v->index;
copy_v3_v3(mesh_vert(vm, i, 0, 0)->co, v->nv.co);
create_mesh_bmvert(bm, vm, i, 0, 0, bv->v);
v->nv.v = mesh_vert(vm, i, 0, 0)->v;
if (weld && v->ebev) {
if (!weld1) {
weld1 = v;
}
else {
weld2 = v;
move_weld_profile_planes(bv, weld1, weld2);
calculate_profile(bp, weld1);
calculate_profile(bp, weld2);
}
}
} while ((v = v->next) != vm->boundstart);
/* copy other ends to (i, 0, ns) for all i, and fill in profiles for edges */
v = vm->boundstart;
do {
i = v->index;
copy_mesh_vert(vm, i, 0, ns, v->next->index, 0, 0);
for (k = 1; k < ns; k++) {
if (v->ebev && vm->mesh_kind != M_ADJ) {
get_profile_point(bp, &v->profile, k, ns, co);
copy_v3_v3(mesh_vert(vm, i, 0, k)->co, co);
if (!weld) {
create_mesh_bmvert(bm, vm, i, 0, k, bv->v);
}
}
else if (n == 2 && !v->ebev && vm->mesh_kind != M_ADJ) {
/* case of one edge beveled and this is the v without ebev */
/* want to copy the verts from other v, in reverse order */
copy_mesh_vert(vm, i, 0, k, 1 - i, 0, ns - k);
}
}
} while ((v = v->next) != vm->boundstart);
if (weld) {
vm->mesh_kind = M_NONE;
for (k = 1; k < ns; k++) {
va = mesh_vert(vm, weld1->index, 0, k)->co;
vb = mesh_vert(vm, weld2->index, 0, ns - k)->co;
/* if one of the profiles is on a flat plane,
* just use the boundary point of the other */
if (weld1->profile.super_r == PRO_LINE_R && weld2->profile.super_r != PRO_LINE_R) {
copy_v3_v3(co, vb);
}
else if (weld2->profile.super_r == PRO_LINE_R && weld1->profile.super_r != PRO_LINE_R) {
copy_v3_v3(co, va);
}
else {
mid_v3_v3v3(co, va, vb);
}
copy_v3_v3(mesh_vert(vm, weld1->index, 0, k)->co, co);
create_mesh_bmvert(bm, vm, weld1->index, 0, k, bv->v);
}
for (k = 1; k < ns; k++) {
copy_mesh_vert(vm, weld2->index, 0, ns - k, weld1->index, 0, k);
}
}
switch (vm->mesh_kind) {
case M_NONE:
if (n == 2 && bp->vertex_only) {
bevel_vert_two_edges(bp, bm, bv);
}
break;
case M_POLY:
bevel_build_poly(bp, bm, bv);
break;
case M_ADJ:
bevel_build_rings(bp, bm, bv);
break;
case M_TRI_FAN:
bevel_build_trifan(bp, bm, bv);
break;
}
} | /* Given that the boundary is built, now make the actual BMVerts
* for the boundary and the interior of the vertex mesh. */ | Given that the boundary is built, now make the actual BMVerts
for the boundary and the interior of the vertex mesh. | [
"Given",
"that",
"the",
"boundary",
"is",
"built",
"now",
"make",
"the",
"actual",
"BMVerts",
"for",
"the",
"boundary",
"and",
"the",
"interior",
"of",
"the",
"vertex",
"mesh",
"."
] | static void build_vmesh(BevelParams *bp, BMesh *bm, BevVert *bv)
{
MemArena *mem_arena = bp->mem_arena;
VMesh *vm = bv->vmesh;
BoundVert *v, *weld1, *weld2;
int n, ns, ns2, i, k, weld;
float *va, *vb, co[3];
n = vm->count;
ns = vm->seg;
ns2 = ns / 2;
vm->mesh = (NewVert *)BLI_memarena_alloc(mem_arena, n * (ns2 + 1) * (ns + 1) * sizeof(NewVert));
weld = (bv->selcount == 2) && (vm->count == 2);
weld1 = weld2 = NULL;
v = vm->boundstart;
do {
i = v->index;
copy_v3_v3(mesh_vert(vm, i, 0, 0)->co, v->nv.co);
create_mesh_bmvert(bm, vm, i, 0, 0, bv->v);
v->nv.v = mesh_vert(vm, i, 0, 0)->v;
if (weld && v->ebev) {
if (!weld1) {
weld1 = v;
}
else {
weld2 = v;
move_weld_profile_planes(bv, weld1, weld2);
calculate_profile(bp, weld1);
calculate_profile(bp, weld2);
}
}
} while ((v = v->next) != vm->boundstart);
v = vm->boundstart;
do {
i = v->index;
copy_mesh_vert(vm, i, 0, ns, v->next->index, 0, 0);
for (k = 1; k < ns; k++) {
if (v->ebev && vm->mesh_kind != M_ADJ) {
get_profile_point(bp, &v->profile, k, ns, co);
copy_v3_v3(mesh_vert(vm, i, 0, k)->co, co);
if (!weld) {
create_mesh_bmvert(bm, vm, i, 0, k, bv->v);
}
}
else if (n == 2 && !v->ebev && vm->mesh_kind != M_ADJ) {
copy_mesh_vert(vm, i, 0, k, 1 - i, 0, ns - k);
}
}
} while ((v = v->next) != vm->boundstart);
if (weld) {
vm->mesh_kind = M_NONE;
for (k = 1; k < ns; k++) {
va = mesh_vert(vm, weld1->index, 0, k)->co;
vb = mesh_vert(vm, weld2->index, 0, ns - k)->co;
if (weld1->profile.super_r == PRO_LINE_R && weld2->profile.super_r != PRO_LINE_R) {
copy_v3_v3(co, vb);
}
else if (weld2->profile.super_r == PRO_LINE_R && weld1->profile.super_r != PRO_LINE_R) {
copy_v3_v3(co, va);
}
else {
mid_v3_v3v3(co, va, vb);
}
copy_v3_v3(mesh_vert(vm, weld1->index, 0, k)->co, co);
create_mesh_bmvert(bm, vm, weld1->index, 0, k, bv->v);
}
for (k = 1; k < ns; k++) {
copy_mesh_vert(vm, weld2->index, 0, ns - k, weld1->index, 0, k);
}
}
switch (vm->mesh_kind) {
case M_NONE:
if (n == 2 && bp->vertex_only) {
bevel_vert_two_edges(bp, bm, bv);
}
break;
case M_POLY:
bevel_build_poly(bp, bm, bv);
break;
case M_ADJ:
bevel_build_rings(bp, bm, bv);
break;
case M_TRI_FAN:
bevel_build_trifan(bp, bm, bv);
break;
}
} | [
"static",
"void",
"build_vmesh",
"(",
"BevelParams",
"*",
"bp",
",",
"BMesh",
"*",
"bm",
",",
"BevVert",
"*",
"bv",
")",
"{",
"MemArena",
"*",
"mem_arena",
"=",
"bp",
"->",
"mem_arena",
";",
"VMesh",
"*",
"vm",
"=",
"bv",
"->",
"vmesh",
";",
"BoundVert",
"*",
"v",
",",
"*",
"weld1",
",",
"*",
"weld2",
";",
"int",
"n",
",",
"ns",
",",
"ns2",
",",
"i",
",",
"k",
",",
"weld",
";",
"float",
"*",
"va",
",",
"*",
"vb",
",",
"co",
"[",
"3",
"]",
";",
"n",
"=",
"vm",
"->",
"count",
";",
"ns",
"=",
"vm",
"->",
"seg",
";",
"ns2",
"=",
"ns",
"/",
"2",
";",
"vm",
"->",
"mesh",
"=",
"(",
"NewVert",
"*",
")",
"BLI_memarena_alloc",
"(",
"mem_arena",
",",
"n",
"*",
"(",
"ns2",
"+",
"1",
")",
"*",
"(",
"ns",
"+",
"1",
")",
"*",
"sizeof",
"(",
"NewVert",
")",
")",
";",
"weld",
"=",
"(",
"bv",
"->",
"selcount",
"==",
"2",
")",
"&&",
"(",
"vm",
"->",
"count",
"==",
"2",
")",
";",
"weld1",
"=",
"weld2",
"=",
"NULL",
";",
"v",
"=",
"vm",
"->",
"boundstart",
";",
"do",
"{",
"i",
"=",
"v",
"->",
"index",
";",
"copy_v3_v3",
"(",
"mesh_vert",
"(",
"vm",
",",
"i",
",",
"0",
",",
"0",
")",
"->",
"co",
",",
"v",
"->",
"nv",
".",
"co",
")",
";",
"create_mesh_bmvert",
"(",
"bm",
",",
"vm",
",",
"i",
",",
"0",
",",
"0",
",",
"bv",
"->",
"v",
")",
";",
"v",
"->",
"nv",
".",
"v",
"=",
"mesh_vert",
"(",
"vm",
",",
"i",
",",
"0",
",",
"0",
")",
"->",
"v",
";",
"if",
"(",
"weld",
"&&",
"v",
"->",
"ebev",
")",
"{",
"if",
"(",
"!",
"weld1",
")",
"{",
"weld1",
"=",
"v",
";",
"}",
"else",
"{",
"weld2",
"=",
"v",
";",
"move_weld_profile_planes",
"(",
"bv",
",",
"weld1",
",",
"weld2",
")",
";",
"calculate_profile",
"(",
"bp",
",",
"weld1",
")",
";",
"calculate_profile",
"(",
"bp",
",",
"weld2",
")",
";",
"}",
"}",
"}",
"while",
"(",
"(",
"v",
"=",
"v",
"->",
"next",
")",
"!=",
"vm",
"->",
"boundstart",
")",
";",
"v",
"=",
"vm",
"->",
"boundstart",
";",
"do",
"{",
"i",
"=",
"v",
"->",
"index",
";",
"copy_mesh_vert",
"(",
"vm",
",",
"i",
",",
"0",
",",
"ns",
",",
"v",
"->",
"next",
"->",
"index",
",",
"0",
",",
"0",
")",
";",
"for",
"(",
"k",
"=",
"1",
";",
"k",
"<",
"ns",
";",
"k",
"++",
")",
"{",
"if",
"(",
"v",
"->",
"ebev",
"&&",
"vm",
"->",
"mesh_kind",
"!=",
"M_ADJ",
")",
"{",
"get_profile_point",
"(",
"bp",
",",
"&",
"v",
"->",
"profile",
",",
"k",
",",
"ns",
",",
"co",
")",
";",
"copy_v3_v3",
"(",
"mesh_vert",
"(",
"vm",
",",
"i",
",",
"0",
",",
"k",
")",
"->",
"co",
",",
"co",
")",
";",
"if",
"(",
"!",
"weld",
")",
"{",
"create_mesh_bmvert",
"(",
"bm",
",",
"vm",
",",
"i",
",",
"0",
",",
"k",
",",
"bv",
"->",
"v",
")",
";",
"}",
"}",
"else",
"if",
"(",
"n",
"==",
"2",
"&&",
"!",
"v",
"->",
"ebev",
"&&",
"vm",
"->",
"mesh_kind",
"!=",
"M_ADJ",
")",
"{",
"copy_mesh_vert",
"(",
"vm",
",",
"i",
",",
"0",
",",
"k",
",",
"1",
"-",
"i",
",",
"0",
",",
"ns",
"-",
"k",
")",
";",
"}",
"}",
"}",
"while",
"(",
"(",
"v",
"=",
"v",
"->",
"next",
")",
"!=",
"vm",
"->",
"boundstart",
")",
";",
"if",
"(",
"weld",
")",
"{",
"vm",
"->",
"mesh_kind",
"=",
"M_NONE",
";",
"for",
"(",
"k",
"=",
"1",
";",
"k",
"<",
"ns",
";",
"k",
"++",
")",
"{",
"va",
"=",
"mesh_vert",
"(",
"vm",
",",
"weld1",
"->",
"index",
",",
"0",
",",
"k",
")",
"->",
"co",
";",
"vb",
"=",
"mesh_vert",
"(",
"vm",
",",
"weld2",
"->",
"index",
",",
"0",
",",
"ns",
"-",
"k",
")",
"->",
"co",
";",
"if",
"(",
"weld1",
"->",
"profile",
".",
"super_r",
"==",
"PRO_LINE_R",
"&&",
"weld2",
"->",
"profile",
".",
"super_r",
"!=",
"PRO_LINE_R",
")",
"{",
"copy_v3_v3",
"(",
"co",
",",
"vb",
")",
";",
"}",
"else",
"if",
"(",
"weld2",
"->",
"profile",
".",
"super_r",
"==",
"PRO_LINE_R",
"&&",
"weld1",
"->",
"profile",
".",
"super_r",
"!=",
"PRO_LINE_R",
")",
"{",
"copy_v3_v3",
"(",
"co",
",",
"va",
")",
";",
"}",
"else",
"{",
"mid_v3_v3v3",
"(",
"co",
",",
"va",
",",
"vb",
")",
";",
"}",
"copy_v3_v3",
"(",
"mesh_vert",
"(",
"vm",
",",
"weld1",
"->",
"index",
",",
"0",
",",
"k",
")",
"->",
"co",
",",
"co",
")",
";",
"create_mesh_bmvert",
"(",
"bm",
",",
"vm",
",",
"weld1",
"->",
"index",
",",
"0",
",",
"k",
",",
"bv",
"->",
"v",
")",
";",
"}",
"for",
"(",
"k",
"=",
"1",
";",
"k",
"<",
"ns",
";",
"k",
"++",
")",
"{",
"copy_mesh_vert",
"(",
"vm",
",",
"weld2",
"->",
"index",
",",
"0",
",",
"ns",
"-",
"k",
",",
"weld1",
"->",
"index",
",",
"0",
",",
"k",
")",
";",
"}",
"}",
"switch",
"(",
"vm",
"->",
"mesh_kind",
")",
"{",
"case",
"M_NONE",
":",
"if",
"(",
"n",
"==",
"2",
"&&",
"bp",
"->",
"vertex_only",
")",
"{",
"bevel_vert_two_edges",
"(",
"bp",
",",
"bm",
",",
"bv",
")",
";",
"}",
"break",
";",
"case",
"M_POLY",
":",
"bevel_build_poly",
"(",
"bp",
",",
"bm",
",",
"bv",
")",
";",
"break",
";",
"case",
"M_ADJ",
":",
"bevel_build_rings",
"(",
"bp",
",",
"bm",
",",
"bv",
")",
";",
"break",
";",
"case",
"M_TRI_FAN",
":",
"bevel_build_trifan",
"(",
"bp",
",",
"bm",
",",
"bv",
")",
";",
"break",
";",
"}",
"}"
] | Given that the boundary is built, now make the actual BMVerts
for the boundary and the interior of the vertex mesh. | [
"Given",
"that",
"the",
"boundary",
"is",
"built",
"now",
"make",
"the",
"actual",
"BMVerts",
"for",
"the",
"boundary",
"and",
"the",
"interior",
"of",
"the",
"vertex",
"mesh",
"."
] | [
"/* special case: two beveled ends welded together */",
"/* will hold two BoundVerts involved in weld */",
"/* make (i, 0, 0) mesh verts for all i */",
"/* copy other ends to (i, 0, ns) for all i, and fill in profiles for edges */",
"/* case of one edge beveled and this is the v without ebev */",
"/* want to copy the verts from other v, in reverse order */",
"/* if one of the profiles is on a flat plane,\n * just use the boundary point of the other */"
] | [
{
"param": "bp",
"type": "BevelParams"
},
{
"param": "bm",
"type": "BMesh"
},
{
"param": "bv",
"type": "BevVert"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bp",
"type": "BevelParams",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bm",
"type": "BMesh",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bv",
"type": "BevVert",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
797e2ca864e674d30732f6f1e8ff98ecac74b2ed | DemonRem/blender | source/blender/bmesh/tools/bmesh_bevel.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | edge_face_angle | float | static float edge_face_angle(EdgeHalf *e)
{
if (e->fprev && e->fnext) {
/* angle between faces is supplement of angle between face normals */
return (float)M_PI - angle_normalized_v3v3(e->fprev->no, e->fnext->no);
}
else {
return 0.0f;
}
} | /* Return the angle between the two faces adjacent to e.
* If there are not two, return 0. */ | Return the angle between the two faces adjacent to e.
If there are not two, return 0. | [
"Return",
"the",
"angle",
"between",
"the",
"two",
"faces",
"adjacent",
"to",
"e",
".",
"If",
"there",
"are",
"not",
"two",
"return",
"0",
"."
] | static float edge_face_angle(EdgeHalf *e)
{
if (e->fprev && e->fnext) {
return (float)M_PI - angle_normalized_v3v3(e->fprev->no, e->fnext->no);
}
else {
return 0.0f;
}
} | [
"static",
"float",
"edge_face_angle",
"(",
"EdgeHalf",
"*",
"e",
")",
"{",
"if",
"(",
"e",
"->",
"fprev",
"&&",
"e",
"->",
"fnext",
")",
"{",
"return",
"(",
"float",
")",
"M_PI",
"-",
"angle_normalized_v3v3",
"(",
"e",
"->",
"fprev",
"->",
"no",
",",
"e",
"->",
"fnext",
"->",
"no",
")",
";",
"}",
"else",
"{",
"return",
"0.0f",
";",
"}",
"}"
] | Return the angle between the two faces adjacent to e.
If there are not two, return 0. | [
"Return",
"the",
"angle",
"between",
"the",
"two",
"faces",
"adjacent",
"to",
"e",
".",
"If",
"there",
"are",
"not",
"two",
"return",
"0",
"."
] | [
"/* angle between faces is supplement of angle between face normals */"
] | [
{
"param": "e",
"type": "EdgeHalf"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "e",
"type": "EdgeHalf",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
797e2ca864e674d30732f6f1e8ff98ecac74b2ed | DemonRem/blender | source/blender/bmesh/tools/bmesh_bevel.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | bevel_edge_order_extend | int | static int bevel_edge_order_extend(BMesh *bm, BevVert *bv, int i)
{
BMEdge *bme, *bme2, *nextbme;
BMLoop *l;
BMIter iter;
int j, tryj, bestj, nsucs, sucindex, k;
BMEdge **sucs = NULL;
BMEdge **save_path = NULL;
BLI_array_staticdeclare(sucs, 4); /* likely very few faces attached to same edge */
BLI_array_staticdeclare(save_path, BM_DEFAULT_NGON_STACK_SIZE);
bme = bv->edges[i].e;
/* fill sucs with all unmarked edges of bmes */
BM_ITER_ELEM (l, &iter, bme, BM_LOOPS_OF_EDGE) {
bme2 = (l->v == bv->v) ? l->prev->e : l->next->e;
if (!BM_BEVEL_EDGE_TAG_TEST(bme2)) {
BLI_array_append(sucs, bme2);
}
}
nsucs = BLI_array_len(sucs);
bestj = j = i;
for (sucindex = 0; sucindex < nsucs; sucindex++) {
nextbme = sucs[sucindex];
BLI_assert(nextbme != NULL);
BLI_assert(!BM_BEVEL_EDGE_TAG_TEST(nextbme));
BLI_assert(j + 1 < bv->edgecount);
bv->edges[j + 1].e = nextbme;
BM_BEVEL_EDGE_TAG_ENABLE(nextbme);
tryj = bevel_edge_order_extend(bm, bv, j + 1);
if (tryj > bestj ||
(tryj == bestj && edges_face_connected_at_vert(bv->edges[tryj].e, bv->edges[0].e))) {
bestj = tryj;
BLI_array_clear(save_path);
for (k = j + 1; k <= bestj; k++) {
BLI_array_append(save_path, bv->edges[k].e);
}
}
/* now reset to path only-going-to-j state */
for (k = j + 1; k <= tryj; k++) {
BM_BEVEL_EDGE_TAG_DISABLE(bv->edges[k].e);
bv->edges[k].e = NULL;
}
}
/* at this point we should be back at invariant on entrance: path up to j */
if (bestj > j) {
/* save_path should have from j + 1 to bestj inclusive
* edges to add to edges[] before returning. */
for (k = j + 1; k <= bestj; k++) {
BLI_assert(save_path[k - (j + 1)] != NULL);
bv->edges[k].e = save_path[k - (j + 1)];
BM_BEVEL_EDGE_TAG_ENABLE(bv->edges[k].e);
}
}
BLI_array_free(sucs);
BLI_array_free(save_path);
return bestj;
} | /* Try to extend the bv->edges[] array beyond i by finding more successor edges.
* This is a possibly exponential-time search, but it is only exponential in the number
* of "internal faces" at a vertex -- i.e., faces that bridge between the edges that naturally
* form a manifold cap around bv. It is rare to have more than one of these, so unlikely
* that the exponential time case will be hit in practice.
* Returns the new index i' where bv->edges[i'] ends the best path found.
* The path will have the tags of all of its edges set. */ | Try to extend the bv->edges[] array beyond i by finding more successor edges.
This is a possibly exponential-time search, but it is only exponential in the number
of "internal faces" at a vertex -- i.e., faces that bridge between the edges that naturally
form a manifold cap around bv. It is rare to have more than one of these, so unlikely
that the exponential time case will be hit in practice.
Returns the new index i' where bv->edges[i'] ends the best path found.
The path will have the tags of all of its edges set. | [
"Try",
"to",
"extend",
"the",
"bv",
"-",
">",
"edges",
"[]",
"array",
"beyond",
"i",
"by",
"finding",
"more",
"successor",
"edges",
".",
"This",
"is",
"a",
"possibly",
"exponential",
"-",
"time",
"search",
"but",
"it",
"is",
"only",
"exponential",
"in",
"the",
"number",
"of",
"\"",
"internal",
"faces",
"\"",
"at",
"a",
"vertex",
"--",
"i",
".",
"e",
".",
"faces",
"that",
"bridge",
"between",
"the",
"edges",
"that",
"naturally",
"form",
"a",
"manifold",
"cap",
"around",
"bv",
".",
"It",
"is",
"rare",
"to",
"have",
"more",
"than",
"one",
"of",
"these",
"so",
"unlikely",
"that",
"the",
"exponential",
"time",
"case",
"will",
"be",
"hit",
"in",
"practice",
".",
"Returns",
"the",
"new",
"index",
"i",
"'",
"where",
"bv",
"-",
">",
"edges",
"[",
"i",
"'",
"]",
"ends",
"the",
"best",
"path",
"found",
".",
"The",
"path",
"will",
"have",
"the",
"tags",
"of",
"all",
"of",
"its",
"edges",
"set",
"."
] | static int bevel_edge_order_extend(BMesh *bm, BevVert *bv, int i)
{
BMEdge *bme, *bme2, *nextbme;
BMLoop *l;
BMIter iter;
int j, tryj, bestj, nsucs, sucindex, k;
BMEdge **sucs = NULL;
BMEdge **save_path = NULL;
BLI_array_staticdeclare(sucs, 4);
BLI_array_staticdeclare(save_path, BM_DEFAULT_NGON_STACK_SIZE);
bme = bv->edges[i].e;
BM_ITER_ELEM (l, &iter, bme, BM_LOOPS_OF_EDGE) {
bme2 = (l->v == bv->v) ? l->prev->e : l->next->e;
if (!BM_BEVEL_EDGE_TAG_TEST(bme2)) {
BLI_array_append(sucs, bme2);
}
}
nsucs = BLI_array_len(sucs);
bestj = j = i;
for (sucindex = 0; sucindex < nsucs; sucindex++) {
nextbme = sucs[sucindex];
BLI_assert(nextbme != NULL);
BLI_assert(!BM_BEVEL_EDGE_TAG_TEST(nextbme));
BLI_assert(j + 1 < bv->edgecount);
bv->edges[j + 1].e = nextbme;
BM_BEVEL_EDGE_TAG_ENABLE(nextbme);
tryj = bevel_edge_order_extend(bm, bv, j + 1);
if (tryj > bestj ||
(tryj == bestj && edges_face_connected_at_vert(bv->edges[tryj].e, bv->edges[0].e))) {
bestj = tryj;
BLI_array_clear(save_path);
for (k = j + 1; k <= bestj; k++) {
BLI_array_append(save_path, bv->edges[k].e);
}
}
for (k = j + 1; k <= tryj; k++) {
BM_BEVEL_EDGE_TAG_DISABLE(bv->edges[k].e);
bv->edges[k].e = NULL;
}
}
if (bestj > j) {
for (k = j + 1; k <= bestj; k++) {
BLI_assert(save_path[k - (j + 1)] != NULL);
bv->edges[k].e = save_path[k - (j + 1)];
BM_BEVEL_EDGE_TAG_ENABLE(bv->edges[k].e);
}
}
BLI_array_free(sucs);
BLI_array_free(save_path);
return bestj;
} | [
"static",
"int",
"bevel_edge_order_extend",
"(",
"BMesh",
"*",
"bm",
",",
"BevVert",
"*",
"bv",
",",
"int",
"i",
")",
"{",
"BMEdge",
"*",
"bme",
",",
"*",
"bme2",
",",
"*",
"nextbme",
";",
"BMLoop",
"*",
"l",
";",
"BMIter",
"iter",
";",
"int",
"j",
",",
"tryj",
",",
"bestj",
",",
"nsucs",
",",
"sucindex",
",",
"k",
";",
"BMEdge",
"*",
"*",
"sucs",
"=",
"NULL",
";",
"BMEdge",
"*",
"*",
"save_path",
"=",
"NULL",
";",
"BLI_array_staticdeclare",
"(",
"sucs",
",",
"4",
")",
";",
"BLI_array_staticdeclare",
"(",
"save_path",
",",
"BM_DEFAULT_NGON_STACK_SIZE",
")",
";",
"bme",
"=",
"bv",
"->",
"edges",
"[",
"i",
"]",
".",
"e",
";",
"BM_ITER_ELEM",
"(",
"l",
",",
"&",
"iter",
",",
"bme",
",",
"BM_LOOPS_OF_EDGE",
")",
"",
"{",
"bme2",
"=",
"(",
"l",
"->",
"v",
"==",
"bv",
"->",
"v",
")",
"?",
"l",
"->",
"prev",
"->",
"e",
":",
"l",
"->",
"next",
"->",
"e",
";",
"if",
"(",
"!",
"BM_BEVEL_EDGE_TAG_TEST",
"(",
"bme2",
")",
")",
"{",
"BLI_array_append",
"(",
"sucs",
",",
"bme2",
")",
";",
"}",
"}",
"nsucs",
"=",
"BLI_array_len",
"(",
"sucs",
")",
";",
"bestj",
"=",
"j",
"=",
"i",
";",
"for",
"(",
"sucindex",
"=",
"0",
";",
"sucindex",
"<",
"nsucs",
";",
"sucindex",
"++",
")",
"{",
"nextbme",
"=",
"sucs",
"[",
"sucindex",
"]",
";",
"BLI_assert",
"(",
"nextbme",
"!=",
"NULL",
")",
";",
"BLI_assert",
"(",
"!",
"BM_BEVEL_EDGE_TAG_TEST",
"(",
"nextbme",
")",
")",
";",
"BLI_assert",
"(",
"j",
"+",
"1",
"<",
"bv",
"->",
"edgecount",
")",
";",
"bv",
"->",
"edges",
"[",
"j",
"+",
"1",
"]",
".",
"e",
"=",
"nextbme",
";",
"BM_BEVEL_EDGE_TAG_ENABLE",
"(",
"nextbme",
")",
";",
"tryj",
"=",
"bevel_edge_order_extend",
"(",
"bm",
",",
"bv",
",",
"j",
"+",
"1",
")",
";",
"if",
"(",
"tryj",
">",
"bestj",
"||",
"(",
"tryj",
"==",
"bestj",
"&&",
"edges_face_connected_at_vert",
"(",
"bv",
"->",
"edges",
"[",
"tryj",
"]",
".",
"e",
",",
"bv",
"->",
"edges",
"[",
"0",
"]",
".",
"e",
")",
")",
")",
"{",
"bestj",
"=",
"tryj",
";",
"BLI_array_clear",
"(",
"save_path",
")",
";",
"for",
"(",
"k",
"=",
"j",
"+",
"1",
";",
"k",
"<=",
"bestj",
";",
"k",
"++",
")",
"{",
"BLI_array_append",
"(",
"save_path",
",",
"bv",
"->",
"edges",
"[",
"k",
"]",
".",
"e",
")",
";",
"}",
"}",
"for",
"(",
"k",
"=",
"j",
"+",
"1",
";",
"k",
"<=",
"tryj",
";",
"k",
"++",
")",
"{",
"BM_BEVEL_EDGE_TAG_DISABLE",
"(",
"bv",
"->",
"edges",
"[",
"k",
"]",
".",
"e",
")",
";",
"bv",
"->",
"edges",
"[",
"k",
"]",
".",
"e",
"=",
"NULL",
";",
"}",
"}",
"if",
"(",
"bestj",
">",
"j",
")",
"{",
"for",
"(",
"k",
"=",
"j",
"+",
"1",
";",
"k",
"<=",
"bestj",
";",
"k",
"++",
")",
"{",
"BLI_assert",
"(",
"save_path",
"[",
"k",
"-",
"(",
"j",
"+",
"1",
")",
"]",
"!=",
"NULL",
")",
";",
"bv",
"->",
"edges",
"[",
"k",
"]",
".",
"e",
"=",
"save_path",
"[",
"k",
"-",
"(",
"j",
"+",
"1",
")",
"]",
";",
"BM_BEVEL_EDGE_TAG_ENABLE",
"(",
"bv",
"->",
"edges",
"[",
"k",
"]",
".",
"e",
")",
";",
"}",
"}",
"BLI_array_free",
"(",
"sucs",
")",
";",
"BLI_array_free",
"(",
"save_path",
")",
";",
"return",
"bestj",
";",
"}"
] | Try to extend the bv->edges[] array beyond i by finding more successor edges. | [
"Try",
"to",
"extend",
"the",
"bv",
"-",
">",
"edges",
"[]",
"array",
"beyond",
"i",
"by",
"finding",
"more",
"successor",
"edges",
"."
] | [
"/* likely very few faces attached to same edge */",
"/* fill sucs with all unmarked edges of bmes */",
"/* now reset to path only-going-to-j state */",
"/* at this point we should be back at invariant on entrance: path up to j */",
"/* save_path should have from j + 1 to bestj inclusive\n * edges to add to edges[] before returning. */"
] | [
{
"param": "bm",
"type": "BMesh"
},
{
"param": "bv",
"type": "BevVert"
},
{
"param": "i",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bm",
"type": "BMesh",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bv",
"type": "BevVert",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "i",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
797e2ca864e674d30732f6f1e8ff98ecac74b2ed | DemonRem/blender | source/blender/bmesh/tools/bmesh_bevel.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | fast_bevel_edge_order | bool | static bool fast_bevel_edge_order(BevVert *bv)
{
int j, k, nsucs;
BMEdge *bme, *bme2, *bmenext;
BMIter iter;
BMLoop *l;
for (j = 1; j < bv->edgecount; j++) {
bme = bv->edges[j - 1].e;
bmenext = NULL;
nsucs = 0;
BM_ITER_ELEM (l, &iter, bme, BM_LOOPS_OF_EDGE) {
bme2 = (l->v == bv->v) ? l->prev->e : l->next->e;
if (!BM_BEVEL_EDGE_TAG_TEST(bme2)) {
nsucs++;
if (bmenext == NULL) {
bmenext = bme2;
}
}
}
if (nsucs == 0 || (nsucs == 2 && j != 1) || nsucs > 2 ||
(j == bv->edgecount - 1 && !edges_face_connected_at_vert(bmenext, bv->edges[0].e))) {
for (k = 1; k < j; k++) {
BM_BEVEL_EDGE_TAG_DISABLE(bv->edges[k].e);
bv->edges[k].e = NULL;
}
return false;
}
bv->edges[j].e = bmenext;
BM_BEVEL_EDGE_TAG_ENABLE(bmenext);
}
return true;
} | /* The alternative older code is O(n^2) where n = # of edges incident to bv->v.
* This implementation is O(n * m) where m = average number of faces attached to an edge incident
* to bv->v, which is almost certainly a small constant except in very strange cases.
* But this code produces different choices of ordering than the legacy system,
* leading to differences in vertex orders etc. in user models,
* so for now will continue to use the legacy code. */ | The alternative older code is O(n^2) where n = # of edges incident to bv->v.
This implementation is O(n * m) where m = average number of faces attached to an edge incident
to bv->v, which is almost certainly a small constant except in very strange cases.
But this code produces different choices of ordering than the legacy system,
leading to differences in vertex orders etc. in user models,
so for now will continue to use the legacy code. | [
"The",
"alternative",
"older",
"code",
"is",
"O",
"(",
"n^2",
")",
"where",
"n",
"=",
"#",
"of",
"edges",
"incident",
"to",
"bv",
"-",
">",
"v",
".",
"This",
"implementation",
"is",
"O",
"(",
"n",
"*",
"m",
")",
"where",
"m",
"=",
"average",
"number",
"of",
"faces",
"attached",
"to",
"an",
"edge",
"incident",
"to",
"bv",
"-",
">",
"v",
"which",
"is",
"almost",
"certainly",
"a",
"small",
"constant",
"except",
"in",
"very",
"strange",
"cases",
".",
"But",
"this",
"code",
"produces",
"different",
"choices",
"of",
"ordering",
"than",
"the",
"legacy",
"system",
"leading",
"to",
"differences",
"in",
"vertex",
"orders",
"etc",
".",
"in",
"user",
"models",
"so",
"for",
"now",
"will",
"continue",
"to",
"use",
"the",
"legacy",
"code",
"."
] | static bool fast_bevel_edge_order(BevVert *bv)
{
int j, k, nsucs;
BMEdge *bme, *bme2, *bmenext;
BMIter iter;
BMLoop *l;
for (j = 1; j < bv->edgecount; j++) {
bme = bv->edges[j - 1].e;
bmenext = NULL;
nsucs = 0;
BM_ITER_ELEM (l, &iter, bme, BM_LOOPS_OF_EDGE) {
bme2 = (l->v == bv->v) ? l->prev->e : l->next->e;
if (!BM_BEVEL_EDGE_TAG_TEST(bme2)) {
nsucs++;
if (bmenext == NULL) {
bmenext = bme2;
}
}
}
if (nsucs == 0 || (nsucs == 2 && j != 1) || nsucs > 2 ||
(j == bv->edgecount - 1 && !edges_face_connected_at_vert(bmenext, bv->edges[0].e))) {
for (k = 1; k < j; k++) {
BM_BEVEL_EDGE_TAG_DISABLE(bv->edges[k].e);
bv->edges[k].e = NULL;
}
return false;
}
bv->edges[j].e = bmenext;
BM_BEVEL_EDGE_TAG_ENABLE(bmenext);
}
return true;
} | [
"static",
"bool",
"fast_bevel_edge_order",
"(",
"BevVert",
"*",
"bv",
")",
"{",
"int",
"j",
",",
"k",
",",
"nsucs",
";",
"BMEdge",
"*",
"bme",
",",
"*",
"bme2",
",",
"*",
"bmenext",
";",
"BMIter",
"iter",
";",
"BMLoop",
"*",
"l",
";",
"for",
"(",
"j",
"=",
"1",
";",
"j",
"<",
"bv",
"->",
"edgecount",
";",
"j",
"++",
")",
"{",
"bme",
"=",
"bv",
"->",
"edges",
"[",
"j",
"-",
"1",
"]",
".",
"e",
";",
"bmenext",
"=",
"NULL",
";",
"nsucs",
"=",
"0",
";",
"BM_ITER_ELEM",
"(",
"l",
",",
"&",
"iter",
",",
"bme",
",",
"BM_LOOPS_OF_EDGE",
")",
"",
"{",
"bme2",
"=",
"(",
"l",
"->",
"v",
"==",
"bv",
"->",
"v",
")",
"?",
"l",
"->",
"prev",
"->",
"e",
":",
"l",
"->",
"next",
"->",
"e",
";",
"if",
"(",
"!",
"BM_BEVEL_EDGE_TAG_TEST",
"(",
"bme2",
")",
")",
"{",
"nsucs",
"++",
";",
"if",
"(",
"bmenext",
"==",
"NULL",
")",
"{",
"bmenext",
"=",
"bme2",
";",
"}",
"}",
"}",
"if",
"(",
"nsucs",
"==",
"0",
"||",
"(",
"nsucs",
"==",
"2",
"&&",
"j",
"!=",
"1",
")",
"||",
"nsucs",
">",
"2",
"||",
"(",
"j",
"==",
"bv",
"->",
"edgecount",
"-",
"1",
"&&",
"!",
"edges_face_connected_at_vert",
"(",
"bmenext",
",",
"bv",
"->",
"edges",
"[",
"0",
"]",
".",
"e",
")",
")",
")",
"{",
"for",
"(",
"k",
"=",
"1",
";",
"k",
"<",
"j",
";",
"k",
"++",
")",
"{",
"BM_BEVEL_EDGE_TAG_DISABLE",
"(",
"bv",
"->",
"edges",
"[",
"k",
"]",
".",
"e",
")",
";",
"bv",
"->",
"edges",
"[",
"k",
"]",
".",
"e",
"=",
"NULL",
";",
"}",
"return",
"false",
";",
"}",
"bv",
"->",
"edges",
"[",
"j",
"]",
".",
"e",
"=",
"bmenext",
";",
"BM_BEVEL_EDGE_TAG_ENABLE",
"(",
"bmenext",
")",
";",
"}",
"return",
"true",
";",
"}"
] | The alternative older code is O(n^2) where n = # of edges incident to bv->v. | [
"The",
"alternative",
"older",
"code",
"is",
"O",
"(",
"n^2",
")",
"where",
"n",
"=",
"#",
"of",
"edges",
"incident",
"to",
"bv",
"-",
">",
"v",
"."
] | [] | [
{
"param": "bv",
"type": "BevVert"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bv",
"type": "BevVert",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
797e2ca864e674d30732f6f1e8ff98ecac74b2ed | DemonRem/blender | source/blender/bmesh/tools/bmesh_bevel.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | bevel_rebuild_existing_polygons | void | static void bevel_rebuild_existing_polygons(BMesh *bm, BevelParams *bp, BMVert *v)
{
void *faces_stack[BM_DEFAULT_ITER_STACK_SIZE];
int faces_len, f_index;
BMFace **faces = BM_iter_as_arrayN(
bm, BM_FACES_OF_VERT, v, &faces_len, faces_stack, BM_DEFAULT_ITER_STACK_SIZE);
if (LIKELY(faces != NULL)) {
for (f_index = 0; f_index < faces_len; f_index++) {
BMFace *f = faces[f_index];
if (bev_rebuild_polygon(bm, bp, f)) {
BM_face_kill(bm, f);
}
}
if (faces != (BMFace **)faces_stack) {
MEM_freeN(faces);
}
}
} | /* All polygons touching v need rebuilding because beveling v has made new vertices */ | All polygons touching v need rebuilding because beveling v has made new vertices | [
"All",
"polygons",
"touching",
"v",
"need",
"rebuilding",
"because",
"beveling",
"v",
"has",
"made",
"new",
"vertices"
] | static void bevel_rebuild_existing_polygons(BMesh *bm, BevelParams *bp, BMVert *v)
{
void *faces_stack[BM_DEFAULT_ITER_STACK_SIZE];
int faces_len, f_index;
BMFace **faces = BM_iter_as_arrayN(
bm, BM_FACES_OF_VERT, v, &faces_len, faces_stack, BM_DEFAULT_ITER_STACK_SIZE);
if (LIKELY(faces != NULL)) {
for (f_index = 0; f_index < faces_len; f_index++) {
BMFace *f = faces[f_index];
if (bev_rebuild_polygon(bm, bp, f)) {
BM_face_kill(bm, f);
}
}
if (faces != (BMFace **)faces_stack) {
MEM_freeN(faces);
}
}
} | [
"static",
"void",
"bevel_rebuild_existing_polygons",
"(",
"BMesh",
"*",
"bm",
",",
"BevelParams",
"*",
"bp",
",",
"BMVert",
"*",
"v",
")",
"{",
"void",
"*",
"faces_stack",
"[",
"BM_DEFAULT_ITER_STACK_SIZE",
"]",
";",
"int",
"faces_len",
",",
"f_index",
";",
"BMFace",
"*",
"*",
"faces",
"=",
"BM_iter_as_arrayN",
"(",
"bm",
",",
"BM_FACES_OF_VERT",
",",
"v",
",",
"&",
"faces_len",
",",
"faces_stack",
",",
"BM_DEFAULT_ITER_STACK_SIZE",
")",
";",
"if",
"(",
"LIKELY",
"(",
"faces",
"!=",
"NULL",
")",
")",
"{",
"for",
"(",
"f_index",
"=",
"0",
";",
"f_index",
"<",
"faces_len",
";",
"f_index",
"++",
")",
"{",
"BMFace",
"*",
"f",
"=",
"faces",
"[",
"f_index",
"]",
";",
"if",
"(",
"bev_rebuild_polygon",
"(",
"bm",
",",
"bp",
",",
"f",
")",
")",
"{",
"BM_face_kill",
"(",
"bm",
",",
"f",
")",
";",
"}",
"}",
"if",
"(",
"faces",
"!=",
"(",
"BMFace",
"*",
"*",
")",
"faces_stack",
")",
"{",
"MEM_freeN",
"(",
"faces",
")",
";",
"}",
"}",
"}"
] | All polygons touching v need rebuilding because beveling v has made new vertices | [
"All",
"polygons",
"touching",
"v",
"need",
"rebuilding",
"because",
"beveling",
"v",
"has",
"made",
"new",
"vertices"
] | [] | [
{
"param": "bm",
"type": "BMesh"
},
{
"param": "bp",
"type": "BevelParams"
},
{
"param": "v",
"type": "BMVert"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bm",
"type": "BMesh",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bp",
"type": "BevelParams",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "v",
"type": "BMVert",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
797e2ca864e674d30732f6f1e8ff98ecac74b2ed | DemonRem/blender | source/blender/bmesh/tools/bmesh_bevel.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | bevel_reattach_wires | void | static void bevel_reattach_wires(BMesh *bm, BevelParams *bp, BMVert *v)
{
BMEdge *e;
BMVert *vclosest, *vother, *votherclosest;
BevVert *bv, *bvother;
BoundVert *bndv, *bndvother;
float d, dclosest;
int i;
bv = find_bevvert(bp, v);
if (!bv || bv->wirecount == 0 || !bv->vmesh) {
return;
}
for (i = 0; i < bv->wirecount; i++) {
e = bv->wire_edges[i];
/* look for the new vertex closest to the other end of e */
vclosest = NULL;
dclosest = FLT_MAX;
votherclosest = NULL;
vother = BM_edge_other_vert(e, v);
bvother = NULL;
if (BM_elem_flag_test(vother, BM_ELEM_TAG)) {
bvother = find_bevvert(bp, vother);
if (!bvother || !bvother->vmesh) {
return; /* shouldn't happen */
}
}
bndv = bv->vmesh->boundstart;
do {
if (bvother) {
bndvother = bvother->vmesh->boundstart;
do {
d = len_squared_v3v3(bndvother->nv.co, bndv->nv.co);
if (d < dclosest) {
vclosest = bndv->nv.v;
votherclosest = bndvother->nv.v;
dclosest = d;
}
} while ((bndvother = bndvother->next) != bvother->vmesh->boundstart);
}
else {
d = len_squared_v3v3(vother->co, bndv->nv.co);
if (d < dclosest) {
vclosest = bndv->nv.v;
votherclosest = vother;
dclosest = d;
}
}
} while ((bndv = bndv->next) != bv->vmesh->boundstart);
if (vclosest) {
BM_edge_create(bm, vclosest, votherclosest, e, BM_CREATE_NO_DOUBLE);
}
}
} | /* If there were any wire edges, they need to be reattached somewhere */ | If there were any wire edges, they need to be reattached somewhere | [
"If",
"there",
"were",
"any",
"wire",
"edges",
"they",
"need",
"to",
"be",
"reattached",
"somewhere"
] | static void bevel_reattach_wires(BMesh *bm, BevelParams *bp, BMVert *v)
{
BMEdge *e;
BMVert *vclosest, *vother, *votherclosest;
BevVert *bv, *bvother;
BoundVert *bndv, *bndvother;
float d, dclosest;
int i;
bv = find_bevvert(bp, v);
if (!bv || bv->wirecount == 0 || !bv->vmesh) {
return;
}
for (i = 0; i < bv->wirecount; i++) {
e = bv->wire_edges[i];
vclosest = NULL;
dclosest = FLT_MAX;
votherclosest = NULL;
vother = BM_edge_other_vert(e, v);
bvother = NULL;
if (BM_elem_flag_test(vother, BM_ELEM_TAG)) {
bvother = find_bevvert(bp, vother);
if (!bvother || !bvother->vmesh) {
return;
}
}
bndv = bv->vmesh->boundstart;
do {
if (bvother) {
bndvother = bvother->vmesh->boundstart;
do {
d = len_squared_v3v3(bndvother->nv.co, bndv->nv.co);
if (d < dclosest) {
vclosest = bndv->nv.v;
votherclosest = bndvother->nv.v;
dclosest = d;
}
} while ((bndvother = bndvother->next) != bvother->vmesh->boundstart);
}
else {
d = len_squared_v3v3(vother->co, bndv->nv.co);
if (d < dclosest) {
vclosest = bndv->nv.v;
votherclosest = vother;
dclosest = d;
}
}
} while ((bndv = bndv->next) != bv->vmesh->boundstart);
if (vclosest) {
BM_edge_create(bm, vclosest, votherclosest, e, BM_CREATE_NO_DOUBLE);
}
}
} | [
"static",
"void",
"bevel_reattach_wires",
"(",
"BMesh",
"*",
"bm",
",",
"BevelParams",
"*",
"bp",
",",
"BMVert",
"*",
"v",
")",
"{",
"BMEdge",
"*",
"e",
";",
"BMVert",
"*",
"vclosest",
",",
"*",
"vother",
",",
"*",
"votherclosest",
";",
"BevVert",
"*",
"bv",
",",
"*",
"bvother",
";",
"BoundVert",
"*",
"bndv",
",",
"*",
"bndvother",
";",
"float",
"d",
",",
"dclosest",
";",
"int",
"i",
";",
"bv",
"=",
"find_bevvert",
"(",
"bp",
",",
"v",
")",
";",
"if",
"(",
"!",
"bv",
"||",
"bv",
"->",
"wirecount",
"==",
"0",
"||",
"!",
"bv",
"->",
"vmesh",
")",
"{",
"return",
";",
"}",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"bv",
"->",
"wirecount",
";",
"i",
"++",
")",
"{",
"e",
"=",
"bv",
"->",
"wire_edges",
"[",
"i",
"]",
";",
"vclosest",
"=",
"NULL",
";",
"dclosest",
"=",
"FLT_MAX",
";",
"votherclosest",
"=",
"NULL",
";",
"vother",
"=",
"BM_edge_other_vert",
"(",
"e",
",",
"v",
")",
";",
"bvother",
"=",
"NULL",
";",
"if",
"(",
"BM_elem_flag_test",
"(",
"vother",
",",
"BM_ELEM_TAG",
")",
")",
"{",
"bvother",
"=",
"find_bevvert",
"(",
"bp",
",",
"vother",
")",
";",
"if",
"(",
"!",
"bvother",
"||",
"!",
"bvother",
"->",
"vmesh",
")",
"{",
"return",
";",
"}",
"}",
"bndv",
"=",
"bv",
"->",
"vmesh",
"->",
"boundstart",
";",
"do",
"{",
"if",
"(",
"bvother",
")",
"{",
"bndvother",
"=",
"bvother",
"->",
"vmesh",
"->",
"boundstart",
";",
"do",
"{",
"d",
"=",
"len_squared_v3v3",
"(",
"bndvother",
"->",
"nv",
".",
"co",
",",
"bndv",
"->",
"nv",
".",
"co",
")",
";",
"if",
"(",
"d",
"<",
"dclosest",
")",
"{",
"vclosest",
"=",
"bndv",
"->",
"nv",
".",
"v",
";",
"votherclosest",
"=",
"bndvother",
"->",
"nv",
".",
"v",
";",
"dclosest",
"=",
"d",
";",
"}",
"}",
"while",
"(",
"(",
"bndvother",
"=",
"bndvother",
"->",
"next",
")",
"!=",
"bvother",
"->",
"vmesh",
"->",
"boundstart",
")",
";",
"}",
"else",
"{",
"d",
"=",
"len_squared_v3v3",
"(",
"vother",
"->",
"co",
",",
"bndv",
"->",
"nv",
".",
"co",
")",
";",
"if",
"(",
"d",
"<",
"dclosest",
")",
"{",
"vclosest",
"=",
"bndv",
"->",
"nv",
".",
"v",
";",
"votherclosest",
"=",
"vother",
";",
"dclosest",
"=",
"d",
";",
"}",
"}",
"}",
"while",
"(",
"(",
"bndv",
"=",
"bndv",
"->",
"next",
")",
"!=",
"bv",
"->",
"vmesh",
"->",
"boundstart",
")",
";",
"if",
"(",
"vclosest",
")",
"{",
"BM_edge_create",
"(",
"bm",
",",
"vclosest",
",",
"votherclosest",
",",
"e",
",",
"BM_CREATE_NO_DOUBLE",
")",
";",
"}",
"}",
"}"
] | If there were any wire edges, they need to be reattached somewhere | [
"If",
"there",
"were",
"any",
"wire",
"edges",
"they",
"need",
"to",
"be",
"reattached",
"somewhere"
] | [
"/* look for the new vertex closest to the other end of e */",
"/* shouldn't happen */"
] | [
{
"param": "bm",
"type": "BMesh"
},
{
"param": "bp",
"type": "BevelParams"
},
{
"param": "v",
"type": "BMVert"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bm",
"type": "BMesh",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bp",
"type": "BevelParams",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "v",
"type": "BMVert",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
797e2ca864e674d30732f6f1e8ff98ecac74b2ed | DemonRem/blender | source/blender/bmesh/tools/bmesh_bevel.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | weld_cross_attrs_copy | void | static void weld_cross_attrs_copy(BMesh *bm, BevVert *bv, VMesh *vm, int vmindex, EdgeHalf *e)
{
BMEdge *bme_prev, *bme_next, *bme;
int i, nseg;
bool disable_seam, enable_smooth;
bme_prev = bme_next = NULL;
for (i = 0; i < 4; i++) {
if (&bv->edges[i] == e) {
bme_prev = bv->edges[(i + 3) % 4].e;
bme_next = bv->edges[(i + 1) % 4].e;
break;
}
}
BLI_assert(bme_prev && bme_next);
/* want seams and sharp edges to cross only if that way on both sides */
disable_seam = BM_elem_flag_test(bme_prev, BM_ELEM_SEAM) !=
BM_elem_flag_test(bme_next, BM_ELEM_SEAM);
enable_smooth = BM_elem_flag_test(bme_prev, BM_ELEM_SMOOTH) !=
BM_elem_flag_test(bme_next, BM_ELEM_SMOOTH);
nseg = e->seg;
for (i = 0; i < nseg; i++) {
bme = BM_edge_exists(mesh_vert(vm, vmindex, 0, i)->v, mesh_vert(vm, vmindex, 0, i + 1)->v);
BLI_assert(bme);
BM_elem_attrs_copy(bm, bm, bme_prev, bme);
if (disable_seam) {
BM_elem_flag_disable(bme, BM_ELEM_SEAM);
}
if (enable_smooth) {
BM_elem_flag_enable(bme, BM_ELEM_SMOOTH);
}
}
} | /*
* Copy edge attribute data across the non-beveled crossing edges of a cross weld.
*
* Situation looks like this:
*
* e->next
* |
* -------3-------
* -------2-------
* -------1------- e
* -------0------
* |
* e->prev
*
* where e is the EdgeHalf of one of the beveled edges,
* e->next and e->prev are EdgeHalfs for the unbeveled edges of the cross
* and their attributes are to be copied to the edges 01, 12, 23.
* The vert i is mesh_vert(vm, vmindex, 0, i)->v
*/ | Copy edge attribute data across the non-beveled crossing edges of a cross weld.
Situation looks like this.
| [
"Copy",
"edge",
"attribute",
"data",
"across",
"the",
"non",
"-",
"beveled",
"crossing",
"edges",
"of",
"a",
"cross",
"weld",
".",
"Situation",
"looks",
"like",
"this",
"."
] | static void weld_cross_attrs_copy(BMesh *bm, BevVert *bv, VMesh *vm, int vmindex, EdgeHalf *e)
{
BMEdge *bme_prev, *bme_next, *bme;
int i, nseg;
bool disable_seam, enable_smooth;
bme_prev = bme_next = NULL;
for (i = 0; i < 4; i++) {
if (&bv->edges[i] == e) {
bme_prev = bv->edges[(i + 3) % 4].e;
bme_next = bv->edges[(i + 1) % 4].e;
break;
}
}
BLI_assert(bme_prev && bme_next);
disable_seam = BM_elem_flag_test(bme_prev, BM_ELEM_SEAM) !=
BM_elem_flag_test(bme_next, BM_ELEM_SEAM);
enable_smooth = BM_elem_flag_test(bme_prev, BM_ELEM_SMOOTH) !=
BM_elem_flag_test(bme_next, BM_ELEM_SMOOTH);
nseg = e->seg;
for (i = 0; i < nseg; i++) {
bme = BM_edge_exists(mesh_vert(vm, vmindex, 0, i)->v, mesh_vert(vm, vmindex, 0, i + 1)->v);
BLI_assert(bme);
BM_elem_attrs_copy(bm, bm, bme_prev, bme);
if (disable_seam) {
BM_elem_flag_disable(bme, BM_ELEM_SEAM);
}
if (enable_smooth) {
BM_elem_flag_enable(bme, BM_ELEM_SMOOTH);
}
}
} | [
"static",
"void",
"weld_cross_attrs_copy",
"(",
"BMesh",
"*",
"bm",
",",
"BevVert",
"*",
"bv",
",",
"VMesh",
"*",
"vm",
",",
"int",
"vmindex",
",",
"EdgeHalf",
"*",
"e",
")",
"{",
"BMEdge",
"*",
"bme_prev",
",",
"*",
"bme_next",
",",
"*",
"bme",
";",
"int",
"i",
",",
"nseg",
";",
"bool",
"disable_seam",
",",
"enable_smooth",
";",
"bme_prev",
"=",
"bme_next",
"=",
"NULL",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"4",
";",
"i",
"++",
")",
"{",
"if",
"(",
"&",
"bv",
"->",
"edges",
"[",
"i",
"]",
"==",
"e",
")",
"{",
"bme_prev",
"=",
"bv",
"->",
"edges",
"[",
"(",
"i",
"+",
"3",
")",
"%",
"4",
"]",
".",
"e",
";",
"bme_next",
"=",
"bv",
"->",
"edges",
"[",
"(",
"i",
"+",
"1",
")",
"%",
"4",
"]",
".",
"e",
";",
"break",
";",
"}",
"}",
"BLI_assert",
"(",
"bme_prev",
"&&",
"bme_next",
")",
";",
"disable_seam",
"=",
"BM_elem_flag_test",
"(",
"bme_prev",
",",
"BM_ELEM_SEAM",
")",
"!=",
"BM_elem_flag_test",
"(",
"bme_next",
",",
"BM_ELEM_SEAM",
")",
";",
"enable_smooth",
"=",
"BM_elem_flag_test",
"(",
"bme_prev",
",",
"BM_ELEM_SMOOTH",
")",
"!=",
"BM_elem_flag_test",
"(",
"bme_next",
",",
"BM_ELEM_SMOOTH",
")",
";",
"nseg",
"=",
"e",
"->",
"seg",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"nseg",
";",
"i",
"++",
")",
"{",
"bme",
"=",
"BM_edge_exists",
"(",
"mesh_vert",
"(",
"vm",
",",
"vmindex",
",",
"0",
",",
"i",
")",
"->",
"v",
",",
"mesh_vert",
"(",
"vm",
",",
"vmindex",
",",
"0",
",",
"i",
"+",
"1",
")",
"->",
"v",
")",
";",
"BLI_assert",
"(",
"bme",
")",
";",
"BM_elem_attrs_copy",
"(",
"bm",
",",
"bm",
",",
"bme_prev",
",",
"bme",
")",
";",
"if",
"(",
"disable_seam",
")",
"{",
"BM_elem_flag_disable",
"(",
"bme",
",",
"BM_ELEM_SEAM",
")",
";",
"}",
"if",
"(",
"enable_smooth",
")",
"{",
"BM_elem_flag_enable",
"(",
"bme",
",",
"BM_ELEM_SMOOTH",
")",
";",
"}",
"}",
"}"
] | Copy edge attribute data across the non-beveled crossing edges of a cross weld. | [
"Copy",
"edge",
"attribute",
"data",
"across",
"the",
"non",
"-",
"beveled",
"crossing",
"edges",
"of",
"a",
"cross",
"weld",
"."
] | [
"/* want seams and sharp edges to cross only if that way on both sides */"
] | [
{
"param": "bm",
"type": "BMesh"
},
{
"param": "bv",
"type": "BevVert"
},
{
"param": "vm",
"type": "VMesh"
},
{
"param": "vmindex",
"type": "int"
},
{
"param": "e",
"type": "EdgeHalf"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bm",
"type": "BMesh",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bv",
"type": "BevVert",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "vm",
"type": "VMesh",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "vmindex",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "e",
"type": "EdgeHalf",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
797e2ca864e674d30732f6f1e8ff98ecac74b2ed | DemonRem/blender | source/blender/bmesh/tools/bmesh_bevel.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | bevel_build_edge_polygons | void | static void bevel_build_edge_polygons(BMesh *bm, BevelParams *bp, BMEdge *bme)
{
BevVert *bv1, *bv2;
BMVert *bmv1, *bmv2, *bmv3, *bmv4;
VMesh *vm1, *vm2;
EdgeHalf *e1, *e2;
BMEdge *bme1, *bme2, *center_bme;
BMFace *f1, *f2, *f, *r_f;
BMVert *verts[4];
BMFace *faces[4];
BMEdge *edges[4];
BMLoop *l;
BMIter iter;
int k, nseg, i1, i2, odd, mid;
int mat_nr = bp->mat_nr;
if (!BM_edge_is_manifold(bme)) {
return;
}
bv1 = find_bevvert(bp, bme->v1);
bv2 = find_bevvert(bp, bme->v2);
BLI_assert(bv1 && bv2);
e1 = find_edge_half(bv1, bme);
e2 = find_edge_half(bv2, bme);
BLI_assert(e1 && e2);
/*
* bme->v1
* / | \
* v1--|--v4
* | | |
* | | |
* v2--|--v3
* \ | /
* bme->v2
*/
nseg = e1->seg;
BLI_assert(nseg > 0 && nseg == e2->seg);
bmv1 = e1->leftv->nv.v;
bmv4 = e1->rightv->nv.v;
bmv2 = e2->rightv->nv.v;
bmv3 = e2->leftv->nv.v;
BLI_assert(bmv1 && bmv2 && bmv3 && bmv4);
f1 = e1->fprev;
f2 = e1->fnext;
faces[0] = faces[1] = f1;
faces[2] = faces[3] = f2;
i1 = e1->leftv->index;
i2 = e2->leftv->index;
vm1 = bv1->vmesh;
vm2 = bv2->vmesh;
verts[0] = bmv1;
verts[1] = bmv2;
odd = nseg % 2;
mid = nseg / 2;
center_bme = NULL;
for (k = 1; k <= nseg; k++) {
verts[3] = mesh_vert(vm1, i1, 0, k)->v;
verts[2] = mesh_vert(vm2, i2, 0, nseg - k)->v;
if (odd && k == mid + 1) {
if (e1->is_seam) {
/* straddles a seam: choose to interpolate in f1 and snap right edge to bme */
edges[0] = edges[1] = NULL;
edges[2] = edges[3] = bme;
r_f = bev_create_ngon(bm, verts, 4, NULL, f1, edges, mat_nr, true);
}
else {
/* straddles but not a seam: interpolate left half in f1, right half in f2 */
r_f = bev_create_ngon(bm, verts, 4, faces, NULL, NULL, mat_nr, true);
}
}
else if (!odd && k == mid) {
/* left poly that touches an even center line on right */
edges[0] = edges[1] = NULL;
edges[2] = edges[3] = bme;
r_f = bev_create_ngon(bm, verts, 4, NULL, f1, edges, mat_nr, true);
center_bme = BM_edge_exists(verts[2], verts[3]);
BLI_assert(center_bme != NULL);
}
else if (!odd && k == mid + 1) {
/* right poly that touches an even center line on left */
edges[0] = edges[1] = bme;
edges[2] = edges[3] = NULL;
r_f = bev_create_ngon(bm, verts, 4, NULL, f2, edges, mat_nr, true);
}
else {
/* doesn't cross or touch the center line, so interpolate in appropriate f1 or f2 */
f = (k <= mid) ? f1 : f2;
r_f = bev_create_ngon(bm, verts, 4, NULL, f, NULL, mat_nr, true);
}
record_face_kind(bp, r_f, F_EDGE);
/* tag the long edges: those out of verts[0] and verts[2] */
BM_ITER_ELEM (l, &iter, r_f, BM_LOOPS_OF_FACE) {
if (l->v == verts[0] || l->v == verts[2]) {
BM_elem_flag_enable(l, BM_ELEM_LONG_TAG);
}
}
verts[0] = verts[3];
verts[1] = verts[2];
}
if (!odd) {
if (!e1->is_seam) {
bev_merge_edge_uvs(bm, center_bme, mesh_vert(vm1, i1, 0, mid)->v);
}
if (!e2->is_seam) {
bev_merge_edge_uvs(bm, center_bme, mesh_vert(vm2, i2, 0, mid)->v);
}
}
/* Fix UVs along end edge joints. A nop unless other side built already. */
/* TODO: if some seam, may want to do selective merge */
if (!bv1->any_seam && bv1->vmesh->mesh_kind == M_NONE) {
bev_merge_end_uvs(bm, bv1, e1);
}
if (!bv2->any_seam && bv2->vmesh->mesh_kind == M_NONE) {
bev_merge_end_uvs(bm, bv2, e2);
}
/* Copy edge data to first and last edge */
bme1 = BM_edge_exists(bmv1, bmv2);
bme2 = BM_edge_exists(bmv3, bmv4);
BLI_assert(bme1 && bme2);
BM_elem_attrs_copy(bm, bm, bme, bme1);
BM_elem_attrs_copy(bm, bm, bme, bme2);
/* If either end is a "weld cross", want continuity of edge attributes across end edge(s) */
if (bevvert_is_weld_cross(bv1)) {
weld_cross_attrs_copy(bm, bv1, vm1, i1, e1);
}
if (bevvert_is_weld_cross(bv2)) {
weld_cross_attrs_copy(bm, bv2, vm2, i2, e2);
}
} | /*
* Build the polygons along the selected Edge
*/ | Build the polygons along the selected Edge | [
"Build",
"the",
"polygons",
"along",
"the",
"selected",
"Edge"
] | static void bevel_build_edge_polygons(BMesh *bm, BevelParams *bp, BMEdge *bme)
{
BevVert *bv1, *bv2;
BMVert *bmv1, *bmv2, *bmv3, *bmv4;
VMesh *vm1, *vm2;
EdgeHalf *e1, *e2;
BMEdge *bme1, *bme2, *center_bme;
BMFace *f1, *f2, *f, *r_f;
BMVert *verts[4];
BMFace *faces[4];
BMEdge *edges[4];
BMLoop *l;
BMIter iter;
int k, nseg, i1, i2, odd, mid;
int mat_nr = bp->mat_nr;
if (!BM_edge_is_manifold(bme)) {
return;
}
bv1 = find_bevvert(bp, bme->v1);
bv2 = find_bevvert(bp, bme->v2);
BLI_assert(bv1 && bv2);
e1 = find_edge_half(bv1, bme);
e2 = find_edge_half(bv2, bme);
BLI_assert(e1 && e2);
nseg = e1->seg;
BLI_assert(nseg > 0 && nseg == e2->seg);
bmv1 = e1->leftv->nv.v;
bmv4 = e1->rightv->nv.v;
bmv2 = e2->rightv->nv.v;
bmv3 = e2->leftv->nv.v;
BLI_assert(bmv1 && bmv2 && bmv3 && bmv4);
f1 = e1->fprev;
f2 = e1->fnext;
faces[0] = faces[1] = f1;
faces[2] = faces[3] = f2;
i1 = e1->leftv->index;
i2 = e2->leftv->index;
vm1 = bv1->vmesh;
vm2 = bv2->vmesh;
verts[0] = bmv1;
verts[1] = bmv2;
odd = nseg % 2;
mid = nseg / 2;
center_bme = NULL;
for (k = 1; k <= nseg; k++) {
verts[3] = mesh_vert(vm1, i1, 0, k)->v;
verts[2] = mesh_vert(vm2, i2, 0, nseg - k)->v;
if (odd && k == mid + 1) {
if (e1->is_seam) {
edges[0] = edges[1] = NULL;
edges[2] = edges[3] = bme;
r_f = bev_create_ngon(bm, verts, 4, NULL, f1, edges, mat_nr, true);
}
else {
r_f = bev_create_ngon(bm, verts, 4, faces, NULL, NULL, mat_nr, true);
}
}
else if (!odd && k == mid) {
edges[0] = edges[1] = NULL;
edges[2] = edges[3] = bme;
r_f = bev_create_ngon(bm, verts, 4, NULL, f1, edges, mat_nr, true);
center_bme = BM_edge_exists(verts[2], verts[3]);
BLI_assert(center_bme != NULL);
}
else if (!odd && k == mid + 1) {
edges[0] = edges[1] = bme;
edges[2] = edges[3] = NULL;
r_f = bev_create_ngon(bm, verts, 4, NULL, f2, edges, mat_nr, true);
}
else {
f = (k <= mid) ? f1 : f2;
r_f = bev_create_ngon(bm, verts, 4, NULL, f, NULL, mat_nr, true);
}
record_face_kind(bp, r_f, F_EDGE);
BM_ITER_ELEM (l, &iter, r_f, BM_LOOPS_OF_FACE) {
if (l->v == verts[0] || l->v == verts[2]) {
BM_elem_flag_enable(l, BM_ELEM_LONG_TAG);
}
}
verts[0] = verts[3];
verts[1] = verts[2];
}
if (!odd) {
if (!e1->is_seam) {
bev_merge_edge_uvs(bm, center_bme, mesh_vert(vm1, i1, 0, mid)->v);
}
if (!e2->is_seam) {
bev_merge_edge_uvs(bm, center_bme, mesh_vert(vm2, i2, 0, mid)->v);
}
}
if (!bv1->any_seam && bv1->vmesh->mesh_kind == M_NONE) {
bev_merge_end_uvs(bm, bv1, e1);
}
if (!bv2->any_seam && bv2->vmesh->mesh_kind == M_NONE) {
bev_merge_end_uvs(bm, bv2, e2);
}
bme1 = BM_edge_exists(bmv1, bmv2);
bme2 = BM_edge_exists(bmv3, bmv4);
BLI_assert(bme1 && bme2);
BM_elem_attrs_copy(bm, bm, bme, bme1);
BM_elem_attrs_copy(bm, bm, bme, bme2);
if (bevvert_is_weld_cross(bv1)) {
weld_cross_attrs_copy(bm, bv1, vm1, i1, e1);
}
if (bevvert_is_weld_cross(bv2)) {
weld_cross_attrs_copy(bm, bv2, vm2, i2, e2);
}
} | [
"static",
"void",
"bevel_build_edge_polygons",
"(",
"BMesh",
"*",
"bm",
",",
"BevelParams",
"*",
"bp",
",",
"BMEdge",
"*",
"bme",
")",
"{",
"BevVert",
"*",
"bv1",
",",
"*",
"bv2",
";",
"BMVert",
"*",
"bmv1",
",",
"*",
"bmv2",
",",
"*",
"bmv3",
",",
"*",
"bmv4",
";",
"VMesh",
"*",
"vm1",
",",
"*",
"vm2",
";",
"EdgeHalf",
"*",
"e1",
",",
"*",
"e2",
";",
"BMEdge",
"*",
"bme1",
",",
"*",
"bme2",
",",
"*",
"center_bme",
";",
"BMFace",
"*",
"f1",
",",
"*",
"f2",
",",
"*",
"f",
",",
"*",
"r_f",
";",
"BMVert",
"*",
"verts",
"[",
"4",
"]",
";",
"BMFace",
"*",
"faces",
"[",
"4",
"]",
";",
"BMEdge",
"*",
"edges",
"[",
"4",
"]",
";",
"BMLoop",
"*",
"l",
";",
"BMIter",
"iter",
";",
"int",
"k",
",",
"nseg",
",",
"i1",
",",
"i2",
",",
"odd",
",",
"mid",
";",
"int",
"mat_nr",
"=",
"bp",
"->",
"mat_nr",
";",
"if",
"(",
"!",
"BM_edge_is_manifold",
"(",
"bme",
")",
")",
"{",
"return",
";",
"}",
"bv1",
"=",
"find_bevvert",
"(",
"bp",
",",
"bme",
"->",
"v1",
")",
";",
"bv2",
"=",
"find_bevvert",
"(",
"bp",
",",
"bme",
"->",
"v2",
")",
";",
"BLI_assert",
"(",
"bv1",
"&&",
"bv2",
")",
";",
"e1",
"=",
"find_edge_half",
"(",
"bv1",
",",
"bme",
")",
";",
"e2",
"=",
"find_edge_half",
"(",
"bv2",
",",
"bme",
")",
";",
"BLI_assert",
"(",
"e1",
"&&",
"e2",
")",
";",
"nseg",
"=",
"e1",
"->",
"seg",
";",
"BLI_assert",
"(",
"nseg",
">",
"0",
"&&",
"nseg",
"==",
"e2",
"->",
"seg",
")",
";",
"bmv1",
"=",
"e1",
"->",
"leftv",
"->",
"nv",
".",
"v",
";",
"bmv4",
"=",
"e1",
"->",
"rightv",
"->",
"nv",
".",
"v",
";",
"bmv2",
"=",
"e2",
"->",
"rightv",
"->",
"nv",
".",
"v",
";",
"bmv3",
"=",
"e2",
"->",
"leftv",
"->",
"nv",
".",
"v",
";",
"BLI_assert",
"(",
"bmv1",
"&&",
"bmv2",
"&&",
"bmv3",
"&&",
"bmv4",
")",
";",
"f1",
"=",
"e1",
"->",
"fprev",
";",
"f2",
"=",
"e1",
"->",
"fnext",
";",
"faces",
"[",
"0",
"]",
"=",
"faces",
"[",
"1",
"]",
"=",
"f1",
";",
"faces",
"[",
"2",
"]",
"=",
"faces",
"[",
"3",
"]",
"=",
"f2",
";",
"i1",
"=",
"e1",
"->",
"leftv",
"->",
"index",
";",
"i2",
"=",
"e2",
"->",
"leftv",
"->",
"index",
";",
"vm1",
"=",
"bv1",
"->",
"vmesh",
";",
"vm2",
"=",
"bv2",
"->",
"vmesh",
";",
"verts",
"[",
"0",
"]",
"=",
"bmv1",
";",
"verts",
"[",
"1",
"]",
"=",
"bmv2",
";",
"odd",
"=",
"nseg",
"%",
"2",
";",
"mid",
"=",
"nseg",
"/",
"2",
";",
"center_bme",
"=",
"NULL",
";",
"for",
"(",
"k",
"=",
"1",
";",
"k",
"<=",
"nseg",
";",
"k",
"++",
")",
"{",
"verts",
"[",
"3",
"]",
"=",
"mesh_vert",
"(",
"vm1",
",",
"i1",
",",
"0",
",",
"k",
")",
"->",
"v",
";",
"verts",
"[",
"2",
"]",
"=",
"mesh_vert",
"(",
"vm2",
",",
"i2",
",",
"0",
",",
"nseg",
"-",
"k",
")",
"->",
"v",
";",
"if",
"(",
"odd",
"&&",
"k",
"==",
"mid",
"+",
"1",
")",
"{",
"if",
"(",
"e1",
"->",
"is_seam",
")",
"{",
"edges",
"[",
"0",
"]",
"=",
"edges",
"[",
"1",
"]",
"=",
"NULL",
";",
"edges",
"[",
"2",
"]",
"=",
"edges",
"[",
"3",
"]",
"=",
"bme",
";",
"r_f",
"=",
"bev_create_ngon",
"(",
"bm",
",",
"verts",
",",
"4",
",",
"NULL",
",",
"f1",
",",
"edges",
",",
"mat_nr",
",",
"true",
")",
";",
"}",
"else",
"{",
"r_f",
"=",
"bev_create_ngon",
"(",
"bm",
",",
"verts",
",",
"4",
",",
"faces",
",",
"NULL",
",",
"NULL",
",",
"mat_nr",
",",
"true",
")",
";",
"}",
"}",
"else",
"if",
"(",
"!",
"odd",
"&&",
"k",
"==",
"mid",
")",
"{",
"edges",
"[",
"0",
"]",
"=",
"edges",
"[",
"1",
"]",
"=",
"NULL",
";",
"edges",
"[",
"2",
"]",
"=",
"edges",
"[",
"3",
"]",
"=",
"bme",
";",
"r_f",
"=",
"bev_create_ngon",
"(",
"bm",
",",
"verts",
",",
"4",
",",
"NULL",
",",
"f1",
",",
"edges",
",",
"mat_nr",
",",
"true",
")",
";",
"center_bme",
"=",
"BM_edge_exists",
"(",
"verts",
"[",
"2",
"]",
",",
"verts",
"[",
"3",
"]",
")",
";",
"BLI_assert",
"(",
"center_bme",
"!=",
"NULL",
")",
";",
"}",
"else",
"if",
"(",
"!",
"odd",
"&&",
"k",
"==",
"mid",
"+",
"1",
")",
"{",
"edges",
"[",
"0",
"]",
"=",
"edges",
"[",
"1",
"]",
"=",
"bme",
";",
"edges",
"[",
"2",
"]",
"=",
"edges",
"[",
"3",
"]",
"=",
"NULL",
";",
"r_f",
"=",
"bev_create_ngon",
"(",
"bm",
",",
"verts",
",",
"4",
",",
"NULL",
",",
"f2",
",",
"edges",
",",
"mat_nr",
",",
"true",
")",
";",
"}",
"else",
"{",
"f",
"=",
"(",
"k",
"<=",
"mid",
")",
"?",
"f1",
":",
"f2",
";",
"r_f",
"=",
"bev_create_ngon",
"(",
"bm",
",",
"verts",
",",
"4",
",",
"NULL",
",",
"f",
",",
"NULL",
",",
"mat_nr",
",",
"true",
")",
";",
"}",
"record_face_kind",
"(",
"bp",
",",
"r_f",
",",
"F_EDGE",
")",
";",
"BM_ITER_ELEM",
"(",
"l",
",",
"&",
"iter",
",",
"r_f",
",",
"BM_LOOPS_OF_FACE",
")",
"",
"{",
"if",
"(",
"l",
"->",
"v",
"==",
"verts",
"[",
"0",
"]",
"||",
"l",
"->",
"v",
"==",
"verts",
"[",
"2",
"]",
")",
"{",
"BM_elem_flag_enable",
"(",
"l",
",",
"BM_ELEM_LONG_TAG",
")",
";",
"}",
"}",
"verts",
"[",
"0",
"]",
"=",
"verts",
"[",
"3",
"]",
";",
"verts",
"[",
"1",
"]",
"=",
"verts",
"[",
"2",
"]",
";",
"}",
"if",
"(",
"!",
"odd",
")",
"{",
"if",
"(",
"!",
"e1",
"->",
"is_seam",
")",
"{",
"bev_merge_edge_uvs",
"(",
"bm",
",",
"center_bme",
",",
"mesh_vert",
"(",
"vm1",
",",
"i1",
",",
"0",
",",
"mid",
")",
"->",
"v",
")",
";",
"}",
"if",
"(",
"!",
"e2",
"->",
"is_seam",
")",
"{",
"bev_merge_edge_uvs",
"(",
"bm",
",",
"center_bme",
",",
"mesh_vert",
"(",
"vm2",
",",
"i2",
",",
"0",
",",
"mid",
")",
"->",
"v",
")",
";",
"}",
"}",
"if",
"(",
"!",
"bv1",
"->",
"any_seam",
"&&",
"bv1",
"->",
"vmesh",
"->",
"mesh_kind",
"==",
"M_NONE",
")",
"{",
"bev_merge_end_uvs",
"(",
"bm",
",",
"bv1",
",",
"e1",
")",
";",
"}",
"if",
"(",
"!",
"bv2",
"->",
"any_seam",
"&&",
"bv2",
"->",
"vmesh",
"->",
"mesh_kind",
"==",
"M_NONE",
")",
"{",
"bev_merge_end_uvs",
"(",
"bm",
",",
"bv2",
",",
"e2",
")",
";",
"}",
"bme1",
"=",
"BM_edge_exists",
"(",
"bmv1",
",",
"bmv2",
")",
";",
"bme2",
"=",
"BM_edge_exists",
"(",
"bmv3",
",",
"bmv4",
")",
";",
"BLI_assert",
"(",
"bme1",
"&&",
"bme2",
")",
";",
"BM_elem_attrs_copy",
"(",
"bm",
",",
"bm",
",",
"bme",
",",
"bme1",
")",
";",
"BM_elem_attrs_copy",
"(",
"bm",
",",
"bm",
",",
"bme",
",",
"bme2",
")",
";",
"if",
"(",
"bevvert_is_weld_cross",
"(",
"bv1",
")",
")",
"{",
"weld_cross_attrs_copy",
"(",
"bm",
",",
"bv1",
",",
"vm1",
",",
"i1",
",",
"e1",
")",
";",
"}",
"if",
"(",
"bevvert_is_weld_cross",
"(",
"bv2",
")",
")",
"{",
"weld_cross_attrs_copy",
"(",
"bm",
",",
"bv2",
",",
"vm2",
",",
"i2",
",",
"e2",
")",
";",
"}",
"}"
] | Build the polygons along the selected Edge | [
"Build",
"the",
"polygons",
"along",
"the",
"selected",
"Edge"
] | [
"/*\n * bme->v1\n * / | \\\n * v1--|--v4\n * | | |\n * | | |\n * v2--|--v3\n * \\ | /\n * bme->v2\n */",
"/* straddles a seam: choose to interpolate in f1 and snap right edge to bme */",
"/* straddles but not a seam: interpolate left half in f1, right half in f2 */",
"/* left poly that touches an even center line on right */",
"/* right poly that touches an even center line on left */",
"/* doesn't cross or touch the center line, so interpolate in appropriate f1 or f2 */",
"/* tag the long edges: those out of verts[0] and verts[2] */",
"/* Fix UVs along end edge joints. A nop unless other side built already. */",
"/* TODO: if some seam, may want to do selective merge */",
"/* Copy edge data to first and last edge */",
"/* If either end is a \"weld cross\", want continuity of edge attributes across end edge(s) */"
] | [
{
"param": "bm",
"type": "BMesh"
},
{
"param": "bp",
"type": "BevelParams"
},
{
"param": "bme",
"type": "BMEdge"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bm",
"type": "BMesh",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bp",
"type": "BevelParams",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bme",
"type": "BMEdge",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
797e2ca864e674d30732f6f1e8ff98ecac74b2ed | DemonRem/blender | source/blender/bmesh/tools/bmesh_bevel.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | find_even_superellipse_chords_general | void | static void find_even_superellipse_chords_general(int seg, float r, double *xvals, double *yvals)
{
const int smoothitermax = 10;
const double error_tol = 1e-7;
int i;
int imax = (seg + 1) / 2 - 1; /* ceiling division - 1 */
double d, dmin, dmax;
double davg;
double mx;
double sum;
double temp;
bool precision_reached = true;
bool seg_odd = seg % 2;
bool rbig;
if (r > 1.0f) {
rbig = true;
mx = pow(0.5, 1.0 / r);
}
else {
rbig = false;
mx = 1 - pow(0.5, 1.0 / r);
}
/* Initial positions, linear spacing along x axis. */
for (i = 0; i <= imax; i++) {
xvals[i] = i * mx / seg * 2;
yvals[i] = superellipse_co(xvals[i], r, rbig);
}
yvals[0] = 1;
/* Smooth distance loop */
for (int iter = 0; iter < smoothitermax; iter++) {
sum = 0.0;
dmin = 2.0;
dmax = 0.0;
/* Update distances between neighbor points. Store the highest and
* lowest to see if the maximum error to average distance (which isn't
* known yet) is below required precision. */
for (i = 0; i < imax; i++) {
d = sqrt(pow((xvals[i + 1] - xvals[i]), 2) + pow((yvals[i + 1] - yvals[i]), 2));
sum += d;
if (d > dmax) {
dmax = d;
}
if (d < dmin) {
dmin = d;
}
}
/* For last distance, weight with 1/2 if seg_odd. */
if (seg_odd) {
sum += M_SQRT2 / 2 * (yvals[imax] - xvals[imax]);
davg = sum / (imax + 0.5);
}
else {
sum += sqrt(pow((xvals[imax] - mx), 2) + pow((yvals[imax] - mx), 2));
davg = sum / (imax + 1.0);
}
/* Max error in tolerance? -> Quit. */
if (dmax - davg > error_tol) {
precision_reached = false;
}
if (dmin - davg < error_tol) {
precision_reached = false;
}
if (precision_reached) {
break;
}
/* Update new coordinates. */
for (i = 1; i <= imax; i++) {
xvals[i] = find_superellipse_chord_endpoint(xvals[i - 1], davg, r, rbig);
yvals[i] = superellipse_co(xvals[i], r, rbig);
}
}
/* Fill remaining. */
if (!seg_odd) {
xvals[imax + 1] = mx;
yvals[imax + 1] = mx;
}
for (i = imax + 1; i <= seg; i++) {
yvals[i] = xvals[seg - i];
xvals[i] = yvals[seg - i];
}
if (!rbig) {
for (i = 0; i <= seg; i++) {
temp = xvals[i];
xvals[i] = 1.0 - yvals[i];
yvals[i] = 1.0 - temp;
}
}
} | /**
* This search procedure to find equidistant points (x,y) in the first
* superellipse quadrant works for every superellipse exponent but is more
* expensive than known solutions for special cases.
* Call the point on superellipse that intersects x=y line mx.
* For r>=1 use only the range x in [0,mx] and mirror the rest along x=y line,
* for r<1 use only x in [mx,1]. Points are initially spaced and iteratively
* repositioned to have the same distance.
*/ | This search procedure to find equidistant points (x,y) in the first
superellipse quadrant works for every superellipse exponent but is more
expensive than known solutions for special cases.
Call the point on superellipse that intersects x=y line mx.
For r>=1 use only the range x in [0,mx] and mirror the rest along x=y line,
for r<1 use only x in [mx,1]. Points are initially spaced and iteratively
repositioned to have the same distance. | [
"This",
"search",
"procedure",
"to",
"find",
"equidistant",
"points",
"(",
"x",
"y",
")",
"in",
"the",
"first",
"superellipse",
"quadrant",
"works",
"for",
"every",
"superellipse",
"exponent",
"but",
"is",
"more",
"expensive",
"than",
"known",
"solutions",
"for",
"special",
"cases",
".",
"Call",
"the",
"point",
"on",
"superellipse",
"that",
"intersects",
"x",
"=",
"y",
"line",
"mx",
".",
"For",
"r",
">",
"=",
"1",
"use",
"only",
"the",
"range",
"x",
"in",
"[",
"0",
"mx",
"]",
"and",
"mirror",
"the",
"rest",
"along",
"x",
"=",
"y",
"line",
"for",
"r<1",
"use",
"only",
"x",
"in",
"[",
"mx",
"1",
"]",
".",
"Points",
"are",
"initially",
"spaced",
"and",
"iteratively",
"repositioned",
"to",
"have",
"the",
"same",
"distance",
"."
] | static void find_even_superellipse_chords_general(int seg, float r, double *xvals, double *yvals)
{
const int smoothitermax = 10;
const double error_tol = 1e-7;
int i;
int imax = (seg + 1) / 2 - 1;
double d, dmin, dmax;
double davg;
double mx;
double sum;
double temp;
bool precision_reached = true;
bool seg_odd = seg % 2;
bool rbig;
if (r > 1.0f) {
rbig = true;
mx = pow(0.5, 1.0 / r);
}
else {
rbig = false;
mx = 1 - pow(0.5, 1.0 / r);
}
for (i = 0; i <= imax; i++) {
xvals[i] = i * mx / seg * 2;
yvals[i] = superellipse_co(xvals[i], r, rbig);
}
yvals[0] = 1;
for (int iter = 0; iter < smoothitermax; iter++) {
sum = 0.0;
dmin = 2.0;
dmax = 0.0;
for (i = 0; i < imax; i++) {
d = sqrt(pow((xvals[i + 1] - xvals[i]), 2) + pow((yvals[i + 1] - yvals[i]), 2));
sum += d;
if (d > dmax) {
dmax = d;
}
if (d < dmin) {
dmin = d;
}
}
if (seg_odd) {
sum += M_SQRT2 / 2 * (yvals[imax] - xvals[imax]);
davg = sum / (imax + 0.5);
}
else {
sum += sqrt(pow((xvals[imax] - mx), 2) + pow((yvals[imax] - mx), 2));
davg = sum / (imax + 1.0);
}
if (dmax - davg > error_tol) {
precision_reached = false;
}
if (dmin - davg < error_tol) {
precision_reached = false;
}
if (precision_reached) {
break;
}
for (i = 1; i <= imax; i++) {
xvals[i] = find_superellipse_chord_endpoint(xvals[i - 1], davg, r, rbig);
yvals[i] = superellipse_co(xvals[i], r, rbig);
}
}
if (!seg_odd) {
xvals[imax + 1] = mx;
yvals[imax + 1] = mx;
}
for (i = imax + 1; i <= seg; i++) {
yvals[i] = xvals[seg - i];
xvals[i] = yvals[seg - i];
}
if (!rbig) {
for (i = 0; i <= seg; i++) {
temp = xvals[i];
xvals[i] = 1.0 - yvals[i];
yvals[i] = 1.0 - temp;
}
}
} | [
"static",
"void",
"find_even_superellipse_chords_general",
"(",
"int",
"seg",
",",
"float",
"r",
",",
"double",
"*",
"xvals",
",",
"double",
"*",
"yvals",
")",
"{",
"const",
"int",
"smoothitermax",
"=",
"10",
";",
"const",
"double",
"error_tol",
"=",
"1e-7",
";",
"int",
"i",
";",
"int",
"imax",
"=",
"(",
"seg",
"+",
"1",
")",
"/",
"2",
"-",
"1",
";",
"double",
"d",
",",
"dmin",
",",
"dmax",
";",
"double",
"davg",
";",
"double",
"mx",
";",
"double",
"sum",
";",
"double",
"temp",
";",
"bool",
"precision_reached",
"=",
"true",
";",
"bool",
"seg_odd",
"=",
"seg",
"%",
"2",
";",
"bool",
"rbig",
";",
"if",
"(",
"r",
">",
"1.0f",
")",
"{",
"rbig",
"=",
"true",
";",
"mx",
"=",
"pow",
"(",
"0.5",
",",
"1.0",
"/",
"r",
")",
";",
"}",
"else",
"{",
"rbig",
"=",
"false",
";",
"mx",
"=",
"1",
"-",
"pow",
"(",
"0.5",
",",
"1.0",
"/",
"r",
")",
";",
"}",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<=",
"imax",
";",
"i",
"++",
")",
"{",
"xvals",
"[",
"i",
"]",
"=",
"i",
"*",
"mx",
"/",
"seg",
"*",
"2",
";",
"yvals",
"[",
"i",
"]",
"=",
"superellipse_co",
"(",
"xvals",
"[",
"i",
"]",
",",
"r",
",",
"rbig",
")",
";",
"}",
"yvals",
"[",
"0",
"]",
"=",
"1",
";",
"for",
"(",
"int",
"iter",
"=",
"0",
";",
"iter",
"<",
"smoothitermax",
";",
"iter",
"++",
")",
"{",
"sum",
"=",
"0.0",
";",
"dmin",
"=",
"2.0",
";",
"dmax",
"=",
"0.0",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"imax",
";",
"i",
"++",
")",
"{",
"d",
"=",
"sqrt",
"(",
"pow",
"(",
"(",
"xvals",
"[",
"i",
"+",
"1",
"]",
"-",
"xvals",
"[",
"i",
"]",
")",
",",
"2",
")",
"+",
"pow",
"(",
"(",
"yvals",
"[",
"i",
"+",
"1",
"]",
"-",
"yvals",
"[",
"i",
"]",
")",
",",
"2",
")",
")",
";",
"sum",
"+=",
"d",
";",
"if",
"(",
"d",
">",
"dmax",
")",
"{",
"dmax",
"=",
"d",
";",
"}",
"if",
"(",
"d",
"<",
"dmin",
")",
"{",
"dmin",
"=",
"d",
";",
"}",
"}",
"if",
"(",
"seg_odd",
")",
"{",
"sum",
"+=",
"M_SQRT2",
"/",
"2",
"*",
"(",
"yvals",
"[",
"imax",
"]",
"-",
"xvals",
"[",
"imax",
"]",
")",
";",
"davg",
"=",
"sum",
"/",
"(",
"imax",
"+",
"0.5",
")",
";",
"}",
"else",
"{",
"sum",
"+=",
"sqrt",
"(",
"pow",
"(",
"(",
"xvals",
"[",
"imax",
"]",
"-",
"mx",
")",
",",
"2",
")",
"+",
"pow",
"(",
"(",
"yvals",
"[",
"imax",
"]",
"-",
"mx",
")",
",",
"2",
")",
")",
";",
"davg",
"=",
"sum",
"/",
"(",
"imax",
"+",
"1.0",
")",
";",
"}",
"if",
"(",
"dmax",
"-",
"davg",
">",
"error_tol",
")",
"{",
"precision_reached",
"=",
"false",
";",
"}",
"if",
"(",
"dmin",
"-",
"davg",
"<",
"error_tol",
")",
"{",
"precision_reached",
"=",
"false",
";",
"}",
"if",
"(",
"precision_reached",
")",
"{",
"break",
";",
"}",
"for",
"(",
"i",
"=",
"1",
";",
"i",
"<=",
"imax",
";",
"i",
"++",
")",
"{",
"xvals",
"[",
"i",
"]",
"=",
"find_superellipse_chord_endpoint",
"(",
"xvals",
"[",
"i",
"-",
"1",
"]",
",",
"davg",
",",
"r",
",",
"rbig",
")",
";",
"yvals",
"[",
"i",
"]",
"=",
"superellipse_co",
"(",
"xvals",
"[",
"i",
"]",
",",
"r",
",",
"rbig",
")",
";",
"}",
"}",
"if",
"(",
"!",
"seg_odd",
")",
"{",
"xvals",
"[",
"imax",
"+",
"1",
"]",
"=",
"mx",
";",
"yvals",
"[",
"imax",
"+",
"1",
"]",
"=",
"mx",
";",
"}",
"for",
"(",
"i",
"=",
"imax",
"+",
"1",
";",
"i",
"<=",
"seg",
";",
"i",
"++",
")",
"{",
"yvals",
"[",
"i",
"]",
"=",
"xvals",
"[",
"seg",
"-",
"i",
"]",
";",
"xvals",
"[",
"i",
"]",
"=",
"yvals",
"[",
"seg",
"-",
"i",
"]",
";",
"}",
"if",
"(",
"!",
"rbig",
")",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<=",
"seg",
";",
"i",
"++",
")",
"{",
"temp",
"=",
"xvals",
"[",
"i",
"]",
";",
"xvals",
"[",
"i",
"]",
"=",
"1.0",
"-",
"yvals",
"[",
"i",
"]",
";",
"yvals",
"[",
"i",
"]",
"=",
"1.0",
"-",
"temp",
";",
"}",
"}",
"}"
] | This search procedure to find equidistant points (x,y) in the first
superellipse quadrant works for every superellipse exponent but is more
expensive than known solutions for special cases. | [
"This",
"search",
"procedure",
"to",
"find",
"equidistant",
"points",
"(",
"x",
"y",
")",
"in",
"the",
"first",
"superellipse",
"quadrant",
"works",
"for",
"every",
"superellipse",
"exponent",
"but",
"is",
"more",
"expensive",
"than",
"known",
"solutions",
"for",
"special",
"cases",
"."
] | [
"/* ceiling division - 1 */",
"/* Initial positions, linear spacing along x axis. */",
"/* Smooth distance loop */",
"/* Update distances between neighbor points. Store the highest and\n * lowest to see if the maximum error to average distance (which isn't\n * known yet) is below required precision. */",
"/* For last distance, weight with 1/2 if seg_odd. */",
"/* Max error in tolerance? -> Quit. */",
"/* Update new coordinates. */",
"/* Fill remaining. */"
] | [
{
"param": "seg",
"type": "int"
},
{
"param": "r",
"type": "float"
},
{
"param": "xvals",
"type": "double"
},
{
"param": "yvals",
"type": "double"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "seg",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "r",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "xvals",
"type": "double",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "yvals",
"type": "double",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
797e2ca864e674d30732f6f1e8ff98ecac74b2ed | DemonRem/blender | source/blender/bmesh/tools/bmesh_bevel.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | find_even_superellipse_chords | void | static void find_even_superellipse_chords(int n, float r, double *xvals, double *yvals)
{
int i, n2;
double temp;
bool seg_odd = n % 2;
n2 = n / 2;
/* Special cases. */
if (r == PRO_LINE_R) {
/* Linear spacing */
for (i = 0; i <= n; i++) {
xvals[i] = (double)i / n;
yvals[i] = 1.0 - (double)i / n;
}
return;
}
if (r == PRO_CIRCLE_R) {
temp = (M_PI / 2) / n;
/* Angle spacing. */
for (i = 0; i <= n; i++) {
xvals[i] = sin(i * temp);
yvals[i] = cos(i * temp);
}
return;
}
if (r == PRO_SQUARE_IN_R) {
/* n is even, distribute first and second half linear. */
if (!seg_odd) {
for (i = 0; i <= n2; i++) {
xvals[i] = 0.0;
yvals[i] = 1.0 - (double)i / n2;
xvals[n - i] = yvals[i];
yvals[n - i] = xvals[i];
}
}
/* n is odd, so get one corner-cut chord. */
else {
temp = 1.0 / (n2 + M_SQRT2 / 2.0);
for (i = 0; i <= n2; i++) {
xvals[i] = 0.0;
yvals[i] = 1.0 - (double)i * temp;
xvals[n - i] = yvals[i];
yvals[n - i] = xvals[i];
}
}
return;
}
if (r == PRO_SQUARE_R) {
/* n is even, distribute first and second half linear. */
if (!seg_odd) {
for (i = 0; i <= n2; i++) {
xvals[i] = (double)i / n2;
yvals[i] = 1.0;
xvals[n - i] = yvals[i];
yvals[n - i] = xvals[i];
}
}
/* n is odd, so get one corner-cut chord. */
else {
temp = 1.0 / (n2 + M_SQRT2 / 2);
for (i = 0; i <= n2; i++) {
xvals[i] = (double)i * temp;
yvals[i] = 1.0;
xvals[n - i] = yvals[i];
yvals[n - i] = xvals[i];
}
}
return;
}
/* For general case use the more expensive search algorithm. */
find_even_superellipse_chords_general(n, r, xvals, yvals);
} | /**
* Find equidistant points (x0,y0), (x1,y1)... (xn,yn) on the superellipse
* function in the first quadrant. For special profiles (linear, arc,
* rectangle) the point can be calculated easily, for any other profile a more
* expensive search procedure must be used because there is no known closed
* form for equidistant parametrization
* xvals and yvals should be size n+1
*/ | Find equidistant points (x0,y0), (x1,y1)... (xn,yn) on the superellipse
function in the first quadrant. For special profiles (linear, arc,
rectangle) the point can be calculated easily, for any other profile a more
expensive search procedure must be used because there is no known closed
form for equidistant parametrization
xvals and yvals should be size n+1 | [
"Find",
"equidistant",
"points",
"(",
"x0",
"y0",
")",
"(",
"x1",
"y1",
")",
"...",
"(",
"xn",
"yn",
")",
"on",
"the",
"superellipse",
"function",
"in",
"the",
"first",
"quadrant",
".",
"For",
"special",
"profiles",
"(",
"linear",
"arc",
"rectangle",
")",
"the",
"point",
"can",
"be",
"calculated",
"easily",
"for",
"any",
"other",
"profile",
"a",
"more",
"expensive",
"search",
"procedure",
"must",
"be",
"used",
"because",
"there",
"is",
"no",
"known",
"closed",
"form",
"for",
"equidistant",
"parametrization",
"xvals",
"and",
"yvals",
"should",
"be",
"size",
"n",
"+",
"1"
] | static void find_even_superellipse_chords(int n, float r, double *xvals, double *yvals)
{
int i, n2;
double temp;
bool seg_odd = n % 2;
n2 = n / 2;
if (r == PRO_LINE_R) {
for (i = 0; i <= n; i++) {
xvals[i] = (double)i / n;
yvals[i] = 1.0 - (double)i / n;
}
return;
}
if (r == PRO_CIRCLE_R) {
temp = (M_PI / 2) / n;
for (i = 0; i <= n; i++) {
xvals[i] = sin(i * temp);
yvals[i] = cos(i * temp);
}
return;
}
if (r == PRO_SQUARE_IN_R) {
if (!seg_odd) {
for (i = 0; i <= n2; i++) {
xvals[i] = 0.0;
yvals[i] = 1.0 - (double)i / n2;
xvals[n - i] = yvals[i];
yvals[n - i] = xvals[i];
}
}
else {
temp = 1.0 / (n2 + M_SQRT2 / 2.0);
for (i = 0; i <= n2; i++) {
xvals[i] = 0.0;
yvals[i] = 1.0 - (double)i * temp;
xvals[n - i] = yvals[i];
yvals[n - i] = xvals[i];
}
}
return;
}
if (r == PRO_SQUARE_R) {
if (!seg_odd) {
for (i = 0; i <= n2; i++) {
xvals[i] = (double)i / n2;
yvals[i] = 1.0;
xvals[n - i] = yvals[i];
yvals[n - i] = xvals[i];
}
}
else {
temp = 1.0 / (n2 + M_SQRT2 / 2);
for (i = 0; i <= n2; i++) {
xvals[i] = (double)i * temp;
yvals[i] = 1.0;
xvals[n - i] = yvals[i];
yvals[n - i] = xvals[i];
}
}
return;
}
find_even_superellipse_chords_general(n, r, xvals, yvals);
} | [
"static",
"void",
"find_even_superellipse_chords",
"(",
"int",
"n",
",",
"float",
"r",
",",
"double",
"*",
"xvals",
",",
"double",
"*",
"yvals",
")",
"{",
"int",
"i",
",",
"n2",
";",
"double",
"temp",
";",
"bool",
"seg_odd",
"=",
"n",
"%",
"2",
";",
"n2",
"=",
"n",
"/",
"2",
";",
"if",
"(",
"r",
"==",
"PRO_LINE_R",
")",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<=",
"n",
";",
"i",
"++",
")",
"{",
"xvals",
"[",
"i",
"]",
"=",
"(",
"double",
")",
"i",
"/",
"n",
";",
"yvals",
"[",
"i",
"]",
"=",
"1.0",
"-",
"(",
"double",
")",
"i",
"/",
"n",
";",
"}",
"return",
";",
"}",
"if",
"(",
"r",
"==",
"PRO_CIRCLE_R",
")",
"{",
"temp",
"=",
"(",
"M_PI",
"/",
"2",
")",
"/",
"n",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<=",
"n",
";",
"i",
"++",
")",
"{",
"xvals",
"[",
"i",
"]",
"=",
"sin",
"(",
"i",
"*",
"temp",
")",
";",
"yvals",
"[",
"i",
"]",
"=",
"cos",
"(",
"i",
"*",
"temp",
")",
";",
"}",
"return",
";",
"}",
"if",
"(",
"r",
"==",
"PRO_SQUARE_IN_R",
")",
"{",
"if",
"(",
"!",
"seg_odd",
")",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<=",
"n2",
";",
"i",
"++",
")",
"{",
"xvals",
"[",
"i",
"]",
"=",
"0.0",
";",
"yvals",
"[",
"i",
"]",
"=",
"1.0",
"-",
"(",
"double",
")",
"i",
"/",
"n2",
";",
"xvals",
"[",
"n",
"-",
"i",
"]",
"=",
"yvals",
"[",
"i",
"]",
";",
"yvals",
"[",
"n",
"-",
"i",
"]",
"=",
"xvals",
"[",
"i",
"]",
";",
"}",
"}",
"else",
"{",
"temp",
"=",
"1.0",
"/",
"(",
"n2",
"+",
"M_SQRT2",
"/",
"2.0",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<=",
"n2",
";",
"i",
"++",
")",
"{",
"xvals",
"[",
"i",
"]",
"=",
"0.0",
";",
"yvals",
"[",
"i",
"]",
"=",
"1.0",
"-",
"(",
"double",
")",
"i",
"*",
"temp",
";",
"xvals",
"[",
"n",
"-",
"i",
"]",
"=",
"yvals",
"[",
"i",
"]",
";",
"yvals",
"[",
"n",
"-",
"i",
"]",
"=",
"xvals",
"[",
"i",
"]",
";",
"}",
"}",
"return",
";",
"}",
"if",
"(",
"r",
"==",
"PRO_SQUARE_R",
")",
"{",
"if",
"(",
"!",
"seg_odd",
")",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<=",
"n2",
";",
"i",
"++",
")",
"{",
"xvals",
"[",
"i",
"]",
"=",
"(",
"double",
")",
"i",
"/",
"n2",
";",
"yvals",
"[",
"i",
"]",
"=",
"1.0",
";",
"xvals",
"[",
"n",
"-",
"i",
"]",
"=",
"yvals",
"[",
"i",
"]",
";",
"yvals",
"[",
"n",
"-",
"i",
"]",
"=",
"xvals",
"[",
"i",
"]",
";",
"}",
"}",
"else",
"{",
"temp",
"=",
"1.0",
"/",
"(",
"n2",
"+",
"M_SQRT2",
"/",
"2",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<=",
"n2",
";",
"i",
"++",
")",
"{",
"xvals",
"[",
"i",
"]",
"=",
"(",
"double",
")",
"i",
"*",
"temp",
";",
"yvals",
"[",
"i",
"]",
"=",
"1.0",
";",
"xvals",
"[",
"n",
"-",
"i",
"]",
"=",
"yvals",
"[",
"i",
"]",
";",
"yvals",
"[",
"n",
"-",
"i",
"]",
"=",
"xvals",
"[",
"i",
"]",
";",
"}",
"}",
"return",
";",
"}",
"find_even_superellipse_chords_general",
"(",
"n",
",",
"r",
",",
"xvals",
",",
"yvals",
")",
";",
"}"
] | Find equidistant points (x0,y0), (x1,y1)... (xn,yn) on the superellipse
function in the first quadrant. | [
"Find",
"equidistant",
"points",
"(",
"x0",
"y0",
")",
"(",
"x1",
"y1",
")",
"...",
"(",
"xn",
"yn",
")",
"on",
"the",
"superellipse",
"function",
"in",
"the",
"first",
"quadrant",
"."
] | [
"/* Special cases. */",
"/* Linear spacing */",
"/* Angle spacing. */",
"/* n is even, distribute first and second half linear. */",
"/* n is odd, so get one corner-cut chord. */",
"/* n is even, distribute first and second half linear. */",
"/* n is odd, so get one corner-cut chord. */",
"/* For general case use the more expensive search algorithm. */"
] | [
{
"param": "n",
"type": "int"
},
{
"param": "r",
"type": "float"
},
{
"param": "xvals",
"type": "double"
},
{
"param": "yvals",
"type": "double"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "n",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "r",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "xvals",
"type": "double",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "yvals",
"type": "double",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
797e2ca864e674d30732f6f1e8ff98ecac74b2ed | DemonRem/blender | source/blender/bmesh/tools/bmesh_bevel.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | vertex_collide_offset | float | static float vertex_collide_offset(BevelParams *bp, EdgeHalf *ea)
{
float limit, ka, kb, no_collide_offset, la, kab;
EdgeHalf *eb;
limit = no_collide_offset = bp->offset + 1e6;
if (bp->offset == 0.0f) {
return no_collide_offset;
}
ka = ea->offset_l_spec / bp->offset;
eb = find_other_end_edge_half(bp, ea, NULL);
kb = eb ? eb->offset_l_spec / bp->offset : 0.0f;
kab = ka + kb;
la = BM_edge_calc_length(ea->e);
if (kab <= 0.0f) {
return no_collide_offset;
}
limit = la / kab;
return limit;
} | /*
* We have an edge A between vertices a and b,
* where EdgeHalf ea is the half of A that starts at a.
* For vertex-only bevels, the new vertices slide from a at a rate ka*t
* and from b at a rate kb*t.
* We want to calculate the t at which the two meet.
*/ | We have an edge A between vertices a and b,
where EdgeHalf ea is the half of A that starts at a.
For vertex-only bevels, the new vertices slide from a at a rate ka*t
and from b at a rate kb*t.
We want to calculate the t at which the two meet. | [
"We",
"have",
"an",
"edge",
"A",
"between",
"vertices",
"a",
"and",
"b",
"where",
"EdgeHalf",
"ea",
"is",
"the",
"half",
"of",
"A",
"that",
"starts",
"at",
"a",
".",
"For",
"vertex",
"-",
"only",
"bevels",
"the",
"new",
"vertices",
"slide",
"from",
"a",
"at",
"a",
"rate",
"ka",
"*",
"t",
"and",
"from",
"b",
"at",
"a",
"rate",
"kb",
"*",
"t",
".",
"We",
"want",
"to",
"calculate",
"the",
"t",
"at",
"which",
"the",
"two",
"meet",
"."
] | static float vertex_collide_offset(BevelParams *bp, EdgeHalf *ea)
{
float limit, ka, kb, no_collide_offset, la, kab;
EdgeHalf *eb;
limit = no_collide_offset = bp->offset + 1e6;
if (bp->offset == 0.0f) {
return no_collide_offset;
}
ka = ea->offset_l_spec / bp->offset;
eb = find_other_end_edge_half(bp, ea, NULL);
kb = eb ? eb->offset_l_spec / bp->offset : 0.0f;
kab = ka + kb;
la = BM_edge_calc_length(ea->e);
if (kab <= 0.0f) {
return no_collide_offset;
}
limit = la / kab;
return limit;
} | [
"static",
"float",
"vertex_collide_offset",
"(",
"BevelParams",
"*",
"bp",
",",
"EdgeHalf",
"*",
"ea",
")",
"{",
"float",
"limit",
",",
"ka",
",",
"kb",
",",
"no_collide_offset",
",",
"la",
",",
"kab",
";",
"EdgeHalf",
"*",
"eb",
";",
"limit",
"=",
"no_collide_offset",
"=",
"bp",
"->",
"offset",
"+",
"1e6",
";",
"if",
"(",
"bp",
"->",
"offset",
"==",
"0.0f",
")",
"{",
"return",
"no_collide_offset",
";",
"}",
"ka",
"=",
"ea",
"->",
"offset_l_spec",
"/",
"bp",
"->",
"offset",
";",
"eb",
"=",
"find_other_end_edge_half",
"(",
"bp",
",",
"ea",
",",
"NULL",
")",
";",
"kb",
"=",
"eb",
"?",
"eb",
"->",
"offset_l_spec",
"/",
"bp",
"->",
"offset",
":",
"0.0f",
";",
"kab",
"=",
"ka",
"+",
"kb",
";",
"la",
"=",
"BM_edge_calc_length",
"(",
"ea",
"->",
"e",
")",
";",
"if",
"(",
"kab",
"<=",
"0.0f",
")",
"{",
"return",
"no_collide_offset",
";",
"}",
"limit",
"=",
"la",
"/",
"kab",
";",
"return",
"limit",
";",
"}"
] | We have an edge A between vertices a and b,
where EdgeHalf ea is the half of A that starts at a. | [
"We",
"have",
"an",
"edge",
"A",
"between",
"vertices",
"a",
"and",
"b",
"where",
"EdgeHalf",
"ea",
"is",
"the",
"half",
"of",
"A",
"that",
"starts",
"at",
"a",
"."
] | [] | [
{
"param": "bp",
"type": "BevelParams"
},
{
"param": "ea",
"type": "EdgeHalf"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bp",
"type": "BevelParams",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ea",
"type": "EdgeHalf",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
797e2ca864e674d30732f6f1e8ff98ecac74b2ed | DemonRem/blender | source/blender/bmesh/tools/bmesh_bevel.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | bevel_limit_offset | void | static void bevel_limit_offset(BevelParams *bp, BMesh *bm)
{
BevVert *bv;
EdgeHalf *eh;
BMIter iter;
BMVert *bmv;
float limited_offset, offset_factor, collision_offset;
int i;
limited_offset = bp->offset;
BM_ITER_MESH (bmv, &iter, bm, BM_VERTS_OF_MESH) {
if (!BM_elem_flag_test(bmv, BM_ELEM_TAG)) {
continue;
}
bv = find_bevvert(bp, bmv);
if (!bv) {
continue;
}
for (i = 0; i < bv->edgecount; i++) {
eh = &bv->edges[i];
if (bp->vertex_only) {
collision_offset = vertex_collide_offset(bp, eh);
if (collision_offset < limited_offset) {
limited_offset = collision_offset;
}
}
else {
collision_offset = geometry_collide_offset(bp, eh);
if (collision_offset < limited_offset) {
limited_offset = collision_offset;
}
}
}
}
if (limited_offset < bp->offset) {
/* All current offset specs have some number times bp->offset,
* so we can just multiply them all by the reduction factor
* of the offset to have the effect of recalculating the specs
* with the new limited_offset.
*/
offset_factor = limited_offset / bp->offset;
BM_ITER_MESH (bmv, &iter, bm, BM_VERTS_OF_MESH) {
if (!BM_elem_flag_test(bmv, BM_ELEM_TAG)) {
continue;
}
bv = find_bevvert(bp, bmv);
if (!bv) {
continue;
}
for (i = 0; i < bv->edgecount; i++) {
eh = &bv->edges[i];
eh->offset_l_spec *= offset_factor;
eh->offset_r_spec *= offset_factor;
eh->offset_l *= offset_factor;
eh->offset_r *= offset_factor;
}
}
bp->offset = limited_offset;
}
} | /*
* Calculate an offset that is the lesser of the current
* bp.offset and the maximum possible offset before geometry
* collisions happen.
* If the offset changes as a result of this, adjust the
* current edge offset specs to reflect this clamping,
* and store the new offset in bp.offset.
*/ | Calculate an offset that is the lesser of the current
bp.offset and the maximum possible offset before geometry
collisions happen.
If the offset changes as a result of this, adjust the
current edge offset specs to reflect this clamping,
and store the new offset in bp.offset. | [
"Calculate",
"an",
"offset",
"that",
"is",
"the",
"lesser",
"of",
"the",
"current",
"bp",
".",
"offset",
"and",
"the",
"maximum",
"possible",
"offset",
"before",
"geometry",
"collisions",
"happen",
".",
"If",
"the",
"offset",
"changes",
"as",
"a",
"result",
"of",
"this",
"adjust",
"the",
"current",
"edge",
"offset",
"specs",
"to",
"reflect",
"this",
"clamping",
"and",
"store",
"the",
"new",
"offset",
"in",
"bp",
".",
"offset",
"."
] | static void bevel_limit_offset(BevelParams *bp, BMesh *bm)
{
BevVert *bv;
EdgeHalf *eh;
BMIter iter;
BMVert *bmv;
float limited_offset, offset_factor, collision_offset;
int i;
limited_offset = bp->offset;
BM_ITER_MESH (bmv, &iter, bm, BM_VERTS_OF_MESH) {
if (!BM_elem_flag_test(bmv, BM_ELEM_TAG)) {
continue;
}
bv = find_bevvert(bp, bmv);
if (!bv) {
continue;
}
for (i = 0; i < bv->edgecount; i++) {
eh = &bv->edges[i];
if (bp->vertex_only) {
collision_offset = vertex_collide_offset(bp, eh);
if (collision_offset < limited_offset) {
limited_offset = collision_offset;
}
}
else {
collision_offset = geometry_collide_offset(bp, eh);
if (collision_offset < limited_offset) {
limited_offset = collision_offset;
}
}
}
}
if (limited_offset < bp->offset) {
offset_factor = limited_offset / bp->offset;
BM_ITER_MESH (bmv, &iter, bm, BM_VERTS_OF_MESH) {
if (!BM_elem_flag_test(bmv, BM_ELEM_TAG)) {
continue;
}
bv = find_bevvert(bp, bmv);
if (!bv) {
continue;
}
for (i = 0; i < bv->edgecount; i++) {
eh = &bv->edges[i];
eh->offset_l_spec *= offset_factor;
eh->offset_r_spec *= offset_factor;
eh->offset_l *= offset_factor;
eh->offset_r *= offset_factor;
}
}
bp->offset = limited_offset;
}
} | [
"static",
"void",
"bevel_limit_offset",
"(",
"BevelParams",
"*",
"bp",
",",
"BMesh",
"*",
"bm",
")",
"{",
"BevVert",
"*",
"bv",
";",
"EdgeHalf",
"*",
"eh",
";",
"BMIter",
"iter",
";",
"BMVert",
"*",
"bmv",
";",
"float",
"limited_offset",
",",
"offset_factor",
",",
"collision_offset",
";",
"int",
"i",
";",
"limited_offset",
"=",
"bp",
"->",
"offset",
";",
"BM_ITER_MESH",
"(",
"bmv",
",",
"&",
"iter",
",",
"bm",
",",
"BM_VERTS_OF_MESH",
")",
"",
"{",
"if",
"(",
"!",
"BM_elem_flag_test",
"(",
"bmv",
",",
"BM_ELEM_TAG",
")",
")",
"{",
"continue",
";",
"}",
"bv",
"=",
"find_bevvert",
"(",
"bp",
",",
"bmv",
")",
";",
"if",
"(",
"!",
"bv",
")",
"{",
"continue",
";",
"}",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"bv",
"->",
"edgecount",
";",
"i",
"++",
")",
"{",
"eh",
"=",
"&",
"bv",
"->",
"edges",
"[",
"i",
"]",
";",
"if",
"(",
"bp",
"->",
"vertex_only",
")",
"{",
"collision_offset",
"=",
"vertex_collide_offset",
"(",
"bp",
",",
"eh",
")",
";",
"if",
"(",
"collision_offset",
"<",
"limited_offset",
")",
"{",
"limited_offset",
"=",
"collision_offset",
";",
"}",
"}",
"else",
"{",
"collision_offset",
"=",
"geometry_collide_offset",
"(",
"bp",
",",
"eh",
")",
";",
"if",
"(",
"collision_offset",
"<",
"limited_offset",
")",
"{",
"limited_offset",
"=",
"collision_offset",
";",
"}",
"}",
"}",
"}",
"if",
"(",
"limited_offset",
"<",
"bp",
"->",
"offset",
")",
"{",
"offset_factor",
"=",
"limited_offset",
"/",
"bp",
"->",
"offset",
";",
"BM_ITER_MESH",
"(",
"bmv",
",",
"&",
"iter",
",",
"bm",
",",
"BM_VERTS_OF_MESH",
")",
"",
"{",
"if",
"(",
"!",
"BM_elem_flag_test",
"(",
"bmv",
",",
"BM_ELEM_TAG",
")",
")",
"{",
"continue",
";",
"}",
"bv",
"=",
"find_bevvert",
"(",
"bp",
",",
"bmv",
")",
";",
"if",
"(",
"!",
"bv",
")",
"{",
"continue",
";",
"}",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"bv",
"->",
"edgecount",
";",
"i",
"++",
")",
"{",
"eh",
"=",
"&",
"bv",
"->",
"edges",
"[",
"i",
"]",
";",
"eh",
"->",
"offset_l_spec",
"*=",
"offset_factor",
";",
"eh",
"->",
"offset_r_spec",
"*=",
"offset_factor",
";",
"eh",
"->",
"offset_l",
"*=",
"offset_factor",
";",
"eh",
"->",
"offset_r",
"*=",
"offset_factor",
";",
"}",
"}",
"bp",
"->",
"offset",
"=",
"limited_offset",
";",
"}",
"}"
] | Calculate an offset that is the lesser of the current
bp.offset and the maximum possible offset before geometry
collisions happen. | [
"Calculate",
"an",
"offset",
"that",
"is",
"the",
"lesser",
"of",
"the",
"current",
"bp",
".",
"offset",
"and",
"the",
"maximum",
"possible",
"offset",
"before",
"geometry",
"collisions",
"happen",
"."
] | [
"/* All current offset specs have some number times bp->offset,\n * so we can just multiply them all by the reduction factor\n * of the offset to have the effect of recalculating the specs\n * with the new limited_offset.\n */"
] | [
{
"param": "bp",
"type": "BevelParams"
},
{
"param": "bm",
"type": "BMesh"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bp",
"type": "BevelParams",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bm",
"type": "BMesh",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
797e2ca864e674d30732f6f1e8ff98ecac74b2ed | DemonRem/blender | source/blender/bmesh/tools/bmesh_bevel.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | BM_mesh_bevel | void | void BM_mesh_bevel(BMesh *bm,
const float offset,
const int offset_type,
const float segments,
const float profile,
const bool vertex_only,
const bool use_weights,
const bool limit_offset,
const struct MDeformVert *dvert,
const int vertex_group,
const int mat,
const bool loop_slide,
const bool mark_seam,
const bool mark_sharp,
const bool harden_normals,
const int face_strength_mode,
const int miter_outer,
const int miter_inner,
const float spread,
const float smoothresh)
{
BMIter iter, liter;
BMVert *v, *v_next;
BMEdge *e;
BMFace *f;
BMLoop *l;
BevVert *bv;
BevelParams bp = {NULL};
bp.offset = offset;
bp.offset_type = offset_type;
bp.seg = segments;
bp.profile = profile;
bp.pro_super_r = -log(2.0) / log(sqrt(profile)); /* convert to superellipse exponent */
bp.vertex_only = vertex_only;
bp.use_weights = use_weights;
bp.loop_slide = loop_slide;
bp.limit_offset = limit_offset;
bp.offset_adjust = true;
bp.dvert = dvert;
bp.vertex_group = vertex_group;
bp.mat_nr = mat;
bp.mark_seam = mark_seam;
bp.mark_sharp = mark_sharp;
bp.harden_normals = harden_normals;
bp.face_strength_mode = face_strength_mode;
bp.miter_outer = miter_outer;
bp.miter_inner = miter_inner;
bp.spread = spread;
bp.smoothresh = smoothresh;
bp.face_hash = NULL;
if (profile >= 0.950f) { /* r ~ 692, so PRO_SQUARE_R is 1e4 */
bp.pro_super_r = PRO_SQUARE_R;
}
if (bp.offset > 0) {
/* primary alloc */
bp.vert_hash = BLI_ghash_ptr_new(__func__);
bp.mem_arena = BLI_memarena_new(MEM_SIZE_OPTIMAL(1 << 16), __func__);
BLI_memarena_use_calloc(bp.mem_arena);
set_profile_spacing(&bp);
bp.face_hash = BLI_ghash_ptr_new(__func__);
BLI_ghash_flag_set(bp.face_hash, GHASH_FLAG_ALLOW_DUPES);
/* Analyze input vertices, sorting edges and assigning initial new vertex positions */
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(v, BM_ELEM_TAG)) {
bv = bevel_vert_construct(bm, &bp, v);
if (!limit_offset && bv) {
build_boundary(&bp, bv, true);
}
}
}
/* Perhaps clamp offset to avoid geometry colliisions */
if (limit_offset) {
bevel_limit_offset(&bp, bm);
/* Assign initial new vertex positions */
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(v, BM_ELEM_TAG)) {
bv = find_bevvert(&bp, v);
if (bv) {
build_boundary(&bp, bv, true);
}
}
}
}
/* Perhaps do a pass to try to even out widths */
if (!bp.vertex_only && bp.offset_adjust && bp.offset_type != BEVEL_AMT_PERCENT) {
adjust_offsets(&bp, bm);
}
/* Build the meshes around vertices, now that positions are final */
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(v, BM_ELEM_TAG)) {
bv = find_bevvert(&bp, v);
if (bv) {
build_vmesh(&bp, bm, bv);
}
}
}
/* Build polygons for edges */
if (!bp.vertex_only) {
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
if (BM_elem_flag_test(e, BM_ELEM_TAG)) {
bevel_build_edge_polygons(bm, &bp, e);
}
}
}
/* Extend edge data like sharp edges and precompute normals for harden */
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(v, BM_ELEM_TAG)) {
bv = find_bevvert(&bp, v);
if (bv) {
bevel_extend_edge_data(bv);
}
}
}
/* Rebuild face polygons around affected vertices */
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(v, BM_ELEM_TAG)) {
bevel_rebuild_existing_polygons(bm, &bp, v);
bevel_reattach_wires(bm, &bp, v);
}
}
BM_ITER_MESH_MUTABLE (v, v_next, &iter, bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(v, BM_ELEM_TAG)) {
BLI_assert(find_bevvert(&bp, v) != NULL);
BM_vert_kill(bm, v);
}
}
if (bp.harden_normals) {
bevel_harden_normals(bm, &bp);
}
if (bp.face_strength_mode != BEVEL_FACE_STRENGTH_NONE) {
bevel_set_weighted_normal_face_strength(bm, &bp);
}
/* When called from operator (as opposed to modifier), bm->use_toolflags
* will be set, and we to transfer the oflags to BM_ELEM_TAGs */
if (bm->use_toolflags) {
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
if (BMO_vert_flag_test(bm, v, VERT_OUT)) {
BM_elem_flag_enable(v, BM_ELEM_TAG);
}
}
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
if (BMO_edge_flag_test(bm, e, EDGE_OUT)) {
BM_elem_flag_enable(e, BM_ELEM_TAG);
}
}
}
/* clear the BM_ELEM_LONG_TAG tags, which were only set on some edges in F_EDGE faces */
BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
if (get_face_kind(&bp, f) != F_EDGE) {
continue;
}
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
BM_elem_flag_disable(l, BM_ELEM_LONG_TAG);
}
}
/* primary free */
BLI_ghash_free(bp.vert_hash, NULL, NULL);
BLI_ghash_free(bp.face_hash, NULL, NULL);
BLI_memarena_free(bp.mem_arena);
}
} | /**
* - Currently only bevels BM_ELEM_TAG'd verts and edges.
*
* - Newly created faces, edges, and verts are BM_ELEM_TAG'd too,
* the caller needs to ensure these are cleared before calling
* if its going to use this tag.
*
* - If limit_offset is set, adjusts offset down if necessary
* to avoid geometry collisions.
*
* \warning all tagged edges _must_ be manifold.
*/ | - Currently only bevels BM_ELEM_TAG'd verts and edges.
- Newly created faces, edges, and verts are BM_ELEM_TAG'd too,
the caller needs to ensure these are cleared before calling
if its going to use this tag.
- If limit_offset is set, adjusts offset down if necessary
to avoid geometry collisions.
\warning all tagged edges _must_ be manifold. | [
"-",
"Currently",
"only",
"bevels",
"BM_ELEM_TAG",
"'",
"d",
"verts",
"and",
"edges",
".",
"-",
"Newly",
"created",
"faces",
"edges",
"and",
"verts",
"are",
"BM_ELEM_TAG",
"'",
"d",
"too",
"the",
"caller",
"needs",
"to",
"ensure",
"these",
"are",
"cleared",
"before",
"calling",
"if",
"its",
"going",
"to",
"use",
"this",
"tag",
".",
"-",
"If",
"limit_offset",
"is",
"set",
"adjusts",
"offset",
"down",
"if",
"necessary",
"to",
"avoid",
"geometry",
"collisions",
".",
"\\",
"warning",
"all",
"tagged",
"edges",
"_must_",
"be",
"manifold",
"."
] | void BM_mesh_bevel(BMesh *bm,
const float offset,
const int offset_type,
const float segments,
const float profile,
const bool vertex_only,
const bool use_weights,
const bool limit_offset,
const struct MDeformVert *dvert,
const int vertex_group,
const int mat,
const bool loop_slide,
const bool mark_seam,
const bool mark_sharp,
const bool harden_normals,
const int face_strength_mode,
const int miter_outer,
const int miter_inner,
const float spread,
const float smoothresh)
{
BMIter iter, liter;
BMVert *v, *v_next;
BMEdge *e;
BMFace *f;
BMLoop *l;
BevVert *bv;
BevelParams bp = {NULL};
bp.offset = offset;
bp.offset_type = offset_type;
bp.seg = segments;
bp.profile = profile;
bp.pro_super_r = -log(2.0) / log(sqrt(profile));
bp.vertex_only = vertex_only;
bp.use_weights = use_weights;
bp.loop_slide = loop_slide;
bp.limit_offset = limit_offset;
bp.offset_adjust = true;
bp.dvert = dvert;
bp.vertex_group = vertex_group;
bp.mat_nr = mat;
bp.mark_seam = mark_seam;
bp.mark_sharp = mark_sharp;
bp.harden_normals = harden_normals;
bp.face_strength_mode = face_strength_mode;
bp.miter_outer = miter_outer;
bp.miter_inner = miter_inner;
bp.spread = spread;
bp.smoothresh = smoothresh;
bp.face_hash = NULL;
if (profile >= 0.950f) {
bp.pro_super_r = PRO_SQUARE_R;
}
if (bp.offset > 0) {
bp.vert_hash = BLI_ghash_ptr_new(__func__);
bp.mem_arena = BLI_memarena_new(MEM_SIZE_OPTIMAL(1 << 16), __func__);
BLI_memarena_use_calloc(bp.mem_arena);
set_profile_spacing(&bp);
bp.face_hash = BLI_ghash_ptr_new(__func__);
BLI_ghash_flag_set(bp.face_hash, GHASH_FLAG_ALLOW_DUPES);
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(v, BM_ELEM_TAG)) {
bv = bevel_vert_construct(bm, &bp, v);
if (!limit_offset && bv) {
build_boundary(&bp, bv, true);
}
}
}
if (limit_offset) {
bevel_limit_offset(&bp, bm);
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(v, BM_ELEM_TAG)) {
bv = find_bevvert(&bp, v);
if (bv) {
build_boundary(&bp, bv, true);
}
}
}
}
if (!bp.vertex_only && bp.offset_adjust && bp.offset_type != BEVEL_AMT_PERCENT) {
adjust_offsets(&bp, bm);
}
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(v, BM_ELEM_TAG)) {
bv = find_bevvert(&bp, v);
if (bv) {
build_vmesh(&bp, bm, bv);
}
}
}
if (!bp.vertex_only) {
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
if (BM_elem_flag_test(e, BM_ELEM_TAG)) {
bevel_build_edge_polygons(bm, &bp, e);
}
}
}
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(v, BM_ELEM_TAG)) {
bv = find_bevvert(&bp, v);
if (bv) {
bevel_extend_edge_data(bv);
}
}
}
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(v, BM_ELEM_TAG)) {
bevel_rebuild_existing_polygons(bm, &bp, v);
bevel_reattach_wires(bm, &bp, v);
}
}
BM_ITER_MESH_MUTABLE (v, v_next, &iter, bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(v, BM_ELEM_TAG)) {
BLI_assert(find_bevvert(&bp, v) != NULL);
BM_vert_kill(bm, v);
}
}
if (bp.harden_normals) {
bevel_harden_normals(bm, &bp);
}
if (bp.face_strength_mode != BEVEL_FACE_STRENGTH_NONE) {
bevel_set_weighted_normal_face_strength(bm, &bp);
}
if (bm->use_toolflags) {
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
if (BMO_vert_flag_test(bm, v, VERT_OUT)) {
BM_elem_flag_enable(v, BM_ELEM_TAG);
}
}
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
if (BMO_edge_flag_test(bm, e, EDGE_OUT)) {
BM_elem_flag_enable(e, BM_ELEM_TAG);
}
}
}
BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
if (get_face_kind(&bp, f) != F_EDGE) {
continue;
}
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
BM_elem_flag_disable(l, BM_ELEM_LONG_TAG);
}
}
BLI_ghash_free(bp.vert_hash, NULL, NULL);
BLI_ghash_free(bp.face_hash, NULL, NULL);
BLI_memarena_free(bp.mem_arena);
}
} | [
"void",
"BM_mesh_bevel",
"(",
"BMesh",
"*",
"bm",
",",
"const",
"float",
"offset",
",",
"const",
"int",
"offset_type",
",",
"const",
"float",
"segments",
",",
"const",
"float",
"profile",
",",
"const",
"bool",
"vertex_only",
",",
"const",
"bool",
"use_weights",
",",
"const",
"bool",
"limit_offset",
",",
"const",
"struct",
"MDeformVert",
"*",
"dvert",
",",
"const",
"int",
"vertex_group",
",",
"const",
"int",
"mat",
",",
"const",
"bool",
"loop_slide",
",",
"const",
"bool",
"mark_seam",
",",
"const",
"bool",
"mark_sharp",
",",
"const",
"bool",
"harden_normals",
",",
"const",
"int",
"face_strength_mode",
",",
"const",
"int",
"miter_outer",
",",
"const",
"int",
"miter_inner",
",",
"const",
"float",
"spread",
",",
"const",
"float",
"smoothresh",
")",
"{",
"BMIter",
"iter",
",",
"liter",
";",
"BMVert",
"*",
"v",
",",
"*",
"v_next",
";",
"BMEdge",
"*",
"e",
";",
"BMFace",
"*",
"f",
";",
"BMLoop",
"*",
"l",
";",
"BevVert",
"*",
"bv",
";",
"BevelParams",
"bp",
"=",
"{",
"NULL",
"}",
";",
"bp",
".",
"offset",
"=",
"offset",
";",
"bp",
".",
"offset_type",
"=",
"offset_type",
";",
"bp",
".",
"seg",
"=",
"segments",
";",
"bp",
".",
"profile",
"=",
"profile",
";",
"bp",
".",
"pro_super_r",
"=",
"-",
"log",
"(",
"2.0",
")",
"/",
"log",
"(",
"sqrt",
"(",
"profile",
")",
")",
";",
"bp",
".",
"vertex_only",
"=",
"vertex_only",
";",
"bp",
".",
"use_weights",
"=",
"use_weights",
";",
"bp",
".",
"loop_slide",
"=",
"loop_slide",
";",
"bp",
".",
"limit_offset",
"=",
"limit_offset",
";",
"bp",
".",
"offset_adjust",
"=",
"true",
";",
"bp",
".",
"dvert",
"=",
"dvert",
";",
"bp",
".",
"vertex_group",
"=",
"vertex_group",
";",
"bp",
".",
"mat_nr",
"=",
"mat",
";",
"bp",
".",
"mark_seam",
"=",
"mark_seam",
";",
"bp",
".",
"mark_sharp",
"=",
"mark_sharp",
";",
"bp",
".",
"harden_normals",
"=",
"harden_normals",
";",
"bp",
".",
"face_strength_mode",
"=",
"face_strength_mode",
";",
"bp",
".",
"miter_outer",
"=",
"miter_outer",
";",
"bp",
".",
"miter_inner",
"=",
"miter_inner",
";",
"bp",
".",
"spread",
"=",
"spread",
";",
"bp",
".",
"smoothresh",
"=",
"smoothresh",
";",
"bp",
".",
"face_hash",
"=",
"NULL",
";",
"if",
"(",
"profile",
">=",
"0.950f",
")",
"{",
"bp",
".",
"pro_super_r",
"=",
"PRO_SQUARE_R",
";",
"}",
"if",
"(",
"bp",
".",
"offset",
">",
"0",
")",
"{",
"bp",
".",
"vert_hash",
"=",
"BLI_ghash_ptr_new",
"(",
"__func__",
")",
";",
"bp",
".",
"mem_arena",
"=",
"BLI_memarena_new",
"(",
"MEM_SIZE_OPTIMAL",
"(",
"1",
"<<",
"16",
")",
",",
"__func__",
")",
";",
"BLI_memarena_use_calloc",
"(",
"bp",
".",
"mem_arena",
")",
";",
"set_profile_spacing",
"(",
"&",
"bp",
")",
";",
"bp",
".",
"face_hash",
"=",
"BLI_ghash_ptr_new",
"(",
"__func__",
")",
";",
"BLI_ghash_flag_set",
"(",
"bp",
".",
"face_hash",
",",
"GHASH_FLAG_ALLOW_DUPES",
")",
";",
"BM_ITER_MESH",
"(",
"v",
",",
"&",
"iter",
",",
"bm",
",",
"BM_VERTS_OF_MESH",
")",
"",
"{",
"if",
"(",
"BM_elem_flag_test",
"(",
"v",
",",
"BM_ELEM_TAG",
")",
")",
"{",
"bv",
"=",
"bevel_vert_construct",
"(",
"bm",
",",
"&",
"bp",
",",
"v",
")",
";",
"if",
"(",
"!",
"limit_offset",
"&&",
"bv",
")",
"{",
"build_boundary",
"(",
"&",
"bp",
",",
"bv",
",",
"true",
")",
";",
"}",
"}",
"}",
"if",
"(",
"limit_offset",
")",
"{",
"bevel_limit_offset",
"(",
"&",
"bp",
",",
"bm",
")",
";",
"BM_ITER_MESH",
"(",
"v",
",",
"&",
"iter",
",",
"bm",
",",
"BM_VERTS_OF_MESH",
")",
"",
"{",
"if",
"(",
"BM_elem_flag_test",
"(",
"v",
",",
"BM_ELEM_TAG",
")",
")",
"{",
"bv",
"=",
"find_bevvert",
"(",
"&",
"bp",
",",
"v",
")",
";",
"if",
"(",
"bv",
")",
"{",
"build_boundary",
"(",
"&",
"bp",
",",
"bv",
",",
"true",
")",
";",
"}",
"}",
"}",
"}",
"if",
"(",
"!",
"bp",
".",
"vertex_only",
"&&",
"bp",
".",
"offset_adjust",
"&&",
"bp",
".",
"offset_type",
"!=",
"BEVEL_AMT_PERCENT",
")",
"{",
"adjust_offsets",
"(",
"&",
"bp",
",",
"bm",
")",
";",
"}",
"BM_ITER_MESH",
"(",
"v",
",",
"&",
"iter",
",",
"bm",
",",
"BM_VERTS_OF_MESH",
")",
"",
"{",
"if",
"(",
"BM_elem_flag_test",
"(",
"v",
",",
"BM_ELEM_TAG",
")",
")",
"{",
"bv",
"=",
"find_bevvert",
"(",
"&",
"bp",
",",
"v",
")",
";",
"if",
"(",
"bv",
")",
"{",
"build_vmesh",
"(",
"&",
"bp",
",",
"bm",
",",
"bv",
")",
";",
"}",
"}",
"}",
"if",
"(",
"!",
"bp",
".",
"vertex_only",
")",
"{",
"BM_ITER_MESH",
"(",
"e",
",",
"&",
"iter",
",",
"bm",
",",
"BM_EDGES_OF_MESH",
")",
"",
"{",
"if",
"(",
"BM_elem_flag_test",
"(",
"e",
",",
"BM_ELEM_TAG",
")",
")",
"{",
"bevel_build_edge_polygons",
"(",
"bm",
",",
"&",
"bp",
",",
"e",
")",
";",
"}",
"}",
"}",
"BM_ITER_MESH",
"(",
"v",
",",
"&",
"iter",
",",
"bm",
",",
"BM_VERTS_OF_MESH",
")",
"",
"{",
"if",
"(",
"BM_elem_flag_test",
"(",
"v",
",",
"BM_ELEM_TAG",
")",
")",
"{",
"bv",
"=",
"find_bevvert",
"(",
"&",
"bp",
",",
"v",
")",
";",
"if",
"(",
"bv",
")",
"{",
"bevel_extend_edge_data",
"(",
"bv",
")",
";",
"}",
"}",
"}",
"BM_ITER_MESH",
"(",
"v",
",",
"&",
"iter",
",",
"bm",
",",
"BM_VERTS_OF_MESH",
")",
"",
"{",
"if",
"(",
"BM_elem_flag_test",
"(",
"v",
",",
"BM_ELEM_TAG",
")",
")",
"{",
"bevel_rebuild_existing_polygons",
"(",
"bm",
",",
"&",
"bp",
",",
"v",
")",
";",
"bevel_reattach_wires",
"(",
"bm",
",",
"&",
"bp",
",",
"v",
")",
";",
"}",
"}",
"BM_ITER_MESH_MUTABLE",
"(",
"v",
",",
"v_next",
",",
"&",
"iter",
",",
"bm",
",",
"BM_VERTS_OF_MESH",
")",
"",
"{",
"if",
"(",
"BM_elem_flag_test",
"(",
"v",
",",
"BM_ELEM_TAG",
")",
")",
"{",
"BLI_assert",
"(",
"find_bevvert",
"(",
"&",
"bp",
",",
"v",
")",
"!=",
"NULL",
")",
";",
"BM_vert_kill",
"(",
"bm",
",",
"v",
")",
";",
"}",
"}",
"if",
"(",
"bp",
".",
"harden_normals",
")",
"{",
"bevel_harden_normals",
"(",
"bm",
",",
"&",
"bp",
")",
";",
"}",
"if",
"(",
"bp",
".",
"face_strength_mode",
"!=",
"BEVEL_FACE_STRENGTH_NONE",
")",
"{",
"bevel_set_weighted_normal_face_strength",
"(",
"bm",
",",
"&",
"bp",
")",
";",
"}",
"if",
"(",
"bm",
"->",
"use_toolflags",
")",
"{",
"BM_ITER_MESH",
"(",
"v",
",",
"&",
"iter",
",",
"bm",
",",
"BM_VERTS_OF_MESH",
")",
"",
"{",
"if",
"(",
"BMO_vert_flag_test",
"(",
"bm",
",",
"v",
",",
"VERT_OUT",
")",
")",
"{",
"BM_elem_flag_enable",
"(",
"v",
",",
"BM_ELEM_TAG",
")",
";",
"}",
"}",
"BM_ITER_MESH",
"(",
"e",
",",
"&",
"iter",
",",
"bm",
",",
"BM_EDGES_OF_MESH",
")",
"",
"{",
"if",
"(",
"BMO_edge_flag_test",
"(",
"bm",
",",
"e",
",",
"EDGE_OUT",
")",
")",
"{",
"BM_elem_flag_enable",
"(",
"e",
",",
"BM_ELEM_TAG",
")",
";",
"}",
"}",
"}",
"BM_ITER_MESH",
"(",
"f",
",",
"&",
"iter",
",",
"bm",
",",
"BM_FACES_OF_MESH",
")",
"",
"{",
"if",
"(",
"get_face_kind",
"(",
"&",
"bp",
",",
"f",
")",
"!=",
"F_EDGE",
")",
"{",
"continue",
";",
"}",
"BM_ITER_ELEM",
"(",
"l",
",",
"&",
"liter",
",",
"f",
",",
"BM_LOOPS_OF_FACE",
")",
"",
"{",
"BM_elem_flag_disable",
"(",
"l",
",",
"BM_ELEM_LONG_TAG",
")",
";",
"}",
"}",
"BLI_ghash_free",
"(",
"bp",
".",
"vert_hash",
",",
"NULL",
",",
"NULL",
")",
";",
"BLI_ghash_free",
"(",
"bp",
".",
"face_hash",
",",
"NULL",
",",
"NULL",
")",
";",
"BLI_memarena_free",
"(",
"bp",
".",
"mem_arena",
")",
";",
"}",
"}"
] | - Currently only bevels BM_ELEM_TAG'd verts and edges. | [
"-",
"Currently",
"only",
"bevels",
"BM_ELEM_TAG",
"'",
"d",
"verts",
"and",
"edges",
"."
] | [
"/* convert to superellipse exponent */",
"/* r ~ 692, so PRO_SQUARE_R is 1e4 */",
"/* primary alloc */",
"/* Analyze input vertices, sorting edges and assigning initial new vertex positions */",
"/* Perhaps clamp offset to avoid geometry colliisions */",
"/* Assign initial new vertex positions */",
"/* Perhaps do a pass to try to even out widths */",
"/* Build the meshes around vertices, now that positions are final */",
"/* Build polygons for edges */",
"/* Extend edge data like sharp edges and precompute normals for harden */",
"/* Rebuild face polygons around affected vertices */",
"/* When called from operator (as opposed to modifier), bm->use_toolflags\n * will be set, and we to transfer the oflags to BM_ELEM_TAGs */",
"/* clear the BM_ELEM_LONG_TAG tags, which were only set on some edges in F_EDGE faces */",
"/* primary free */"
] | [
{
"param": "bm",
"type": "BMesh"
},
{
"param": "offset",
"type": "float"
},
{
"param": "offset_type",
"type": "int"
},
{
"param": "segments",
"type": "float"
},
{
"param": "profile",
"type": "float"
},
{
"param": "vertex_only",
"type": "bool"
},
{
"param": "use_weights",
"type": "bool"
},
{
"param": "limit_offset",
"type": "bool"
},
{
"param": "dvert",
"type": "struct MDeformVert"
},
{
"param": "vertex_group",
"type": "int"
},
{
"param": "mat",
"type": "int"
},
{
"param": "loop_slide",
"type": "bool"
},
{
"param": "mark_seam",
"type": "bool"
},
{
"param": "mark_sharp",
"type": "bool"
},
{
"param": "harden_normals",
"type": "bool"
},
{
"param": "face_strength_mode",
"type": "int"
},
{
"param": "miter_outer",
"type": "int"
},
{
"param": "miter_inner",
"type": "int"
},
{
"param": "spread",
"type": "float"
},
{
"param": "smoothresh",
"type": "float"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bm",
"type": "BMesh",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "offset",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "offset_type",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "segments",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "profile",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "vertex_only",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "use_weights",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "limit_offset",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dvert",
"type": "struct MDeformVert",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "vertex_group",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mat",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "loop_slide",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mark_seam",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mark_sharp",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "harden_normals",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "face_strength_mode",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "miter_outer",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "miter_inner",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "spread",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "smoothresh",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e7a7bf96f11bcb5b2e789ee62474c7b954e307a | DemonRem/blender | source/blender/windowmanager/intern/wm_keymap.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | wm_keymap_item_copy | wmKeyMapItem | static wmKeyMapItem *wm_keymap_item_copy(wmKeyMapItem *kmi)
{
wmKeyMapItem *kmin = MEM_dupallocN(kmi);
kmin->prev = kmin->next = NULL;
kmin->flag &= ~KMI_UPDATE;
if (kmin->properties) {
kmin->ptr = MEM_callocN(sizeof(PointerRNA), "UserKeyMapItemPtr");
WM_operator_properties_create(kmin->ptr, kmin->idname);
kmin->properties = IDP_CopyProperty(kmin->properties);
kmin->ptr->data = kmin->properties;
}
else {
kmin->properties = NULL;
kmin->ptr = NULL;
}
return kmin;
} | /* -------------------------------------------------------------------- */
/** \name Keymap Item
*
* Item in a keymap, that maps from an event to an operator or modal map item.
* \{ */ | \name Keymap Item
Item in a keymap, that maps from an event to an operator or modal map item. | [
"\\",
"name",
"Keymap",
"Item",
"Item",
"in",
"a",
"keymap",
"that",
"maps",
"from",
"an",
"event",
"to",
"an",
"operator",
"or",
"modal",
"map",
"item",
"."
] | static wmKeyMapItem *wm_keymap_item_copy(wmKeyMapItem *kmi)
{
wmKeyMapItem *kmin = MEM_dupallocN(kmi);
kmin->prev = kmin->next = NULL;
kmin->flag &= ~KMI_UPDATE;
if (kmin->properties) {
kmin->ptr = MEM_callocN(sizeof(PointerRNA), "UserKeyMapItemPtr");
WM_operator_properties_create(kmin->ptr, kmin->idname);
kmin->properties = IDP_CopyProperty(kmin->properties);
kmin->ptr->data = kmin->properties;
}
else {
kmin->properties = NULL;
kmin->ptr = NULL;
}
return kmin;
} | [
"static",
"wmKeyMapItem",
"*",
"wm_keymap_item_copy",
"(",
"wmKeyMapItem",
"*",
"kmi",
")",
"{",
"wmKeyMapItem",
"*",
"kmin",
"=",
"MEM_dupallocN",
"(",
"kmi",
")",
";",
"kmin",
"->",
"prev",
"=",
"kmin",
"->",
"next",
"=",
"NULL",
";",
"kmin",
"->",
"flag",
"&=",
"~",
"KMI_UPDATE",
";",
"if",
"(",
"kmin",
"->",
"properties",
")",
"{",
"kmin",
"->",
"ptr",
"=",
"MEM_callocN",
"(",
"sizeof",
"(",
"PointerRNA",
")",
",",
"\"",
"\"",
")",
";",
"WM_operator_properties_create",
"(",
"kmin",
"->",
"ptr",
",",
"kmin",
"->",
"idname",
")",
";",
"kmin",
"->",
"properties",
"=",
"IDP_CopyProperty",
"(",
"kmin",
"->",
"properties",
")",
";",
"kmin",
"->",
"ptr",
"->",
"data",
"=",
"kmin",
"->",
"properties",
";",
"}",
"else",
"{",
"kmin",
"->",
"properties",
"=",
"NULL",
";",
"kmin",
"->",
"ptr",
"=",
"NULL",
";",
"}",
"return",
"kmin",
";",
"}"
] | \name Keymap Item | [
"\\",
"name",
"Keymap",
"Item"
] | [] | [
{
"param": "kmi",
"type": "wmKeyMapItem"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "kmi",
"type": "wmKeyMapItem",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e7a7bf96f11bcb5b2e789ee62474c7b954e307a | DemonRem/blender | source/blender/windowmanager/intern/wm_keymap.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | wm_keymap_item_properties_update_ot | void | static void wm_keymap_item_properties_update_ot(wmKeyMapItem *kmi)
{
if (kmi->idname[0] == 0) {
BLI_assert(kmi->ptr == NULL);
return;
}
if (kmi->ptr == NULL) {
wm_keymap_item_properties_set(kmi);
}
else {
wmOperatorType *ot = WM_operatortype_find(kmi->idname, 0);
if (ot) {
if (ot->srna != kmi->ptr->type) {
/* matches wm_keymap_item_properties_set but doesn't alloc new ptr */
WM_operator_properties_create_ptr(kmi->ptr, ot);
/* 'kmi->ptr->data' NULL'd above, keep using existing properties.
* Note: the operators property types may have changed,
* we will need a more comprehensive sanitize function to support this properly.
*/
if (kmi->properties) {
kmi->ptr->data = kmi->properties;
}
WM_operator_properties_sanitize(kmi->ptr, 1);
}
}
else {
/* zombie keymap item */
wm_keymap_item_free(kmi);
}
}
} | /**
* Similar to #wm_keymap_item_properties_set
* but checks for the #wmOperatorType having changed, see T38042.
*/ | Similar to #wm_keymap_item_properties_set
but checks for the #wmOperatorType having changed, see T38042. | [
"Similar",
"to",
"#wm_keymap_item_properties_set",
"but",
"checks",
"for",
"the",
"#wmOperatorType",
"having",
"changed",
"see",
"T38042",
"."
] | static void wm_keymap_item_properties_update_ot(wmKeyMapItem *kmi)
{
if (kmi->idname[0] == 0) {
BLI_assert(kmi->ptr == NULL);
return;
}
if (kmi->ptr == NULL) {
wm_keymap_item_properties_set(kmi);
}
else {
wmOperatorType *ot = WM_operatortype_find(kmi->idname, 0);
if (ot) {
if (ot->srna != kmi->ptr->type) {
WM_operator_properties_create_ptr(kmi->ptr, ot);
if (kmi->properties) {
kmi->ptr->data = kmi->properties;
}
WM_operator_properties_sanitize(kmi->ptr, 1);
}
}
else {
wm_keymap_item_free(kmi);
}
}
} | [
"static",
"void",
"wm_keymap_item_properties_update_ot",
"(",
"wmKeyMapItem",
"*",
"kmi",
")",
"{",
"if",
"(",
"kmi",
"->",
"idname",
"[",
"0",
"]",
"==",
"0",
")",
"{",
"BLI_assert",
"(",
"kmi",
"->",
"ptr",
"==",
"NULL",
")",
";",
"return",
";",
"}",
"if",
"(",
"kmi",
"->",
"ptr",
"==",
"NULL",
")",
"{",
"wm_keymap_item_properties_set",
"(",
"kmi",
")",
";",
"}",
"else",
"{",
"wmOperatorType",
"*",
"ot",
"=",
"WM_operatortype_find",
"(",
"kmi",
"->",
"idname",
",",
"0",
")",
";",
"if",
"(",
"ot",
")",
"{",
"if",
"(",
"ot",
"->",
"srna",
"!=",
"kmi",
"->",
"ptr",
"->",
"type",
")",
"{",
"WM_operator_properties_create_ptr",
"(",
"kmi",
"->",
"ptr",
",",
"ot",
")",
";",
"if",
"(",
"kmi",
"->",
"properties",
")",
"{",
"kmi",
"->",
"ptr",
"->",
"data",
"=",
"kmi",
"->",
"properties",
";",
"}",
"WM_operator_properties_sanitize",
"(",
"kmi",
"->",
"ptr",
",",
"1",
")",
";",
"}",
"}",
"else",
"{",
"wm_keymap_item_free",
"(",
"kmi",
")",
";",
"}",
"}",
"}"
] | Similar to #wm_keymap_item_properties_set
but checks for the #wmOperatorType having changed, see T38042. | [
"Similar",
"to",
"#wm_keymap_item_properties_set",
"but",
"checks",
"for",
"the",
"#wmOperatorType",
"having",
"changed",
"see",
"T38042",
"."
] | [
"/* matches wm_keymap_item_properties_set but doesn't alloc new ptr */",
"/* 'kmi->ptr->data' NULL'd above, keep using existing properties.\n * Note: the operators property types may have changed,\n * we will need a more comprehensive sanitize function to support this properly.\n */",
"/* zombie keymap item */"
] | [
{
"param": "kmi",
"type": "wmKeyMapItem"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "kmi",
"type": "wmKeyMapItem",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e7a7bf96f11bcb5b2e789ee62474c7b954e307a | DemonRem/blender | source/blender/windowmanager/intern/wm_keymap.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | WM_keymap_item_properties_reset | void | void WM_keymap_item_properties_reset(wmKeyMapItem *kmi, struct IDProperty *properties)
{
if (LIKELY(kmi->ptr)) {
WM_operator_properties_free(kmi->ptr);
MEM_freeN(kmi->ptr);
kmi->ptr = NULL;
}
kmi->properties = properties;
wm_keymap_item_properties_set(kmi);
} | /* properties can be NULL, otherwise the arg passed is used and ownership is given to the kmi */ | properties can be NULL, otherwise the arg passed is used and ownership is given to the kmi | [
"properties",
"can",
"be",
"NULL",
"otherwise",
"the",
"arg",
"passed",
"is",
"used",
"and",
"ownership",
"is",
"given",
"to",
"the",
"kmi"
] | void WM_keymap_item_properties_reset(wmKeyMapItem *kmi, struct IDProperty *properties)
{
if (LIKELY(kmi->ptr)) {
WM_operator_properties_free(kmi->ptr);
MEM_freeN(kmi->ptr);
kmi->ptr = NULL;
}
kmi->properties = properties;
wm_keymap_item_properties_set(kmi);
} | [
"void",
"WM_keymap_item_properties_reset",
"(",
"wmKeyMapItem",
"*",
"kmi",
",",
"struct",
"IDProperty",
"*",
"properties",
")",
"{",
"if",
"(",
"LIKELY",
"(",
"kmi",
"->",
"ptr",
")",
")",
"{",
"WM_operator_properties_free",
"(",
"kmi",
"->",
"ptr",
")",
";",
"MEM_freeN",
"(",
"kmi",
"->",
"ptr",
")",
";",
"kmi",
"->",
"ptr",
"=",
"NULL",
";",
"}",
"kmi",
"->",
"properties",
"=",
"properties",
";",
"wm_keymap_item_properties_set",
"(",
"kmi",
")",
";",
"}"
] | properties can be NULL, otherwise the arg passed is used and ownership is given to the kmi | [
"properties",
"can",
"be",
"NULL",
"otherwise",
"the",
"arg",
"passed",
"is",
"used",
"and",
"ownership",
"is",
"given",
"to",
"the",
"kmi"
] | [] | [
{
"param": "kmi",
"type": "wmKeyMapItem"
},
{
"param": "properties",
"type": "struct IDProperty"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "kmi",
"type": "wmKeyMapItem",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "properties",
"type": "struct IDProperty",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e7a7bf96f11bcb5b2e789ee62474c7b954e307a | DemonRem/blender | source/blender/windowmanager/intern/wm_keymap.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | wm_keymap_diff_item_copy | wmKeyMapDiffItem | static wmKeyMapDiffItem *wm_keymap_diff_item_copy(wmKeyMapDiffItem *kmdi)
{
wmKeyMapDiffItem *kmdin = MEM_dupallocN(kmdi);
kmdin->next = kmdin->prev = NULL;
if (kmdi->add_item) {
kmdin->add_item = wm_keymap_item_copy(kmdi->add_item);
}
if (kmdi->remove_item) {
kmdin->remove_item = wm_keymap_item_copy(kmdi->remove_item);
}
return kmdin;
} | /* -------------------------------------------------------------------- */
/** \name Keymap Diff Item
*
* Item in a diff keymap, used for saving diff of keymaps in user preferences.
* \{ */ | \name Keymap Diff Item
Item in a diff keymap, used for saving diff of keymaps in user preferences. | [
"\\",
"name",
"Keymap",
"Diff",
"Item",
"Item",
"in",
"a",
"diff",
"keymap",
"used",
"for",
"saving",
"diff",
"of",
"keymaps",
"in",
"user",
"preferences",
"."
] | static wmKeyMapDiffItem *wm_keymap_diff_item_copy(wmKeyMapDiffItem *kmdi)
{
wmKeyMapDiffItem *kmdin = MEM_dupallocN(kmdi);
kmdin->next = kmdin->prev = NULL;
if (kmdi->add_item) {
kmdin->add_item = wm_keymap_item_copy(kmdi->add_item);
}
if (kmdi->remove_item) {
kmdin->remove_item = wm_keymap_item_copy(kmdi->remove_item);
}
return kmdin;
} | [
"static",
"wmKeyMapDiffItem",
"*",
"wm_keymap_diff_item_copy",
"(",
"wmKeyMapDiffItem",
"*",
"kmdi",
")",
"{",
"wmKeyMapDiffItem",
"*",
"kmdin",
"=",
"MEM_dupallocN",
"(",
"kmdi",
")",
";",
"kmdin",
"->",
"next",
"=",
"kmdin",
"->",
"prev",
"=",
"NULL",
";",
"if",
"(",
"kmdi",
"->",
"add_item",
")",
"{",
"kmdin",
"->",
"add_item",
"=",
"wm_keymap_item_copy",
"(",
"kmdi",
"->",
"add_item",
")",
";",
"}",
"if",
"(",
"kmdi",
"->",
"remove_item",
")",
"{",
"kmdin",
"->",
"remove_item",
"=",
"wm_keymap_item_copy",
"(",
"kmdi",
"->",
"remove_item",
")",
";",
"}",
"return",
"kmdin",
";",
"}"
] | \name Keymap Diff Item | [
"\\",
"name",
"Keymap",
"Diff",
"Item"
] | [] | [
{
"param": "kmdi",
"type": "wmKeyMapDiffItem"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "kmdi",
"type": "wmKeyMapDiffItem",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e7a7bf96f11bcb5b2e789ee62474c7b954e307a | DemonRem/blender | source/blender/windowmanager/intern/wm_keymap.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | WM_keyconfig_new | wmKeyConfig | wmKeyConfig *WM_keyconfig_new(wmWindowManager *wm, const char *idname, bool user_defined)
{
wmKeyConfig *keyconf = BLI_findstring(&wm->keyconfigs, idname, offsetof(wmKeyConfig, idname));
if (keyconf) {
if (keyconf == wm->defaultconf) {
/* For default configuration, we need to keep keymap
* modal items and poll functions intact. */
for (wmKeyMap *km = keyconf->keymaps.first; km; km = km->next) {
WM_keymap_clear(km);
}
}
else {
/* For user defined key configuration, clear all keymaps. */
WM_keyconfig_clear(keyconf);
}
return keyconf;
}
/* Create new configuration. */
keyconf = MEM_callocN(sizeof(wmKeyConfig), "wmKeyConfig");
BLI_strncpy(keyconf->idname, idname, sizeof(keyconf->idname));
BLI_addtail(&wm->keyconfigs, keyconf);
if (user_defined) {
keyconf->flag |= KEYCONF_USER;
}
return keyconf;
} | /* -------------------------------------------------------------------- */
/** \name Key Configuration
*
* List of keymaps for all editors, modes, etc.
* There is a builtin default key configuration,
* a user key configuration, and other preset configurations.
* \{ */ | \name Key Configuration
List of keymaps for all editors, modes, etc.
There is a builtin default key configuration,
a user key configuration, and other preset configurations. | [
"\\",
"name",
"Key",
"Configuration",
"List",
"of",
"keymaps",
"for",
"all",
"editors",
"modes",
"etc",
".",
"There",
"is",
"a",
"builtin",
"default",
"key",
"configuration",
"a",
"user",
"key",
"configuration",
"and",
"other",
"preset",
"configurations",
"."
] | wmKeyConfig *WM_keyconfig_new(wmWindowManager *wm, const char *idname, bool user_defined)
{
wmKeyConfig *keyconf = BLI_findstring(&wm->keyconfigs, idname, offsetof(wmKeyConfig, idname));
if (keyconf) {
if (keyconf == wm->defaultconf) {
for (wmKeyMap *km = keyconf->keymaps.first; km; km = km->next) {
WM_keymap_clear(km);
}
}
else {
WM_keyconfig_clear(keyconf);
}
return keyconf;
}
keyconf = MEM_callocN(sizeof(wmKeyConfig), "wmKeyConfig");
BLI_strncpy(keyconf->idname, idname, sizeof(keyconf->idname));
BLI_addtail(&wm->keyconfigs, keyconf);
if (user_defined) {
keyconf->flag |= KEYCONF_USER;
}
return keyconf;
} | [
"wmKeyConfig",
"*",
"WM_keyconfig_new",
"(",
"wmWindowManager",
"*",
"wm",
",",
"const",
"char",
"*",
"idname",
",",
"bool",
"user_defined",
")",
"{",
"wmKeyConfig",
"*",
"keyconf",
"=",
"BLI_findstring",
"(",
"&",
"wm",
"->",
"keyconfigs",
",",
"idname",
",",
"offsetof",
"(",
"wmKeyConfig",
",",
"idname",
")",
")",
";",
"if",
"(",
"keyconf",
")",
"{",
"if",
"(",
"keyconf",
"==",
"wm",
"->",
"defaultconf",
")",
"{",
"for",
"(",
"wmKeyMap",
"*",
"km",
"=",
"keyconf",
"->",
"keymaps",
".",
"first",
";",
"km",
";",
"km",
"=",
"km",
"->",
"next",
")",
"{",
"WM_keymap_clear",
"(",
"km",
")",
";",
"}",
"}",
"else",
"{",
"WM_keyconfig_clear",
"(",
"keyconf",
")",
";",
"}",
"return",
"keyconf",
";",
"}",
"keyconf",
"=",
"MEM_callocN",
"(",
"sizeof",
"(",
"wmKeyConfig",
")",
",",
"\"",
"\"",
")",
";",
"BLI_strncpy",
"(",
"keyconf",
"->",
"idname",
",",
"idname",
",",
"sizeof",
"(",
"keyconf",
"->",
"idname",
")",
")",
";",
"BLI_addtail",
"(",
"&",
"wm",
"->",
"keyconfigs",
",",
"keyconf",
")",
";",
"if",
"(",
"user_defined",
")",
"{",
"keyconf",
"->",
"flag",
"|=",
"KEYCONF_USER",
";",
"}",
"return",
"keyconf",
";",
"}"
] | \name Key Configuration | [
"\\",
"name",
"Key",
"Configuration"
] | [
"/* For default configuration, we need to keep keymap\n * modal items and poll functions intact. */",
"/* For user defined key configuration, clear all keymaps. */",
"/* Create new configuration. */"
] | [
{
"param": "wm",
"type": "wmWindowManager"
},
{
"param": "idname",
"type": "char"
},
{
"param": "user_defined",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "wm",
"type": "wmWindowManager",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "idname",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "user_defined",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e7a7bf96f11bcb5b2e789ee62474c7b954e307a | DemonRem/blender | source/blender/windowmanager/intern/wm_keymap.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | wm_keymap_new | wmKeyMap | static wmKeyMap *wm_keymap_new(const char *idname, int spaceid, int regionid)
{
wmKeyMap *km = MEM_callocN(sizeof(struct wmKeyMap), "keymap list");
BLI_strncpy(km->idname, idname, KMAP_MAX_NAME);
km->spaceid = spaceid;
km->regionid = regionid;
{
const char *owner_id = RNA_struct_state_owner_get();
if (owner_id) {
BLI_strncpy(km->owner_id, owner_id, sizeof(km->owner_id));
}
}
return km;
} | /* -------------------------------------------------------------------- */
/** \name Keymap
*
* List of keymap items for one editor, mode, modal operator.
* \{ */ | \name Keymap
List of keymap items for one editor, mode, modal operator. | [
"\\",
"name",
"Keymap",
"List",
"of",
"keymap",
"items",
"for",
"one",
"editor",
"mode",
"modal",
"operator",
"."
] | static wmKeyMap *wm_keymap_new(const char *idname, int spaceid, int regionid)
{
wmKeyMap *km = MEM_callocN(sizeof(struct wmKeyMap), "keymap list");
BLI_strncpy(km->idname, idname, KMAP_MAX_NAME);
km->spaceid = spaceid;
km->regionid = regionid;
{
const char *owner_id = RNA_struct_state_owner_get();
if (owner_id) {
BLI_strncpy(km->owner_id, owner_id, sizeof(km->owner_id));
}
}
return km;
} | [
"static",
"wmKeyMap",
"*",
"wm_keymap_new",
"(",
"const",
"char",
"*",
"idname",
",",
"int",
"spaceid",
",",
"int",
"regionid",
")",
"{",
"wmKeyMap",
"*",
"km",
"=",
"MEM_callocN",
"(",
"sizeof",
"(",
"struct",
"wmKeyMap",
")",
",",
"\"",
"\"",
")",
";",
"BLI_strncpy",
"(",
"km",
"->",
"idname",
",",
"idname",
",",
"KMAP_MAX_NAME",
")",
";",
"km",
"->",
"spaceid",
"=",
"spaceid",
";",
"km",
"->",
"regionid",
"=",
"regionid",
";",
"{",
"const",
"char",
"*",
"owner_id",
"=",
"RNA_struct_state_owner_get",
"(",
")",
";",
"if",
"(",
"owner_id",
")",
"{",
"BLI_strncpy",
"(",
"km",
"->",
"owner_id",
",",
"owner_id",
",",
"sizeof",
"(",
"km",
"->",
"owner_id",
")",
")",
";",
"}",
"}",
"return",
"km",
";",
"}"
] | \name Keymap | [
"\\",
"name",
"Keymap"
] | [] | [
{
"param": "idname",
"type": "char"
},
{
"param": "spaceid",
"type": "int"
},
{
"param": "regionid",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "idname",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "spaceid",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "regionid",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e7a7bf96f11bcb5b2e789ee62474c7b954e307a | DemonRem/blender | source/blender/windowmanager/intern/wm_keymap.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | WM_keymap_verify_item | wmKeyMapItem | wmKeyMapItem *WM_keymap_verify_item(
wmKeyMap *keymap, const char *idname, int type, int val, int modifier, int keymodifier)
{
wmKeyMapItem *kmi;
for (kmi = keymap->items.first; kmi; kmi = kmi->next) {
if (STREQLEN(kmi->idname, idname, OP_MAX_TYPENAME)) {
break;
}
}
if (kmi == NULL) {
kmi = MEM_callocN(sizeof(wmKeyMapItem), "keymap entry");
BLI_addtail(&keymap->items, kmi);
BLI_strncpy(kmi->idname, idname, OP_MAX_TYPENAME);
keymap_item_set_id(keymap, kmi);
keymap_event_set(kmi, type, val, modifier, keymodifier);
wm_keymap_item_properties_set(kmi);
}
return kmi;
} | /* if item was added, then bail out */ | if item was added, then bail out | [
"if",
"item",
"was",
"added",
"then",
"bail",
"out"
] | wmKeyMapItem *WM_keymap_verify_item(
wmKeyMap *keymap, const char *idname, int type, int val, int modifier, int keymodifier)
{
wmKeyMapItem *kmi;
for (kmi = keymap->items.first; kmi; kmi = kmi->next) {
if (STREQLEN(kmi->idname, idname, OP_MAX_TYPENAME)) {
break;
}
}
if (kmi == NULL) {
kmi = MEM_callocN(sizeof(wmKeyMapItem), "keymap entry");
BLI_addtail(&keymap->items, kmi);
BLI_strncpy(kmi->idname, idname, OP_MAX_TYPENAME);
keymap_item_set_id(keymap, kmi);
keymap_event_set(kmi, type, val, modifier, keymodifier);
wm_keymap_item_properties_set(kmi);
}
return kmi;
} | [
"wmKeyMapItem",
"*",
"WM_keymap_verify_item",
"(",
"wmKeyMap",
"*",
"keymap",
",",
"const",
"char",
"*",
"idname",
",",
"int",
"type",
",",
"int",
"val",
",",
"int",
"modifier",
",",
"int",
"keymodifier",
")",
"{",
"wmKeyMapItem",
"*",
"kmi",
";",
"for",
"(",
"kmi",
"=",
"keymap",
"->",
"items",
".",
"first",
";",
"kmi",
";",
"kmi",
"=",
"kmi",
"->",
"next",
")",
"{",
"if",
"(",
"STREQLEN",
"(",
"kmi",
"->",
"idname",
",",
"idname",
",",
"OP_MAX_TYPENAME",
")",
")",
"{",
"break",
";",
"}",
"}",
"if",
"(",
"kmi",
"==",
"NULL",
")",
"{",
"kmi",
"=",
"MEM_callocN",
"(",
"sizeof",
"(",
"wmKeyMapItem",
")",
",",
"\"",
"\"",
")",
";",
"BLI_addtail",
"(",
"&",
"keymap",
"->",
"items",
",",
"kmi",
")",
";",
"BLI_strncpy",
"(",
"kmi",
"->",
"idname",
",",
"idname",
",",
"OP_MAX_TYPENAME",
")",
";",
"keymap_item_set_id",
"(",
"keymap",
",",
"kmi",
")",
";",
"keymap_event_set",
"(",
"kmi",
",",
"type",
",",
"val",
",",
"modifier",
",",
"keymodifier",
")",
";",
"wm_keymap_item_properties_set",
"(",
"kmi",
")",
";",
"}",
"return",
"kmi",
";",
"}"
] | if item was added, then bail out | [
"if",
"item",
"was",
"added",
"then",
"bail",
"out"
] | [] | [
{
"param": "keymap",
"type": "wmKeyMap"
},
{
"param": "idname",
"type": "char"
},
{
"param": "type",
"type": "int"
},
{
"param": "val",
"type": "int"
},
{
"param": "modifier",
"type": "int"
},
{
"param": "keymodifier",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "keymap",
"type": "wmKeyMap",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "idname",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "val",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "modifier",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "keymodifier",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e7a7bf96f11bcb5b2e789ee62474c7b954e307a | DemonRem/blender | source/blender/windowmanager/intern/wm_keymap.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | wm_keymap_addon_add | void | static void wm_keymap_addon_add(wmKeyMap *keymap, wmKeyMap *addonmap)
{
wmKeyMapItem *kmi, *kmin;
for (kmi = addonmap->items.first; kmi; kmi = kmi->next) {
kmin = wm_keymap_item_copy(kmi);
keymap_item_set_id(keymap, kmin);
BLI_addhead(&keymap->items, kmin);
}
} | /* -------------------------------------------------------------------- */
/** \name Keymap Diff and Patch
*
* Rather than saving the entire keymap for user preferences, we only save a
* diff so that changes in the defaults get synced. This system is not perfect
* but works better than overriding the keymap entirely when only few items
* are changed.
* \{ */ | \name Keymap Diff and Patch
Rather than saving the entire keymap for user preferences, we only save a
diff so that changes in the defaults get synced. This system is not perfect
but works better than overriding the keymap entirely when only few items
are changed. | [
"\\",
"name",
"Keymap",
"Diff",
"and",
"Patch",
"Rather",
"than",
"saving",
"the",
"entire",
"keymap",
"for",
"user",
"preferences",
"we",
"only",
"save",
"a",
"diff",
"so",
"that",
"changes",
"in",
"the",
"defaults",
"get",
"synced",
".",
"This",
"system",
"is",
"not",
"perfect",
"but",
"works",
"better",
"than",
"overriding",
"the",
"keymap",
"entirely",
"when",
"only",
"few",
"items",
"are",
"changed",
"."
] | static void wm_keymap_addon_add(wmKeyMap *keymap, wmKeyMap *addonmap)
{
wmKeyMapItem *kmi, *kmin;
for (kmi = addonmap->items.first; kmi; kmi = kmi->next) {
kmin = wm_keymap_item_copy(kmi);
keymap_item_set_id(keymap, kmin);
BLI_addhead(&keymap->items, kmin);
}
} | [
"static",
"void",
"wm_keymap_addon_add",
"(",
"wmKeyMap",
"*",
"keymap",
",",
"wmKeyMap",
"*",
"addonmap",
")",
"{",
"wmKeyMapItem",
"*",
"kmi",
",",
"*",
"kmin",
";",
"for",
"(",
"kmi",
"=",
"addonmap",
"->",
"items",
".",
"first",
";",
"kmi",
";",
"kmi",
"=",
"kmi",
"->",
"next",
")",
"{",
"kmin",
"=",
"wm_keymap_item_copy",
"(",
"kmi",
")",
";",
"keymap_item_set_id",
"(",
"keymap",
",",
"kmin",
")",
";",
"BLI_addhead",
"(",
"&",
"keymap",
"->",
"items",
",",
"kmin",
")",
";",
"}",
"}"
] | \name Keymap Diff and Patch | [
"\\",
"name",
"Keymap",
"Diff",
"and",
"Patch"
] | [] | [
{
"param": "keymap",
"type": "wmKeyMap"
},
{
"param": "addonmap",
"type": "wmKeyMap"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "keymap",
"type": "wmKeyMap",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "addonmap",
"type": "wmKeyMap",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e7a7bf96f11bcb5b2e789ee62474c7b954e307a | DemonRem/blender | source/blender/windowmanager/intern/wm_keymap.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | WM_modalkeymap_add | wmKeyMap | wmKeyMap *WM_modalkeymap_add(wmKeyConfig *keyconf,
const char *idname,
const EnumPropertyItem *items)
{
wmKeyMap *km = WM_keymap_ensure(keyconf, idname, 0, 0);
km->flag |= KEYMAP_MODAL;
/* init modal items from default config */
wmWindowManager *wm = G_MAIN->wm.first;
if (wm->defaultconf && wm->defaultconf != keyconf) {
wmKeyMap *defaultkm = WM_keymap_list_find(&wm->defaultconf->keymaps, km->idname, 0, 0);
if (defaultkm) {
km->modal_items = defaultkm->modal_items;
km->poll = defaultkm->poll;
km->poll_modal_item = defaultkm->poll_modal_item;
}
}
if (items) {
km->modal_items = items;
}
return km;
} | /* -------------------------------------------------------------------- */
/** \name Modal Keymaps
*
* Modal key-maps get linked to a running operator,
* and filter the keys before sending to #wmOperatorType.modal callback.
* \{ */ | \name Modal Keymaps
Modal key-maps get linked to a running operator,
and filter the keys before sending to #wmOperatorType.modal callback. | [
"\\",
"name",
"Modal",
"Keymaps",
"Modal",
"key",
"-",
"maps",
"get",
"linked",
"to",
"a",
"running",
"operator",
"and",
"filter",
"the",
"keys",
"before",
"sending",
"to",
"#wmOperatorType",
".",
"modal",
"callback",
"."
] | wmKeyMap *WM_modalkeymap_add(wmKeyConfig *keyconf,
const char *idname,
const EnumPropertyItem *items)
{
wmKeyMap *km = WM_keymap_ensure(keyconf, idname, 0, 0);
km->flag |= KEYMAP_MODAL;
wmWindowManager *wm = G_MAIN->wm.first;
if (wm->defaultconf && wm->defaultconf != keyconf) {
wmKeyMap *defaultkm = WM_keymap_list_find(&wm->defaultconf->keymaps, km->idname, 0, 0);
if (defaultkm) {
km->modal_items = defaultkm->modal_items;
km->poll = defaultkm->poll;
km->poll_modal_item = defaultkm->poll_modal_item;
}
}
if (items) {
km->modal_items = items;
}
return km;
} | [
"wmKeyMap",
"*",
"WM_modalkeymap_add",
"(",
"wmKeyConfig",
"*",
"keyconf",
",",
"const",
"char",
"*",
"idname",
",",
"const",
"EnumPropertyItem",
"*",
"items",
")",
"{",
"wmKeyMap",
"*",
"km",
"=",
"WM_keymap_ensure",
"(",
"keyconf",
",",
"idname",
",",
"0",
",",
"0",
")",
";",
"km",
"->",
"flag",
"|=",
"KEYMAP_MODAL",
";",
"wmWindowManager",
"*",
"wm",
"=",
"G_MAIN",
"->",
"wm",
".",
"first",
";",
"if",
"(",
"wm",
"->",
"defaultconf",
"&&",
"wm",
"->",
"defaultconf",
"!=",
"keyconf",
")",
"{",
"wmKeyMap",
"*",
"defaultkm",
"=",
"WM_keymap_list_find",
"(",
"&",
"wm",
"->",
"defaultconf",
"->",
"keymaps",
",",
"km",
"->",
"idname",
",",
"0",
",",
"0",
")",
";",
"if",
"(",
"defaultkm",
")",
"{",
"km",
"->",
"modal_items",
"=",
"defaultkm",
"->",
"modal_items",
";",
"km",
"->",
"poll",
"=",
"defaultkm",
"->",
"poll",
";",
"km",
"->",
"poll_modal_item",
"=",
"defaultkm",
"->",
"poll_modal_item",
";",
"}",
"}",
"if",
"(",
"items",
")",
"{",
"km",
"->",
"modal_items",
"=",
"items",
";",
"}",
"return",
"km",
";",
"}"
] | \name Modal Keymaps | [
"\\",
"name",
"Modal",
"Keymaps"
] | [
"/* init modal items from default config */"
] | [
{
"param": "keyconf",
"type": "wmKeyConfig"
},
{
"param": "idname",
"type": "char"
},
{
"param": "items",
"type": "EnumPropertyItem"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "keyconf",
"type": "wmKeyConfig",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "idname",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "items",
"type": "EnumPropertyItem",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e7a7bf96f11bcb5b2e789ee62474c7b954e307a | DemonRem/blender | source/blender/windowmanager/intern/wm_keymap.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | WM_keymap_active | wmKeyMap | wmKeyMap *WM_keymap_active(wmWindowManager *wm, wmKeyMap *keymap)
{
wmKeyMap *km;
if (!keymap) {
return NULL;
}
/* first user defined keymaps */
km = WM_keymap_list_find(
&wm->userconf->keymaps, keymap->idname, keymap->spaceid, keymap->regionid);
if (km) {
return km;
}
return keymap;
} | /* -------------------------------------------------------------------- */
/** \name Event Handling
*
* Handlers have pointers to the keymap in the default configuration.
* During event handling this function is called to get the keymap from the final configuration.
* \{ */ | \name Event Handling
Handlers have pointers to the keymap in the default configuration.
During event handling this function is called to get the keymap from the final configuration. | [
"\\",
"name",
"Event",
"Handling",
"Handlers",
"have",
"pointers",
"to",
"the",
"keymap",
"in",
"the",
"default",
"configuration",
".",
"During",
"event",
"handling",
"this",
"function",
"is",
"called",
"to",
"get",
"the",
"keymap",
"from",
"the",
"final",
"configuration",
"."
] | wmKeyMap *WM_keymap_active(wmWindowManager *wm, wmKeyMap *keymap)
{
wmKeyMap *km;
if (!keymap) {
return NULL;
}
km = WM_keymap_list_find(
&wm->userconf->keymaps, keymap->idname, keymap->spaceid, keymap->regionid);
if (km) {
return km;
}
return keymap;
} | [
"wmKeyMap",
"*",
"WM_keymap_active",
"(",
"wmWindowManager",
"*",
"wm",
",",
"wmKeyMap",
"*",
"keymap",
")",
"{",
"wmKeyMap",
"*",
"km",
";",
"if",
"(",
"!",
"keymap",
")",
"{",
"return",
"NULL",
";",
"}",
"km",
"=",
"WM_keymap_list_find",
"(",
"&",
"wm",
"->",
"userconf",
"->",
"keymaps",
",",
"keymap",
"->",
"idname",
",",
"keymap",
"->",
"spaceid",
",",
"keymap",
"->",
"regionid",
")",
";",
"if",
"(",
"km",
")",
"{",
"return",
"km",
";",
"}",
"return",
"keymap",
";",
"}"
] | \name Event Handling | [
"\\",
"name",
"Event",
"Handling"
] | [
"/* first user defined keymaps */"
] | [
{
"param": "wm",
"type": "wmWindowManager"
},
{
"param": "keymap",
"type": "wmKeyMap"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "wm",
"type": "wmWindowManager",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "keymap",
"type": "wmKeyMap",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e7a7bf96f11bcb5b2e789ee62474c7b954e307a | DemonRem/blender | source/blender/windowmanager/intern/wm_keymap.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | WM_keymap_item_restore_to_default | void | void WM_keymap_item_restore_to_default(bContext *C, wmKeyMap *keymap, wmKeyMapItem *kmi)
{
wmWindowManager *wm = CTX_wm_manager(C);
wmKeyMap *defaultmap, *addonmap;
wmKeyMapItem *orig;
if (!keymap) {
return;
}
/* construct default keymap from preset + addons */
defaultmap = wm_keymap_preset(wm, keymap);
addonmap = WM_keymap_list_find(
&wm->addonconf->keymaps, keymap->idname, keymap->spaceid, keymap->regionid);
if (addonmap) {
defaultmap = wm_keymap_copy(defaultmap);
wm_keymap_addon_add(defaultmap, addonmap);
}
/* find original item */
orig = WM_keymap_item_find_id(defaultmap, kmi->id);
if (orig) {
/* restore to original */
if (!STREQ(orig->idname, kmi->idname)) {
BLI_strncpy(kmi->idname, orig->idname, sizeof(kmi->idname));
WM_keymap_item_properties_reset(kmi, NULL);
}
if (orig->properties) {
if (kmi->properties) {
IDP_FreeProperty(kmi->properties);
kmi->properties = NULL;
}
kmi->properties = IDP_CopyProperty(orig->properties);
kmi->ptr->data = kmi->properties;
}
kmi->propvalue = orig->propvalue;
kmi->type = orig->type;
kmi->val = orig->val;
kmi->shift = orig->shift;
kmi->ctrl = orig->ctrl;
kmi->alt = orig->alt;
kmi->oskey = orig->oskey;
kmi->keymodifier = orig->keymodifier;
kmi->maptype = orig->maptype;
WM_keyconfig_update_tag(keymap, kmi);
}
/* free temporary keymap */
if (addonmap) {
WM_keymap_clear(defaultmap);
MEM_freeN(defaultmap);
}
} | /* -------------------------------------------------------------------- */
/** \name Keymap Editor
*
* In the keymap editor the user key configuration is edited.
* \{ */ | \name Keymap Editor
In the keymap editor the user key configuration is edited. | [
"\\",
"name",
"Keymap",
"Editor",
"In",
"the",
"keymap",
"editor",
"the",
"user",
"key",
"configuration",
"is",
"edited",
"."
] | void WM_keymap_item_restore_to_default(bContext *C, wmKeyMap *keymap, wmKeyMapItem *kmi)
{
wmWindowManager *wm = CTX_wm_manager(C);
wmKeyMap *defaultmap, *addonmap;
wmKeyMapItem *orig;
if (!keymap) {
return;
}
defaultmap = wm_keymap_preset(wm, keymap);
addonmap = WM_keymap_list_find(
&wm->addonconf->keymaps, keymap->idname, keymap->spaceid, keymap->regionid);
if (addonmap) {
defaultmap = wm_keymap_copy(defaultmap);
wm_keymap_addon_add(defaultmap, addonmap);
}
orig = WM_keymap_item_find_id(defaultmap, kmi->id);
if (orig) {
if (!STREQ(orig->idname, kmi->idname)) {
BLI_strncpy(kmi->idname, orig->idname, sizeof(kmi->idname));
WM_keymap_item_properties_reset(kmi, NULL);
}
if (orig->properties) {
if (kmi->properties) {
IDP_FreeProperty(kmi->properties);
kmi->properties = NULL;
}
kmi->properties = IDP_CopyProperty(orig->properties);
kmi->ptr->data = kmi->properties;
}
kmi->propvalue = orig->propvalue;
kmi->type = orig->type;
kmi->val = orig->val;
kmi->shift = orig->shift;
kmi->ctrl = orig->ctrl;
kmi->alt = orig->alt;
kmi->oskey = orig->oskey;
kmi->keymodifier = orig->keymodifier;
kmi->maptype = orig->maptype;
WM_keyconfig_update_tag(keymap, kmi);
}
if (addonmap) {
WM_keymap_clear(defaultmap);
MEM_freeN(defaultmap);
}
} | [
"void",
"WM_keymap_item_restore_to_default",
"(",
"bContext",
"*",
"C",
",",
"wmKeyMap",
"*",
"keymap",
",",
"wmKeyMapItem",
"*",
"kmi",
")",
"{",
"wmWindowManager",
"*",
"wm",
"=",
"CTX_wm_manager",
"(",
"C",
")",
";",
"wmKeyMap",
"*",
"defaultmap",
",",
"*",
"addonmap",
";",
"wmKeyMapItem",
"*",
"orig",
";",
"if",
"(",
"!",
"keymap",
")",
"{",
"return",
";",
"}",
"defaultmap",
"=",
"wm_keymap_preset",
"(",
"wm",
",",
"keymap",
")",
";",
"addonmap",
"=",
"WM_keymap_list_find",
"(",
"&",
"wm",
"->",
"addonconf",
"->",
"keymaps",
",",
"keymap",
"->",
"idname",
",",
"keymap",
"->",
"spaceid",
",",
"keymap",
"->",
"regionid",
")",
";",
"if",
"(",
"addonmap",
")",
"{",
"defaultmap",
"=",
"wm_keymap_copy",
"(",
"defaultmap",
")",
";",
"wm_keymap_addon_add",
"(",
"defaultmap",
",",
"addonmap",
")",
";",
"}",
"orig",
"=",
"WM_keymap_item_find_id",
"(",
"defaultmap",
",",
"kmi",
"->",
"id",
")",
";",
"if",
"(",
"orig",
")",
"{",
"if",
"(",
"!",
"STREQ",
"(",
"orig",
"->",
"idname",
",",
"kmi",
"->",
"idname",
")",
")",
"{",
"BLI_strncpy",
"(",
"kmi",
"->",
"idname",
",",
"orig",
"->",
"idname",
",",
"sizeof",
"(",
"kmi",
"->",
"idname",
")",
")",
";",
"WM_keymap_item_properties_reset",
"(",
"kmi",
",",
"NULL",
")",
";",
"}",
"if",
"(",
"orig",
"->",
"properties",
")",
"{",
"if",
"(",
"kmi",
"->",
"properties",
")",
"{",
"IDP_FreeProperty",
"(",
"kmi",
"->",
"properties",
")",
";",
"kmi",
"->",
"properties",
"=",
"NULL",
";",
"}",
"kmi",
"->",
"properties",
"=",
"IDP_CopyProperty",
"(",
"orig",
"->",
"properties",
")",
";",
"kmi",
"->",
"ptr",
"->",
"data",
"=",
"kmi",
"->",
"properties",
";",
"}",
"kmi",
"->",
"propvalue",
"=",
"orig",
"->",
"propvalue",
";",
"kmi",
"->",
"type",
"=",
"orig",
"->",
"type",
";",
"kmi",
"->",
"val",
"=",
"orig",
"->",
"val",
";",
"kmi",
"->",
"shift",
"=",
"orig",
"->",
"shift",
";",
"kmi",
"->",
"ctrl",
"=",
"orig",
"->",
"ctrl",
";",
"kmi",
"->",
"alt",
"=",
"orig",
"->",
"alt",
";",
"kmi",
"->",
"oskey",
"=",
"orig",
"->",
"oskey",
";",
"kmi",
"->",
"keymodifier",
"=",
"orig",
"->",
"keymodifier",
";",
"kmi",
"->",
"maptype",
"=",
"orig",
"->",
"maptype",
";",
"WM_keyconfig_update_tag",
"(",
"keymap",
",",
"kmi",
")",
";",
"}",
"if",
"(",
"addonmap",
")",
"{",
"WM_keymap_clear",
"(",
"defaultmap",
")",
";",
"MEM_freeN",
"(",
"defaultmap",
")",
";",
"}",
"}"
] | \name Keymap Editor | [
"\\",
"name",
"Keymap",
"Editor"
] | [
"/* construct default keymap from preset + addons */",
"/* find original item */",
"/* restore to original */",
"/* free temporary keymap */"
] | [
{
"param": "C",
"type": "bContext"
},
{
"param": "keymap",
"type": "wmKeyMap"
},
{
"param": "kmi",
"type": "wmKeyMapItem"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "keymap",
"type": "wmKeyMap",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "kmi",
"type": "wmKeyMapItem",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e4a8831518fabb4bcf2f5efe396e621a680ccc4 | DemonRem/blender | source/blender/blenkernel/intern/multires_reshape.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | multires_reshape_corner_coord_to_ptex | void | static void multires_reshape_corner_coord_to_ptex(const MPoly *coarse_poly,
const int corner,
const float corner_u,
const float corner_v,
float *r_ptex_face_u,
float *r_ptex_face_v)
{
if (coarse_poly->totloop == 4) {
float grid_u, grid_v;
BKE_subdiv_ptex_face_uv_to_grid_uv(corner_u, corner_v, &grid_u, &grid_v);
BKE_subdiv_rotate_grid_to_quad(corner, grid_u, grid_v, r_ptex_face_u, r_ptex_face_v);
}
else {
*r_ptex_face_u = corner_u;
*r_ptex_face_v = corner_v;
}
} | /* Convert normalized coordinate within a grid to a normalized coordinate within
* a ptex face. */ | Convert normalized coordinate within a grid to a normalized coordinate within
a ptex face. | [
"Convert",
"normalized",
"coordinate",
"within",
"a",
"grid",
"to",
"a",
"normalized",
"coordinate",
"within",
"a",
"ptex",
"face",
"."
] | static void multires_reshape_corner_coord_to_ptex(const MPoly *coarse_poly,
const int corner,
const float corner_u,
const float corner_v,
float *r_ptex_face_u,
float *r_ptex_face_v)
{
if (coarse_poly->totloop == 4) {
float grid_u, grid_v;
BKE_subdiv_ptex_face_uv_to_grid_uv(corner_u, corner_v, &grid_u, &grid_v);
BKE_subdiv_rotate_grid_to_quad(corner, grid_u, grid_v, r_ptex_face_u, r_ptex_face_v);
}
else {
*r_ptex_face_u = corner_u;
*r_ptex_face_v = corner_v;
}
} | [
"static",
"void",
"multires_reshape_corner_coord_to_ptex",
"(",
"const",
"MPoly",
"*",
"coarse_poly",
",",
"const",
"int",
"corner",
",",
"const",
"float",
"corner_u",
",",
"const",
"float",
"corner_v",
",",
"float",
"*",
"r_ptex_face_u",
",",
"float",
"*",
"r_ptex_face_v",
")",
"{",
"if",
"(",
"coarse_poly",
"->",
"totloop",
"==",
"4",
")",
"{",
"float",
"grid_u",
",",
"grid_v",
";",
"BKE_subdiv_ptex_face_uv_to_grid_uv",
"(",
"corner_u",
",",
"corner_v",
",",
"&",
"grid_u",
",",
"&",
"grid_v",
")",
";",
"BKE_subdiv_rotate_grid_to_quad",
"(",
"corner",
",",
"grid_u",
",",
"grid_v",
",",
"r_ptex_face_u",
",",
"r_ptex_face_v",
")",
";",
"}",
"else",
"{",
"*",
"r_ptex_face_u",
"=",
"corner_u",
";",
"*",
"r_ptex_face_v",
"=",
"corner_v",
";",
"}",
"}"
] | Convert normalized coordinate within a grid to a normalized coordinate within
a ptex face. | [
"Convert",
"normalized",
"coordinate",
"within",
"a",
"grid",
"to",
"a",
"normalized",
"coordinate",
"within",
"a",
"ptex",
"face",
"."
] | [] | [
{
"param": "coarse_poly",
"type": "MPoly"
},
{
"param": "corner",
"type": "int"
},
{
"param": "corner_u",
"type": "float"
},
{
"param": "corner_v",
"type": "float"
},
{
"param": "r_ptex_face_u",
"type": "float"
},
{
"param": "r_ptex_face_v",
"type": "float"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "coarse_poly",
"type": "MPoly",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "corner",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "corner_u",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "corner_v",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "r_ptex_face_u",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "r_ptex_face_v",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e4a8831518fabb4bcf2f5efe396e621a680ccc4 | DemonRem/blender | source/blender/blenkernel/intern/multires_reshape.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | multires_reshape_sample_surface | void | static void multires_reshape_sample_surface(Subdiv *subdiv,
const MPoly *coarse_poly,
const int corner,
const float corner_u,
const float corner_v,
const int ptex_face_index,
float r_P[3],
float r_dPdu[3],
float r_dPdv[3])
{
float ptex_face_u, ptex_face_v;
multires_reshape_corner_coord_to_ptex(
coarse_poly, corner, corner_u, corner_v, &ptex_face_u, &ptex_face_v);
BKE_subdiv_eval_limit_point_and_derivatives(
subdiv, ptex_face_index, ptex_face_u, ptex_face_v, r_P, r_dPdu, r_dPdv);
} | /* NOTE: The tangent vectors are measured in ptex face normalized coordinates,
* which is different from grid tangent. */ | The tangent vectors are measured in ptex face normalized coordinates,
which is different from grid tangent. | [
"The",
"tangent",
"vectors",
"are",
"measured",
"in",
"ptex",
"face",
"normalized",
"coordinates",
"which",
"is",
"different",
"from",
"grid",
"tangent",
"."
] | static void multires_reshape_sample_surface(Subdiv *subdiv,
const MPoly *coarse_poly,
const int corner,
const float corner_u,
const float corner_v,
const int ptex_face_index,
float r_P[3],
float r_dPdu[3],
float r_dPdv[3])
{
float ptex_face_u, ptex_face_v;
multires_reshape_corner_coord_to_ptex(
coarse_poly, corner, corner_u, corner_v, &ptex_face_u, &ptex_face_v);
BKE_subdiv_eval_limit_point_and_derivatives(
subdiv, ptex_face_index, ptex_face_u, ptex_face_v, r_P, r_dPdu, r_dPdv);
} | [
"static",
"void",
"multires_reshape_sample_surface",
"(",
"Subdiv",
"*",
"subdiv",
",",
"const",
"MPoly",
"*",
"coarse_poly",
",",
"const",
"int",
"corner",
",",
"const",
"float",
"corner_u",
",",
"const",
"float",
"corner_v",
",",
"const",
"int",
"ptex_face_index",
",",
"float",
"r_P",
"[",
"3",
"]",
",",
"float",
"r_dPdu",
"[",
"3",
"]",
",",
"float",
"r_dPdv",
"[",
"3",
"]",
")",
"{",
"float",
"ptex_face_u",
",",
"ptex_face_v",
";",
"multires_reshape_corner_coord_to_ptex",
"(",
"coarse_poly",
",",
"corner",
",",
"corner_u",
",",
"corner_v",
",",
"&",
"ptex_face_u",
",",
"&",
"ptex_face_v",
")",
";",
"BKE_subdiv_eval_limit_point_and_derivatives",
"(",
"subdiv",
",",
"ptex_face_index",
",",
"ptex_face_u",
",",
"ptex_face_v",
",",
"r_P",
",",
"r_dPdu",
",",
"r_dPdv",
")",
";",
"}"
] | NOTE: The tangent vectors are measured in ptex face normalized coordinates,
which is different from grid tangent. | [
"NOTE",
":",
"The",
"tangent",
"vectors",
"are",
"measured",
"in",
"ptex",
"face",
"normalized",
"coordinates",
"which",
"is",
"different",
"from",
"grid",
"tangent",
"."
] | [] | [
{
"param": "subdiv",
"type": "Subdiv"
},
{
"param": "coarse_poly",
"type": "MPoly"
},
{
"param": "corner",
"type": "int"
},
{
"param": "corner_u",
"type": "float"
},
{
"param": "corner_v",
"type": "float"
},
{
"param": "ptex_face_index",
"type": "int"
},
{
"param": "r_P",
"type": "float"
},
{
"param": "r_dPdu",
"type": "float"
},
{
"param": "r_dPdv",
"type": "float"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "subdiv",
"type": "Subdiv",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "coarse_poly",
"type": "MPoly",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "corner",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "corner_u",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "corner_v",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ptex_face_index",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "r_P",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "r_dPdu",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "r_dPdv",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e4a8831518fabb4bcf2f5efe396e621a680ccc4 | DemonRem/blender | source/blender/blenkernel/intern/multires_reshape.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | multires_reshape_init_key_layers | void | static void multires_reshape_init_key_layers(CCGKey *key, const MultiresPropagateData *data)
{
key->elem_size = 3 * sizeof(float);
if (data->grid_paint_mask != NULL) {
key->mask_offset = 3 * sizeof(float);
key->elem_size += sizeof(float);
key->has_mask = true;
}
else {
key->mask_offset = -1;
key->has_mask = false;
}
/* We never have normals in original grids. */
key->normal_offset = -1;
key->has_normals = false;
} | /* Initialize element sizes and offsets. */ | Initialize element sizes and offsets. | [
"Initialize",
"element",
"sizes",
"and",
"offsets",
"."
] | static void multires_reshape_init_key_layers(CCGKey *key, const MultiresPropagateData *data)
{
key->elem_size = 3 * sizeof(float);
if (data->grid_paint_mask != NULL) {
key->mask_offset = 3 * sizeof(float);
key->elem_size += sizeof(float);
key->has_mask = true;
}
else {
key->mask_offset = -1;
key->has_mask = false;
}
key->normal_offset = -1;
key->has_normals = false;
} | [
"static",
"void",
"multires_reshape_init_key_layers",
"(",
"CCGKey",
"*",
"key",
",",
"const",
"MultiresPropagateData",
"*",
"data",
")",
"{",
"key",
"->",
"elem_size",
"=",
"3",
"*",
"sizeof",
"(",
"float",
")",
";",
"if",
"(",
"data",
"->",
"grid_paint_mask",
"!=",
"NULL",
")",
"{",
"key",
"->",
"mask_offset",
"=",
"3",
"*",
"sizeof",
"(",
"float",
")",
";",
"key",
"->",
"elem_size",
"+=",
"sizeof",
"(",
"float",
")",
";",
"key",
"->",
"has_mask",
"=",
"true",
";",
"}",
"else",
"{",
"key",
"->",
"mask_offset",
"=",
"-1",
";",
"key",
"->",
"has_mask",
"=",
"false",
";",
"}",
"key",
"->",
"normal_offset",
"=",
"-1",
";",
"key",
"->",
"has_normals",
"=",
"false",
";",
"}"
] | Initialize element sizes and offsets. | [
"Initialize",
"element",
"sizes",
"and",
"offsets",
"."
] | [
"/* We never have normals in original grids. */"
] | [
{
"param": "key",
"type": "CCGKey"
},
{
"param": "data",
"type": "MultiresPropagateData"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "key",
"type": "CCGKey",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "MultiresPropagateData",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e4a8831518fabb4bcf2f5efe396e621a680ccc4 | DemonRem/blender | source/blender/blenkernel/intern/multires_reshape.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | multires_reshape_init_level_key | void | static void multires_reshape_init_level_key(CCGKey *key,
const MultiresPropagateData *data,
const int level)
{
key->level = level;
/* Init layers. */
multires_reshape_init_key_layers(key, data);
/* By default, only 3 floats for coordinate, */
key->grid_size = BKE_subdiv_grid_size_from_level(key->level);
key->grid_area = key->grid_size * key->grid_size;
key->grid_bytes = key->elem_size * key->grid_area;
} | /* Initialize key used to access reshape grids at given level. */ | Initialize key used to access reshape grids at given level. | [
"Initialize",
"key",
"used",
"to",
"access",
"reshape",
"grids",
"at",
"given",
"level",
"."
] | static void multires_reshape_init_level_key(CCGKey *key,
const MultiresPropagateData *data,
const int level)
{
key->level = level;
multires_reshape_init_key_layers(key, data);
key->grid_size = BKE_subdiv_grid_size_from_level(key->level);
key->grid_area = key->grid_size * key->grid_size;
key->grid_bytes = key->elem_size * key->grid_area;
} | [
"static",
"void",
"multires_reshape_init_level_key",
"(",
"CCGKey",
"*",
"key",
",",
"const",
"MultiresPropagateData",
"*",
"data",
",",
"const",
"int",
"level",
")",
"{",
"key",
"->",
"level",
"=",
"level",
";",
"multires_reshape_init_key_layers",
"(",
"key",
",",
"data",
")",
";",
"key",
"->",
"grid_size",
"=",
"BKE_subdiv_grid_size_from_level",
"(",
"key",
"->",
"level",
")",
";",
"key",
"->",
"grid_area",
"=",
"key",
"->",
"grid_size",
"*",
"key",
"->",
"grid_size",
";",
"key",
"->",
"grid_bytes",
"=",
"key",
"->",
"elem_size",
"*",
"key",
"->",
"grid_area",
";",
"}"
] | Initialize key used to access reshape grids at given level. | [
"Initialize",
"key",
"used",
"to",
"access",
"reshape",
"grids",
"at",
"given",
"level",
"."
] | [
"/* Init layers. */",
"/* By default, only 3 floats for coordinate, */"
] | [
{
"param": "key",
"type": "CCGKey"
},
{
"param": "data",
"type": "MultiresPropagateData"
},
{
"param": "level",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "key",
"type": "CCGKey",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "MultiresPropagateData",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "level",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e4a8831518fabb4bcf2f5efe396e621a680ccc4 | DemonRem/blender | source/blender/blenkernel/intern/multires_reshape.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | multires_reshape_calculate_delta | void | static void multires_reshape_calculate_delta(MultiresPropagateData *data,
CCGElem **delta_grids_data)
{
const int num_grids = data->num_grids;
/* At this point those custom data layers has updated data for the
* level we are propagating from. */
const MDisps *mdisps = data->mdisps;
const GridPaintMask *grid_paint_mask = data->grid_paint_mask;
CCGKey *reshape_key = &data->reshape_level_key;
CCGKey *delta_level_key = &data->top_level_key;
/* Calculate delta. */
const int top_grid_size = data->top_grid_size;
const int reshape_grid_size = data->reshape_grid_size;
const int delta_grid_size = data->top_grid_size;
const int skip = (top_grid_size - 1) / (reshape_grid_size - 1);
for (int grid_index = 0; grid_index < num_grids; grid_index++) {
/*const*/ CCGElem *orig_grid = data->orig_grids_data[grid_index];
CCGElem *delta_grid = delta_grids_data[grid_index];
for (int y = 0; y < reshape_grid_size; y++) {
const int top_y = y * skip;
for (int x = 0; x < reshape_grid_size; x++) {
const int top_x = x * skip;
const int top_index = top_y * delta_grid_size + top_x;
sub_v3_v3v3(CCG_grid_elem_co(delta_level_key, delta_grid, top_x, top_y),
mdisps[grid_index].disps[top_index],
CCG_grid_elem_co(reshape_key, orig_grid, x, y));
if (delta_level_key->has_mask) {
const float old_mask_value = *CCG_grid_elem_mask(reshape_key, orig_grid, x, y);
const float new_mask_value = grid_paint_mask[grid_index].data[top_index];
*CCG_grid_elem_mask(delta_level_key, delta_grid, top_x, top_y) = new_mask_value -
old_mask_value;
}
}
}
}
} | /* Calculate delta of changed reshape level data layers. Delta goes to a
* grids at top level (meaning, the result grids are only partially filled
* in). */ | Calculate delta of changed reshape level data layers. Delta goes to a
grids at top level (meaning, the result grids are only partially filled
in). | [
"Calculate",
"delta",
"of",
"changed",
"reshape",
"level",
"data",
"layers",
".",
"Delta",
"goes",
"to",
"a",
"grids",
"at",
"top",
"level",
"(",
"meaning",
"the",
"result",
"grids",
"are",
"only",
"partially",
"filled",
"in",
")",
"."
] | static void multires_reshape_calculate_delta(MultiresPropagateData *data,
CCGElem **delta_grids_data)
{
const int num_grids = data->num_grids;
const MDisps *mdisps = data->mdisps;
const GridPaintMask *grid_paint_mask = data->grid_paint_mask;
CCGKey *reshape_key = &data->reshape_level_key;
CCGKey *delta_level_key = &data->top_level_key;
const int top_grid_size = data->top_grid_size;
const int reshape_grid_size = data->reshape_grid_size;
const int delta_grid_size = data->top_grid_size;
const int skip = (top_grid_size - 1) / (reshape_grid_size - 1);
for (int grid_index = 0; grid_index < num_grids; grid_index++) {
CCGElem *orig_grid = data->orig_grids_data[grid_index];
CCGElem *delta_grid = delta_grids_data[grid_index];
for (int y = 0; y < reshape_grid_size; y++) {
const int top_y = y * skip;
for (int x = 0; x < reshape_grid_size; x++) {
const int top_x = x * skip;
const int top_index = top_y * delta_grid_size + top_x;
sub_v3_v3v3(CCG_grid_elem_co(delta_level_key, delta_grid, top_x, top_y),
mdisps[grid_index].disps[top_index],
CCG_grid_elem_co(reshape_key, orig_grid, x, y));
if (delta_level_key->has_mask) {
const float old_mask_value = *CCG_grid_elem_mask(reshape_key, orig_grid, x, y);
const float new_mask_value = grid_paint_mask[grid_index].data[top_index];
*CCG_grid_elem_mask(delta_level_key, delta_grid, top_x, top_y) = new_mask_value -
old_mask_value;
}
}
}
}
} | [
"static",
"void",
"multires_reshape_calculate_delta",
"(",
"MultiresPropagateData",
"*",
"data",
",",
"CCGElem",
"*",
"*",
"delta_grids_data",
")",
"{",
"const",
"int",
"num_grids",
"=",
"data",
"->",
"num_grids",
";",
"const",
"MDisps",
"*",
"mdisps",
"=",
"data",
"->",
"mdisps",
";",
"const",
"GridPaintMask",
"*",
"grid_paint_mask",
"=",
"data",
"->",
"grid_paint_mask",
";",
"CCGKey",
"*",
"reshape_key",
"=",
"&",
"data",
"->",
"reshape_level_key",
";",
"CCGKey",
"*",
"delta_level_key",
"=",
"&",
"data",
"->",
"top_level_key",
";",
"const",
"int",
"top_grid_size",
"=",
"data",
"->",
"top_grid_size",
";",
"const",
"int",
"reshape_grid_size",
"=",
"data",
"->",
"reshape_grid_size",
";",
"const",
"int",
"delta_grid_size",
"=",
"data",
"->",
"top_grid_size",
";",
"const",
"int",
"skip",
"=",
"(",
"top_grid_size",
"-",
"1",
")",
"/",
"(",
"reshape_grid_size",
"-",
"1",
")",
";",
"for",
"(",
"int",
"grid_index",
"=",
"0",
";",
"grid_index",
"<",
"num_grids",
";",
"grid_index",
"++",
")",
"{",
"CCGElem",
"*",
"orig_grid",
"=",
"data",
"->",
"orig_grids_data",
"[",
"grid_index",
"]",
";",
"CCGElem",
"*",
"delta_grid",
"=",
"delta_grids_data",
"[",
"grid_index",
"]",
";",
"for",
"(",
"int",
"y",
"=",
"0",
";",
"y",
"<",
"reshape_grid_size",
";",
"y",
"++",
")",
"{",
"const",
"int",
"top_y",
"=",
"y",
"*",
"skip",
";",
"for",
"(",
"int",
"x",
"=",
"0",
";",
"x",
"<",
"reshape_grid_size",
";",
"x",
"++",
")",
"{",
"const",
"int",
"top_x",
"=",
"x",
"*",
"skip",
";",
"const",
"int",
"top_index",
"=",
"top_y",
"*",
"delta_grid_size",
"+",
"top_x",
";",
"sub_v3_v3v3",
"(",
"CCG_grid_elem_co",
"(",
"delta_level_key",
",",
"delta_grid",
",",
"top_x",
",",
"top_y",
")",
",",
"mdisps",
"[",
"grid_index",
"]",
".",
"disps",
"[",
"top_index",
"]",
",",
"CCG_grid_elem_co",
"(",
"reshape_key",
",",
"orig_grid",
",",
"x",
",",
"y",
")",
")",
";",
"if",
"(",
"delta_level_key",
"->",
"has_mask",
")",
"{",
"const",
"float",
"old_mask_value",
"=",
"*",
"CCG_grid_elem_mask",
"(",
"reshape_key",
",",
"orig_grid",
",",
"x",
",",
"y",
")",
";",
"const",
"float",
"new_mask_value",
"=",
"grid_paint_mask",
"[",
"grid_index",
"]",
".",
"data",
"[",
"top_index",
"]",
";",
"*",
"CCG_grid_elem_mask",
"(",
"delta_level_key",
",",
"delta_grid",
",",
"top_x",
",",
"top_y",
")",
"=",
"new_mask_value",
"-",
"old_mask_value",
";",
"}",
"}",
"}",
"}",
"}"
] | Calculate delta of changed reshape level data layers. | [
"Calculate",
"delta",
"of",
"changed",
"reshape",
"level",
"data",
"layers",
"."
] | [
"/* At this point those custom data layers has updated data for the\n * level we are propagating from. */",
"/* Calculate delta. */",
"/*const*/"
] | [
{
"param": "data",
"type": "MultiresPropagateData"
},
{
"param": "delta_grids_data",
"type": "CCGElem"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": "MultiresPropagateData",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "delta_grids_data",
"type": "CCGElem",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e4a8831518fabb4bcf2f5efe396e621a680ccc4 | DemonRem/blender | source/blender/blenkernel/intern/multires_reshape.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | multires_reshape_propagate_and_smooth_delta | void | static void multires_reshape_propagate_and_smooth_delta(MultiresPropagateData *data,
CCGElem **delta_grids_data)
{
const int num_grids = data->num_grids;
for (int grid_index = 0; grid_index < num_grids; grid_index++) {
CCGElem *delta_grid = delta_grids_data[grid_index];
multires_reshape_propagate_and_smooth_delta_grid(data, delta_grid);
}
} | /* Entry point to propagate+smooth. */ | Entry point to propagate+smooth. | [
"Entry",
"point",
"to",
"propagate",
"+",
"smooth",
"."
] | static void multires_reshape_propagate_and_smooth_delta(MultiresPropagateData *data,
CCGElem **delta_grids_data)
{
const int num_grids = data->num_grids;
for (int grid_index = 0; grid_index < num_grids; grid_index++) {
CCGElem *delta_grid = delta_grids_data[grid_index];
multires_reshape_propagate_and_smooth_delta_grid(data, delta_grid);
}
} | [
"static",
"void",
"multires_reshape_propagate_and_smooth_delta",
"(",
"MultiresPropagateData",
"*",
"data",
",",
"CCGElem",
"*",
"*",
"delta_grids_data",
")",
"{",
"const",
"int",
"num_grids",
"=",
"data",
"->",
"num_grids",
";",
"for",
"(",
"int",
"grid_index",
"=",
"0",
";",
"grid_index",
"<",
"num_grids",
";",
"grid_index",
"++",
")",
"{",
"CCGElem",
"*",
"delta_grid",
"=",
"delta_grids_data",
"[",
"grid_index",
"]",
";",
"multires_reshape_propagate_and_smooth_delta_grid",
"(",
"data",
",",
"delta_grid",
")",
";",
"}",
"}"
] | Entry point to propagate+smooth. | [
"Entry",
"point",
"to",
"propagate",
"+",
"smooth",
"."
] | [] | [
{
"param": "data",
"type": "MultiresPropagateData"
},
{
"param": "delta_grids_data",
"type": "CCGElem"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": "MultiresPropagateData",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "delta_grids_data",
"type": "CCGElem",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e4a8831518fabb4bcf2f5efe396e621a680ccc4 | DemonRem/blender | source/blender/blenkernel/intern/multires_reshape.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | multires_reshape_propagate_apply_delta | void | static void multires_reshape_propagate_apply_delta(MultiresPropagateData *data,
CCGElem **delta_grids_data)
{
const int num_grids = data->num_grids;
/* At this point those custom data layers has updated data for the
* level we are propagating from. */
MDisps *mdisps = data->mdisps;
GridPaintMask *grid_paint_mask = data->grid_paint_mask;
CCGKey *orig_key = &data->reshape_level_key;
CCGKey *delta_level_key = &data->top_level_key;
CCGElem **orig_grids_data = data->orig_grids_data;
const int orig_grid_size = data->reshape_grid_size;
const int top_grid_size = data->top_grid_size;
const int skip = (top_grid_size - 1) / (orig_grid_size - 1);
/* Restore grid values at the reshape level. Those values are to be changed
* to the accommodate for the smooth delta. */
for (int grid_index = 0; grid_index < num_grids; grid_index++) {
CCGElem *orig_grid = orig_grids_data[grid_index];
for (int y = 0; y < orig_grid_size; y++) {
const int top_y = y * skip;
for (int x = 0; x < orig_grid_size; x++) {
const int top_x = x * skip;
const int top_index = top_y * top_grid_size + top_x;
copy_v3_v3(mdisps[grid_index].disps[top_index],
CCG_grid_elem_co(orig_key, orig_grid, x, y));
if (grid_paint_mask != NULL) {
grid_paint_mask[grid_index].data[top_index] = *CCG_grid_elem_mask(
orig_key, orig_grid, x, y);
}
}
}
}
/* Add smoothed delta to all the levels. */
for (int grid_index = 0; grid_index < num_grids; grid_index++) {
CCGElem *delta_grid = delta_grids_data[grid_index];
for (int y = 0; y < top_grid_size; y++) {
for (int x = 0; x < top_grid_size; x++) {
const int top_index = y * top_grid_size + x;
add_v3_v3(mdisps[grid_index].disps[top_index],
CCG_grid_elem_co(delta_level_key, delta_grid, x, y));
if (delta_level_key->has_mask) {
grid_paint_mask[grid_index].data[top_index] += *CCG_grid_elem_mask(
delta_level_key, delta_grid, x, y);
}
}
}
}
} | /* Apply smoothed deltas on the actual data layers. */ | Apply smoothed deltas on the actual data layers. | [
"Apply",
"smoothed",
"deltas",
"on",
"the",
"actual",
"data",
"layers",
"."
] | static void multires_reshape_propagate_apply_delta(MultiresPropagateData *data,
CCGElem **delta_grids_data)
{
const int num_grids = data->num_grids;
MDisps *mdisps = data->mdisps;
GridPaintMask *grid_paint_mask = data->grid_paint_mask;
CCGKey *orig_key = &data->reshape_level_key;
CCGKey *delta_level_key = &data->top_level_key;
CCGElem **orig_grids_data = data->orig_grids_data;
const int orig_grid_size = data->reshape_grid_size;
const int top_grid_size = data->top_grid_size;
const int skip = (top_grid_size - 1) / (orig_grid_size - 1);
for (int grid_index = 0; grid_index < num_grids; grid_index++) {
CCGElem *orig_grid = orig_grids_data[grid_index];
for (int y = 0; y < orig_grid_size; y++) {
const int top_y = y * skip;
for (int x = 0; x < orig_grid_size; x++) {
const int top_x = x * skip;
const int top_index = top_y * top_grid_size + top_x;
copy_v3_v3(mdisps[grid_index].disps[top_index],
CCG_grid_elem_co(orig_key, orig_grid, x, y));
if (grid_paint_mask != NULL) {
grid_paint_mask[grid_index].data[top_index] = *CCG_grid_elem_mask(
orig_key, orig_grid, x, y);
}
}
}
}
for (int grid_index = 0; grid_index < num_grids; grid_index++) {
CCGElem *delta_grid = delta_grids_data[grid_index];
for (int y = 0; y < top_grid_size; y++) {
for (int x = 0; x < top_grid_size; x++) {
const int top_index = y * top_grid_size + x;
add_v3_v3(mdisps[grid_index].disps[top_index],
CCG_grid_elem_co(delta_level_key, delta_grid, x, y));
if (delta_level_key->has_mask) {
grid_paint_mask[grid_index].data[top_index] += *CCG_grid_elem_mask(
delta_level_key, delta_grid, x, y);
}
}
}
}
} | [
"static",
"void",
"multires_reshape_propagate_apply_delta",
"(",
"MultiresPropagateData",
"*",
"data",
",",
"CCGElem",
"*",
"*",
"delta_grids_data",
")",
"{",
"const",
"int",
"num_grids",
"=",
"data",
"->",
"num_grids",
";",
"MDisps",
"*",
"mdisps",
"=",
"data",
"->",
"mdisps",
";",
"GridPaintMask",
"*",
"grid_paint_mask",
"=",
"data",
"->",
"grid_paint_mask",
";",
"CCGKey",
"*",
"orig_key",
"=",
"&",
"data",
"->",
"reshape_level_key",
";",
"CCGKey",
"*",
"delta_level_key",
"=",
"&",
"data",
"->",
"top_level_key",
";",
"CCGElem",
"*",
"*",
"orig_grids_data",
"=",
"data",
"->",
"orig_grids_data",
";",
"const",
"int",
"orig_grid_size",
"=",
"data",
"->",
"reshape_grid_size",
";",
"const",
"int",
"top_grid_size",
"=",
"data",
"->",
"top_grid_size",
";",
"const",
"int",
"skip",
"=",
"(",
"top_grid_size",
"-",
"1",
")",
"/",
"(",
"orig_grid_size",
"-",
"1",
")",
";",
"for",
"(",
"int",
"grid_index",
"=",
"0",
";",
"grid_index",
"<",
"num_grids",
";",
"grid_index",
"++",
")",
"{",
"CCGElem",
"*",
"orig_grid",
"=",
"orig_grids_data",
"[",
"grid_index",
"]",
";",
"for",
"(",
"int",
"y",
"=",
"0",
";",
"y",
"<",
"orig_grid_size",
";",
"y",
"++",
")",
"{",
"const",
"int",
"top_y",
"=",
"y",
"*",
"skip",
";",
"for",
"(",
"int",
"x",
"=",
"0",
";",
"x",
"<",
"orig_grid_size",
";",
"x",
"++",
")",
"{",
"const",
"int",
"top_x",
"=",
"x",
"*",
"skip",
";",
"const",
"int",
"top_index",
"=",
"top_y",
"*",
"top_grid_size",
"+",
"top_x",
";",
"copy_v3_v3",
"(",
"mdisps",
"[",
"grid_index",
"]",
".",
"disps",
"[",
"top_index",
"]",
",",
"CCG_grid_elem_co",
"(",
"orig_key",
",",
"orig_grid",
",",
"x",
",",
"y",
")",
")",
";",
"if",
"(",
"grid_paint_mask",
"!=",
"NULL",
")",
"{",
"grid_paint_mask",
"[",
"grid_index",
"]",
".",
"data",
"[",
"top_index",
"]",
"=",
"*",
"CCG_grid_elem_mask",
"(",
"orig_key",
",",
"orig_grid",
",",
"x",
",",
"y",
")",
";",
"}",
"}",
"}",
"}",
"for",
"(",
"int",
"grid_index",
"=",
"0",
";",
"grid_index",
"<",
"num_grids",
";",
"grid_index",
"++",
")",
"{",
"CCGElem",
"*",
"delta_grid",
"=",
"delta_grids_data",
"[",
"grid_index",
"]",
";",
"for",
"(",
"int",
"y",
"=",
"0",
";",
"y",
"<",
"top_grid_size",
";",
"y",
"++",
")",
"{",
"for",
"(",
"int",
"x",
"=",
"0",
";",
"x",
"<",
"top_grid_size",
";",
"x",
"++",
")",
"{",
"const",
"int",
"top_index",
"=",
"y",
"*",
"top_grid_size",
"+",
"x",
";",
"add_v3_v3",
"(",
"mdisps",
"[",
"grid_index",
"]",
".",
"disps",
"[",
"top_index",
"]",
",",
"CCG_grid_elem_co",
"(",
"delta_level_key",
",",
"delta_grid",
",",
"x",
",",
"y",
")",
")",
";",
"if",
"(",
"delta_level_key",
"->",
"has_mask",
")",
"{",
"grid_paint_mask",
"[",
"grid_index",
"]",
".",
"data",
"[",
"top_index",
"]",
"+=",
"*",
"CCG_grid_elem_mask",
"(",
"delta_level_key",
",",
"delta_grid",
",",
"x",
",",
"y",
")",
";",
"}",
"}",
"}",
"}",
"}"
] | Apply smoothed deltas on the actual data layers. | [
"Apply",
"smoothed",
"deltas",
"on",
"the",
"actual",
"data",
"layers",
"."
] | [
"/* At this point those custom data layers has updated data for the\n * level we are propagating from. */",
"/* Restore grid values at the reshape level. Those values are to be changed\n * to the accommodate for the smooth delta. */",
"/* Add smoothed delta to all the levels. */"
] | [
{
"param": "data",
"type": "MultiresPropagateData"
},
{
"param": "delta_grids_data",
"type": "CCGElem"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": "MultiresPropagateData",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "delta_grids_data",
"type": "CCGElem",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e4a8831518fabb4bcf2f5efe396e621a680ccc4 | DemonRem/blender | source/blender/blenkernel/intern/multires_reshape.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | multires_reshape_neighour_boundary_vertices | void | static void multires_reshape_neighour_boundary_vertices(MultiresReshapeContext *ctx,
const int UNUSED(ptex_face_index),
const float corner_u,
const float corner_v,
const int coarse_poly_index,
const int coarse_corner,
const float final_P[3],
const float final_mask)
{
const Mesh *coarse_mesh = ctx->coarse_mesh;
const MPoly *coarse_mpoly = coarse_mesh->mpoly;
const MPoly *coarse_poly = &coarse_mpoly[coarse_poly_index];
const int num_corners = coarse_poly->totloop;
const int start_ptex_face_index = ctx->face_ptex_offset[coarse_poly_index];
const bool is_quad = (coarse_poly->totloop == 4);
if (corner_u == 1.0f && corner_v == 1.0f) {
for (int current_corner = 0; current_corner < num_corners; current_corner++) {
if (current_corner == coarse_corner) {
continue;
}
const int current_ptex_face_index = is_quad ? start_ptex_face_index :
start_ptex_face_index + current_corner;
multires_reshape_vertex_from_final_data(ctx,
current_ptex_face_index,
1.0f,
1.0f,
coarse_poly_index,
current_corner,
final_P,
final_mask);
}
}
else if (corner_u == 1.0f) {
const float next_corner_index = (coarse_corner + 1) % num_corners;
const float next_corner_u = corner_v;
const float next_corner_v = 1.0f;
const int next_ptex_face_index = is_quad ? start_ptex_face_index :
start_ptex_face_index + next_corner_index;
multires_reshape_vertex_from_final_data(ctx,
next_ptex_face_index,
next_corner_u,
next_corner_v,
coarse_poly_index,
next_corner_index,
final_P,
final_mask);
}
else if (corner_v == 1.0f) {
const float prev_corner_index = (coarse_corner + num_corners - 1) % num_corners;
const float prev_corner_u = 1.0f;
const float prev_corner_v = corner_u;
const int prev_ptex_face_index = is_quad ? start_ptex_face_index :
start_ptex_face_index + prev_corner_index;
multires_reshape_vertex_from_final_data(ctx,
prev_ptex_face_index,
prev_corner_u,
prev_corner_v,
coarse_poly_index,
prev_corner_index,
final_P,
final_mask);
}
} | /* Will run reshaping for all grid elements which are adjacent to the given
* one. This is the way to ensure continuity of displacement stored in the
* grids across the inner boundaries of the grids. */ | Will run reshaping for all grid elements which are adjacent to the given
one. This is the way to ensure continuity of displacement stored in the
grids across the inner boundaries of the grids. | [
"Will",
"run",
"reshaping",
"for",
"all",
"grid",
"elements",
"which",
"are",
"adjacent",
"to",
"the",
"given",
"one",
".",
"This",
"is",
"the",
"way",
"to",
"ensure",
"continuity",
"of",
"displacement",
"stored",
"in",
"the",
"grids",
"across",
"the",
"inner",
"boundaries",
"of",
"the",
"grids",
"."
] | static void multires_reshape_neighour_boundary_vertices(MultiresReshapeContext *ctx,
const int UNUSED(ptex_face_index),
const float corner_u,
const float corner_v,
const int coarse_poly_index,
const int coarse_corner,
const float final_P[3],
const float final_mask)
{
const Mesh *coarse_mesh = ctx->coarse_mesh;
const MPoly *coarse_mpoly = coarse_mesh->mpoly;
const MPoly *coarse_poly = &coarse_mpoly[coarse_poly_index];
const int num_corners = coarse_poly->totloop;
const int start_ptex_face_index = ctx->face_ptex_offset[coarse_poly_index];
const bool is_quad = (coarse_poly->totloop == 4);
if (corner_u == 1.0f && corner_v == 1.0f) {
for (int current_corner = 0; current_corner < num_corners; current_corner++) {
if (current_corner == coarse_corner) {
continue;
}
const int current_ptex_face_index = is_quad ? start_ptex_face_index :
start_ptex_face_index + current_corner;
multires_reshape_vertex_from_final_data(ctx,
current_ptex_face_index,
1.0f,
1.0f,
coarse_poly_index,
current_corner,
final_P,
final_mask);
}
}
else if (corner_u == 1.0f) {
const float next_corner_index = (coarse_corner + 1) % num_corners;
const float next_corner_u = corner_v;
const float next_corner_v = 1.0f;
const int next_ptex_face_index = is_quad ? start_ptex_face_index :
start_ptex_face_index + next_corner_index;
multires_reshape_vertex_from_final_data(ctx,
next_ptex_face_index,
next_corner_u,
next_corner_v,
coarse_poly_index,
next_corner_index,
final_P,
final_mask);
}
else if (corner_v == 1.0f) {
const float prev_corner_index = (coarse_corner + num_corners - 1) % num_corners;
const float prev_corner_u = 1.0f;
const float prev_corner_v = corner_u;
const int prev_ptex_face_index = is_quad ? start_ptex_face_index :
start_ptex_face_index + prev_corner_index;
multires_reshape_vertex_from_final_data(ctx,
prev_ptex_face_index,
prev_corner_u,
prev_corner_v,
coarse_poly_index,
prev_corner_index,
final_P,
final_mask);
}
} | [
"static",
"void",
"multires_reshape_neighour_boundary_vertices",
"(",
"MultiresReshapeContext",
"*",
"ctx",
",",
"const",
"int",
"UNUSED",
"(",
"ptex_face_index",
")",
",",
"const",
"float",
"corner_u",
",",
"const",
"float",
"corner_v",
",",
"const",
"int",
"coarse_poly_index",
",",
"const",
"int",
"coarse_corner",
",",
"const",
"float",
"final_P",
"[",
"3",
"]",
",",
"const",
"float",
"final_mask",
")",
"{",
"const",
"Mesh",
"*",
"coarse_mesh",
"=",
"ctx",
"->",
"coarse_mesh",
";",
"const",
"MPoly",
"*",
"coarse_mpoly",
"=",
"coarse_mesh",
"->",
"mpoly",
";",
"const",
"MPoly",
"*",
"coarse_poly",
"=",
"&",
"coarse_mpoly",
"[",
"coarse_poly_index",
"]",
";",
"const",
"int",
"num_corners",
"=",
"coarse_poly",
"->",
"totloop",
";",
"const",
"int",
"start_ptex_face_index",
"=",
"ctx",
"->",
"face_ptex_offset",
"[",
"coarse_poly_index",
"]",
";",
"const",
"bool",
"is_quad",
"=",
"(",
"coarse_poly",
"->",
"totloop",
"==",
"4",
")",
";",
"if",
"(",
"corner_u",
"==",
"1.0f",
"&&",
"corner_v",
"==",
"1.0f",
")",
"{",
"for",
"(",
"int",
"current_corner",
"=",
"0",
";",
"current_corner",
"<",
"num_corners",
";",
"current_corner",
"++",
")",
"{",
"if",
"(",
"current_corner",
"==",
"coarse_corner",
")",
"{",
"continue",
";",
"}",
"const",
"int",
"current_ptex_face_index",
"=",
"is_quad",
"?",
"start_ptex_face_index",
":",
"start_ptex_face_index",
"+",
"current_corner",
";",
"multires_reshape_vertex_from_final_data",
"(",
"ctx",
",",
"current_ptex_face_index",
",",
"1.0f",
",",
"1.0f",
",",
"coarse_poly_index",
",",
"current_corner",
",",
"final_P",
",",
"final_mask",
")",
";",
"}",
"}",
"else",
"if",
"(",
"corner_u",
"==",
"1.0f",
")",
"{",
"const",
"float",
"next_corner_index",
"=",
"(",
"coarse_corner",
"+",
"1",
")",
"%",
"num_corners",
";",
"const",
"float",
"next_corner_u",
"=",
"corner_v",
";",
"const",
"float",
"next_corner_v",
"=",
"1.0f",
";",
"const",
"int",
"next_ptex_face_index",
"=",
"is_quad",
"?",
"start_ptex_face_index",
":",
"start_ptex_face_index",
"+",
"next_corner_index",
";",
"multires_reshape_vertex_from_final_data",
"(",
"ctx",
",",
"next_ptex_face_index",
",",
"next_corner_u",
",",
"next_corner_v",
",",
"coarse_poly_index",
",",
"next_corner_index",
",",
"final_P",
",",
"final_mask",
")",
";",
"}",
"else",
"if",
"(",
"corner_v",
"==",
"1.0f",
")",
"{",
"const",
"float",
"prev_corner_index",
"=",
"(",
"coarse_corner",
"+",
"num_corners",
"-",
"1",
")",
"%",
"num_corners",
";",
"const",
"float",
"prev_corner_u",
"=",
"1.0f",
";",
"const",
"float",
"prev_corner_v",
"=",
"corner_u",
";",
"const",
"int",
"prev_ptex_face_index",
"=",
"is_quad",
"?",
"start_ptex_face_index",
":",
"start_ptex_face_index",
"+",
"prev_corner_index",
";",
"multires_reshape_vertex_from_final_data",
"(",
"ctx",
",",
"prev_ptex_face_index",
",",
"prev_corner_u",
",",
"prev_corner_v",
",",
"coarse_poly_index",
",",
"prev_corner_index",
",",
"final_P",
",",
"final_mask",
")",
";",
"}",
"}"
] | Will run reshaping for all grid elements which are adjacent to the given
one. | [
"Will",
"run",
"reshaping",
"for",
"all",
"grid",
"elements",
"which",
"are",
"adjacent",
"to",
"the",
"given",
"one",
"."
] | [] | [
{
"param": "ctx",
"type": "MultiresReshapeContext"
},
{
"param": "UNUSED",
"type": "int"
},
{
"param": "corner_u",
"type": "float"
},
{
"param": "corner_v",
"type": "float"
},
{
"param": "coarse_poly_index",
"type": "int"
},
{
"param": "coarse_corner",
"type": "int"
},
{
"param": "final_P",
"type": "float"
},
{
"param": "final_mask",
"type": "float"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ctx",
"type": "MultiresReshapeContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "UNUSED",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "corner_u",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "corner_v",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "coarse_poly_index",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "coarse_corner",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "final_P",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "final_mask",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e4a8831518fabb4bcf2f5efe396e621a680ccc4 | DemonRem/blender | source/blender/blenkernel/intern/multires_reshape.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | multiresModifier_reshapeFromObject | bool | bool multiresModifier_reshapeFromObject(struct Depsgraph *depsgraph,
MultiresModifierData *mmd,
Object *dst,
Object *src)
{
/* Would be cool to support this eventually, but it is very tricky to match
* vertices order even for meshes, when mixing meshes and other objects it's
* even more tricky. */
if (src->type != OB_MESH) {
return false;
}
MultiresModifierData reshape_mmd;
multires_reshape_init_mmd(&reshape_mmd, mmd);
/* Get evaluated vertices locations to reshape to. */
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
Object *src_eval = DEG_get_evaluated_object(depsgraph, src);
Mesh *src_mesh_eval = mesh_get_eval_final(depsgraph, scene_eval, src_eval, &CD_MASK_BAREMESH);
int num_deformed_verts;
float(*deformed_verts)[3] = BKE_mesh_vert_coords_alloc(src_mesh_eval, &num_deformed_verts);
bool result = multires_reshape_from_vertcos(
depsgraph, dst, &reshape_mmd, deformed_verts, num_deformed_verts, false);
MEM_freeN(deformed_verts);
return result;
} | /* Returns truth on success, false otherwise.
*
* This function might fail in cases like source and destination not having
* matched amount of vertices. */ | Returns truth on success, false otherwise.
This function might fail in cases like source and destination not having
matched amount of vertices. | [
"Returns",
"truth",
"on",
"success",
"false",
"otherwise",
".",
"This",
"function",
"might",
"fail",
"in",
"cases",
"like",
"source",
"and",
"destination",
"not",
"having",
"matched",
"amount",
"of",
"vertices",
"."
] | bool multiresModifier_reshapeFromObject(struct Depsgraph *depsgraph,
MultiresModifierData *mmd,
Object *dst,
Object *src)
{
if (src->type != OB_MESH) {
return false;
}
MultiresModifierData reshape_mmd;
multires_reshape_init_mmd(&reshape_mmd, mmd);
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
Object *src_eval = DEG_get_evaluated_object(depsgraph, src);
Mesh *src_mesh_eval = mesh_get_eval_final(depsgraph, scene_eval, src_eval, &CD_MASK_BAREMESH);
int num_deformed_verts;
float(*deformed_verts)[3] = BKE_mesh_vert_coords_alloc(src_mesh_eval, &num_deformed_verts);
bool result = multires_reshape_from_vertcos(
depsgraph, dst, &reshape_mmd, deformed_verts, num_deformed_verts, false);
MEM_freeN(deformed_verts);
return result;
} | [
"bool",
"multiresModifier_reshapeFromObject",
"(",
"struct",
"Depsgraph",
"*",
"depsgraph",
",",
"MultiresModifierData",
"*",
"mmd",
",",
"Object",
"*",
"dst",
",",
"Object",
"*",
"src",
")",
"{",
"if",
"(",
"src",
"->",
"type",
"!=",
"OB_MESH",
")",
"{",
"return",
"false",
";",
"}",
"MultiresModifierData",
"reshape_mmd",
";",
"multires_reshape_init_mmd",
"(",
"&",
"reshape_mmd",
",",
"mmd",
")",
";",
"Scene",
"*",
"scene_eval",
"=",
"DEG_get_evaluated_scene",
"(",
"depsgraph",
")",
";",
"Object",
"*",
"src_eval",
"=",
"DEG_get_evaluated_object",
"(",
"depsgraph",
",",
"src",
")",
";",
"Mesh",
"*",
"src_mesh_eval",
"=",
"mesh_get_eval_final",
"(",
"depsgraph",
",",
"scene_eval",
",",
"src_eval",
",",
"&",
"CD_MASK_BAREMESH",
")",
";",
"int",
"num_deformed_verts",
";",
"float",
"(",
"*",
"deformed_verts",
")",
"[",
"3",
"]",
"=",
"BKE_mesh_vert_coords_alloc",
"(",
"src_mesh_eval",
",",
"&",
"num_deformed_verts",
")",
";",
"bool",
"result",
"=",
"multires_reshape_from_vertcos",
"(",
"depsgraph",
",",
"dst",
",",
"&",
"reshape_mmd",
",",
"deformed_verts",
",",
"num_deformed_verts",
",",
"false",
")",
";",
"MEM_freeN",
"(",
"deformed_verts",
")",
";",
"return",
"result",
";",
"}"
] | Returns truth on success, false otherwise. | [
"Returns",
"truth",
"on",
"success",
"false",
"otherwise",
"."
] | [
"/* Would be cool to support this eventually, but it is very tricky to match\n * vertices order even for meshes, when mixing meshes and other objects it's\n * even more tricky. */",
"/* Get evaluated vertices locations to reshape to. */"
] | [
{
"param": "depsgraph",
"type": "struct Depsgraph"
},
{
"param": "mmd",
"type": "MultiresModifierData"
},
{
"param": "dst",
"type": "Object"
},
{
"param": "src",
"type": "Object"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "depsgraph",
"type": "struct Depsgraph",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mmd",
"type": "MultiresModifierData",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "Object",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "src",
"type": "Object",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
67ac5067134954cb950c17d32c84f7ebc8bd1f8e | DemonRem/blender | source/blender/editors/screen/workspace_layout_edit.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | ED_workspace_layout_delete | bool | bool ED_workspace_layout_delete(WorkSpace *workspace, WorkSpaceLayout *layout_old, bContext *C)
{
const bScreen *screen_old = BKE_workspace_layout_screen_get(layout_old);
WorkSpaceLayout *layout_new;
BLI_assert(BLI_findindex(BKE_workspace_layouts_get(workspace), layout_old) != -1);
/* don't allow deleting temp fullscreens for now */
if (BKE_screen_is_fullscreen_area(screen_old)) {
return false;
}
/* A layout/screen can only be in use by one window at a time, so as
* long as we are able to find a layout/screen that is unused, we
* can safely assume ours is not in use anywhere an delete it. */
layout_new = workspace_layout_delete_find_new(layout_old);
if (layout_new) {
return workspace_layout_delete_doit(workspace, layout_old, layout_new, C);
}
return false;
} | /**
* \warning Only call outside of area/region loops!
* \return true if succeeded.
*/ | \warning Only call outside of area/region loops.
\return true if succeeded. | [
"\\",
"warning",
"Only",
"call",
"outside",
"of",
"area",
"/",
"region",
"loops",
".",
"\\",
"return",
"true",
"if",
"succeeded",
"."
] | bool ED_workspace_layout_delete(WorkSpace *workspace, WorkSpaceLayout *layout_old, bContext *C)
{
const bScreen *screen_old = BKE_workspace_layout_screen_get(layout_old);
WorkSpaceLayout *layout_new;
BLI_assert(BLI_findindex(BKE_workspace_layouts_get(workspace), layout_old) != -1);
if (BKE_screen_is_fullscreen_area(screen_old)) {
return false;
}
layout_new = workspace_layout_delete_find_new(layout_old);
if (layout_new) {
return workspace_layout_delete_doit(workspace, layout_old, layout_new, C);
}
return false;
} | [
"bool",
"ED_workspace_layout_delete",
"(",
"WorkSpace",
"*",
"workspace",
",",
"WorkSpaceLayout",
"*",
"layout_old",
",",
"bContext",
"*",
"C",
")",
"{",
"const",
"bScreen",
"*",
"screen_old",
"=",
"BKE_workspace_layout_screen_get",
"(",
"layout_old",
")",
";",
"WorkSpaceLayout",
"*",
"layout_new",
";",
"BLI_assert",
"(",
"BLI_findindex",
"(",
"BKE_workspace_layouts_get",
"(",
"workspace",
")",
",",
"layout_old",
")",
"!=",
"-1",
")",
";",
"if",
"(",
"BKE_screen_is_fullscreen_area",
"(",
"screen_old",
")",
")",
"{",
"return",
"false",
";",
"}",
"layout_new",
"=",
"workspace_layout_delete_find_new",
"(",
"layout_old",
")",
";",
"if",
"(",
"layout_new",
")",
"{",
"return",
"workspace_layout_delete_doit",
"(",
"workspace",
",",
"layout_old",
",",
"layout_new",
",",
"C",
")",
";",
"}",
"return",
"false",
";",
"}"
] | \warning Only call outside of area/region loops! | [
"\\",
"warning",
"Only",
"call",
"outside",
"of",
"area",
"/",
"region",
"loops!"
] | [
"/* don't allow deleting temp fullscreens for now */",
"/* A layout/screen can only be in use by one window at a time, so as\n * long as we are able to find a layout/screen that is unused, we\n * can safely assume ours is not in use anywhere an delete it. */"
] | [
{
"param": "workspace",
"type": "WorkSpace"
},
{
"param": "layout_old",
"type": "WorkSpaceLayout"
},
{
"param": "C",
"type": "bContext"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "workspace",
"type": "WorkSpace",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "layout_old",
"type": "WorkSpaceLayout",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
10852ed6148307c9a347fe7c725b2b2aafeddf78 | DemonRem/blender | source/blender/modifiers/intern/MOD_normal_edit.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | mix_normals | void | static void mix_normals(const float mix_factor,
MDeformVert *dvert,
const int defgrp_index,
const bool use_invert_vgroup,
const float mix_limit,
const short mix_mode,
const int num_verts,
MLoop *mloop,
float (*nos_old)[3],
float (*nos_new)[3],
const int num_loops)
{
/* Mix with org normals... */
float *facs = NULL, *wfac;
float(*no_new)[3], (*no_old)[3];
int i;
if (dvert) {
facs = MEM_malloc_arrayN((size_t)num_loops, sizeof(*facs), __func__);
BKE_defvert_extract_vgroup_to_loopweights(
dvert, defgrp_index, num_verts, mloop, num_loops, facs, use_invert_vgroup);
}
for (i = num_loops, no_new = nos_new, no_old = nos_old, wfac = facs; i--;
no_new++, no_old++, wfac++) {
const float fac = facs ? *wfac * mix_factor : mix_factor;
switch (mix_mode) {
case MOD_NORMALEDIT_MIX_ADD:
add_v3_v3(*no_new, *no_old);
normalize_v3(*no_new);
break;
case MOD_NORMALEDIT_MIX_SUB:
sub_v3_v3(*no_new, *no_old);
normalize_v3(*no_new);
break;
case MOD_NORMALEDIT_MIX_MUL:
mul_v3_v3(*no_new, *no_old);
normalize_v3(*no_new);
break;
case MOD_NORMALEDIT_MIX_COPY:
break;
}
interp_v3_v3v3_slerp_safe(
*no_new,
*no_old,
*no_new,
(mix_limit < (float)M_PI) ? min_ff(fac, mix_limit / angle_v3v3(*no_new, *no_old)) : fac);
}
MEM_SAFE_FREE(facs);
} | /* Note this modifies nos_new in-place. */ | Note this modifies nos_new in-place. | [
"Note",
"this",
"modifies",
"nos_new",
"in",
"-",
"place",
"."
] | static void mix_normals(const float mix_factor,
MDeformVert *dvert,
const int defgrp_index,
const bool use_invert_vgroup,
const float mix_limit,
const short mix_mode,
const int num_verts,
MLoop *mloop,
float (*nos_old)[3],
float (*nos_new)[3],
const int num_loops)
{
float *facs = NULL, *wfac;
float(*no_new)[3], (*no_old)[3];
int i;
if (dvert) {
facs = MEM_malloc_arrayN((size_t)num_loops, sizeof(*facs), __func__);
BKE_defvert_extract_vgroup_to_loopweights(
dvert, defgrp_index, num_verts, mloop, num_loops, facs, use_invert_vgroup);
}
for (i = num_loops, no_new = nos_new, no_old = nos_old, wfac = facs; i--;
no_new++, no_old++, wfac++) {
const float fac = facs ? *wfac * mix_factor : mix_factor;
switch (mix_mode) {
case MOD_NORMALEDIT_MIX_ADD:
add_v3_v3(*no_new, *no_old);
normalize_v3(*no_new);
break;
case MOD_NORMALEDIT_MIX_SUB:
sub_v3_v3(*no_new, *no_old);
normalize_v3(*no_new);
break;
case MOD_NORMALEDIT_MIX_MUL:
mul_v3_v3(*no_new, *no_old);
normalize_v3(*no_new);
break;
case MOD_NORMALEDIT_MIX_COPY:
break;
}
interp_v3_v3v3_slerp_safe(
*no_new,
*no_old,
*no_new,
(mix_limit < (float)M_PI) ? min_ff(fac, mix_limit / angle_v3v3(*no_new, *no_old)) : fac);
}
MEM_SAFE_FREE(facs);
} | [
"static",
"void",
"mix_normals",
"(",
"const",
"float",
"mix_factor",
",",
"MDeformVert",
"*",
"dvert",
",",
"const",
"int",
"defgrp_index",
",",
"const",
"bool",
"use_invert_vgroup",
",",
"const",
"float",
"mix_limit",
",",
"const",
"short",
"mix_mode",
",",
"const",
"int",
"num_verts",
",",
"MLoop",
"*",
"mloop",
",",
"float",
"(",
"*",
"nos_old",
")",
"[",
"3",
"]",
",",
"float",
"(",
"*",
"nos_new",
")",
"[",
"3",
"]",
",",
"const",
"int",
"num_loops",
")",
"{",
"float",
"*",
"facs",
"=",
"NULL",
",",
"*",
"wfac",
";",
"float",
"(",
"*",
"no_new",
")",
"[",
"3",
"]",
",",
"(",
"*",
"no_old",
")",
"[",
"3",
"]",
";",
"int",
"i",
";",
"if",
"(",
"dvert",
")",
"{",
"facs",
"=",
"MEM_malloc_arrayN",
"(",
"(",
"size_t",
")",
"num_loops",
",",
"sizeof",
"(",
"*",
"facs",
")",
",",
"__func__",
")",
";",
"BKE_defvert_extract_vgroup_to_loopweights",
"(",
"dvert",
",",
"defgrp_index",
",",
"num_verts",
",",
"mloop",
",",
"num_loops",
",",
"facs",
",",
"use_invert_vgroup",
")",
";",
"}",
"for",
"(",
"i",
"=",
"num_loops",
",",
"no_new",
"=",
"nos_new",
",",
"no_old",
"=",
"nos_old",
",",
"wfac",
"=",
"facs",
";",
"i",
"--",
";",
"no_new",
"++",
",",
"no_old",
"++",
",",
"wfac",
"++",
")",
"{",
"const",
"float",
"fac",
"=",
"facs",
"?",
"*",
"wfac",
"*",
"mix_factor",
":",
"mix_factor",
";",
"switch",
"(",
"mix_mode",
")",
"{",
"case",
"MOD_NORMALEDIT_MIX_ADD",
":",
"add_v3_v3",
"(",
"*",
"no_new",
",",
"*",
"no_old",
")",
";",
"normalize_v3",
"(",
"*",
"no_new",
")",
";",
"break",
";",
"case",
"MOD_NORMALEDIT_MIX_SUB",
":",
"sub_v3_v3",
"(",
"*",
"no_new",
",",
"*",
"no_old",
")",
";",
"normalize_v3",
"(",
"*",
"no_new",
")",
";",
"break",
";",
"case",
"MOD_NORMALEDIT_MIX_MUL",
":",
"mul_v3_v3",
"(",
"*",
"no_new",
",",
"*",
"no_old",
")",
";",
"normalize_v3",
"(",
"*",
"no_new",
")",
";",
"break",
";",
"case",
"MOD_NORMALEDIT_MIX_COPY",
":",
"break",
";",
"}",
"interp_v3_v3v3_slerp_safe",
"(",
"*",
"no_new",
",",
"*",
"no_old",
",",
"*",
"no_new",
",",
"(",
"mix_limit",
"<",
"(",
"float",
")",
"M_PI",
")",
"?",
"min_ff",
"(",
"fac",
",",
"mix_limit",
"/",
"angle_v3v3",
"(",
"*",
"no_new",
",",
"*",
"no_old",
")",
")",
":",
"fac",
")",
";",
"}",
"MEM_SAFE_FREE",
"(",
"facs",
")",
";",
"}"
] | Note this modifies nos_new in-place. | [
"Note",
"this",
"modifies",
"nos_new",
"in",
"-",
"place",
"."
] | [
"/* Mix with org normals... */"
] | [
{
"param": "mix_factor",
"type": "float"
},
{
"param": "dvert",
"type": "MDeformVert"
},
{
"param": "defgrp_index",
"type": "int"
},
{
"param": "use_invert_vgroup",
"type": "bool"
},
{
"param": "mix_limit",
"type": "float"
},
{
"param": "mix_mode",
"type": "short"
},
{
"param": "num_verts",
"type": "int"
},
{
"param": "mloop",
"type": "MLoop"
},
{
"param": "nos_old",
"type": "float"
},
{
"param": "nos_new",
"type": "float"
},
{
"param": "num_loops",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "mix_factor",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dvert",
"type": "MDeformVert",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "defgrp_index",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "use_invert_vgroup",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mix_limit",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mix_mode",
"type": "short",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "num_verts",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mloop",
"type": "MLoop",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "nos_old",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "nos_new",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "num_loops",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
10852ed6148307c9a347fe7c725b2b2aafeddf78 | DemonRem/blender | source/blender/modifiers/intern/MOD_normal_edit.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | polygons_check_flip | bool | static bool polygons_check_flip(MLoop *mloop,
float (*nos)[3],
CustomData *ldata,
MPoly *mpoly,
float (*polynors)[3],
const int num_polys)
{
MPoly *mp;
MDisps *mdisp = CustomData_get_layer(ldata, CD_MDISPS);
int i;
bool flipped = false;
for (i = 0, mp = mpoly; i < num_polys; i++, mp++) {
float norsum[3] = {0.0f};
float(*no)[3];
int j;
for (j = 0, no = &nos[mp->loopstart]; j < mp->totloop; j++, no++) {
add_v3_v3(norsum, *no);
}
if (!normalize_v3(norsum)) {
continue;
}
/* If average of new loop normals is opposed to polygon normal, flip polygon. */
if (dot_v3v3(polynors[i], norsum) < 0.0f) {
BKE_mesh_polygon_flip_ex(mp, mloop, ldata, nos, mdisp, true);
negate_v3(polynors[i]);
flipped = true;
}
}
return flipped;
} | /* Check poly normals and new loop normals are compatible, otherwise flip polygons
* (and invert matching poly normals). */ | Check poly normals and new loop normals are compatible, otherwise flip polygons
(and invert matching poly normals). | [
"Check",
"poly",
"normals",
"and",
"new",
"loop",
"normals",
"are",
"compatible",
"otherwise",
"flip",
"polygons",
"(",
"and",
"invert",
"matching",
"poly",
"normals",
")",
"."
] | static bool polygons_check_flip(MLoop *mloop,
float (*nos)[3],
CustomData *ldata,
MPoly *mpoly,
float (*polynors)[3],
const int num_polys)
{
MPoly *mp;
MDisps *mdisp = CustomData_get_layer(ldata, CD_MDISPS);
int i;
bool flipped = false;
for (i = 0, mp = mpoly; i < num_polys; i++, mp++) {
float norsum[3] = {0.0f};
float(*no)[3];
int j;
for (j = 0, no = &nos[mp->loopstart]; j < mp->totloop; j++, no++) {
add_v3_v3(norsum, *no);
}
if (!normalize_v3(norsum)) {
continue;
}
if (dot_v3v3(polynors[i], norsum) < 0.0f) {
BKE_mesh_polygon_flip_ex(mp, mloop, ldata, nos, mdisp, true);
negate_v3(polynors[i]);
flipped = true;
}
}
return flipped;
} | [
"static",
"bool",
"polygons_check_flip",
"(",
"MLoop",
"*",
"mloop",
",",
"float",
"(",
"*",
"nos",
")",
"[",
"3",
"]",
",",
"CustomData",
"*",
"ldata",
",",
"MPoly",
"*",
"mpoly",
",",
"float",
"(",
"*",
"polynors",
")",
"[",
"3",
"]",
",",
"const",
"int",
"num_polys",
")",
"{",
"MPoly",
"*",
"mp",
";",
"MDisps",
"*",
"mdisp",
"=",
"CustomData_get_layer",
"(",
"ldata",
",",
"CD_MDISPS",
")",
";",
"int",
"i",
";",
"bool",
"flipped",
"=",
"false",
";",
"for",
"(",
"i",
"=",
"0",
",",
"mp",
"=",
"mpoly",
";",
"i",
"<",
"num_polys",
";",
"i",
"++",
",",
"mp",
"++",
")",
"{",
"float",
"norsum",
"[",
"3",
"]",
"=",
"{",
"0.0f",
"}",
";",
"float",
"(",
"*",
"no",
")",
"[",
"3",
"]",
";",
"int",
"j",
";",
"for",
"(",
"j",
"=",
"0",
",",
"no",
"=",
"&",
"nos",
"[",
"mp",
"->",
"loopstart",
"]",
";",
"j",
"<",
"mp",
"->",
"totloop",
";",
"j",
"++",
",",
"no",
"++",
")",
"{",
"add_v3_v3",
"(",
"norsum",
",",
"*",
"no",
")",
";",
"}",
"if",
"(",
"!",
"normalize_v3",
"(",
"norsum",
")",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"dot_v3v3",
"(",
"polynors",
"[",
"i",
"]",
",",
"norsum",
")",
"<",
"0.0f",
")",
"{",
"BKE_mesh_polygon_flip_ex",
"(",
"mp",
",",
"mloop",
",",
"ldata",
",",
"nos",
",",
"mdisp",
",",
"true",
")",
";",
"negate_v3",
"(",
"polynors",
"[",
"i",
"]",
")",
";",
"flipped",
"=",
"true",
";",
"}",
"}",
"return",
"flipped",
";",
"}"
] | Check poly normals and new loop normals are compatible, otherwise flip polygons
(and invert matching poly normals). | [
"Check",
"poly",
"normals",
"and",
"new",
"loop",
"normals",
"are",
"compatible",
"otherwise",
"flip",
"polygons",
"(",
"and",
"invert",
"matching",
"poly",
"normals",
")",
"."
] | [
"/* If average of new loop normals is opposed to polygon normal, flip polygon. */"
] | [
{
"param": "mloop",
"type": "MLoop"
},
{
"param": "nos",
"type": "float"
},
{
"param": "ldata",
"type": "CustomData"
},
{
"param": "mpoly",
"type": "MPoly"
},
{
"param": "polynors",
"type": "float"
},
{
"param": "num_polys",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "mloop",
"type": "MLoop",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "nos",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ldata",
"type": "CustomData",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mpoly",
"type": "MPoly",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "polynors",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "num_polys",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
67ffc6adc9fbaf9078be5454a49a9db3600a66d4 | DemonRem/blender | source/blender/editors/gpencil/gpencil_data.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | gp_data_add_exec | int | static int gp_data_add_exec(bContext *C, wmOperator *op)
{
PointerRNA gpd_owner = {NULL};
bGPdata **gpd_ptr = ED_gpencil_data_get_pointers(C, &gpd_owner);
bool is_annotation = ED_gpencil_data_owner_is_annotation(&gpd_owner);
if (gpd_ptr == NULL) {
BKE_report(op->reports, RPT_ERROR, "Nowhere for grease pencil data to go");
return OPERATOR_CANCELLED;
}
else {
/* decrement user count and add new datablock */
/* TODO: if a datablock exists,
* we should make a copy of it instead of starting fresh (as in other areas) */
Main *bmain = CTX_data_main(C);
/* decrement user count of old GP datablock */
if (*gpd_ptr) {
bGPdata *gpd = (*gpd_ptr);
id_us_min(&gpd->id);
}
/* Add new datablock, with a single layer ready to use
* (so users don't have to perform an extra step). */
if (is_annotation) {
bGPdata *gpd = BKE_gpencil_data_addnew(bmain, DATA_("Annotations"));
*gpd_ptr = gpd;
/* tag for annotations */
gpd->flag |= GP_DATA_ANNOTATIONS;
/* add new layer (i.e. a "note") */
BKE_gpencil_layer_addnew(*gpd_ptr, DATA_("Note"), true);
}
else {
/* GP Object Case - This shouldn't happen! */
*gpd_ptr = BKE_gpencil_data_addnew(bmain, DATA_("GPencil"));
/* add default sets of colors and brushes */
Object *ob = CTX_data_active_object(C);
ED_gpencil_add_defaults(C, ob);
/* add new layer */
BKE_gpencil_layer_addnew(*gpd_ptr, DATA_("GP_Layer"), true);
}
}
/* notifiers */
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
return OPERATOR_FINISHED;
} | /* add new datablock - wrapper around API */ | add new datablock - wrapper around API | [
"add",
"new",
"datablock",
"-",
"wrapper",
"around",
"API"
] | static int gp_data_add_exec(bContext *C, wmOperator *op)
{
PointerRNA gpd_owner = {NULL};
bGPdata **gpd_ptr = ED_gpencil_data_get_pointers(C, &gpd_owner);
bool is_annotation = ED_gpencil_data_owner_is_annotation(&gpd_owner);
if (gpd_ptr == NULL) {
BKE_report(op->reports, RPT_ERROR, "Nowhere for grease pencil data to go");
return OPERATOR_CANCELLED;
}
else {
Main *bmain = CTX_data_main(C);
if (*gpd_ptr) {
bGPdata *gpd = (*gpd_ptr);
id_us_min(&gpd->id);
}
if (is_annotation) {
bGPdata *gpd = BKE_gpencil_data_addnew(bmain, DATA_("Annotations"));
*gpd_ptr = gpd;
gpd->flag |= GP_DATA_ANNOTATIONS;
BKE_gpencil_layer_addnew(*gpd_ptr, DATA_("Note"), true);
}
else {
*gpd_ptr = BKE_gpencil_data_addnew(bmain, DATA_("GPencil"));
Object *ob = CTX_data_active_object(C);
ED_gpencil_add_defaults(C, ob);
BKE_gpencil_layer_addnew(*gpd_ptr, DATA_("GP_Layer"), true);
}
}
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
return OPERATOR_FINISHED;
} | [
"static",
"int",
"gp_data_add_exec",
"(",
"bContext",
"*",
"C",
",",
"wmOperator",
"*",
"op",
")",
"{",
"PointerRNA",
"gpd_owner",
"=",
"{",
"NULL",
"}",
";",
"bGPdata",
"*",
"*",
"gpd_ptr",
"=",
"ED_gpencil_data_get_pointers",
"(",
"C",
",",
"&",
"gpd_owner",
")",
";",
"bool",
"is_annotation",
"=",
"ED_gpencil_data_owner_is_annotation",
"(",
"&",
"gpd_owner",
")",
";",
"if",
"(",
"gpd_ptr",
"==",
"NULL",
")",
"{",
"BKE_report",
"(",
"op",
"->",
"reports",
",",
"RPT_ERROR",
",",
"\"",
"\"",
")",
";",
"return",
"OPERATOR_CANCELLED",
";",
"}",
"else",
"{",
"Main",
"*",
"bmain",
"=",
"CTX_data_main",
"(",
"C",
")",
";",
"if",
"(",
"*",
"gpd_ptr",
")",
"{",
"bGPdata",
"*",
"gpd",
"=",
"(",
"*",
"gpd_ptr",
")",
";",
"id_us_min",
"(",
"&",
"gpd",
"->",
"id",
")",
";",
"}",
"if",
"(",
"is_annotation",
")",
"{",
"bGPdata",
"*",
"gpd",
"=",
"BKE_gpencil_data_addnew",
"(",
"bmain",
",",
"DATA_",
"(",
"\"",
"\"",
")",
")",
";",
"*",
"gpd_ptr",
"=",
"gpd",
";",
"gpd",
"->",
"flag",
"|=",
"GP_DATA_ANNOTATIONS",
";",
"BKE_gpencil_layer_addnew",
"(",
"*",
"gpd_ptr",
",",
"DATA_",
"(",
"\"",
"\"",
")",
",",
"true",
")",
";",
"}",
"else",
"{",
"*",
"gpd_ptr",
"=",
"BKE_gpencil_data_addnew",
"(",
"bmain",
",",
"DATA_",
"(",
"\"",
"\"",
")",
")",
";",
"Object",
"*",
"ob",
"=",
"CTX_data_active_object",
"(",
"C",
")",
";",
"ED_gpencil_add_defaults",
"(",
"C",
",",
"ob",
")",
";",
"BKE_gpencil_layer_addnew",
"(",
"*",
"gpd_ptr",
",",
"DATA_",
"(",
"\"",
"\"",
")",
",",
"true",
")",
";",
"}",
"}",
"WM_event_add_notifier",
"(",
"C",
",",
"NC_GPENCIL",
"|",
"ND_DATA",
"|",
"NA_EDITED",
",",
"NULL",
")",
";",
"return",
"OPERATOR_FINISHED",
";",
"}"
] | add new datablock - wrapper around API | [
"add",
"new",
"datablock",
"-",
"wrapper",
"around",
"API"
] | [
"/* decrement user count and add new datablock */",
"/* TODO: if a datablock exists,\n * we should make a copy of it instead of starting fresh (as in other areas) */",
"/* decrement user count of old GP datablock */",
"/* Add new datablock, with a single layer ready to use\n * (so users don't have to perform an extra step). */",
"/* tag for annotations */",
"/* add new layer (i.e. a \"note\") */",
"/* GP Object Case - This shouldn't happen! */",
"/* add default sets of colors and brushes */",
"/* add new layer */",
"/* notifiers */"
] | [
{
"param": "C",
"type": "bContext"
},
{
"param": "op",
"type": "wmOperator"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "op",
"type": "wmOperator",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
67ffc6adc9fbaf9078be5454a49a9db3600a66d4 | DemonRem/blender | source/blender/editors/gpencil/gpencil_data.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | gp_data_unlink_poll | bool | static bool gp_data_unlink_poll(bContext *C)
{
bGPdata **gpd_ptr = ED_gpencil_data_get_pointers(C, NULL);
/* only unlink annotation datablocks */
if ((gpd_ptr != NULL) && (*gpd_ptr != NULL)) {
bGPdata *gpd = (*gpd_ptr);
if ((gpd->flag & GP_DATA_ANNOTATIONS) == 0) {
return false;
}
}
/* if we have access to some active data, make sure there's a datablock before enabling this */
return (gpd_ptr && *gpd_ptr);
} | /* poll callback for adding data/layers - special */ | poll callback for adding data/layers - special | [
"poll",
"callback",
"for",
"adding",
"data",
"/",
"layers",
"-",
"special"
] | static bool gp_data_unlink_poll(bContext *C)
{
bGPdata **gpd_ptr = ED_gpencil_data_get_pointers(C, NULL);
if ((gpd_ptr != NULL) && (*gpd_ptr != NULL)) {
bGPdata *gpd = (*gpd_ptr);
if ((gpd->flag & GP_DATA_ANNOTATIONS) == 0) {
return false;
}
}
return (gpd_ptr && *gpd_ptr);
} | [
"static",
"bool",
"gp_data_unlink_poll",
"(",
"bContext",
"*",
"C",
")",
"{",
"bGPdata",
"*",
"*",
"gpd_ptr",
"=",
"ED_gpencil_data_get_pointers",
"(",
"C",
",",
"NULL",
")",
";",
"if",
"(",
"(",
"gpd_ptr",
"!=",
"NULL",
")",
"&&",
"(",
"*",
"gpd_ptr",
"!=",
"NULL",
")",
")",
"{",
"bGPdata",
"*",
"gpd",
"=",
"(",
"*",
"gpd_ptr",
")",
";",
"if",
"(",
"(",
"gpd",
"->",
"flag",
"&",
"GP_DATA_ANNOTATIONS",
")",
"==",
"0",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"(",
"gpd_ptr",
"&&",
"*",
"gpd_ptr",
")",
";",
"}"
] | poll callback for adding data/layers - special | [
"poll",
"callback",
"for",
"adding",
"data",
"/",
"layers",
"-",
"special"
] | [
"/* only unlink annotation datablocks */",
"/* if we have access to some active data, make sure there's a datablock before enabling this */"
] | [
{
"param": "C",
"type": "bContext"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
67ffc6adc9fbaf9078be5454a49a9db3600a66d4 | DemonRem/blender | source/blender/editors/gpencil/gpencil_data.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | gp_data_unlink_exec | int | static int gp_data_unlink_exec(bContext *C, wmOperator *op)
{
bGPdata **gpd_ptr = ED_gpencil_data_get_pointers(C, NULL);
if (gpd_ptr == NULL) {
BKE_report(op->reports, RPT_ERROR, "Nowhere for grease pencil data to go");
return OPERATOR_CANCELLED;
}
else {
/* just unlink datablock now, decreasing its user count */
bGPdata *gpd = (*gpd_ptr);
id_us_min(&gpd->id);
*gpd_ptr = NULL;
}
/* notifiers */
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
return OPERATOR_FINISHED;
} | /* unlink datablock - wrapper around API */ | unlink datablock - wrapper around API | [
"unlink",
"datablock",
"-",
"wrapper",
"around",
"API"
] | static int gp_data_unlink_exec(bContext *C, wmOperator *op)
{
bGPdata **gpd_ptr = ED_gpencil_data_get_pointers(C, NULL);
if (gpd_ptr == NULL) {
BKE_report(op->reports, RPT_ERROR, "Nowhere for grease pencil data to go");
return OPERATOR_CANCELLED;
}
else {
bGPdata *gpd = (*gpd_ptr);
id_us_min(&gpd->id);
*gpd_ptr = NULL;
}
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
return OPERATOR_FINISHED;
} | [
"static",
"int",
"gp_data_unlink_exec",
"(",
"bContext",
"*",
"C",
",",
"wmOperator",
"*",
"op",
")",
"{",
"bGPdata",
"*",
"*",
"gpd_ptr",
"=",
"ED_gpencil_data_get_pointers",
"(",
"C",
",",
"NULL",
")",
";",
"if",
"(",
"gpd_ptr",
"==",
"NULL",
")",
"{",
"BKE_report",
"(",
"op",
"->",
"reports",
",",
"RPT_ERROR",
",",
"\"",
"\"",
")",
";",
"return",
"OPERATOR_CANCELLED",
";",
"}",
"else",
"{",
"bGPdata",
"*",
"gpd",
"=",
"(",
"*",
"gpd_ptr",
")",
";",
"id_us_min",
"(",
"&",
"gpd",
"->",
"id",
")",
";",
"*",
"gpd_ptr",
"=",
"NULL",
";",
"}",
"WM_event_add_notifier",
"(",
"C",
",",
"NC_GPENCIL",
"|",
"ND_DATA",
"|",
"NA_EDITED",
",",
"NULL",
")",
";",
"return",
"OPERATOR_FINISHED",
";",
"}"
] | unlink datablock - wrapper around API | [
"unlink",
"datablock",
"-",
"wrapper",
"around",
"API"
] | [
"/* just unlink datablock now, decreasing its user count */",
"/* notifiers */"
] | [
{
"param": "C",
"type": "bContext"
},
{
"param": "op",
"type": "wmOperator"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "op",
"type": "wmOperator",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
67ffc6adc9fbaf9078be5454a49a9db3600a66d4 | DemonRem/blender | source/blender/editors/gpencil/gpencil_data.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | gp_layer_add_exec | int | static int gp_layer_add_exec(bContext *C, wmOperator *op)
{
PointerRNA gpd_owner = {NULL};
bGPdata **gpd_ptr = ED_gpencil_data_get_pointers(C, &gpd_owner);
bool is_annotation = ED_gpencil_data_owner_is_annotation(&gpd_owner);
/* if there's no existing Grease-Pencil data there, add some */
if (gpd_ptr == NULL) {
BKE_report(op->reports, RPT_ERROR, "Nowhere for grease pencil data to go");
return OPERATOR_CANCELLED;
}
if (*gpd_ptr == NULL) {
Main *bmain = CTX_data_main(C);
if (is_annotation) {
/* Annotations */
*gpd_ptr = BKE_gpencil_data_addnew(bmain, DATA_("Annotations"));
/* mark as annotation */
(*gpd_ptr)->flag |= GP_DATA_ANNOTATIONS;
}
else {
/* GP Object */
/* NOTE: This shouldn't actually happen in practice */
*gpd_ptr = BKE_gpencil_data_addnew(bmain, DATA_("GPencil"));
/* add default sets of colors and brushes */
Object *ob = CTX_data_active_object(C);
ED_gpencil_add_defaults(C, ob);
}
}
/* add new layer now */
if (is_annotation) {
BKE_gpencil_layer_addnew(*gpd_ptr, DATA_("Note"), true);
}
else {
BKE_gpencil_layer_addnew(*gpd_ptr, DATA_("GP_Layer"), true);
}
/* notifiers */
bGPdata *gpd = *gpd_ptr;
DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE);
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
return OPERATOR_FINISHED;
} | /* add new layer - wrapper around API */ | add new layer - wrapper around API | [
"add",
"new",
"layer",
"-",
"wrapper",
"around",
"API"
] | static int gp_layer_add_exec(bContext *C, wmOperator *op)
{
PointerRNA gpd_owner = {NULL};
bGPdata **gpd_ptr = ED_gpencil_data_get_pointers(C, &gpd_owner);
bool is_annotation = ED_gpencil_data_owner_is_annotation(&gpd_owner);
if (gpd_ptr == NULL) {
BKE_report(op->reports, RPT_ERROR, "Nowhere for grease pencil data to go");
return OPERATOR_CANCELLED;
}
if (*gpd_ptr == NULL) {
Main *bmain = CTX_data_main(C);
if (is_annotation) {
*gpd_ptr = BKE_gpencil_data_addnew(bmain, DATA_("Annotations"));
(*gpd_ptr)->flag |= GP_DATA_ANNOTATIONS;
}
else {
*gpd_ptr = BKE_gpencil_data_addnew(bmain, DATA_("GPencil"));
Object *ob = CTX_data_active_object(C);
ED_gpencil_add_defaults(C, ob);
}
}
if (is_annotation) {
BKE_gpencil_layer_addnew(*gpd_ptr, DATA_("Note"), true);
}
else {
BKE_gpencil_layer_addnew(*gpd_ptr, DATA_("GP_Layer"), true);
}
bGPdata *gpd = *gpd_ptr;
DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE);
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
return OPERATOR_FINISHED;
} | [
"static",
"int",
"gp_layer_add_exec",
"(",
"bContext",
"*",
"C",
",",
"wmOperator",
"*",
"op",
")",
"{",
"PointerRNA",
"gpd_owner",
"=",
"{",
"NULL",
"}",
";",
"bGPdata",
"*",
"*",
"gpd_ptr",
"=",
"ED_gpencil_data_get_pointers",
"(",
"C",
",",
"&",
"gpd_owner",
")",
";",
"bool",
"is_annotation",
"=",
"ED_gpencil_data_owner_is_annotation",
"(",
"&",
"gpd_owner",
")",
";",
"if",
"(",
"gpd_ptr",
"==",
"NULL",
")",
"{",
"BKE_report",
"(",
"op",
"->",
"reports",
",",
"RPT_ERROR",
",",
"\"",
"\"",
")",
";",
"return",
"OPERATOR_CANCELLED",
";",
"}",
"if",
"(",
"*",
"gpd_ptr",
"==",
"NULL",
")",
"{",
"Main",
"*",
"bmain",
"=",
"CTX_data_main",
"(",
"C",
")",
";",
"if",
"(",
"is_annotation",
")",
"{",
"*",
"gpd_ptr",
"=",
"BKE_gpencil_data_addnew",
"(",
"bmain",
",",
"DATA_",
"(",
"\"",
"\"",
")",
")",
";",
"(",
"*",
"gpd_ptr",
")",
"->",
"flag",
"|=",
"GP_DATA_ANNOTATIONS",
";",
"}",
"else",
"{",
"*",
"gpd_ptr",
"=",
"BKE_gpencil_data_addnew",
"(",
"bmain",
",",
"DATA_",
"(",
"\"",
"\"",
")",
")",
";",
"Object",
"*",
"ob",
"=",
"CTX_data_active_object",
"(",
"C",
")",
";",
"ED_gpencil_add_defaults",
"(",
"C",
",",
"ob",
")",
";",
"}",
"}",
"if",
"(",
"is_annotation",
")",
"{",
"BKE_gpencil_layer_addnew",
"(",
"*",
"gpd_ptr",
",",
"DATA_",
"(",
"\"",
"\"",
")",
",",
"true",
")",
";",
"}",
"else",
"{",
"BKE_gpencil_layer_addnew",
"(",
"*",
"gpd_ptr",
",",
"DATA_",
"(",
"\"",
"\"",
")",
",",
"true",
")",
";",
"}",
"bGPdata",
"*",
"gpd",
"=",
"*",
"gpd_ptr",
";",
"DEG_id_tag_update",
"(",
"&",
"gpd",
"->",
"id",
",",
"ID_RECALC_TRANSFORM",
"|",
"ID_RECALC_GEOMETRY",
"|",
"ID_RECALC_COPY_ON_WRITE",
")",
";",
"WM_event_add_notifier",
"(",
"C",
",",
"NC_GPENCIL",
"|",
"ND_DATA",
"|",
"NA_EDITED",
",",
"NULL",
")",
";",
"return",
"OPERATOR_FINISHED",
";",
"}"
] | add new layer - wrapper around API | [
"add",
"new",
"layer",
"-",
"wrapper",
"around",
"API"
] | [
"/* if there's no existing Grease-Pencil data there, add some */",
"/* Annotations */",
"/* mark as annotation */",
"/* GP Object */",
"/* NOTE: This shouldn't actually happen in practice */",
"/* add default sets of colors and brushes */",
"/* add new layer now */",
"/* notifiers */"
] | [
{
"param": "C",
"type": "bContext"
},
{
"param": "op",
"type": "wmOperator"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "op",
"type": "wmOperator",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
67ffc6adc9fbaf9078be5454a49a9db3600a66d4 | DemonRem/blender | source/blender/editors/gpencil/gpencil_data.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | gp_merge_layer_exec | int | static int gp_merge_layer_exec(bContext *C, wmOperator *op)
{
bGPdata *gpd = ED_gpencil_data_get_active(C);
bGPDlayer *gpl_next = BKE_gpencil_layer_getactive(gpd);
bGPDlayer *gpl_current = gpl_next->prev;
if (ELEM(NULL, gpd, gpl_current, gpl_next)) {
BKE_report(op->reports, RPT_ERROR, "No layers to merge");
return OPERATOR_CANCELLED;
}
/* Collect frames of gpl_current in hash table to avoid O(n^2) lookups */
GHash *gh_frames_cur = BLI_ghash_int_new_ex(__func__, 64);
for (bGPDframe *gpf = gpl_current->frames.first; gpf; gpf = gpf->next) {
BLI_ghash_insert(gh_frames_cur, POINTER_FROM_INT(gpf->framenum), gpf);
}
/* read all frames from next layer and add any missing in current layer */
for (bGPDframe *gpf = gpl_next->frames.first; gpf; gpf = gpf->next) {
/* try to find frame in current layer */
bGPDframe *frame = BLI_ghash_lookup(gh_frames_cur, POINTER_FROM_INT(gpf->framenum));
if (!frame) {
bGPDframe *actframe = BKE_gpencil_layer_getframe(
gpl_current, gpf->framenum, GP_GETFRAME_USE_PREV);
frame = BKE_gpencil_frame_addnew(gpl_current, gpf->framenum);
/* duplicate strokes of current active frame */
if (actframe) {
BKE_gpencil_frame_copy_strokes(actframe, frame);
}
}
/* add to tail all strokes */
BLI_movelisttolist(&frame->strokes, &gpf->strokes);
}
/* Now delete next layer */
BKE_gpencil_layer_delete(gpd, gpl_next);
BLI_ghash_free(gh_frames_cur, NULL, NULL);
/* notifiers */
DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
return OPERATOR_FINISHED;
} | /* ********************** Merge Layer with the next layer **************************** */ | Merge Layer with the next layer | [
"Merge",
"Layer",
"with",
"the",
"next",
"layer"
] | static int gp_merge_layer_exec(bContext *C, wmOperator *op)
{
bGPdata *gpd = ED_gpencil_data_get_active(C);
bGPDlayer *gpl_next = BKE_gpencil_layer_getactive(gpd);
bGPDlayer *gpl_current = gpl_next->prev;
if (ELEM(NULL, gpd, gpl_current, gpl_next)) {
BKE_report(op->reports, RPT_ERROR, "No layers to merge");
return OPERATOR_CANCELLED;
}
GHash *gh_frames_cur = BLI_ghash_int_new_ex(__func__, 64);
for (bGPDframe *gpf = gpl_current->frames.first; gpf; gpf = gpf->next) {
BLI_ghash_insert(gh_frames_cur, POINTER_FROM_INT(gpf->framenum), gpf);
}
for (bGPDframe *gpf = gpl_next->frames.first; gpf; gpf = gpf->next) {
bGPDframe *frame = BLI_ghash_lookup(gh_frames_cur, POINTER_FROM_INT(gpf->framenum));
if (!frame) {
bGPDframe *actframe = BKE_gpencil_layer_getframe(
gpl_current, gpf->framenum, GP_GETFRAME_USE_PREV);
frame = BKE_gpencil_frame_addnew(gpl_current, gpf->framenum);
if (actframe) {
BKE_gpencil_frame_copy_strokes(actframe, frame);
}
}
BLI_movelisttolist(&frame->strokes, &gpf->strokes);
}
BKE_gpencil_layer_delete(gpd, gpl_next);
BLI_ghash_free(gh_frames_cur, NULL, NULL);
DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
return OPERATOR_FINISHED;
} | [
"static",
"int",
"gp_merge_layer_exec",
"(",
"bContext",
"*",
"C",
",",
"wmOperator",
"*",
"op",
")",
"{",
"bGPdata",
"*",
"gpd",
"=",
"ED_gpencil_data_get_active",
"(",
"C",
")",
";",
"bGPDlayer",
"*",
"gpl_next",
"=",
"BKE_gpencil_layer_getactive",
"(",
"gpd",
")",
";",
"bGPDlayer",
"*",
"gpl_current",
"=",
"gpl_next",
"->",
"prev",
";",
"if",
"(",
"ELEM",
"(",
"NULL",
",",
"gpd",
",",
"gpl_current",
",",
"gpl_next",
")",
")",
"{",
"BKE_report",
"(",
"op",
"->",
"reports",
",",
"RPT_ERROR",
",",
"\"",
"\"",
")",
";",
"return",
"OPERATOR_CANCELLED",
";",
"}",
"GHash",
"*",
"gh_frames_cur",
"=",
"BLI_ghash_int_new_ex",
"(",
"__func__",
",",
"64",
")",
";",
"for",
"(",
"bGPDframe",
"*",
"gpf",
"=",
"gpl_current",
"->",
"frames",
".",
"first",
";",
"gpf",
";",
"gpf",
"=",
"gpf",
"->",
"next",
")",
"{",
"BLI_ghash_insert",
"(",
"gh_frames_cur",
",",
"POINTER_FROM_INT",
"(",
"gpf",
"->",
"framenum",
")",
",",
"gpf",
")",
";",
"}",
"for",
"(",
"bGPDframe",
"*",
"gpf",
"=",
"gpl_next",
"->",
"frames",
".",
"first",
";",
"gpf",
";",
"gpf",
"=",
"gpf",
"->",
"next",
")",
"{",
"bGPDframe",
"*",
"frame",
"=",
"BLI_ghash_lookup",
"(",
"gh_frames_cur",
",",
"POINTER_FROM_INT",
"(",
"gpf",
"->",
"framenum",
")",
")",
";",
"if",
"(",
"!",
"frame",
")",
"{",
"bGPDframe",
"*",
"actframe",
"=",
"BKE_gpencil_layer_getframe",
"(",
"gpl_current",
",",
"gpf",
"->",
"framenum",
",",
"GP_GETFRAME_USE_PREV",
")",
";",
"frame",
"=",
"BKE_gpencil_frame_addnew",
"(",
"gpl_current",
",",
"gpf",
"->",
"framenum",
")",
";",
"if",
"(",
"actframe",
")",
"{",
"BKE_gpencil_frame_copy_strokes",
"(",
"actframe",
",",
"frame",
")",
";",
"}",
"}",
"BLI_movelisttolist",
"(",
"&",
"frame",
"->",
"strokes",
",",
"&",
"gpf",
"->",
"strokes",
")",
";",
"}",
"BKE_gpencil_layer_delete",
"(",
"gpd",
",",
"gpl_next",
")",
";",
"BLI_ghash_free",
"(",
"gh_frames_cur",
",",
"NULL",
",",
"NULL",
")",
";",
"DEG_id_tag_update",
"(",
"&",
"gpd",
"->",
"id",
",",
"ID_RECALC_TRANSFORM",
"|",
"ID_RECALC_GEOMETRY",
")",
";",
"WM_event_add_notifier",
"(",
"C",
",",
"NC_GPENCIL",
"|",
"ND_DATA",
"|",
"NA_EDITED",
",",
"NULL",
")",
";",
"return",
"OPERATOR_FINISHED",
";",
"}"
] | Merge Layer with the next layer | [
"Merge",
"Layer",
"with",
"the",
"next",
"layer"
] | [
"/* Collect frames of gpl_current in hash table to avoid O(n^2) lookups */",
"/* read all frames from next layer and add any missing in current layer */",
"/* try to find frame in current layer */",
"/* duplicate strokes of current active frame */",
"/* add to tail all strokes */",
"/* Now delete next layer */",
"/* notifiers */"
] | [
{
"param": "C",
"type": "bContext"
},
{
"param": "op",
"type": "wmOperator"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "op",
"type": "wmOperator",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
67ffc6adc9fbaf9078be5454a49a9db3600a66d4 | DemonRem/blender | source/blender/editors/gpencil/gpencil_data.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | gp_stroke_lock_color_exec | int | static int gp_stroke_lock_color_exec(bContext *C, wmOperator *UNUSED(op))
{
bGPdata *gpd = ED_gpencil_data_get_active(C);
Object *ob = CTX_data_active_object(C);
short *totcol = give_totcolp(ob);
/* sanity checks */
if (ELEM(NULL, gpd)) {
return OPERATOR_CANCELLED;
}
/* first lock all colors */
for (short i = 0; i < *totcol; i++) {
Material *tmp_ma = give_current_material(ob, i + 1);
if (tmp_ma) {
tmp_ma->gp_style->flag |= GP_STYLE_COLOR_LOCKED;
DEG_id_tag_update(&tmp_ma->id, ID_RECALC_COPY_ON_WRITE);
}
}
/* loop all selected strokes and unlock any color */
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
/* only editable and visible layers are considered */
if (gpencil_layer_is_editable(gpl) && (gpl->actframe != NULL)) {
for (bGPDstroke *gps = gpl->actframe->strokes.last; gps; gps = gps->prev) {
/* only if selected */
if (gps->flag & GP_STROKE_SELECT) {
/* skip strokes that are invalid for current view */
if (ED_gpencil_stroke_can_use(C, gps) == false) {
continue;
}
/* unlock color */
Material *tmp_ma = give_current_material(ob, gps->mat_nr + 1);
if (tmp_ma) {
tmp_ma->gp_style->flag &= ~GP_STYLE_COLOR_LOCKED;
DEG_id_tag_update(&tmp_ma->id, ID_RECALC_COPY_ON_WRITE);
}
}
}
}
}
/* updates */
DEG_id_tag_update(&gpd->id, ID_RECALC_GEOMETRY);
/* copy on write tag is needed, or else no refresh happens */
DEG_id_tag_update(&gpd->id, ID_RECALC_COPY_ON_WRITE);
/* notifiers */
DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
return OPERATOR_FINISHED;
} | /* ******************* Lock color of non selected Strokes colors ************************** */ | Lock color of non selected Strokes colors | [
"Lock",
"color",
"of",
"non",
"selected",
"Strokes",
"colors"
] | static int gp_stroke_lock_color_exec(bContext *C, wmOperator *UNUSED(op))
{
bGPdata *gpd = ED_gpencil_data_get_active(C);
Object *ob = CTX_data_active_object(C);
short *totcol = give_totcolp(ob);
if (ELEM(NULL, gpd)) {
return OPERATOR_CANCELLED;
}
for (short i = 0; i < *totcol; i++) {
Material *tmp_ma = give_current_material(ob, i + 1);
if (tmp_ma) {
tmp_ma->gp_style->flag |= GP_STYLE_COLOR_LOCKED;
DEG_id_tag_update(&tmp_ma->id, ID_RECALC_COPY_ON_WRITE);
}
}
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
if (gpencil_layer_is_editable(gpl) && (gpl->actframe != NULL)) {
for (bGPDstroke *gps = gpl->actframe->strokes.last; gps; gps = gps->prev) {
if (gps->flag & GP_STROKE_SELECT) {
if (ED_gpencil_stroke_can_use(C, gps) == false) {
continue;
}
Material *tmp_ma = give_current_material(ob, gps->mat_nr + 1);
if (tmp_ma) {
tmp_ma->gp_style->flag &= ~GP_STYLE_COLOR_LOCKED;
DEG_id_tag_update(&tmp_ma->id, ID_RECALC_COPY_ON_WRITE);
}
}
}
}
}
DEG_id_tag_update(&gpd->id, ID_RECALC_GEOMETRY);
DEG_id_tag_update(&gpd->id, ID_RECALC_COPY_ON_WRITE);
DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
return OPERATOR_FINISHED;
} | [
"static",
"int",
"gp_stroke_lock_color_exec",
"(",
"bContext",
"*",
"C",
",",
"wmOperator",
"*",
"UNUSED",
"(",
"op",
")",
")",
"{",
"bGPdata",
"*",
"gpd",
"=",
"ED_gpencil_data_get_active",
"(",
"C",
")",
";",
"Object",
"*",
"ob",
"=",
"CTX_data_active_object",
"(",
"C",
")",
";",
"short",
"*",
"totcol",
"=",
"give_totcolp",
"(",
"ob",
")",
";",
"if",
"(",
"ELEM",
"(",
"NULL",
",",
"gpd",
")",
")",
"{",
"return",
"OPERATOR_CANCELLED",
";",
"}",
"for",
"(",
"short",
"i",
"=",
"0",
";",
"i",
"<",
"*",
"totcol",
";",
"i",
"++",
")",
"{",
"Material",
"*",
"tmp_ma",
"=",
"give_current_material",
"(",
"ob",
",",
"i",
"+",
"1",
")",
";",
"if",
"(",
"tmp_ma",
")",
"{",
"tmp_ma",
"->",
"gp_style",
"->",
"flag",
"|=",
"GP_STYLE_COLOR_LOCKED",
";",
"DEG_id_tag_update",
"(",
"&",
"tmp_ma",
"->",
"id",
",",
"ID_RECALC_COPY_ON_WRITE",
")",
";",
"}",
"}",
"for",
"(",
"bGPDlayer",
"*",
"gpl",
"=",
"gpd",
"->",
"layers",
".",
"first",
";",
"gpl",
";",
"gpl",
"=",
"gpl",
"->",
"next",
")",
"{",
"if",
"(",
"gpencil_layer_is_editable",
"(",
"gpl",
")",
"&&",
"(",
"gpl",
"->",
"actframe",
"!=",
"NULL",
")",
")",
"{",
"for",
"(",
"bGPDstroke",
"*",
"gps",
"=",
"gpl",
"->",
"actframe",
"->",
"strokes",
".",
"last",
";",
"gps",
";",
"gps",
"=",
"gps",
"->",
"prev",
")",
"{",
"if",
"(",
"gps",
"->",
"flag",
"&",
"GP_STROKE_SELECT",
")",
"{",
"if",
"(",
"ED_gpencil_stroke_can_use",
"(",
"C",
",",
"gps",
")",
"==",
"false",
")",
"{",
"continue",
";",
"}",
"Material",
"*",
"tmp_ma",
"=",
"give_current_material",
"(",
"ob",
",",
"gps",
"->",
"mat_nr",
"+",
"1",
")",
";",
"if",
"(",
"tmp_ma",
")",
"{",
"tmp_ma",
"->",
"gp_style",
"->",
"flag",
"&=",
"~",
"GP_STYLE_COLOR_LOCKED",
";",
"DEG_id_tag_update",
"(",
"&",
"tmp_ma",
"->",
"id",
",",
"ID_RECALC_COPY_ON_WRITE",
")",
";",
"}",
"}",
"}",
"}",
"}",
"DEG_id_tag_update",
"(",
"&",
"gpd",
"->",
"id",
",",
"ID_RECALC_GEOMETRY",
")",
";",
"DEG_id_tag_update",
"(",
"&",
"gpd",
"->",
"id",
",",
"ID_RECALC_COPY_ON_WRITE",
")",
";",
"DEG_id_tag_update",
"(",
"&",
"gpd",
"->",
"id",
",",
"ID_RECALC_TRANSFORM",
"|",
"ID_RECALC_GEOMETRY",
")",
";",
"WM_event_add_notifier",
"(",
"C",
",",
"NC_GPENCIL",
"|",
"ND_DATA",
"|",
"NA_EDITED",
",",
"NULL",
")",
";",
"return",
"OPERATOR_FINISHED",
";",
"}"
] | Lock color of non selected Strokes colors | [
"Lock",
"color",
"of",
"non",
"selected",
"Strokes",
"colors"
] | [
"/* sanity checks */",
"/* first lock all colors */",
"/* loop all selected strokes and unlock any color */",
"/* only editable and visible layers are considered */",
"/* only if selected */",
"/* skip strokes that are invalid for current view */",
"/* unlock color */",
"/* updates */",
"/* copy on write tag is needed, or else no refresh happens */",
"/* notifiers */"
] | [
{
"param": "C",
"type": "bContext"
},
{
"param": "UNUSED",
"type": "wmOperator"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "UNUSED",
"type": "wmOperator",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
67ffc6adc9fbaf9078be5454a49a9db3600a66d4 | DemonRem/blender | source/blender/editors/gpencil/gpencil_data.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | gpencil_lock_layer_exec | int | static int gpencil_lock_layer_exec(bContext *C, wmOperator *UNUSED(op))
{
bGPdata *gpd = ED_gpencil_data_get_active(C);
Object *ob = CTX_data_active_object(C);
MaterialGPencilStyle *gp_style = NULL;
/* sanity checks */
if (ELEM(NULL, gpd)) {
return OPERATOR_CANCELLED;
}
/* first lock and hide all colors */
Material *ma = NULL;
short *totcol = give_totcolp(ob);
if (totcol == 0) {
return OPERATOR_CANCELLED;
}
for (short i = 0; i < *totcol; i++) {
ma = BKE_material_gpencil_get(ob, i + 1);
if (ma) {
gp_style = ma->gp_style;
gp_style->flag |= GP_STYLE_COLOR_LOCKED;
gp_style->flag |= GP_STYLE_COLOR_HIDE;
DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
}
}
/* loop all selected strokes and unlock any color used in active layer */
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
/* only editable and visible layers are considered */
if (gpencil_layer_is_editable(gpl) && (gpl->actframe != NULL) &&
(gpl->flag & GP_LAYER_ACTIVE)) {
for (bGPDstroke *gps = gpl->actframe->strokes.last; gps; gps = gps->prev) {
/* skip strokes that are invalid for current view */
if (ED_gpencil_stroke_can_use(C, gps) == false) {
continue;
}
ma = BKE_material_gpencil_get(ob, gps->mat_nr + 1);
DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
gp_style = ma->gp_style;
/* unlock/unhide color if not unlocked before */
if (gp_style != NULL) {
gp_style->flag &= ~GP_STYLE_COLOR_LOCKED;
gp_style->flag &= ~GP_STYLE_COLOR_HIDE;
}
}
}
}
/* updates */
DEG_id_tag_update(&gpd->id, ID_RECALC_GEOMETRY);
/* copy on write tag is needed, or else no refresh happens */
DEG_id_tag_update(&gpd->id, ID_RECALC_COPY_ON_WRITE);
/* notifiers */
DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
return OPERATOR_FINISHED;
} | /* **************** Lock and hide any color non used in current layer ************************** */ | Lock and hide any color non used in current layer | [
"Lock",
"and",
"hide",
"any",
"color",
"non",
"used",
"in",
"current",
"layer"
] | static int gpencil_lock_layer_exec(bContext *C, wmOperator *UNUSED(op))
{
bGPdata *gpd = ED_gpencil_data_get_active(C);
Object *ob = CTX_data_active_object(C);
MaterialGPencilStyle *gp_style = NULL;
if (ELEM(NULL, gpd)) {
return OPERATOR_CANCELLED;
}
Material *ma = NULL;
short *totcol = give_totcolp(ob);
if (totcol == 0) {
return OPERATOR_CANCELLED;
}
for (short i = 0; i < *totcol; i++) {
ma = BKE_material_gpencil_get(ob, i + 1);
if (ma) {
gp_style = ma->gp_style;
gp_style->flag |= GP_STYLE_COLOR_LOCKED;
gp_style->flag |= GP_STYLE_COLOR_HIDE;
DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
}
}
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
if (gpencil_layer_is_editable(gpl) && (gpl->actframe != NULL) &&
(gpl->flag & GP_LAYER_ACTIVE)) {
for (bGPDstroke *gps = gpl->actframe->strokes.last; gps; gps = gps->prev) {
if (ED_gpencil_stroke_can_use(C, gps) == false) {
continue;
}
ma = BKE_material_gpencil_get(ob, gps->mat_nr + 1);
DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
gp_style = ma->gp_style;
if (gp_style != NULL) {
gp_style->flag &= ~GP_STYLE_COLOR_LOCKED;
gp_style->flag &= ~GP_STYLE_COLOR_HIDE;
}
}
}
}
DEG_id_tag_update(&gpd->id, ID_RECALC_GEOMETRY);
DEG_id_tag_update(&gpd->id, ID_RECALC_COPY_ON_WRITE);
DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
return OPERATOR_FINISHED;
} | [
"static",
"int",
"gpencil_lock_layer_exec",
"(",
"bContext",
"*",
"C",
",",
"wmOperator",
"*",
"UNUSED",
"(",
"op",
")",
")",
"{",
"bGPdata",
"*",
"gpd",
"=",
"ED_gpencil_data_get_active",
"(",
"C",
")",
";",
"Object",
"*",
"ob",
"=",
"CTX_data_active_object",
"(",
"C",
")",
";",
"MaterialGPencilStyle",
"*",
"gp_style",
"=",
"NULL",
";",
"if",
"(",
"ELEM",
"(",
"NULL",
",",
"gpd",
")",
")",
"{",
"return",
"OPERATOR_CANCELLED",
";",
"}",
"Material",
"*",
"ma",
"=",
"NULL",
";",
"short",
"*",
"totcol",
"=",
"give_totcolp",
"(",
"ob",
")",
";",
"if",
"(",
"totcol",
"==",
"0",
")",
"{",
"return",
"OPERATOR_CANCELLED",
";",
"}",
"for",
"(",
"short",
"i",
"=",
"0",
";",
"i",
"<",
"*",
"totcol",
";",
"i",
"++",
")",
"{",
"ma",
"=",
"BKE_material_gpencil_get",
"(",
"ob",
",",
"i",
"+",
"1",
")",
";",
"if",
"(",
"ma",
")",
"{",
"gp_style",
"=",
"ma",
"->",
"gp_style",
";",
"gp_style",
"->",
"flag",
"|=",
"GP_STYLE_COLOR_LOCKED",
";",
"gp_style",
"->",
"flag",
"|=",
"GP_STYLE_COLOR_HIDE",
";",
"DEG_id_tag_update",
"(",
"&",
"ma",
"->",
"id",
",",
"ID_RECALC_COPY_ON_WRITE",
")",
";",
"}",
"}",
"for",
"(",
"bGPDlayer",
"*",
"gpl",
"=",
"gpd",
"->",
"layers",
".",
"first",
";",
"gpl",
";",
"gpl",
"=",
"gpl",
"->",
"next",
")",
"{",
"if",
"(",
"gpencil_layer_is_editable",
"(",
"gpl",
")",
"&&",
"(",
"gpl",
"->",
"actframe",
"!=",
"NULL",
")",
"&&",
"(",
"gpl",
"->",
"flag",
"&",
"GP_LAYER_ACTIVE",
")",
")",
"{",
"for",
"(",
"bGPDstroke",
"*",
"gps",
"=",
"gpl",
"->",
"actframe",
"->",
"strokes",
".",
"last",
";",
"gps",
";",
"gps",
"=",
"gps",
"->",
"prev",
")",
"{",
"if",
"(",
"ED_gpencil_stroke_can_use",
"(",
"C",
",",
"gps",
")",
"==",
"false",
")",
"{",
"continue",
";",
"}",
"ma",
"=",
"BKE_material_gpencil_get",
"(",
"ob",
",",
"gps",
"->",
"mat_nr",
"+",
"1",
")",
";",
"DEG_id_tag_update",
"(",
"&",
"ma",
"->",
"id",
",",
"ID_RECALC_COPY_ON_WRITE",
")",
";",
"gp_style",
"=",
"ma",
"->",
"gp_style",
";",
"if",
"(",
"gp_style",
"!=",
"NULL",
")",
"{",
"gp_style",
"->",
"flag",
"&=",
"~",
"GP_STYLE_COLOR_LOCKED",
";",
"gp_style",
"->",
"flag",
"&=",
"~",
"GP_STYLE_COLOR_HIDE",
";",
"}",
"}",
"}",
"}",
"DEG_id_tag_update",
"(",
"&",
"gpd",
"->",
"id",
",",
"ID_RECALC_GEOMETRY",
")",
";",
"DEG_id_tag_update",
"(",
"&",
"gpd",
"->",
"id",
",",
"ID_RECALC_COPY_ON_WRITE",
")",
";",
"DEG_id_tag_update",
"(",
"&",
"gpd",
"->",
"id",
",",
"ID_RECALC_TRANSFORM",
"|",
"ID_RECALC_GEOMETRY",
")",
";",
"WM_event_add_notifier",
"(",
"C",
",",
"NC_GPENCIL",
"|",
"ND_DATA",
"|",
"NA_EDITED",
",",
"NULL",
")",
";",
"return",
"OPERATOR_FINISHED",
";",
"}"
] | Lock and hide any color non used in current layer | [
"Lock",
"and",
"hide",
"any",
"color",
"non",
"used",
"in",
"current",
"layer"
] | [
"/* sanity checks */",
"/* first lock and hide all colors */",
"/* loop all selected strokes and unlock any color used in active layer */",
"/* only editable and visible layers are considered */",
"/* skip strokes that are invalid for current view */",
"/* unlock/unhide color if not unlocked before */",
"/* updates */",
"/* copy on write tag is needed, or else no refresh happens */",
"/* notifiers */"
] | [
{
"param": "C",
"type": "bContext"
},
{
"param": "UNUSED",
"type": "wmOperator"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "UNUSED",
"type": "wmOperator",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
67ffc6adc9fbaf9078be5454a49a9db3600a66d4 | DemonRem/blender | source/blender/editors/gpencil/gpencil_data.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | gpencil_set_active_material_exec | int | static int gpencil_set_active_material_exec(bContext *C, wmOperator *op)
{
Object *ob = CTX_data_active_object(C);
bGPdata *gpd = ED_gpencil_data_get_active(C);
bool changed = false;
/* Sanity checks. */
if (gpd == NULL) {
BKE_report(op->reports, RPT_ERROR, "No Grease Pencil data");
return OPERATOR_CANCELLED;
}
/* Loop all selected strokes. */
GP_EDITABLE_STROKES_BEGIN (gpstroke_iter, C, gpl, gps) {
if (gps->flag & GP_STROKE_SELECT) {
/* Change Active material. */
ob->actcol = gps->mat_nr + 1;
changed = true;
break;
}
}
GP_EDITABLE_STROKES_END(gpstroke_iter);
/* notifiers */
if (changed) {
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
}
return OPERATOR_FINISHED;
} | /* ***************** Set selected stroke material the active material ************************ */ | Set selected stroke material the active material | [
"Set",
"selected",
"stroke",
"material",
"the",
"active",
"material"
] | static int gpencil_set_active_material_exec(bContext *C, wmOperator *op)
{
Object *ob = CTX_data_active_object(C);
bGPdata *gpd = ED_gpencil_data_get_active(C);
bool changed = false;
if (gpd == NULL) {
BKE_report(op->reports, RPT_ERROR, "No Grease Pencil data");
return OPERATOR_CANCELLED;
}
GP_EDITABLE_STROKES_BEGIN (gpstroke_iter, C, gpl, gps) {
if (gps->flag & GP_STROKE_SELECT) {
ob->actcol = gps->mat_nr + 1;
changed = true;
break;
}
}
GP_EDITABLE_STROKES_END(gpstroke_iter);
if (changed) {
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
}
return OPERATOR_FINISHED;
} | [
"static",
"int",
"gpencil_set_active_material_exec",
"(",
"bContext",
"*",
"C",
",",
"wmOperator",
"*",
"op",
")",
"{",
"Object",
"*",
"ob",
"=",
"CTX_data_active_object",
"(",
"C",
")",
";",
"bGPdata",
"*",
"gpd",
"=",
"ED_gpencil_data_get_active",
"(",
"C",
")",
";",
"bool",
"changed",
"=",
"false",
";",
"if",
"(",
"gpd",
"==",
"NULL",
")",
"{",
"BKE_report",
"(",
"op",
"->",
"reports",
",",
"RPT_ERROR",
",",
"\"",
"\"",
")",
";",
"return",
"OPERATOR_CANCELLED",
";",
"}",
"GP_EDITABLE_STROKES_BEGIN",
"(",
"gpstroke_iter",
",",
"C",
",",
"gpl",
",",
"gps",
")",
"",
"{",
"if",
"(",
"gps",
"->",
"flag",
"&",
"GP_STROKE_SELECT",
")",
"{",
"ob",
"->",
"actcol",
"=",
"gps",
"->",
"mat_nr",
"+",
"1",
";",
"changed",
"=",
"true",
";",
"break",
";",
"}",
"}",
"GP_EDITABLE_STROKES_END",
"(",
"gpstroke_iter",
")",
";",
"if",
"(",
"changed",
")",
"{",
"WM_event_add_notifier",
"(",
"C",
",",
"NC_GPENCIL",
"|",
"ND_DATA",
"|",
"NA_EDITED",
",",
"NULL",
")",
";",
"}",
"return",
"OPERATOR_FINISHED",
";",
"}"
] | Set selected stroke material the active material | [
"Set",
"selected",
"stroke",
"material",
"the",
"active",
"material"
] | [
"/* Sanity checks. */",
"/* Loop all selected strokes. */",
"/* Change Active material. */",
"/* notifiers */"
] | [
{
"param": "C",
"type": "bContext"
},
{
"param": "op",
"type": "wmOperator"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "op",
"type": "wmOperator",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
748bf4db4e26187a536ec5406965bd7844625794 | DemonRem/blender | source/blender/modifiers/intern/MOD_fluidsim_util.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | fluidsim_read_obj | Mesh | static Mesh *fluidsim_read_obj(const char *filename, const MPoly *mp_example)
{
int wri = 0, i;
int gotBytes;
gzFile gzf;
int numverts = 0, numfaces = 0;
Mesh *mesh = NULL;
MPoly *mp;
MLoop *ml;
MVert *mv;
short *normals, *no_s;
float no[3];
const short mp_mat_nr = mp_example->mat_nr;
const char mp_flag = mp_example->flag;
/* ------------------------------------------------
* get numverts + numfaces first
* ------------------------------------------------ */
gzf = BLI_gzopen(filename, "rb");
if (!gzf) {
return NULL;
}
/* read numverts */
gotBytes = gzread(gzf, &wri, sizeof(wri));
numverts = wri;
/* skip verts */
gotBytes = gzseek(gzf, numverts * 3 * sizeof(float), SEEK_CUR) != -1;
/* read number of normals */
if (gotBytes) {
gotBytes = gzread(gzf, &wri, sizeof(wri));
}
/* skip normals */
gotBytes = gzseek(gzf, numverts * 3 * sizeof(float), SEEK_CUR) != -1;
/* get no. of triangles */
if (gotBytes) {
gotBytes = gzread(gzf, &wri, sizeof(wri));
}
numfaces = wri;
gzclose(gzf);
/* ------------------------------------------------ */
if (!numfaces || !numverts || !gotBytes) {
return NULL;
}
gzf = BLI_gzopen(filename, "rb");
if (!gzf) {
return NULL;
}
mesh = BKE_mesh_new_nomain(numverts, 0, 0, numfaces * 3, numfaces);
if (!mesh) {
gzclose(gzf);
return NULL;
}
/* read numverts */
gotBytes = gzread(gzf, &wri, sizeof(wri));
/* read vertex position from file */
mv = mesh->mvert;
for (i = 0; i < numverts; i++, mv++) {
gotBytes = gzread(gzf, mv->co, sizeof(float) * 3);
}
/* should be the same as numverts */
gotBytes = gzread(gzf, &wri, sizeof(wri));
if (wri != numverts) {
if (mesh) {
BKE_id_free(NULL, mesh);
}
gzclose(gzf);
return NULL;
}
normals = MEM_calloc_arrayN(numverts, 3 * sizeof(short), "fluid_tmp_normals");
if (!normals) {
if (mesh) {
BKE_id_free(NULL, mesh);
}
gzclose(gzf);
return NULL;
}
/* read normals from file (but don't save them yet) */
for (i = numverts, no_s = normals; i > 0; i--, no_s += 3) {
gotBytes = gzread(gzf, no, sizeof(float) * 3);
normal_float_to_short_v3(no_s, no);
}
/* read no. of triangles */
gotBytes = gzread(gzf, &wri, sizeof(wri));
if (wri != numfaces) {
printf("Fluidsim: error in reading data from file.\n");
if (mesh) {
BKE_id_free(NULL, mesh);
}
gzclose(gzf);
MEM_freeN(normals);
return NULL;
}
/* read triangles from file */
mp = mesh->mpoly;
ml = mesh->mloop;
for (i = 0; i < numfaces; i++, mp++, ml += 3) {
int face[3];
gotBytes = gzread(gzf, face, sizeof(int) * 3);
/* initialize from existing face */
mp->mat_nr = mp_mat_nr;
mp->flag = mp_flag;
mp->loopstart = i * 3;
mp->totloop = 3;
ml[0].v = face[0];
ml[1].v = face[1];
ml[2].v = face[2];
}
gzclose(gzf);
BKE_mesh_calc_edges(mesh, false, false);
BKE_mesh_vert_normals_apply(mesh, (short(*)[3])normals);
MEM_freeN(normals);
// CDDM_calc_normals(result);
return mesh;
} | /* read .bobj.gz file into a fluidsimMesh struct */ | read .bobj.gz file into a fluidsimMesh struct | [
"read",
".",
"bobj",
".",
"gz",
"file",
"into",
"a",
"fluidsimMesh",
"struct"
] | static Mesh *fluidsim_read_obj(const char *filename, const MPoly *mp_example)
{
int wri = 0, i;
int gotBytes;
gzFile gzf;
int numverts = 0, numfaces = 0;
Mesh *mesh = NULL;
MPoly *mp;
MLoop *ml;
MVert *mv;
short *normals, *no_s;
float no[3];
const short mp_mat_nr = mp_example->mat_nr;
const char mp_flag = mp_example->flag;
gzf = BLI_gzopen(filename, "rb");
if (!gzf) {
return NULL;
}
gotBytes = gzread(gzf, &wri, sizeof(wri));
numverts = wri;
gotBytes = gzseek(gzf, numverts * 3 * sizeof(float), SEEK_CUR) != -1;
if (gotBytes) {
gotBytes = gzread(gzf, &wri, sizeof(wri));
}
gotBytes = gzseek(gzf, numverts * 3 * sizeof(float), SEEK_CUR) != -1;
if (gotBytes) {
gotBytes = gzread(gzf, &wri, sizeof(wri));
}
numfaces = wri;
gzclose(gzf);
if (!numfaces || !numverts || !gotBytes) {
return NULL;
}
gzf = BLI_gzopen(filename, "rb");
if (!gzf) {
return NULL;
}
mesh = BKE_mesh_new_nomain(numverts, 0, 0, numfaces * 3, numfaces);
if (!mesh) {
gzclose(gzf);
return NULL;
}
gotBytes = gzread(gzf, &wri, sizeof(wri));
mv = mesh->mvert;
for (i = 0; i < numverts; i++, mv++) {
gotBytes = gzread(gzf, mv->co, sizeof(float) * 3);
}
gotBytes = gzread(gzf, &wri, sizeof(wri));
if (wri != numverts) {
if (mesh) {
BKE_id_free(NULL, mesh);
}
gzclose(gzf);
return NULL;
}
normals = MEM_calloc_arrayN(numverts, 3 * sizeof(short), "fluid_tmp_normals");
if (!normals) {
if (mesh) {
BKE_id_free(NULL, mesh);
}
gzclose(gzf);
return NULL;
}
for (i = numverts, no_s = normals; i > 0; i--, no_s += 3) {
gotBytes = gzread(gzf, no, sizeof(float) * 3);
normal_float_to_short_v3(no_s, no);
}
gotBytes = gzread(gzf, &wri, sizeof(wri));
if (wri != numfaces) {
printf("Fluidsim: error in reading data from file.\n");
if (mesh) {
BKE_id_free(NULL, mesh);
}
gzclose(gzf);
MEM_freeN(normals);
return NULL;
}
mp = mesh->mpoly;
ml = mesh->mloop;
for (i = 0; i < numfaces; i++, mp++, ml += 3) {
int face[3];
gotBytes = gzread(gzf, face, sizeof(int) * 3);
mp->mat_nr = mp_mat_nr;
mp->flag = mp_flag;
mp->loopstart = i * 3;
mp->totloop = 3;
ml[0].v = face[0];
ml[1].v = face[1];
ml[2].v = face[2];
}
gzclose(gzf);
BKE_mesh_calc_edges(mesh, false, false);
BKE_mesh_vert_normals_apply(mesh, (short(*)[3])normals);
MEM_freeN(normals);
return mesh;
} | [
"static",
"Mesh",
"*",
"fluidsim_read_obj",
"(",
"const",
"char",
"*",
"filename",
",",
"const",
"MPoly",
"*",
"mp_example",
")",
"{",
"int",
"wri",
"=",
"0",
",",
"i",
";",
"int",
"gotBytes",
";",
"gzFile",
"gzf",
";",
"int",
"numverts",
"=",
"0",
",",
"numfaces",
"=",
"0",
";",
"Mesh",
"*",
"mesh",
"=",
"NULL",
";",
"MPoly",
"*",
"mp",
";",
"MLoop",
"*",
"ml",
";",
"MVert",
"*",
"mv",
";",
"short",
"*",
"normals",
",",
"*",
"no_s",
";",
"float",
"no",
"[",
"3",
"]",
";",
"const",
"short",
"mp_mat_nr",
"=",
"mp_example",
"->",
"mat_nr",
";",
"const",
"char",
"mp_flag",
"=",
"mp_example",
"->",
"flag",
";",
"gzf",
"=",
"BLI_gzopen",
"(",
"filename",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"!",
"gzf",
")",
"{",
"return",
"NULL",
";",
"}",
"gotBytes",
"=",
"gzread",
"(",
"gzf",
",",
"&",
"wri",
",",
"sizeof",
"(",
"wri",
")",
")",
";",
"numverts",
"=",
"wri",
";",
"gotBytes",
"=",
"gzseek",
"(",
"gzf",
",",
"numverts",
"*",
"3",
"*",
"sizeof",
"(",
"float",
")",
",",
"SEEK_CUR",
")",
"!=",
"-1",
";",
"if",
"(",
"gotBytes",
")",
"{",
"gotBytes",
"=",
"gzread",
"(",
"gzf",
",",
"&",
"wri",
",",
"sizeof",
"(",
"wri",
")",
")",
";",
"}",
"gotBytes",
"=",
"gzseek",
"(",
"gzf",
",",
"numverts",
"*",
"3",
"*",
"sizeof",
"(",
"float",
")",
",",
"SEEK_CUR",
")",
"!=",
"-1",
";",
"if",
"(",
"gotBytes",
")",
"{",
"gotBytes",
"=",
"gzread",
"(",
"gzf",
",",
"&",
"wri",
",",
"sizeof",
"(",
"wri",
")",
")",
";",
"}",
"numfaces",
"=",
"wri",
";",
"gzclose",
"(",
"gzf",
")",
";",
"if",
"(",
"!",
"numfaces",
"||",
"!",
"numverts",
"||",
"!",
"gotBytes",
")",
"{",
"return",
"NULL",
";",
"}",
"gzf",
"=",
"BLI_gzopen",
"(",
"filename",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"!",
"gzf",
")",
"{",
"return",
"NULL",
";",
"}",
"mesh",
"=",
"BKE_mesh_new_nomain",
"(",
"numverts",
",",
"0",
",",
"0",
",",
"numfaces",
"*",
"3",
",",
"numfaces",
")",
";",
"if",
"(",
"!",
"mesh",
")",
"{",
"gzclose",
"(",
"gzf",
")",
";",
"return",
"NULL",
";",
"}",
"gotBytes",
"=",
"gzread",
"(",
"gzf",
",",
"&",
"wri",
",",
"sizeof",
"(",
"wri",
")",
")",
";",
"mv",
"=",
"mesh",
"->",
"mvert",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"numverts",
";",
"i",
"++",
",",
"mv",
"++",
")",
"{",
"gotBytes",
"=",
"gzread",
"(",
"gzf",
",",
"mv",
"->",
"co",
",",
"sizeof",
"(",
"float",
")",
"*",
"3",
")",
";",
"}",
"gotBytes",
"=",
"gzread",
"(",
"gzf",
",",
"&",
"wri",
",",
"sizeof",
"(",
"wri",
")",
")",
";",
"if",
"(",
"wri",
"!=",
"numverts",
")",
"{",
"if",
"(",
"mesh",
")",
"{",
"BKE_id_free",
"(",
"NULL",
",",
"mesh",
")",
";",
"}",
"gzclose",
"(",
"gzf",
")",
";",
"return",
"NULL",
";",
"}",
"normals",
"=",
"MEM_calloc_arrayN",
"(",
"numverts",
",",
"3",
"*",
"sizeof",
"(",
"short",
")",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"!",
"normals",
")",
"{",
"if",
"(",
"mesh",
")",
"{",
"BKE_id_free",
"(",
"NULL",
",",
"mesh",
")",
";",
"}",
"gzclose",
"(",
"gzf",
")",
";",
"return",
"NULL",
";",
"}",
"for",
"(",
"i",
"=",
"numverts",
",",
"no_s",
"=",
"normals",
";",
"i",
">",
"0",
";",
"i",
"--",
",",
"no_s",
"+=",
"3",
")",
"{",
"gotBytes",
"=",
"gzread",
"(",
"gzf",
",",
"no",
",",
"sizeof",
"(",
"float",
")",
"*",
"3",
")",
";",
"normal_float_to_short_v3",
"(",
"no_s",
",",
"no",
")",
";",
"}",
"gotBytes",
"=",
"gzread",
"(",
"gzf",
",",
"&",
"wri",
",",
"sizeof",
"(",
"wri",
")",
")",
";",
"if",
"(",
"wri",
"!=",
"numfaces",
")",
"{",
"printf",
"(",
"\"",
"\\n",
"\"",
")",
";",
"if",
"(",
"mesh",
")",
"{",
"BKE_id_free",
"(",
"NULL",
",",
"mesh",
")",
";",
"}",
"gzclose",
"(",
"gzf",
")",
";",
"MEM_freeN",
"(",
"normals",
")",
";",
"return",
"NULL",
";",
"}",
"mp",
"=",
"mesh",
"->",
"mpoly",
";",
"ml",
"=",
"mesh",
"->",
"mloop",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"numfaces",
";",
"i",
"++",
",",
"mp",
"++",
",",
"ml",
"+=",
"3",
")",
"{",
"int",
"face",
"[",
"3",
"]",
";",
"gotBytes",
"=",
"gzread",
"(",
"gzf",
",",
"face",
",",
"sizeof",
"(",
"int",
")",
"*",
"3",
")",
";",
"mp",
"->",
"mat_nr",
"=",
"mp_mat_nr",
";",
"mp",
"->",
"flag",
"=",
"mp_flag",
";",
"mp",
"->",
"loopstart",
"=",
"i",
"*",
"3",
";",
"mp",
"->",
"totloop",
"=",
"3",
";",
"ml",
"[",
"0",
"]",
".",
"v",
"=",
"face",
"[",
"0",
"]",
";",
"ml",
"[",
"1",
"]",
".",
"v",
"=",
"face",
"[",
"1",
"]",
";",
"ml",
"[",
"2",
"]",
".",
"v",
"=",
"face",
"[",
"2",
"]",
";",
"}",
"gzclose",
"(",
"gzf",
")",
";",
"BKE_mesh_calc_edges",
"(",
"mesh",
",",
"false",
",",
"false",
")",
";",
"BKE_mesh_vert_normals_apply",
"(",
"mesh",
",",
"(",
"short",
"(",
"*",
")",
"[",
"3",
"]",
")",
"normals",
")",
";",
"MEM_freeN",
"(",
"normals",
")",
";",
"return",
"mesh",
";",
"}"
] | read .bobj.gz file into a fluidsimMesh struct | [
"read",
".",
"bobj",
".",
"gz",
"file",
"into",
"a",
"fluidsimMesh",
"struct"
] | [
"/* ------------------------------------------------\n * get numverts + numfaces first\n * ------------------------------------------------ */",
"/* read numverts */",
"/* skip verts */",
"/* read number of normals */",
"/* skip normals */",
"/* get no. of triangles */",
"/* ------------------------------------------------ */",
"/* read numverts */",
"/* read vertex position from file */",
"/* should be the same as numverts */",
"/* read normals from file (but don't save them yet) */",
"/* read no. of triangles */",
"/* read triangles from file */",
"/* initialize from existing face */",
"// CDDM_calc_normals(result);"
] | [
{
"param": "filename",
"type": "char"
},
{
"param": "mp_example",
"type": "MPoly"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mp_example",
"type": "MPoly",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
748bf4db4e26187a536ec5406965bd7844625794 | DemonRem/blender | source/blender/modifiers/intern/MOD_fluidsim_util.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | fluidsim_read_vel_cache | void | static void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, Mesh *mesh, char *filename)
{
int wri, i, j;
float wrf;
gzFile gzf;
FluidsimSettings *fss = fluidmd->fss;
int len = strlen(filename);
int totvert = mesh->totvert;
FluidVertexVelocity *velarray = NULL;
/* mesh and vverts have to be valid from loading... */
if (fss->meshVelocities) {
MEM_freeN(fss->meshVelocities);
}
if (len < 7) {
return;
}
if (fss->domainNovecgen > 0) {
return;
}
fss->meshVelocities = MEM_calloc_arrayN(
mesh->totvert, sizeof(FluidVertexVelocity), "Fluidsim_velocities");
fss->totvert = totvert;
velarray = fss->meshVelocities;
/* .bobj.gz, correct filename
* 87654321 */
filename[len - 6] = 'v';
filename[len - 5] = 'e';
filename[len - 4] = 'l';
gzf = BLI_gzopen(filename, "rb");
if (!gzf) {
MEM_freeN(fss->meshVelocities);
fss->meshVelocities = NULL;
return;
}
gzread(gzf, &wri, sizeof(wri));
if (wri != totvert) {
MEM_freeN(fss->meshVelocities);
fss->meshVelocities = NULL;
return;
}
for (i = 0; i < totvert; i++) {
for (j = 0; j < 3; j++) {
gzread(gzf, &wrf, sizeof(wrf));
velarray[i].vel[j] = wrf;
}
}
gzclose(gzf);
} | /* read zipped fluidsim velocities into the co's of the fluidsimsettings normals struct */ | read zipped fluidsim velocities into the co's of the fluidsimsettings normals struct | [
"read",
"zipped",
"fluidsim",
"velocities",
"into",
"the",
"co",
"'",
"s",
"of",
"the",
"fluidsimsettings",
"normals",
"struct"
] | static void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, Mesh *mesh, char *filename)
{
int wri, i, j;
float wrf;
gzFile gzf;
FluidsimSettings *fss = fluidmd->fss;
int len = strlen(filename);
int totvert = mesh->totvert;
FluidVertexVelocity *velarray = NULL;
if (fss->meshVelocities) {
MEM_freeN(fss->meshVelocities);
}
if (len < 7) {
return;
}
if (fss->domainNovecgen > 0) {
return;
}
fss->meshVelocities = MEM_calloc_arrayN(
mesh->totvert, sizeof(FluidVertexVelocity), "Fluidsim_velocities");
fss->totvert = totvert;
velarray = fss->meshVelocities;
filename[len - 6] = 'v';
filename[len - 5] = 'e';
filename[len - 4] = 'l';
gzf = BLI_gzopen(filename, "rb");
if (!gzf) {
MEM_freeN(fss->meshVelocities);
fss->meshVelocities = NULL;
return;
}
gzread(gzf, &wri, sizeof(wri));
if (wri != totvert) {
MEM_freeN(fss->meshVelocities);
fss->meshVelocities = NULL;
return;
}
for (i = 0; i < totvert; i++) {
for (j = 0; j < 3; j++) {
gzread(gzf, &wrf, sizeof(wrf));
velarray[i].vel[j] = wrf;
}
}
gzclose(gzf);
} | [
"static",
"void",
"fluidsim_read_vel_cache",
"(",
"FluidsimModifierData",
"*",
"fluidmd",
",",
"Mesh",
"*",
"mesh",
",",
"char",
"*",
"filename",
")",
"{",
"int",
"wri",
",",
"i",
",",
"j",
";",
"float",
"wrf",
";",
"gzFile",
"gzf",
";",
"FluidsimSettings",
"*",
"fss",
"=",
"fluidmd",
"->",
"fss",
";",
"int",
"len",
"=",
"strlen",
"(",
"filename",
")",
";",
"int",
"totvert",
"=",
"mesh",
"->",
"totvert",
";",
"FluidVertexVelocity",
"*",
"velarray",
"=",
"NULL",
";",
"if",
"(",
"fss",
"->",
"meshVelocities",
")",
"{",
"MEM_freeN",
"(",
"fss",
"->",
"meshVelocities",
")",
";",
"}",
"if",
"(",
"len",
"<",
"7",
")",
"{",
"return",
";",
"}",
"if",
"(",
"fss",
"->",
"domainNovecgen",
">",
"0",
")",
"{",
"return",
";",
"}",
"fss",
"->",
"meshVelocities",
"=",
"MEM_calloc_arrayN",
"(",
"mesh",
"->",
"totvert",
",",
"sizeof",
"(",
"FluidVertexVelocity",
")",
",",
"\"",
"\"",
")",
";",
"fss",
"->",
"totvert",
"=",
"totvert",
";",
"velarray",
"=",
"fss",
"->",
"meshVelocities",
";",
"filename",
"[",
"len",
"-",
"6",
"]",
"=",
"'",
"'",
";",
"filename",
"[",
"len",
"-",
"5",
"]",
"=",
"'",
"'",
";",
"filename",
"[",
"len",
"-",
"4",
"]",
"=",
"'",
"'",
";",
"gzf",
"=",
"BLI_gzopen",
"(",
"filename",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"!",
"gzf",
")",
"{",
"MEM_freeN",
"(",
"fss",
"->",
"meshVelocities",
")",
";",
"fss",
"->",
"meshVelocities",
"=",
"NULL",
";",
"return",
";",
"}",
"gzread",
"(",
"gzf",
",",
"&",
"wri",
",",
"sizeof",
"(",
"wri",
")",
")",
";",
"if",
"(",
"wri",
"!=",
"totvert",
")",
"{",
"MEM_freeN",
"(",
"fss",
"->",
"meshVelocities",
")",
";",
"fss",
"->",
"meshVelocities",
"=",
"NULL",
";",
"return",
";",
"}",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"totvert",
";",
"i",
"++",
")",
"{",
"for",
"(",
"j",
"=",
"0",
";",
"j",
"<",
"3",
";",
"j",
"++",
")",
"{",
"gzread",
"(",
"gzf",
",",
"&",
"wrf",
",",
"sizeof",
"(",
"wrf",
")",
")",
";",
"velarray",
"[",
"i",
"]",
".",
"vel",
"[",
"j",
"]",
"=",
"wrf",
";",
"}",
"}",
"gzclose",
"(",
"gzf",
")",
";",
"}"
] | read zipped fluidsim velocities into the co's of the fluidsimsettings normals struct | [
"read",
"zipped",
"fluidsim",
"velocities",
"into",
"the",
"co",
"'",
"s",
"of",
"the",
"fluidsimsettings",
"normals",
"struct"
] | [
"/* mesh and vverts have to be valid from loading... */",
"/* .bobj.gz, correct filename\n * 87654321 */"
] | [
{
"param": "fluidmd",
"type": "FluidsimModifierData"
},
{
"param": "mesh",
"type": "Mesh"
},
{
"param": "filename",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fluidmd",
"type": "FluidsimModifierData",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mesh",
"type": "Mesh",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c6994dab72d351a2ed247ad30d9cb288bb0d6189 | DemonRem/blender | source/blender/editors/space_node/node_templates.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | node_link_item_compare | bool | static bool node_link_item_compare(bNode *node, NodeLinkItem *item)
{
if (ELEM(node->type, NODE_GROUP, NODE_CUSTOM_GROUP)) {
return (node->id == (ID *)item->ngroup);
}
else {
return true;
}
} | /* Compare an existing node to a link item to see if it can be reused.
* item must be for the same node type!
* XXX should become a node type callback
*/ | Compare an existing node to a link item to see if it can be reused.
item must be for the same node type.
XXX should become a node type callback | [
"Compare",
"an",
"existing",
"node",
"to",
"a",
"link",
"item",
"to",
"see",
"if",
"it",
"can",
"be",
"reused",
".",
"item",
"must",
"be",
"for",
"the",
"same",
"node",
"type",
".",
"XXX",
"should",
"become",
"a",
"node",
"type",
"callback"
] | static bool node_link_item_compare(bNode *node, NodeLinkItem *item)
{
if (ELEM(node->type, NODE_GROUP, NODE_CUSTOM_GROUP)) {
return (node->id == (ID *)item->ngroup);
}
else {
return true;
}
} | [
"static",
"bool",
"node_link_item_compare",
"(",
"bNode",
"*",
"node",
",",
"NodeLinkItem",
"*",
"item",
")",
"{",
"if",
"(",
"ELEM",
"(",
"node",
"->",
"type",
",",
"NODE_GROUP",
",",
"NODE_CUSTOM_GROUP",
")",
")",
"{",
"return",
"(",
"node",
"->",
"id",
"==",
"(",
"ID",
"*",
")",
"item",
"->",
"ngroup",
")",
";",
"}",
"else",
"{",
"return",
"true",
";",
"}",
"}"
] | Compare an existing node to a link item to see if it can be reused. | [
"Compare",
"an",
"existing",
"node",
"to",
"a",
"link",
"item",
"to",
"see",
"if",
"it",
"can",
"be",
"reused",
"."
] | [] | [
{
"param": "node",
"type": "bNode"
},
{
"param": "item",
"type": "NodeLinkItem"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "node",
"type": "bNode",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "item",
"type": "NodeLinkItem",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c6994dab72d351a2ed247ad30d9cb288bb0d6189 | DemonRem/blender | source/blender/editors/space_node/node_templates.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | node_socket_disconnect | void | static void node_socket_disconnect(Main *bmain,
bNodeTree *ntree,
bNode *node_to,
bNodeSocket *sock_to)
{
if (!sock_to->link) {
return;
}
nodeRemLink(ntree, sock_to->link);
sock_to->flag |= SOCK_COLLAPSED;
nodeUpdate(ntree, node_to);
ntreeUpdateTree(bmain, ntree);
ED_node_tag_update_nodetree(bmain, ntree, node_to);
} | /* disconnect socket from the node it is connected to */ | disconnect socket from the node it is connected to | [
"disconnect",
"socket",
"from",
"the",
"node",
"it",
"is",
"connected",
"to"
] | static void node_socket_disconnect(Main *bmain,
bNodeTree *ntree,
bNode *node_to,
bNodeSocket *sock_to)
{
if (!sock_to->link) {
return;
}
nodeRemLink(ntree, sock_to->link);
sock_to->flag |= SOCK_COLLAPSED;
nodeUpdate(ntree, node_to);
ntreeUpdateTree(bmain, ntree);
ED_node_tag_update_nodetree(bmain, ntree, node_to);
} | [
"static",
"void",
"node_socket_disconnect",
"(",
"Main",
"*",
"bmain",
",",
"bNodeTree",
"*",
"ntree",
",",
"bNode",
"*",
"node_to",
",",
"bNodeSocket",
"*",
"sock_to",
")",
"{",
"if",
"(",
"!",
"sock_to",
"->",
"link",
")",
"{",
"return",
";",
"}",
"nodeRemLink",
"(",
"ntree",
",",
"sock_to",
"->",
"link",
")",
";",
"sock_to",
"->",
"flag",
"|=",
"SOCK_COLLAPSED",
";",
"nodeUpdate",
"(",
"ntree",
",",
"node_to",
")",
";",
"ntreeUpdateTree",
"(",
"bmain",
",",
"ntree",
")",
";",
"ED_node_tag_update_nodetree",
"(",
"bmain",
",",
"ntree",
",",
"node_to",
")",
";",
"}"
] | disconnect socket from the node it is connected to | [
"disconnect",
"socket",
"from",
"the",
"node",
"it",
"is",
"connected",
"to"
] | [] | [
{
"param": "bmain",
"type": "Main"
},
{
"param": "ntree",
"type": "bNodeTree"
},
{
"param": "node_to",
"type": "bNode"
},
{
"param": "sock_to",
"type": "bNodeSocket"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bmain",
"type": "Main",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ntree",
"type": "bNodeTree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "node_to",
"type": "bNode",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "sock_to",
"type": "bNodeSocket",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c6994dab72d351a2ed247ad30d9cb288bb0d6189 | DemonRem/blender | source/blender/editors/space_node/node_templates.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | node_socket_remove | void | static void node_socket_remove(Main *bmain, bNodeTree *ntree, bNode *node_to, bNodeSocket *sock_to)
{
if (!sock_to->link) {
return;
}
node_remove_linked(bmain, ntree, sock_to->link->fromnode);
sock_to->flag |= SOCK_COLLAPSED;
nodeUpdate(ntree, node_to);
ntreeUpdateTree(bmain, ntree);
ED_node_tag_update_nodetree(bmain, ntree, node_to);
} | /* remove all nodes connected to this socket, if they aren't connected to other nodes */ | remove all nodes connected to this socket, if they aren't connected to other nodes | [
"remove",
"all",
"nodes",
"connected",
"to",
"this",
"socket",
"if",
"they",
"aren",
"'",
"t",
"connected",
"to",
"other",
"nodes"
] | static void node_socket_remove(Main *bmain, bNodeTree *ntree, bNode *node_to, bNodeSocket *sock_to)
{
if (!sock_to->link) {
return;
}
node_remove_linked(bmain, ntree, sock_to->link->fromnode);
sock_to->flag |= SOCK_COLLAPSED;
nodeUpdate(ntree, node_to);
ntreeUpdateTree(bmain, ntree);
ED_node_tag_update_nodetree(bmain, ntree, node_to);
} | [
"static",
"void",
"node_socket_remove",
"(",
"Main",
"*",
"bmain",
",",
"bNodeTree",
"*",
"ntree",
",",
"bNode",
"*",
"node_to",
",",
"bNodeSocket",
"*",
"sock_to",
")",
"{",
"if",
"(",
"!",
"sock_to",
"->",
"link",
")",
"{",
"return",
";",
"}",
"node_remove_linked",
"(",
"bmain",
",",
"ntree",
",",
"sock_to",
"->",
"link",
"->",
"fromnode",
")",
";",
"sock_to",
"->",
"flag",
"|=",
"SOCK_COLLAPSED",
";",
"nodeUpdate",
"(",
"ntree",
",",
"node_to",
")",
";",
"ntreeUpdateTree",
"(",
"bmain",
",",
"ntree",
")",
";",
"ED_node_tag_update_nodetree",
"(",
"bmain",
",",
"ntree",
",",
"node_to",
")",
";",
"}"
] | remove all nodes connected to this socket, if they aren't connected to other nodes | [
"remove",
"all",
"nodes",
"connected",
"to",
"this",
"socket",
"if",
"they",
"aren",
"'",
"t",
"connected",
"to",
"other",
"nodes"
] | [] | [
{
"param": "bmain",
"type": "Main"
},
{
"param": "ntree",
"type": "bNodeTree"
},
{
"param": "node_to",
"type": "bNode"
},
{
"param": "sock_to",
"type": "bNodeSocket"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bmain",
"type": "Main",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ntree",
"type": "bNodeTree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "node_to",
"type": "bNode",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "sock_to",
"type": "bNodeSocket",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c6994dab72d351a2ed247ad30d9cb288bb0d6189 | DemonRem/blender | source/blender/editors/space_node/node_templates.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | node_socket_add_replace | void | static void node_socket_add_replace(const bContext *C,
bNodeTree *ntree,
bNode *node_to,
bNodeSocket *sock_to,
int type,
NodeLinkItem *item)
{
Main *bmain = CTX_data_main(C);
bNode *node_from;
bNodeSocket *sock_from_tmp;
bNode *node_prev = NULL;
/* unlink existing node */
if (sock_to->link) {
node_prev = sock_to->link->fromnode;
nodeRemLink(ntree, sock_to->link);
}
/* find existing node that we can use */
for (node_from = ntree->nodes.first; node_from; node_from = node_from->next) {
if (node_from->type == type) {
break;
}
}
if (node_from) {
if (node_from->inputs.first || node_from->typeinfo->draw_buttons ||
node_from->typeinfo->draw_buttons_ex) {
node_from = NULL;
}
}
if (node_prev && node_prev->type == type && node_link_item_compare(node_prev, item)) {
/* keep the previous node if it's the same type */
node_from = node_prev;
}
else if (!node_from) {
node_from = nodeAddStaticNode(C, ntree, type);
if (node_prev != NULL) {
/* If we're replacing existing node, use its location. */
node_from->locx = node_prev->locx;
node_from->locy = node_prev->locy;
node_from->offsetx = node_prev->offsetx;
node_from->offsety = node_prev->offsety;
}
else {
sock_from_tmp = BLI_findlink(&node_from->outputs, item->socket_index);
nodePositionRelative(node_from, node_to, sock_from_tmp, sock_to);
}
node_link_item_apply(bmain, node_from, item);
}
nodeSetActive(ntree, node_from);
/* add link */
sock_from_tmp = BLI_findlink(&node_from->outputs, item->socket_index);
nodeAddLink(ntree, node_from, sock_from_tmp, node_to, sock_to);
sock_to->flag &= ~SOCK_COLLAPSED;
/* copy input sockets from previous node */
if (node_prev && node_from != node_prev) {
bNodeSocket *sock_prev, *sock_from;
for (sock_prev = node_prev->inputs.first; sock_prev; sock_prev = sock_prev->next) {
for (sock_from = node_from->inputs.first; sock_from; sock_from = sock_from->next) {
if (nodeCountSocketLinks(ntree, sock_from) >= sock_from->limit) {
continue;
}
if (STREQ(sock_prev->name, sock_from->name) && sock_prev->type == sock_from->type) {
bNodeLink *link = sock_prev->link;
if (link && link->fromnode) {
nodeAddLink(ntree, link->fromnode, link->fromsock, node_from, sock_from);
nodeRemLink(ntree, link);
}
node_socket_copy_default_value(sock_from, sock_prev);
}
}
}
/* also preserve mapping for texture nodes */
if (node_from->typeinfo->nclass == NODE_CLASS_TEXTURE &&
node_prev->typeinfo->nclass == NODE_CLASS_TEXTURE) {
memcpy(node_from->storage, node_prev->storage, sizeof(NodeTexBase));
}
/* remove node */
node_remove_linked(bmain, ntree, node_prev);
}
nodeUpdate(ntree, node_from);
nodeUpdate(ntree, node_to);
ntreeUpdateTree(CTX_data_main(C), ntree);
ED_node_tag_update_nodetree(CTX_data_main(C), ntree, node_to);
} | /* add new node connected to this socket, or replace an existing one */ | add new node connected to this socket, or replace an existing one | [
"add",
"new",
"node",
"connected",
"to",
"this",
"socket",
"or",
"replace",
"an",
"existing",
"one"
] | static void node_socket_add_replace(const bContext *C,
bNodeTree *ntree,
bNode *node_to,
bNodeSocket *sock_to,
int type,
NodeLinkItem *item)
{
Main *bmain = CTX_data_main(C);
bNode *node_from;
bNodeSocket *sock_from_tmp;
bNode *node_prev = NULL;
if (sock_to->link) {
node_prev = sock_to->link->fromnode;
nodeRemLink(ntree, sock_to->link);
}
for (node_from = ntree->nodes.first; node_from; node_from = node_from->next) {
if (node_from->type == type) {
break;
}
}
if (node_from) {
if (node_from->inputs.first || node_from->typeinfo->draw_buttons ||
node_from->typeinfo->draw_buttons_ex) {
node_from = NULL;
}
}
if (node_prev && node_prev->type == type && node_link_item_compare(node_prev, item)) {
node_from = node_prev;
}
else if (!node_from) {
node_from = nodeAddStaticNode(C, ntree, type);
if (node_prev != NULL) {
node_from->locx = node_prev->locx;
node_from->locy = node_prev->locy;
node_from->offsetx = node_prev->offsetx;
node_from->offsety = node_prev->offsety;
}
else {
sock_from_tmp = BLI_findlink(&node_from->outputs, item->socket_index);
nodePositionRelative(node_from, node_to, sock_from_tmp, sock_to);
}
node_link_item_apply(bmain, node_from, item);
}
nodeSetActive(ntree, node_from);
sock_from_tmp = BLI_findlink(&node_from->outputs, item->socket_index);
nodeAddLink(ntree, node_from, sock_from_tmp, node_to, sock_to);
sock_to->flag &= ~SOCK_COLLAPSED;
if (node_prev && node_from != node_prev) {
bNodeSocket *sock_prev, *sock_from;
for (sock_prev = node_prev->inputs.first; sock_prev; sock_prev = sock_prev->next) {
for (sock_from = node_from->inputs.first; sock_from; sock_from = sock_from->next) {
if (nodeCountSocketLinks(ntree, sock_from) >= sock_from->limit) {
continue;
}
if (STREQ(sock_prev->name, sock_from->name) && sock_prev->type == sock_from->type) {
bNodeLink *link = sock_prev->link;
if (link && link->fromnode) {
nodeAddLink(ntree, link->fromnode, link->fromsock, node_from, sock_from);
nodeRemLink(ntree, link);
}
node_socket_copy_default_value(sock_from, sock_prev);
}
}
}
if (node_from->typeinfo->nclass == NODE_CLASS_TEXTURE &&
node_prev->typeinfo->nclass == NODE_CLASS_TEXTURE) {
memcpy(node_from->storage, node_prev->storage, sizeof(NodeTexBase));
}
node_remove_linked(bmain, ntree, node_prev);
}
nodeUpdate(ntree, node_from);
nodeUpdate(ntree, node_to);
ntreeUpdateTree(CTX_data_main(C), ntree);
ED_node_tag_update_nodetree(CTX_data_main(C), ntree, node_to);
} | [
"static",
"void",
"node_socket_add_replace",
"(",
"const",
"bContext",
"*",
"C",
",",
"bNodeTree",
"*",
"ntree",
",",
"bNode",
"*",
"node_to",
",",
"bNodeSocket",
"*",
"sock_to",
",",
"int",
"type",
",",
"NodeLinkItem",
"*",
"item",
")",
"{",
"Main",
"*",
"bmain",
"=",
"CTX_data_main",
"(",
"C",
")",
";",
"bNode",
"*",
"node_from",
";",
"bNodeSocket",
"*",
"sock_from_tmp",
";",
"bNode",
"*",
"node_prev",
"=",
"NULL",
";",
"if",
"(",
"sock_to",
"->",
"link",
")",
"{",
"node_prev",
"=",
"sock_to",
"->",
"link",
"->",
"fromnode",
";",
"nodeRemLink",
"(",
"ntree",
",",
"sock_to",
"->",
"link",
")",
";",
"}",
"for",
"(",
"node_from",
"=",
"ntree",
"->",
"nodes",
".",
"first",
";",
"node_from",
";",
"node_from",
"=",
"node_from",
"->",
"next",
")",
"{",
"if",
"(",
"node_from",
"->",
"type",
"==",
"type",
")",
"{",
"break",
";",
"}",
"}",
"if",
"(",
"node_from",
")",
"{",
"if",
"(",
"node_from",
"->",
"inputs",
".",
"first",
"||",
"node_from",
"->",
"typeinfo",
"->",
"draw_buttons",
"||",
"node_from",
"->",
"typeinfo",
"->",
"draw_buttons_ex",
")",
"{",
"node_from",
"=",
"NULL",
";",
"}",
"}",
"if",
"(",
"node_prev",
"&&",
"node_prev",
"->",
"type",
"==",
"type",
"&&",
"node_link_item_compare",
"(",
"node_prev",
",",
"item",
")",
")",
"{",
"node_from",
"=",
"node_prev",
";",
"}",
"else",
"if",
"(",
"!",
"node_from",
")",
"{",
"node_from",
"=",
"nodeAddStaticNode",
"(",
"C",
",",
"ntree",
",",
"type",
")",
";",
"if",
"(",
"node_prev",
"!=",
"NULL",
")",
"{",
"node_from",
"->",
"locx",
"=",
"node_prev",
"->",
"locx",
";",
"node_from",
"->",
"locy",
"=",
"node_prev",
"->",
"locy",
";",
"node_from",
"->",
"offsetx",
"=",
"node_prev",
"->",
"offsetx",
";",
"node_from",
"->",
"offsety",
"=",
"node_prev",
"->",
"offsety",
";",
"}",
"else",
"{",
"sock_from_tmp",
"=",
"BLI_findlink",
"(",
"&",
"node_from",
"->",
"outputs",
",",
"item",
"->",
"socket_index",
")",
";",
"nodePositionRelative",
"(",
"node_from",
",",
"node_to",
",",
"sock_from_tmp",
",",
"sock_to",
")",
";",
"}",
"node_link_item_apply",
"(",
"bmain",
",",
"node_from",
",",
"item",
")",
";",
"}",
"nodeSetActive",
"(",
"ntree",
",",
"node_from",
")",
";",
"sock_from_tmp",
"=",
"BLI_findlink",
"(",
"&",
"node_from",
"->",
"outputs",
",",
"item",
"->",
"socket_index",
")",
";",
"nodeAddLink",
"(",
"ntree",
",",
"node_from",
",",
"sock_from_tmp",
",",
"node_to",
",",
"sock_to",
")",
";",
"sock_to",
"->",
"flag",
"&=",
"~",
"SOCK_COLLAPSED",
";",
"if",
"(",
"node_prev",
"&&",
"node_from",
"!=",
"node_prev",
")",
"{",
"bNodeSocket",
"*",
"sock_prev",
",",
"*",
"sock_from",
";",
"for",
"(",
"sock_prev",
"=",
"node_prev",
"->",
"inputs",
".",
"first",
";",
"sock_prev",
";",
"sock_prev",
"=",
"sock_prev",
"->",
"next",
")",
"{",
"for",
"(",
"sock_from",
"=",
"node_from",
"->",
"inputs",
".",
"first",
";",
"sock_from",
";",
"sock_from",
"=",
"sock_from",
"->",
"next",
")",
"{",
"if",
"(",
"nodeCountSocketLinks",
"(",
"ntree",
",",
"sock_from",
")",
">=",
"sock_from",
"->",
"limit",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"STREQ",
"(",
"sock_prev",
"->",
"name",
",",
"sock_from",
"->",
"name",
")",
"&&",
"sock_prev",
"->",
"type",
"==",
"sock_from",
"->",
"type",
")",
"{",
"bNodeLink",
"*",
"link",
"=",
"sock_prev",
"->",
"link",
";",
"if",
"(",
"link",
"&&",
"link",
"->",
"fromnode",
")",
"{",
"nodeAddLink",
"(",
"ntree",
",",
"link",
"->",
"fromnode",
",",
"link",
"->",
"fromsock",
",",
"node_from",
",",
"sock_from",
")",
";",
"nodeRemLink",
"(",
"ntree",
",",
"link",
")",
";",
"}",
"node_socket_copy_default_value",
"(",
"sock_from",
",",
"sock_prev",
")",
";",
"}",
"}",
"}",
"if",
"(",
"node_from",
"->",
"typeinfo",
"->",
"nclass",
"==",
"NODE_CLASS_TEXTURE",
"&&",
"node_prev",
"->",
"typeinfo",
"->",
"nclass",
"==",
"NODE_CLASS_TEXTURE",
")",
"{",
"memcpy",
"(",
"node_from",
"->",
"storage",
",",
"node_prev",
"->",
"storage",
",",
"sizeof",
"(",
"NodeTexBase",
")",
")",
";",
"}",
"node_remove_linked",
"(",
"bmain",
",",
"ntree",
",",
"node_prev",
")",
";",
"}",
"nodeUpdate",
"(",
"ntree",
",",
"node_from",
")",
";",
"nodeUpdate",
"(",
"ntree",
",",
"node_to",
")",
";",
"ntreeUpdateTree",
"(",
"CTX_data_main",
"(",
"C",
")",
",",
"ntree",
")",
";",
"ED_node_tag_update_nodetree",
"(",
"CTX_data_main",
"(",
"C",
")",
",",
"ntree",
",",
"node_to",
")",
";",
"}"
] | add new node connected to this socket, or replace an existing one | [
"add",
"new",
"node",
"connected",
"to",
"this",
"socket",
"or",
"replace",
"an",
"existing",
"one"
] | [
"/* unlink existing node */",
"/* find existing node that we can use */",
"/* keep the previous node if it's the same type */",
"/* If we're replacing existing node, use its location. */",
"/* add link */",
"/* copy input sockets from previous node */",
"/* also preserve mapping for texture nodes */",
"/* remove node */"
] | [
{
"param": "C",
"type": "bContext"
},
{
"param": "ntree",
"type": "bNodeTree"
},
{
"param": "node_to",
"type": "bNode"
},
{
"param": "sock_to",
"type": "bNodeSocket"
},
{
"param": "type",
"type": "int"
},
{
"param": "item",
"type": "NodeLinkItem"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ntree",
"type": "bNodeTree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "node_to",
"type": "bNode",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "sock_to",
"type": "bNodeSocket",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "item",
"type": "NodeLinkItem",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7e0110cbb99942f72af77638975cff53bccb2672 | DemonRem/blender | source/blender/draw/intern/draw_anim_viz.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | MPATH_cache_init | void | static void MPATH_cache_init(void *vedata)
{
MPATH_PassList *psl = ((MPATH_Data *)vedata)->psl;
{
DRWState state = DRW_STATE_WRITE_COLOR;
psl->lines = DRW_pass_create("Motionpath Line Pass", state);
}
{
DRWState state = DRW_STATE_WRITE_COLOR;
psl->points = DRW_pass_create("Motionpath Point Pass", state);
}
} | /* Here init all passes and shading groups
* Assume that all Passes are NULL */ | Here init all passes and shading groups
Assume that all Passes are NULL | [
"Here",
"init",
"all",
"passes",
"and",
"shading",
"groups",
"Assume",
"that",
"all",
"Passes",
"are",
"NULL"
] | static void MPATH_cache_init(void *vedata)
{
MPATH_PassList *psl = ((MPATH_Data *)vedata)->psl;
{
DRWState state = DRW_STATE_WRITE_COLOR;
psl->lines = DRW_pass_create("Motionpath Line Pass", state);
}
{
DRWState state = DRW_STATE_WRITE_COLOR;
psl->points = DRW_pass_create("Motionpath Point Pass", state);
}
} | [
"static",
"void",
"MPATH_cache_init",
"(",
"void",
"*",
"vedata",
")",
"{",
"MPATH_PassList",
"*",
"psl",
"=",
"(",
"(",
"MPATH_Data",
"*",
")",
"vedata",
")",
"->",
"psl",
";",
"{",
"DRWState",
"state",
"=",
"DRW_STATE_WRITE_COLOR",
";",
"psl",
"->",
"lines",
"=",
"DRW_pass_create",
"(",
"\"",
"\"",
",",
"state",
")",
";",
"}",
"{",
"DRWState",
"state",
"=",
"DRW_STATE_WRITE_COLOR",
";",
"psl",
"->",
"points",
"=",
"DRW_pass_create",
"(",
"\"",
"\"",
",",
"state",
")",
";",
"}",
"}"
] | Here init all passes and shading groups
Assume that all Passes are NULL | [
"Here",
"init",
"all",
"passes",
"and",
"shading",
"groups",
"Assume",
"that",
"all",
"Passes",
"are",
"NULL"
] | [] | [
{
"param": "vedata",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "vedata",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7e0110cbb99942f72af77638975cff53bccb2672 | DemonRem/blender | source/blender/draw/intern/draw_anim_viz.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | MPATH_draw_scene | void | static void MPATH_draw_scene(void *vedata)
{
MPATH_PassList *psl = ((MPATH_Data *)vedata)->psl;
DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
if (DRW_pass_is_empty(psl->lines) && DRW_pass_is_empty(psl->points)) {
/* Nothing to draw. */
return;
}
MULTISAMPLE_SYNC_ENABLE(dfbl, dtxl);
DRW_draw_pass(psl->lines);
DRW_draw_pass(psl->points);
MULTISAMPLE_SYNC_DISABLE_NO_DEPTH(dfbl, dtxl);
} | /* Draw time! Control rendering pipeline from here */ | Draw time. Control rendering pipeline from here | [
"Draw",
"time",
".",
"Control",
"rendering",
"pipeline",
"from",
"here"
] | static void MPATH_draw_scene(void *vedata)
{
MPATH_PassList *psl = ((MPATH_Data *)vedata)->psl;
DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
if (DRW_pass_is_empty(psl->lines) && DRW_pass_is_empty(psl->points)) {
return;
}
MULTISAMPLE_SYNC_ENABLE(dfbl, dtxl);
DRW_draw_pass(psl->lines);
DRW_draw_pass(psl->points);
MULTISAMPLE_SYNC_DISABLE_NO_DEPTH(dfbl, dtxl);
} | [
"static",
"void",
"MPATH_draw_scene",
"(",
"void",
"*",
"vedata",
")",
"{",
"MPATH_PassList",
"*",
"psl",
"=",
"(",
"(",
"MPATH_Data",
"*",
")",
"vedata",
")",
"->",
"psl",
";",
"DefaultFramebufferList",
"*",
"dfbl",
"=",
"DRW_viewport_framebuffer_list_get",
"(",
")",
";",
"DefaultTextureList",
"*",
"dtxl",
"=",
"DRW_viewport_texture_list_get",
"(",
")",
";",
"if",
"(",
"DRW_pass_is_empty",
"(",
"psl",
"->",
"lines",
")",
"&&",
"DRW_pass_is_empty",
"(",
"psl",
"->",
"points",
")",
")",
"{",
"return",
";",
"}",
"MULTISAMPLE_SYNC_ENABLE",
"(",
"dfbl",
",",
"dtxl",
")",
";",
"DRW_draw_pass",
"(",
"psl",
"->",
"lines",
")",
";",
"DRW_draw_pass",
"(",
"psl",
"->",
"points",
")",
";",
"MULTISAMPLE_SYNC_DISABLE_NO_DEPTH",
"(",
"dfbl",
",",
"dtxl",
")",
";",
"}"
] | Draw time! | [
"Draw",
"time!"
] | [
"/* Nothing to draw. */"
] | [
{
"param": "vedata",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "vedata",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
80e7e6312aa0494382039de277546ec051f6ae98 | DemonRem/blender | source/blender/editors/object/object_modes.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | ED_object_mode_compat_set | bool | bool ED_object_mode_compat_set(bContext *C, Object *ob, eObjectMode mode, ReportList *reports)
{
bool ok;
if (!ELEM(ob->mode, mode, OB_MODE_OBJECT)) {
const char *opstring = object_mode_op_string(ob->mode);
WM_operator_name_call(C, opstring, WM_OP_EXEC_REGION_WIN, NULL);
ok = ELEM(ob->mode, mode, OB_MODE_OBJECT);
if (!ok) {
wmOperatorType *ot = WM_operatortype_find(opstring, false);
BKE_reportf(reports, RPT_ERROR, "Unable to execute '%s', error changing modes", ot->name);
}
}
else {
ok = true;
}
return ok;
} | /**
* Sets the mode to a compatible state (use before entering the mode).
*
* This is so each mode's exec function can call
*/ | Sets the mode to a compatible state (use before entering the mode).
This is so each mode's exec function can call | [
"Sets",
"the",
"mode",
"to",
"a",
"compatible",
"state",
"(",
"use",
"before",
"entering",
"the",
"mode",
")",
".",
"This",
"is",
"so",
"each",
"mode",
"'",
"s",
"exec",
"function",
"can",
"call"
] | bool ED_object_mode_compat_set(bContext *C, Object *ob, eObjectMode mode, ReportList *reports)
{
bool ok;
if (!ELEM(ob->mode, mode, OB_MODE_OBJECT)) {
const char *opstring = object_mode_op_string(ob->mode);
WM_operator_name_call(C, opstring, WM_OP_EXEC_REGION_WIN, NULL);
ok = ELEM(ob->mode, mode, OB_MODE_OBJECT);
if (!ok) {
wmOperatorType *ot = WM_operatortype_find(opstring, false);
BKE_reportf(reports, RPT_ERROR, "Unable to execute '%s', error changing modes", ot->name);
}
}
else {
ok = true;
}
return ok;
} | [
"bool",
"ED_object_mode_compat_set",
"(",
"bContext",
"*",
"C",
",",
"Object",
"*",
"ob",
",",
"eObjectMode",
"mode",
",",
"ReportList",
"*",
"reports",
")",
"{",
"bool",
"ok",
";",
"if",
"(",
"!",
"ELEM",
"(",
"ob",
"->",
"mode",
",",
"mode",
",",
"OB_MODE_OBJECT",
")",
")",
"{",
"const",
"char",
"*",
"opstring",
"=",
"object_mode_op_string",
"(",
"ob",
"->",
"mode",
")",
";",
"WM_operator_name_call",
"(",
"C",
",",
"opstring",
",",
"WM_OP_EXEC_REGION_WIN",
",",
"NULL",
")",
";",
"ok",
"=",
"ELEM",
"(",
"ob",
"->",
"mode",
",",
"mode",
",",
"OB_MODE_OBJECT",
")",
";",
"if",
"(",
"!",
"ok",
")",
"{",
"wmOperatorType",
"*",
"ot",
"=",
"WM_operatortype_find",
"(",
"opstring",
",",
"false",
")",
";",
"BKE_reportf",
"(",
"reports",
",",
"RPT_ERROR",
",",
"\"",
"\"",
",",
"ot",
"->",
"name",
")",
";",
"}",
"}",
"else",
"{",
"ok",
"=",
"true",
";",
"}",
"return",
"ok",
";",
"}"
] | Sets the mode to a compatible state (use before entering the mode). | [
"Sets",
"the",
"mode",
"to",
"a",
"compatible",
"state",
"(",
"use",
"before",
"entering",
"the",
"mode",
")",
"."
] | [] | [
{
"param": "C",
"type": "bContext"
},
{
"param": "ob",
"type": "Object"
},
{
"param": "mode",
"type": "eObjectMode"
},
{
"param": "reports",
"type": "ReportList"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ob",
"type": "Object",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mode",
"type": "eObjectMode",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reports",
"type": "ReportList",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
80e7e6312aa0494382039de277546ec051f6ae98 | DemonRem/blender | source/blender/editors/object/object_modes.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | ED_object_mode_generic_enter | bool | bool ED_object_mode_generic_enter(struct bContext *C, eObjectMode object_mode)
{
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *ob = OBACT(view_layer);
if (ob == NULL) {
return (object_mode == OB_MODE_OBJECT);
}
if (ob->mode == object_mode) {
return true;
}
wmOperatorType *ot = WM_operatortype_find("OBJECT_OT_mode_set", false);
PointerRNA ptr;
WM_operator_properties_create_ptr(&ptr, ot);
RNA_enum_set(&ptr, "mode", object_mode);
WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &ptr);
WM_operator_properties_free(&ptr);
return (ob->mode == object_mode);
} | /* -------------------------------------------------------------------- */
/** \name Generic Mode Enter/Exit
*
* Supports exiting a mode without it being in the current context.
* This could be done for entering modes too if it's needed.
*
* \{ */ | \name Generic Mode Enter/Exit
Supports exiting a mode without it being in the current context.
This could be done for entering modes too if it's needed.
| [
"\\",
"name",
"Generic",
"Mode",
"Enter",
"/",
"Exit",
"Supports",
"exiting",
"a",
"mode",
"without",
"it",
"being",
"in",
"the",
"current",
"context",
".",
"This",
"could",
"be",
"done",
"for",
"entering",
"modes",
"too",
"if",
"it",
"'",
"s",
"needed",
"."
] | bool ED_object_mode_generic_enter(struct bContext *C, eObjectMode object_mode)
{
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *ob = OBACT(view_layer);
if (ob == NULL) {
return (object_mode == OB_MODE_OBJECT);
}
if (ob->mode == object_mode) {
return true;
}
wmOperatorType *ot = WM_operatortype_find("OBJECT_OT_mode_set", false);
PointerRNA ptr;
WM_operator_properties_create_ptr(&ptr, ot);
RNA_enum_set(&ptr, "mode", object_mode);
WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &ptr);
WM_operator_properties_free(&ptr);
return (ob->mode == object_mode);
} | [
"bool",
"ED_object_mode_generic_enter",
"(",
"struct",
"bContext",
"*",
"C",
",",
"eObjectMode",
"object_mode",
")",
"{",
"ViewLayer",
"*",
"view_layer",
"=",
"CTX_data_view_layer",
"(",
"C",
")",
";",
"Object",
"*",
"ob",
"=",
"OBACT",
"(",
"view_layer",
")",
";",
"if",
"(",
"ob",
"==",
"NULL",
")",
"{",
"return",
"(",
"object_mode",
"==",
"OB_MODE_OBJECT",
")",
";",
"}",
"if",
"(",
"ob",
"->",
"mode",
"==",
"object_mode",
")",
"{",
"return",
"true",
";",
"}",
"wmOperatorType",
"*",
"ot",
"=",
"WM_operatortype_find",
"(",
"\"",
"\"",
",",
"false",
")",
";",
"PointerRNA",
"ptr",
";",
"WM_operator_properties_create_ptr",
"(",
"&",
"ptr",
",",
"ot",
")",
";",
"RNA_enum_set",
"(",
"&",
"ptr",
",",
"\"",
"\"",
",",
"object_mode",
")",
";",
"WM_operator_name_call_ptr",
"(",
"C",
",",
"ot",
",",
"WM_OP_INVOKE_DEFAULT",
",",
"&",
"ptr",
")",
";",
"WM_operator_properties_free",
"(",
"&",
"ptr",
")",
";",
"return",
"(",
"ob",
"->",
"mode",
"==",
"object_mode",
")",
";",
"}"
] | \name Generic Mode Enter/Exit | [
"\\",
"name",
"Generic",
"Mode",
"Enter",
"/",
"Exit"
] | [] | [
{
"param": "C",
"type": "struct bContext"
},
{
"param": "object_mode",
"type": "eObjectMode"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "struct bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "object_mode",
"type": "eObjectMode",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
80e7e6312aa0494382039de277546ec051f6ae98 | DemonRem/blender | source/blender/editors/object/object_modes.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | ed_object_mode_generic_exit_ex | bool | static bool ed_object_mode_generic_exit_ex(struct Main *bmain,
struct Depsgraph *depsgraph,
struct Scene *scene,
struct Object *ob,
bool only_test)
{
BLI_assert((bmain == NULL) == only_test);
if (ob->mode & OB_MODE_EDIT) {
if (BKE_object_is_in_editmode(ob)) {
if (only_test) {
return true;
}
ED_object_editmode_exit_ex(bmain, scene, ob, EM_FREEDATA);
}
}
else if (ob->mode & OB_MODE_VERTEX_PAINT) {
if (ob->sculpt && (ob->sculpt->mode_type == OB_MODE_VERTEX_PAINT)) {
if (only_test) {
return true;
}
ED_object_vpaintmode_exit_ex(ob);
}
}
else if (ob->mode & OB_MODE_WEIGHT_PAINT) {
if (ob->sculpt && (ob->sculpt->mode_type == OB_MODE_WEIGHT_PAINT)) {
if (only_test) {
return true;
}
ED_object_wpaintmode_exit_ex(ob);
}
}
else if (ob->mode & OB_MODE_SCULPT) {
if (ob->sculpt && (ob->sculpt->mode_type == OB_MODE_SCULPT)) {
if (only_test) {
return true;
}
ED_object_sculptmode_exit_ex(bmain, depsgraph, scene, ob);
}
}
else if (ob->mode & OB_MODE_POSE) {
if (ob->pose != NULL) {
if (only_test) {
return true;
}
ED_object_posemode_exit_ex(bmain, ob);
}
}
else if ((ob->type == OB_GPENCIL) && ((ob->mode & OB_MODE_OBJECT) == 0)) {
if (only_test) {
return true;
}
ED_object_gpencil_exit(bmain, ob);
}
else {
if (only_test) {
return false;
}
BLI_assert((ob->mode & OB_MODE_ALL_MODE_DATA) == 0);
}
return false;
} | /**
* Use for changing works-paces or changing active object.
* Caller can check #OB_MODE_ALL_MODE_DATA to test if this needs to be run.
*/ | Use for changing works-paces or changing active object.
Caller can check #OB_MODE_ALL_MODE_DATA to test if this needs to be run. | [
"Use",
"for",
"changing",
"works",
"-",
"paces",
"or",
"changing",
"active",
"object",
".",
"Caller",
"can",
"check",
"#OB_MODE_ALL_MODE_DATA",
"to",
"test",
"if",
"this",
"needs",
"to",
"be",
"run",
"."
] | static bool ed_object_mode_generic_exit_ex(struct Main *bmain,
struct Depsgraph *depsgraph,
struct Scene *scene,
struct Object *ob,
bool only_test)
{
BLI_assert((bmain == NULL) == only_test);
if (ob->mode & OB_MODE_EDIT) {
if (BKE_object_is_in_editmode(ob)) {
if (only_test) {
return true;
}
ED_object_editmode_exit_ex(bmain, scene, ob, EM_FREEDATA);
}
}
else if (ob->mode & OB_MODE_VERTEX_PAINT) {
if (ob->sculpt && (ob->sculpt->mode_type == OB_MODE_VERTEX_PAINT)) {
if (only_test) {
return true;
}
ED_object_vpaintmode_exit_ex(ob);
}
}
else if (ob->mode & OB_MODE_WEIGHT_PAINT) {
if (ob->sculpt && (ob->sculpt->mode_type == OB_MODE_WEIGHT_PAINT)) {
if (only_test) {
return true;
}
ED_object_wpaintmode_exit_ex(ob);
}
}
else if (ob->mode & OB_MODE_SCULPT) {
if (ob->sculpt && (ob->sculpt->mode_type == OB_MODE_SCULPT)) {
if (only_test) {
return true;
}
ED_object_sculptmode_exit_ex(bmain, depsgraph, scene, ob);
}
}
else if (ob->mode & OB_MODE_POSE) {
if (ob->pose != NULL) {
if (only_test) {
return true;
}
ED_object_posemode_exit_ex(bmain, ob);
}
}
else if ((ob->type == OB_GPENCIL) && ((ob->mode & OB_MODE_OBJECT) == 0)) {
if (only_test) {
return true;
}
ED_object_gpencil_exit(bmain, ob);
}
else {
if (only_test) {
return false;
}
BLI_assert((ob->mode & OB_MODE_ALL_MODE_DATA) == 0);
}
return false;
} | [
"static",
"bool",
"ed_object_mode_generic_exit_ex",
"(",
"struct",
"Main",
"*",
"bmain",
",",
"struct",
"Depsgraph",
"*",
"depsgraph",
",",
"struct",
"Scene",
"*",
"scene",
",",
"struct",
"Object",
"*",
"ob",
",",
"bool",
"only_test",
")",
"{",
"BLI_assert",
"(",
"(",
"bmain",
"==",
"NULL",
")",
"==",
"only_test",
")",
";",
"if",
"(",
"ob",
"->",
"mode",
"&",
"OB_MODE_EDIT",
")",
"{",
"if",
"(",
"BKE_object_is_in_editmode",
"(",
"ob",
")",
")",
"{",
"if",
"(",
"only_test",
")",
"{",
"return",
"true",
";",
"}",
"ED_object_editmode_exit_ex",
"(",
"bmain",
",",
"scene",
",",
"ob",
",",
"EM_FREEDATA",
")",
";",
"}",
"}",
"else",
"if",
"(",
"ob",
"->",
"mode",
"&",
"OB_MODE_VERTEX_PAINT",
")",
"{",
"if",
"(",
"ob",
"->",
"sculpt",
"&&",
"(",
"ob",
"->",
"sculpt",
"->",
"mode_type",
"==",
"OB_MODE_VERTEX_PAINT",
")",
")",
"{",
"if",
"(",
"only_test",
")",
"{",
"return",
"true",
";",
"}",
"ED_object_vpaintmode_exit_ex",
"(",
"ob",
")",
";",
"}",
"}",
"else",
"if",
"(",
"ob",
"->",
"mode",
"&",
"OB_MODE_WEIGHT_PAINT",
")",
"{",
"if",
"(",
"ob",
"->",
"sculpt",
"&&",
"(",
"ob",
"->",
"sculpt",
"->",
"mode_type",
"==",
"OB_MODE_WEIGHT_PAINT",
")",
")",
"{",
"if",
"(",
"only_test",
")",
"{",
"return",
"true",
";",
"}",
"ED_object_wpaintmode_exit_ex",
"(",
"ob",
")",
";",
"}",
"}",
"else",
"if",
"(",
"ob",
"->",
"mode",
"&",
"OB_MODE_SCULPT",
")",
"{",
"if",
"(",
"ob",
"->",
"sculpt",
"&&",
"(",
"ob",
"->",
"sculpt",
"->",
"mode_type",
"==",
"OB_MODE_SCULPT",
")",
")",
"{",
"if",
"(",
"only_test",
")",
"{",
"return",
"true",
";",
"}",
"ED_object_sculptmode_exit_ex",
"(",
"bmain",
",",
"depsgraph",
",",
"scene",
",",
"ob",
")",
";",
"}",
"}",
"else",
"if",
"(",
"ob",
"->",
"mode",
"&",
"OB_MODE_POSE",
")",
"{",
"if",
"(",
"ob",
"->",
"pose",
"!=",
"NULL",
")",
"{",
"if",
"(",
"only_test",
")",
"{",
"return",
"true",
";",
"}",
"ED_object_posemode_exit_ex",
"(",
"bmain",
",",
"ob",
")",
";",
"}",
"}",
"else",
"if",
"(",
"(",
"ob",
"->",
"type",
"==",
"OB_GPENCIL",
")",
"&&",
"(",
"(",
"ob",
"->",
"mode",
"&",
"OB_MODE_OBJECT",
")",
"==",
"0",
")",
")",
"{",
"if",
"(",
"only_test",
")",
"{",
"return",
"true",
";",
"}",
"ED_object_gpencil_exit",
"(",
"bmain",
",",
"ob",
")",
";",
"}",
"else",
"{",
"if",
"(",
"only_test",
")",
"{",
"return",
"false",
";",
"}",
"BLI_assert",
"(",
"(",
"ob",
"->",
"mode",
"&",
"OB_MODE_ALL_MODE_DATA",
")",
"==",
"0",
")",
";",
"}",
"return",
"false",
";",
"}"
] | Use for changing works-paces or changing active object. | [
"Use",
"for",
"changing",
"works",
"-",
"paces",
"or",
"changing",
"active",
"object",
"."
] | [] | [
{
"param": "bmain",
"type": "struct Main"
},
{
"param": "depsgraph",
"type": "struct Depsgraph"
},
{
"param": "scene",
"type": "struct Scene"
},
{
"param": "ob",
"type": "struct Object"
},
{
"param": "only_test",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bmain",
"type": "struct Main",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "depsgraph",
"type": "struct Depsgraph",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scene",
"type": "struct Scene",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ob",
"type": "struct Object",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "only_test",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
fb7f5ca5ff9743f0e7b7fcfd56baca329fcf0882 | DemonRem/blender | source/blender/draw/modes/edit_metaball_mode.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | EDIT_METABALL_cache_init | void | static void EDIT_METABALL_cache_init(void *vedata)
{
EDIT_METABALL_PassList *psl = ((EDIT_METABALL_Data *)vedata)->psl;
EDIT_METABALL_StorageList *stl = ((EDIT_METABALL_Data *)vedata)->stl;
const DRWContextState *draw_ctx = DRW_context_state_get();
if (!stl->g_data) {
/* Alloc transient pointers */
stl->g_data = MEM_mallocN(sizeof(*stl->g_data), __func__);
}
{
/* Create a pass */
DRWState state = (DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL |
DRW_STATE_BLEND_ALPHA);
psl->pass = DRW_pass_create("My Pass", state);
/* Create a shadingGroup using a function in draw_common.c or custom one */
stl->g_data->group = buffer_instance_mball_handles(psl->pass, draw_ctx->sh_cfg);
}
} | /* Here init all passes and shading groups
* Assume that all Passes are NULL */ | Here init all passes and shading groups
Assume that all Passes are NULL | [
"Here",
"init",
"all",
"passes",
"and",
"shading",
"groups",
"Assume",
"that",
"all",
"Passes",
"are",
"NULL"
] | static void EDIT_METABALL_cache_init(void *vedata)
{
EDIT_METABALL_PassList *psl = ((EDIT_METABALL_Data *)vedata)->psl;
EDIT_METABALL_StorageList *stl = ((EDIT_METABALL_Data *)vedata)->stl;
const DRWContextState *draw_ctx = DRW_context_state_get();
if (!stl->g_data) {
stl->g_data = MEM_mallocN(sizeof(*stl->g_data), __func__);
}
{
DRWState state = (DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL |
DRW_STATE_BLEND_ALPHA);
psl->pass = DRW_pass_create("My Pass", state);
stl->g_data->group = buffer_instance_mball_handles(psl->pass, draw_ctx->sh_cfg);
}
} | [
"static",
"void",
"EDIT_METABALL_cache_init",
"(",
"void",
"*",
"vedata",
")",
"{",
"EDIT_METABALL_PassList",
"*",
"psl",
"=",
"(",
"(",
"EDIT_METABALL_Data",
"*",
")",
"vedata",
")",
"->",
"psl",
";",
"EDIT_METABALL_StorageList",
"*",
"stl",
"=",
"(",
"(",
"EDIT_METABALL_Data",
"*",
")",
"vedata",
")",
"->",
"stl",
";",
"const",
"DRWContextState",
"*",
"draw_ctx",
"=",
"DRW_context_state_get",
"(",
")",
";",
"if",
"(",
"!",
"stl",
"->",
"g_data",
")",
"{",
"stl",
"->",
"g_data",
"=",
"MEM_mallocN",
"(",
"sizeof",
"(",
"*",
"stl",
"->",
"g_data",
")",
",",
"__func__",
")",
";",
"}",
"{",
"DRWState",
"state",
"=",
"(",
"DRW_STATE_WRITE_COLOR",
"|",
"DRW_STATE_WRITE_DEPTH",
"|",
"DRW_STATE_DEPTH_LESS_EQUAL",
"|",
"DRW_STATE_BLEND_ALPHA",
")",
";",
"psl",
"->",
"pass",
"=",
"DRW_pass_create",
"(",
"\"",
"\"",
",",
"state",
")",
";",
"stl",
"->",
"g_data",
"->",
"group",
"=",
"buffer_instance_mball_handles",
"(",
"psl",
"->",
"pass",
",",
"draw_ctx",
"->",
"sh_cfg",
")",
";",
"}",
"}"
] | Here init all passes and shading groups
Assume that all Passes are NULL | [
"Here",
"init",
"all",
"passes",
"and",
"shading",
"groups",
"Assume",
"that",
"all",
"Passes",
"are",
"NULL"
] | [
"/* Alloc transient pointers */",
"/* Create a pass */",
"/* Create a shadingGroup using a function in draw_common.c or custom one */"
] | [
{
"param": "vedata",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "vedata",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
fb7f5ca5ff9743f0e7b7fcfd56baca329fcf0882 | DemonRem/blender | source/blender/draw/modes/edit_metaball_mode.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | EDIT_METABALL_draw_scene | void | static void EDIT_METABALL_draw_scene(void *vedata)
{
EDIT_METABALL_PassList *psl = ((EDIT_METABALL_Data *)vedata)->psl;
/* render passes on default framebuffer. */
DRW_draw_pass(psl->pass);
} | /* Draw time ! Control rendering pipeline from here */ | Draw time . Control rendering pipeline from here | [
"Draw",
"time",
".",
"Control",
"rendering",
"pipeline",
"from",
"here"
] | static void EDIT_METABALL_draw_scene(void *vedata)
{
EDIT_METABALL_PassList *psl = ((EDIT_METABALL_Data *)vedata)->psl;
DRW_draw_pass(psl->pass);
} | [
"static",
"void",
"EDIT_METABALL_draw_scene",
"(",
"void",
"*",
"vedata",
")",
"{",
"EDIT_METABALL_PassList",
"*",
"psl",
"=",
"(",
"(",
"EDIT_METABALL_Data",
"*",
")",
"vedata",
")",
"->",
"psl",
";",
"DRW_draw_pass",
"(",
"psl",
"->",
"pass",
")",
";",
"}"
] | Draw time ! | [
"Draw",
"time",
"!"
] | [
"/* render passes on default framebuffer. */"
] | [
{
"param": "vedata",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "vedata",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c99f5d4075ff33f34ed5765f39b311abd2cb3e39 | DemonRem/blender | source/blender/render/intern/source/pointdensity.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | alloc_point_data | void | static void alloc_point_data(PointDensity *pd)
{
const int totpoints = pd->totpoints;
int data_used = point_data_used(pd);
int data_size = 0;
if (data_used & POINT_DATA_VEL) {
/* store 3 channels of velocity data */
data_size += 3;
}
if (data_used & POINT_DATA_LIFE) {
/* store 1 channel of lifetime data */
data_size += 1;
}
if (data_used & POINT_DATA_COLOR) {
/* store 3 channels of RGB data */
data_size += 3;
}
if (data_size) {
pd->point_data = MEM_callocN(sizeof(float) * data_size * totpoints, "particle point data");
}
} | /* additional data stored alongside the point density BVH,
* accessible by point index number to retrieve other information
* such as particle velocity or lifetime */ | additional data stored alongside the point density BVH,
accessible by point index number to retrieve other information
such as particle velocity or lifetime | [
"additional",
"data",
"stored",
"alongside",
"the",
"point",
"density",
"BVH",
"accessible",
"by",
"point",
"index",
"number",
"to",
"retrieve",
"other",
"information",
"such",
"as",
"particle",
"velocity",
"or",
"lifetime"
] | static void alloc_point_data(PointDensity *pd)
{
const int totpoints = pd->totpoints;
int data_used = point_data_used(pd);
int data_size = 0;
if (data_used & POINT_DATA_VEL) {
data_size += 3;
}
if (data_used & POINT_DATA_LIFE) {
data_size += 1;
}
if (data_used & POINT_DATA_COLOR) {
data_size += 3;
}
if (data_size) {
pd->point_data = MEM_callocN(sizeof(float) * data_size * totpoints, "particle point data");
}
} | [
"static",
"void",
"alloc_point_data",
"(",
"PointDensity",
"*",
"pd",
")",
"{",
"const",
"int",
"totpoints",
"=",
"pd",
"->",
"totpoints",
";",
"int",
"data_used",
"=",
"point_data_used",
"(",
"pd",
")",
";",
"int",
"data_size",
"=",
"0",
";",
"if",
"(",
"data_used",
"&",
"POINT_DATA_VEL",
")",
"{",
"data_size",
"+=",
"3",
";",
"}",
"if",
"(",
"data_used",
"&",
"POINT_DATA_LIFE",
")",
"{",
"data_size",
"+=",
"1",
";",
"}",
"if",
"(",
"data_used",
"&",
"POINT_DATA_COLOR",
")",
"{",
"data_size",
"+=",
"3",
";",
"}",
"if",
"(",
"data_size",
")",
"{",
"pd",
"->",
"point_data",
"=",
"MEM_callocN",
"(",
"sizeof",
"(",
"float",
")",
"*",
"data_size",
"*",
"totpoints",
",",
"\"",
"\"",
")",
";",
"}",
"}"
] | additional data stored alongside the point density BVH,
accessible by point index number to retrieve other information
such as particle velocity or lifetime | [
"additional",
"data",
"stored",
"alongside",
"the",
"point",
"density",
"BVH",
"accessible",
"by",
"point",
"index",
"number",
"to",
"retrieve",
"other",
"information",
"such",
"as",
"particle",
"velocity",
"or",
"lifetime"
] | [
"/* store 3 channels of velocity data */",
"/* store 1 channel of lifetime data */",
"/* store 3 channels of RGB data */"
] | [
{
"param": "pd",
"type": "PointDensity"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pd",
"type": "PointDensity",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c99f5d4075ff33f34ed5765f39b311abd2cb3e39 | DemonRem/blender | source/blender/render/intern/source/pointdensity.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | RE_point_density_sample | void | void RE_point_density_sample(Depsgraph *depsgraph,
PointDensity *pd,
const int resolution,
float *values)
{
Object *object = pd->object;
float min[3], max[3], dim[3];
/* TODO(sergey): Implement some sort of assert() that point density
* was cached already.
*/
if (object == NULL) {
sample_dummy_point_density(resolution, values);
return;
}
BLI_mutex_lock(&sample_mutex);
RE_point_density_minmax(depsgraph, pd, min, max);
BLI_mutex_unlock(&sample_mutex);
sub_v3_v3v3(dim, max, min);
if (dim[0] <= 0.0f || dim[1] <= 0.0f || dim[2] <= 0.0f) {
sample_dummy_point_density(resolution, values);
return;
}
SampleCallbackData data;
data.pd = pd;
data.resolution = resolution;
data.min = min;
data.dim = dim;
data.values = values;
TaskParallelSettings settings;
BLI_parallel_range_settings_defaults(&settings);
settings.use_threading = (resolution > 32);
BLI_task_parallel_range(0, resolution, &data, point_density_sample_func, &settings);
free_pointdensity(pd);
} | /* NOTE 1: Requires RE_point_density_cache() to be called first.
* NOTE 2: Frees point density structure after sampling.
*/ | NOTE 1: Requires RE_point_density_cache() to be called first.
NOTE 2: Frees point density structure after sampling. | [
"NOTE",
"1",
":",
"Requires",
"RE_point_density_cache",
"()",
"to",
"be",
"called",
"first",
".",
"NOTE",
"2",
":",
"Frees",
"point",
"density",
"structure",
"after",
"sampling",
"."
] | void RE_point_density_sample(Depsgraph *depsgraph,
PointDensity *pd,
const int resolution,
float *values)
{
Object *object = pd->object;
float min[3], max[3], dim[3];
if (object == NULL) {
sample_dummy_point_density(resolution, values);
return;
}
BLI_mutex_lock(&sample_mutex);
RE_point_density_minmax(depsgraph, pd, min, max);
BLI_mutex_unlock(&sample_mutex);
sub_v3_v3v3(dim, max, min);
if (dim[0] <= 0.0f || dim[1] <= 0.0f || dim[2] <= 0.0f) {
sample_dummy_point_density(resolution, values);
return;
}
SampleCallbackData data;
data.pd = pd;
data.resolution = resolution;
data.min = min;
data.dim = dim;
data.values = values;
TaskParallelSettings settings;
BLI_parallel_range_settings_defaults(&settings);
settings.use_threading = (resolution > 32);
BLI_task_parallel_range(0, resolution, &data, point_density_sample_func, &settings);
free_pointdensity(pd);
} | [
"void",
"RE_point_density_sample",
"(",
"Depsgraph",
"*",
"depsgraph",
",",
"PointDensity",
"*",
"pd",
",",
"const",
"int",
"resolution",
",",
"float",
"*",
"values",
")",
"{",
"Object",
"*",
"object",
"=",
"pd",
"->",
"object",
";",
"float",
"min",
"[",
"3",
"]",
",",
"max",
"[",
"3",
"]",
",",
"dim",
"[",
"3",
"]",
";",
"if",
"(",
"object",
"==",
"NULL",
")",
"{",
"sample_dummy_point_density",
"(",
"resolution",
",",
"values",
")",
";",
"return",
";",
"}",
"BLI_mutex_lock",
"(",
"&",
"sample_mutex",
")",
";",
"RE_point_density_minmax",
"(",
"depsgraph",
",",
"pd",
",",
"min",
",",
"max",
")",
";",
"BLI_mutex_unlock",
"(",
"&",
"sample_mutex",
")",
";",
"sub_v3_v3v3",
"(",
"dim",
",",
"max",
",",
"min",
")",
";",
"if",
"(",
"dim",
"[",
"0",
"]",
"<=",
"0.0f",
"||",
"dim",
"[",
"1",
"]",
"<=",
"0.0f",
"||",
"dim",
"[",
"2",
"]",
"<=",
"0.0f",
")",
"{",
"sample_dummy_point_density",
"(",
"resolution",
",",
"values",
")",
";",
"return",
";",
"}",
"SampleCallbackData",
"data",
";",
"data",
".",
"pd",
"=",
"pd",
";",
"data",
".",
"resolution",
"=",
"resolution",
";",
"data",
".",
"min",
"=",
"min",
";",
"data",
".",
"dim",
"=",
"dim",
";",
"data",
".",
"values",
"=",
"values",
";",
"TaskParallelSettings",
"settings",
";",
"BLI_parallel_range_settings_defaults",
"(",
"&",
"settings",
")",
";",
"settings",
".",
"use_threading",
"=",
"(",
"resolution",
">",
"32",
")",
";",
"BLI_task_parallel_range",
"(",
"0",
",",
"resolution",
",",
"&",
"data",
",",
"point_density_sample_func",
",",
"&",
"settings",
")",
";",
"free_pointdensity",
"(",
"pd",
")",
";",
"}"
] | NOTE 1: Requires RE_point_density_cache() to be called first. | [
"NOTE",
"1",
":",
"Requires",
"RE_point_density_cache",
"()",
"to",
"be",
"called",
"first",
"."
] | [
"/* TODO(sergey): Implement some sort of assert() that point density\n * was cached already.\n */"
] | [
{
"param": "depsgraph",
"type": "Depsgraph"
},
{
"param": "pd",
"type": "PointDensity"
},
{
"param": "resolution",
"type": "int"
},
{
"param": "values",
"type": "float"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "depsgraph",
"type": "Depsgraph",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pd",
"type": "PointDensity",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "resolution",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "values",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7ed41b5b4d0c13a100aa7baeed43b08fc9050d9a | DemonRem/blender | source/blender/editors/armature/pose_slide.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | pose_slide_apply_props | void | static void pose_slide_apply_props(tPoseSlideOp *pso,
tPChanFCurveLink *pfl,
const char prop_prefix[])
{
PointerRNA ptr = {NULL};
LinkData *ld;
int len = strlen(pfl->pchan_path);
/* setup pointer RNA for resolving paths */
RNA_pointer_create(NULL, &RNA_PoseBone, pfl->pchan, &ptr);
/* - custom properties are just denoted using ["..."][etc.] after the end of the base path,
* so just check for opening pair after the end of the path
* - bbone properties are similar, but they always start with a prefix "bbone_*",
* so a similar method should work here for those too
*/
for (ld = pfl->fcurves.first; ld; ld = ld->next) {
FCurve *fcu = (FCurve *)ld->data;
const char *bPtr, *pPtr;
if (fcu->rna_path == NULL) {
continue;
}
/* do we have a match?
* - bPtr is the RNA Path with the standard part chopped off
* - pPtr is the chunk of the path which is left over
*/
bPtr = strstr(fcu->rna_path, pfl->pchan_path) + len;
pPtr = strstr(bPtr, prop_prefix);
if (pPtr) {
/* use RNA to try and get a handle on this property, then, assuming that it is just
* numerical, try and grab the value as a float for temp editing before setting back
*/
PropertyRNA *prop = RNA_struct_find_property(&ptr, pPtr);
if (prop) {
switch (RNA_property_type(prop)) {
/* continuous values that can be smoothly interpolated... */
case PROP_FLOAT: {
float tval = RNA_property_float_get(&ptr, prop);
pose_slide_apply_val(pso, fcu, pfl->ob, &tval);
RNA_property_float_set(&ptr, prop, tval);
break;
}
case PROP_INT: {
float tval = (float)RNA_property_int_get(&ptr, prop);
pose_slide_apply_val(pso, fcu, pfl->ob, &tval);
RNA_property_int_set(&ptr, prop, (int)tval);
break;
}
/* values which can only take discrete values */
case PROP_BOOLEAN: {
float tval = (float)RNA_property_boolean_get(&ptr, prop);
pose_slide_apply_val(pso, fcu, pfl->ob, &tval);
RNA_property_boolean_set(
&ptr, prop, (int)tval); // XXX: do we need threshold clamping here?
break;
}
case PROP_ENUM: {
/* don't handle this case - these don't usually represent interchangeable
* set of values which should be interpolated between
*/
break;
}
default:
/* cannot handle */
// printf("Cannot Pose Slide non-numerical property\n");
break;
}
}
}
}
} | /* helper for apply() - perform sliding for custom properties or bbone properties */ | helper for apply() - perform sliding for custom properties or bbone properties | [
"helper",
"for",
"apply",
"()",
"-",
"perform",
"sliding",
"for",
"custom",
"properties",
"or",
"bbone",
"properties"
] | static void pose_slide_apply_props(tPoseSlideOp *pso,
tPChanFCurveLink *pfl,
const char prop_prefix[])
{
PointerRNA ptr = {NULL};
LinkData *ld;
int len = strlen(pfl->pchan_path);
RNA_pointer_create(NULL, &RNA_PoseBone, pfl->pchan, &ptr);
for (ld = pfl->fcurves.first; ld; ld = ld->next) {
FCurve *fcu = (FCurve *)ld->data;
const char *bPtr, *pPtr;
if (fcu->rna_path == NULL) {
continue;
}
bPtr = strstr(fcu->rna_path, pfl->pchan_path) + len;
pPtr = strstr(bPtr, prop_prefix);
if (pPtr) {
PropertyRNA *prop = RNA_struct_find_property(&ptr, pPtr);
if (prop) {
switch (RNA_property_type(prop)) {
case PROP_FLOAT: {
float tval = RNA_property_float_get(&ptr, prop);
pose_slide_apply_val(pso, fcu, pfl->ob, &tval);
RNA_property_float_set(&ptr, prop, tval);
break;
}
case PROP_INT: {
float tval = (float)RNA_property_int_get(&ptr, prop);
pose_slide_apply_val(pso, fcu, pfl->ob, &tval);
RNA_property_int_set(&ptr, prop, (int)tval);
break;
}
case PROP_BOOLEAN: {
float tval = (float)RNA_property_boolean_get(&ptr, prop);
pose_slide_apply_val(pso, fcu, pfl->ob, &tval);
RNA_property_boolean_set(
&ptr, prop, (int)tval);
break;
}
case PROP_ENUM: {
break;
}
default:
break;
}
}
}
}
} | [
"static",
"void",
"pose_slide_apply_props",
"(",
"tPoseSlideOp",
"*",
"pso",
",",
"tPChanFCurveLink",
"*",
"pfl",
",",
"const",
"char",
"prop_prefix",
"[",
"]",
")",
"{",
"PointerRNA",
"ptr",
"=",
"{",
"NULL",
"}",
";",
"LinkData",
"*",
"ld",
";",
"int",
"len",
"=",
"strlen",
"(",
"pfl",
"->",
"pchan_path",
")",
";",
"RNA_pointer_create",
"(",
"NULL",
",",
"&",
"RNA_PoseBone",
",",
"pfl",
"->",
"pchan",
",",
"&",
"ptr",
")",
";",
"for",
"(",
"ld",
"=",
"pfl",
"->",
"fcurves",
".",
"first",
";",
"ld",
";",
"ld",
"=",
"ld",
"->",
"next",
")",
"{",
"FCurve",
"*",
"fcu",
"=",
"(",
"FCurve",
"*",
")",
"ld",
"->",
"data",
";",
"const",
"char",
"*",
"bPtr",
",",
"*",
"pPtr",
";",
"if",
"(",
"fcu",
"->",
"rna_path",
"==",
"NULL",
")",
"{",
"continue",
";",
"}",
"bPtr",
"=",
"strstr",
"(",
"fcu",
"->",
"rna_path",
",",
"pfl",
"->",
"pchan_path",
")",
"+",
"len",
";",
"pPtr",
"=",
"strstr",
"(",
"bPtr",
",",
"prop_prefix",
")",
";",
"if",
"(",
"pPtr",
")",
"{",
"PropertyRNA",
"*",
"prop",
"=",
"RNA_struct_find_property",
"(",
"&",
"ptr",
",",
"pPtr",
")",
";",
"if",
"(",
"prop",
")",
"{",
"switch",
"(",
"RNA_property_type",
"(",
"prop",
")",
")",
"{",
"case",
"PROP_FLOAT",
":",
"{",
"float",
"tval",
"=",
"RNA_property_float_get",
"(",
"&",
"ptr",
",",
"prop",
")",
";",
"pose_slide_apply_val",
"(",
"pso",
",",
"fcu",
",",
"pfl",
"->",
"ob",
",",
"&",
"tval",
")",
";",
"RNA_property_float_set",
"(",
"&",
"ptr",
",",
"prop",
",",
"tval",
")",
";",
"break",
";",
"}",
"case",
"PROP_INT",
":",
"{",
"float",
"tval",
"=",
"(",
"float",
")",
"RNA_property_int_get",
"(",
"&",
"ptr",
",",
"prop",
")",
";",
"pose_slide_apply_val",
"(",
"pso",
",",
"fcu",
",",
"pfl",
"->",
"ob",
",",
"&",
"tval",
")",
";",
"RNA_property_int_set",
"(",
"&",
"ptr",
",",
"prop",
",",
"(",
"int",
")",
"tval",
")",
";",
"break",
";",
"}",
"case",
"PROP_BOOLEAN",
":",
"{",
"float",
"tval",
"=",
"(",
"float",
")",
"RNA_property_boolean_get",
"(",
"&",
"ptr",
",",
"prop",
")",
";",
"pose_slide_apply_val",
"(",
"pso",
",",
"fcu",
",",
"pfl",
"->",
"ob",
",",
"&",
"tval",
")",
";",
"RNA_property_boolean_set",
"(",
"&",
"ptr",
",",
"prop",
",",
"(",
"int",
")",
"tval",
")",
";",
"break",
";",
"}",
"case",
"PROP_ENUM",
":",
"{",
"break",
";",
"}",
"default",
":",
"break",
";",
"}",
"}",
"}",
"}",
"}"
] | helper for apply() - perform sliding for custom properties or bbone properties | [
"helper",
"for",
"apply",
"()",
"-",
"perform",
"sliding",
"for",
"custom",
"properties",
"or",
"bbone",
"properties"
] | [
"/* setup pointer RNA for resolving paths */",
"/* - custom properties are just denoted using [\"...\"][etc.] after the end of the base path,\n * so just check for opening pair after the end of the path\n * - bbone properties are similar, but they always start with a prefix \"bbone_*\",\n * so a similar method should work here for those too\n */",
"/* do we have a match?\n * - bPtr is the RNA Path with the standard part chopped off\n * - pPtr is the chunk of the path which is left over\n */",
"/* use RNA to try and get a handle on this property, then, assuming that it is just\n * numerical, try and grab the value as a float for temp editing before setting back\n */",
"/* continuous values that can be smoothly interpolated... */",
"/* values which can only take discrete values */",
"// XXX: do we need threshold clamping here?",
"/* don't handle this case - these don't usually represent interchangeable\n * set of values which should be interpolated between\n */",
"/* cannot handle */",
"// printf(\"Cannot Pose Slide non-numerical property\\n\");"
] | [
{
"param": "pso",
"type": "tPoseSlideOp"
},
{
"param": "pfl",
"type": "tPChanFCurveLink"
},
{
"param": "prop_prefix",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pso",
"type": "tPoseSlideOp",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pfl",
"type": "tPChanFCurveLink",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "prop_prefix",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7ed41b5b4d0c13a100aa7baeed43b08fc9050d9a | DemonRem/blender | source/blender/editors/armature/pose_slide.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | pose_slide_apply_quat | void | static void pose_slide_apply_quat(tPoseSlideOp *pso, tPChanFCurveLink *pfl)
{
FCurve *fcu_w = NULL, *fcu_x = NULL, *fcu_y = NULL, *fcu_z = NULL;
bPoseChannel *pchan = pfl->pchan;
LinkData *ld = NULL;
char *path = NULL;
float cframe;
float prevFrameF, nextFrameF;
if (!pose_frame_range_from_object_get(pso, pfl->ob, &prevFrameF, &nextFrameF)) {
BLI_assert(!"Invalid pfl data");
return;
}
/* get the path to use - this should be quaternion rotations only (needs care) */
path = BLI_sprintfN("%s.%s", pfl->pchan_path, "rotation_quaternion");
/* get the current frame number */
cframe = (float)pso->cframe;
/* using this path, find each matching F-Curve for the variables we're interested in */
while ((ld = poseAnim_mapping_getNextFCurve(&pfl->fcurves, ld, path))) {
FCurve *fcu = (FCurve *)ld->data;
/* assign this F-Curve to one of the relevant pointers... */
switch (fcu->array_index) {
case 3: /* z */
fcu_z = fcu;
break;
case 2: /* y */
fcu_y = fcu;
break;
case 1: /* x */
fcu_x = fcu;
break;
case 0: /* w */
fcu_w = fcu;
break;
}
}
/* only if all channels exist, proceed */
if (fcu_w && fcu_x && fcu_y && fcu_z) {
float quat_prev[4], quat_prev_orig[4];
float quat_next[4], quat_next_orig[4];
float quat_curr[4], quat_curr_orig[4];
float quat_final[4];
copy_qt_qt(quat_curr_orig, pchan->quat);
/* get 2 quats */
quat_prev_orig[0] = evaluate_fcurve(fcu_w, prevFrameF);
quat_prev_orig[1] = evaluate_fcurve(fcu_x, prevFrameF);
quat_prev_orig[2] = evaluate_fcurve(fcu_y, prevFrameF);
quat_prev_orig[3] = evaluate_fcurve(fcu_z, prevFrameF);
quat_next_orig[0] = evaluate_fcurve(fcu_w, nextFrameF);
quat_next_orig[1] = evaluate_fcurve(fcu_x, nextFrameF);
quat_next_orig[2] = evaluate_fcurve(fcu_y, nextFrameF);
quat_next_orig[3] = evaluate_fcurve(fcu_z, nextFrameF);
normalize_qt_qt(quat_prev, quat_prev_orig);
normalize_qt_qt(quat_next, quat_next_orig);
normalize_qt_qt(quat_curr, quat_curr_orig);
/* perform blending */
if (pso->mode == POSESLIDE_BREAKDOWN) {
/* Just perform the interpolation between quat_prev and
* quat_next using pso->percentage as a guide. */
interp_qt_qtqt(quat_final, quat_prev, quat_next, pso->percentage);
}
else if (pso->mode == POSESLIDE_PUSH) {
float quat_diff[4];
/* calculate the delta transform from the previous to the current */
/* TODO: investigate ways to favour one transform more? */
sub_qt_qtqt(quat_diff, quat_curr, quat_prev);
/* increase the original by the delta transform, by an amount determined by percentage */
add_qt_qtqt(quat_final, quat_curr, quat_diff, pso->percentage);
normalize_qt(quat_final);
}
else {
BLI_assert(pso->mode == POSESLIDE_RELAX);
float quat_interp[4], quat_final_prev[4];
/* TODO: maybe a sensitivity ctrl on top of this is needed */
int iters = (int)ceil(10.0f * pso->percentage);
copy_qt_qt(quat_final, quat_curr);
/* perform this blending several times until a satisfactory result is reached */
while (iters-- > 0) {
/* calculate the interpolation between the endpoints */
interp_qt_qtqt(quat_interp,
quat_prev,
quat_next,
(cframe - pso->prevFrame) / (pso->nextFrame - pso->prevFrame));
normalize_qt_qt(quat_final_prev, quat_final);
/* tricky interpolations - blending between original and new */
interp_qt_qtqt(quat_final, quat_final_prev, quat_interp, 1.0f / 6.0f);
}
}
/* Apply final to the pose bone, keeping compatible for similar keyframe positions. */
quat_to_compatible_quat(pchan->quat, quat_final, quat_curr_orig);
}
/* free the path now */
MEM_freeN(path);
} | /* helper for apply() - perform sliding for quaternion rotations (using quat blending) */ | helper for apply() - perform sliding for quaternion rotations (using quat blending) | [
"helper",
"for",
"apply",
"()",
"-",
"perform",
"sliding",
"for",
"quaternion",
"rotations",
"(",
"using",
"quat",
"blending",
")"
] | static void pose_slide_apply_quat(tPoseSlideOp *pso, tPChanFCurveLink *pfl)
{
FCurve *fcu_w = NULL, *fcu_x = NULL, *fcu_y = NULL, *fcu_z = NULL;
bPoseChannel *pchan = pfl->pchan;
LinkData *ld = NULL;
char *path = NULL;
float cframe;
float prevFrameF, nextFrameF;
if (!pose_frame_range_from_object_get(pso, pfl->ob, &prevFrameF, &nextFrameF)) {
BLI_assert(!"Invalid pfl data");
return;
}
path = BLI_sprintfN("%s.%s", pfl->pchan_path, "rotation_quaternion");
cframe = (float)pso->cframe;
while ((ld = poseAnim_mapping_getNextFCurve(&pfl->fcurves, ld, path))) {
FCurve *fcu = (FCurve *)ld->data;
switch (fcu->array_index) {
case 3:
fcu_z = fcu;
break;
case 2:
fcu_y = fcu;
break;
case 1:
fcu_x = fcu;
break;
case 0:
fcu_w = fcu;
break;
}
}
if (fcu_w && fcu_x && fcu_y && fcu_z) {
float quat_prev[4], quat_prev_orig[4];
float quat_next[4], quat_next_orig[4];
float quat_curr[4], quat_curr_orig[4];
float quat_final[4];
copy_qt_qt(quat_curr_orig, pchan->quat);
quat_prev_orig[0] = evaluate_fcurve(fcu_w, prevFrameF);
quat_prev_orig[1] = evaluate_fcurve(fcu_x, prevFrameF);
quat_prev_orig[2] = evaluate_fcurve(fcu_y, prevFrameF);
quat_prev_orig[3] = evaluate_fcurve(fcu_z, prevFrameF);
quat_next_orig[0] = evaluate_fcurve(fcu_w, nextFrameF);
quat_next_orig[1] = evaluate_fcurve(fcu_x, nextFrameF);
quat_next_orig[2] = evaluate_fcurve(fcu_y, nextFrameF);
quat_next_orig[3] = evaluate_fcurve(fcu_z, nextFrameF);
normalize_qt_qt(quat_prev, quat_prev_orig);
normalize_qt_qt(quat_next, quat_next_orig);
normalize_qt_qt(quat_curr, quat_curr_orig);
if (pso->mode == POSESLIDE_BREAKDOWN) {
interp_qt_qtqt(quat_final, quat_prev, quat_next, pso->percentage);
}
else if (pso->mode == POSESLIDE_PUSH) {
float quat_diff[4];
sub_qt_qtqt(quat_diff, quat_curr, quat_prev);
add_qt_qtqt(quat_final, quat_curr, quat_diff, pso->percentage);
normalize_qt(quat_final);
}
else {
BLI_assert(pso->mode == POSESLIDE_RELAX);
float quat_interp[4], quat_final_prev[4];
int iters = (int)ceil(10.0f * pso->percentage);
copy_qt_qt(quat_final, quat_curr);
while (iters-- > 0) {
interp_qt_qtqt(quat_interp,
quat_prev,
quat_next,
(cframe - pso->prevFrame) / (pso->nextFrame - pso->prevFrame));
normalize_qt_qt(quat_final_prev, quat_final);
interp_qt_qtqt(quat_final, quat_final_prev, quat_interp, 1.0f / 6.0f);
}
}
quat_to_compatible_quat(pchan->quat, quat_final, quat_curr_orig);
}
MEM_freeN(path);
} | [
"static",
"void",
"pose_slide_apply_quat",
"(",
"tPoseSlideOp",
"*",
"pso",
",",
"tPChanFCurveLink",
"*",
"pfl",
")",
"{",
"FCurve",
"*",
"fcu_w",
"=",
"NULL",
",",
"*",
"fcu_x",
"=",
"NULL",
",",
"*",
"fcu_y",
"=",
"NULL",
",",
"*",
"fcu_z",
"=",
"NULL",
";",
"bPoseChannel",
"*",
"pchan",
"=",
"pfl",
"->",
"pchan",
";",
"LinkData",
"*",
"ld",
"=",
"NULL",
";",
"char",
"*",
"path",
"=",
"NULL",
";",
"float",
"cframe",
";",
"float",
"prevFrameF",
",",
"nextFrameF",
";",
"if",
"(",
"!",
"pose_frame_range_from_object_get",
"(",
"pso",
",",
"pfl",
"->",
"ob",
",",
"&",
"prevFrameF",
",",
"&",
"nextFrameF",
")",
")",
"{",
"BLI_assert",
"(",
"!",
"\"",
"\"",
")",
";",
"return",
";",
"}",
"path",
"=",
"BLI_sprintfN",
"(",
"\"",
"\"",
",",
"pfl",
"->",
"pchan_path",
",",
"\"",
"\"",
")",
";",
"cframe",
"=",
"(",
"float",
")",
"pso",
"->",
"cframe",
";",
"while",
"(",
"(",
"ld",
"=",
"poseAnim_mapping_getNextFCurve",
"(",
"&",
"pfl",
"->",
"fcurves",
",",
"ld",
",",
"path",
")",
")",
")",
"{",
"FCurve",
"*",
"fcu",
"=",
"(",
"FCurve",
"*",
")",
"ld",
"->",
"data",
";",
"switch",
"(",
"fcu",
"->",
"array_index",
")",
"{",
"case",
"3",
":",
"fcu_z",
"=",
"fcu",
";",
"break",
";",
"case",
"2",
":",
"fcu_y",
"=",
"fcu",
";",
"break",
";",
"case",
"1",
":",
"fcu_x",
"=",
"fcu",
";",
"break",
";",
"case",
"0",
":",
"fcu_w",
"=",
"fcu",
";",
"break",
";",
"}",
"}",
"if",
"(",
"fcu_w",
"&&",
"fcu_x",
"&&",
"fcu_y",
"&&",
"fcu_z",
")",
"{",
"float",
"quat_prev",
"[",
"4",
"]",
",",
"quat_prev_orig",
"[",
"4",
"]",
";",
"float",
"quat_next",
"[",
"4",
"]",
",",
"quat_next_orig",
"[",
"4",
"]",
";",
"float",
"quat_curr",
"[",
"4",
"]",
",",
"quat_curr_orig",
"[",
"4",
"]",
";",
"float",
"quat_final",
"[",
"4",
"]",
";",
"copy_qt_qt",
"(",
"quat_curr_orig",
",",
"pchan",
"->",
"quat",
")",
";",
"quat_prev_orig",
"[",
"0",
"]",
"=",
"evaluate_fcurve",
"(",
"fcu_w",
",",
"prevFrameF",
")",
";",
"quat_prev_orig",
"[",
"1",
"]",
"=",
"evaluate_fcurve",
"(",
"fcu_x",
",",
"prevFrameF",
")",
";",
"quat_prev_orig",
"[",
"2",
"]",
"=",
"evaluate_fcurve",
"(",
"fcu_y",
",",
"prevFrameF",
")",
";",
"quat_prev_orig",
"[",
"3",
"]",
"=",
"evaluate_fcurve",
"(",
"fcu_z",
",",
"prevFrameF",
")",
";",
"quat_next_orig",
"[",
"0",
"]",
"=",
"evaluate_fcurve",
"(",
"fcu_w",
",",
"nextFrameF",
")",
";",
"quat_next_orig",
"[",
"1",
"]",
"=",
"evaluate_fcurve",
"(",
"fcu_x",
",",
"nextFrameF",
")",
";",
"quat_next_orig",
"[",
"2",
"]",
"=",
"evaluate_fcurve",
"(",
"fcu_y",
",",
"nextFrameF",
")",
";",
"quat_next_orig",
"[",
"3",
"]",
"=",
"evaluate_fcurve",
"(",
"fcu_z",
",",
"nextFrameF",
")",
";",
"normalize_qt_qt",
"(",
"quat_prev",
",",
"quat_prev_orig",
")",
";",
"normalize_qt_qt",
"(",
"quat_next",
",",
"quat_next_orig",
")",
";",
"normalize_qt_qt",
"(",
"quat_curr",
",",
"quat_curr_orig",
")",
";",
"if",
"(",
"pso",
"->",
"mode",
"==",
"POSESLIDE_BREAKDOWN",
")",
"{",
"interp_qt_qtqt",
"(",
"quat_final",
",",
"quat_prev",
",",
"quat_next",
",",
"pso",
"->",
"percentage",
")",
";",
"}",
"else",
"if",
"(",
"pso",
"->",
"mode",
"==",
"POSESLIDE_PUSH",
")",
"{",
"float",
"quat_diff",
"[",
"4",
"]",
";",
"sub_qt_qtqt",
"(",
"quat_diff",
",",
"quat_curr",
",",
"quat_prev",
")",
";",
"add_qt_qtqt",
"(",
"quat_final",
",",
"quat_curr",
",",
"quat_diff",
",",
"pso",
"->",
"percentage",
")",
";",
"normalize_qt",
"(",
"quat_final",
")",
";",
"}",
"else",
"{",
"BLI_assert",
"(",
"pso",
"->",
"mode",
"==",
"POSESLIDE_RELAX",
")",
";",
"float",
"quat_interp",
"[",
"4",
"]",
",",
"quat_final_prev",
"[",
"4",
"]",
";",
"int",
"iters",
"=",
"(",
"int",
")",
"ceil",
"(",
"10.0f",
"*",
"pso",
"->",
"percentage",
")",
";",
"copy_qt_qt",
"(",
"quat_final",
",",
"quat_curr",
")",
";",
"while",
"(",
"iters",
"--",
">",
"0",
")",
"{",
"interp_qt_qtqt",
"(",
"quat_interp",
",",
"quat_prev",
",",
"quat_next",
",",
"(",
"cframe",
"-",
"pso",
"->",
"prevFrame",
")",
"/",
"(",
"pso",
"->",
"nextFrame",
"-",
"pso",
"->",
"prevFrame",
")",
")",
";",
"normalize_qt_qt",
"(",
"quat_final_prev",
",",
"quat_final",
")",
";",
"interp_qt_qtqt",
"(",
"quat_final",
",",
"quat_final_prev",
",",
"quat_interp",
",",
"1.0f",
"/",
"6.0f",
")",
";",
"}",
"}",
"quat_to_compatible_quat",
"(",
"pchan",
"->",
"quat",
",",
"quat_final",
",",
"quat_curr_orig",
")",
";",
"}",
"MEM_freeN",
"(",
"path",
")",
";",
"}"
] | helper for apply() - perform sliding for quaternion rotations (using quat blending) | [
"helper",
"for",
"apply",
"()",
"-",
"perform",
"sliding",
"for",
"quaternion",
"rotations",
"(",
"using",
"quat",
"blending",
")"
] | [
"/* get the path to use - this should be quaternion rotations only (needs care) */",
"/* get the current frame number */",
"/* using this path, find each matching F-Curve for the variables we're interested in */",
"/* assign this F-Curve to one of the relevant pointers... */",
"/* z */",
"/* y */",
"/* x */",
"/* w */",
"/* only if all channels exist, proceed */",
"/* get 2 quats */",
"/* perform blending */",
"/* Just perform the interpolation between quat_prev and\n * quat_next using pso->percentage as a guide. */",
"/* calculate the delta transform from the previous to the current */",
"/* TODO: investigate ways to favour one transform more? */",
"/* increase the original by the delta transform, by an amount determined by percentage */",
"/* TODO: maybe a sensitivity ctrl on top of this is needed */",
"/* perform this blending several times until a satisfactory result is reached */",
"/* calculate the interpolation between the endpoints */",
"/* tricky interpolations - blending between original and new */",
"/* Apply final to the pose bone, keeping compatible for similar keyframe positions. */",
"/* free the path now */"
] | [
{
"param": "pso",
"type": "tPoseSlideOp"
},
{
"param": "pfl",
"type": "tPChanFCurveLink"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pso",
"type": "tPoseSlideOp",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pfl",
"type": "tPChanFCurveLink",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7ed41b5b4d0c13a100aa7baeed43b08fc9050d9a | DemonRem/blender | source/blender/editors/armature/pose_slide.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | pose_slide_apply | void | static void pose_slide_apply(bContext *C, tPoseSlideOp *pso)
{
tPChanFCurveLink *pfl;
/* sanitise the frame ranges */
if (pso->prevFrame == pso->nextFrame) {
/* move out one step either side */
pso->prevFrame--;
pso->nextFrame++;
for (uint ob_index = 0; ob_index < pso->objects_len; ob_index++) {
tPoseSlideObject *ob_data = &pso->ob_data_array[ob_index];
if (!ob_data->valid) {
continue;
}
/* apply NLA mapping corrections so the frame lookups work */
ob_data->prevFrameF = BKE_nla_tweakedit_remap(
ob_data->ob->adt, pso->prevFrame, NLATIME_CONVERT_UNMAP);
ob_data->nextFrameF = BKE_nla_tweakedit_remap(
ob_data->ob->adt, pso->nextFrame, NLATIME_CONVERT_UNMAP);
}
}
/* for each link, handle each set of transforms */
for (pfl = pso->pfLinks.first; pfl; pfl = pfl->next) {
/* valid transforms for each PoseChannel should have been noted already
* - sliding the pose should be a straightforward exercise for location+rotation,
* but rotations get more complicated since we may want to use quaternion blending
* for quaternions instead...
*/
bPoseChannel *pchan = pfl->pchan;
if (ELEM(pso->channels, PS_TFM_ALL, PS_TFM_LOC) && (pchan->flag & POSE_LOC)) {
/* calculate these for the 'location' vector, and use location curves */
pose_slide_apply_vec3(pso, pfl, pchan->loc, "location");
}
if (ELEM(pso->channels, PS_TFM_ALL, PS_TFM_SIZE) && (pchan->flag & POSE_SIZE)) {
/* calculate these for the 'scale' vector, and use scale curves */
pose_slide_apply_vec3(pso, pfl, pchan->size, "scale");
}
if (ELEM(pso->channels, PS_TFM_ALL, PS_TFM_ROT) && (pchan->flag & POSE_ROT)) {
/* everything depends on the rotation mode */
if (pchan->rotmode > 0) {
/* eulers - so calculate these for the 'eul' vector, and use euler_rotation curves */
pose_slide_apply_vec3(pso, pfl, pchan->eul, "rotation_euler");
}
else if (pchan->rotmode == ROT_MODE_AXISANGLE) {
/* TODO: need to figure out how to do this! */
}
else {
/* quaternions - use quaternion blending */
pose_slide_apply_quat(pso, pfl);
}
}
if (ELEM(pso->channels, PS_TFM_ALL, PS_TFM_BBONE_SHAPE) && (pchan->flag & POSE_BBONE_SHAPE)) {
/* bbone properties - they all start a "bbone_" prefix */
pose_slide_apply_props(pso, pfl, "bbone_");
}
if (ELEM(pso->channels, PS_TFM_ALL, PS_TFM_PROPS) && (pfl->oldprops)) {
/* Not strictly a transform, but custom properties contribute
* to the pose produced in many rigs (e.g. the facial rigs used in Sintel). */
pose_slide_apply_props(pso, pfl, "[\""); /* dummy " for texteditor bugs */
}
}
/* depsgraph updates + redraws */
pose_slide_refresh(C, pso);
} | /* apply() - perform the pose sliding based on weighting various poses */ | perform the pose sliding based on weighting various poses | [
"perform",
"the",
"pose",
"sliding",
"based",
"on",
"weighting",
"various",
"poses"
] | static void pose_slide_apply(bContext *C, tPoseSlideOp *pso)
{
tPChanFCurveLink *pfl;
if (pso->prevFrame == pso->nextFrame) {
pso->prevFrame--;
pso->nextFrame++;
for (uint ob_index = 0; ob_index < pso->objects_len; ob_index++) {
tPoseSlideObject *ob_data = &pso->ob_data_array[ob_index];
if (!ob_data->valid) {
continue;
}
ob_data->prevFrameF = BKE_nla_tweakedit_remap(
ob_data->ob->adt, pso->prevFrame, NLATIME_CONVERT_UNMAP);
ob_data->nextFrameF = BKE_nla_tweakedit_remap(
ob_data->ob->adt, pso->nextFrame, NLATIME_CONVERT_UNMAP);
}
}
for (pfl = pso->pfLinks.first; pfl; pfl = pfl->next) {
bPoseChannel *pchan = pfl->pchan;
if (ELEM(pso->channels, PS_TFM_ALL, PS_TFM_LOC) && (pchan->flag & POSE_LOC)) {
pose_slide_apply_vec3(pso, pfl, pchan->loc, "location");
}
if (ELEM(pso->channels, PS_TFM_ALL, PS_TFM_SIZE) && (pchan->flag & POSE_SIZE)) {
pose_slide_apply_vec3(pso, pfl, pchan->size, "scale");
}
if (ELEM(pso->channels, PS_TFM_ALL, PS_TFM_ROT) && (pchan->flag & POSE_ROT)) {
if (pchan->rotmode > 0) {
pose_slide_apply_vec3(pso, pfl, pchan->eul, "rotation_euler");
}
else if (pchan->rotmode == ROT_MODE_AXISANGLE) {
}
else {
pose_slide_apply_quat(pso, pfl);
}
}
if (ELEM(pso->channels, PS_TFM_ALL, PS_TFM_BBONE_SHAPE) && (pchan->flag & POSE_BBONE_SHAPE)) {
pose_slide_apply_props(pso, pfl, "bbone_");
}
if (ELEM(pso->channels, PS_TFM_ALL, PS_TFM_PROPS) && (pfl->oldprops)) {
pose_slide_apply_props(pso, pfl, "[\"");
}
}
pose_slide_refresh(C, pso);
} | [
"static",
"void",
"pose_slide_apply",
"(",
"bContext",
"*",
"C",
",",
"tPoseSlideOp",
"*",
"pso",
")",
"{",
"tPChanFCurveLink",
"*",
"pfl",
";",
"if",
"(",
"pso",
"->",
"prevFrame",
"==",
"pso",
"->",
"nextFrame",
")",
"{",
"pso",
"->",
"prevFrame",
"--",
";",
"pso",
"->",
"nextFrame",
"++",
";",
"for",
"(",
"uint",
"ob_index",
"=",
"0",
";",
"ob_index",
"<",
"pso",
"->",
"objects_len",
";",
"ob_index",
"++",
")",
"{",
"tPoseSlideObject",
"*",
"ob_data",
"=",
"&",
"pso",
"->",
"ob_data_array",
"[",
"ob_index",
"]",
";",
"if",
"(",
"!",
"ob_data",
"->",
"valid",
")",
"{",
"continue",
";",
"}",
"ob_data",
"->",
"prevFrameF",
"=",
"BKE_nla_tweakedit_remap",
"(",
"ob_data",
"->",
"ob",
"->",
"adt",
",",
"pso",
"->",
"prevFrame",
",",
"NLATIME_CONVERT_UNMAP",
")",
";",
"ob_data",
"->",
"nextFrameF",
"=",
"BKE_nla_tweakedit_remap",
"(",
"ob_data",
"->",
"ob",
"->",
"adt",
",",
"pso",
"->",
"nextFrame",
",",
"NLATIME_CONVERT_UNMAP",
")",
";",
"}",
"}",
"for",
"(",
"pfl",
"=",
"pso",
"->",
"pfLinks",
".",
"first",
";",
"pfl",
";",
"pfl",
"=",
"pfl",
"->",
"next",
")",
"{",
"bPoseChannel",
"*",
"pchan",
"=",
"pfl",
"->",
"pchan",
";",
"if",
"(",
"ELEM",
"(",
"pso",
"->",
"channels",
",",
"PS_TFM_ALL",
",",
"PS_TFM_LOC",
")",
"&&",
"(",
"pchan",
"->",
"flag",
"&",
"POSE_LOC",
")",
")",
"{",
"pose_slide_apply_vec3",
"(",
"pso",
",",
"pfl",
",",
"pchan",
"->",
"loc",
",",
"\"",
"\"",
")",
";",
"}",
"if",
"(",
"ELEM",
"(",
"pso",
"->",
"channels",
",",
"PS_TFM_ALL",
",",
"PS_TFM_SIZE",
")",
"&&",
"(",
"pchan",
"->",
"flag",
"&",
"POSE_SIZE",
")",
")",
"{",
"pose_slide_apply_vec3",
"(",
"pso",
",",
"pfl",
",",
"pchan",
"->",
"size",
",",
"\"",
"\"",
")",
";",
"}",
"if",
"(",
"ELEM",
"(",
"pso",
"->",
"channels",
",",
"PS_TFM_ALL",
",",
"PS_TFM_ROT",
")",
"&&",
"(",
"pchan",
"->",
"flag",
"&",
"POSE_ROT",
")",
")",
"{",
"if",
"(",
"pchan",
"->",
"rotmode",
">",
"0",
")",
"{",
"pose_slide_apply_vec3",
"(",
"pso",
",",
"pfl",
",",
"pchan",
"->",
"eul",
",",
"\"",
"\"",
")",
";",
"}",
"else",
"if",
"(",
"pchan",
"->",
"rotmode",
"==",
"ROT_MODE_AXISANGLE",
")",
"{",
"}",
"else",
"{",
"pose_slide_apply_quat",
"(",
"pso",
",",
"pfl",
")",
";",
"}",
"}",
"if",
"(",
"ELEM",
"(",
"pso",
"->",
"channels",
",",
"PS_TFM_ALL",
",",
"PS_TFM_BBONE_SHAPE",
")",
"&&",
"(",
"pchan",
"->",
"flag",
"&",
"POSE_BBONE_SHAPE",
")",
")",
"{",
"pose_slide_apply_props",
"(",
"pso",
",",
"pfl",
",",
"\"",
"\"",
")",
";",
"}",
"if",
"(",
"ELEM",
"(",
"pso",
"->",
"channels",
",",
"PS_TFM_ALL",
",",
"PS_TFM_PROPS",
")",
"&&",
"(",
"pfl",
"->",
"oldprops",
")",
")",
"{",
"pose_slide_apply_props",
"(",
"pso",
",",
"pfl",
",",
"\"",
"\\\"",
"\"",
")",
";",
"}",
"}",
"pose_slide_refresh",
"(",
"C",
",",
"pso",
")",
";",
"}"
] | apply() - perform the pose sliding based on weighting various poses | [
"apply",
"()",
"-",
"perform",
"the",
"pose",
"sliding",
"based",
"on",
"weighting",
"various",
"poses"
] | [
"/* sanitise the frame ranges */",
"/* move out one step either side */",
"/* apply NLA mapping corrections so the frame lookups work */",
"/* for each link, handle each set of transforms */",
"/* valid transforms for each PoseChannel should have been noted already\n * - sliding the pose should be a straightforward exercise for location+rotation,\n * but rotations get more complicated since we may want to use quaternion blending\n * for quaternions instead...\n */",
"/* calculate these for the 'location' vector, and use location curves */",
"/* calculate these for the 'scale' vector, and use scale curves */",
"/* everything depends on the rotation mode */",
"/* eulers - so calculate these for the 'eul' vector, and use euler_rotation curves */",
"/* TODO: need to figure out how to do this! */",
"/* quaternions - use quaternion blending */",
"/* bbone properties - they all start a \"bbone_\" prefix */",
"/* Not strictly a transform, but custom properties contribute\n * to the pose produced in many rigs (e.g. the facial rigs used in Sintel). */",
"/* dummy \" for texteditor bugs */",
"/* depsgraph updates + redraws */"
] | [
{
"param": "C",
"type": "bContext"
},
{
"param": "pso",
"type": "tPoseSlideOp"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pso",
"type": "tPoseSlideOp",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7ed41b5b4d0c13a100aa7baeed43b08fc9050d9a | DemonRem/blender | source/blender/editors/armature/pose_slide.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | pose_slide_draw_status | void | static void pose_slide_draw_status(tPoseSlideOp *pso)
{
char status_str[UI_MAX_DRAW_STR];
char limits_str[UI_MAX_DRAW_STR];
char axis_str[50];
char mode_str[32];
switch (pso->mode) {
case POSESLIDE_PUSH:
strcpy(mode_str, TIP_("Push Pose"));
break;
case POSESLIDE_RELAX:
strcpy(mode_str, TIP_("Relax Pose"));
break;
case POSESLIDE_BREAKDOWN:
strcpy(mode_str, TIP_("Breakdown"));
break;
default:
/* unknown */
strcpy(mode_str, TIP_("Sliding-Tool"));
break;
}
switch (pso->axislock) {
case PS_LOCK_X:
BLI_strncpy(axis_str, TIP_("[X]/Y/Z axis only (X to clear)"), sizeof(axis_str));
break;
case PS_LOCK_Y:
BLI_strncpy(axis_str, TIP_("X/[Y]/Z axis only (Y to clear)"), sizeof(axis_str));
break;
case PS_LOCK_Z:
BLI_strncpy(axis_str, TIP_("X/Y/[Z] axis only (Z to clear)"), sizeof(axis_str));
break;
default:
if (ELEM(pso->channels, PS_TFM_LOC, PS_TFM_ROT, PS_TFM_SIZE)) {
BLI_strncpy(axis_str, TIP_("X/Y/Z = Axis Constraint"), sizeof(axis_str));
}
else {
axis_str[0] = '\0';
}
break;
}
switch (pso->channels) {
case PS_TFM_LOC:
BLI_snprintf(limits_str,
sizeof(limits_str),
TIP_("[G]/R/S/B/C - Location only (G to clear) | %s"),
axis_str);
break;
case PS_TFM_ROT:
BLI_snprintf(limits_str,
sizeof(limits_str),
TIP_("G/[R]/S/B/C - Rotation only (R to clear) | %s"),
axis_str);
break;
case PS_TFM_SIZE:
BLI_snprintf(limits_str,
sizeof(limits_str),
TIP_("G/R/[S]/B/C - Scale only (S to clear) | %s"),
axis_str);
break;
case PS_TFM_BBONE_SHAPE:
BLI_strncpy(limits_str,
TIP_("G/R/S/[B]/C - Bendy Bone properties only (B to clear) | %s"),
sizeof(limits_str));
break;
case PS_TFM_PROPS:
BLI_strncpy(limits_str,
TIP_("G/R/S/B/[C] - Custom Properties only (C to clear) | %s"),
sizeof(limits_str));
break;
default:
BLI_strncpy(
limits_str, TIP_("G/R/S/B/C - Limit to Transform/Property Set"), sizeof(limits_str));
break;
}
if (hasNumInput(&pso->num)) {
Scene *scene = pso->scene;
char str_offs[NUM_STR_REP_LEN];
outputNumInput(&pso->num, str_offs, &scene->unit);
BLI_snprintf(
status_str, sizeof(status_str), "%s: %s | %s", mode_str, str_offs, limits_str);
}
else {
BLI_snprintf(status_str,
sizeof(status_str),
"%s: %d %% | %s",
mode_str,
(int)(pso->percentage * 100.0f),
limits_str);
}
ED_area_status_text(pso->sa, status_str);
} | /* draw percentage indicator in header */
// TODO: Include hints about locks here... | draw percentage indicator in header
TODO: Include hints about locks here | [
"draw",
"percentage",
"indicator",
"in",
"header",
"TODO",
":",
"Include",
"hints",
"about",
"locks",
"here"
] | static void pose_slide_draw_status(tPoseSlideOp *pso)
{
char status_str[UI_MAX_DRAW_STR];
char limits_str[UI_MAX_DRAW_STR];
char axis_str[50];
char mode_str[32];
switch (pso->mode) {
case POSESLIDE_PUSH:
strcpy(mode_str, TIP_("Push Pose"));
break;
case POSESLIDE_RELAX:
strcpy(mode_str, TIP_("Relax Pose"));
break;
case POSESLIDE_BREAKDOWN:
strcpy(mode_str, TIP_("Breakdown"));
break;
default:
strcpy(mode_str, TIP_("Sliding-Tool"));
break;
}
switch (pso->axislock) {
case PS_LOCK_X:
BLI_strncpy(axis_str, TIP_("[X]/Y/Z axis only (X to clear)"), sizeof(axis_str));
break;
case PS_LOCK_Y:
BLI_strncpy(axis_str, TIP_("X/[Y]/Z axis only (Y to clear)"), sizeof(axis_str));
break;
case PS_LOCK_Z:
BLI_strncpy(axis_str, TIP_("X/Y/[Z] axis only (Z to clear)"), sizeof(axis_str));
break;
default:
if (ELEM(pso->channels, PS_TFM_LOC, PS_TFM_ROT, PS_TFM_SIZE)) {
BLI_strncpy(axis_str, TIP_("X/Y/Z = Axis Constraint"), sizeof(axis_str));
}
else {
axis_str[0] = '\0';
}
break;
}
switch (pso->channels) {
case PS_TFM_LOC:
BLI_snprintf(limits_str,
sizeof(limits_str),
TIP_("[G]/R/S/B/C - Location only (G to clear) | %s"),
axis_str);
break;
case PS_TFM_ROT:
BLI_snprintf(limits_str,
sizeof(limits_str),
TIP_("G/[R]/S/B/C - Rotation only (R to clear) | %s"),
axis_str);
break;
case PS_TFM_SIZE:
BLI_snprintf(limits_str,
sizeof(limits_str),
TIP_("G/R/[S]/B/C - Scale only (S to clear) | %s"),
axis_str);
break;
case PS_TFM_BBONE_SHAPE:
BLI_strncpy(limits_str,
TIP_("G/R/S/[B]/C - Bendy Bone properties only (B to clear) | %s"),
sizeof(limits_str));
break;
case PS_TFM_PROPS:
BLI_strncpy(limits_str,
TIP_("G/R/S/B/[C] - Custom Properties only (C to clear) | %s"),
sizeof(limits_str));
break;
default:
BLI_strncpy(
limits_str, TIP_("G/R/S/B/C - Limit to Transform/Property Set"), sizeof(limits_str));
break;
}
if (hasNumInput(&pso->num)) {
Scene *scene = pso->scene;
char str_offs[NUM_STR_REP_LEN];
outputNumInput(&pso->num, str_offs, &scene->unit);
BLI_snprintf(
status_str, sizeof(status_str), "%s: %s | %s", mode_str, str_offs, limits_str);
}
else {
BLI_snprintf(status_str,
sizeof(status_str),
"%s: %d %% | %s",
mode_str,
(int)(pso->percentage * 100.0f),
limits_str);
}
ED_area_status_text(pso->sa, status_str);
} | [
"static",
"void",
"pose_slide_draw_status",
"(",
"tPoseSlideOp",
"*",
"pso",
")",
"{",
"char",
"status_str",
"[",
"UI_MAX_DRAW_STR",
"]",
";",
"char",
"limits_str",
"[",
"UI_MAX_DRAW_STR",
"]",
";",
"char",
"axis_str",
"[",
"50",
"]",
";",
"char",
"mode_str",
"[",
"32",
"]",
";",
"switch",
"(",
"pso",
"->",
"mode",
")",
"{",
"case",
"POSESLIDE_PUSH",
":",
"strcpy",
"(",
"mode_str",
",",
"TIP_",
"(",
"\"",
"\"",
")",
")",
";",
"break",
";",
"case",
"POSESLIDE_RELAX",
":",
"strcpy",
"(",
"mode_str",
",",
"TIP_",
"(",
"\"",
"\"",
")",
")",
";",
"break",
";",
"case",
"POSESLIDE_BREAKDOWN",
":",
"strcpy",
"(",
"mode_str",
",",
"TIP_",
"(",
"\"",
"\"",
")",
")",
";",
"break",
";",
"default",
":",
"strcpy",
"(",
"mode_str",
",",
"TIP_",
"(",
"\"",
"\"",
")",
")",
";",
"break",
";",
"}",
"switch",
"(",
"pso",
"->",
"axislock",
")",
"{",
"case",
"PS_LOCK_X",
":",
"BLI_strncpy",
"(",
"axis_str",
",",
"TIP_",
"(",
"\"",
"\"",
")",
",",
"sizeof",
"(",
"axis_str",
")",
")",
";",
"break",
";",
"case",
"PS_LOCK_Y",
":",
"BLI_strncpy",
"(",
"axis_str",
",",
"TIP_",
"(",
"\"",
"\"",
")",
",",
"sizeof",
"(",
"axis_str",
")",
")",
";",
"break",
";",
"case",
"PS_LOCK_Z",
":",
"BLI_strncpy",
"(",
"axis_str",
",",
"TIP_",
"(",
"\"",
"\"",
")",
",",
"sizeof",
"(",
"axis_str",
")",
")",
";",
"break",
";",
"default",
":",
"if",
"(",
"ELEM",
"(",
"pso",
"->",
"channels",
",",
"PS_TFM_LOC",
",",
"PS_TFM_ROT",
",",
"PS_TFM_SIZE",
")",
")",
"{",
"BLI_strncpy",
"(",
"axis_str",
",",
"TIP_",
"(",
"\"",
"\"",
")",
",",
"sizeof",
"(",
"axis_str",
")",
")",
";",
"}",
"else",
"{",
"axis_str",
"[",
"0",
"]",
"=",
"'",
"\\0",
"'",
";",
"}",
"break",
";",
"}",
"switch",
"(",
"pso",
"->",
"channels",
")",
"{",
"case",
"PS_TFM_LOC",
":",
"BLI_snprintf",
"(",
"limits_str",
",",
"sizeof",
"(",
"limits_str",
")",
",",
"TIP_",
"(",
"\"",
"\"",
")",
",",
"axis_str",
")",
";",
"break",
";",
"case",
"PS_TFM_ROT",
":",
"BLI_snprintf",
"(",
"limits_str",
",",
"sizeof",
"(",
"limits_str",
")",
",",
"TIP_",
"(",
"\"",
"\"",
")",
",",
"axis_str",
")",
";",
"break",
";",
"case",
"PS_TFM_SIZE",
":",
"BLI_snprintf",
"(",
"limits_str",
",",
"sizeof",
"(",
"limits_str",
")",
",",
"TIP_",
"(",
"\"",
"\"",
")",
",",
"axis_str",
")",
";",
"break",
";",
"case",
"PS_TFM_BBONE_SHAPE",
":",
"BLI_strncpy",
"(",
"limits_str",
",",
"TIP_",
"(",
"\"",
"\"",
")",
",",
"sizeof",
"(",
"limits_str",
")",
")",
";",
"break",
";",
"case",
"PS_TFM_PROPS",
":",
"BLI_strncpy",
"(",
"limits_str",
",",
"TIP_",
"(",
"\"",
"\"",
")",
",",
"sizeof",
"(",
"limits_str",
")",
")",
";",
"break",
";",
"default",
":",
"BLI_strncpy",
"(",
"limits_str",
",",
"TIP_",
"(",
"\"",
"\"",
")",
",",
"sizeof",
"(",
"limits_str",
")",
")",
";",
"break",
";",
"}",
"if",
"(",
"hasNumInput",
"(",
"&",
"pso",
"->",
"num",
")",
")",
"{",
"Scene",
"*",
"scene",
"=",
"pso",
"->",
"scene",
";",
"char",
"str_offs",
"[",
"NUM_STR_REP_LEN",
"]",
";",
"outputNumInput",
"(",
"&",
"pso",
"->",
"num",
",",
"str_offs",
",",
"&",
"scene",
"->",
"unit",
")",
";",
"BLI_snprintf",
"(",
"status_str",
",",
"sizeof",
"(",
"status_str",
")",
",",
"\"",
"\"",
",",
"mode_str",
",",
"str_offs",
",",
"limits_str",
")",
";",
"}",
"else",
"{",
"BLI_snprintf",
"(",
"status_str",
",",
"sizeof",
"(",
"status_str",
")",
",",
"\"",
"\"",
",",
"mode_str",
",",
"(",
"int",
")",
"(",
"pso",
"->",
"percentage",
"*",
"100.0f",
")",
",",
"limits_str",
")",
";",
"}",
"ED_area_status_text",
"(",
"pso",
"->",
"sa",
",",
"status_str",
")",
";",
"}"
] | draw percentage indicator in header
TODO: Include hints about locks here... | [
"draw",
"percentage",
"indicator",
"in",
"header",
"TODO",
":",
"Include",
"hints",
"about",
"locks",
"here",
"..."
] | [
"/* unknown */"
] | [
{
"param": "pso",
"type": "tPoseSlideOp"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pso",
"type": "tPoseSlideOp",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7ed41b5b4d0c13a100aa7baeed43b08fc9050d9a | DemonRem/blender | source/blender/editors/armature/pose_slide.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | pose_slide_invoke_common | int | static int pose_slide_invoke_common(bContext *C, wmOperator *op, tPoseSlideOp *pso)
{
tPChanFCurveLink *pfl;
wmWindow *win = CTX_wm_window(C);
/* for each link, add all its keyframes to the search tree */
for (pfl = pso->pfLinks.first; pfl; pfl = pfl->next) {
LinkData *ld;
/* do this for each F-Curve */
for (ld = pfl->fcurves.first; ld; ld = ld->next) {
FCurve *fcu = (FCurve *)ld->data;
fcurve_to_keylist(pfl->ob->adt, fcu, &pso->keys, 0);
}
}
/* cancel if no keyframes found... */
if (pso->keys.root) {
ActKeyColumn *ak;
float cframe = (float)pso->cframe;
/* firstly, check if the current frame is a keyframe... */
ak = (ActKeyColumn *)BLI_dlrbTree_search_exact(&pso->keys, compare_ak_cfraPtr, &cframe);
if (ak == NULL) {
/* current frame is not a keyframe, so search */
ActKeyColumn *pk = (ActKeyColumn *)BLI_dlrbTree_search_prev(
&pso->keys, compare_ak_cfraPtr, &cframe);
ActKeyColumn *nk = (ActKeyColumn *)BLI_dlrbTree_search_next(
&pso->keys, compare_ak_cfraPtr, &cframe);
/* new set the frames */
/* prev frame */
pso->prevFrame = (pk) ? (pk->cfra) : (pso->cframe - 1);
RNA_int_set(op->ptr, "prev_frame", pso->prevFrame);
/* next frame */
pso->nextFrame = (nk) ? (nk->cfra) : (pso->cframe + 1);
RNA_int_set(op->ptr, "next_frame", pso->nextFrame);
}
else {
/* current frame itself is a keyframe, so just take keyframes on either side */
/* prev frame */
pso->prevFrame = (ak->prev) ? (ak->prev->cfra) : (pso->cframe - 1);
RNA_int_set(op->ptr, "prev_frame", pso->prevFrame);
/* next frame */
pso->nextFrame = (ak->next) ? (ak->next->cfra) : (pso->cframe + 1);
RNA_int_set(op->ptr, "next_frame", pso->nextFrame);
}
/* apply NLA mapping corrections so the frame lookups work */
for (uint ob_index = 0; ob_index < pso->objects_len; ob_index++) {
tPoseSlideObject *ob_data = &pso->ob_data_array[ob_index];
if (ob_data->valid) {
ob_data->prevFrameF = BKE_nla_tweakedit_remap(
ob_data->ob->adt, pso->prevFrame, NLATIME_CONVERT_UNMAP);
ob_data->nextFrameF = BKE_nla_tweakedit_remap(
ob_data->ob->adt, pso->nextFrame, NLATIME_CONVERT_UNMAP);
}
}
}
else {
BKE_report(op->reports, RPT_ERROR, "No keyframes to slide between");
pose_slide_exit(op);
return OPERATOR_CANCELLED;
}
/* initial apply for operator... */
/* TODO: need to calculate percentage for initial round too... */
if (pso->mode != POSESLIDE_PUSH_REST && pso->mode != POSESLIDE_RELAX_REST) {
pose_slide_apply(C, pso);
}
else {
pose_slide_rest_pose_apply(C, pso);
}
/* depsgraph updates + redraws */
pose_slide_refresh(C, pso);
/* set cursor to indicate modal */
WM_cursor_modal_set(win, WM_CURSOR_EW_SCROLL);
/* header print */
pose_slide_draw_status(pso);
/* add a modal handler for this operator */
WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
} | /* common code for invoke() methods */ | common code for invoke() methods | [
"common",
"code",
"for",
"invoke",
"()",
"methods"
] | static int pose_slide_invoke_common(bContext *C, wmOperator *op, tPoseSlideOp *pso)
{
tPChanFCurveLink *pfl;
wmWindow *win = CTX_wm_window(C);
for (pfl = pso->pfLinks.first; pfl; pfl = pfl->next) {
LinkData *ld;
for (ld = pfl->fcurves.first; ld; ld = ld->next) {
FCurve *fcu = (FCurve *)ld->data;
fcurve_to_keylist(pfl->ob->adt, fcu, &pso->keys, 0);
}
}
if (pso->keys.root) {
ActKeyColumn *ak;
float cframe = (float)pso->cframe;
ak = (ActKeyColumn *)BLI_dlrbTree_search_exact(&pso->keys, compare_ak_cfraPtr, &cframe);
if (ak == NULL) {
ActKeyColumn *pk = (ActKeyColumn *)BLI_dlrbTree_search_prev(
&pso->keys, compare_ak_cfraPtr, &cframe);
ActKeyColumn *nk = (ActKeyColumn *)BLI_dlrbTree_search_next(
&pso->keys, compare_ak_cfraPtr, &cframe);
pso->prevFrame = (pk) ? (pk->cfra) : (pso->cframe - 1);
RNA_int_set(op->ptr, "prev_frame", pso->prevFrame);
pso->nextFrame = (nk) ? (nk->cfra) : (pso->cframe + 1);
RNA_int_set(op->ptr, "next_frame", pso->nextFrame);
}
else {
pso->prevFrame = (ak->prev) ? (ak->prev->cfra) : (pso->cframe - 1);
RNA_int_set(op->ptr, "prev_frame", pso->prevFrame);
pso->nextFrame = (ak->next) ? (ak->next->cfra) : (pso->cframe + 1);
RNA_int_set(op->ptr, "next_frame", pso->nextFrame);
}
for (uint ob_index = 0; ob_index < pso->objects_len; ob_index++) {
tPoseSlideObject *ob_data = &pso->ob_data_array[ob_index];
if (ob_data->valid) {
ob_data->prevFrameF = BKE_nla_tweakedit_remap(
ob_data->ob->adt, pso->prevFrame, NLATIME_CONVERT_UNMAP);
ob_data->nextFrameF = BKE_nla_tweakedit_remap(
ob_data->ob->adt, pso->nextFrame, NLATIME_CONVERT_UNMAP);
}
}
}
else {
BKE_report(op->reports, RPT_ERROR, "No keyframes to slide between");
pose_slide_exit(op);
return OPERATOR_CANCELLED;
}
if (pso->mode != POSESLIDE_PUSH_REST && pso->mode != POSESLIDE_RELAX_REST) {
pose_slide_apply(C, pso);
}
else {
pose_slide_rest_pose_apply(C, pso);
}
pose_slide_refresh(C, pso);
WM_cursor_modal_set(win, WM_CURSOR_EW_SCROLL);
pose_slide_draw_status(pso);
WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
} | [
"static",
"int",
"pose_slide_invoke_common",
"(",
"bContext",
"*",
"C",
",",
"wmOperator",
"*",
"op",
",",
"tPoseSlideOp",
"*",
"pso",
")",
"{",
"tPChanFCurveLink",
"*",
"pfl",
";",
"wmWindow",
"*",
"win",
"=",
"CTX_wm_window",
"(",
"C",
")",
";",
"for",
"(",
"pfl",
"=",
"pso",
"->",
"pfLinks",
".",
"first",
";",
"pfl",
";",
"pfl",
"=",
"pfl",
"->",
"next",
")",
"{",
"LinkData",
"*",
"ld",
";",
"for",
"(",
"ld",
"=",
"pfl",
"->",
"fcurves",
".",
"first",
";",
"ld",
";",
"ld",
"=",
"ld",
"->",
"next",
")",
"{",
"FCurve",
"*",
"fcu",
"=",
"(",
"FCurve",
"*",
")",
"ld",
"->",
"data",
";",
"fcurve_to_keylist",
"(",
"pfl",
"->",
"ob",
"->",
"adt",
",",
"fcu",
",",
"&",
"pso",
"->",
"keys",
",",
"0",
")",
";",
"}",
"}",
"if",
"(",
"pso",
"->",
"keys",
".",
"root",
")",
"{",
"ActKeyColumn",
"*",
"ak",
";",
"float",
"cframe",
"=",
"(",
"float",
")",
"pso",
"->",
"cframe",
";",
"ak",
"=",
"(",
"ActKeyColumn",
"*",
")",
"BLI_dlrbTree_search_exact",
"(",
"&",
"pso",
"->",
"keys",
",",
"compare_ak_cfraPtr",
",",
"&",
"cframe",
")",
";",
"if",
"(",
"ak",
"==",
"NULL",
")",
"{",
"ActKeyColumn",
"*",
"pk",
"=",
"(",
"ActKeyColumn",
"*",
")",
"BLI_dlrbTree_search_prev",
"(",
"&",
"pso",
"->",
"keys",
",",
"compare_ak_cfraPtr",
",",
"&",
"cframe",
")",
";",
"ActKeyColumn",
"*",
"nk",
"=",
"(",
"ActKeyColumn",
"*",
")",
"BLI_dlrbTree_search_next",
"(",
"&",
"pso",
"->",
"keys",
",",
"compare_ak_cfraPtr",
",",
"&",
"cframe",
")",
";",
"pso",
"->",
"prevFrame",
"=",
"(",
"pk",
")",
"?",
"(",
"pk",
"->",
"cfra",
")",
":",
"(",
"pso",
"->",
"cframe",
"-",
"1",
")",
";",
"RNA_int_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"pso",
"->",
"prevFrame",
")",
";",
"pso",
"->",
"nextFrame",
"=",
"(",
"nk",
")",
"?",
"(",
"nk",
"->",
"cfra",
")",
":",
"(",
"pso",
"->",
"cframe",
"+",
"1",
")",
";",
"RNA_int_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"pso",
"->",
"nextFrame",
")",
";",
"}",
"else",
"{",
"pso",
"->",
"prevFrame",
"=",
"(",
"ak",
"->",
"prev",
")",
"?",
"(",
"ak",
"->",
"prev",
"->",
"cfra",
")",
":",
"(",
"pso",
"->",
"cframe",
"-",
"1",
")",
";",
"RNA_int_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"pso",
"->",
"prevFrame",
")",
";",
"pso",
"->",
"nextFrame",
"=",
"(",
"ak",
"->",
"next",
")",
"?",
"(",
"ak",
"->",
"next",
"->",
"cfra",
")",
":",
"(",
"pso",
"->",
"cframe",
"+",
"1",
")",
";",
"RNA_int_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"pso",
"->",
"nextFrame",
")",
";",
"}",
"for",
"(",
"uint",
"ob_index",
"=",
"0",
";",
"ob_index",
"<",
"pso",
"->",
"objects_len",
";",
"ob_index",
"++",
")",
"{",
"tPoseSlideObject",
"*",
"ob_data",
"=",
"&",
"pso",
"->",
"ob_data_array",
"[",
"ob_index",
"]",
";",
"if",
"(",
"ob_data",
"->",
"valid",
")",
"{",
"ob_data",
"->",
"prevFrameF",
"=",
"BKE_nla_tweakedit_remap",
"(",
"ob_data",
"->",
"ob",
"->",
"adt",
",",
"pso",
"->",
"prevFrame",
",",
"NLATIME_CONVERT_UNMAP",
")",
";",
"ob_data",
"->",
"nextFrameF",
"=",
"BKE_nla_tweakedit_remap",
"(",
"ob_data",
"->",
"ob",
"->",
"adt",
",",
"pso",
"->",
"nextFrame",
",",
"NLATIME_CONVERT_UNMAP",
")",
";",
"}",
"}",
"}",
"else",
"{",
"BKE_report",
"(",
"op",
"->",
"reports",
",",
"RPT_ERROR",
",",
"\"",
"\"",
")",
";",
"pose_slide_exit",
"(",
"op",
")",
";",
"return",
"OPERATOR_CANCELLED",
";",
"}",
"if",
"(",
"pso",
"->",
"mode",
"!=",
"POSESLIDE_PUSH_REST",
"&&",
"pso",
"->",
"mode",
"!=",
"POSESLIDE_RELAX_REST",
")",
"{",
"pose_slide_apply",
"(",
"C",
",",
"pso",
")",
";",
"}",
"else",
"{",
"pose_slide_rest_pose_apply",
"(",
"C",
",",
"pso",
")",
";",
"}",
"pose_slide_refresh",
"(",
"C",
",",
"pso",
")",
";",
"WM_cursor_modal_set",
"(",
"win",
",",
"WM_CURSOR_EW_SCROLL",
")",
";",
"pose_slide_draw_status",
"(",
"pso",
")",
";",
"WM_event_add_modal_handler",
"(",
"C",
",",
"op",
")",
";",
"return",
"OPERATOR_RUNNING_MODAL",
";",
"}"
] | common code for invoke() methods | [
"common",
"code",
"for",
"invoke",
"()",
"methods"
] | [
"/* for each link, add all its keyframes to the search tree */",
"/* do this for each F-Curve */",
"/* cancel if no keyframes found... */",
"/* firstly, check if the current frame is a keyframe... */",
"/* current frame is not a keyframe, so search */",
"/* new set the frames */",
"/* prev frame */",
"/* next frame */",
"/* current frame itself is a keyframe, so just take keyframes on either side */",
"/* prev frame */",
"/* next frame */",
"/* apply NLA mapping corrections so the frame lookups work */",
"/* initial apply for operator... */",
"/* TODO: need to calculate percentage for initial round too... */",
"/* depsgraph updates + redraws */",
"/* set cursor to indicate modal */",
"/* header print */",
"/* add a modal handler for this operator */"
] | [
{
"param": "C",
"type": "bContext"
},
{
"param": "op",
"type": "wmOperator"
},
{
"param": "pso",
"type": "tPoseSlideOp"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "op",
"type": "wmOperator",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pso",
"type": "tPoseSlideOp",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7ed41b5b4d0c13a100aa7baeed43b08fc9050d9a | DemonRem/blender | source/blender/editors/armature/pose_slide.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | pose_slide_mouse_update_percentage | void | static void pose_slide_mouse_update_percentage(tPoseSlideOp *pso,
wmOperator *op,
const wmEvent *event)
{
pso->percentage = (event->x - pso->ar->winrct.xmin) / ((float)pso->ar->winx);
RNA_float_set(op->ptr, "percentage", pso->percentage);
} | /* calculate percentage based on position of mouse (we only use x-axis for now.
* since this is more convenient for users to do), and store new percentage value
*/ | calculate percentage based on position of mouse (we only use x-axis for now.
since this is more convenient for users to do), and store new percentage value | [
"calculate",
"percentage",
"based",
"on",
"position",
"of",
"mouse",
"(",
"we",
"only",
"use",
"x",
"-",
"axis",
"for",
"now",
".",
"since",
"this",
"is",
"more",
"convenient",
"for",
"users",
"to",
"do",
")",
"and",
"store",
"new",
"percentage",
"value"
] | static void pose_slide_mouse_update_percentage(tPoseSlideOp *pso,
wmOperator *op,
const wmEvent *event)
{
pso->percentage = (event->x - pso->ar->winrct.xmin) / ((float)pso->ar->winx);
RNA_float_set(op->ptr, "percentage", pso->percentage);
} | [
"static",
"void",
"pose_slide_mouse_update_percentage",
"(",
"tPoseSlideOp",
"*",
"pso",
",",
"wmOperator",
"*",
"op",
",",
"const",
"wmEvent",
"*",
"event",
")",
"{",
"pso",
"->",
"percentage",
"=",
"(",
"event",
"->",
"x",
"-",
"pso",
"->",
"ar",
"->",
"winrct",
".",
"xmin",
")",
"/",
"(",
"(",
"float",
")",
"pso",
"->",
"ar",
"->",
"winx",
")",
";",
"RNA_float_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"pso",
"->",
"percentage",
")",
";",
"}"
] | calculate percentage based on position of mouse (we only use x-axis for now. | [
"calculate",
"percentage",
"based",
"on",
"position",
"of",
"mouse",
"(",
"we",
"only",
"use",
"x",
"-",
"axis",
"for",
"now",
"."
] | [] | [
{
"param": "pso",
"type": "tPoseSlideOp"
},
{
"param": "op",
"type": "wmOperator"
},
{
"param": "event",
"type": "wmEvent"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pso",
"type": "tPoseSlideOp",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "op",
"type": "wmOperator",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "event",
"type": "wmEvent",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7ed41b5b4d0c13a100aa7baeed43b08fc9050d9a | DemonRem/blender | source/blender/editors/armature/pose_slide.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | pose_slide_exec_common | int | static int pose_slide_exec_common(bContext *C, wmOperator *op, tPoseSlideOp *pso)
{
/* settings should have been set up ok for applying, so just apply! */
if (pso->mode != POSESLIDE_PUSH_REST && pso->mode != POSESLIDE_RELAX_REST) {
pose_slide_apply(C, pso);
}
else {
pose_slide_rest_pose_apply(C, pso);
}
/* insert keyframes if needed */
pose_slide_autoKeyframe(C, pso);
/* cleanup and done */
pose_slide_exit(op);
return OPERATOR_FINISHED;
} | /* common code for exec() methods */ | common code for exec() methods | [
"common",
"code",
"for",
"exec",
"()",
"methods"
] | static int pose_slide_exec_common(bContext *C, wmOperator *op, tPoseSlideOp *pso)
{
if (pso->mode != POSESLIDE_PUSH_REST && pso->mode != POSESLIDE_RELAX_REST) {
pose_slide_apply(C, pso);
}
else {
pose_slide_rest_pose_apply(C, pso);
}
pose_slide_autoKeyframe(C, pso);
pose_slide_exit(op);
return OPERATOR_FINISHED;
} | [
"static",
"int",
"pose_slide_exec_common",
"(",
"bContext",
"*",
"C",
",",
"wmOperator",
"*",
"op",
",",
"tPoseSlideOp",
"*",
"pso",
")",
"{",
"if",
"(",
"pso",
"->",
"mode",
"!=",
"POSESLIDE_PUSH_REST",
"&&",
"pso",
"->",
"mode",
"!=",
"POSESLIDE_RELAX_REST",
")",
"{",
"pose_slide_apply",
"(",
"C",
",",
"pso",
")",
";",
"}",
"else",
"{",
"pose_slide_rest_pose_apply",
"(",
"C",
",",
"pso",
")",
";",
"}",
"pose_slide_autoKeyframe",
"(",
"C",
",",
"pso",
")",
";",
"pose_slide_exit",
"(",
"op",
")",
";",
"return",
"OPERATOR_FINISHED",
";",
"}"
] | common code for exec() methods | [
"common",
"code",
"for",
"exec",
"()",
"methods"
] | [
"/* settings should have been set up ok for applying, so just apply! */",
"/* insert keyframes if needed */",
"/* cleanup and done */"
] | [
{
"param": "C",
"type": "bContext"
},
{
"param": "op",
"type": "wmOperator"
},
{
"param": "pso",
"type": "tPoseSlideOp"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "op",
"type": "wmOperator",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pso",
"type": "tPoseSlideOp",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7ed41b5b4d0c13a100aa7baeed43b08fc9050d9a | DemonRem/blender | source/blender/editors/armature/pose_slide.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | pose_slide_push_invoke | int | static int pose_slide_push_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
tPoseSlideOp *pso;
/* initialize data */
if (pose_slide_init(C, op, POSESLIDE_PUSH) == 0) {
pose_slide_exit(op);
return OPERATOR_CANCELLED;
}
else {
pso = op->customdata;
}
/* initialise percentage so that it won't pop on first mouse move */
pose_slide_mouse_update_percentage(pso, op, event);
/* do common setup work */
return pose_slide_invoke_common(C, op, pso);
} | /* invoke() - for 'push from breakdown' mode */ | for 'push from breakdown' mode | [
"for",
"'",
"push",
"from",
"breakdown",
"'",
"mode"
] | static int pose_slide_push_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
tPoseSlideOp *pso;
if (pose_slide_init(C, op, POSESLIDE_PUSH) == 0) {
pose_slide_exit(op);
return OPERATOR_CANCELLED;
}
else {
pso = op->customdata;
}
pose_slide_mouse_update_percentage(pso, op, event);
return pose_slide_invoke_common(C, op, pso);
} | [
"static",
"int",
"pose_slide_push_invoke",
"(",
"bContext",
"*",
"C",
",",
"wmOperator",
"*",
"op",
",",
"const",
"wmEvent",
"*",
"event",
")",
"{",
"tPoseSlideOp",
"*",
"pso",
";",
"if",
"(",
"pose_slide_init",
"(",
"C",
",",
"op",
",",
"POSESLIDE_PUSH",
")",
"==",
"0",
")",
"{",
"pose_slide_exit",
"(",
"op",
")",
";",
"return",
"OPERATOR_CANCELLED",
";",
"}",
"else",
"{",
"pso",
"=",
"op",
"->",
"customdata",
";",
"}",
"pose_slide_mouse_update_percentage",
"(",
"pso",
",",
"op",
",",
"event",
")",
";",
"return",
"pose_slide_invoke_common",
"(",
"C",
",",
"op",
",",
"pso",
")",
";",
"}"
] | invoke() - for 'push from breakdown' mode | [
"invoke",
"()",
"-",
"for",
"'",
"push",
"from",
"breakdown",
"'",
"mode"
] | [
"/* initialize data */",
"/* initialise percentage so that it won't pop on first mouse move */",
"/* do common setup work */"
] | [
{
"param": "C",
"type": "bContext"
},
{
"param": "op",
"type": "wmOperator"
},
{
"param": "event",
"type": "wmEvent"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "op",
"type": "wmOperator",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "event",
"type": "wmEvent",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7ed41b5b4d0c13a100aa7baeed43b08fc9050d9a | DemonRem/blender | source/blender/editors/armature/pose_slide.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | pose_slide_relax_invoke | int | static int pose_slide_relax_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
tPoseSlideOp *pso;
/* initialize data */
if (pose_slide_init(C, op, POSESLIDE_RELAX) == 0) {
pose_slide_exit(op);
return OPERATOR_CANCELLED;
}
else {
pso = op->customdata;
}
/* initialise percentage so that it won't pop on first mouse move */
pose_slide_mouse_update_percentage(pso, op, event);
/* do common setup work */
return pose_slide_invoke_common(C, op, pso);
} | /* invoke() - for 'relax to breakdown' mode */ | for 'relax to breakdown' mode | [
"for",
"'",
"relax",
"to",
"breakdown",
"'",
"mode"
] | static int pose_slide_relax_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
tPoseSlideOp *pso;
if (pose_slide_init(C, op, POSESLIDE_RELAX) == 0) {
pose_slide_exit(op);
return OPERATOR_CANCELLED;
}
else {
pso = op->customdata;
}
pose_slide_mouse_update_percentage(pso, op, event);
return pose_slide_invoke_common(C, op, pso);
} | [
"static",
"int",
"pose_slide_relax_invoke",
"(",
"bContext",
"*",
"C",
",",
"wmOperator",
"*",
"op",
",",
"const",
"wmEvent",
"*",
"event",
")",
"{",
"tPoseSlideOp",
"*",
"pso",
";",
"if",
"(",
"pose_slide_init",
"(",
"C",
",",
"op",
",",
"POSESLIDE_RELAX",
")",
"==",
"0",
")",
"{",
"pose_slide_exit",
"(",
"op",
")",
";",
"return",
"OPERATOR_CANCELLED",
";",
"}",
"else",
"{",
"pso",
"=",
"op",
"->",
"customdata",
";",
"}",
"pose_slide_mouse_update_percentage",
"(",
"pso",
",",
"op",
",",
"event",
")",
";",
"return",
"pose_slide_invoke_common",
"(",
"C",
",",
"op",
",",
"pso",
")",
";",
"}"
] | invoke() - for 'relax to breakdown' mode | [
"invoke",
"()",
"-",
"for",
"'",
"relax",
"to",
"breakdown",
"'",
"mode"
] | [
"/* initialize data */",
"/* initialise percentage so that it won't pop on first mouse move */",
"/* do common setup work */"
] | [
{
"param": "C",
"type": "bContext"
},
{
"param": "op",
"type": "wmOperator"
},
{
"param": "event",
"type": "wmEvent"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "op",
"type": "wmOperator",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "event",
"type": "wmEvent",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7ed41b5b4d0c13a100aa7baeed43b08fc9050d9a | DemonRem/blender | source/blender/editors/armature/pose_slide.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | pose_slide_push_rest_invoke | int | static int pose_slide_push_rest_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
tPoseSlideOp *pso;
/* initialize data */
if (pose_slide_init(C, op, POSESLIDE_PUSH_REST) == 0) {
pose_slide_exit(op);
return OPERATOR_CANCELLED;
}
else {
pso = op->customdata;
}
/* initialise percentage so that it won't pop on first mouse move */
pose_slide_mouse_update_percentage(pso, op, event);
/* do common setup work */
return pose_slide_invoke_common(C, op, pso);
} | /* ........................ */
/* invoke() - for 'push from rest pose' mode */ | for 'push from rest pose' mode | [
"for",
"'",
"push",
"from",
"rest",
"pose",
"'",
"mode"
] | static int pose_slide_push_rest_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
tPoseSlideOp *pso;
if (pose_slide_init(C, op, POSESLIDE_PUSH_REST) == 0) {
pose_slide_exit(op);
return OPERATOR_CANCELLED;
}
else {
pso = op->customdata;
}
pose_slide_mouse_update_percentage(pso, op, event);
return pose_slide_invoke_common(C, op, pso);
} | [
"static",
"int",
"pose_slide_push_rest_invoke",
"(",
"bContext",
"*",
"C",
",",
"wmOperator",
"*",
"op",
",",
"const",
"wmEvent",
"*",
"event",
")",
"{",
"tPoseSlideOp",
"*",
"pso",
";",
"if",
"(",
"pose_slide_init",
"(",
"C",
",",
"op",
",",
"POSESLIDE_PUSH_REST",
")",
"==",
"0",
")",
"{",
"pose_slide_exit",
"(",
"op",
")",
";",
"return",
"OPERATOR_CANCELLED",
";",
"}",
"else",
"{",
"pso",
"=",
"op",
"->",
"customdata",
";",
"}",
"pose_slide_mouse_update_percentage",
"(",
"pso",
",",
"op",
",",
"event",
")",
";",
"return",
"pose_slide_invoke_common",
"(",
"C",
",",
"op",
",",
"pso",
")",
";",
"}"
] | ........................
invoke() - for 'push from rest pose' mode | [
"........................",
"invoke",
"()",
"-",
"for",
"'",
"push",
"from",
"rest",
"pose",
"'",
"mode"
] | [
"/* initialize data */",
"/* initialise percentage so that it won't pop on first mouse move */",
"/* do common setup work */"
] | [
{
"param": "C",
"type": "bContext"
},
{
"param": "op",
"type": "wmOperator"
},
{
"param": "event",
"type": "wmEvent"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "op",
"type": "wmOperator",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "event",
"type": "wmEvent",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7ed41b5b4d0c13a100aa7baeed43b08fc9050d9a | DemonRem/blender | source/blender/editors/armature/pose_slide.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | pose_propagate_fcurve | void | static void pose_propagate_fcurve(
wmOperator *op, Object *ob, FCurve *fcu, float startFrame, tPosePropagate_ModeData modeData)
{
const int mode = RNA_enum_get(op->ptr, "mode");
BezTriple *bezt;
float refVal = 0.0f;
bool keyExists;
int i, match;
short first = 1;
/* skip if no keyframes to edit */
if ((fcu->bezt == NULL) || (fcu->totvert < 2)) {
return;
}
/* find the reference value from bones directly, which means that the user
* doesn't need to firstly keyframe the pose (though this doesn't mean that
* they can't either)
*/
if (!pose_propagate_get_refVal(ob, fcu, &refVal)) {
return;
}
/* find the first keyframe to start propagating from
* - if there's a keyframe on the current frame, we probably want to save this value there too
* since it may be as of yet unkeyed
* - if starting before the starting frame, don't touch the key, as it may have had some valid
* values
* - if only doing selected keyframes, start from the first one
*/
if (mode != POSE_PROPAGATE_SELECTED_KEYS) {
match = binarysearch_bezt_index(fcu->bezt, startFrame, fcu->totvert, &keyExists);
if (fcu->bezt[match].vec[1][0] < startFrame) {
i = match + 1;
}
else {
i = match;
}
}
else {
/* selected - start from first keyframe */
i = 0;
}
for (bezt = &fcu->bezt[i]; i < fcu->totvert; i++, bezt++) {
/* additional termination conditions based on the operator 'mode' property go here... */
if (ELEM(mode, POSE_PROPAGATE_BEFORE_FRAME, POSE_PROPAGATE_SMART_HOLDS)) {
/* stop if keyframe is outside the accepted range */
if (bezt->vec[1][0] > modeData.end_frame) {
break;
}
}
else if (mode == POSE_PROPAGATE_NEXT_KEY) {
/* stop after the first keyframe has been processed */
if (first == 0) {
break;
}
}
else if (mode == POSE_PROPAGATE_LAST_KEY) {
/* only affect this frame if it will be the last one */
if (i != (fcu->totvert - 1)) {
continue;
}
}
else if (mode == POSE_PROPAGATE_SELECTED_MARKERS) {
/* only allow if there's a marker on this frame */
CfraElem *ce = NULL;
/* stop on matching marker if there is one */
for (ce = modeData.sel_markers.first; ce; ce = ce->next) {
if (ce->cfra == round_fl_to_int(bezt->vec[1][0])) {
break;
}
}
/* skip this keyframe if no marker */
if (ce == NULL) {
continue;
}
}
else if (mode == POSE_PROPAGATE_SELECTED_KEYS) {
/* only allow if this keyframe is already selected - skip otherwise */
if (BEZT_ISSEL_ANY(bezt) == 0) {
continue;
}
}
/* just flatten handles, since values will now be the same either side... */
/* TODO: perhaps a fade-out modulation of the value is required here (optional once again)? */
bezt->vec[0][1] = bezt->vec[1][1] = bezt->vec[2][1] = refVal;
/* select keyframe to indicate that it's been changed */
bezt->f2 |= SELECT;
first = 0;
}
} | /* propagate just works along each F-Curve in turn */ | propagate just works along each F-Curve in turn | [
"propagate",
"just",
"works",
"along",
"each",
"F",
"-",
"Curve",
"in",
"turn"
] | static void pose_propagate_fcurve(
wmOperator *op, Object *ob, FCurve *fcu, float startFrame, tPosePropagate_ModeData modeData)
{
const int mode = RNA_enum_get(op->ptr, "mode");
BezTriple *bezt;
float refVal = 0.0f;
bool keyExists;
int i, match;
short first = 1;
if ((fcu->bezt == NULL) || (fcu->totvert < 2)) {
return;
}
if (!pose_propagate_get_refVal(ob, fcu, &refVal)) {
return;
}
if (mode != POSE_PROPAGATE_SELECTED_KEYS) {
match = binarysearch_bezt_index(fcu->bezt, startFrame, fcu->totvert, &keyExists);
if (fcu->bezt[match].vec[1][0] < startFrame) {
i = match + 1;
}
else {
i = match;
}
}
else {
i = 0;
}
for (bezt = &fcu->bezt[i]; i < fcu->totvert; i++, bezt++) {
if (ELEM(mode, POSE_PROPAGATE_BEFORE_FRAME, POSE_PROPAGATE_SMART_HOLDS)) {
if (bezt->vec[1][0] > modeData.end_frame) {
break;
}
}
else if (mode == POSE_PROPAGATE_NEXT_KEY) {
if (first == 0) {
break;
}
}
else if (mode == POSE_PROPAGATE_LAST_KEY) {
if (i != (fcu->totvert - 1)) {
continue;
}
}
else if (mode == POSE_PROPAGATE_SELECTED_MARKERS) {
CfraElem *ce = NULL;
for (ce = modeData.sel_markers.first; ce; ce = ce->next) {
if (ce->cfra == round_fl_to_int(bezt->vec[1][0])) {
break;
}
}
if (ce == NULL) {
continue;
}
}
else if (mode == POSE_PROPAGATE_SELECTED_KEYS) {
if (BEZT_ISSEL_ANY(bezt) == 0) {
continue;
}
}
bezt->vec[0][1] = bezt->vec[1][1] = bezt->vec[2][1] = refVal;
bezt->f2 |= SELECT;
first = 0;
}
} | [
"static",
"void",
"pose_propagate_fcurve",
"(",
"wmOperator",
"*",
"op",
",",
"Object",
"*",
"ob",
",",
"FCurve",
"*",
"fcu",
",",
"float",
"startFrame",
",",
"tPosePropagate_ModeData",
"modeData",
")",
"{",
"const",
"int",
"mode",
"=",
"RNA_enum_get",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
")",
";",
"BezTriple",
"*",
"bezt",
";",
"float",
"refVal",
"=",
"0.0f",
";",
"bool",
"keyExists",
";",
"int",
"i",
",",
"match",
";",
"short",
"first",
"=",
"1",
";",
"if",
"(",
"(",
"fcu",
"->",
"bezt",
"==",
"NULL",
")",
"||",
"(",
"fcu",
"->",
"totvert",
"<",
"2",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"pose_propagate_get_refVal",
"(",
"ob",
",",
"fcu",
",",
"&",
"refVal",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"mode",
"!=",
"POSE_PROPAGATE_SELECTED_KEYS",
")",
"{",
"match",
"=",
"binarysearch_bezt_index",
"(",
"fcu",
"->",
"bezt",
",",
"startFrame",
",",
"fcu",
"->",
"totvert",
",",
"&",
"keyExists",
")",
";",
"if",
"(",
"fcu",
"->",
"bezt",
"[",
"match",
"]",
".",
"vec",
"[",
"1",
"]",
"[",
"0",
"]",
"<",
"startFrame",
")",
"{",
"i",
"=",
"match",
"+",
"1",
";",
"}",
"else",
"{",
"i",
"=",
"match",
";",
"}",
"}",
"else",
"{",
"i",
"=",
"0",
";",
"}",
"for",
"(",
"bezt",
"=",
"&",
"fcu",
"->",
"bezt",
"[",
"i",
"]",
";",
"i",
"<",
"fcu",
"->",
"totvert",
";",
"i",
"++",
",",
"bezt",
"++",
")",
"{",
"if",
"(",
"ELEM",
"(",
"mode",
",",
"POSE_PROPAGATE_BEFORE_FRAME",
",",
"POSE_PROPAGATE_SMART_HOLDS",
")",
")",
"{",
"if",
"(",
"bezt",
"->",
"vec",
"[",
"1",
"]",
"[",
"0",
"]",
">",
"modeData",
".",
"end_frame",
")",
"{",
"break",
";",
"}",
"}",
"else",
"if",
"(",
"mode",
"==",
"POSE_PROPAGATE_NEXT_KEY",
")",
"{",
"if",
"(",
"first",
"==",
"0",
")",
"{",
"break",
";",
"}",
"}",
"else",
"if",
"(",
"mode",
"==",
"POSE_PROPAGATE_LAST_KEY",
")",
"{",
"if",
"(",
"i",
"!=",
"(",
"fcu",
"->",
"totvert",
"-",
"1",
")",
")",
"{",
"continue",
";",
"}",
"}",
"else",
"if",
"(",
"mode",
"==",
"POSE_PROPAGATE_SELECTED_MARKERS",
")",
"{",
"CfraElem",
"*",
"ce",
"=",
"NULL",
";",
"for",
"(",
"ce",
"=",
"modeData",
".",
"sel_markers",
".",
"first",
";",
"ce",
";",
"ce",
"=",
"ce",
"->",
"next",
")",
"{",
"if",
"(",
"ce",
"->",
"cfra",
"==",
"round_fl_to_int",
"(",
"bezt",
"->",
"vec",
"[",
"1",
"]",
"[",
"0",
"]",
")",
")",
"{",
"break",
";",
"}",
"}",
"if",
"(",
"ce",
"==",
"NULL",
")",
"{",
"continue",
";",
"}",
"}",
"else",
"if",
"(",
"mode",
"==",
"POSE_PROPAGATE_SELECTED_KEYS",
")",
"{",
"if",
"(",
"BEZT_ISSEL_ANY",
"(",
"bezt",
")",
"==",
"0",
")",
"{",
"continue",
";",
"}",
"}",
"bezt",
"->",
"vec",
"[",
"0",
"]",
"[",
"1",
"]",
"=",
"bezt",
"->",
"vec",
"[",
"1",
"]",
"[",
"1",
"]",
"=",
"bezt",
"->",
"vec",
"[",
"2",
"]",
"[",
"1",
"]",
"=",
"refVal",
";",
"bezt",
"->",
"f2",
"|=",
"SELECT",
";",
"first",
"=",
"0",
";",
"}",
"}"
] | propagate just works along each F-Curve in turn | [
"propagate",
"just",
"works",
"along",
"each",
"F",
"-",
"Curve",
"in",
"turn"
] | [
"/* skip if no keyframes to edit */",
"/* find the reference value from bones directly, which means that the user\n * doesn't need to firstly keyframe the pose (though this doesn't mean that\n * they can't either)\n */",
"/* find the first keyframe to start propagating from\n * - if there's a keyframe on the current frame, we probably want to save this value there too\n * since it may be as of yet unkeyed\n * - if starting before the starting frame, don't touch the key, as it may have had some valid\n * values\n * - if only doing selected keyframes, start from the first one\n */",
"/* selected - start from first keyframe */",
"/* additional termination conditions based on the operator 'mode' property go here... */",
"/* stop if keyframe is outside the accepted range */",
"/* stop after the first keyframe has been processed */",
"/* only affect this frame if it will be the last one */",
"/* only allow if there's a marker on this frame */",
"/* stop on matching marker if there is one */",
"/* skip this keyframe if no marker */",
"/* only allow if this keyframe is already selected - skip otherwise */",
"/* just flatten handles, since values will now be the same either side... */",
"/* TODO: perhaps a fade-out modulation of the value is required here (optional once again)? */",
"/* select keyframe to indicate that it's been changed */"
] | [
{
"param": "op",
"type": "wmOperator"
},
{
"param": "ob",
"type": "Object"
},
{
"param": "fcu",
"type": "FCurve"
},
{
"param": "startFrame",
"type": "float"
},
{
"param": "modeData",
"type": "tPosePropagate_ModeData"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "op",
"type": "wmOperator",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ob",
"type": "Object",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fcu",
"type": "FCurve",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "startFrame",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "modeData",
"type": "tPosePropagate_ModeData",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c999e1ad14e50e1d0f0fd206de6e0035d0f903d5 | DemonRem/blender | source/blender/blenkernel/intern/shader_fx.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | BKE_shaderfx_has_gpencil | bool | bool BKE_shaderfx_has_gpencil(Object *ob)
{
ShaderFxData *fx;
for (fx = ob->shader_fx.first; fx; fx = fx->next) {
const ShaderFxTypeInfo *fxi = BKE_shaderfxType_getInfo(fx->type);
if (fxi->type == eShaderFxType_GpencilType) {
return true;
}
}
return false;
} | /* check if exist grease pencil effects */ | check if exist grease pencil effects | [
"check",
"if",
"exist",
"grease",
"pencil",
"effects"
] | bool BKE_shaderfx_has_gpencil(Object *ob)
{
ShaderFxData *fx;
for (fx = ob->shader_fx.first; fx; fx = fx->next) {
const ShaderFxTypeInfo *fxi = BKE_shaderfxType_getInfo(fx->type);
if (fxi->type == eShaderFxType_GpencilType) {
return true;
}
}
return false;
} | [
"bool",
"BKE_shaderfx_has_gpencil",
"(",
"Object",
"*",
"ob",
")",
"{",
"ShaderFxData",
"*",
"fx",
";",
"for",
"(",
"fx",
"=",
"ob",
"->",
"shader_fx",
".",
"first",
";",
"fx",
";",
"fx",
"=",
"fx",
"->",
"next",
")",
"{",
"const",
"ShaderFxTypeInfo",
"*",
"fxi",
"=",
"BKE_shaderfxType_getInfo",
"(",
"fx",
"->",
"type",
")",
";",
"if",
"(",
"fxi",
"->",
"type",
"==",
"eShaderFxType_GpencilType",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | check if exist grease pencil effects | [
"check",
"if",
"exist",
"grease",
"pencil",
"effects"
] | [] | [
{
"param": "ob",
"type": "Object"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ob",
"type": "Object",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ac432bf0b64bf996660dbad8f36fd0e7ca749861 | DemonRem/blender | source/blender/blenkernel/intern/blender.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | BKE_blender_free | void | void BKE_blender_free(void)
{
/* samples are in a global list..., also sets G_MAIN->sound->sample NULL */
/* Needs to run before main free as wm is still referenced for icons preview jobs. */
BKE_studiolight_free();
BKE_main_free(G_MAIN);
G_MAIN = NULL;
if (G.log.file != NULL) {
fclose(G.log.file);
}
BKE_spacetypes_free(); /* after free main, it uses space callbacks */
IMB_exit();
BKE_cachefiles_exit();
BKE_images_exit();
DEG_free_node_types();
BKE_brush_system_exit();
RE_texture_rng_exit();
BKE_callback_global_finalize();
IMB_moviecache_destruct();
free_nodesystem();
} | /* only to be called on exit blender */ | only to be called on exit blender | [
"only",
"to",
"be",
"called",
"on",
"exit",
"blender"
] | void BKE_blender_free(void)
{
BKE_studiolight_free();
BKE_main_free(G_MAIN);
G_MAIN = NULL;
if (G.log.file != NULL) {
fclose(G.log.file);
}
BKE_spacetypes_free();
IMB_exit();
BKE_cachefiles_exit();
BKE_images_exit();
DEG_free_node_types();
BKE_brush_system_exit();
RE_texture_rng_exit();
BKE_callback_global_finalize();
IMB_moviecache_destruct();
free_nodesystem();
} | [
"void",
"BKE_blender_free",
"(",
"void",
")",
"{",
"BKE_studiolight_free",
"(",
")",
";",
"BKE_main_free",
"(",
"G_MAIN",
")",
";",
"G_MAIN",
"=",
"NULL",
";",
"if",
"(",
"G",
".",
"log",
".",
"file",
"!=",
"NULL",
")",
"{",
"fclose",
"(",
"G",
".",
"log",
".",
"file",
")",
";",
"}",
"BKE_spacetypes_free",
"(",
")",
";",
"IMB_exit",
"(",
")",
";",
"BKE_cachefiles_exit",
"(",
")",
";",
"BKE_images_exit",
"(",
")",
";",
"DEG_free_node_types",
"(",
")",
";",
"BKE_brush_system_exit",
"(",
")",
";",
"RE_texture_rng_exit",
"(",
")",
";",
"BKE_callback_global_finalize",
"(",
")",
";",
"IMB_moviecache_destruct",
"(",
")",
";",
"free_nodesystem",
"(",
")",
";",
"}"
] | only to be called on exit blender | [
"only",
"to",
"be",
"called",
"on",
"exit",
"blender"
] | [
"/* samples are in a global list..., also sets G_MAIN->sound->sample NULL */",
"/* Needs to run before main free as wm is still referenced for icons preview jobs. */",
"/* after free main, it uses space callbacks */"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
ac432bf0b64bf996660dbad8f36fd0e7ca749861 | DemonRem/blender | source/blender/blenkernel/intern/blender.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | BKE_blender_userdef_data_free | void | void BKE_blender_userdef_data_free(UserDef *userdef, bool clear_fonts)
{
#define U _invalid_access_ /* ensure no accidental global access */
#ifdef U /* quiet warning */
#endif
userdef_free_keymaps(userdef);
userdef_free_keyconfig_prefs(userdef);
userdef_free_user_menus(userdef);
userdef_free_addons(userdef);
if (clear_fonts) {
for (uiFont *font = userdef->uifonts.first; font; font = font->next) {
BLF_unload_id(font->blf_id);
}
BLF_default_set(-1);
}
BLI_freelistN(&userdef->autoexec_paths);
BLI_freelistN(&userdef->uistyles);
BLI_freelistN(&userdef->uifonts);
BLI_freelistN(&userdef->themes);
#undef U
} | /**
* When loading a new userdef from file,
* or when exiting Blender.
*/ | When loading a new userdef from file,
or when exiting Blender. | [
"When",
"loading",
"a",
"new",
"userdef",
"from",
"file",
"or",
"when",
"exiting",
"Blender",
"."
] | void BKE_blender_userdef_data_free(UserDef *userdef, bool clear_fonts)
{
#define U _invalid_access_ /* ensure no accidental global access */
#ifdef U
#endif
userdef_free_keymaps(userdef);
userdef_free_keyconfig_prefs(userdef);
userdef_free_user_menus(userdef);
userdef_free_addons(userdef);
if (clear_fonts) {
for (uiFont *font = userdef->uifonts.first; font; font = font->next) {
BLF_unload_id(font->blf_id);
}
BLF_default_set(-1);
}
BLI_freelistN(&userdef->autoexec_paths);
BLI_freelistN(&userdef->uistyles);
BLI_freelistN(&userdef->uifonts);
BLI_freelistN(&userdef->themes);
#undef U
} | [
"void",
"BKE_blender_userdef_data_free",
"(",
"UserDef",
"*",
"userdef",
",",
"bool",
"clear_fonts",
")",
"{",
"#define",
"U",
" _invalid_access_ /* ensure no accidental global access */",
"\n",
"#ifdef",
"U",
"#endif",
"userdef_free_keymaps",
"(",
"userdef",
")",
";",
"userdef_free_keyconfig_prefs",
"(",
"userdef",
")",
";",
"userdef_free_user_menus",
"(",
"userdef",
")",
";",
"userdef_free_addons",
"(",
"userdef",
")",
";",
"if",
"(",
"clear_fonts",
")",
"{",
"for",
"(",
"uiFont",
"*",
"font",
"=",
"userdef",
"->",
"uifonts",
".",
"first",
";",
"font",
";",
"font",
"=",
"font",
"->",
"next",
")",
"{",
"BLF_unload_id",
"(",
"font",
"->",
"blf_id",
")",
";",
"}",
"BLF_default_set",
"(",
"-1",
")",
";",
"}",
"BLI_freelistN",
"(",
"&",
"userdef",
"->",
"autoexec_paths",
")",
";",
"BLI_freelistN",
"(",
"&",
"userdef",
"->",
"uistyles",
")",
";",
"BLI_freelistN",
"(",
"&",
"userdef",
"->",
"uifonts",
")",
";",
"BLI_freelistN",
"(",
"&",
"userdef",
"->",
"themes",
")",
";",
"#undef",
" U",
"\n",
"}"
] | When loading a new userdef from file,
or when exiting Blender. | [
"When",
"loading",
"a",
"new",
"userdef",
"from",
"file",
"or",
"when",
"exiting",
"Blender",
"."
] | [
"/* quiet warning */"
] | [
{
"param": "userdef",
"type": "UserDef"
},
{
"param": "clear_fonts",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "userdef",
"type": "UserDef",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "clear_fonts",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ac432bf0b64bf996660dbad8f36fd0e7ca749861 | DemonRem/blender | source/blender/blenkernel/intern/blender.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | BKE_blender_userdef_app_template_data_swap | void | void BKE_blender_userdef_app_template_data_swap(UserDef *userdef_a, UserDef *userdef_b)
{
/* TODO:
* - various minor settings (add as needed).
*/
#define DATA_SWAP(id) \
{ \
UserDef userdef_tmp; \
memcpy(&(userdef_tmp.id), &(userdef_a->id), sizeof(userdef_tmp.id)); \
memcpy(&(userdef_a->id), &(userdef_b->id), sizeof(userdef_tmp.id)); \
memcpy(&(userdef_b->id), &(userdef_tmp.id), sizeof(userdef_tmp.id)); \
} \
((void)0)
#define LIST_SWAP(id) \
{ \
SWAP(ListBase, userdef_a->id, userdef_b->id); \
} \
((void)0)
#define FLAG_SWAP(id, ty, flags) \
{ \
CHECK_TYPE(&(userdef_a->id), ty *); \
const ty f = flags; \
const ty a = userdef_a->id; \
const ty b = userdef_b->id; \
userdef_a->id = (userdef_a->id & ~f) | (b & f); \
userdef_b->id = (userdef_b->id & ~f) | (a & f); \
} \
((void)0)
LIST_SWAP(uistyles);
LIST_SWAP(uifonts);
LIST_SWAP(themes);
LIST_SWAP(addons);
LIST_SWAP(user_keymaps);
LIST_SWAP(user_keyconfig_prefs);
DATA_SWAP(font_path_ui);
DATA_SWAP(font_path_ui_mono);
DATA_SWAP(keyconfigstr);
DATA_SWAP(gizmo_flag);
DATA_SWAP(app_flag);
/* We could add others. */
FLAG_SWAP(uiflag, int, USER_SAVE_PROMPT);
#undef SWAP_TYPELESS
#undef DATA_SWAP
#undef LIST_SWAP
#undef FLAG_SWAP
} | /**
* Write U from userdef.
* This function defines which settings a template will override for the user preferences.
*/ | Write U from userdef.
This function defines which settings a template will override for the user preferences. | [
"Write",
"U",
"from",
"userdef",
".",
"This",
"function",
"defines",
"which",
"settings",
"a",
"template",
"will",
"override",
"for",
"the",
"user",
"preferences",
"."
] | void BKE_blender_userdef_app_template_data_swap(UserDef *userdef_a, UserDef *userdef_b)
{
#define DATA_SWAP(id) \
{ \
UserDef userdef_tmp; \
memcpy(&(userdef_tmp.id), &(userdef_a->id), sizeof(userdef_tmp.id)); \
memcpy(&(userdef_a->id), &(userdef_b->id), sizeof(userdef_tmp.id)); \
memcpy(&(userdef_b->id), &(userdef_tmp.id), sizeof(userdef_tmp.id)); \
} \
((void)0)
#define LIST_SWAP(id) \
{ \
SWAP(ListBase, userdef_a->id, userdef_b->id); \
} \
((void)0)
#define FLAG_SWAP(id, ty, flags) \
{ \
CHECK_TYPE(&(userdef_a->id), ty *); \
const ty f = flags; \
const ty a = userdef_a->id; \
const ty b = userdef_b->id; \
userdef_a->id = (userdef_a->id & ~f) | (b & f); \
userdef_b->id = (userdef_b->id & ~f) | (a & f); \
} \
((void)0)
LIST_SWAP(uistyles);
LIST_SWAP(uifonts);
LIST_SWAP(themes);
LIST_SWAP(addons);
LIST_SWAP(user_keymaps);
LIST_SWAP(user_keyconfig_prefs);
DATA_SWAP(font_path_ui);
DATA_SWAP(font_path_ui_mono);
DATA_SWAP(keyconfigstr);
DATA_SWAP(gizmo_flag);
DATA_SWAP(app_flag);
FLAG_SWAP(uiflag, int, USER_SAVE_PROMPT);
#undef SWAP_TYPELESS
#undef DATA_SWAP
#undef LIST_SWAP
#undef FLAG_SWAP
} | [
"void",
"BKE_blender_userdef_app_template_data_swap",
"(",
"UserDef",
"*",
"userdef_a",
",",
"UserDef",
"*",
"userdef_b",
")",
"{",
"#define",
"DATA_SWAP",
"(",
"id",
")",
" \\\n { \\\n UserDef userdef_tmp; \\\n memcpy(&(userdef_tmp.id), &(userdef_a->id), sizeof(userdef_tmp.id)); \\\n memcpy(&(userdef_a->id), &(userdef_b->id), sizeof(userdef_tmp.id)); \\\n memcpy(&(userdef_b->id), &(userdef_tmp.id), sizeof(userdef_tmp.id)); \\\n } \\\n ((void)0)",
"\n\n",
"#define",
"LIST_SWAP",
"(",
"id",
")",
" \\\n { \\\n SWAP(ListBase, userdef_a->id, userdef_b->id); \\\n } \\\n ((void)0)",
"\n\n",
"#define",
"FLAG_SWAP",
"(",
"id",
",",
"ty",
",",
"flags",
")",
" \\\n { \\\n CHECK_TYPE(&(userdef_a->id), ty *); \\\n const ty f = flags; \\\n const ty a = userdef_a->id; \\\n const ty b = userdef_b->id; \\\n userdef_a->id = (userdef_a->id & ~f) | (b & f); \\\n userdef_b->id = (userdef_b->id & ~f) | (a & f); \\\n } \\\n ((void)0)",
"\n\n",
"LIST_SWAP",
"(",
"uistyles",
")",
";",
"LIST_SWAP",
"(",
"uifonts",
")",
";",
"LIST_SWAP",
"(",
"themes",
")",
";",
"LIST_SWAP",
"(",
"addons",
")",
";",
"LIST_SWAP",
"(",
"user_keymaps",
")",
";",
"LIST_SWAP",
"(",
"user_keyconfig_prefs",
")",
";",
"DATA_SWAP",
"(",
"font_path_ui",
")",
";",
"DATA_SWAP",
"(",
"font_path_ui_mono",
")",
";",
"DATA_SWAP",
"(",
"keyconfigstr",
")",
";",
"DATA_SWAP",
"(",
"gizmo_flag",
")",
";",
"DATA_SWAP",
"(",
"app_flag",
")",
";",
"FLAG_SWAP",
"(",
"uiflag",
",",
"int",
",",
"USER_SAVE_PROMPT",
")",
";",
"#undef",
" SWAP_TYPELESS",
"\n",
"#undef",
" DATA_SWAP",
"\n",
"#undef",
" LIST_SWAP",
"\n",
"#undef",
" FLAG_SWAP",
"\n",
"}"
] | Write U from userdef. | [
"Write",
"U",
"from",
"userdef",
"."
] | [
"/* TODO:\n * - various minor settings (add as needed).\n */",
"/* We could add others. */"
] | [
{
"param": "userdef_a",
"type": "UserDef"
},
{
"param": "userdef_b",
"type": "UserDef"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "userdef_a",
"type": "UserDef",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "userdef_b",
"type": "UserDef",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
357ef31c51f3a8623a3e0281e8401d6ce62e09a0 | DemonRem/blender | source/blender/editors/space_node/node_relationships.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | best_socket_input | bNodeSocket | static bNodeSocket *best_socket_input(bNodeTree *ntree, bNode *node, int num, int replace)
{
bNodeSocket *sock;
int socktype, maxtype = 0;
int a = 0;
for (sock = node->inputs.first; sock; sock = sock->next) {
maxtype = max_ii(sock->type, maxtype);
}
/* find sockets of higher 'types' first (i.e. image) */
for (socktype = maxtype; socktype >= 0; socktype--) {
for (sock = node->inputs.first; sock; sock = sock->next) {
if (!socket_is_available(ntree, sock, replace)) {
a++;
continue;
}
if (sock->type == socktype) {
/* increment to make sure we don't keep finding
* the same socket on every attempt running this function */
a++;
if (a > num) {
return sock;
}
}
}
}
return NULL;
} | /* this is a bit complicated, but designed to prioritize finding
* sockets of higher types, such as image, first */ | this is a bit complicated, but designed to prioritize finding
sockets of higher types, such as image, first | [
"this",
"is",
"a",
"bit",
"complicated",
"but",
"designed",
"to",
"prioritize",
"finding",
"sockets",
"of",
"higher",
"types",
"such",
"as",
"image",
"first"
] | static bNodeSocket *best_socket_input(bNodeTree *ntree, bNode *node, int num, int replace)
{
bNodeSocket *sock;
int socktype, maxtype = 0;
int a = 0;
for (sock = node->inputs.first; sock; sock = sock->next) {
maxtype = max_ii(sock->type, maxtype);
}
for (socktype = maxtype; socktype >= 0; socktype--) {
for (sock = node->inputs.first; sock; sock = sock->next) {
if (!socket_is_available(ntree, sock, replace)) {
a++;
continue;
}
if (sock->type == socktype) {
a++;
if (a > num) {
return sock;
}
}
}
}
return NULL;
} | [
"static",
"bNodeSocket",
"*",
"best_socket_input",
"(",
"bNodeTree",
"*",
"ntree",
",",
"bNode",
"*",
"node",
",",
"int",
"num",
",",
"int",
"replace",
")",
"{",
"bNodeSocket",
"*",
"sock",
";",
"int",
"socktype",
",",
"maxtype",
"=",
"0",
";",
"int",
"a",
"=",
"0",
";",
"for",
"(",
"sock",
"=",
"node",
"->",
"inputs",
".",
"first",
";",
"sock",
";",
"sock",
"=",
"sock",
"->",
"next",
")",
"{",
"maxtype",
"=",
"max_ii",
"(",
"sock",
"->",
"type",
",",
"maxtype",
")",
";",
"}",
"for",
"(",
"socktype",
"=",
"maxtype",
";",
"socktype",
">=",
"0",
";",
"socktype",
"--",
")",
"{",
"for",
"(",
"sock",
"=",
"node",
"->",
"inputs",
".",
"first",
";",
"sock",
";",
"sock",
"=",
"sock",
"->",
"next",
")",
"{",
"if",
"(",
"!",
"socket_is_available",
"(",
"ntree",
",",
"sock",
",",
"replace",
")",
")",
"{",
"a",
"++",
";",
"continue",
";",
"}",
"if",
"(",
"sock",
"->",
"type",
"==",
"socktype",
")",
"{",
"a",
"++",
";",
"if",
"(",
"a",
">",
"num",
")",
"{",
"return",
"sock",
";",
"}",
"}",
"}",
"}",
"return",
"NULL",
";",
"}"
] | this is a bit complicated, but designed to prioritize finding
sockets of higher types, such as image, first | [
"this",
"is",
"a",
"bit",
"complicated",
"but",
"designed",
"to",
"prioritize",
"finding",
"sockets",
"of",
"higher",
"types",
"such",
"as",
"image",
"first"
] | [
"/* find sockets of higher 'types' first (i.e. image) */",
"/* increment to make sure we don't keep finding\n * the same socket on every attempt running this function */"
] | [
{
"param": "ntree",
"type": "bNodeTree"
},
{
"param": "node",
"type": "bNode"
},
{
"param": "num",
"type": "int"
},
{
"param": "replace",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ntree",
"type": "bNodeTree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "node",
"type": "bNode",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "num",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "replace",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
357ef31c51f3a8623a3e0281e8401d6ce62e09a0 | DemonRem/blender | source/blender/editors/space_node/node_relationships.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | node_link_modal | int | static int node_link_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
bNodeLinkDrag *nldrag = op->customdata;
ARegion *ar = CTX_wm_region(C);
float cursor[2];
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &cursor[0], &cursor[1]);
switch (event->type) {
case MOUSEMOVE:
node_link_find_socket(C, op, cursor);
node_link_update_header(C, nldrag);
ED_region_tag_redraw(ar);
break;
case LEFTMOUSE:
case RIGHTMOUSE:
case MIDDLEMOUSE: {
if (event->val == KM_RELEASE) {
node_link_exit(C, op, true);
ED_workspace_status_text(C, NULL);
ED_region_tag_redraw(ar);
return OPERATOR_FINISHED;
}
break;
}
}
return OPERATOR_RUNNING_MODAL;
} | /* loop that adds a nodelink, called by function below */
/* in_out = starting socket */ | loop that adds a nodelink, called by function below
in_out = starting socket | [
"loop",
"that",
"adds",
"a",
"nodelink",
"called",
"by",
"function",
"below",
"in_out",
"=",
"starting",
"socket"
] | static int node_link_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
bNodeLinkDrag *nldrag = op->customdata;
ARegion *ar = CTX_wm_region(C);
float cursor[2];
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &cursor[0], &cursor[1]);
switch (event->type) {
case MOUSEMOVE:
node_link_find_socket(C, op, cursor);
node_link_update_header(C, nldrag);
ED_region_tag_redraw(ar);
break;
case LEFTMOUSE:
case RIGHTMOUSE:
case MIDDLEMOUSE: {
if (event->val == KM_RELEASE) {
node_link_exit(C, op, true);
ED_workspace_status_text(C, NULL);
ED_region_tag_redraw(ar);
return OPERATOR_FINISHED;
}
break;
}
}
return OPERATOR_RUNNING_MODAL;
} | [
"static",
"int",
"node_link_modal",
"(",
"bContext",
"*",
"C",
",",
"wmOperator",
"*",
"op",
",",
"const",
"wmEvent",
"*",
"event",
")",
"{",
"bNodeLinkDrag",
"*",
"nldrag",
"=",
"op",
"->",
"customdata",
";",
"ARegion",
"*",
"ar",
"=",
"CTX_wm_region",
"(",
"C",
")",
";",
"float",
"cursor",
"[",
"2",
"]",
";",
"UI_view2d_region_to_view",
"(",
"&",
"ar",
"->",
"v2d",
",",
"event",
"->",
"mval",
"[",
"0",
"]",
",",
"event",
"->",
"mval",
"[",
"1",
"]",
",",
"&",
"cursor",
"[",
"0",
"]",
",",
"&",
"cursor",
"[",
"1",
"]",
")",
";",
"switch",
"(",
"event",
"->",
"type",
")",
"{",
"case",
"MOUSEMOVE",
":",
"node_link_find_socket",
"(",
"C",
",",
"op",
",",
"cursor",
")",
";",
"node_link_update_header",
"(",
"C",
",",
"nldrag",
")",
";",
"ED_region_tag_redraw",
"(",
"ar",
")",
";",
"break",
";",
"case",
"LEFTMOUSE",
":",
"case",
"RIGHTMOUSE",
":",
"case",
"MIDDLEMOUSE",
":",
"{",
"if",
"(",
"event",
"->",
"val",
"==",
"KM_RELEASE",
")",
"{",
"node_link_exit",
"(",
"C",
",",
"op",
",",
"true",
")",
";",
"ED_workspace_status_text",
"(",
"C",
",",
"NULL",
")",
";",
"ED_region_tag_redraw",
"(",
"ar",
")",
";",
"return",
"OPERATOR_FINISHED",
";",
"}",
"break",
";",
"}",
"}",
"return",
"OPERATOR_RUNNING_MODAL",
";",
"}"
] | loop that adds a nodelink, called by function below
in_out = starting socket | [
"loop",
"that",
"adds",
"a",
"nodelink",
"called",
"by",
"function",
"below",
"in_out",
"=",
"starting",
"socket"
] | [] | [
{
"param": "C",
"type": "bContext"
},
{
"param": "op",
"type": "wmOperator"
},
{
"param": "event",
"type": "wmEvent"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "op",
"type": "wmOperator",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "event",
"type": "wmEvent",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
357ef31c51f3a8623a3e0281e8401d6ce62e09a0 | DemonRem/blender | source/blender/editors/space_node/node_relationships.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | node_make_link_exec | int | static int node_make_link_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
SpaceNode *snode = CTX_wm_space_node(C);
const bool replace = RNA_boolean_get(op->ptr, "replace");
ED_preview_kill_jobs(CTX_wm_manager(C), bmain);
snode_autoconnect(bmain, snode, 1, replace);
/* deselect sockets after linking */
node_deselect_all_input_sockets(snode, 0);
node_deselect_all_output_sockets(snode, 0);
ntreeUpdateTree(CTX_data_main(C), snode->edittree);
snode_notify(C, snode);
snode_dag_update(C, snode);
return OPERATOR_FINISHED;
} | /* makes a link between selected output and input sockets */ | makes a link between selected output and input sockets | [
"makes",
"a",
"link",
"between",
"selected",
"output",
"and",
"input",
"sockets"
] | static int node_make_link_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
SpaceNode *snode = CTX_wm_space_node(C);
const bool replace = RNA_boolean_get(op->ptr, "replace");
ED_preview_kill_jobs(CTX_wm_manager(C), bmain);
snode_autoconnect(bmain, snode, 1, replace);
node_deselect_all_input_sockets(snode, 0);
node_deselect_all_output_sockets(snode, 0);
ntreeUpdateTree(CTX_data_main(C), snode->edittree);
snode_notify(C, snode);
snode_dag_update(C, snode);
return OPERATOR_FINISHED;
} | [
"static",
"int",
"node_make_link_exec",
"(",
"bContext",
"*",
"C",
",",
"wmOperator",
"*",
"op",
")",
"{",
"Main",
"*",
"bmain",
"=",
"CTX_data_main",
"(",
"C",
")",
";",
"SpaceNode",
"*",
"snode",
"=",
"CTX_wm_space_node",
"(",
"C",
")",
";",
"const",
"bool",
"replace",
"=",
"RNA_boolean_get",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
")",
";",
"ED_preview_kill_jobs",
"(",
"CTX_wm_manager",
"(",
"C",
")",
",",
"bmain",
")",
";",
"snode_autoconnect",
"(",
"bmain",
",",
"snode",
",",
"1",
",",
"replace",
")",
";",
"node_deselect_all_input_sockets",
"(",
"snode",
",",
"0",
")",
";",
"node_deselect_all_output_sockets",
"(",
"snode",
",",
"0",
")",
";",
"ntreeUpdateTree",
"(",
"CTX_data_main",
"(",
"C",
")",
",",
"snode",
"->",
"edittree",
")",
";",
"snode_notify",
"(",
"C",
",",
"snode",
")",
";",
"snode_dag_update",
"(",
"C",
",",
"snode",
")",
";",
"return",
"OPERATOR_FINISHED",
";",
"}"
] | makes a link between selected output and input sockets | [
"makes",
"a",
"link",
"between",
"selected",
"output",
"and",
"input",
"sockets"
] | [
"/* deselect sockets after linking */"
] | [
{
"param": "C",
"type": "bContext"
},
{
"param": "op",
"type": "wmOperator"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "op",
"type": "wmOperator",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
357ef31c51f3a8623a3e0281e8401d6ce62e09a0 | DemonRem/blender | source/blender/editors/space_node/node_relationships.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | node_detach_exec | int | static int node_detach_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceNode *snode = CTX_wm_space_node(C);
bNodeTree *ntree = snode->edittree;
bNode *node;
/* reset tags */
for (node = ntree->nodes.first; node; node = node->next) {
node->done = 0;
}
/* detach nodes recursively
* relative order is preserved here!
*/
for (node = ntree->nodes.first; node; node = node->next) {
if (!(node->done & NODE_DETACH_DONE)) {
node_detach_recursive(node);
}
}
ED_node_sort(ntree);
WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, NULL);
return OPERATOR_FINISHED;
} | /* detach the root nodes in the current selection */ | detach the root nodes in the current selection | [
"detach",
"the",
"root",
"nodes",
"in",
"the",
"current",
"selection"
] | static int node_detach_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceNode *snode = CTX_wm_space_node(C);
bNodeTree *ntree = snode->edittree;
bNode *node;
for (node = ntree->nodes.first; node; node = node->next) {
node->done = 0;
}
for (node = ntree->nodes.first; node; node = node->next) {
if (!(node->done & NODE_DETACH_DONE)) {
node_detach_recursive(node);
}
}
ED_node_sort(ntree);
WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, NULL);
return OPERATOR_FINISHED;
} | [
"static",
"int",
"node_detach_exec",
"(",
"bContext",
"*",
"C",
",",
"wmOperator",
"*",
"UNUSED",
"(",
"op",
")",
")",
"{",
"SpaceNode",
"*",
"snode",
"=",
"CTX_wm_space_node",
"(",
"C",
")",
";",
"bNodeTree",
"*",
"ntree",
"=",
"snode",
"->",
"edittree",
";",
"bNode",
"*",
"node",
";",
"for",
"(",
"node",
"=",
"ntree",
"->",
"nodes",
".",
"first",
";",
"node",
";",
"node",
"=",
"node",
"->",
"next",
")",
"{",
"node",
"->",
"done",
"=",
"0",
";",
"}",
"for",
"(",
"node",
"=",
"ntree",
"->",
"nodes",
".",
"first",
";",
"node",
";",
"node",
"=",
"node",
"->",
"next",
")",
"{",
"if",
"(",
"!",
"(",
"node",
"->",
"done",
"&",
"NODE_DETACH_DONE",
")",
")",
"{",
"node_detach_recursive",
"(",
"node",
")",
";",
"}",
"}",
"ED_node_sort",
"(",
"ntree",
")",
";",
"WM_event_add_notifier",
"(",
"C",
",",
"NC_NODE",
"|",
"ND_DISPLAY",
",",
"NULL",
")",
";",
"return",
"OPERATOR_FINISHED",
";",
"}"
] | detach the root nodes in the current selection | [
"detach",
"the",
"root",
"nodes",
"in",
"the",
"current",
"selection"
] | [
"/* reset tags */",
"/* detach nodes recursively\n * relative order is preserved here!\n */"
] | [
{
"param": "C",
"type": "bContext"
},
{
"param": "UNUSED",
"type": "wmOperator"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "UNUSED",
"type": "wmOperator",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
357ef31c51f3a8623a3e0281e8401d6ce62e09a0 | DemonRem/blender | source/blender/editors/space_node/node_relationships.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | node_link_insert_offset_frame_chain_cb | bool | static bool node_link_insert_offset_frame_chain_cb(bNode *fromnode,
bNode *tonode,
void *userdata,
const bool reversed)
{
NodeInsertOfsData *data = userdata;
bNode *ofs_node = reversed ? fromnode : tonode;
if (ofs_node->parent && ofs_node->parent != data->insert_parent) {
node_offset_apply(ofs_node->parent, data->offset_x);
}
else {
node_offset_apply(ofs_node, data->offset_x);
}
return true;
} | /**
* Callback that applies NodeInsertOfsData.offset_x to a node or its parent, similar
* to node_link_insert_offset_output_chain_cb below, but with slightly different logic
*/ | Callback that applies NodeInsertOfsData.offset_x to a node or its parent, similar
to node_link_insert_offset_output_chain_cb below, but with slightly different logic | [
"Callback",
"that",
"applies",
"NodeInsertOfsData",
".",
"offset_x",
"to",
"a",
"node",
"or",
"its",
"parent",
"similar",
"to",
"node_link_insert_offset_output_chain_cb",
"below",
"but",
"with",
"slightly",
"different",
"logic"
] | static bool node_link_insert_offset_frame_chain_cb(bNode *fromnode,
bNode *tonode,
void *userdata,
const bool reversed)
{
NodeInsertOfsData *data = userdata;
bNode *ofs_node = reversed ? fromnode : tonode;
if (ofs_node->parent && ofs_node->parent != data->insert_parent) {
node_offset_apply(ofs_node->parent, data->offset_x);
}
else {
node_offset_apply(ofs_node, data->offset_x);
}
return true;
} | [
"static",
"bool",
"node_link_insert_offset_frame_chain_cb",
"(",
"bNode",
"*",
"fromnode",
",",
"bNode",
"*",
"tonode",
",",
"void",
"*",
"userdata",
",",
"const",
"bool",
"reversed",
")",
"{",
"NodeInsertOfsData",
"*",
"data",
"=",
"userdata",
";",
"bNode",
"*",
"ofs_node",
"=",
"reversed",
"?",
"fromnode",
":",
"tonode",
";",
"if",
"(",
"ofs_node",
"->",
"parent",
"&&",
"ofs_node",
"->",
"parent",
"!=",
"data",
"->",
"insert_parent",
")",
"{",
"node_offset_apply",
"(",
"ofs_node",
"->",
"parent",
",",
"data",
"->",
"offset_x",
")",
";",
"}",
"else",
"{",
"node_offset_apply",
"(",
"ofs_node",
",",
"data",
"->",
"offset_x",
")",
";",
"}",
"return",
"true",
";",
"}"
] | Callback that applies NodeInsertOfsData.offset_x to a node or its parent, similar
to node_link_insert_offset_output_chain_cb below, but with slightly different logic | [
"Callback",
"that",
"applies",
"NodeInsertOfsData",
".",
"offset_x",
"to",
"a",
"node",
"or",
"its",
"parent",
"similar",
"to",
"node_link_insert_offset_output_chain_cb",
"below",
"but",
"with",
"slightly",
"different",
"logic"
] | [] | [
{
"param": "fromnode",
"type": "bNode"
},
{
"param": "tonode",
"type": "bNode"
},
{
"param": "userdata",
"type": "void"
},
{
"param": "reversed",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fromnode",
"type": "bNode",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tonode",
"type": "bNode",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "userdata",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reversed",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
357ef31c51f3a8623a3e0281e8401d6ce62e09a0 | DemonRem/blender | source/blender/editors/space_node/node_relationships.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | node_link_insert_offset_frame_chains | void | static void node_link_insert_offset_frame_chains(const bNodeTree *ntree,
const bNode *parent,
NodeInsertOfsData *data,
const bool reversed)
{
bNode *node;
for (node = ntree->nodes.first; node; node = node->next) {
if (nodeIsChildOf(parent, node)) {
nodeChainIter(ntree, node, node_link_insert_offset_frame_chain_cb, data, reversed);
}
}
} | /**
* Applies NodeInsertOfsData.offset_x to all childs of \a parent
*/ | Applies NodeInsertOfsData.offset_x to all childs of \a parent | [
"Applies",
"NodeInsertOfsData",
".",
"offset_x",
"to",
"all",
"childs",
"of",
"\\",
"a",
"parent"
] | static void node_link_insert_offset_frame_chains(const bNodeTree *ntree,
const bNode *parent,
NodeInsertOfsData *data,
const bool reversed)
{
bNode *node;
for (node = ntree->nodes.first; node; node = node->next) {
if (nodeIsChildOf(parent, node)) {
nodeChainIter(ntree, node, node_link_insert_offset_frame_chain_cb, data, reversed);
}
}
} | [
"static",
"void",
"node_link_insert_offset_frame_chains",
"(",
"const",
"bNodeTree",
"*",
"ntree",
",",
"const",
"bNode",
"*",
"parent",
",",
"NodeInsertOfsData",
"*",
"data",
",",
"const",
"bool",
"reversed",
")",
"{",
"bNode",
"*",
"node",
";",
"for",
"(",
"node",
"=",
"ntree",
"->",
"nodes",
".",
"first",
";",
"node",
";",
"node",
"=",
"node",
"->",
"next",
")",
"{",
"if",
"(",
"nodeIsChildOf",
"(",
"parent",
",",
"node",
")",
")",
"{",
"nodeChainIter",
"(",
"ntree",
",",
"node",
",",
"node_link_insert_offset_frame_chain_cb",
",",
"data",
",",
"reversed",
")",
";",
"}",
"}",
"}"
] | Applies NodeInsertOfsData.offset_x to all childs of \a parent | [
"Applies",
"NodeInsertOfsData",
".",
"offset_x",
"to",
"all",
"childs",
"of",
"\\",
"a",
"parent"
] | [] | [
{
"param": "ntree",
"type": "bNodeTree"
},
{
"param": "parent",
"type": "bNode"
},
{
"param": "data",
"type": "NodeInsertOfsData"
},
{
"param": "reversed",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ntree",
"type": "bNodeTree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "parent",
"type": "bNode",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "NodeInsertOfsData",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reversed",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
357ef31c51f3a8623a3e0281e8401d6ce62e09a0 | DemonRem/blender | source/blender/editors/space_node/node_relationships.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | node_link_insert_offset_chain_cb | bool | static bool node_link_insert_offset_chain_cb(bNode *fromnode,
bNode *tonode,
void *userdata,
const bool reversed)
{
NodeInsertOfsData *data = userdata;
bNode *ofs_node = reversed ? fromnode : tonode;
if (data->insert_parent) {
if (ofs_node->parent && (ofs_node->parent->flag & NODE_TEST) == 0) {
node_parent_offset_apply(data, ofs_node->parent, data->offset_x);
node_link_insert_offset_frame_chains(data->ntree, ofs_node->parent, data, reversed);
}
else {
node_offset_apply(ofs_node, data->offset_x);
}
if (nodeIsChildOf(data->insert_parent, ofs_node) == false) {
data->insert_parent = NULL;
}
}
else if (ofs_node->parent) {
bNode *node = nodeFindRootParent(ofs_node);
node_offset_apply(node, data->offset_x);
}
else {
node_offset_apply(ofs_node, data->offset_x);
}
return true;
} | /**
* Callback that applies NodeInsertOfsData.offset_x to a node or its parent,
* considering the logic needed for offsetting nodes after link insert
*/ | Callback that applies NodeInsertOfsData.offset_x to a node or its parent,
considering the logic needed for offsetting nodes after link insert | [
"Callback",
"that",
"applies",
"NodeInsertOfsData",
".",
"offset_x",
"to",
"a",
"node",
"or",
"its",
"parent",
"considering",
"the",
"logic",
"needed",
"for",
"offsetting",
"nodes",
"after",
"link",
"insert"
] | static bool node_link_insert_offset_chain_cb(bNode *fromnode,
bNode *tonode,
void *userdata,
const bool reversed)
{
NodeInsertOfsData *data = userdata;
bNode *ofs_node = reversed ? fromnode : tonode;
if (data->insert_parent) {
if (ofs_node->parent && (ofs_node->parent->flag & NODE_TEST) == 0) {
node_parent_offset_apply(data, ofs_node->parent, data->offset_x);
node_link_insert_offset_frame_chains(data->ntree, ofs_node->parent, data, reversed);
}
else {
node_offset_apply(ofs_node, data->offset_x);
}
if (nodeIsChildOf(data->insert_parent, ofs_node) == false) {
data->insert_parent = NULL;
}
}
else if (ofs_node->parent) {
bNode *node = nodeFindRootParent(ofs_node);
node_offset_apply(node, data->offset_x);
}
else {
node_offset_apply(ofs_node, data->offset_x);
}
return true;
} | [
"static",
"bool",
"node_link_insert_offset_chain_cb",
"(",
"bNode",
"*",
"fromnode",
",",
"bNode",
"*",
"tonode",
",",
"void",
"*",
"userdata",
",",
"const",
"bool",
"reversed",
")",
"{",
"NodeInsertOfsData",
"*",
"data",
"=",
"userdata",
";",
"bNode",
"*",
"ofs_node",
"=",
"reversed",
"?",
"fromnode",
":",
"tonode",
";",
"if",
"(",
"data",
"->",
"insert_parent",
")",
"{",
"if",
"(",
"ofs_node",
"->",
"parent",
"&&",
"(",
"ofs_node",
"->",
"parent",
"->",
"flag",
"&",
"NODE_TEST",
")",
"==",
"0",
")",
"{",
"node_parent_offset_apply",
"(",
"data",
",",
"ofs_node",
"->",
"parent",
",",
"data",
"->",
"offset_x",
")",
";",
"node_link_insert_offset_frame_chains",
"(",
"data",
"->",
"ntree",
",",
"ofs_node",
"->",
"parent",
",",
"data",
",",
"reversed",
")",
";",
"}",
"else",
"{",
"node_offset_apply",
"(",
"ofs_node",
",",
"data",
"->",
"offset_x",
")",
";",
"}",
"if",
"(",
"nodeIsChildOf",
"(",
"data",
"->",
"insert_parent",
",",
"ofs_node",
")",
"==",
"false",
")",
"{",
"data",
"->",
"insert_parent",
"=",
"NULL",
";",
"}",
"}",
"else",
"if",
"(",
"ofs_node",
"->",
"parent",
")",
"{",
"bNode",
"*",
"node",
"=",
"nodeFindRootParent",
"(",
"ofs_node",
")",
";",
"node_offset_apply",
"(",
"node",
",",
"data",
"->",
"offset_x",
")",
";",
"}",
"else",
"{",
"node_offset_apply",
"(",
"ofs_node",
",",
"data",
"->",
"offset_x",
")",
";",
"}",
"return",
"true",
";",
"}"
] | Callback that applies NodeInsertOfsData.offset_x to a node or its parent,
considering the logic needed for offsetting nodes after link insert | [
"Callback",
"that",
"applies",
"NodeInsertOfsData",
".",
"offset_x",
"to",
"a",
"node",
"or",
"its",
"parent",
"considering",
"the",
"logic",
"needed",
"for",
"offsetting",
"nodes",
"after",
"link",
"insert"
] | [] | [
{
"param": "fromnode",
"type": "bNode"
},
{
"param": "tonode",
"type": "bNode"
},
{
"param": "userdata",
"type": "void"
},
{
"param": "reversed",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fromnode",
"type": "bNode",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tonode",
"type": "bNode",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "userdata",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reversed",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
357ef31c51f3a8623a3e0281e8401d6ce62e09a0 | DemonRem/blender | source/blender/editors/space_node/node_relationships.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | node_insert_offset_modal | int | static int node_insert_offset_modal(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
{
SpaceNode *snode = CTX_wm_space_node(C);
NodeInsertOfsData *iofsd = snode->iofsd;
bNode *node;
float duration;
bool redraw = false;
if (!snode || event->type != TIMER || iofsd == NULL || iofsd->anim_timer != event->customdata) {
return OPERATOR_PASS_THROUGH;
}
duration = (float)iofsd->anim_timer->duration;
/* handle animation - do this before possibly aborting due to duration, since
* main thread might be so busy that node hasn't reached final position yet */
for (node = snode->edittree->nodes.first; node; node = node->next) {
if (UNLIKELY(node->anim_ofsx)) {
const float endval = node->anim_init_locx + node->anim_ofsx;
if (IS_EQF(node->locx, endval) == false) {
node->locx = BLI_easing_cubic_ease_in_out(
duration, node->anim_init_locx, node->anim_ofsx, NODE_INSOFS_ANIM_DURATION);
if (node->anim_ofsx < 0) {
CLAMP_MIN(node->locx, endval);
}
else {
CLAMP_MAX(node->locx, endval);
}
redraw = true;
}
}
}
if (redraw) {
ED_region_tag_redraw(CTX_wm_region(C));
}
/* end timer + free insert offset data */
if (duration > NODE_INSOFS_ANIM_DURATION) {
WM_event_remove_timer(CTX_wm_manager(C), NULL, iofsd->anim_timer);
for (node = snode->edittree->nodes.first; node; node = node->next) {
node->anim_init_locx = node->anim_ofsx = 0.0f;
}
snode->iofsd = NULL;
MEM_freeN(iofsd);
return (OPERATOR_FINISHED | OPERATOR_PASS_THROUGH);
}
return OPERATOR_RUNNING_MODAL;
} | /**
* Modal handler for insert offset animation
*/ | Modal handler for insert offset animation | [
"Modal",
"handler",
"for",
"insert",
"offset",
"animation"
] | static int node_insert_offset_modal(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
{
SpaceNode *snode = CTX_wm_space_node(C);
NodeInsertOfsData *iofsd = snode->iofsd;
bNode *node;
float duration;
bool redraw = false;
if (!snode || event->type != TIMER || iofsd == NULL || iofsd->anim_timer != event->customdata) {
return OPERATOR_PASS_THROUGH;
}
duration = (float)iofsd->anim_timer->duration;
for (node = snode->edittree->nodes.first; node; node = node->next) {
if (UNLIKELY(node->anim_ofsx)) {
const float endval = node->anim_init_locx + node->anim_ofsx;
if (IS_EQF(node->locx, endval) == false) {
node->locx = BLI_easing_cubic_ease_in_out(
duration, node->anim_init_locx, node->anim_ofsx, NODE_INSOFS_ANIM_DURATION);
if (node->anim_ofsx < 0) {
CLAMP_MIN(node->locx, endval);
}
else {
CLAMP_MAX(node->locx, endval);
}
redraw = true;
}
}
}
if (redraw) {
ED_region_tag_redraw(CTX_wm_region(C));
}
if (duration > NODE_INSOFS_ANIM_DURATION) {
WM_event_remove_timer(CTX_wm_manager(C), NULL, iofsd->anim_timer);
for (node = snode->edittree->nodes.first; node; node = node->next) {
node->anim_init_locx = node->anim_ofsx = 0.0f;
}
snode->iofsd = NULL;
MEM_freeN(iofsd);
return (OPERATOR_FINISHED | OPERATOR_PASS_THROUGH);
}
return OPERATOR_RUNNING_MODAL;
} | [
"static",
"int",
"node_insert_offset_modal",
"(",
"bContext",
"*",
"C",
",",
"wmOperator",
"*",
"UNUSED",
"(",
"op",
")",
",",
"const",
"wmEvent",
"*",
"event",
")",
"{",
"SpaceNode",
"*",
"snode",
"=",
"CTX_wm_space_node",
"(",
"C",
")",
";",
"NodeInsertOfsData",
"*",
"iofsd",
"=",
"snode",
"->",
"iofsd",
";",
"bNode",
"*",
"node",
";",
"float",
"duration",
";",
"bool",
"redraw",
"=",
"false",
";",
"if",
"(",
"!",
"snode",
"||",
"event",
"->",
"type",
"!=",
"TIMER",
"||",
"iofsd",
"==",
"NULL",
"||",
"iofsd",
"->",
"anim_timer",
"!=",
"event",
"->",
"customdata",
")",
"{",
"return",
"OPERATOR_PASS_THROUGH",
";",
"}",
"duration",
"=",
"(",
"float",
")",
"iofsd",
"->",
"anim_timer",
"->",
"duration",
";",
"for",
"(",
"node",
"=",
"snode",
"->",
"edittree",
"->",
"nodes",
".",
"first",
";",
"node",
";",
"node",
"=",
"node",
"->",
"next",
")",
"{",
"if",
"(",
"UNLIKELY",
"(",
"node",
"->",
"anim_ofsx",
")",
")",
"{",
"const",
"float",
"endval",
"=",
"node",
"->",
"anim_init_locx",
"+",
"node",
"->",
"anim_ofsx",
";",
"if",
"(",
"IS_EQF",
"(",
"node",
"->",
"locx",
",",
"endval",
")",
"==",
"false",
")",
"{",
"node",
"->",
"locx",
"=",
"BLI_easing_cubic_ease_in_out",
"(",
"duration",
",",
"node",
"->",
"anim_init_locx",
",",
"node",
"->",
"anim_ofsx",
",",
"NODE_INSOFS_ANIM_DURATION",
")",
";",
"if",
"(",
"node",
"->",
"anim_ofsx",
"<",
"0",
")",
"{",
"CLAMP_MIN",
"(",
"node",
"->",
"locx",
",",
"endval",
")",
";",
"}",
"else",
"{",
"CLAMP_MAX",
"(",
"node",
"->",
"locx",
",",
"endval",
")",
";",
"}",
"redraw",
"=",
"true",
";",
"}",
"}",
"}",
"if",
"(",
"redraw",
")",
"{",
"ED_region_tag_redraw",
"(",
"CTX_wm_region",
"(",
"C",
")",
")",
";",
"}",
"if",
"(",
"duration",
">",
"NODE_INSOFS_ANIM_DURATION",
")",
"{",
"WM_event_remove_timer",
"(",
"CTX_wm_manager",
"(",
"C",
")",
",",
"NULL",
",",
"iofsd",
"->",
"anim_timer",
")",
";",
"for",
"(",
"node",
"=",
"snode",
"->",
"edittree",
"->",
"nodes",
".",
"first",
";",
"node",
";",
"node",
"=",
"node",
"->",
"next",
")",
"{",
"node",
"->",
"anim_init_locx",
"=",
"node",
"->",
"anim_ofsx",
"=",
"0.0f",
";",
"}",
"snode",
"->",
"iofsd",
"=",
"NULL",
";",
"MEM_freeN",
"(",
"iofsd",
")",
";",
"return",
"(",
"OPERATOR_FINISHED",
"|",
"OPERATOR_PASS_THROUGH",
")",
";",
"}",
"return",
"OPERATOR_RUNNING_MODAL",
";",
"}"
] | Modal handler for insert offset animation | [
"Modal",
"handler",
"for",
"insert",
"offset",
"animation"
] | [
"/* handle animation - do this before possibly aborting due to duration, since\n * main thread might be so busy that node hasn't reached final position yet */",
"/* end timer + free insert offset data */"
] | [
{
"param": "C",
"type": "bContext"
},
{
"param": "UNUSED",
"type": "wmOperator"
},
{
"param": "event",
"type": "wmEvent"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "UNUSED",
"type": "wmOperator",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "event",
"type": "wmEvent",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9f47ada47d11e1c58daa5b8ec30fd71cd8eabfda | DemonRem/blender | source/blender/blenlib/intern/rand.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | BLI_rng_srandom | void | void BLI_rng_srandom(RNG *rng, unsigned int seed)
{
BLI_rng_seed(rng, seed + hash[seed & 255]);
seed = BLI_rng_get_uint(rng);
BLI_rng_seed(rng, seed + hash[seed & 255]);
seed = BLI_rng_get_uint(rng);
BLI_rng_seed(rng, seed + hash[seed & 255]);
} | /**
* Use a hash table to create better seed.
*/ | Use a hash table to create better seed. | [
"Use",
"a",
"hash",
"table",
"to",
"create",
"better",
"seed",
"."
] | void BLI_rng_srandom(RNG *rng, unsigned int seed)
{
BLI_rng_seed(rng, seed + hash[seed & 255]);
seed = BLI_rng_get_uint(rng);
BLI_rng_seed(rng, seed + hash[seed & 255]);
seed = BLI_rng_get_uint(rng);
BLI_rng_seed(rng, seed + hash[seed & 255]);
} | [
"void",
"BLI_rng_srandom",
"(",
"RNG",
"*",
"rng",
",",
"unsigned",
"int",
"seed",
")",
"{",
"BLI_rng_seed",
"(",
"rng",
",",
"seed",
"+",
"hash",
"[",
"seed",
"&",
"255",
"]",
")",
";",
"seed",
"=",
"BLI_rng_get_uint",
"(",
"rng",
")",
";",
"BLI_rng_seed",
"(",
"rng",
",",
"seed",
"+",
"hash",
"[",
"seed",
"&",
"255",
"]",
")",
";",
"seed",
"=",
"BLI_rng_get_uint",
"(",
"rng",
")",
";",
"BLI_rng_seed",
"(",
"rng",
",",
"seed",
"+",
"hash",
"[",
"seed",
"&",
"255",
"]",
")",
";",
"}"
] | Use a hash table to create better seed. | [
"Use",
"a",
"hash",
"table",
"to",
"create",
"better",
"seed",
"."
] | [] | [
{
"param": "rng",
"type": "RNG"
},
{
"param": "seed",
"type": "unsigned int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "rng",
"type": "RNG",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "seed",
"type": "unsigned int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9f47ada47d11e1c58daa5b8ec30fd71cd8eabfda | DemonRem/blender | source/blender/blenlib/intern/rand.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | BLI_rng_get_tri_sample_float_v2 | void | void BLI_rng_get_tri_sample_float_v2(
RNG *rng, const float v1[2], const float v2[2], const float v3[2], float r_pt[2])
{
float u = BLI_rng_get_float(rng);
float v = BLI_rng_get_float(rng);
float side_u[2], side_v[2];
if ((u + v) > 1.0f) {
u = 1.0f - u;
v = 1.0f - v;
}
sub_v2_v2v2(side_u, v2, v1);
sub_v2_v2v2(side_v, v3, v1);
copy_v2_v2(r_pt, v1);
madd_v2_v2fl(r_pt, side_u, u);
madd_v2_v2fl(r_pt, side_v, v);
} | /**
* Generate a random point inside given tri.
*/ | Generate a random point inside given tri. | [
"Generate",
"a",
"random",
"point",
"inside",
"given",
"tri",
"."
] | void BLI_rng_get_tri_sample_float_v2(
RNG *rng, const float v1[2], const float v2[2], const float v3[2], float r_pt[2])
{
float u = BLI_rng_get_float(rng);
float v = BLI_rng_get_float(rng);
float side_u[2], side_v[2];
if ((u + v) > 1.0f) {
u = 1.0f - u;
v = 1.0f - v;
}
sub_v2_v2v2(side_u, v2, v1);
sub_v2_v2v2(side_v, v3, v1);
copy_v2_v2(r_pt, v1);
madd_v2_v2fl(r_pt, side_u, u);
madd_v2_v2fl(r_pt, side_v, v);
} | [
"void",
"BLI_rng_get_tri_sample_float_v2",
"(",
"RNG",
"*",
"rng",
",",
"const",
"float",
"v1",
"[",
"2",
"]",
",",
"const",
"float",
"v2",
"[",
"2",
"]",
",",
"const",
"float",
"v3",
"[",
"2",
"]",
",",
"float",
"r_pt",
"[",
"2",
"]",
")",
"{",
"float",
"u",
"=",
"BLI_rng_get_float",
"(",
"rng",
")",
";",
"float",
"v",
"=",
"BLI_rng_get_float",
"(",
"rng",
")",
";",
"float",
"side_u",
"[",
"2",
"]",
",",
"side_v",
"[",
"2",
"]",
";",
"if",
"(",
"(",
"u",
"+",
"v",
")",
">",
"1.0f",
")",
"{",
"u",
"=",
"1.0f",
"-",
"u",
";",
"v",
"=",
"1.0f",
"-",
"v",
";",
"}",
"sub_v2_v2v2",
"(",
"side_u",
",",
"v2",
",",
"v1",
")",
";",
"sub_v2_v2v2",
"(",
"side_v",
",",
"v3",
",",
"v1",
")",
";",
"copy_v2_v2",
"(",
"r_pt",
",",
"v1",
")",
";",
"madd_v2_v2fl",
"(",
"r_pt",
",",
"side_u",
",",
"u",
")",
";",
"madd_v2_v2fl",
"(",
"r_pt",
",",
"side_v",
",",
"v",
")",
";",
"}"
] | Generate a random point inside given tri. | [
"Generate",
"a",
"random",
"point",
"inside",
"given",
"tri",
"."
] | [] | [
{
"param": "rng",
"type": "RNG"
},
{
"param": "v1",
"type": "float"
},
{
"param": "v2",
"type": "float"
},
{
"param": "v3",
"type": "float"
},
{
"param": "r_pt",
"type": "float"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "rng",
"type": "RNG",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "v1",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "v2",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "v3",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "r_pt",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9f47ada47d11e1c58daa5b8ec30fd71cd8eabfda | DemonRem/blender | source/blender/blenlib/intern/rand.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | BLI_rng_skip | void | void BLI_rng_skip(RNG *rng, int n)
{
while (n--) {
rng_step(rng);
}
} | /**
* Simulate getting \a n random values.
*
* \note Useful when threaded code needs consistent values, independent of task division.
*/ | Simulate getting \a n random values.
\note Useful when threaded code needs consistent values, independent of task division. | [
"Simulate",
"getting",
"\\",
"a",
"n",
"random",
"values",
".",
"\\",
"note",
"Useful",
"when",
"threaded",
"code",
"needs",
"consistent",
"values",
"independent",
"of",
"task",
"division",
"."
] | void BLI_rng_skip(RNG *rng, int n)
{
while (n--) {
rng_step(rng);
}
} | [
"void",
"BLI_rng_skip",
"(",
"RNG",
"*",
"rng",
",",
"int",
"n",
")",
"{",
"while",
"(",
"n",
"--",
")",
"{",
"rng_step",
"(",
"rng",
")",
";",
"}",
"}"
] | Simulate getting \a n random values. | [
"Simulate",
"getting",
"\\",
"a",
"n",
"random",
"values",
"."
] | [] | [
{
"param": "rng",
"type": "RNG"
},
{
"param": "n",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "rng",
"type": "RNG",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "n",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9f47ada47d11e1c58daa5b8ec30fd71cd8eabfda | DemonRem/blender | source/blender/blenlib/intern/rand.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | BLI_array_frand | void | void BLI_array_frand(float *ar, int count, unsigned int seed)
{
RNG rng;
BLI_rng_srandom(&rng, seed);
for (int i = 0; i < count; i++) {
ar[i] = BLI_rng_get_float(&rng);
}
} | /* fill an array with random numbers */ | fill an array with random numbers | [
"fill",
"an",
"array",
"with",
"random",
"numbers"
] | void BLI_array_frand(float *ar, int count, unsigned int seed)
{
RNG rng;
BLI_rng_srandom(&rng, seed);
for (int i = 0; i < count; i++) {
ar[i] = BLI_rng_get_float(&rng);
}
} | [
"void",
"BLI_array_frand",
"(",
"float",
"*",
"ar",
",",
"int",
"count",
",",
"unsigned",
"int",
"seed",
")",
"{",
"RNG",
"rng",
";",
"BLI_rng_srandom",
"(",
"&",
"rng",
",",
"seed",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"count",
";",
"i",
"++",
")",
"{",
"ar",
"[",
"i",
"]",
"=",
"BLI_rng_get_float",
"(",
"&",
"rng",
")",
";",
"}",
"}"
] | fill an array with random numbers | [
"fill",
"an",
"array",
"with",
"random",
"numbers"
] | [] | [
{
"param": "ar",
"type": "float"
},
{
"param": "count",
"type": "int"
},
{
"param": "seed",
"type": "unsigned int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ar",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "count",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "seed",
"type": "unsigned int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
883c17aa1e11519aba0c7f420f10da90d74fad47 | DemonRem/blender | source/blender/modifiers/intern/MOD_multires.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | subdiv_descriptor_ensure | Subdiv | static Subdiv *subdiv_descriptor_ensure(MultiresModifierData *mmd,
const SubdivSettings *subdiv_settings,
const Mesh *mesh)
{
MultiresRuntimeData *runtime_data = (MultiresRuntimeData *)mmd->modifier.runtime;
Subdiv *subdiv = BKE_subdiv_update_from_mesh(runtime_data->subdiv, subdiv_settings, mesh);
runtime_data->subdiv = subdiv;
return subdiv;
} | /* Main goal of this function is to give usable subdivision surface descriptor
* which matches settings and topology. */ | Main goal of this function is to give usable subdivision surface descriptor
which matches settings and topology. | [
"Main",
"goal",
"of",
"this",
"function",
"is",
"to",
"give",
"usable",
"subdivision",
"surface",
"descriptor",
"which",
"matches",
"settings",
"and",
"topology",
"."
] | static Subdiv *subdiv_descriptor_ensure(MultiresModifierData *mmd,
const SubdivSettings *subdiv_settings,
const Mesh *mesh)
{
MultiresRuntimeData *runtime_data = (MultiresRuntimeData *)mmd->modifier.runtime;
Subdiv *subdiv = BKE_subdiv_update_from_mesh(runtime_data->subdiv, subdiv_settings, mesh);
runtime_data->subdiv = subdiv;
return subdiv;
} | [
"static",
"Subdiv",
"*",
"subdiv_descriptor_ensure",
"(",
"MultiresModifierData",
"*",
"mmd",
",",
"const",
"SubdivSettings",
"*",
"subdiv_settings",
",",
"const",
"Mesh",
"*",
"mesh",
")",
"{",
"MultiresRuntimeData",
"*",
"runtime_data",
"=",
"(",
"MultiresRuntimeData",
"*",
")",
"mmd",
"->",
"modifier",
".",
"runtime",
";",
"Subdiv",
"*",
"subdiv",
"=",
"BKE_subdiv_update_from_mesh",
"(",
"runtime_data",
"->",
"subdiv",
",",
"subdiv_settings",
",",
"mesh",
")",
";",
"runtime_data",
"->",
"subdiv",
"=",
"subdiv",
";",
"return",
"subdiv",
";",
"}"
] | Main goal of this function is to give usable subdivision surface descriptor
which matches settings and topology. | [
"Main",
"goal",
"of",
"this",
"function",
"is",
"to",
"give",
"usable",
"subdivision",
"surface",
"descriptor",
"which",
"matches",
"settings",
"and",
"topology",
"."
] | [] | [
{
"param": "mmd",
"type": "MultiresModifierData"
},
{
"param": "subdiv_settings",
"type": "SubdivSettings"
},
{
"param": "mesh",
"type": "Mesh"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "mmd",
"type": "MultiresModifierData",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "subdiv_settings",
"type": "SubdivSettings",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mesh",
"type": "Mesh",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
883c17aa1e11519aba0c7f420f10da90d74fad47 | DemonRem/blender | source/blender/modifiers/intern/MOD_multires.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | multires_as_mesh | Mesh | static Mesh *multires_as_mesh(MultiresModifierData *mmd,
const ModifierEvalContext *ctx,
Mesh *mesh,
Subdiv *subdiv)
{
Mesh *result = mesh;
const bool use_render_params = (ctx->flag & MOD_APPLY_RENDER);
const bool ignore_simplify = (ctx->flag & MOD_APPLY_IGNORE_SIMPLIFY);
const Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
Object *object = ctx->object;
SubdivToMeshSettings mesh_settings;
BKE_multires_subdiv_mesh_settings_init(
&mesh_settings, scene, object, mmd, use_render_params, ignore_simplify);
if (mesh_settings.resolution < 3) {
return result;
}
BKE_subdiv_displacement_attach_from_multires(subdiv, mesh, mmd);
result = BKE_subdiv_to_mesh(subdiv, &mesh_settings, mesh);
return result;
} | /* Subdivide into fully qualified mesh. */ | Subdivide into fully qualified mesh. | [
"Subdivide",
"into",
"fully",
"qualified",
"mesh",
"."
] | static Mesh *multires_as_mesh(MultiresModifierData *mmd,
const ModifierEvalContext *ctx,
Mesh *mesh,
Subdiv *subdiv)
{
Mesh *result = mesh;
const bool use_render_params = (ctx->flag & MOD_APPLY_RENDER);
const bool ignore_simplify = (ctx->flag & MOD_APPLY_IGNORE_SIMPLIFY);
const Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
Object *object = ctx->object;
SubdivToMeshSettings mesh_settings;
BKE_multires_subdiv_mesh_settings_init(
&mesh_settings, scene, object, mmd, use_render_params, ignore_simplify);
if (mesh_settings.resolution < 3) {
return result;
}
BKE_subdiv_displacement_attach_from_multires(subdiv, mesh, mmd);
result = BKE_subdiv_to_mesh(subdiv, &mesh_settings, mesh);
return result;
} | [
"static",
"Mesh",
"*",
"multires_as_mesh",
"(",
"MultiresModifierData",
"*",
"mmd",
",",
"const",
"ModifierEvalContext",
"*",
"ctx",
",",
"Mesh",
"*",
"mesh",
",",
"Subdiv",
"*",
"subdiv",
")",
"{",
"Mesh",
"*",
"result",
"=",
"mesh",
";",
"const",
"bool",
"use_render_params",
"=",
"(",
"ctx",
"->",
"flag",
"&",
"MOD_APPLY_RENDER",
")",
";",
"const",
"bool",
"ignore_simplify",
"=",
"(",
"ctx",
"->",
"flag",
"&",
"MOD_APPLY_IGNORE_SIMPLIFY",
")",
";",
"const",
"Scene",
"*",
"scene",
"=",
"DEG_get_evaluated_scene",
"(",
"ctx",
"->",
"depsgraph",
")",
";",
"Object",
"*",
"object",
"=",
"ctx",
"->",
"object",
";",
"SubdivToMeshSettings",
"mesh_settings",
";",
"BKE_multires_subdiv_mesh_settings_init",
"(",
"&",
"mesh_settings",
",",
"scene",
",",
"object",
",",
"mmd",
",",
"use_render_params",
",",
"ignore_simplify",
")",
";",
"if",
"(",
"mesh_settings",
".",
"resolution",
"<",
"3",
")",
"{",
"return",
"result",
";",
"}",
"BKE_subdiv_displacement_attach_from_multires",
"(",
"subdiv",
",",
"mesh",
",",
"mmd",
")",
";",
"result",
"=",
"BKE_subdiv_to_mesh",
"(",
"subdiv",
",",
"&",
"mesh_settings",
",",
"mesh",
")",
";",
"return",
"result",
";",
"}"
] | Subdivide into fully qualified mesh. | [
"Subdivide",
"into",
"fully",
"qualified",
"mesh",
"."
] | [] | [
{
"param": "mmd",
"type": "MultiresModifierData"
},
{
"param": "ctx",
"type": "ModifierEvalContext"
},
{
"param": "mesh",
"type": "Mesh"
},
{
"param": "subdiv",
"type": "Subdiv"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "mmd",
"type": "MultiresModifierData",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ctx",
"type": "ModifierEvalContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mesh",
"type": "Mesh",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "subdiv",
"type": "Subdiv",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ac1b5e4ab0bf1a1ab854a6d8a7b704117dea1e1b | DemonRem/blender | source/blender/blenkernel/intern/unit.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | unit_get_system | bUnitCollection | static const bUnitCollection *unit_get_system(int system, int type)
{
assert((system > -1) && (system < UNIT_SYSTEM_TOT) && (type > -1) && (type < B_UNIT_TYPE_TOT));
return bUnitSystems[system][type]; /* select system to use, metric/imperial/other? */
} | /* internal, has some option not exposed */ | internal, has some option not exposed | [
"internal",
"has",
"some",
"option",
"not",
"exposed"
] | static const bUnitCollection *unit_get_system(int system, int type)
{
assert((system > -1) && (system < UNIT_SYSTEM_TOT) && (type > -1) && (type < B_UNIT_TYPE_TOT));
return bUnitSystems[system][type];
} | [
"static",
"const",
"bUnitCollection",
"*",
"unit_get_system",
"(",
"int",
"system",
",",
"int",
"type",
")",
"{",
"assert",
"(",
"(",
"system",
">",
"-1",
")",
"&&",
"(",
"system",
"<",
"UNIT_SYSTEM_TOT",
")",
"&&",
"(",
"type",
">",
"-1",
")",
"&&",
"(",
"type",
"<",
"B_UNIT_TYPE_TOT",
")",
")",
";",
"return",
"bUnitSystems",
"[",
"system",
"]",
"[",
"type",
"]",
";",
"}"
] | internal, has some option not exposed | [
"internal",
"has",
"some",
"option",
"not",
"exposed"
] | [
"/* select system to use, metric/imperial/other? */"
] | [
{
"param": "system",
"type": "int"
},
{
"param": "type",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "system",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ac1b5e4ab0bf1a1ab854a6d8a7b704117dea1e1b | DemonRem/blender | source/blender/blenkernel/intern/unit.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | unit_dual_convert | void | static void unit_dual_convert(double value,
const bUnitCollection *usys,
bUnitDef const **r_unit_a,
bUnitDef const **r_unit_b,
double *r_value_a,
double *r_value_b,
const bUnitDef *main_unit)
{
const bUnitDef *unit;
if (main_unit) {
unit = main_unit;
}
else {
unit = unit_best_fit(value, usys, NULL, 1);
}
*r_value_a = (value < 0.0 ? ceil : floor)(value / unit->scalar) * unit->scalar;
*r_value_b = value - (*r_value_a);
*r_unit_a = unit;
*r_unit_b = unit_best_fit(*r_value_b, usys, *r_unit_a, 1);
} | /* convert into 2 units and 2 values for "2ft, 3inch" syntax */ | convert into 2 units and 2 values for "2ft, 3inch" syntax | [
"convert",
"into",
"2",
"units",
"and",
"2",
"values",
"for",
"\"",
"2ft",
"3inch",
"\"",
"syntax"
] | static void unit_dual_convert(double value,
const bUnitCollection *usys,
bUnitDef const **r_unit_a,
bUnitDef const **r_unit_b,
double *r_value_a,
double *r_value_b,
const bUnitDef *main_unit)
{
const bUnitDef *unit;
if (main_unit) {
unit = main_unit;
}
else {
unit = unit_best_fit(value, usys, NULL, 1);
}
*r_value_a = (value < 0.0 ? ceil : floor)(value / unit->scalar) * unit->scalar;
*r_value_b = value - (*r_value_a);
*r_unit_a = unit;
*r_unit_b = unit_best_fit(*r_value_b, usys, *r_unit_a, 1);
} | [
"static",
"void",
"unit_dual_convert",
"(",
"double",
"value",
",",
"const",
"bUnitCollection",
"*",
"usys",
",",
"bUnitDef",
"const",
"*",
"*",
"r_unit_a",
",",
"bUnitDef",
"const",
"*",
"*",
"r_unit_b",
",",
"double",
"*",
"r_value_a",
",",
"double",
"*",
"r_value_b",
",",
"const",
"bUnitDef",
"*",
"main_unit",
")",
"{",
"const",
"bUnitDef",
"*",
"unit",
";",
"if",
"(",
"main_unit",
")",
"{",
"unit",
"=",
"main_unit",
";",
"}",
"else",
"{",
"unit",
"=",
"unit_best_fit",
"(",
"value",
",",
"usys",
",",
"NULL",
",",
"1",
")",
";",
"}",
"*",
"r_value_a",
"=",
"(",
"value",
"<",
"0.0",
"?",
"ceil",
":",
"floor",
")",
"(",
"value",
"/",
"unit",
"->",
"scalar",
")",
"*",
"unit",
"->",
"scalar",
";",
"*",
"r_value_b",
"=",
"value",
"-",
"(",
"*",
"r_value_a",
")",
";",
"*",
"r_unit_a",
"=",
"unit",
";",
"*",
"r_unit_b",
"=",
"unit_best_fit",
"(",
"*",
"r_value_b",
",",
"usys",
",",
"*",
"r_unit_a",
",",
"1",
")",
";",
"}"
] | convert into 2 units and 2 values for "2ft, 3inch" syntax | [
"convert",
"into",
"2",
"units",
"and",
"2",
"values",
"for",
"\"",
"2ft",
"3inch",
"\"",
"syntax"
] | [] | [
{
"param": "value",
"type": "double"
},
{
"param": "usys",
"type": "bUnitCollection"
},
{
"param": "r_unit_a",
"type": "bUnitDef"
},
{
"param": "r_unit_b",
"type": "bUnitDef"
},
{
"param": "r_value_a",
"type": "double"
},
{
"param": "r_value_b",
"type": "double"
},
{
"param": "main_unit",
"type": "bUnitDef"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "value",
"type": "double",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "usys",
"type": "bUnitCollection",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "r_unit_a",
"type": "bUnitDef",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "r_unit_b",
"type": "bUnitDef",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "r_value_a",
"type": "double",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "r_value_b",
"type": "double",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "main_unit",
"type": "bUnitDef",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ac1b5e4ab0bf1a1ab854a6d8a7b704117dea1e1b | DemonRem/blender | source/blender/blenkernel/intern/unit.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | bUnit_ReplaceString | bool | bool bUnit_ReplaceString(
char *str, int len_max, const char *str_prev, double scale_pref, int system, int type)
{
const bUnitCollection *usys = unit_get_system(system, type);
if (!is_valid_unit_collection(usys)) {
return false;
}
const bUnitDef *unit = NULL, *default_unit;
double scale_pref_base = scale_pref;
char str_tmp[TEMP_STR_SIZE];
bool changed = false;
/* Try to find a default unit from current or previous string. */
default_unit = unit_detect_from_str(usys, str, str_prev);
/* We apply the default unit to the whole expression (default unit is now the reference '1.0'
* one). */
scale_pref_base *= default_unit->scalar;
/* Apply the default unit on the whole expression, this allows to handle nasty cases like
* '2+2in'. */
if (BLI_snprintf(str_tmp, sizeof(str_tmp), "(%s)*%.9g", str, default_unit->scalar) <
sizeof(str_tmp)) {
strncpy(str, str_tmp, len_max);
}
else {
/* BLI_snprintf would not fit into str_tmp, cant do much in this case
* check for this because otherwise bUnit_ReplaceString could call its self forever */
return changed;
}
for (unit = usys->units; unit->name; unit++) {
/* in case there are multiple instances */
while (unit_replace(str, len_max, str_tmp, scale_pref_base, unit)) {
changed = true;
}
}
unit = NULL;
{
/* try other unit systems now, so we can evaluate imperial when metric is set for eg. */
/* Note that checking other systems at that point means we do not support their units as
* 'default' one. In other words, when in metrics, typing '2+2in' will give 2 meters 2 inches,
* not 4 inches. I do think this is the desired behavior!
*/
const bUnitCollection *usys_iter;
int system_iter;
for (system_iter = 0; system_iter < UNIT_SYSTEM_TOT; system_iter++) {
if (system_iter != system) {
usys_iter = unit_get_system(system_iter, type);
if (usys_iter) {
for (unit = usys_iter->units; unit->name; unit++) {
int ofs = 0;
/* in case there are multiple instances */
while (
(ofs = unit_replace(str + ofs, len_max - ofs, str_tmp, scale_pref_base, unit))) {
changed = true;
}
}
}
}
}
}
unit = NULL;
/* replace # with add sign when there is no operator between it and the next number
*
* "1*1# 3*100# * 3" -> "1*1+ 3*100 * 3"
*
* */
{
char *str_found = str;
const char *ch = str;
while ((str_found = strchr(str_found, SEP_CHR))) {
bool op_found = false;
/* any operators after this? */
for (ch = str_found + 1; *ch != '\0'; ch++) {
if (*ch == ' ' || *ch == '\t') {
continue;
}
op_found = (ch_is_op(*ch) || ELEM(*ch, ',', ')'));
break;
}
/* If found an op, comma or closing parenthesis, no need to insert a '+', else we need it. */
*str_found++ = op_found ? ' ' : '+';
}
}
return changed;
} | /* make a copy of the string that replaces the units with numbers
* this is used before parsing
* This is only used when evaluating user input and can afford to be a bit slower
*
* This is to be used before python evaluation so..
* 10.1km -> 10.1*1000.0
* ...will be resolved by python.
*
* values will be split by an add sign
* 5'2" -> 5*0.3048 + 2*0.0254
*
* str_prev is optional, when valid it is used to get a base unit when none is set.
*
* return true of a change was made.
*/ | make a copy of the string that replaces the units with numbers
this is used before parsing
This is only used when evaluating user input and can afford to be a bit slower
This is to be used before python evaluation so
10.1km -> 10.1*1000.0
will be resolved by python.
str_prev is optional, when valid it is used to get a base unit when none is set.
return true of a change was made. | [
"make",
"a",
"copy",
"of",
"the",
"string",
"that",
"replaces",
"the",
"units",
"with",
"numbers",
"this",
"is",
"used",
"before",
"parsing",
"This",
"is",
"only",
"used",
"when",
"evaluating",
"user",
"input",
"and",
"can",
"afford",
"to",
"be",
"a",
"bit",
"slower",
"This",
"is",
"to",
"be",
"used",
"before",
"python",
"evaluation",
"so",
"10",
".",
"1km",
"-",
">",
"10",
".",
"1",
"*",
"1000",
".",
"0",
"will",
"be",
"resolved",
"by",
"python",
".",
"str_prev",
"is",
"optional",
"when",
"valid",
"it",
"is",
"used",
"to",
"get",
"a",
"base",
"unit",
"when",
"none",
"is",
"set",
".",
"return",
"true",
"of",
"a",
"change",
"was",
"made",
"."
] | bool bUnit_ReplaceString(
char *str, int len_max, const char *str_prev, double scale_pref, int system, int type)
{
const bUnitCollection *usys = unit_get_system(system, type);
if (!is_valid_unit_collection(usys)) {
return false;
}
const bUnitDef *unit = NULL, *default_unit;
double scale_pref_base = scale_pref;
char str_tmp[TEMP_STR_SIZE];
bool changed = false;
default_unit = unit_detect_from_str(usys, str, str_prev);
scale_pref_base *= default_unit->scalar;
if (BLI_snprintf(str_tmp, sizeof(str_tmp), "(%s)*%.9g", str, default_unit->scalar) <
sizeof(str_tmp)) {
strncpy(str, str_tmp, len_max);
}
else {
return changed;
}
for (unit = usys->units; unit->name; unit++) {
while (unit_replace(str, len_max, str_tmp, scale_pref_base, unit)) {
changed = true;
}
}
unit = NULL;
{
const bUnitCollection *usys_iter;
int system_iter;
for (system_iter = 0; system_iter < UNIT_SYSTEM_TOT; system_iter++) {
if (system_iter != system) {
usys_iter = unit_get_system(system_iter, type);
if (usys_iter) {
for (unit = usys_iter->units; unit->name; unit++) {
int ofs = 0;
while (
(ofs = unit_replace(str + ofs, len_max - ofs, str_tmp, scale_pref_base, unit))) {
changed = true;
}
}
}
}
}
}
unit = NULL;
{
char *str_found = str;
const char *ch = str;
while ((str_found = strchr(str_found, SEP_CHR))) {
bool op_found = false;
for (ch = str_found + 1; *ch != '\0'; ch++) {
if (*ch == ' ' || *ch == '\t') {
continue;
}
op_found = (ch_is_op(*ch) || ELEM(*ch, ',', ')'));
break;
}
*str_found++ = op_found ? ' ' : '+';
}
}
return changed;
} | [
"bool",
"bUnit_ReplaceString",
"(",
"char",
"*",
"str",
",",
"int",
"len_max",
",",
"const",
"char",
"*",
"str_prev",
",",
"double",
"scale_pref",
",",
"int",
"system",
",",
"int",
"type",
")",
"{",
"const",
"bUnitCollection",
"*",
"usys",
"=",
"unit_get_system",
"(",
"system",
",",
"type",
")",
";",
"if",
"(",
"!",
"is_valid_unit_collection",
"(",
"usys",
")",
")",
"{",
"return",
"false",
";",
"}",
"const",
"bUnitDef",
"*",
"unit",
"=",
"NULL",
",",
"*",
"default_unit",
";",
"double",
"scale_pref_base",
"=",
"scale_pref",
";",
"char",
"str_tmp",
"[",
"TEMP_STR_SIZE",
"]",
";",
"bool",
"changed",
"=",
"false",
";",
"default_unit",
"=",
"unit_detect_from_str",
"(",
"usys",
",",
"str",
",",
"str_prev",
")",
";",
"scale_pref_base",
"*=",
"default_unit",
"->",
"scalar",
";",
"if",
"(",
"BLI_snprintf",
"(",
"str_tmp",
",",
"sizeof",
"(",
"str_tmp",
")",
",",
"\"",
"\"",
",",
"str",
",",
"default_unit",
"->",
"scalar",
")",
"<",
"sizeof",
"(",
"str_tmp",
")",
")",
"{",
"strncpy",
"(",
"str",
",",
"str_tmp",
",",
"len_max",
")",
";",
"}",
"else",
"{",
"return",
"changed",
";",
"}",
"for",
"(",
"unit",
"=",
"usys",
"->",
"units",
";",
"unit",
"->",
"name",
";",
"unit",
"++",
")",
"{",
"while",
"(",
"unit_replace",
"(",
"str",
",",
"len_max",
",",
"str_tmp",
",",
"scale_pref_base",
",",
"unit",
")",
")",
"{",
"changed",
"=",
"true",
";",
"}",
"}",
"unit",
"=",
"NULL",
";",
"{",
"const",
"bUnitCollection",
"*",
"usys_iter",
";",
"int",
"system_iter",
";",
"for",
"(",
"system_iter",
"=",
"0",
";",
"system_iter",
"<",
"UNIT_SYSTEM_TOT",
";",
"system_iter",
"++",
")",
"{",
"if",
"(",
"system_iter",
"!=",
"system",
")",
"{",
"usys_iter",
"=",
"unit_get_system",
"(",
"system_iter",
",",
"type",
")",
";",
"if",
"(",
"usys_iter",
")",
"{",
"for",
"(",
"unit",
"=",
"usys_iter",
"->",
"units",
";",
"unit",
"->",
"name",
";",
"unit",
"++",
")",
"{",
"int",
"ofs",
"=",
"0",
";",
"while",
"(",
"(",
"ofs",
"=",
"unit_replace",
"(",
"str",
"+",
"ofs",
",",
"len_max",
"-",
"ofs",
",",
"str_tmp",
",",
"scale_pref_base",
",",
"unit",
")",
")",
")",
"{",
"changed",
"=",
"true",
";",
"}",
"}",
"}",
"}",
"}",
"}",
"unit",
"=",
"NULL",
";",
"{",
"char",
"*",
"str_found",
"=",
"str",
";",
"const",
"char",
"*",
"ch",
"=",
"str",
";",
"while",
"(",
"(",
"str_found",
"=",
"strchr",
"(",
"str_found",
",",
"SEP_CHR",
")",
")",
")",
"{",
"bool",
"op_found",
"=",
"false",
";",
"for",
"(",
"ch",
"=",
"str_found",
"+",
"1",
";",
"*",
"ch",
"!=",
"'",
"\\0",
"'",
";",
"ch",
"++",
")",
"{",
"if",
"(",
"*",
"ch",
"==",
"'",
"'",
"||",
"*",
"ch",
"==",
"'",
"\\t",
"'",
")",
"{",
"continue",
";",
"}",
"op_found",
"=",
"(",
"ch_is_op",
"(",
"*",
"ch",
")",
"||",
"ELEM",
"(",
"*",
"ch",
",",
"'",
"'",
",",
"'",
"'",
")",
")",
";",
"break",
";",
"}",
"*",
"str_found",
"++",
"=",
"op_found",
"?",
"'",
"'",
":",
"'",
"'",
";",
"}",
"}",
"return",
"changed",
";",
"}"
] | make a copy of the string that replaces the units with numbers
this is used before parsing
This is only used when evaluating user input and can afford to be a bit slower | [
"make",
"a",
"copy",
"of",
"the",
"string",
"that",
"replaces",
"the",
"units",
"with",
"numbers",
"this",
"is",
"used",
"before",
"parsing",
"This",
"is",
"only",
"used",
"when",
"evaluating",
"user",
"input",
"and",
"can",
"afford",
"to",
"be",
"a",
"bit",
"slower"
] | [
"/* Try to find a default unit from current or previous string. */",
"/* We apply the default unit to the whole expression (default unit is now the reference '1.0'\n * one). */",
"/* Apply the default unit on the whole expression, this allows to handle nasty cases like\n * '2+2in'. */",
"/* BLI_snprintf would not fit into str_tmp, cant do much in this case\n * check for this because otherwise bUnit_ReplaceString could call its self forever */",
"/* in case there are multiple instances */",
"/* try other unit systems now, so we can evaluate imperial when metric is set for eg. */",
"/* Note that checking other systems at that point means we do not support their units as\n * 'default' one. In other words, when in metrics, typing '2+2in' will give 2 meters 2 inches,\n * not 4 inches. I do think this is the desired behavior!\n */",
"/* in case there are multiple instances */",
"/* replace # with add sign when there is no operator between it and the next number\n *\n * \"1*1# 3*100# * 3\" -> \"1*1+ 3*100 * 3\"\n *\n * */",
"/* any operators after this? */",
"/* If found an op, comma or closing parenthesis, no need to insert a '+', else we need it. */"
] | [
{
"param": "str",
"type": "char"
},
{
"param": "len_max",
"type": "int"
},
{
"param": "str_prev",
"type": "char"
},
{
"param": "scale_pref",
"type": "double"
},
{
"param": "system",
"type": "int"
},
{
"param": "type",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "str",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "len_max",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "str_prev",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scale_pref",
"type": "double",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "system",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
88765f1d165ff66fae025eb9ace38d5b50a771b4 | DemonRem/blender | source/blender/nodes/composite/nodes/node_composite_image.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | cmp_node_image_verify_outputs | void | static void cmp_node_image_verify_outputs(bNodeTree *ntree, bNode *node, bool rlayer)
{
bNodeSocket *sock, *sock_next;
LinkNodePair available_sockets = {NULL, NULL};
int sock_index;
/* XXX make callback */
if (rlayer) {
cmp_node_rlayer_create_outputs(ntree, node, &available_sockets);
}
else {
cmp_node_image_create_outputs(ntree, node, &available_sockets);
}
/* Get rid of sockets whose passes are not available in the image.
* If sockets that are not available would be deleted, the connections to them would be lost
* when e.g. opening a file (since there's no render at all yet).
* Therefore, sockets with connected links will just be set as unavailable.
*
* Another important detail comes from compatibility with the older socket model, where there
* was a fixed socket per pass type that was just hidden or not. Therefore, older versions expect
* the first 31 passes to belong to a specific pass type.
* So, we keep those 31 always allocated before the others as well,
* even if they have no links attached. */
sock_index = 0;
for (sock = node->outputs.first; sock; sock = sock_next, sock_index++) {
sock_next = sock->next;
if (BLI_linklist_index(available_sockets.list, sock) >= 0) {
sock->flag &= ~(SOCK_UNAVAIL | SOCK_HIDDEN);
}
else {
bNodeLink *link;
for (link = ntree->links.first; link; link = link->next) {
if (link->fromsock == sock) {
break;
}
}
if (!link && (!rlayer || sock_index > 30)) {
MEM_freeN(sock->storage);
nodeRemoveSocket(ntree, node, sock);
}
else {
sock->flag |= SOCK_UNAVAIL;
}
}
}
BLI_linklist_free(available_sockets.list, NULL);
} | /* XXX make this into a generic socket verification function for dynamic socket replacement
* (multilayer, groups, static templates) */ | XXX make this into a generic socket verification function for dynamic socket replacement
(multilayer, groups, static templates) | [
"XXX",
"make",
"this",
"into",
"a",
"generic",
"socket",
"verification",
"function",
"for",
"dynamic",
"socket",
"replacement",
"(",
"multilayer",
"groups",
"static",
"templates",
")"
] | static void cmp_node_image_verify_outputs(bNodeTree *ntree, bNode *node, bool rlayer)
{
bNodeSocket *sock, *sock_next;
LinkNodePair available_sockets = {NULL, NULL};
int sock_index;
if (rlayer) {
cmp_node_rlayer_create_outputs(ntree, node, &available_sockets);
}
else {
cmp_node_image_create_outputs(ntree, node, &available_sockets);
}
sock_index = 0;
for (sock = node->outputs.first; sock; sock = sock_next, sock_index++) {
sock_next = sock->next;
if (BLI_linklist_index(available_sockets.list, sock) >= 0) {
sock->flag &= ~(SOCK_UNAVAIL | SOCK_HIDDEN);
}
else {
bNodeLink *link;
for (link = ntree->links.first; link; link = link->next) {
if (link->fromsock == sock) {
break;
}
}
if (!link && (!rlayer || sock_index > 30)) {
MEM_freeN(sock->storage);
nodeRemoveSocket(ntree, node, sock);
}
else {
sock->flag |= SOCK_UNAVAIL;
}
}
}
BLI_linklist_free(available_sockets.list, NULL);
} | [
"static",
"void",
"cmp_node_image_verify_outputs",
"(",
"bNodeTree",
"*",
"ntree",
",",
"bNode",
"*",
"node",
",",
"bool",
"rlayer",
")",
"{",
"bNodeSocket",
"*",
"sock",
",",
"*",
"sock_next",
";",
"LinkNodePair",
"available_sockets",
"=",
"{",
"NULL",
",",
"NULL",
"}",
";",
"int",
"sock_index",
";",
"if",
"(",
"rlayer",
")",
"{",
"cmp_node_rlayer_create_outputs",
"(",
"ntree",
",",
"node",
",",
"&",
"available_sockets",
")",
";",
"}",
"else",
"{",
"cmp_node_image_create_outputs",
"(",
"ntree",
",",
"node",
",",
"&",
"available_sockets",
")",
";",
"}",
"sock_index",
"=",
"0",
";",
"for",
"(",
"sock",
"=",
"node",
"->",
"outputs",
".",
"first",
";",
"sock",
";",
"sock",
"=",
"sock_next",
",",
"sock_index",
"++",
")",
"{",
"sock_next",
"=",
"sock",
"->",
"next",
";",
"if",
"(",
"BLI_linklist_index",
"(",
"available_sockets",
".",
"list",
",",
"sock",
")",
">=",
"0",
")",
"{",
"sock",
"->",
"flag",
"&=",
"~",
"(",
"SOCK_UNAVAIL",
"|",
"SOCK_HIDDEN",
")",
";",
"}",
"else",
"{",
"bNodeLink",
"*",
"link",
";",
"for",
"(",
"link",
"=",
"ntree",
"->",
"links",
".",
"first",
";",
"link",
";",
"link",
"=",
"link",
"->",
"next",
")",
"{",
"if",
"(",
"link",
"->",
"fromsock",
"==",
"sock",
")",
"{",
"break",
";",
"}",
"}",
"if",
"(",
"!",
"link",
"&&",
"(",
"!",
"rlayer",
"||",
"sock_index",
">",
"30",
")",
")",
"{",
"MEM_freeN",
"(",
"sock",
"->",
"storage",
")",
";",
"nodeRemoveSocket",
"(",
"ntree",
",",
"node",
",",
"sock",
")",
";",
"}",
"else",
"{",
"sock",
"->",
"flag",
"|=",
"SOCK_UNAVAIL",
";",
"}",
"}",
"}",
"BLI_linklist_free",
"(",
"available_sockets",
".",
"list",
",",
"NULL",
")",
";",
"}"
] | XXX make this into a generic socket verification function for dynamic socket replacement
(multilayer, groups, static templates) | [
"XXX",
"make",
"this",
"into",
"a",
"generic",
"socket",
"verification",
"function",
"for",
"dynamic",
"socket",
"replacement",
"(",
"multilayer",
"groups",
"static",
"templates",
")"
] | [
"/* XXX make callback */",
"/* Get rid of sockets whose passes are not available in the image.\n * If sockets that are not available would be deleted, the connections to them would be lost\n * when e.g. opening a file (since there's no render at all yet).\n * Therefore, sockets with connected links will just be set as unavailable.\n *\n * Another important detail comes from compatibility with the older socket model, where there\n * was a fixed socket per pass type that was just hidden or not. Therefore, older versions expect\n * the first 31 passes to belong to a specific pass type.\n * So, we keep those 31 always allocated before the others as well,\n * even if they have no links attached. */"
] | [
{
"param": "ntree",
"type": "bNodeTree"
},
{
"param": "node",
"type": "bNode"
},
{
"param": "rlayer",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ntree",
"type": "bNodeTree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "node",
"type": "bNode",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rlayer",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
fc087ff91b23a5aa9167ce65ce406408db24ac63 | DemonRem/blender | source/blender/blenkernel/intern/mask.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | BKE_mask_copy_data | void | void BKE_mask_copy_data(Main *UNUSED(bmain),
Mask *mask_dst,
const Mask *mask_src,
const int UNUSED(flag))
{
BLI_listbase_clear(&mask_dst->masklayers);
/* TODO add unused flag to those as well. */
BKE_mask_layer_copy_list(&mask_dst->masklayers, &mask_src->masklayers);
/* enable fake user by default */
id_fake_user_set(&mask_dst->id);
} | /**
* Only copy internal data of Mask ID from source
* to already allocated/initialized destination.
* You probably never want to use that directly,
* use #BKE_id_copy or #BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
* \param flag: Copying options (see BKE_library.h's LIB_ID_COPY_... flags for more).
*/ | Only copy internal data of Mask ID from source
to already allocated/initialized destination.
You probably never want to use that directly,
use #BKE_id_copy or #BKE_id_copy_ex for typical needs.
WARNING. This function will not handle ID user count!
\param flag: Copying options . | [
"Only",
"copy",
"internal",
"data",
"of",
"Mask",
"ID",
"from",
"source",
"to",
"already",
"allocated",
"/",
"initialized",
"destination",
".",
"You",
"probably",
"never",
"want",
"to",
"use",
"that",
"directly",
"use",
"#BKE_id_copy",
"or",
"#BKE_id_copy_ex",
"for",
"typical",
"needs",
".",
"WARNING",
".",
"This",
"function",
"will",
"not",
"handle",
"ID",
"user",
"count!",
"\\",
"param",
"flag",
":",
"Copying",
"options",
"."
] | void BKE_mask_copy_data(Main *UNUSED(bmain),
Mask *mask_dst,
const Mask *mask_src,
const int UNUSED(flag))
{
BLI_listbase_clear(&mask_dst->masklayers);
BKE_mask_layer_copy_list(&mask_dst->masklayers, &mask_src->masklayers);
id_fake_user_set(&mask_dst->id);
} | [
"void",
"BKE_mask_copy_data",
"(",
"Main",
"*",
"UNUSED",
"(",
"bmain",
")",
",",
"Mask",
"*",
"mask_dst",
",",
"const",
"Mask",
"*",
"mask_src",
",",
"const",
"int",
"UNUSED",
"(",
"flag",
")",
")",
"{",
"BLI_listbase_clear",
"(",
"&",
"mask_dst",
"->",
"masklayers",
")",
";",
"BKE_mask_layer_copy_list",
"(",
"&",
"mask_dst",
"->",
"masklayers",
",",
"&",
"mask_src",
"->",
"masklayers",
")",
";",
"id_fake_user_set",
"(",
"&",
"mask_dst",
"->",
"id",
")",
";",
"}"
] | Only copy internal data of Mask ID from source
to already allocated/initialized destination. | [
"Only",
"copy",
"internal",
"data",
"of",
"Mask",
"ID",
"from",
"source",
"to",
"already",
"allocated",
"/",
"initialized",
"destination",
"."
] | [
"/* TODO add unused flag to those as well. */",
"/* enable fake user by default */"
] | [
{
"param": "UNUSED",
"type": "int"
},
{
"param": "mask_dst",
"type": "Mask"
},
{
"param": "mask_src",
"type": "Mask"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "UNUSED",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mask_dst",
"type": "Mask",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mask_src",
"type": "Mask",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
fc087ff91b23a5aa9167ce65ce406408db24ac63 | DemonRem/blender | source/blender/blenkernel/intern/mask.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | BKE_mask_layer_free_shapes | void | void BKE_mask_layer_free_shapes(MaskLayer *masklay)
{
MaskLayerShape *masklay_shape;
/* free animation data */
masklay_shape = masklay->splines_shapes.first;
while (masklay_shape) {
MaskLayerShape *next_masklay_shape = masklay_shape->next;
BLI_remlink(&masklay->splines_shapes, masklay_shape);
BKE_mask_layer_shape_free(masklay_shape);
masklay_shape = next_masklay_shape;
}
} | /** \brief Free all animation keys for a mask layer
*/ | \brief Free all animation keys for a mask layer | [
"\\",
"brief",
"Free",
"all",
"animation",
"keys",
"for",
"a",
"mask",
"layer"
] | void BKE_mask_layer_free_shapes(MaskLayer *masklay)
{
MaskLayerShape *masklay_shape;
masklay_shape = masklay->splines_shapes.first;
while (masklay_shape) {
MaskLayerShape *next_masklay_shape = masklay_shape->next;
BLI_remlink(&masklay->splines_shapes, masklay_shape);
BKE_mask_layer_shape_free(masklay_shape);
masklay_shape = next_masklay_shape;
}
} | [
"void",
"BKE_mask_layer_free_shapes",
"(",
"MaskLayer",
"*",
"masklay",
")",
"{",
"MaskLayerShape",
"*",
"masklay_shape",
";",
"masklay_shape",
"=",
"masklay",
"->",
"splines_shapes",
".",
"first",
";",
"while",
"(",
"masklay_shape",
")",
"{",
"MaskLayerShape",
"*",
"next_masklay_shape",
"=",
"masklay_shape",
"->",
"next",
";",
"BLI_remlink",
"(",
"&",
"masklay",
"->",
"splines_shapes",
",",
"masklay_shape",
")",
";",
"BKE_mask_layer_shape_free",
"(",
"masklay_shape",
")",
";",
"masklay_shape",
"=",
"next_masklay_shape",
";",
"}",
"}"
] | \brief Free all animation keys for a mask layer | [
"\\",
"brief",
"Free",
"all",
"animation",
"keys",
"for",
"a",
"mask",
"layer"
] | [
"/* free animation data */"
] | [
{
"param": "masklay",
"type": "MaskLayer"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "masklay",
"type": "MaskLayer",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
fc087ff91b23a5aa9167ce65ce406408db24ac63 | DemonRem/blender | source/blender/blenkernel/intern/mask.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | BKE_mask_free | void | void BKE_mask_free(Mask *mask)
{
BKE_animdata_free((ID *)mask, false);
/* free mask data */
BKE_mask_layer_free_list(&mask->masklayers);
} | /** Free (or release) any data used by this mask (does not free the mask itself). */ | Free (or release) any data used by this mask (does not free the mask itself). | [
"Free",
"(",
"or",
"release",
")",
"any",
"data",
"used",
"by",
"this",
"mask",
"(",
"does",
"not",
"free",
"the",
"mask",
"itself",
")",
"."
] | void BKE_mask_free(Mask *mask)
{
BKE_animdata_free((ID *)mask, false);
BKE_mask_layer_free_list(&mask->masklayers);
} | [
"void",
"BKE_mask_free",
"(",
"Mask",
"*",
"mask",
")",
"{",
"BKE_animdata_free",
"(",
"(",
"ID",
"*",
")",
"mask",
",",
"false",
")",
";",
"BKE_mask_layer_free_list",
"(",
"&",
"mask",
"->",
"masklayers",
")",
";",
"}"
] | Free (or release) any data used by this mask (does not free the mask itself). | [
"Free",
"(",
"or",
"release",
")",
"any",
"data",
"used",
"by",
"this",
"mask",
"(",
"does",
"not",
"free",
"the",
"mask",
"itself",
")",
"."
] | [
"/* free mask data */"
] | [
{
"param": "mask",
"type": "Mask"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "mask",
"type": "Mask",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
fc087ff91b23a5aa9167ce65ce406408db24ac63 | DemonRem/blender | source/blender/blenkernel/intern/mask.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | BKE_mask_calc_tangent_polyline | void | void BKE_mask_calc_tangent_polyline(MaskSpline *spline, MaskSplinePoint *point, float t[2])
{
float tvec_a[2], tvec_b[2];
MaskSplinePoint *point_prev, *point_next;
BKE_mask_get_handle_point_adjacent(spline, point, &point_prev, &point_next);
if (point_prev) {
sub_v2_v2v2(tvec_a, point->bezt.vec[1], point_prev->bezt.vec[1]);
normalize_v2(tvec_a);
}
else {
zero_v2(tvec_a);
}
if (point_next) {
sub_v2_v2v2(tvec_b, point_next->bezt.vec[1], point->bezt.vec[1]);
normalize_v2(tvec_b);
}
else {
zero_v2(tvec_b);
}
add_v2_v2v2(t, tvec_a, tvec_b);
normalize_v2(t);
} | /* calculates the tangent of a point by its previous and next
* (ignoring handles - as if its a poly line) */ | calculates the tangent of a point by its previous and next
(ignoring handles - as if its a poly line) | [
"calculates",
"the",
"tangent",
"of",
"a",
"point",
"by",
"its",
"previous",
"and",
"next",
"(",
"ignoring",
"handles",
"-",
"as",
"if",
"its",
"a",
"poly",
"line",
")"
] | void BKE_mask_calc_tangent_polyline(MaskSpline *spline, MaskSplinePoint *point, float t[2])
{
float tvec_a[2], tvec_b[2];
MaskSplinePoint *point_prev, *point_next;
BKE_mask_get_handle_point_adjacent(spline, point, &point_prev, &point_next);
if (point_prev) {
sub_v2_v2v2(tvec_a, point->bezt.vec[1], point_prev->bezt.vec[1]);
normalize_v2(tvec_a);
}
else {
zero_v2(tvec_a);
}
if (point_next) {
sub_v2_v2v2(tvec_b, point_next->bezt.vec[1], point->bezt.vec[1]);
normalize_v2(tvec_b);
}
else {
zero_v2(tvec_b);
}
add_v2_v2v2(t, tvec_a, tvec_b);
normalize_v2(t);
} | [
"void",
"BKE_mask_calc_tangent_polyline",
"(",
"MaskSpline",
"*",
"spline",
",",
"MaskSplinePoint",
"*",
"point",
",",
"float",
"t",
"[",
"2",
"]",
")",
"{",
"float",
"tvec_a",
"[",
"2",
"]",
",",
"tvec_b",
"[",
"2",
"]",
";",
"MaskSplinePoint",
"*",
"point_prev",
",",
"*",
"point_next",
";",
"BKE_mask_get_handle_point_adjacent",
"(",
"spline",
",",
"point",
",",
"&",
"point_prev",
",",
"&",
"point_next",
")",
";",
"if",
"(",
"point_prev",
")",
"{",
"sub_v2_v2v2",
"(",
"tvec_a",
",",
"point",
"->",
"bezt",
".",
"vec",
"[",
"1",
"]",
",",
"point_prev",
"->",
"bezt",
".",
"vec",
"[",
"1",
"]",
")",
";",
"normalize_v2",
"(",
"tvec_a",
")",
";",
"}",
"else",
"{",
"zero_v2",
"(",
"tvec_a",
")",
";",
"}",
"if",
"(",
"point_next",
")",
"{",
"sub_v2_v2v2",
"(",
"tvec_b",
",",
"point_next",
"->",
"bezt",
".",
"vec",
"[",
"1",
"]",
",",
"point",
"->",
"bezt",
".",
"vec",
"[",
"1",
"]",
")",
";",
"normalize_v2",
"(",
"tvec_b",
")",
";",
"}",
"else",
"{",
"zero_v2",
"(",
"tvec_b",
")",
";",
"}",
"add_v2_v2v2",
"(",
"t",
",",
"tvec_a",
",",
"tvec_b",
")",
";",
"normalize_v2",
"(",
"t",
")",
";",
"}"
] | calculates the tangent of a point by its previous and next
(ignoring handles - as if its a poly line) | [
"calculates",
"the",
"tangent",
"of",
"a",
"point",
"by",
"its",
"previous",
"and",
"next",
"(",
"ignoring",
"handles",
"-",
"as",
"if",
"its",
"a",
"poly",
"line",
")"
] | [] | [
{
"param": "spline",
"type": "MaskSpline"
},
{
"param": "point",
"type": "MaskSplinePoint"
},
{
"param": "t",
"type": "float"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "spline",
"type": "MaskSpline",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "point",
"type": "MaskSplinePoint",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "t",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
fc087ff91b23a5aa9167ce65ce406408db24ac63 | DemonRem/blender | source/blender/blenkernel/intern/mask.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | BKE_mask_calc_handle_point_auto | void | void BKE_mask_calc_handle_point_auto(MaskSpline *spline,
MaskSplinePoint *point,
const bool do_recalc_length)
{
MaskSplinePoint *point_prev, *point_next;
const char h_back[2] = {point->bezt.h1, point->bezt.h2};
const float length_average = (do_recalc_length) ?
0.0f /* dummy value */ :
(len_v3v3(point->bezt.vec[0], point->bezt.vec[1]) +
len_v3v3(point->bezt.vec[1], point->bezt.vec[2])) /
2.0f;
BKE_mask_get_handle_point_adjacent(spline, point, &point_prev, &point_next);
point->bezt.h1 = HD_AUTO;
point->bezt.h2 = HD_AUTO;
mask_calc_point_handle(point, point_prev, point_next);
point->bezt.h1 = h_back[0];
point->bezt.h2 = h_back[1];
/* preserve length by applying it back */
if (do_recalc_length == false) {
dist_ensure_v2_v2fl(point->bezt.vec[0], point->bezt.vec[1], length_average);
dist_ensure_v2_v2fl(point->bezt.vec[2], point->bezt.vec[1], length_average);
}
} | /**
* \brief Resets auto handles even for non-auto bezier points
*
* Useful for giving sane defaults.
*/ | \brief Resets auto handles even for non-auto bezier points
Useful for giving sane defaults. | [
"\\",
"brief",
"Resets",
"auto",
"handles",
"even",
"for",
"non",
"-",
"auto",
"bezier",
"points",
"Useful",
"for",
"giving",
"sane",
"defaults",
"."
] | void BKE_mask_calc_handle_point_auto(MaskSpline *spline,
MaskSplinePoint *point,
const bool do_recalc_length)
{
MaskSplinePoint *point_prev, *point_next;
const char h_back[2] = {point->bezt.h1, point->bezt.h2};
const float length_average = (do_recalc_length) ?
0.0f :
(len_v3v3(point->bezt.vec[0], point->bezt.vec[1]) +
len_v3v3(point->bezt.vec[1], point->bezt.vec[2])) /
2.0f;
BKE_mask_get_handle_point_adjacent(spline, point, &point_prev, &point_next);
point->bezt.h1 = HD_AUTO;
point->bezt.h2 = HD_AUTO;
mask_calc_point_handle(point, point_prev, point_next);
point->bezt.h1 = h_back[0];
point->bezt.h2 = h_back[1];
if (do_recalc_length == false) {
dist_ensure_v2_v2fl(point->bezt.vec[0], point->bezt.vec[1], length_average);
dist_ensure_v2_v2fl(point->bezt.vec[2], point->bezt.vec[1], length_average);
}
} | [
"void",
"BKE_mask_calc_handle_point_auto",
"(",
"MaskSpline",
"*",
"spline",
",",
"MaskSplinePoint",
"*",
"point",
",",
"const",
"bool",
"do_recalc_length",
")",
"{",
"MaskSplinePoint",
"*",
"point_prev",
",",
"*",
"point_next",
";",
"const",
"char",
"h_back",
"[",
"2",
"]",
"=",
"{",
"point",
"->",
"bezt",
".",
"h1",
",",
"point",
"->",
"bezt",
".",
"h2",
"}",
";",
"const",
"float",
"length_average",
"=",
"(",
"do_recalc_length",
")",
"?",
"0.0f",
":",
"(",
"len_v3v3",
"(",
"point",
"->",
"bezt",
".",
"vec",
"[",
"0",
"]",
",",
"point",
"->",
"bezt",
".",
"vec",
"[",
"1",
"]",
")",
"+",
"len_v3v3",
"(",
"point",
"->",
"bezt",
".",
"vec",
"[",
"1",
"]",
",",
"point",
"->",
"bezt",
".",
"vec",
"[",
"2",
"]",
")",
")",
"/",
"2.0f",
";",
"BKE_mask_get_handle_point_adjacent",
"(",
"spline",
",",
"point",
",",
"&",
"point_prev",
",",
"&",
"point_next",
")",
";",
"point",
"->",
"bezt",
".",
"h1",
"=",
"HD_AUTO",
";",
"point",
"->",
"bezt",
".",
"h2",
"=",
"HD_AUTO",
";",
"mask_calc_point_handle",
"(",
"point",
",",
"point_prev",
",",
"point_next",
")",
";",
"point",
"->",
"bezt",
".",
"h1",
"=",
"h_back",
"[",
"0",
"]",
";",
"point",
"->",
"bezt",
".",
"h2",
"=",
"h_back",
"[",
"1",
"]",
";",
"if",
"(",
"do_recalc_length",
"==",
"false",
")",
"{",
"dist_ensure_v2_v2fl",
"(",
"point",
"->",
"bezt",
".",
"vec",
"[",
"0",
"]",
",",
"point",
"->",
"bezt",
".",
"vec",
"[",
"1",
"]",
",",
"length_average",
")",
";",
"dist_ensure_v2_v2fl",
"(",
"point",
"->",
"bezt",
".",
"vec",
"[",
"2",
"]",
",",
"point",
"->",
"bezt",
".",
"vec",
"[",
"1",
"]",
",",
"length_average",
")",
";",
"}",
"}"
] | \brief Resets auto handles even for non-auto bezier points
Useful for giving sane defaults. | [
"\\",
"brief",
"Resets",
"auto",
"handles",
"even",
"for",
"non",
"-",
"auto",
"bezier",
"points",
"Useful",
"for",
"giving",
"sane",
"defaults",
"."
] | [
"/* dummy value */",
"/* preserve length by applying it back */"
] | [
{
"param": "spline",
"type": "MaskSpline"
},
{
"param": "point",
"type": "MaskSplinePoint"
},
{
"param": "do_recalc_length",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "spline",
"type": "MaskSpline",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "point",
"type": "MaskSplinePoint",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "do_recalc_length",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |