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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
91d66e16dde7be10963e5a424d04771010ad5fee | DemonRem/blender | source/blender/blenkernel/intern/collision.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | collision_move_object | void | void collision_move_object(CollisionModifierData *collmd, float step, float prevstep)
{
float oldx[3];
unsigned int i = 0;
/* the collider doesn't move this frame */
if (collmd->is_static) {
for (i = 0; i < collmd->mvert_num; i++) {
zero_v3(collmd->current_v[i].co);
}
return;
}
for (i = 0; i < collmd->mvert_num; i++) {
interp_v3_v3v3(oldx, collmd->x[i].co, collmd->xnew[i].co, prevstep);
interp_v3_v3v3(collmd->current_x[i].co, collmd->x[i].co, collmd->xnew[i].co, step);
sub_v3_v3v3(collmd->current_v[i].co, collmd->current_x[i].co, oldx);
}
bvhtree_update_from_mvert(
collmd->bvhtree, collmd->current_x, NULL, collmd->tri, collmd->tri_num, false);
} | /* step is limited from 0 (frame start position) to 1 (frame end position) */ | step is limited from 0 (frame start position) to 1 (frame end position) | [
"step",
"is",
"limited",
"from",
"0",
"(",
"frame",
"start",
"position",
")",
"to",
"1",
"(",
"frame",
"end",
"position",
")"
] | void collision_move_object(CollisionModifierData *collmd, float step, float prevstep)
{
float oldx[3];
unsigned int i = 0;
if (collmd->is_static) {
for (i = 0; i < collmd->mvert_num; i++) {
zero_v3(collmd->current_v[i].co);
}
return;
}
for (i = 0; i < collmd->mvert_num; i++) {
interp_v3_v3v3(oldx, collmd->x[i].co, collmd->xnew[i].co, prevstep);
interp_v3_v3v3(collmd->current_x[i].co, collmd->x[i].co, collmd->xnew[i].co, step);
sub_v3_v3v3(collmd->current_v[i].co, collmd->current_x[i].co, oldx);
}
bvhtree_update_from_mvert(
collmd->bvhtree, collmd->current_x, NULL, collmd->tri, collmd->tri_num, false);
} | [
"void",
"collision_move_object",
"(",
"CollisionModifierData",
"*",
"collmd",
",",
"float",
"step",
",",
"float",
"prevstep",
")",
"{",
"float",
"oldx",
"[",
"3",
"]",
";",
"unsigned",
"int",
"i",
"=",
"0",
";",
"if",
"(",
"collmd",
"->",
"is_static",
")",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"collmd",
"->",
"mvert_num",
";",
"i",
"++",
")",
"{",
"zero_v3",
"(",
"collmd",
"->",
"current_v",
"[",
"i",
"]",
".",
"co",
")",
";",
"}",
"return",
";",
"}",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"collmd",
"->",
"mvert_num",
";",
"i",
"++",
")",
"{",
"interp_v3_v3v3",
"(",
"oldx",
",",
"collmd",
"->",
"x",
"[",
"i",
"]",
".",
"co",
",",
"collmd",
"->",
"xnew",
"[",
"i",
"]",
".",
"co",
",",
"prevstep",
")",
";",
"interp_v3_v3v3",
"(",
"collmd",
"->",
"current_x",
"[",
"i",
"]",
".",
"co",
",",
"collmd",
"->",
"x",
"[",
"i",
"]",
".",
"co",
",",
"collmd",
"->",
"xnew",
"[",
"i",
"]",
".",
"co",
",",
"step",
")",
";",
"sub_v3_v3v3",
"(",
"collmd",
"->",
"current_v",
"[",
"i",
"]",
".",
"co",
",",
"collmd",
"->",
"current_x",
"[",
"i",
"]",
".",
"co",
",",
"oldx",
")",
";",
"}",
"bvhtree_update_from_mvert",
"(",
"collmd",
"->",
"bvhtree",
",",
"collmd",
"->",
"current_x",
",",
"NULL",
",",
"collmd",
"->",
"tri",
",",
"collmd",
"->",
"tri_num",
",",
"false",
")",
";",
"}"
] | step is limited from 0 (frame start position) to 1 (frame end position) | [
"step",
"is",
"limited",
"from",
"0",
"(",
"frame",
"start",
"position",
")",
"to",
"1",
"(",
"frame",
"end",
"position",
")"
] | [
"/* the collider doesn't move this frame */"
] | [
{
"param": "collmd",
"type": "CollisionModifierData"
},
{
"param": "step",
"type": "float"
},
{
"param": "prevstep",
"type": "float"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "collmd",
"type": "CollisionModifierData",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "step",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "prevstep",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
91d66e16dde7be10963e5a424d04771010ad5fee | DemonRem/blender | source/blender/blenkernel/intern/collision.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | BKE_collision_relations_create | ListBase | ListBase *BKE_collision_relations_create(Depsgraph *depsgraph,
Collection *collection,
unsigned int modifier_type)
{
ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph);
Base *base = BKE_collection_or_layer_objects(view_layer, collection);
const bool for_render = (DEG_get_mode(depsgraph) == DAG_EVAL_RENDER);
const int base_flag = (for_render) ? BASE_ENABLED_RENDER : BASE_ENABLED_VIEWPORT;
ListBase *relations = MEM_callocN(sizeof(ListBase), "CollisionRelation list");
for (; base; base = base->next) {
if (base->flag & base_flag) {
add_collision_object(relations, base->object, 0, modifier_type);
}
}
return relations;
} | /* Create list of collision relations in the collection or entire scene.
* This is used by the depsgraph to build relations, as well as faster
* lookup of colliders during evaluation. */ | Create list of collision relations in the collection or entire scene.
This is used by the depsgraph to build relations, as well as faster
lookup of colliders during evaluation. | [
"Create",
"list",
"of",
"collision",
"relations",
"in",
"the",
"collection",
"or",
"entire",
"scene",
".",
"This",
"is",
"used",
"by",
"the",
"depsgraph",
"to",
"build",
"relations",
"as",
"well",
"as",
"faster",
"lookup",
"of",
"colliders",
"during",
"evaluation",
"."
] | ListBase *BKE_collision_relations_create(Depsgraph *depsgraph,
Collection *collection,
unsigned int modifier_type)
{
ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph);
Base *base = BKE_collection_or_layer_objects(view_layer, collection);
const bool for_render = (DEG_get_mode(depsgraph) == DAG_EVAL_RENDER);
const int base_flag = (for_render) ? BASE_ENABLED_RENDER : BASE_ENABLED_VIEWPORT;
ListBase *relations = MEM_callocN(sizeof(ListBase), "CollisionRelation list");
for (; base; base = base->next) {
if (base->flag & base_flag) {
add_collision_object(relations, base->object, 0, modifier_type);
}
}
return relations;
} | [
"ListBase",
"*",
"BKE_collision_relations_create",
"(",
"Depsgraph",
"*",
"depsgraph",
",",
"Collection",
"*",
"collection",
",",
"unsigned",
"int",
"modifier_type",
")",
"{",
"ViewLayer",
"*",
"view_layer",
"=",
"DEG_get_input_view_layer",
"(",
"depsgraph",
")",
";",
"Base",
"*",
"base",
"=",
"BKE_collection_or_layer_objects",
"(",
"view_layer",
",",
"collection",
")",
";",
"const",
"bool",
"for_render",
"=",
"(",
"DEG_get_mode",
"(",
"depsgraph",
")",
"==",
"DAG_EVAL_RENDER",
")",
";",
"const",
"int",
"base_flag",
"=",
"(",
"for_render",
")",
"?",
"BASE_ENABLED_RENDER",
":",
"BASE_ENABLED_VIEWPORT",
";",
"ListBase",
"*",
"relations",
"=",
"MEM_callocN",
"(",
"sizeof",
"(",
"ListBase",
")",
",",
"\"",
"\"",
")",
";",
"for",
"(",
";",
"base",
";",
"base",
"=",
"base",
"->",
"next",
")",
"{",
"if",
"(",
"base",
"->",
"flag",
"&",
"base_flag",
")",
"{",
"add_collision_object",
"(",
"relations",
",",
"base",
"->",
"object",
",",
"0",
",",
"modifier_type",
")",
";",
"}",
"}",
"return",
"relations",
";",
"}"
] | Create list of collision relations in the collection or entire scene. | [
"Create",
"list",
"of",
"collision",
"relations",
"in",
"the",
"collection",
"or",
"entire",
"scene",
"."
] | [] | [
{
"param": "depsgraph",
"type": "Depsgraph"
},
{
"param": "collection",
"type": "Collection"
},
{
"param": "modifier_type",
"type": "unsigned int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "depsgraph",
"type": "Depsgraph",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "collection",
"type": "Collection",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "modifier_type",
"type": "unsigned int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
91d66e16dde7be10963e5a424d04771010ad5fee | DemonRem/blender | source/blender/blenkernel/intern/collision.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | BKE_collider_cache_create | ListBase | ListBase *BKE_collider_cache_create(Depsgraph *depsgraph, Object *self, Collection *collection)
{
ListBase *relations = DEG_get_collision_relations(
depsgraph, collection, eModifierType_Collision);
ListBase *cache = NULL;
if (!relations) {
return NULL;
}
for (CollisionRelation *relation = relations->first; relation; relation = relation->next) {
/* Get evaluated object. */
Object *ob = (Object *)DEG_get_evaluated_id(depsgraph, &relation->ob->id);
if (ob == self) {
continue;
}
CollisionModifierData *cmd = (CollisionModifierData *)modifiers_findByType(
ob, eModifierType_Collision);
if (cmd && cmd->bvhtree) {
if (cache == NULL) {
cache = MEM_callocN(sizeof(ListBase), "ColliderCache array");
}
ColliderCache *col = MEM_callocN(sizeof(ColliderCache), "ColliderCache");
col->ob = ob;
col->collmd = cmd;
/* make sure collider is properly set up */
collision_move_object(cmd, 1.0, 0.0);
BLI_addtail(cache, col);
}
}
return cache;
} | /* Create effective list of colliders from relations built beforehand.
* Self will be excluded. */ | Create effective list of colliders from relations built beforehand.
Self will be excluded. | [
"Create",
"effective",
"list",
"of",
"colliders",
"from",
"relations",
"built",
"beforehand",
".",
"Self",
"will",
"be",
"excluded",
"."
] | ListBase *BKE_collider_cache_create(Depsgraph *depsgraph, Object *self, Collection *collection)
{
ListBase *relations = DEG_get_collision_relations(
depsgraph, collection, eModifierType_Collision);
ListBase *cache = NULL;
if (!relations) {
return NULL;
}
for (CollisionRelation *relation = relations->first; relation; relation = relation->next) {
Object *ob = (Object *)DEG_get_evaluated_id(depsgraph, &relation->ob->id);
if (ob == self) {
continue;
}
CollisionModifierData *cmd = (CollisionModifierData *)modifiers_findByType(
ob, eModifierType_Collision);
if (cmd && cmd->bvhtree) {
if (cache == NULL) {
cache = MEM_callocN(sizeof(ListBase), "ColliderCache array");
}
ColliderCache *col = MEM_callocN(sizeof(ColliderCache), "ColliderCache");
col->ob = ob;
col->collmd = cmd;
collision_move_object(cmd, 1.0, 0.0);
BLI_addtail(cache, col);
}
}
return cache;
} | [
"ListBase",
"*",
"BKE_collider_cache_create",
"(",
"Depsgraph",
"*",
"depsgraph",
",",
"Object",
"*",
"self",
",",
"Collection",
"*",
"collection",
")",
"{",
"ListBase",
"*",
"relations",
"=",
"DEG_get_collision_relations",
"(",
"depsgraph",
",",
"collection",
",",
"eModifierType_Collision",
")",
";",
"ListBase",
"*",
"cache",
"=",
"NULL",
";",
"if",
"(",
"!",
"relations",
")",
"{",
"return",
"NULL",
";",
"}",
"for",
"(",
"CollisionRelation",
"*",
"relation",
"=",
"relations",
"->",
"first",
";",
"relation",
";",
"relation",
"=",
"relation",
"->",
"next",
")",
"{",
"Object",
"*",
"ob",
"=",
"(",
"Object",
"*",
")",
"DEG_get_evaluated_id",
"(",
"depsgraph",
",",
"&",
"relation",
"->",
"ob",
"->",
"id",
")",
";",
"if",
"(",
"ob",
"==",
"self",
")",
"{",
"continue",
";",
"}",
"CollisionModifierData",
"*",
"cmd",
"=",
"(",
"CollisionModifierData",
"*",
")",
"modifiers_findByType",
"(",
"ob",
",",
"eModifierType_Collision",
")",
";",
"if",
"(",
"cmd",
"&&",
"cmd",
"->",
"bvhtree",
")",
"{",
"if",
"(",
"cache",
"==",
"NULL",
")",
"{",
"cache",
"=",
"MEM_callocN",
"(",
"sizeof",
"(",
"ListBase",
")",
",",
"\"",
"\"",
")",
";",
"}",
"ColliderCache",
"*",
"col",
"=",
"MEM_callocN",
"(",
"sizeof",
"(",
"ColliderCache",
")",
",",
"\"",
"\"",
")",
";",
"col",
"->",
"ob",
"=",
"ob",
";",
"col",
"->",
"collmd",
"=",
"cmd",
";",
"collision_move_object",
"(",
"cmd",
",",
"1.0",
",",
"0.0",
")",
";",
"BLI_addtail",
"(",
"cache",
",",
"col",
")",
";",
"}",
"}",
"return",
"cache",
";",
"}"
] | Create effective list of colliders from relations built beforehand. | [
"Create",
"effective",
"list",
"of",
"colliders",
"from",
"relations",
"built",
"beforehand",
"."
] | [
"/* Get evaluated object. */",
"/* make sure collider is properly set up */"
] | [
{
"param": "depsgraph",
"type": "Depsgraph"
},
{
"param": "self",
"type": "Object"
},
{
"param": "collection",
"type": "Collection"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "depsgraph",
"type": "Depsgraph",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "self",
"type": "Object",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "collection",
"type": "Collection",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
91d66e16dde7be10963e5a424d04771010ad5fee | DemonRem/blender | source/blender/blenkernel/intern/collision.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | cloth_point_collision | CollPair | static CollPair *cloth_point_collision(ModifierData *md1,
ModifierData *md2,
BVHTreeOverlap *overlap,
float epsilon,
CollPair *collpair,
float UNUSED(dt))
{
ClothModifierData *clmd = (ClothModifierData *)md1;
CollisionModifierData *collmd = (CollisionModifierData *)md2;
/* Cloth *cloth = clmd->clothObject; */ /* UNUSED */
ClothVertex *vert = NULL;
const MVertTri *vt;
const MVert *mverts = collmd->current_x;
vert = &clmd->clothObject->verts[overlap->indexA];
vt = &collmd->tri[overlap->indexB];
collpair = cloth_point_collpair(vert->tx,
vert->x,
mverts,
vt->tri[0],
vt->tri[1],
vt->tri[2],
overlap->indexA,
overlap->indexB,
epsilon,
collpair);
return collpair;
} | /* Determines collisions on overlap,
* collisions are written to collpair[i] and collision+number_collision_found is returned. */ | Determines collisions on overlap,
collisions are written to collpair[i] and collision+number_collision_found is returned. | [
"Determines",
"collisions",
"on",
"overlap",
"collisions",
"are",
"written",
"to",
"collpair",
"[",
"i",
"]",
"and",
"collision",
"+",
"number_collision_found",
"is",
"returned",
"."
] | static CollPair *cloth_point_collision(ModifierData *md1,
ModifierData *md2,
BVHTreeOverlap *overlap,
float epsilon,
CollPair *collpair,
float UNUSED(dt))
{
ClothModifierData *clmd = (ClothModifierData *)md1;
CollisionModifierData *collmd = (CollisionModifierData *)md2;
ClothVertex *vert = NULL;
const MVertTri *vt;
const MVert *mverts = collmd->current_x;
vert = &clmd->clothObject->verts[overlap->indexA];
vt = &collmd->tri[overlap->indexB];
collpair = cloth_point_collpair(vert->tx,
vert->x,
mverts,
vt->tri[0],
vt->tri[1],
vt->tri[2],
overlap->indexA,
overlap->indexB,
epsilon,
collpair);
return collpair;
} | [
"static",
"CollPair",
"*",
"cloth_point_collision",
"(",
"ModifierData",
"*",
"md1",
",",
"ModifierData",
"*",
"md2",
",",
"BVHTreeOverlap",
"*",
"overlap",
",",
"float",
"epsilon",
",",
"CollPair",
"*",
"collpair",
",",
"float",
"UNUSED",
"(",
"dt",
")",
")",
"{",
"ClothModifierData",
"*",
"clmd",
"=",
"(",
"ClothModifierData",
"*",
")",
"md1",
";",
"CollisionModifierData",
"*",
"collmd",
"=",
"(",
"CollisionModifierData",
"*",
")",
"md2",
";",
"ClothVertex",
"*",
"vert",
"=",
"NULL",
";",
"const",
"MVertTri",
"*",
"vt",
";",
"const",
"MVert",
"*",
"mverts",
"=",
"collmd",
"->",
"current_x",
";",
"vert",
"=",
"&",
"clmd",
"->",
"clothObject",
"->",
"verts",
"[",
"overlap",
"->",
"indexA",
"]",
";",
"vt",
"=",
"&",
"collmd",
"->",
"tri",
"[",
"overlap",
"->",
"indexB",
"]",
";",
"collpair",
"=",
"cloth_point_collpair",
"(",
"vert",
"->",
"tx",
",",
"vert",
"->",
"x",
",",
"mverts",
",",
"vt",
"->",
"tri",
"[",
"0",
"]",
",",
"vt",
"->",
"tri",
"[",
"1",
"]",
",",
"vt",
"->",
"tri",
"[",
"2",
"]",
",",
"overlap",
"->",
"indexA",
",",
"overlap",
"->",
"indexB",
",",
"epsilon",
",",
"collpair",
")",
";",
"return",
"collpair",
";",
"}"
] | Determines collisions on overlap,
collisions are written to collpair[i] and collision+number_collision_found is returned. | [
"Determines",
"collisions",
"on",
"overlap",
"collisions",
"are",
"written",
"to",
"collpair",
"[",
"i",
"]",
"and",
"collision",
"+",
"number_collision_found",
"is",
"returned",
"."
] | [
"/* Cloth *cloth = clmd->clothObject; */",
"/* UNUSED */"
] | [
{
"param": "md1",
"type": "ModifierData"
},
{
"param": "md2",
"type": "ModifierData"
},
{
"param": "overlap",
"type": "BVHTreeOverlap"
},
{
"param": "epsilon",
"type": "float"
},
{
"param": "collpair",
"type": "CollPair"
},
{
"param": "UNUSED",
"type": "float"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "md1",
"type": "ModifierData",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "md2",
"type": "ModifierData",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "overlap",
"type": "BVHTreeOverlap",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "epsilon",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "collpair",
"type": "CollPair",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "UNUSED",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cc023688c8eb491d23daeca14ef51e1b57978975 | DemonRem/blender | source/blender/editors/transform/transform_convert_armature.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | pose_grab_with_ik_add | nan | static short pose_grab_with_ik_add(bPoseChannel *pchan)
{
bKinematicConstraint *targetless = NULL;
bKinematicConstraint *data;
bConstraint *con;
/* Sanity check */
if (pchan == NULL) {
return 0;
}
/* Rule: not if there's already an IK on this channel */
for (con = pchan->constraints.first; con; con = con->next) {
if (con->type == CONSTRAINT_TYPE_KINEMATIC) {
data = con->data;
if (data->tar == NULL || (data->tar->type == OB_ARMATURE && data->subtarget[0] == '\0')) {
/* make reference to constraint to base things off later
* (if it's the last targetless constraint encountered) */
targetless = (bKinematicConstraint *)con->data;
/* but, if this is a targetless IK, we make it auto anyway (for the children loop) */
if (con->enforce != 0.0f) {
data->flag |= CONSTRAINT_IK_AUTO;
/* if no chain length has been specified,
* just make things obey standard rotation locks too */
if (data->rootbone == 0) {
for (; pchan; pchan = pchan->parent) {
/* here, we set ik-settings for bone from pchan->protectflag */
// XXX: careful with quats/axis-angle rotations where we're locking 4d components
if (pchan->protectflag & OB_LOCK_ROTX) {
pchan->ikflag |= BONE_IK_NO_XDOF_TEMP;
}
if (pchan->protectflag & OB_LOCK_ROTY) {
pchan->ikflag |= BONE_IK_NO_YDOF_TEMP;
}
if (pchan->protectflag & OB_LOCK_ROTZ) {
pchan->ikflag |= BONE_IK_NO_ZDOF_TEMP;
}
}
}
return 0;
}
}
if ((con->flag & CONSTRAINT_DISABLE) == 0 && (con->enforce != 0.0f)) {
return 0;
}
}
}
con = BKE_constraint_add_for_pose(NULL, pchan, "TempConstraint", CONSTRAINT_TYPE_KINEMATIC);
/* for draw, but also for detecting while pose solving */
pchan->constflag |= (PCHAN_HAS_IK | PCHAN_HAS_TARGET);
data = con->data;
if (targetless) {
/* if exists, use values from last targetless (but disabled) IK-constraint as base */
*data = *targetless;
}
else {
data->flag = CONSTRAINT_IK_TIP;
}
data->flag |= CONSTRAINT_IK_TEMP | CONSTRAINT_IK_AUTO | CONSTRAINT_IK_POS;
copy_v3_v3(data->grabtarget, pchan->pose_tail);
/* watch-it! has to be 0 here, since we're still on the
* same bone for the first time through the loop T25885. */
data->rootbone = 0;
/* we only include bones that are part of a continual connected chain */
do {
/* here, we set ik-settings for bone from pchan->protectflag */
// XXX: careful with quats/axis-angle rotations where we're locking 4d components
if (pchan->protectflag & OB_LOCK_ROTX) {
pchan->ikflag |= BONE_IK_NO_XDOF_TEMP;
}
if (pchan->protectflag & OB_LOCK_ROTY) {
pchan->ikflag |= BONE_IK_NO_YDOF_TEMP;
}
if (pchan->protectflag & OB_LOCK_ROTZ) {
pchan->ikflag |= BONE_IK_NO_ZDOF_TEMP;
}
/* now we count this pchan as being included */
data->rootbone++;
/* continue to parent, but only if we're connected to it */
if (pchan->bone->flag & BONE_CONNECTED) {
pchan = pchan->parent;
}
else {
pchan = NULL;
}
} while (pchan);
/* make a copy of maximum chain-length */
data->max_rootbone = data->rootbone;
return 1;
} | /* adds the IK to pchan - returns if added */ | adds the IK to pchan - returns if added | [
"adds",
"the",
"IK",
"to",
"pchan",
"-",
"returns",
"if",
"added"
] | static short pose_grab_with_ik_add(bPoseChannel *pchan)
{
bKinematicConstraint *targetless = NULL;
bKinematicConstraint *data;
bConstraint *con;
if (pchan == NULL) {
return 0;
}
for (con = pchan->constraints.first; con; con = con->next) {
if (con->type == CONSTRAINT_TYPE_KINEMATIC) {
data = con->data;
if (data->tar == NULL || (data->tar->type == OB_ARMATURE && data->subtarget[0] == '\0')) {
targetless = (bKinematicConstraint *)con->data;
if (con->enforce != 0.0f) {
data->flag |= CONSTRAINT_IK_AUTO;
if (data->rootbone == 0) {
for (; pchan; pchan = pchan->parent) {
if (pchan->protectflag & OB_LOCK_ROTX) {
pchan->ikflag |= BONE_IK_NO_XDOF_TEMP;
}
if (pchan->protectflag & OB_LOCK_ROTY) {
pchan->ikflag |= BONE_IK_NO_YDOF_TEMP;
}
if (pchan->protectflag & OB_LOCK_ROTZ) {
pchan->ikflag |= BONE_IK_NO_ZDOF_TEMP;
}
}
}
return 0;
}
}
if ((con->flag & CONSTRAINT_DISABLE) == 0 && (con->enforce != 0.0f)) {
return 0;
}
}
}
con = BKE_constraint_add_for_pose(NULL, pchan, "TempConstraint", CONSTRAINT_TYPE_KINEMATIC);
pchan->constflag |= (PCHAN_HAS_IK | PCHAN_HAS_TARGET);
data = con->data;
if (targetless) {
*data = *targetless;
}
else {
data->flag = CONSTRAINT_IK_TIP;
}
data->flag |= CONSTRAINT_IK_TEMP | CONSTRAINT_IK_AUTO | CONSTRAINT_IK_POS;
copy_v3_v3(data->grabtarget, pchan->pose_tail);
data->rootbone = 0;
do {
if (pchan->protectflag & OB_LOCK_ROTX) {
pchan->ikflag |= BONE_IK_NO_XDOF_TEMP;
}
if (pchan->protectflag & OB_LOCK_ROTY) {
pchan->ikflag |= BONE_IK_NO_YDOF_TEMP;
}
if (pchan->protectflag & OB_LOCK_ROTZ) {
pchan->ikflag |= BONE_IK_NO_ZDOF_TEMP;
}
data->rootbone++;
if (pchan->bone->flag & BONE_CONNECTED) {
pchan = pchan->parent;
}
else {
pchan = NULL;
}
} while (pchan);
data->max_rootbone = data->rootbone;
return 1;
} | [
"static",
"short",
"pose_grab_with_ik_add",
"(",
"bPoseChannel",
"*",
"pchan",
")",
"{",
"bKinematicConstraint",
"*",
"targetless",
"=",
"NULL",
";",
"bKinematicConstraint",
"*",
"data",
";",
"bConstraint",
"*",
"con",
";",
"if",
"(",
"pchan",
"==",
"NULL",
")",
"{",
"return",
"0",
";",
"}",
"for",
"(",
"con",
"=",
"pchan",
"->",
"constraints",
".",
"first",
";",
"con",
";",
"con",
"=",
"con",
"->",
"next",
")",
"{",
"if",
"(",
"con",
"->",
"type",
"==",
"CONSTRAINT_TYPE_KINEMATIC",
")",
"{",
"data",
"=",
"con",
"->",
"data",
";",
"if",
"(",
"data",
"->",
"tar",
"==",
"NULL",
"||",
"(",
"data",
"->",
"tar",
"->",
"type",
"==",
"OB_ARMATURE",
"&&",
"data",
"->",
"subtarget",
"[",
"0",
"]",
"==",
"'",
"\\0",
"'",
")",
")",
"{",
"targetless",
"=",
"(",
"bKinematicConstraint",
"*",
")",
"con",
"->",
"data",
";",
"if",
"(",
"con",
"->",
"enforce",
"!=",
"0.0f",
")",
"{",
"data",
"->",
"flag",
"|=",
"CONSTRAINT_IK_AUTO",
";",
"if",
"(",
"data",
"->",
"rootbone",
"==",
"0",
")",
"{",
"for",
"(",
";",
"pchan",
";",
"pchan",
"=",
"pchan",
"->",
"parent",
")",
"{",
"if",
"(",
"pchan",
"->",
"protectflag",
"&",
"OB_LOCK_ROTX",
")",
"{",
"pchan",
"->",
"ikflag",
"|=",
"BONE_IK_NO_XDOF_TEMP",
";",
"}",
"if",
"(",
"pchan",
"->",
"protectflag",
"&",
"OB_LOCK_ROTY",
")",
"{",
"pchan",
"->",
"ikflag",
"|=",
"BONE_IK_NO_YDOF_TEMP",
";",
"}",
"if",
"(",
"pchan",
"->",
"protectflag",
"&",
"OB_LOCK_ROTZ",
")",
"{",
"pchan",
"->",
"ikflag",
"|=",
"BONE_IK_NO_ZDOF_TEMP",
";",
"}",
"}",
"}",
"return",
"0",
";",
"}",
"}",
"if",
"(",
"(",
"con",
"->",
"flag",
"&",
"CONSTRAINT_DISABLE",
")",
"==",
"0",
"&&",
"(",
"con",
"->",
"enforce",
"!=",
"0.0f",
")",
")",
"{",
"return",
"0",
";",
"}",
"}",
"}",
"con",
"=",
"BKE_constraint_add_for_pose",
"(",
"NULL",
",",
"pchan",
",",
"\"",
"\"",
",",
"CONSTRAINT_TYPE_KINEMATIC",
")",
";",
"pchan",
"->",
"constflag",
"|=",
"(",
"PCHAN_HAS_IK",
"|",
"PCHAN_HAS_TARGET",
")",
";",
"data",
"=",
"con",
"->",
"data",
";",
"if",
"(",
"targetless",
")",
"{",
"*",
"data",
"=",
"*",
"targetless",
";",
"}",
"else",
"{",
"data",
"->",
"flag",
"=",
"CONSTRAINT_IK_TIP",
";",
"}",
"data",
"->",
"flag",
"|=",
"CONSTRAINT_IK_TEMP",
"|",
"CONSTRAINT_IK_AUTO",
"|",
"CONSTRAINT_IK_POS",
";",
"copy_v3_v3",
"(",
"data",
"->",
"grabtarget",
",",
"pchan",
"->",
"pose_tail",
")",
";",
"data",
"->",
"rootbone",
"=",
"0",
";",
"do",
"{",
"if",
"(",
"pchan",
"->",
"protectflag",
"&",
"OB_LOCK_ROTX",
")",
"{",
"pchan",
"->",
"ikflag",
"|=",
"BONE_IK_NO_XDOF_TEMP",
";",
"}",
"if",
"(",
"pchan",
"->",
"protectflag",
"&",
"OB_LOCK_ROTY",
")",
"{",
"pchan",
"->",
"ikflag",
"|=",
"BONE_IK_NO_YDOF_TEMP",
";",
"}",
"if",
"(",
"pchan",
"->",
"protectflag",
"&",
"OB_LOCK_ROTZ",
")",
"{",
"pchan",
"->",
"ikflag",
"|=",
"BONE_IK_NO_ZDOF_TEMP",
";",
"}",
"data",
"->",
"rootbone",
"++",
";",
"if",
"(",
"pchan",
"->",
"bone",
"->",
"flag",
"&",
"BONE_CONNECTED",
")",
"{",
"pchan",
"=",
"pchan",
"->",
"parent",
";",
"}",
"else",
"{",
"pchan",
"=",
"NULL",
";",
"}",
"}",
"while",
"(",
"pchan",
")",
";",
"data",
"->",
"max_rootbone",
"=",
"data",
"->",
"rootbone",
";",
"return",
"1",
";",
"}"
] | adds the IK to pchan - returns if added | [
"adds",
"the",
"IK",
"to",
"pchan",
"-",
"returns",
"if",
"added"
] | [
"/* Sanity check */",
"/* Rule: not if there's already an IK on this channel */",
"/* make reference to constraint to base things off later\n * (if it's the last targetless constraint encountered) */",
"/* but, if this is a targetless IK, we make it auto anyway (for the children loop) */",
"/* if no chain length has been specified,\n * just make things obey standard rotation locks too */",
"/* here, we set ik-settings for bone from pchan->protectflag */",
"// XXX: careful with quats/axis-angle rotations where we're locking 4d components",
"/* for draw, but also for detecting while pose solving */",
"/* if exists, use values from last targetless (but disabled) IK-constraint as base */",
"/* watch-it! has to be 0 here, since we're still on the\n * same bone for the first time through the loop T25885. */",
"/* we only include bones that are part of a continual connected chain */",
"/* here, we set ik-settings for bone from pchan->protectflag */",
"// XXX: careful with quats/axis-angle rotations where we're locking 4d components",
"/* now we count this pchan as being included */",
"/* continue to parent, but only if we're connected to it */",
"/* make a copy of maximum chain-length */"
] | [
{
"param": "pchan",
"type": "bPoseChannel"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pchan",
"type": "bPoseChannel",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cc023688c8eb491d23daeca14ef51e1b57978975 | DemonRem/blender | source/blender/editors/transform/transform_convert_armature.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | pose_grab_with_ik | nan | static short pose_grab_with_ik(Main *bmain, Object *ob)
{
bArmature *arm;
bPoseChannel *pchan, *parent;
Bone *bonec;
short tot_ik = 0;
if ((ob == NULL) || (ob->pose == NULL) || (ob->mode & OB_MODE_POSE) == 0) {
return 0;
}
arm = ob->data;
/* Rule: allow multiple Bones
* (but they must be selected, and only one ik-solver per chain should get added) */
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
if (pchan->bone->layer & arm->layer) {
if (pchan->bone->flag & BONE_SELECTED) {
/* Rule: no IK for solitatry (unconnected) bones */
for (bonec = pchan->bone->childbase.first; bonec; bonec = bonec->next) {
if (bonec->flag & BONE_CONNECTED) {
break;
}
}
if ((pchan->bone->flag & BONE_CONNECTED) == 0 && (bonec == NULL)) {
continue;
}
/* rule: if selected Bone is not a root bone, it gets a temporal IK */
if (pchan->parent) {
/* only adds if there's no IK yet (and no parent bone was selected) */
for (parent = pchan->parent; parent; parent = parent->parent) {
if (parent->bone->flag & BONE_SELECTED) {
break;
}
}
if (parent == NULL) {
tot_ik += pose_grab_with_ik_add(pchan);
}
}
else {
/* rule: go over the children and add IK to the tips */
tot_ik += pose_grab_with_ik_children(ob->pose, pchan->bone);
}
}
}
}
/* iTaSC needs clear for new IK constraints */
if (tot_ik) {
BIK_clear_data(ob->pose);
/* TODO(sergey): Consider doing partial update only. */
DEG_relations_tag_update(bmain);
}
return (tot_ik) ? 1 : 0;
} | /* main call which adds temporal IK chains */ | main call which adds temporal IK chains | [
"main",
"call",
"which",
"adds",
"temporal",
"IK",
"chains"
] | static short pose_grab_with_ik(Main *bmain, Object *ob)
{
bArmature *arm;
bPoseChannel *pchan, *parent;
Bone *bonec;
short tot_ik = 0;
if ((ob == NULL) || (ob->pose == NULL) || (ob->mode & OB_MODE_POSE) == 0) {
return 0;
}
arm = ob->data;
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
if (pchan->bone->layer & arm->layer) {
if (pchan->bone->flag & BONE_SELECTED) {
for (bonec = pchan->bone->childbase.first; bonec; bonec = bonec->next) {
if (bonec->flag & BONE_CONNECTED) {
break;
}
}
if ((pchan->bone->flag & BONE_CONNECTED) == 0 && (bonec == NULL)) {
continue;
}
if (pchan->parent) {
for (parent = pchan->parent; parent; parent = parent->parent) {
if (parent->bone->flag & BONE_SELECTED) {
break;
}
}
if (parent == NULL) {
tot_ik += pose_grab_with_ik_add(pchan);
}
}
else {
tot_ik += pose_grab_with_ik_children(ob->pose, pchan->bone);
}
}
}
}
if (tot_ik) {
BIK_clear_data(ob->pose);
DEG_relations_tag_update(bmain);
}
return (tot_ik) ? 1 : 0;
} | [
"static",
"short",
"pose_grab_with_ik",
"(",
"Main",
"*",
"bmain",
",",
"Object",
"*",
"ob",
")",
"{",
"bArmature",
"*",
"arm",
";",
"bPoseChannel",
"*",
"pchan",
",",
"*",
"parent",
";",
"Bone",
"*",
"bonec",
";",
"short",
"tot_ik",
"=",
"0",
";",
"if",
"(",
"(",
"ob",
"==",
"NULL",
")",
"||",
"(",
"ob",
"->",
"pose",
"==",
"NULL",
")",
"||",
"(",
"ob",
"->",
"mode",
"&",
"OB_MODE_POSE",
")",
"==",
"0",
")",
"{",
"return",
"0",
";",
"}",
"arm",
"=",
"ob",
"->",
"data",
";",
"for",
"(",
"pchan",
"=",
"ob",
"->",
"pose",
"->",
"chanbase",
".",
"first",
";",
"pchan",
";",
"pchan",
"=",
"pchan",
"->",
"next",
")",
"{",
"if",
"(",
"pchan",
"->",
"bone",
"->",
"layer",
"&",
"arm",
"->",
"layer",
")",
"{",
"if",
"(",
"pchan",
"->",
"bone",
"->",
"flag",
"&",
"BONE_SELECTED",
")",
"{",
"for",
"(",
"bonec",
"=",
"pchan",
"->",
"bone",
"->",
"childbase",
".",
"first",
";",
"bonec",
";",
"bonec",
"=",
"bonec",
"->",
"next",
")",
"{",
"if",
"(",
"bonec",
"->",
"flag",
"&",
"BONE_CONNECTED",
")",
"{",
"break",
";",
"}",
"}",
"if",
"(",
"(",
"pchan",
"->",
"bone",
"->",
"flag",
"&",
"BONE_CONNECTED",
")",
"==",
"0",
"&&",
"(",
"bonec",
"==",
"NULL",
")",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"pchan",
"->",
"parent",
")",
"{",
"for",
"(",
"parent",
"=",
"pchan",
"->",
"parent",
";",
"parent",
";",
"parent",
"=",
"parent",
"->",
"parent",
")",
"{",
"if",
"(",
"parent",
"->",
"bone",
"->",
"flag",
"&",
"BONE_SELECTED",
")",
"{",
"break",
";",
"}",
"}",
"if",
"(",
"parent",
"==",
"NULL",
")",
"{",
"tot_ik",
"+=",
"pose_grab_with_ik_add",
"(",
"pchan",
")",
";",
"}",
"}",
"else",
"{",
"tot_ik",
"+=",
"pose_grab_with_ik_children",
"(",
"ob",
"->",
"pose",
",",
"pchan",
"->",
"bone",
")",
";",
"}",
"}",
"}",
"}",
"if",
"(",
"tot_ik",
")",
"{",
"BIK_clear_data",
"(",
"ob",
"->",
"pose",
")",
";",
"DEG_relations_tag_update",
"(",
"bmain",
")",
";",
"}",
"return",
"(",
"tot_ik",
")",
"?",
"1",
":",
"0",
";",
"}"
] | main call which adds temporal IK chains | [
"main",
"call",
"which",
"adds",
"temporal",
"IK",
"chains"
] | [
"/* Rule: allow multiple Bones\n * (but they must be selected, and only one ik-solver per chain should get added) */",
"/* Rule: no IK for solitatry (unconnected) bones */",
"/* rule: if selected Bone is not a root bone, it gets a temporal IK */",
"/* only adds if there's no IK yet (and no parent bone was selected) */",
"/* rule: go over the children and add IK to the tips */",
"/* iTaSC needs clear for new IK constraints */",
"/* TODO(sergey): Consider doing partial update only. */"
] | [
{
"param": "bmain",
"type": "Main"
},
{
"param": "ob",
"type": "Object"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bmain",
"type": "Main",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ob",
"type": "Object",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5a8301fae679fb0c3422c376b48e6b05d0717437 | DemonRem/blender | source/blender/editors/uvedit/uvedit_smart_stitch.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | stitch_update_header | void | static void stitch_update_header(StitchStateContainer *ssc, bContext *C)
{
const char *str = TIP_(
"Mode(TAB) %s, "
"(S)nap %s, "
"(M)idpoints %s, "
"(L)imit %.2f (Alt Wheel adjust) %s, "
"Switch (I)sland, "
"shift select vertices");
char msg[UI_MAX_DRAW_STR];
ScrArea *sa = CTX_wm_area(C);
if (sa) {
BLI_snprintf(msg,
sizeof(msg),
str,
ssc->mode == STITCH_VERT ? TIP_("Vertex") : TIP_("Edge"),
WM_bool_as_string(ssc->snap_islands),
WM_bool_as_string(ssc->midpoints),
ssc->limit_dist,
WM_bool_as_string(ssc->use_limit));
ED_workspace_status_text(C, msg);
}
} | /* This function updates the header of the UV editor when the stitch tool updates its settings */ | This function updates the header of the UV editor when the stitch tool updates its settings | [
"This",
"function",
"updates",
"the",
"header",
"of",
"the",
"UV",
"editor",
"when",
"the",
"stitch",
"tool",
"updates",
"its",
"settings"
] | static void stitch_update_header(StitchStateContainer *ssc, bContext *C)
{
const char *str = TIP_(
"Mode(TAB) %s, "
"(S)nap %s, "
"(M)idpoints %s, "
"(L)imit %.2f (Alt Wheel adjust) %s, "
"Switch (I)sland, "
"shift select vertices");
char msg[UI_MAX_DRAW_STR];
ScrArea *sa = CTX_wm_area(C);
if (sa) {
BLI_snprintf(msg,
sizeof(msg),
str,
ssc->mode == STITCH_VERT ? TIP_("Vertex") : TIP_("Edge"),
WM_bool_as_string(ssc->snap_islands),
WM_bool_as_string(ssc->midpoints),
ssc->limit_dist,
WM_bool_as_string(ssc->use_limit));
ED_workspace_status_text(C, msg);
}
} | [
"static",
"void",
"stitch_update_header",
"(",
"StitchStateContainer",
"*",
"ssc",
",",
"bContext",
"*",
"C",
")",
"{",
"const",
"char",
"*",
"str",
"=",
"TIP_",
"(",
"\"",
"\"",
"\"",
"\"",
"\"",
"\"",
"\"",
"\"",
"\"",
"\"",
"\"",
"\"",
")",
";",
"char",
"msg",
"[",
"UI_MAX_DRAW_STR",
"]",
";",
"ScrArea",
"*",
"sa",
"=",
"CTX_wm_area",
"(",
"C",
")",
";",
"if",
"(",
"sa",
")",
"{",
"BLI_snprintf",
"(",
"msg",
",",
"sizeof",
"(",
"msg",
")",
",",
"str",
",",
"ssc",
"->",
"mode",
"==",
"STITCH_VERT",
"?",
"TIP_",
"(",
"\"",
"\"",
")",
":",
"TIP_",
"(",
"\"",
"\"",
")",
",",
"WM_bool_as_string",
"(",
"ssc",
"->",
"snap_islands",
")",
",",
"WM_bool_as_string",
"(",
"ssc",
"->",
"midpoints",
")",
",",
"ssc",
"->",
"limit_dist",
",",
"WM_bool_as_string",
"(",
"ssc",
"->",
"use_limit",
")",
")",
";",
"ED_workspace_status_text",
"(",
"C",
",",
"msg",
")",
";",
"}",
"}"
] | This function updates the header of the UV editor when the stitch tool updates its settings | [
"This",
"function",
"updates",
"the",
"header",
"of",
"the",
"UV",
"editor",
"when",
"the",
"stitch",
"tool",
"updates",
"its",
"settings"
] | [] | [
{
"param": "ssc",
"type": "StitchStateContainer"
},
{
"param": "C",
"type": "bContext"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ssc",
"type": "StitchStateContainer",
"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": []
} |
5a8301fae679fb0c3422c376b48e6b05d0717437 | DemonRem/blender | source/blender/editors/uvedit/uvedit_smart_stitch.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | stitch_check_uvs_stitchable | bool | static bool stitch_check_uvs_stitchable(UvElement *element,
UvElement *element_iter,
StitchStateContainer *ssc,
StitchState *state)
{
BMesh *bm = state->em->bm;
float limit;
if (element_iter == element) {
return 0;
}
limit = ssc->limit_dist;
if (ssc->use_limit) {
MLoopUV *luv, *luv_iter;
BMLoop *l;
l = element->l;
luv = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MLOOPUV);
l = element_iter->l;
luv_iter = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MLOOPUV);
if (fabsf(luv->uv[0] - luv_iter->uv[0]) < limit &&
fabsf(luv->uv[1] - luv_iter->uv[1]) < limit) {
return 1;
}
else {
return 0;
}
}
else {
return 1;
}
} | /* check if two uvelements are stitchable.
* This should only operate on -different- separate UvElements */ | check if two uvelements are stitchable.
This should only operate on -different- separate UvElements | [
"check",
"if",
"two",
"uvelements",
"are",
"stitchable",
".",
"This",
"should",
"only",
"operate",
"on",
"-",
"different",
"-",
"separate",
"UvElements"
] | static bool stitch_check_uvs_stitchable(UvElement *element,
UvElement *element_iter,
StitchStateContainer *ssc,
StitchState *state)
{
BMesh *bm = state->em->bm;
float limit;
if (element_iter == element) {
return 0;
}
limit = ssc->limit_dist;
if (ssc->use_limit) {
MLoopUV *luv, *luv_iter;
BMLoop *l;
l = element->l;
luv = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MLOOPUV);
l = element_iter->l;
luv_iter = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MLOOPUV);
if (fabsf(luv->uv[0] - luv_iter->uv[0]) < limit &&
fabsf(luv->uv[1] - luv_iter->uv[1]) < limit) {
return 1;
}
else {
return 0;
}
}
else {
return 1;
}
} | [
"static",
"bool",
"stitch_check_uvs_stitchable",
"(",
"UvElement",
"*",
"element",
",",
"UvElement",
"*",
"element_iter",
",",
"StitchStateContainer",
"*",
"ssc",
",",
"StitchState",
"*",
"state",
")",
"{",
"BMesh",
"*",
"bm",
"=",
"state",
"->",
"em",
"->",
"bm",
";",
"float",
"limit",
";",
"if",
"(",
"element_iter",
"==",
"element",
")",
"{",
"return",
"0",
";",
"}",
"limit",
"=",
"ssc",
"->",
"limit_dist",
";",
"if",
"(",
"ssc",
"->",
"use_limit",
")",
"{",
"MLoopUV",
"*",
"luv",
",",
"*",
"luv_iter",
";",
"BMLoop",
"*",
"l",
";",
"l",
"=",
"element",
"->",
"l",
";",
"luv",
"=",
"CustomData_bmesh_get",
"(",
"&",
"bm",
"->",
"ldata",
",",
"l",
"->",
"head",
".",
"data",
",",
"CD_MLOOPUV",
")",
";",
"l",
"=",
"element_iter",
"->",
"l",
";",
"luv_iter",
"=",
"CustomData_bmesh_get",
"(",
"&",
"bm",
"->",
"ldata",
",",
"l",
"->",
"head",
".",
"data",
",",
"CD_MLOOPUV",
")",
";",
"if",
"(",
"fabsf",
"(",
"luv",
"->",
"uv",
"[",
"0",
"]",
"-",
"luv_iter",
"->",
"uv",
"[",
"0",
"]",
")",
"<",
"limit",
"&&",
"fabsf",
"(",
"luv",
"->",
"uv",
"[",
"1",
"]",
"-",
"luv_iter",
"->",
"uv",
"[",
"1",
"]",
")",
"<",
"limit",
")",
"{",
"return",
"1",
";",
"}",
"else",
"{",
"return",
"0",
";",
"}",
"}",
"else",
"{",
"return",
"1",
";",
"}",
"}"
] | check if two uvelements are stitchable. | [
"check",
"if",
"two",
"uvelements",
"are",
"stitchable",
"."
] | [] | [
{
"param": "element",
"type": "UvElement"
},
{
"param": "element_iter",
"type": "UvElement"
},
{
"param": "ssc",
"type": "StitchStateContainer"
},
{
"param": "state",
"type": "StitchState"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "element",
"type": "UvElement",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "element_iter",
"type": "UvElement",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ssc",
"type": "StitchStateContainer",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "state",
"type": "StitchState",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ef4d8174718b436c6515d5a6a1b5f5a4c77a71e9 | DemonRem/blender | source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | WM_gizmomap_minmax | bool | bool WM_gizmomap_minmax(const wmGizmoMap *gzmap,
bool UNUSED(use_hidden),
bool use_select,
float r_min[3],
float r_max[3])
{
if (use_select) {
int i;
for (i = 0; i < gzmap->gzmap_context.select.len; i++) {
minmax_v3v3_v3(r_min, r_max, gzmap->gzmap_context.select.items[i]->matrix_basis[3]);
}
return i != 0;
}
else {
bool ok = false;
BLI_assert(!"TODO");
return ok;
}
} | /**
* \note We could use a callback to define bounds, for now just use matrix location.
*/ | \note We could use a callback to define bounds, for now just use matrix location. | [
"\\",
"note",
"We",
"could",
"use",
"a",
"callback",
"to",
"define",
"bounds",
"for",
"now",
"just",
"use",
"matrix",
"location",
"."
] | bool WM_gizmomap_minmax(const wmGizmoMap *gzmap,
bool UNUSED(use_hidden),
bool use_select,
float r_min[3],
float r_max[3])
{
if (use_select) {
int i;
for (i = 0; i < gzmap->gzmap_context.select.len; i++) {
minmax_v3v3_v3(r_min, r_max, gzmap->gzmap_context.select.items[i]->matrix_basis[3]);
}
return i != 0;
}
else {
bool ok = false;
BLI_assert(!"TODO");
return ok;
}
} | [
"bool",
"WM_gizmomap_minmax",
"(",
"const",
"wmGizmoMap",
"*",
"gzmap",
",",
"bool",
"UNUSED",
"(",
"use_hidden",
")",
",",
"bool",
"use_select",
",",
"float",
"r_min",
"[",
"3",
"]",
",",
"float",
"r_max",
"[",
"3",
"]",
")",
"{",
"if",
"(",
"use_select",
")",
"{",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"gzmap",
"->",
"gzmap_context",
".",
"select",
".",
"len",
";",
"i",
"++",
")",
"{",
"minmax_v3v3_v3",
"(",
"r_min",
",",
"r_max",
",",
"gzmap",
"->",
"gzmap_context",
".",
"select",
".",
"items",
"[",
"i",
"]",
"->",
"matrix_basis",
"[",
"3",
"]",
")",
";",
"}",
"return",
"i",
"!=",
"0",
";",
"}",
"else",
"{",
"bool",
"ok",
"=",
"false",
";",
"BLI_assert",
"(",
"!",
"\"",
"\"",
")",
";",
"return",
"ok",
";",
"}",
"}"
] | \note We could use a callback to define bounds, for now just use matrix location. | [
"\\",
"note",
"We",
"could",
"use",
"a",
"callback",
"to",
"define",
"bounds",
"for",
"now",
"just",
"use",
"matrix",
"location",
"."
] | [] | [
{
"param": "gzmap",
"type": "wmGizmoMap"
},
{
"param": "UNUSED",
"type": "bool"
},
{
"param": "use_select",
"type": "bool"
},
{
"param": "r_min",
"type": "float"
},
{
"param": "r_max",
"type": "float"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "gzmap",
"type": "wmGizmoMap",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "UNUSED",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "use_select",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "r_min",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "r_max",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ef4d8174718b436c6515d5a6a1b5f5a4c77a71e9 | DemonRem/blender | source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | WM_gizmomap_gizmo_hash_new | GHash | static GHash *WM_gizmomap_gizmo_hash_new(const bContext *C,
wmGizmoMap *gzmap,
bool (*poll)(const wmGizmo *, void *),
void *data,
const eWM_GizmoFlag flag_exclude)
{
GHash *hash = BLI_ghash_ptr_new(__func__);
/* collect gizmos */
for (wmGizmoGroup *gzgroup = gzmap->groups.first; gzgroup; gzgroup = gzgroup->next) {
if (WM_gizmo_group_type_poll(C, gzgroup->type)) {
for (wmGizmo *gz = gzgroup->gizmos.first; gz; gz = gz->next) {
if (((flag_exclude == 0) || ((gz->flag & flag_exclude) == 0)) &&
(!poll || poll(gz, data))) {
BLI_ghash_insert(hash, gz, gz);
}
}
}
}
return hash;
} | /**
* Creates and returns idname hash table for (visible) gizmos in \a gzmap
*
* \param poll: Polling function for excluding gizmos.
* \param data: Custom data passed to \a poll
*
* TODO(campbell): this uses unreliable order,
* best we use an iterator function instead of a hash.
*/ | Creates and returns idname hash table for (visible) gizmos in \a gzmap
\param poll: Polling function for excluding gizmos.
\param data: Custom data passed to \a poll
this uses unreliable order,
best we use an iterator function instead of a hash. | [
"Creates",
"and",
"returns",
"idname",
"hash",
"table",
"for",
"(",
"visible",
")",
"gizmos",
"in",
"\\",
"a",
"gzmap",
"\\",
"param",
"poll",
":",
"Polling",
"function",
"for",
"excluding",
"gizmos",
".",
"\\",
"param",
"data",
":",
"Custom",
"data",
"passed",
"to",
"\\",
"a",
"poll",
"this",
"uses",
"unreliable",
"order",
"best",
"we",
"use",
"an",
"iterator",
"function",
"instead",
"of",
"a",
"hash",
"."
] | static GHash *WM_gizmomap_gizmo_hash_new(const bContext *C,
wmGizmoMap *gzmap,
bool (*poll)(const wmGizmo *, void *),
void *data,
const eWM_GizmoFlag flag_exclude)
{
GHash *hash = BLI_ghash_ptr_new(__func__);
for (wmGizmoGroup *gzgroup = gzmap->groups.first; gzgroup; gzgroup = gzgroup->next) {
if (WM_gizmo_group_type_poll(C, gzgroup->type)) {
for (wmGizmo *gz = gzgroup->gizmos.first; gz; gz = gz->next) {
if (((flag_exclude == 0) || ((gz->flag & flag_exclude) == 0)) &&
(!poll || poll(gz, data))) {
BLI_ghash_insert(hash, gz, gz);
}
}
}
}
return hash;
} | [
"static",
"GHash",
"*",
"WM_gizmomap_gizmo_hash_new",
"(",
"const",
"bContext",
"*",
"C",
",",
"wmGizmoMap",
"*",
"gzmap",
",",
"bool",
"(",
"*",
"poll",
")",
"(",
"const",
"wmGizmo",
"*",
",",
"void",
"*",
")",
",",
"void",
"*",
"data",
",",
"const",
"eWM_GizmoFlag",
"flag_exclude",
")",
"{",
"GHash",
"*",
"hash",
"=",
"BLI_ghash_ptr_new",
"(",
"__func__",
")",
";",
"for",
"(",
"wmGizmoGroup",
"*",
"gzgroup",
"=",
"gzmap",
"->",
"groups",
".",
"first",
";",
"gzgroup",
";",
"gzgroup",
"=",
"gzgroup",
"->",
"next",
")",
"{",
"if",
"(",
"WM_gizmo_group_type_poll",
"(",
"C",
",",
"gzgroup",
"->",
"type",
")",
")",
"{",
"for",
"(",
"wmGizmo",
"*",
"gz",
"=",
"gzgroup",
"->",
"gizmos",
".",
"first",
";",
"gz",
";",
"gz",
"=",
"gz",
"->",
"next",
")",
"{",
"if",
"(",
"(",
"(",
"flag_exclude",
"==",
"0",
")",
"||",
"(",
"(",
"gz",
"->",
"flag",
"&",
"flag_exclude",
")",
"==",
"0",
")",
")",
"&&",
"(",
"!",
"poll",
"||",
"poll",
"(",
"gz",
",",
"data",
")",
")",
")",
"{",
"BLI_ghash_insert",
"(",
"hash",
",",
"gz",
",",
"gz",
")",
";",
"}",
"}",
"}",
"}",
"return",
"hash",
";",
"}"
] | Creates and returns idname hash table for (visible) gizmos in \a gzmap
\param poll: Polling function for excluding gizmos. | [
"Creates",
"and",
"returns",
"idname",
"hash",
"table",
"for",
"(",
"visible",
")",
"gizmos",
"in",
"\\",
"a",
"gzmap",
"\\",
"param",
"poll",
":",
"Polling",
"function",
"for",
"excluding",
"gizmos",
"."
] | [
"/* collect gizmos */"
] | [
{
"param": "C",
"type": "bContext"
},
{
"param": "gzmap",
"type": "wmGizmoMap"
},
{
"param": "poll",
"type": "bool"
},
{
"param": "data",
"type": "void"
},
{
"param": "flag_exclude",
"type": "eWM_GizmoFlag"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gzmap",
"type": "wmGizmoMap",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "poll",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flag_exclude",
"type": "eWM_GizmoFlag",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ef4d8174718b436c6515d5a6a1b5f5a4c77a71e9 | DemonRem/blender | source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | gizmomap_prepare_drawing | void | static void gizmomap_prepare_drawing(wmGizmoMap *gzmap,
const bContext *C,
ListBase *draw_gizmos,
const eWM_GizmoFlagMapDrawStep drawstep)
{
if (!gzmap || BLI_listbase_is_empty(&gzmap->groups)) {
return;
}
gzmap->is_init = false;
wmGizmo *gz_modal = gzmap->gzmap_context.modal;
/* only active gizmo needs updating */
if (gz_modal) {
if ((gz_modal->parent_gzgroup->type->flag & WM_GIZMOGROUPTYPE_DRAW_MODAL_ALL) == 0) {
if (wm_gizmogroup_is_visible_in_drawstep(gz_modal->parent_gzgroup, drawstep)) {
if (gizmo_prepare_drawing(gzmap, gz_modal, C, draw_gizmos, drawstep)) {
gzmap->update_flag[drawstep] &= ~GIZMOMAP_IS_PREPARE_DRAW;
}
}
/* don't draw any other gizmos */
return;
}
}
for (wmGizmoGroup *gzgroup = gzmap->groups.first; gzgroup; gzgroup = gzgroup->next) {
/* check group visibility - drawstep first to avoid unnecessary call of group poll callback */
if (!wm_gizmogroup_is_visible_in_drawstep(gzgroup, drawstep) ||
!WM_gizmo_group_type_poll(C, gzgroup->type)) {
continue;
}
/* Needs to be initialized on first draw. */
/* XXX weak: Gizmo-group may skip refreshing if it's invisible
* (map gets untagged nevertheless). */
if (gzmap->update_flag[drawstep] & GIZMOMAP_IS_REFRESH_CALLBACK) {
/* force refresh again. */
gzgroup->init_flag &= ~WM_GIZMOGROUP_INIT_REFRESH;
}
/* Calls `setup`, `setup_keymap` and `refresh` if they're defined. */
WM_gizmogroup_ensure_init(C, gzgroup);
/* prepare drawing */
if (gzgroup->type->draw_prepare) {
gzgroup->type->draw_prepare(C, gzgroup);
}
for (wmGizmo *gz = gzgroup->gizmos.first; gz; gz = gz->next) {
gizmo_prepare_drawing(gzmap, gz, C, draw_gizmos, drawstep);
}
}
gzmap->update_flag[drawstep] &= ~(GIZMOMAP_IS_REFRESH_CALLBACK | GIZMOMAP_IS_PREPARE_DRAW);
} | /**
* Update gizmos of \a gzmap to prepare for drawing. Adds all gizmos that
* should be drawn to list \a draw_gizmos, note that added items need freeing.
*/ | Update gizmos of \a gzmap to prepare for drawing. Adds all gizmos that
should be drawn to list \a draw_gizmos, note that added items need freeing. | [
"Update",
"gizmos",
"of",
"\\",
"a",
"gzmap",
"to",
"prepare",
"for",
"drawing",
".",
"Adds",
"all",
"gizmos",
"that",
"should",
"be",
"drawn",
"to",
"list",
"\\",
"a",
"draw_gizmos",
"note",
"that",
"added",
"items",
"need",
"freeing",
"."
] | static void gizmomap_prepare_drawing(wmGizmoMap *gzmap,
const bContext *C,
ListBase *draw_gizmos,
const eWM_GizmoFlagMapDrawStep drawstep)
{
if (!gzmap || BLI_listbase_is_empty(&gzmap->groups)) {
return;
}
gzmap->is_init = false;
wmGizmo *gz_modal = gzmap->gzmap_context.modal;
if (gz_modal) {
if ((gz_modal->parent_gzgroup->type->flag & WM_GIZMOGROUPTYPE_DRAW_MODAL_ALL) == 0) {
if (wm_gizmogroup_is_visible_in_drawstep(gz_modal->parent_gzgroup, drawstep)) {
if (gizmo_prepare_drawing(gzmap, gz_modal, C, draw_gizmos, drawstep)) {
gzmap->update_flag[drawstep] &= ~GIZMOMAP_IS_PREPARE_DRAW;
}
}
return;
}
}
for (wmGizmoGroup *gzgroup = gzmap->groups.first; gzgroup; gzgroup = gzgroup->next) {
if (!wm_gizmogroup_is_visible_in_drawstep(gzgroup, drawstep) ||
!WM_gizmo_group_type_poll(C, gzgroup->type)) {
continue;
}
if (gzmap->update_flag[drawstep] & GIZMOMAP_IS_REFRESH_CALLBACK) {
gzgroup->init_flag &= ~WM_GIZMOGROUP_INIT_REFRESH;
}
WM_gizmogroup_ensure_init(C, gzgroup);
if (gzgroup->type->draw_prepare) {
gzgroup->type->draw_prepare(C, gzgroup);
}
for (wmGizmo *gz = gzgroup->gizmos.first; gz; gz = gz->next) {
gizmo_prepare_drawing(gzmap, gz, C, draw_gizmos, drawstep);
}
}
gzmap->update_flag[drawstep] &= ~(GIZMOMAP_IS_REFRESH_CALLBACK | GIZMOMAP_IS_PREPARE_DRAW);
} | [
"static",
"void",
"gizmomap_prepare_drawing",
"(",
"wmGizmoMap",
"*",
"gzmap",
",",
"const",
"bContext",
"*",
"C",
",",
"ListBase",
"*",
"draw_gizmos",
",",
"const",
"eWM_GizmoFlagMapDrawStep",
"drawstep",
")",
"{",
"if",
"(",
"!",
"gzmap",
"||",
"BLI_listbase_is_empty",
"(",
"&",
"gzmap",
"->",
"groups",
")",
")",
"{",
"return",
";",
"}",
"gzmap",
"->",
"is_init",
"=",
"false",
";",
"wmGizmo",
"*",
"gz_modal",
"=",
"gzmap",
"->",
"gzmap_context",
".",
"modal",
";",
"if",
"(",
"gz_modal",
")",
"{",
"if",
"(",
"(",
"gz_modal",
"->",
"parent_gzgroup",
"->",
"type",
"->",
"flag",
"&",
"WM_GIZMOGROUPTYPE_DRAW_MODAL_ALL",
")",
"==",
"0",
")",
"{",
"if",
"(",
"wm_gizmogroup_is_visible_in_drawstep",
"(",
"gz_modal",
"->",
"parent_gzgroup",
",",
"drawstep",
")",
")",
"{",
"if",
"(",
"gizmo_prepare_drawing",
"(",
"gzmap",
",",
"gz_modal",
",",
"C",
",",
"draw_gizmos",
",",
"drawstep",
")",
")",
"{",
"gzmap",
"->",
"update_flag",
"[",
"drawstep",
"]",
"&=",
"~",
"GIZMOMAP_IS_PREPARE_DRAW",
";",
"}",
"}",
"return",
";",
"}",
"}",
"for",
"(",
"wmGizmoGroup",
"*",
"gzgroup",
"=",
"gzmap",
"->",
"groups",
".",
"first",
";",
"gzgroup",
";",
"gzgroup",
"=",
"gzgroup",
"->",
"next",
")",
"{",
"if",
"(",
"!",
"wm_gizmogroup_is_visible_in_drawstep",
"(",
"gzgroup",
",",
"drawstep",
")",
"||",
"!",
"WM_gizmo_group_type_poll",
"(",
"C",
",",
"gzgroup",
"->",
"type",
")",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"gzmap",
"->",
"update_flag",
"[",
"drawstep",
"]",
"&",
"GIZMOMAP_IS_REFRESH_CALLBACK",
")",
"{",
"gzgroup",
"->",
"init_flag",
"&=",
"~",
"WM_GIZMOGROUP_INIT_REFRESH",
";",
"}",
"WM_gizmogroup_ensure_init",
"(",
"C",
",",
"gzgroup",
")",
";",
"if",
"(",
"gzgroup",
"->",
"type",
"->",
"draw_prepare",
")",
"{",
"gzgroup",
"->",
"type",
"->",
"draw_prepare",
"(",
"C",
",",
"gzgroup",
")",
";",
"}",
"for",
"(",
"wmGizmo",
"*",
"gz",
"=",
"gzgroup",
"->",
"gizmos",
".",
"first",
";",
"gz",
";",
"gz",
"=",
"gz",
"->",
"next",
")",
"{",
"gizmo_prepare_drawing",
"(",
"gzmap",
",",
"gz",
",",
"C",
",",
"draw_gizmos",
",",
"drawstep",
")",
";",
"}",
"}",
"gzmap",
"->",
"update_flag",
"[",
"drawstep",
"]",
"&=",
"~",
"(",
"GIZMOMAP_IS_REFRESH_CALLBACK",
"|",
"GIZMOMAP_IS_PREPARE_DRAW",
")",
";",
"}"
] | Update gizmos of \a gzmap to prepare for drawing. | [
"Update",
"gizmos",
"of",
"\\",
"a",
"gzmap",
"to",
"prepare",
"for",
"drawing",
"."
] | [
"/* only active gizmo needs updating */",
"/* don't draw any other gizmos */",
"/* check group visibility - drawstep first to avoid unnecessary call of group poll callback */",
"/* Needs to be initialized on first draw. */",
"/* XXX weak: Gizmo-group may skip refreshing if it's invisible\n * (map gets untagged nevertheless). */",
"/* force refresh again. */",
"/* Calls `setup`, `setup_keymap` and `refresh` if they're defined. */",
"/* prepare drawing */"
] | [
{
"param": "gzmap",
"type": "wmGizmoMap"
},
{
"param": "C",
"type": "bContext"
},
{
"param": "draw_gizmos",
"type": "ListBase"
},
{
"param": "drawstep",
"type": "eWM_GizmoFlagMapDrawStep"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "gzmap",
"type": "wmGizmoMap",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "draw_gizmos",
"type": "ListBase",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "drawstep",
"type": "eWM_GizmoFlagMapDrawStep",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ef4d8174718b436c6515d5a6a1b5f5a4c77a71e9 | DemonRem/blender | source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | gizmos_draw_list | void | static void gizmos_draw_list(const wmGizmoMap *gzmap, const bContext *C, ListBase *draw_gizmos)
{
/* Can be empty if we're dynamically added and removed. */
if ((gzmap == NULL) || BLI_listbase_is_empty(&gzmap->groups)) {
return;
}
/* TODO(campbell): This will need it own shader probably?
* Don't think it can be handled from that point though. */
/* const bool use_lighting = (U.gizmo_flag & V3D_GIZMO_SHADED) != 0; */
bool is_depth_prev = false;
/* draw_gizmos contains all visible gizmos - draw them */
for (LinkData *link = draw_gizmos->first, *link_next; link; link = link_next) {
wmGizmo *gz = link->data;
link_next = link->next;
bool is_depth = (gz->parent_gzgroup->type->flag & WM_GIZMOGROUPTYPE_DEPTH_3D) != 0;
/* Weak! since we don't 100% support depth yet (select ignores depth)
* always show highlighted. */
if (is_depth && (gz->state & WM_GIZMO_STATE_HIGHLIGHT)) {
is_depth = false;
}
if (is_depth == is_depth_prev) {
/* pass */
}
else {
if (is_depth) {
GPU_depth_test(true);
}
else {
GPU_depth_test(false);
}
is_depth_prev = is_depth;
}
/* XXX force AntiAlias Gizmos. */
GPU_line_smooth(true);
GPU_polygon_smooth(true);
gz->type->draw(C, gz);
GPU_line_smooth(false);
GPU_polygon_smooth(false);
/* free/remove gizmo link after drawing */
BLI_freelinkN(draw_gizmos, link);
}
if (is_depth_prev) {
GPU_depth_test(false);
}
} | /**
* Draw all visible gizmos in \a gzmap.
* Uses global draw_gizmos listbase.
*/ | Draw all visible gizmos in \a gzmap.
Uses global draw_gizmos listbase. | [
"Draw",
"all",
"visible",
"gizmos",
"in",
"\\",
"a",
"gzmap",
".",
"Uses",
"global",
"draw_gizmos",
"listbase",
"."
] | static void gizmos_draw_list(const wmGizmoMap *gzmap, const bContext *C, ListBase *draw_gizmos)
{
if ((gzmap == NULL) || BLI_listbase_is_empty(&gzmap->groups)) {
return;
}
bool is_depth_prev = false;
for (LinkData *link = draw_gizmos->first, *link_next; link; link = link_next) {
wmGizmo *gz = link->data;
link_next = link->next;
bool is_depth = (gz->parent_gzgroup->type->flag & WM_GIZMOGROUPTYPE_DEPTH_3D) != 0;
if (is_depth && (gz->state & WM_GIZMO_STATE_HIGHLIGHT)) {
is_depth = false;
}
if (is_depth == is_depth_prev) {
}
else {
if (is_depth) {
GPU_depth_test(true);
}
else {
GPU_depth_test(false);
}
is_depth_prev = is_depth;
}
GPU_line_smooth(true);
GPU_polygon_smooth(true);
gz->type->draw(C, gz);
GPU_line_smooth(false);
GPU_polygon_smooth(false);
BLI_freelinkN(draw_gizmos, link);
}
if (is_depth_prev) {
GPU_depth_test(false);
}
} | [
"static",
"void",
"gizmos_draw_list",
"(",
"const",
"wmGizmoMap",
"*",
"gzmap",
",",
"const",
"bContext",
"*",
"C",
",",
"ListBase",
"*",
"draw_gizmos",
")",
"{",
"if",
"(",
"(",
"gzmap",
"==",
"NULL",
")",
"||",
"BLI_listbase_is_empty",
"(",
"&",
"gzmap",
"->",
"groups",
")",
")",
"{",
"return",
";",
"}",
"bool",
"is_depth_prev",
"=",
"false",
";",
"for",
"(",
"LinkData",
"*",
"link",
"=",
"draw_gizmos",
"->",
"first",
",",
"*",
"link_next",
";",
"link",
";",
"link",
"=",
"link_next",
")",
"{",
"wmGizmo",
"*",
"gz",
"=",
"link",
"->",
"data",
";",
"link_next",
"=",
"link",
"->",
"next",
";",
"bool",
"is_depth",
"=",
"(",
"gz",
"->",
"parent_gzgroup",
"->",
"type",
"->",
"flag",
"&",
"WM_GIZMOGROUPTYPE_DEPTH_3D",
")",
"!=",
"0",
";",
"if",
"(",
"is_depth",
"&&",
"(",
"gz",
"->",
"state",
"&",
"WM_GIZMO_STATE_HIGHLIGHT",
")",
")",
"{",
"is_depth",
"=",
"false",
";",
"}",
"if",
"(",
"is_depth",
"==",
"is_depth_prev",
")",
"{",
"}",
"else",
"{",
"if",
"(",
"is_depth",
")",
"{",
"GPU_depth_test",
"(",
"true",
")",
";",
"}",
"else",
"{",
"GPU_depth_test",
"(",
"false",
")",
";",
"}",
"is_depth_prev",
"=",
"is_depth",
";",
"}",
"GPU_line_smooth",
"(",
"true",
")",
";",
"GPU_polygon_smooth",
"(",
"true",
")",
";",
"gz",
"->",
"type",
"->",
"draw",
"(",
"C",
",",
"gz",
")",
";",
"GPU_line_smooth",
"(",
"false",
")",
";",
"GPU_polygon_smooth",
"(",
"false",
")",
";",
"BLI_freelinkN",
"(",
"draw_gizmos",
",",
"link",
")",
";",
"}",
"if",
"(",
"is_depth_prev",
")",
"{",
"GPU_depth_test",
"(",
"false",
")",
";",
"}",
"}"
] | Draw all visible gizmos in \a gzmap. | [
"Draw",
"all",
"visible",
"gizmos",
"in",
"\\",
"a",
"gzmap",
"."
] | [
"/* Can be empty if we're dynamically added and removed. */",
"/* TODO(campbell): This will need it own shader probably?\n * Don't think it can be handled from that point though. */",
"/* const bool use_lighting = (U.gizmo_flag & V3D_GIZMO_SHADED) != 0; */",
"/* draw_gizmos contains all visible gizmos - draw them */",
"/* Weak! since we don't 100% support depth yet (select ignores depth)\n * always show highlighted. */",
"/* pass */",
"/* XXX force AntiAlias Gizmos. */",
"/* free/remove gizmo link after drawing */"
] | [
{
"param": "gzmap",
"type": "wmGizmoMap"
},
{
"param": "C",
"type": "bContext"
},
{
"param": "draw_gizmos",
"type": "ListBase"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "gzmap",
"type": "wmGizmoMap",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "draw_gizmos",
"type": "ListBase",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ef4d8174718b436c6515d5a6a1b5f5a4c77a71e9 | DemonRem/blender | source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | wm_gizmomap_handler_context_op | void | void wm_gizmomap_handler_context_op(bContext *C, wmEventHandler_Op *handler)
{
bScreen *screen = CTX_wm_screen(C);
if (screen) {
ScrArea *sa;
for (sa = screen->areabase.first; sa; sa = sa->next) {
if (sa == handler->context.area) {
break;
}
}
if (sa == NULL) {
/* when changing screen layouts with running modal handlers (like render display), this
* is not an error to print */
printf("internal error: modal gizmo-map handler has invalid area\n");
}
else {
ARegion *ar;
CTX_wm_area_set(C, sa);
for (ar = sa->regionbase.first; ar; ar = ar->next) {
if (ar == handler->context.region) {
break;
}
}
/* XXX no warning print here, after full-area and back regions are remade */
if (ar) {
CTX_wm_region_set(C, ar);
}
}
}
} | /**
* Prepare context for gizmo handling (but only if area/region is
* part of screen). Version of #wm_handler_op_context for gizmos.
*/ | Prepare context for gizmo handling (but only if area/region is
part of screen). Version of #wm_handler_op_context for gizmos. | [
"Prepare",
"context",
"for",
"gizmo",
"handling",
"(",
"but",
"only",
"if",
"area",
"/",
"region",
"is",
"part",
"of",
"screen",
")",
".",
"Version",
"of",
"#wm_handler_op_context",
"for",
"gizmos",
"."
] | void wm_gizmomap_handler_context_op(bContext *C, wmEventHandler_Op *handler)
{
bScreen *screen = CTX_wm_screen(C);
if (screen) {
ScrArea *sa;
for (sa = screen->areabase.first; sa; sa = sa->next) {
if (sa == handler->context.area) {
break;
}
}
if (sa == NULL) {
printf("internal error: modal gizmo-map handler has invalid area\n");
}
else {
ARegion *ar;
CTX_wm_area_set(C, sa);
for (ar = sa->regionbase.first; ar; ar = ar->next) {
if (ar == handler->context.region) {
break;
}
}
if (ar) {
CTX_wm_region_set(C, ar);
}
}
}
} | [
"void",
"wm_gizmomap_handler_context_op",
"(",
"bContext",
"*",
"C",
",",
"wmEventHandler_Op",
"*",
"handler",
")",
"{",
"bScreen",
"*",
"screen",
"=",
"CTX_wm_screen",
"(",
"C",
")",
";",
"if",
"(",
"screen",
")",
"{",
"ScrArea",
"*",
"sa",
";",
"for",
"(",
"sa",
"=",
"screen",
"->",
"areabase",
".",
"first",
";",
"sa",
";",
"sa",
"=",
"sa",
"->",
"next",
")",
"{",
"if",
"(",
"sa",
"==",
"handler",
"->",
"context",
".",
"area",
")",
"{",
"break",
";",
"}",
"}",
"if",
"(",
"sa",
"==",
"NULL",
")",
"{",
"printf",
"(",
"\"",
"\\n",
"\"",
")",
";",
"}",
"else",
"{",
"ARegion",
"*",
"ar",
";",
"CTX_wm_area_set",
"(",
"C",
",",
"sa",
")",
";",
"for",
"(",
"ar",
"=",
"sa",
"->",
"regionbase",
".",
"first",
";",
"ar",
";",
"ar",
"=",
"ar",
"->",
"next",
")",
"{",
"if",
"(",
"ar",
"==",
"handler",
"->",
"context",
".",
"region",
")",
"{",
"break",
";",
"}",
"}",
"if",
"(",
"ar",
")",
"{",
"CTX_wm_region_set",
"(",
"C",
",",
"ar",
")",
";",
"}",
"}",
"}",
"}"
] | Prepare context for gizmo handling (but only if area/region is
part of screen). | [
"Prepare",
"context",
"for",
"gizmo",
"handling",
"(",
"but",
"only",
"if",
"area",
"/",
"region",
"is",
"part",
"of",
"screen",
")",
"."
] | [
"/* when changing screen layouts with running modal handlers (like render display), this\n * is not an error to print */",
"/* XXX no warning print here, after full-area and back regions are remade */"
] | [
{
"param": "C",
"type": "bContext"
},
{
"param": "handler",
"type": "wmEventHandler_Op"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "handler",
"type": "wmEventHandler_Op",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ef4d8174718b436c6515d5a6a1b5f5a4c77a71e9 | DemonRem/blender | source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | wm_gizmos_keymap | void | void wm_gizmos_keymap(wmKeyConfig *keyconf)
{
/* we add this item-less keymap once and use it to group gizmo-group keymaps into it */
WM_keymap_ensure(keyconf, "Gizmos", 0, 0);
for (wmGizmoMapType *gzmap_type = gizmomaptypes.first; gzmap_type;
gzmap_type = gzmap_type->next) {
for (wmGizmoGroupTypeRef *gzgt_ref = gzmap_type->grouptype_refs.first; gzgt_ref;
gzgt_ref = gzgt_ref->next) {
wm_gizmogrouptype_setup_keymap(gzgt_ref->type, keyconf);
}
}
wm_gizmogroup_tweak_modal_keymap(keyconf);
} | /**
* Initialize keymaps for all existing gizmo-groups
*/ | Initialize keymaps for all existing gizmo-groups | [
"Initialize",
"keymaps",
"for",
"all",
"existing",
"gizmo",
"-",
"groups"
] | void wm_gizmos_keymap(wmKeyConfig *keyconf)
{
WM_keymap_ensure(keyconf, "Gizmos", 0, 0);
for (wmGizmoMapType *gzmap_type = gizmomaptypes.first; gzmap_type;
gzmap_type = gzmap_type->next) {
for (wmGizmoGroupTypeRef *gzgt_ref = gzmap_type->grouptype_refs.first; gzgt_ref;
gzgt_ref = gzgt_ref->next) {
wm_gizmogrouptype_setup_keymap(gzgt_ref->type, keyconf);
}
}
wm_gizmogroup_tweak_modal_keymap(keyconf);
} | [
"void",
"wm_gizmos_keymap",
"(",
"wmKeyConfig",
"*",
"keyconf",
")",
"{",
"WM_keymap_ensure",
"(",
"keyconf",
",",
"\"",
"\"",
",",
"0",
",",
"0",
")",
";",
"for",
"(",
"wmGizmoMapType",
"*",
"gzmap_type",
"=",
"gizmomaptypes",
".",
"first",
";",
"gzmap_type",
";",
"gzmap_type",
"=",
"gzmap_type",
"->",
"next",
")",
"{",
"for",
"(",
"wmGizmoGroupTypeRef",
"*",
"gzgt_ref",
"=",
"gzmap_type",
"->",
"grouptype_refs",
".",
"first",
";",
"gzgt_ref",
";",
"gzgt_ref",
"=",
"gzgt_ref",
"->",
"next",
")",
"{",
"wm_gizmogrouptype_setup_keymap",
"(",
"gzgt_ref",
"->",
"type",
",",
"keyconf",
")",
";",
"}",
"}",
"wm_gizmogroup_tweak_modal_keymap",
"(",
"keyconf",
")",
";",
"}"
] | Initialize keymaps for all existing gizmo-groups | [
"Initialize",
"keymaps",
"for",
"all",
"existing",
"gizmo",
"-",
"groups"
] | [
"/* we add this item-less keymap once and use it to group gizmo-group keymaps into it */"
] | [
{
"param": "keyconf",
"type": "wmKeyConfig"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "keyconf",
"type": "wmKeyConfig",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ef4d8174718b436c6515d5a6a1b5f5a4c77a71e9 | DemonRem/blender | source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | WM_gizmoconfig_update | void | void WM_gizmoconfig_update(struct Main *bmain)
{
if (G.background) {
return;
}
if (wm_gzmap_type_update_flag == 0) {
return;
}
if (wm_gzmap_type_update_flag & WM_GIZMOMAPTYPE_GLOBAL_UPDATE_REMOVE) {
for (wmGizmoMapType *gzmap_type = gizmomaptypes.first; gzmap_type;
gzmap_type = gzmap_type->next) {
if (gzmap_type->type_update_flag & WM_GIZMOMAPTYPE_GLOBAL_UPDATE_REMOVE) {
gzmap_type->type_update_flag &= ~WM_GIZMOMAPTYPE_UPDATE_REMOVE;
for (wmGizmoGroupTypeRef *gzgt_ref = gzmap_type->grouptype_refs.first, *gzgt_ref_next;
gzgt_ref;
gzgt_ref = gzgt_ref_next) {
gzgt_ref_next = gzgt_ref->next;
if (gzgt_ref->type->type_update_flag & WM_GIZMOMAPTYPE_UPDATE_REMOVE) {
gzgt_ref->type->type_update_flag &= ~WM_GIZMOMAPTYPE_UPDATE_REMOVE;
WM_gizmomaptype_group_unlink(NULL, bmain, gzmap_type, gzgt_ref->type);
}
}
}
}
wm_gzmap_type_update_flag &= ~WM_GIZMOMAPTYPE_GLOBAL_UPDATE_REMOVE;
}
if (wm_gzmap_type_update_flag & WM_GIZMOMAPTYPE_GLOBAL_UPDATE_INIT) {
for (wmGizmoMapType *gzmap_type = gizmomaptypes.first; gzmap_type;
gzmap_type = gzmap_type->next) {
const uchar type_update_all = WM_GIZMOMAPTYPE_UPDATE_INIT | WM_GIZMOMAPTYPE_KEYMAP_INIT;
if (gzmap_type->type_update_flag & type_update_all) {
gzmap_type->type_update_flag &= ~type_update_all;
for (wmGizmoGroupTypeRef *gzgt_ref = gzmap_type->grouptype_refs.first; gzgt_ref;
gzgt_ref = gzgt_ref->next) {
if (gzgt_ref->type->type_update_flag & WM_GIZMOMAPTYPE_KEYMAP_INIT) {
WM_gizmomaptype_group_init_runtime_keymap(bmain, gzgt_ref->type);
gzgt_ref->type->type_update_flag &= ~WM_GIZMOMAPTYPE_KEYMAP_INIT;
}
if (gzgt_ref->type->type_update_flag & WM_GIZMOMAPTYPE_UPDATE_INIT) {
WM_gizmomaptype_group_init_runtime(bmain, gzmap_type, gzgt_ref->type);
gzgt_ref->type->type_update_flag &= ~WM_GIZMOMAPTYPE_UPDATE_INIT;
}
}
}
}
wm_gzmap_type_update_flag &= ~WM_GIZMOMAPTYPE_GLOBAL_UPDATE_INIT;
}
if (wm_gzmap_type_update_flag & WM_GIZMOTYPE_GLOBAL_UPDATE_REMOVE) {
for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
for (ARegion *ar = regionbase->first; ar; ar = ar->next) {
wmGizmoMap *gzmap = ar->gizmo_map;
if (gzmap != NULL && gzmap->tag_remove_group) {
gzmap->tag_remove_group = false;
for (wmGizmoGroup *gzgroup = gzmap->groups.first, *gzgroup_next; gzgroup;
gzgroup = gzgroup_next) {
gzgroup_next = gzgroup->next;
if (gzgroup->tag_remove) {
wm_gizmogroup_free(NULL, gzgroup);
ED_region_tag_redraw(ar);
}
}
}
}
}
}
}
wm_gzmap_type_update_flag &= ~WM_GIZMOTYPE_GLOBAL_UPDATE_REMOVE;
}
} | /**
* Run in case new types have been added (runs often, early exit where possible).
* Follows #WM_keyconfig_update conventions.
*/ | Run in case new types have been added (runs often, early exit where possible). | [
"Run",
"in",
"case",
"new",
"types",
"have",
"been",
"added",
"(",
"runs",
"often",
"early",
"exit",
"where",
"possible",
")",
"."
] | void WM_gizmoconfig_update(struct Main *bmain)
{
if (G.background) {
return;
}
if (wm_gzmap_type_update_flag == 0) {
return;
}
if (wm_gzmap_type_update_flag & WM_GIZMOMAPTYPE_GLOBAL_UPDATE_REMOVE) {
for (wmGizmoMapType *gzmap_type = gizmomaptypes.first; gzmap_type;
gzmap_type = gzmap_type->next) {
if (gzmap_type->type_update_flag & WM_GIZMOMAPTYPE_GLOBAL_UPDATE_REMOVE) {
gzmap_type->type_update_flag &= ~WM_GIZMOMAPTYPE_UPDATE_REMOVE;
for (wmGizmoGroupTypeRef *gzgt_ref = gzmap_type->grouptype_refs.first, *gzgt_ref_next;
gzgt_ref;
gzgt_ref = gzgt_ref_next) {
gzgt_ref_next = gzgt_ref->next;
if (gzgt_ref->type->type_update_flag & WM_GIZMOMAPTYPE_UPDATE_REMOVE) {
gzgt_ref->type->type_update_flag &= ~WM_GIZMOMAPTYPE_UPDATE_REMOVE;
WM_gizmomaptype_group_unlink(NULL, bmain, gzmap_type, gzgt_ref->type);
}
}
}
}
wm_gzmap_type_update_flag &= ~WM_GIZMOMAPTYPE_GLOBAL_UPDATE_REMOVE;
}
if (wm_gzmap_type_update_flag & WM_GIZMOMAPTYPE_GLOBAL_UPDATE_INIT) {
for (wmGizmoMapType *gzmap_type = gizmomaptypes.first; gzmap_type;
gzmap_type = gzmap_type->next) {
const uchar type_update_all = WM_GIZMOMAPTYPE_UPDATE_INIT | WM_GIZMOMAPTYPE_KEYMAP_INIT;
if (gzmap_type->type_update_flag & type_update_all) {
gzmap_type->type_update_flag &= ~type_update_all;
for (wmGizmoGroupTypeRef *gzgt_ref = gzmap_type->grouptype_refs.first; gzgt_ref;
gzgt_ref = gzgt_ref->next) {
if (gzgt_ref->type->type_update_flag & WM_GIZMOMAPTYPE_KEYMAP_INIT) {
WM_gizmomaptype_group_init_runtime_keymap(bmain, gzgt_ref->type);
gzgt_ref->type->type_update_flag &= ~WM_GIZMOMAPTYPE_KEYMAP_INIT;
}
if (gzgt_ref->type->type_update_flag & WM_GIZMOMAPTYPE_UPDATE_INIT) {
WM_gizmomaptype_group_init_runtime(bmain, gzmap_type, gzgt_ref->type);
gzgt_ref->type->type_update_flag &= ~WM_GIZMOMAPTYPE_UPDATE_INIT;
}
}
}
}
wm_gzmap_type_update_flag &= ~WM_GIZMOMAPTYPE_GLOBAL_UPDATE_INIT;
}
if (wm_gzmap_type_update_flag & WM_GIZMOTYPE_GLOBAL_UPDATE_REMOVE) {
for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
for (ARegion *ar = regionbase->first; ar; ar = ar->next) {
wmGizmoMap *gzmap = ar->gizmo_map;
if (gzmap != NULL && gzmap->tag_remove_group) {
gzmap->tag_remove_group = false;
for (wmGizmoGroup *gzgroup = gzmap->groups.first, *gzgroup_next; gzgroup;
gzgroup = gzgroup_next) {
gzgroup_next = gzgroup->next;
if (gzgroup->tag_remove) {
wm_gizmogroup_free(NULL, gzgroup);
ED_region_tag_redraw(ar);
}
}
}
}
}
}
}
wm_gzmap_type_update_flag &= ~WM_GIZMOTYPE_GLOBAL_UPDATE_REMOVE;
}
} | [
"void",
"WM_gizmoconfig_update",
"(",
"struct",
"Main",
"*",
"bmain",
")",
"{",
"if",
"(",
"G",
".",
"background",
")",
"{",
"return",
";",
"}",
"if",
"(",
"wm_gzmap_type_update_flag",
"==",
"0",
")",
"{",
"return",
";",
"}",
"if",
"(",
"wm_gzmap_type_update_flag",
"&",
"WM_GIZMOMAPTYPE_GLOBAL_UPDATE_REMOVE",
")",
"{",
"for",
"(",
"wmGizmoMapType",
"*",
"gzmap_type",
"=",
"gizmomaptypes",
".",
"first",
";",
"gzmap_type",
";",
"gzmap_type",
"=",
"gzmap_type",
"->",
"next",
")",
"{",
"if",
"(",
"gzmap_type",
"->",
"type_update_flag",
"&",
"WM_GIZMOMAPTYPE_GLOBAL_UPDATE_REMOVE",
")",
"{",
"gzmap_type",
"->",
"type_update_flag",
"&=",
"~",
"WM_GIZMOMAPTYPE_UPDATE_REMOVE",
";",
"for",
"(",
"wmGizmoGroupTypeRef",
"*",
"gzgt_ref",
"=",
"gzmap_type",
"->",
"grouptype_refs",
".",
"first",
",",
"*",
"gzgt_ref_next",
";",
"gzgt_ref",
";",
"gzgt_ref",
"=",
"gzgt_ref_next",
")",
"{",
"gzgt_ref_next",
"=",
"gzgt_ref",
"->",
"next",
";",
"if",
"(",
"gzgt_ref",
"->",
"type",
"->",
"type_update_flag",
"&",
"WM_GIZMOMAPTYPE_UPDATE_REMOVE",
")",
"{",
"gzgt_ref",
"->",
"type",
"->",
"type_update_flag",
"&=",
"~",
"WM_GIZMOMAPTYPE_UPDATE_REMOVE",
";",
"WM_gizmomaptype_group_unlink",
"(",
"NULL",
",",
"bmain",
",",
"gzmap_type",
",",
"gzgt_ref",
"->",
"type",
")",
";",
"}",
"}",
"}",
"}",
"wm_gzmap_type_update_flag",
"&=",
"~",
"WM_GIZMOMAPTYPE_GLOBAL_UPDATE_REMOVE",
";",
"}",
"if",
"(",
"wm_gzmap_type_update_flag",
"&",
"WM_GIZMOMAPTYPE_GLOBAL_UPDATE_INIT",
")",
"{",
"for",
"(",
"wmGizmoMapType",
"*",
"gzmap_type",
"=",
"gizmomaptypes",
".",
"first",
";",
"gzmap_type",
";",
"gzmap_type",
"=",
"gzmap_type",
"->",
"next",
")",
"{",
"const",
"uchar",
"type_update_all",
"=",
"WM_GIZMOMAPTYPE_UPDATE_INIT",
"|",
"WM_GIZMOMAPTYPE_KEYMAP_INIT",
";",
"if",
"(",
"gzmap_type",
"->",
"type_update_flag",
"&",
"type_update_all",
")",
"{",
"gzmap_type",
"->",
"type_update_flag",
"&=",
"~",
"type_update_all",
";",
"for",
"(",
"wmGizmoGroupTypeRef",
"*",
"gzgt_ref",
"=",
"gzmap_type",
"->",
"grouptype_refs",
".",
"first",
";",
"gzgt_ref",
";",
"gzgt_ref",
"=",
"gzgt_ref",
"->",
"next",
")",
"{",
"if",
"(",
"gzgt_ref",
"->",
"type",
"->",
"type_update_flag",
"&",
"WM_GIZMOMAPTYPE_KEYMAP_INIT",
")",
"{",
"WM_gizmomaptype_group_init_runtime_keymap",
"(",
"bmain",
",",
"gzgt_ref",
"->",
"type",
")",
";",
"gzgt_ref",
"->",
"type",
"->",
"type_update_flag",
"&=",
"~",
"WM_GIZMOMAPTYPE_KEYMAP_INIT",
";",
"}",
"if",
"(",
"gzgt_ref",
"->",
"type",
"->",
"type_update_flag",
"&",
"WM_GIZMOMAPTYPE_UPDATE_INIT",
")",
"{",
"WM_gizmomaptype_group_init_runtime",
"(",
"bmain",
",",
"gzmap_type",
",",
"gzgt_ref",
"->",
"type",
")",
";",
"gzgt_ref",
"->",
"type",
"->",
"type_update_flag",
"&=",
"~",
"WM_GIZMOMAPTYPE_UPDATE_INIT",
";",
"}",
"}",
"}",
"}",
"wm_gzmap_type_update_flag",
"&=",
"~",
"WM_GIZMOMAPTYPE_GLOBAL_UPDATE_INIT",
";",
"}",
"if",
"(",
"wm_gzmap_type_update_flag",
"&",
"WM_GIZMOTYPE_GLOBAL_UPDATE_REMOVE",
")",
"{",
"for",
"(",
"bScreen",
"*",
"screen",
"=",
"bmain",
"->",
"screens",
".",
"first",
";",
"screen",
";",
"screen",
"=",
"screen",
"->",
"id",
".",
"next",
")",
"{",
"for",
"(",
"ScrArea",
"*",
"sa",
"=",
"screen",
"->",
"areabase",
".",
"first",
";",
"sa",
";",
"sa",
"=",
"sa",
"->",
"next",
")",
"{",
"for",
"(",
"SpaceLink",
"*",
"sl",
"=",
"sa",
"->",
"spacedata",
".",
"first",
";",
"sl",
";",
"sl",
"=",
"sl",
"->",
"next",
")",
"{",
"ListBase",
"*",
"regionbase",
"=",
"(",
"sl",
"==",
"sa",
"->",
"spacedata",
".",
"first",
")",
"?",
"&",
"sa",
"->",
"regionbase",
":",
"&",
"sl",
"->",
"regionbase",
";",
"for",
"(",
"ARegion",
"*",
"ar",
"=",
"regionbase",
"->",
"first",
";",
"ar",
";",
"ar",
"=",
"ar",
"->",
"next",
")",
"{",
"wmGizmoMap",
"*",
"gzmap",
"=",
"ar",
"->",
"gizmo_map",
";",
"if",
"(",
"gzmap",
"!=",
"NULL",
"&&",
"gzmap",
"->",
"tag_remove_group",
")",
"{",
"gzmap",
"->",
"tag_remove_group",
"=",
"false",
";",
"for",
"(",
"wmGizmoGroup",
"*",
"gzgroup",
"=",
"gzmap",
"->",
"groups",
".",
"first",
",",
"*",
"gzgroup_next",
";",
"gzgroup",
";",
"gzgroup",
"=",
"gzgroup_next",
")",
"{",
"gzgroup_next",
"=",
"gzgroup",
"->",
"next",
";",
"if",
"(",
"gzgroup",
"->",
"tag_remove",
")",
"{",
"wm_gizmogroup_free",
"(",
"NULL",
",",
"gzgroup",
")",
";",
"ED_region_tag_redraw",
"(",
"ar",
")",
";",
"}",
"}",
"}",
"}",
"}",
"}",
"}",
"wm_gzmap_type_update_flag",
"&=",
"~",
"WM_GIZMOTYPE_GLOBAL_UPDATE_REMOVE",
";",
"}",
"}"
] | Run in case new types have been added (runs often, early exit where possible). | [
"Run",
"in",
"case",
"new",
"types",
"have",
"been",
"added",
"(",
"runs",
"often",
"early",
"exit",
"where",
"possible",
")",
"."
] | [] | [
{
"param": "bmain",
"type": "struct Main"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bmain",
"type": "struct Main",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1637f8cfed56591d01282d64252d0e74d8c8a3ee | DemonRem/blender | source/blender/makesrna/intern/rna_screen.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | rna_Area_type_itemf | EnumPropertyItem | static const EnumPropertyItem *rna_Area_type_itemf(bContext *UNUSED(C),
PointerRNA *UNUSED(ptr),
PropertyRNA *UNUSED(prop),
bool *r_free)
{
EnumPropertyItem *item = NULL;
int totitem = 0;
/* +1 to skip SPACE_EMPTY */
for (const EnumPropertyItem *item_from = rna_enum_space_type_items + 1; item_from->identifier;
item_from++) {
if (ELEM(item_from->value, SPACE_TOPBAR, SPACE_STATUSBAR)) {
continue;
}
RNA_enum_item_add(&item, &totitem, item_from);
}
RNA_enum_item_end(&item, &totitem);
*r_free = true;
return item;
} | /* UI compatible list: should not be needed, but for now we need to keep EMPTY
* at least in the static version of this enum for python scripts. */ | UI compatible list: should not be needed, but for now we need to keep EMPTY
at least in the static version of this enum for python scripts. | [
"UI",
"compatible",
"list",
":",
"should",
"not",
"be",
"needed",
"but",
"for",
"now",
"we",
"need",
"to",
"keep",
"EMPTY",
"at",
"least",
"in",
"the",
"static",
"version",
"of",
"this",
"enum",
"for",
"python",
"scripts",
"."
] | static const EnumPropertyItem *rna_Area_type_itemf(bContext *UNUSED(C),
PointerRNA *UNUSED(ptr),
PropertyRNA *UNUSED(prop),
bool *r_free)
{
EnumPropertyItem *item = NULL;
int totitem = 0;
for (const EnumPropertyItem *item_from = rna_enum_space_type_items + 1; item_from->identifier;
item_from++) {
if (ELEM(item_from->value, SPACE_TOPBAR, SPACE_STATUSBAR)) {
continue;
}
RNA_enum_item_add(&item, &totitem, item_from);
}
RNA_enum_item_end(&item, &totitem);
*r_free = true;
return item;
} | [
"static",
"const",
"EnumPropertyItem",
"*",
"rna_Area_type_itemf",
"(",
"bContext",
"*",
"UNUSED",
"(",
"C",
")",
",",
"PointerRNA",
"*",
"UNUSED",
"(",
"ptr",
")",
",",
"PropertyRNA",
"*",
"UNUSED",
"(",
"prop",
")",
",",
"bool",
"*",
"r_free",
")",
"{",
"EnumPropertyItem",
"*",
"item",
"=",
"NULL",
";",
"int",
"totitem",
"=",
"0",
";",
"for",
"(",
"const",
"EnumPropertyItem",
"*",
"item_from",
"=",
"rna_enum_space_type_items",
"+",
"1",
";",
"item_from",
"->",
"identifier",
";",
"item_from",
"++",
")",
"{",
"if",
"(",
"ELEM",
"(",
"item_from",
"->",
"value",
",",
"SPACE_TOPBAR",
",",
"SPACE_STATUSBAR",
")",
")",
"{",
"continue",
";",
"}",
"RNA_enum_item_add",
"(",
"&",
"item",
",",
"&",
"totitem",
",",
"item_from",
")",
";",
"}",
"RNA_enum_item_end",
"(",
"&",
"item",
",",
"&",
"totitem",
")",
";",
"*",
"r_free",
"=",
"true",
";",
"return",
"item",
";",
"}"
] | UI compatible list: should not be needed, but for now we need to keep EMPTY
at least in the static version of this enum for python scripts. | [
"UI",
"compatible",
"list",
":",
"should",
"not",
"be",
"needed",
"but",
"for",
"now",
"we",
"need",
"to",
"keep",
"EMPTY",
"at",
"least",
"in",
"the",
"static",
"version",
"of",
"this",
"enum",
"for",
"python",
"scripts",
"."
] | [
"/* +1 to skip SPACE_EMPTY */"
] | [
{
"param": "UNUSED",
"type": "PropertyRNA"
},
{
"param": "r_free",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "UNUSED",
"type": "PropertyRNA",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "r_free",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ce410f3e52dd8998b6a11f71dffce01a2e6ef6aa | DemonRem/blender | source/blender/editors/gpencil/gpencil_ops.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | gp_stroke_editmode_poll | bool | static bool gp_stroke_editmode_poll(bContext *C)
{
bGPdata *gpd = CTX_data_gpencil_data(C);
return (gpd && (gpd->flag & GP_DATA_STROKE_EDITMODE));
} | /* Poll callback for stroke editing mode */ | Poll callback for stroke editing mode | [
"Poll",
"callback",
"for",
"stroke",
"editing",
"mode"
] | static bool gp_stroke_editmode_poll(bContext *C)
{
bGPdata *gpd = CTX_data_gpencil_data(C);
return (gpd && (gpd->flag & GP_DATA_STROKE_EDITMODE));
} | [
"static",
"bool",
"gp_stroke_editmode_poll",
"(",
"bContext",
"*",
"C",
")",
"{",
"bGPdata",
"*",
"gpd",
"=",
"CTX_data_gpencil_data",
"(",
"C",
")",
";",
"return",
"(",
"gpd",
"&&",
"(",
"gpd",
"->",
"flag",
"&",
"GP_DATA_STROKE_EDITMODE",
")",
")",
";",
"}"
] | Poll callback for stroke editing mode | [
"Poll",
"callback",
"for",
"stroke",
"editing",
"mode"
] | [] | [
{
"param": "C",
"type": "bContext"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ce410f3e52dd8998b6a11f71dffce01a2e6ef6aa | DemonRem/blender | source/blender/editors/gpencil/gpencil_ops.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | gp_stroke_paintmode_poll | bool | static bool gp_stroke_paintmode_poll(bContext *C)
{
/* TODO: limit this to mode, but review 2D editors */
bGPdata *gpd = CTX_data_gpencil_data(C);
return (gpd && (gpd->flag & GP_DATA_STROKE_PAINTMODE));
} | /* Poll callback for stroke painting mode */ | Poll callback for stroke painting mode | [
"Poll",
"callback",
"for",
"stroke",
"painting",
"mode"
] | static bool gp_stroke_paintmode_poll(bContext *C)
{
bGPdata *gpd = CTX_data_gpencil_data(C);
return (gpd && (gpd->flag & GP_DATA_STROKE_PAINTMODE));
} | [
"static",
"bool",
"gp_stroke_paintmode_poll",
"(",
"bContext",
"*",
"C",
")",
"{",
"bGPdata",
"*",
"gpd",
"=",
"CTX_data_gpencil_data",
"(",
"C",
")",
";",
"return",
"(",
"gpd",
"&&",
"(",
"gpd",
"->",
"flag",
"&",
"GP_DATA_STROKE_PAINTMODE",
")",
")",
";",
"}"
] | Poll callback for stroke painting mode | [
"Poll",
"callback",
"for",
"stroke",
"painting",
"mode"
] | [
"/* TODO: limit this to mode, but review 2D editors */"
] | [
{
"param": "C",
"type": "bContext"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ce410f3e52dd8998b6a11f71dffce01a2e6ef6aa | DemonRem/blender | source/blender/editors/gpencil/gpencil_ops.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | gp_stroke_sculptmode_poll | bool | static bool gp_stroke_sculptmode_poll(bContext *C)
{
bGPdata *gpd = CTX_data_gpencil_data(C);
Object *ob = CTX_data_active_object(C);
ScrArea *sa = CTX_wm_area(C);
/* if not gpencil object and not view3d, need sculpt keys if edit mode */
if (sa->spacetype != SPACE_VIEW3D) {
return ((gpd) && (gpd->flag & GP_DATA_STROKE_EDITMODE));
}
else {
/* weight paint is a submode of sculpt */
if ((ob) && (ob->type == OB_GPENCIL)) {
return GPENCIL_SCULPT_OR_WEIGHT_MODE(gpd);
}
}
return 0;
} | /* Poll callback for stroke sculpting mode */ | Poll callback for stroke sculpting mode | [
"Poll",
"callback",
"for",
"stroke",
"sculpting",
"mode"
] | static bool gp_stroke_sculptmode_poll(bContext *C)
{
bGPdata *gpd = CTX_data_gpencil_data(C);
Object *ob = CTX_data_active_object(C);
ScrArea *sa = CTX_wm_area(C);
if (sa->spacetype != SPACE_VIEW3D) {
return ((gpd) && (gpd->flag & GP_DATA_STROKE_EDITMODE));
}
else {
if ((ob) && (ob->type == OB_GPENCIL)) {
return GPENCIL_SCULPT_OR_WEIGHT_MODE(gpd);
}
}
return 0;
} | [
"static",
"bool",
"gp_stroke_sculptmode_poll",
"(",
"bContext",
"*",
"C",
")",
"{",
"bGPdata",
"*",
"gpd",
"=",
"CTX_data_gpencil_data",
"(",
"C",
")",
";",
"Object",
"*",
"ob",
"=",
"CTX_data_active_object",
"(",
"C",
")",
";",
"ScrArea",
"*",
"sa",
"=",
"CTX_wm_area",
"(",
"C",
")",
";",
"if",
"(",
"sa",
"->",
"spacetype",
"!=",
"SPACE_VIEW3D",
")",
"{",
"return",
"(",
"(",
"gpd",
")",
"&&",
"(",
"gpd",
"->",
"flag",
"&",
"GP_DATA_STROKE_EDITMODE",
")",
")",
";",
"}",
"else",
"{",
"if",
"(",
"(",
"ob",
")",
"&&",
"(",
"ob",
"->",
"type",
"==",
"OB_GPENCIL",
")",
")",
"{",
"return",
"GPENCIL_SCULPT_OR_WEIGHT_MODE",
"(",
"gpd",
")",
";",
"}",
"}",
"return",
"0",
";",
"}"
] | Poll callback for stroke sculpting mode | [
"Poll",
"callback",
"for",
"stroke",
"sculpting",
"mode"
] | [
"/* if not gpencil object and not view3d, need sculpt keys if edit mode */",
"/* weight paint is a submode of sculpt */"
] | [
{
"param": "C",
"type": "bContext"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ce410f3e52dd8998b6a11f71dffce01a2e6ef6aa | DemonRem/blender | source/blender/editors/gpencil/gpencil_ops.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | gp_stroke_weightmode_poll | bool | static bool gp_stroke_weightmode_poll(bContext *C)
{
bGPdata *gpd = CTX_data_gpencil_data(C);
Object *ob = CTX_data_active_object(C);
if ((ob) && (ob->type == OB_GPENCIL)) {
return (gpd && (gpd->flag & GP_DATA_STROKE_WEIGHTMODE));
}
return 0;
} | /* Poll callback for stroke weight paint mode */ | Poll callback for stroke weight paint mode | [
"Poll",
"callback",
"for",
"stroke",
"weight",
"paint",
"mode"
] | static bool gp_stroke_weightmode_poll(bContext *C)
{
bGPdata *gpd = CTX_data_gpencil_data(C);
Object *ob = CTX_data_active_object(C);
if ((ob) && (ob->type == OB_GPENCIL)) {
return (gpd && (gpd->flag & GP_DATA_STROKE_WEIGHTMODE));
}
return 0;
} | [
"static",
"bool",
"gp_stroke_weightmode_poll",
"(",
"bContext",
"*",
"C",
")",
"{",
"bGPdata",
"*",
"gpd",
"=",
"CTX_data_gpencil_data",
"(",
"C",
")",
";",
"Object",
"*",
"ob",
"=",
"CTX_data_active_object",
"(",
"C",
")",
";",
"if",
"(",
"(",
"ob",
")",
"&&",
"(",
"ob",
"->",
"type",
"==",
"OB_GPENCIL",
")",
")",
"{",
"return",
"(",
"gpd",
"&&",
"(",
"gpd",
"->",
"flag",
"&",
"GP_DATA_STROKE_WEIGHTMODE",
")",
")",
";",
"}",
"return",
"0",
";",
"}"
] | Poll callback for stroke weight paint mode | [
"Poll",
"callback",
"for",
"stroke",
"weight",
"paint",
"mode"
] | [] | [
{
"param": "C",
"type": "bContext"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ce410f3e52dd8998b6a11f71dffce01a2e6ef6aa | DemonRem/blender | source/blender/editors/gpencil/gpencil_ops.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | ed_keymap_gpencil_editing | void | static void ed_keymap_gpencil_editing(wmKeyConfig *keyconf)
{
wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Edit Mode", 0, 0);
/* set poll callback - so that this keymap only gets enabled when stroke editmode is enabled */
keymap->poll = gp_stroke_editmode_poll;
} | /* Stroke Editing Keymap - Only when editmode is enabled */ | Stroke Editing Keymap - Only when editmode is enabled | [
"Stroke",
"Editing",
"Keymap",
"-",
"Only",
"when",
"editmode",
"is",
"enabled"
] | static void ed_keymap_gpencil_editing(wmKeyConfig *keyconf)
{
wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Edit Mode", 0, 0);
keymap->poll = gp_stroke_editmode_poll;
} | [
"static",
"void",
"ed_keymap_gpencil_editing",
"(",
"wmKeyConfig",
"*",
"keyconf",
")",
"{",
"wmKeyMap",
"*",
"keymap",
"=",
"WM_keymap_ensure",
"(",
"keyconf",
",",
"\"",
"\"",
",",
"0",
",",
"0",
")",
";",
"keymap",
"->",
"poll",
"=",
"gp_stroke_editmode_poll",
";",
"}"
] | Stroke Editing Keymap - Only when editmode is enabled | [
"Stroke",
"Editing",
"Keymap",
"-",
"Only",
"when",
"editmode",
"is",
"enabled"
] | [
"/* set poll callback - so that this keymap only gets enabled when stroke editmode is enabled */"
] | [
{
"param": "keyconf",
"type": "wmKeyConfig"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "keyconf",
"type": "wmKeyConfig",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ce410f3e52dd8998b6a11f71dffce01a2e6ef6aa | DemonRem/blender | source/blender/editors/gpencil/gpencil_ops.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | ed_keymap_gpencil_painting_draw | void | static void ed_keymap_gpencil_painting_draw(wmKeyConfig *keyconf)
{
wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Paint (Draw brush)", 0, 0);
keymap->poll = gp_stroke_paintmode_draw_poll;
} | /* keys for draw with a drawing brush (no fill) */ | keys for draw with a drawing brush (no fill) | [
"keys",
"for",
"draw",
"with",
"a",
"drawing",
"brush",
"(",
"no",
"fill",
")"
] | static void ed_keymap_gpencil_painting_draw(wmKeyConfig *keyconf)
{
wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Paint (Draw brush)", 0, 0);
keymap->poll = gp_stroke_paintmode_draw_poll;
} | [
"static",
"void",
"ed_keymap_gpencil_painting_draw",
"(",
"wmKeyConfig",
"*",
"keyconf",
")",
"{",
"wmKeyMap",
"*",
"keymap",
"=",
"WM_keymap_ensure",
"(",
"keyconf",
",",
"\"",
"\"",
",",
"0",
",",
"0",
")",
";",
"keymap",
"->",
"poll",
"=",
"gp_stroke_paintmode_draw_poll",
";",
"}"
] | keys for draw with a drawing brush (no fill) | [
"keys",
"for",
"draw",
"with",
"a",
"drawing",
"brush",
"(",
"no",
"fill",
")"
] | [] | [
{
"param": "keyconf",
"type": "wmKeyConfig"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "keyconf",
"type": "wmKeyConfig",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ce410f3e52dd8998b6a11f71dffce01a2e6ef6aa | DemonRem/blender | source/blender/editors/gpencil/gpencil_ops.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | ed_keymap_gpencil_painting_erase | void | static void ed_keymap_gpencil_painting_erase(wmKeyConfig *keyconf)
{
wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Paint (Erase)", 0, 0);
keymap->poll = gp_stroke_paintmode_erase_poll;
} | /* keys for draw with a eraser brush (erase) */ | keys for draw with a eraser brush (erase) | [
"keys",
"for",
"draw",
"with",
"a",
"eraser",
"brush",
"(",
"erase",
")"
] | static void ed_keymap_gpencil_painting_erase(wmKeyConfig *keyconf)
{
wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Paint (Erase)", 0, 0);
keymap->poll = gp_stroke_paintmode_erase_poll;
} | [
"static",
"void",
"ed_keymap_gpencil_painting_erase",
"(",
"wmKeyConfig",
"*",
"keyconf",
")",
"{",
"wmKeyMap",
"*",
"keymap",
"=",
"WM_keymap_ensure",
"(",
"keyconf",
",",
"\"",
"\"",
",",
"0",
",",
"0",
")",
";",
"keymap",
"->",
"poll",
"=",
"gp_stroke_paintmode_erase_poll",
";",
"}"
] | keys for draw with a eraser brush (erase) | [
"keys",
"for",
"draw",
"with",
"a",
"eraser",
"brush",
"(",
"erase",
")"
] | [] | [
{
"param": "keyconf",
"type": "wmKeyConfig"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "keyconf",
"type": "wmKeyConfig",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ce410f3e52dd8998b6a11f71dffce01a2e6ef6aa | DemonRem/blender | source/blender/editors/gpencil/gpencil_ops.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | ed_keymap_gpencil_painting_fill | void | static void ed_keymap_gpencil_painting_fill(wmKeyConfig *keyconf)
{
wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Paint (Fill)", 0, 0);
keymap->poll = gp_stroke_paintmode_fill_poll;
} | /* keys for draw with a fill brush */ | keys for draw with a fill brush | [
"keys",
"for",
"draw",
"with",
"a",
"fill",
"brush"
] | static void ed_keymap_gpencil_painting_fill(wmKeyConfig *keyconf)
{
wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Paint (Fill)", 0, 0);
keymap->poll = gp_stroke_paintmode_fill_poll;
} | [
"static",
"void",
"ed_keymap_gpencil_painting_fill",
"(",
"wmKeyConfig",
"*",
"keyconf",
")",
"{",
"wmKeyMap",
"*",
"keymap",
"=",
"WM_keymap_ensure",
"(",
"keyconf",
",",
"\"",
"\"",
",",
"0",
",",
"0",
")",
";",
"keymap",
"->",
"poll",
"=",
"gp_stroke_paintmode_fill_poll",
";",
"}"
] | keys for draw with a fill brush | [
"keys",
"for",
"draw",
"with",
"a",
"fill",
"brush"
] | [] | [
{
"param": "keyconf",
"type": "wmKeyConfig"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "keyconf",
"type": "wmKeyConfig",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ce410f3e52dd8998b6a11f71dffce01a2e6ef6aa | DemonRem/blender | source/blender/editors/gpencil/gpencil_ops.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | ed_keymap_gpencil_painting | void | static void ed_keymap_gpencil_painting(wmKeyConfig *keyconf)
{
/* set poll callback - so that this keymap only gets enabled when stroke paintmode is enabled */
wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Paint Mode", 0, 0);
keymap->poll = gp_stroke_paintmode_poll;
} | /* Stroke Painting Keymap - Only when paintmode is enabled */ | Stroke Painting Keymap - Only when paintmode is enabled | [
"Stroke",
"Painting",
"Keymap",
"-",
"Only",
"when",
"paintmode",
"is",
"enabled"
] | static void ed_keymap_gpencil_painting(wmKeyConfig *keyconf)
{
wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Paint Mode", 0, 0);
keymap->poll = gp_stroke_paintmode_poll;
} | [
"static",
"void",
"ed_keymap_gpencil_painting",
"(",
"wmKeyConfig",
"*",
"keyconf",
")",
"{",
"wmKeyMap",
"*",
"keymap",
"=",
"WM_keymap_ensure",
"(",
"keyconf",
",",
"\"",
"\"",
",",
"0",
",",
"0",
")",
";",
"keymap",
"->",
"poll",
"=",
"gp_stroke_paintmode_poll",
";",
"}"
] | Stroke Painting Keymap - Only when paintmode is enabled | [
"Stroke",
"Painting",
"Keymap",
"-",
"Only",
"when",
"paintmode",
"is",
"enabled"
] | [
"/* set poll callback - so that this keymap only gets enabled when stroke paintmode is enabled */"
] | [
{
"param": "keyconf",
"type": "wmKeyConfig"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "keyconf",
"type": "wmKeyConfig",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ce410f3e52dd8998b6a11f71dffce01a2e6ef6aa | DemonRem/blender | source/blender/editors/gpencil/gpencil_ops.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | ed_keymap_gpencil_sculpting | void | static void ed_keymap_gpencil_sculpting(wmKeyConfig *keyconf)
{
/* set poll callback - so that this keymap only gets enabled when stroke sculptmode is enabled */
wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Sculpt Mode", 0, 0);
keymap->poll = gp_stroke_sculptmode_poll;
} | /* Stroke Sculpting Keymap - Only when sculptmode is enabled */ | Stroke Sculpting Keymap - Only when sculptmode is enabled | [
"Stroke",
"Sculpting",
"Keymap",
"-",
"Only",
"when",
"sculptmode",
"is",
"enabled"
] | static void ed_keymap_gpencil_sculpting(wmKeyConfig *keyconf)
{
wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Sculpt Mode", 0, 0);
keymap->poll = gp_stroke_sculptmode_poll;
} | [
"static",
"void",
"ed_keymap_gpencil_sculpting",
"(",
"wmKeyConfig",
"*",
"keyconf",
")",
"{",
"wmKeyMap",
"*",
"keymap",
"=",
"WM_keymap_ensure",
"(",
"keyconf",
",",
"\"",
"\"",
",",
"0",
",",
"0",
")",
";",
"keymap",
"->",
"poll",
"=",
"gp_stroke_sculptmode_poll",
";",
"}"
] | Stroke Sculpting Keymap - Only when sculptmode is enabled | [
"Stroke",
"Sculpting",
"Keymap",
"-",
"Only",
"when",
"sculptmode",
"is",
"enabled"
] | [
"/* set poll callback - so that this keymap only gets enabled when stroke sculptmode is enabled */"
] | [
{
"param": "keyconf",
"type": "wmKeyConfig"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "keyconf",
"type": "wmKeyConfig",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ce410f3e52dd8998b6a11f71dffce01a2e6ef6aa | DemonRem/blender | source/blender/editors/gpencil/gpencil_ops.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | ed_keymap_gpencil_weightpainting | void | static void ed_keymap_gpencil_weightpainting(wmKeyConfig *keyconf)
{
/* set poll callback - so that this keymap only gets enabled when stroke sculptmode is enabled */
wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Weight Mode", 0, 0);
keymap->poll = gp_stroke_weightmode_poll;
} | /* Stroke Weight Paint Keymap - Only when weight is enabled */ | Stroke Weight Paint Keymap - Only when weight is enabled | [
"Stroke",
"Weight",
"Paint",
"Keymap",
"-",
"Only",
"when",
"weight",
"is",
"enabled"
] | static void ed_keymap_gpencil_weightpainting(wmKeyConfig *keyconf)
{
wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Weight Mode", 0, 0);
keymap->poll = gp_stroke_weightmode_poll;
} | [
"static",
"void",
"ed_keymap_gpencil_weightpainting",
"(",
"wmKeyConfig",
"*",
"keyconf",
")",
"{",
"wmKeyMap",
"*",
"keymap",
"=",
"WM_keymap_ensure",
"(",
"keyconf",
",",
"\"",
"\"",
",",
"0",
",",
"0",
")",
";",
"keymap",
"->",
"poll",
"=",
"gp_stroke_weightmode_poll",
";",
"}"
] | Stroke Weight Paint Keymap - Only when weight is enabled | [
"Stroke",
"Weight",
"Paint",
"Keymap",
"-",
"Only",
"when",
"weight",
"is",
"enabled"
] | [
"/* set poll callback - so that this keymap only gets enabled when stroke sculptmode is enabled */"
] | [
{
"param": "keyconf",
"type": "wmKeyConfig"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "keyconf",
"type": "wmKeyConfig",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
fbac9e6b773ec9d73709e9911960a43cff55b585 | DemonRem/blender | source/blender/blenkernel/intern/appdir.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | BKE_appdir_folder_default | char | const char *BKE_appdir_folder_default(void)
{
#ifndef WIN32
const char *const xdg_documents_dir = BLI_getenv("XDG_DOCUMENTS_DIR");
if (xdg_documents_dir) {
return xdg_documents_dir;
}
return BLI_getenv("HOME");
#else /* Windows */
static char documentfolder[MAXPATHLEN];
HRESULT hResult;
/* Check for %HOME% env var */
if (uput_getenv("HOME", documentfolder, MAXPATHLEN)) {
if (BLI_is_dir(documentfolder)) {
return documentfolder;
}
}
/* add user profile support for WIN 2K / NT.
* This is %APPDATA%, which translates to either
* %USERPROFILE%\Application Data or since Vista
* to %USERPROFILE%\AppData\Roaming
*/
hResult = SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, documentfolder);
if (hResult == S_OK) {
if (BLI_is_dir(documentfolder)) {
return documentfolder;
}
}
return NULL;
#endif /* WIN32 */
} | /* This is now only used to really get the user's default document folder */
/* On Windows I chose the 'Users/<MyUserName>/Documents' since it's used
* as default location to save documents */ | This is now only used to really get the user's default document folder
On Windows I chose the 'Users//Documents' since it's used
as default location to save documents | [
"This",
"is",
"now",
"only",
"used",
"to",
"really",
"get",
"the",
"user",
"'",
"s",
"default",
"document",
"folder",
"On",
"Windows",
"I",
"chose",
"the",
"'",
"Users",
"//",
"Documents",
"'",
"since",
"it",
"'",
"s",
"used",
"as",
"default",
"location",
"to",
"save",
"documents"
] | const char *BKE_appdir_folder_default(void)
{
#ifndef WIN32
const char *const xdg_documents_dir = BLI_getenv("XDG_DOCUMENTS_DIR");
if (xdg_documents_dir) {
return xdg_documents_dir;
}
return BLI_getenv("HOME");
#else
static char documentfolder[MAXPATHLEN];
HRESULT hResult;
if (uput_getenv("HOME", documentfolder, MAXPATHLEN)) {
if (BLI_is_dir(documentfolder)) {
return documentfolder;
}
}
hResult = SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, documentfolder);
if (hResult == S_OK) {
if (BLI_is_dir(documentfolder)) {
return documentfolder;
}
}
return NULL;
#endif
} | [
"const",
"char",
"*",
"BKE_appdir_folder_default",
"(",
"void",
")",
"{",
"#ifndef",
"WIN32",
"const",
"char",
"*",
"const",
"xdg_documents_dir",
"=",
"BLI_getenv",
"(",
"\"",
"\"",
")",
";",
"if",
"(",
"xdg_documents_dir",
")",
"{",
"return",
"xdg_documents_dir",
";",
"}",
"return",
"BLI_getenv",
"(",
"\"",
"\"",
")",
";",
"#else",
"static",
"char",
"documentfolder",
"[",
"MAXPATHLEN",
"]",
";",
"HRESULT",
"hResult",
";",
"if",
"(",
"uput_getenv",
"(",
"\"",
"\"",
",",
"documentfolder",
",",
"MAXPATHLEN",
")",
")",
"{",
"if",
"(",
"BLI_is_dir",
"(",
"documentfolder",
")",
")",
"{",
"return",
"documentfolder",
";",
"}",
"}",
"hResult",
"=",
"SHGetFolderPath",
"(",
"NULL",
",",
"CSIDL_PERSONAL",
",",
"NULL",
",",
"SHGFP_TYPE_CURRENT",
",",
"documentfolder",
")",
";",
"if",
"(",
"hResult",
"==",
"S_OK",
")",
"{",
"if",
"(",
"BLI_is_dir",
"(",
"documentfolder",
")",
")",
"{",
"return",
"documentfolder",
";",
"}",
"}",
"return",
"NULL",
";",
"#endif",
"}"
] | This is now only used to really get the user's default document folder
On Windows I chose the 'Users/<MyUserName>/Documents' since it's used
as default location to save documents | [
"This",
"is",
"now",
"only",
"used",
"to",
"really",
"get",
"the",
"user",
"'",
"s",
"default",
"document",
"folder",
"On",
"Windows",
"I",
"chose",
"the",
"'",
"Users",
"/",
"<MyUserName",
">",
"/",
"Documents",
"'",
"since",
"it",
"'",
"s",
"used",
"as",
"default",
"location",
"to",
"save",
"documents"
] | [
"/* Windows */",
"/* Check for %HOME% env var */",
"/* add user profile support for WIN 2K / NT.\n * This is %APPDATA%, which translates to either\n * %USERPROFILE%\\Application Data or since Vista\n * to %USERPROFILE%\\AppData\\Roaming\n */",
"/* WIN32 */"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
fbac9e6b773ec9d73709e9911960a43cff55b585 | DemonRem/blender | source/blender/blenkernel/intern/appdir.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | blender_version_decimal | char | static char *blender_version_decimal(const int ver)
{
static char version_str[5];
BLI_assert(ver < 1000);
BLI_snprintf(version_str, sizeof(version_str), "%d.%02d", ver / 100, ver % 100);
return version_str;
} | /* returns a formatted representation of the specified version number. Non-re-entrant! */ | returns a formatted representation of the specified version number. Non-re-entrant! | [
"returns",
"a",
"formatted",
"representation",
"of",
"the",
"specified",
"version",
"number",
".",
"Non",
"-",
"re",
"-",
"entrant!"
] | static char *blender_version_decimal(const int ver)
{
static char version_str[5];
BLI_assert(ver < 1000);
BLI_snprintf(version_str, sizeof(version_str), "%d.%02d", ver / 100, ver % 100);
return version_str;
} | [
"static",
"char",
"*",
"blender_version_decimal",
"(",
"const",
"int",
"ver",
")",
"{",
"static",
"char",
"version_str",
"[",
"5",
"]",
";",
"BLI_assert",
"(",
"ver",
"<",
"1000",
")",
";",
"BLI_snprintf",
"(",
"version_str",
",",
"sizeof",
"(",
"version_str",
")",
",",
"\"",
"\"",
",",
"ver",
"/",
"100",
",",
"ver",
"%",
"100",
")",
";",
"return",
"version_str",
";",
"}"
] | returns a formatted representation of the specified version number. | [
"returns",
"a",
"formatted",
"representation",
"of",
"the",
"specified",
"version",
"number",
"."
] | [] | [
{
"param": "ver",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ver",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
fbac9e6b773ec9d73709e9911960a43cff55b585 | DemonRem/blender | source/blender/blenkernel/intern/appdir.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | BKE_appdir_folder_id_ex | char | const char *BKE_appdir_folder_id_ex(const int folder_id,
const char *subfolder,
char *path,
size_t path_len)
{
const int ver = BLENDER_VERSION;
switch (folder_id) {
case BLENDER_DATAFILES: /* general case */
if (get_path_environment(path, path_len, subfolder, "BLENDER_USER_DATAFILES")) {
break;
}
if (get_path_user(path, path_len, "datafiles", subfolder, ver)) {
break;
}
if (get_path_environment(path, path_len, subfolder, "BLENDER_SYSTEM_DATAFILES")) {
break;
}
if (get_path_local(path, path_len, "datafiles", subfolder, ver)) {
break;
}
if (get_path_system(path, path_len, "datafiles", subfolder, ver)) {
break;
}
return NULL;
case BLENDER_USER_DATAFILES:
if (get_path_environment(path, path_len, subfolder, "BLENDER_USER_DATAFILES")) {
break;
}
if (get_path_user(path, path_len, "datafiles", subfolder, ver)) {
break;
}
return NULL;
case BLENDER_SYSTEM_DATAFILES:
if (get_path_environment(path, path_len, subfolder, "BLENDER_SYSTEM_DATAFILES")) {
break;
}
if (get_path_system(path, path_len, "datafiles", subfolder, ver)) {
break;
}
if (get_path_local(path, path_len, "datafiles", subfolder, ver)) {
break;
}
return NULL;
case BLENDER_USER_AUTOSAVE:
if (get_path_environment(path, path_len, subfolder, "BLENDER_USER_DATAFILES")) {
break;
}
if (get_path_user(path, path_len, "autosave", subfolder, ver)) {
break;
}
return NULL;
case BLENDER_USER_CONFIG:
if (get_path_environment(path, path_len, subfolder, "BLENDER_USER_CONFIG")) {
break;
}
if (get_path_user(path, path_len, "config", subfolder, ver)) {
break;
}
return NULL;
case BLENDER_USER_SCRIPTS:
if (get_path_environment(path, path_len, subfolder, "BLENDER_USER_SCRIPTS")) {
break;
}
if (get_path_user(path, path_len, "scripts", subfolder, ver)) {
break;
}
return NULL;
case BLENDER_SYSTEM_SCRIPTS:
if (get_path_environment(path, path_len, subfolder, "BLENDER_SYSTEM_SCRIPTS")) {
break;
}
if (get_path_system(path, path_len, "scripts", subfolder, ver)) {
break;
}
if (get_path_local(path, path_len, "scripts", subfolder, ver)) {
break;
}
return NULL;
case BLENDER_SYSTEM_PYTHON:
if (get_path_environment(path, path_len, subfolder, "BLENDER_SYSTEM_PYTHON")) {
break;
}
if (get_path_system(path, path_len, "python", subfolder, ver)) {
break;
}
if (get_path_local(path, path_len, "python", subfolder, ver)) {
break;
}
return NULL;
default:
BLI_assert(0);
break;
}
return path;
} | /**
* Get a folder out of the 'folder_id' presets for paths.
* returns the path if found, NULL string if not
*
* \param subfolder: The name of a directory to check for,
* this may contain path separators but must resolve to a directory, checked with #BLI_is_dir.
*/ | Get a folder out of the 'folder_id' presets for paths.
returns the path if found, NULL string if not
\param subfolder: The name of a directory to check for,
this may contain path separators but must resolve to a directory, checked with #BLI_is_dir. | [
"Get",
"a",
"folder",
"out",
"of",
"the",
"'",
"folder_id",
"'",
"presets",
"for",
"paths",
".",
"returns",
"the",
"path",
"if",
"found",
"NULL",
"string",
"if",
"not",
"\\",
"param",
"subfolder",
":",
"The",
"name",
"of",
"a",
"directory",
"to",
"check",
"for",
"this",
"may",
"contain",
"path",
"separators",
"but",
"must",
"resolve",
"to",
"a",
"directory",
"checked",
"with",
"#BLI_is_dir",
"."
] | const char *BKE_appdir_folder_id_ex(const int folder_id,
const char *subfolder,
char *path,
size_t path_len)
{
const int ver = BLENDER_VERSION;
switch (folder_id) {
case BLENDER_DATAFILES:
if (get_path_environment(path, path_len, subfolder, "BLENDER_USER_DATAFILES")) {
break;
}
if (get_path_user(path, path_len, "datafiles", subfolder, ver)) {
break;
}
if (get_path_environment(path, path_len, subfolder, "BLENDER_SYSTEM_DATAFILES")) {
break;
}
if (get_path_local(path, path_len, "datafiles", subfolder, ver)) {
break;
}
if (get_path_system(path, path_len, "datafiles", subfolder, ver)) {
break;
}
return NULL;
case BLENDER_USER_DATAFILES:
if (get_path_environment(path, path_len, subfolder, "BLENDER_USER_DATAFILES")) {
break;
}
if (get_path_user(path, path_len, "datafiles", subfolder, ver)) {
break;
}
return NULL;
case BLENDER_SYSTEM_DATAFILES:
if (get_path_environment(path, path_len, subfolder, "BLENDER_SYSTEM_DATAFILES")) {
break;
}
if (get_path_system(path, path_len, "datafiles", subfolder, ver)) {
break;
}
if (get_path_local(path, path_len, "datafiles", subfolder, ver)) {
break;
}
return NULL;
case BLENDER_USER_AUTOSAVE:
if (get_path_environment(path, path_len, subfolder, "BLENDER_USER_DATAFILES")) {
break;
}
if (get_path_user(path, path_len, "autosave", subfolder, ver)) {
break;
}
return NULL;
case BLENDER_USER_CONFIG:
if (get_path_environment(path, path_len, subfolder, "BLENDER_USER_CONFIG")) {
break;
}
if (get_path_user(path, path_len, "config", subfolder, ver)) {
break;
}
return NULL;
case BLENDER_USER_SCRIPTS:
if (get_path_environment(path, path_len, subfolder, "BLENDER_USER_SCRIPTS")) {
break;
}
if (get_path_user(path, path_len, "scripts", subfolder, ver)) {
break;
}
return NULL;
case BLENDER_SYSTEM_SCRIPTS:
if (get_path_environment(path, path_len, subfolder, "BLENDER_SYSTEM_SCRIPTS")) {
break;
}
if (get_path_system(path, path_len, "scripts", subfolder, ver)) {
break;
}
if (get_path_local(path, path_len, "scripts", subfolder, ver)) {
break;
}
return NULL;
case BLENDER_SYSTEM_PYTHON:
if (get_path_environment(path, path_len, subfolder, "BLENDER_SYSTEM_PYTHON")) {
break;
}
if (get_path_system(path, path_len, "python", subfolder, ver)) {
break;
}
if (get_path_local(path, path_len, "python", subfolder, ver)) {
break;
}
return NULL;
default:
BLI_assert(0);
break;
}
return path;
} | [
"const",
"char",
"*",
"BKE_appdir_folder_id_ex",
"(",
"const",
"int",
"folder_id",
",",
"const",
"char",
"*",
"subfolder",
",",
"char",
"*",
"path",
",",
"size_t",
"path_len",
")",
"{",
"const",
"int",
"ver",
"=",
"BLENDER_VERSION",
";",
"switch",
"(",
"folder_id",
")",
"{",
"case",
"BLENDER_DATAFILES",
":",
"if",
"(",
"get_path_environment",
"(",
"path",
",",
"path_len",
",",
"subfolder",
",",
"\"",
"\"",
")",
")",
"{",
"break",
";",
"}",
"if",
"(",
"get_path_user",
"(",
"path",
",",
"path_len",
",",
"\"",
"\"",
",",
"subfolder",
",",
"ver",
")",
")",
"{",
"break",
";",
"}",
"if",
"(",
"get_path_environment",
"(",
"path",
",",
"path_len",
",",
"subfolder",
",",
"\"",
"\"",
")",
")",
"{",
"break",
";",
"}",
"if",
"(",
"get_path_local",
"(",
"path",
",",
"path_len",
",",
"\"",
"\"",
",",
"subfolder",
",",
"ver",
")",
")",
"{",
"break",
";",
"}",
"if",
"(",
"get_path_system",
"(",
"path",
",",
"path_len",
",",
"\"",
"\"",
",",
"subfolder",
",",
"ver",
")",
")",
"{",
"break",
";",
"}",
"return",
"NULL",
";",
"case",
"BLENDER_USER_DATAFILES",
":",
"if",
"(",
"get_path_environment",
"(",
"path",
",",
"path_len",
",",
"subfolder",
",",
"\"",
"\"",
")",
")",
"{",
"break",
";",
"}",
"if",
"(",
"get_path_user",
"(",
"path",
",",
"path_len",
",",
"\"",
"\"",
",",
"subfolder",
",",
"ver",
")",
")",
"{",
"break",
";",
"}",
"return",
"NULL",
";",
"case",
"BLENDER_SYSTEM_DATAFILES",
":",
"if",
"(",
"get_path_environment",
"(",
"path",
",",
"path_len",
",",
"subfolder",
",",
"\"",
"\"",
")",
")",
"{",
"break",
";",
"}",
"if",
"(",
"get_path_system",
"(",
"path",
",",
"path_len",
",",
"\"",
"\"",
",",
"subfolder",
",",
"ver",
")",
")",
"{",
"break",
";",
"}",
"if",
"(",
"get_path_local",
"(",
"path",
",",
"path_len",
",",
"\"",
"\"",
",",
"subfolder",
",",
"ver",
")",
")",
"{",
"break",
";",
"}",
"return",
"NULL",
";",
"case",
"BLENDER_USER_AUTOSAVE",
":",
"if",
"(",
"get_path_environment",
"(",
"path",
",",
"path_len",
",",
"subfolder",
",",
"\"",
"\"",
")",
")",
"{",
"break",
";",
"}",
"if",
"(",
"get_path_user",
"(",
"path",
",",
"path_len",
",",
"\"",
"\"",
",",
"subfolder",
",",
"ver",
")",
")",
"{",
"break",
";",
"}",
"return",
"NULL",
";",
"case",
"BLENDER_USER_CONFIG",
":",
"if",
"(",
"get_path_environment",
"(",
"path",
",",
"path_len",
",",
"subfolder",
",",
"\"",
"\"",
")",
")",
"{",
"break",
";",
"}",
"if",
"(",
"get_path_user",
"(",
"path",
",",
"path_len",
",",
"\"",
"\"",
",",
"subfolder",
",",
"ver",
")",
")",
"{",
"break",
";",
"}",
"return",
"NULL",
";",
"case",
"BLENDER_USER_SCRIPTS",
":",
"if",
"(",
"get_path_environment",
"(",
"path",
",",
"path_len",
",",
"subfolder",
",",
"\"",
"\"",
")",
")",
"{",
"break",
";",
"}",
"if",
"(",
"get_path_user",
"(",
"path",
",",
"path_len",
",",
"\"",
"\"",
",",
"subfolder",
",",
"ver",
")",
")",
"{",
"break",
";",
"}",
"return",
"NULL",
";",
"case",
"BLENDER_SYSTEM_SCRIPTS",
":",
"if",
"(",
"get_path_environment",
"(",
"path",
",",
"path_len",
",",
"subfolder",
",",
"\"",
"\"",
")",
")",
"{",
"break",
";",
"}",
"if",
"(",
"get_path_system",
"(",
"path",
",",
"path_len",
",",
"\"",
"\"",
",",
"subfolder",
",",
"ver",
")",
")",
"{",
"break",
";",
"}",
"if",
"(",
"get_path_local",
"(",
"path",
",",
"path_len",
",",
"\"",
"\"",
",",
"subfolder",
",",
"ver",
")",
")",
"{",
"break",
";",
"}",
"return",
"NULL",
";",
"case",
"BLENDER_SYSTEM_PYTHON",
":",
"if",
"(",
"get_path_environment",
"(",
"path",
",",
"path_len",
",",
"subfolder",
",",
"\"",
"\"",
")",
")",
"{",
"break",
";",
"}",
"if",
"(",
"get_path_system",
"(",
"path",
",",
"path_len",
",",
"\"",
"\"",
",",
"subfolder",
",",
"ver",
")",
")",
"{",
"break",
";",
"}",
"if",
"(",
"get_path_local",
"(",
"path",
",",
"path_len",
",",
"\"",
"\"",
",",
"subfolder",
",",
"ver",
")",
")",
"{",
"break",
";",
"}",
"return",
"NULL",
";",
"default",
":",
"BLI_assert",
"(",
"0",
")",
";",
"break",
";",
"}",
"return",
"path",
";",
"}"
] | Get a folder out of the 'folder_id' presets for paths. | [
"Get",
"a",
"folder",
"out",
"of",
"the",
"'",
"folder_id",
"'",
"presets",
"for",
"paths",
"."
] | [
"/* general case */"
] | [
{
"param": "folder_id",
"type": "int"
},
{
"param": "subfolder",
"type": "char"
},
{
"param": "path",
"type": "char"
},
{
"param": "path_len",
"type": "size_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "folder_id",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "subfolder",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "path",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "path_len",
"type": "size_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
fbac9e6b773ec9d73709e9911960a43cff55b585 | DemonRem/blender | source/blender/blenkernel/intern/appdir.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | BKE_appdir_folder_id_user_notest | char | const char *BKE_appdir_folder_id_user_notest(const int folder_id, const char *subfolder)
{
const int ver = BLENDER_VERSION;
static char path[FILE_MAX] = "";
switch (folder_id) {
case BLENDER_USER_DATAFILES:
if (get_path_environment_notest(path, sizeof(path), subfolder, "BLENDER_USER_DATAFILES")) {
break;
}
get_path_user(path, sizeof(path), "datafiles", subfolder, ver);
break;
case BLENDER_USER_CONFIG:
if (get_path_environment_notest(path, sizeof(path), subfolder, "BLENDER_USER_CONFIG")) {
break;
}
get_path_user(path, sizeof(path), "config", subfolder, ver);
break;
case BLENDER_USER_AUTOSAVE:
if (get_path_environment_notest(path, sizeof(path), subfolder, "BLENDER_USER_AUTOSAVE")) {
break;
}
get_path_user(path, sizeof(path), "autosave", subfolder, ver);
break;
case BLENDER_USER_SCRIPTS:
if (get_path_environment_notest(path, sizeof(path), subfolder, "BLENDER_USER_SCRIPTS")) {
break;
}
get_path_user(path, sizeof(path), "scripts", subfolder, ver);
break;
default:
BLI_assert(0);
break;
}
if ('\0' == path[0]) {
return NULL;
}
return path;
} | /**
* Returns the path to a folder in the user area without checking that it actually exists first.
*/ | Returns the path to a folder in the user area without checking that it actually exists first. | [
"Returns",
"the",
"path",
"to",
"a",
"folder",
"in",
"the",
"user",
"area",
"without",
"checking",
"that",
"it",
"actually",
"exists",
"first",
"."
] | const char *BKE_appdir_folder_id_user_notest(const int folder_id, const char *subfolder)
{
const int ver = BLENDER_VERSION;
static char path[FILE_MAX] = "";
switch (folder_id) {
case BLENDER_USER_DATAFILES:
if (get_path_environment_notest(path, sizeof(path), subfolder, "BLENDER_USER_DATAFILES")) {
break;
}
get_path_user(path, sizeof(path), "datafiles", subfolder, ver);
break;
case BLENDER_USER_CONFIG:
if (get_path_environment_notest(path, sizeof(path), subfolder, "BLENDER_USER_CONFIG")) {
break;
}
get_path_user(path, sizeof(path), "config", subfolder, ver);
break;
case BLENDER_USER_AUTOSAVE:
if (get_path_environment_notest(path, sizeof(path), subfolder, "BLENDER_USER_AUTOSAVE")) {
break;
}
get_path_user(path, sizeof(path), "autosave", subfolder, ver);
break;
case BLENDER_USER_SCRIPTS:
if (get_path_environment_notest(path, sizeof(path), subfolder, "BLENDER_USER_SCRIPTS")) {
break;
}
get_path_user(path, sizeof(path), "scripts", subfolder, ver);
break;
default:
BLI_assert(0);
break;
}
if ('\0' == path[0]) {
return NULL;
}
return path;
} | [
"const",
"char",
"*",
"BKE_appdir_folder_id_user_notest",
"(",
"const",
"int",
"folder_id",
",",
"const",
"char",
"*",
"subfolder",
")",
"{",
"const",
"int",
"ver",
"=",
"BLENDER_VERSION",
";",
"static",
"char",
"path",
"[",
"FILE_MAX",
"]",
"=",
"\"",
"\"",
";",
"switch",
"(",
"folder_id",
")",
"{",
"case",
"BLENDER_USER_DATAFILES",
":",
"if",
"(",
"get_path_environment_notest",
"(",
"path",
",",
"sizeof",
"(",
"path",
")",
",",
"subfolder",
",",
"\"",
"\"",
")",
")",
"{",
"break",
";",
"}",
"get_path_user",
"(",
"path",
",",
"sizeof",
"(",
"path",
")",
",",
"\"",
"\"",
",",
"subfolder",
",",
"ver",
")",
";",
"break",
";",
"case",
"BLENDER_USER_CONFIG",
":",
"if",
"(",
"get_path_environment_notest",
"(",
"path",
",",
"sizeof",
"(",
"path",
")",
",",
"subfolder",
",",
"\"",
"\"",
")",
")",
"{",
"break",
";",
"}",
"get_path_user",
"(",
"path",
",",
"sizeof",
"(",
"path",
")",
",",
"\"",
"\"",
",",
"subfolder",
",",
"ver",
")",
";",
"break",
";",
"case",
"BLENDER_USER_AUTOSAVE",
":",
"if",
"(",
"get_path_environment_notest",
"(",
"path",
",",
"sizeof",
"(",
"path",
")",
",",
"subfolder",
",",
"\"",
"\"",
")",
")",
"{",
"break",
";",
"}",
"get_path_user",
"(",
"path",
",",
"sizeof",
"(",
"path",
")",
",",
"\"",
"\"",
",",
"subfolder",
",",
"ver",
")",
";",
"break",
";",
"case",
"BLENDER_USER_SCRIPTS",
":",
"if",
"(",
"get_path_environment_notest",
"(",
"path",
",",
"sizeof",
"(",
"path",
")",
",",
"subfolder",
",",
"\"",
"\"",
")",
")",
"{",
"break",
";",
"}",
"get_path_user",
"(",
"path",
",",
"sizeof",
"(",
"path",
")",
",",
"\"",
"\"",
",",
"subfolder",
",",
"ver",
")",
";",
"break",
";",
"default",
":",
"BLI_assert",
"(",
"0",
")",
";",
"break",
";",
"}",
"if",
"(",
"'",
"\\0",
"'",
"==",
"path",
"[",
"0",
"]",
")",
"{",
"return",
"NULL",
";",
"}",
"return",
"path",
";",
"}"
] | Returns the path to a folder in the user area without checking that it actually exists first. | [
"Returns",
"the",
"path",
"to",
"a",
"folder",
"in",
"the",
"user",
"area",
"without",
"checking",
"that",
"it",
"actually",
"exists",
"first",
"."
] | [] | [
{
"param": "folder_id",
"type": "int"
},
{
"param": "subfolder",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "folder_id",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "subfolder",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
fbac9e6b773ec9d73709e9911960a43cff55b585 | DemonRem/blender | source/blender/blenkernel/intern/appdir.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | BKE_appdir_folder_id_create | char | const char *BKE_appdir_folder_id_create(const int folder_id, const char *subfolder)
{
const char *path;
/* only for user folders */
if (!ELEM(folder_id,
BLENDER_USER_DATAFILES,
BLENDER_USER_CONFIG,
BLENDER_USER_SCRIPTS,
BLENDER_USER_AUTOSAVE)) {
return NULL;
}
path = BKE_appdir_folder_id(folder_id, subfolder);
if (!path) {
path = BKE_appdir_folder_id_user_notest(folder_id, subfolder);
if (path) {
BLI_dir_create_recursive(path);
}
}
return path;
} | /**
* Returns the path to a folder in the user area, creating it if it doesn't exist.
*/ | Returns the path to a folder in the user area, creating it if it doesn't exist. | [
"Returns",
"the",
"path",
"to",
"a",
"folder",
"in",
"the",
"user",
"area",
"creating",
"it",
"if",
"it",
"doesn",
"'",
"t",
"exist",
"."
] | const char *BKE_appdir_folder_id_create(const int folder_id, const char *subfolder)
{
const char *path;
if (!ELEM(folder_id,
BLENDER_USER_DATAFILES,
BLENDER_USER_CONFIG,
BLENDER_USER_SCRIPTS,
BLENDER_USER_AUTOSAVE)) {
return NULL;
}
path = BKE_appdir_folder_id(folder_id, subfolder);
if (!path) {
path = BKE_appdir_folder_id_user_notest(folder_id, subfolder);
if (path) {
BLI_dir_create_recursive(path);
}
}
return path;
} | [
"const",
"char",
"*",
"BKE_appdir_folder_id_create",
"(",
"const",
"int",
"folder_id",
",",
"const",
"char",
"*",
"subfolder",
")",
"{",
"const",
"char",
"*",
"path",
";",
"if",
"(",
"!",
"ELEM",
"(",
"folder_id",
",",
"BLENDER_USER_DATAFILES",
",",
"BLENDER_USER_CONFIG",
",",
"BLENDER_USER_SCRIPTS",
",",
"BLENDER_USER_AUTOSAVE",
")",
")",
"{",
"return",
"NULL",
";",
"}",
"path",
"=",
"BKE_appdir_folder_id",
"(",
"folder_id",
",",
"subfolder",
")",
";",
"if",
"(",
"!",
"path",
")",
"{",
"path",
"=",
"BKE_appdir_folder_id_user_notest",
"(",
"folder_id",
",",
"subfolder",
")",
";",
"if",
"(",
"path",
")",
"{",
"BLI_dir_create_recursive",
"(",
"path",
")",
";",
"}",
"}",
"return",
"path",
";",
"}"
] | Returns the path to a folder in the user area, creating it if it doesn't exist. | [
"Returns",
"the",
"path",
"to",
"a",
"folder",
"in",
"the",
"user",
"area",
"creating",
"it",
"if",
"it",
"doesn",
"'",
"t",
"exist",
"."
] | [
"/* only for user folders */"
] | [
{
"param": "folder_id",
"type": "int"
},
{
"param": "subfolder",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "folder_id",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "subfolder",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
fbac9e6b773ec9d73709e9911960a43cff55b585 | DemonRem/blender | source/blender/blenkernel/intern/appdir.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | BKE_appdir_folder_id_version | char | const char *BKE_appdir_folder_id_version(const int folder_id, const int ver, const bool do_check)
{
static char path[FILE_MAX] = "";
bool ok;
switch (folder_id) {
case BLENDER_RESOURCE_PATH_USER:
ok = get_path_user(path, sizeof(path), NULL, NULL, ver);
break;
case BLENDER_RESOURCE_PATH_LOCAL:
ok = get_path_local(path, sizeof(path), NULL, NULL, ver);
break;
case BLENDER_RESOURCE_PATH_SYSTEM:
ok = get_path_system(path, sizeof(path), NULL, NULL, ver);
break;
default:
path[0] = '\0'; /* in case do_check is false */
ok = false;
BLI_assert(!"incorrect ID");
break;
}
if (!ok && do_check) {
return NULL;
}
return path;
} | /**
* Returns the path of the top-level version-specific local, user or system directory.
* If do_check, then the result will be NULL if the directory doesn't exist.
*/ | Returns the path of the top-level version-specific local, user or system directory.
If do_check, then the result will be NULL if the directory doesn't exist. | [
"Returns",
"the",
"path",
"of",
"the",
"top",
"-",
"level",
"version",
"-",
"specific",
"local",
"user",
"or",
"system",
"directory",
".",
"If",
"do_check",
"then",
"the",
"result",
"will",
"be",
"NULL",
"if",
"the",
"directory",
"doesn",
"'",
"t",
"exist",
"."
] | const char *BKE_appdir_folder_id_version(const int folder_id, const int ver, const bool do_check)
{
static char path[FILE_MAX] = "";
bool ok;
switch (folder_id) {
case BLENDER_RESOURCE_PATH_USER:
ok = get_path_user(path, sizeof(path), NULL, NULL, ver);
break;
case BLENDER_RESOURCE_PATH_LOCAL:
ok = get_path_local(path, sizeof(path), NULL, NULL, ver);
break;
case BLENDER_RESOURCE_PATH_SYSTEM:
ok = get_path_system(path, sizeof(path), NULL, NULL, ver);
break;
default:
path[0] = '\0';
ok = false;
BLI_assert(!"incorrect ID");
break;
}
if (!ok && do_check) {
return NULL;
}
return path;
} | [
"const",
"char",
"*",
"BKE_appdir_folder_id_version",
"(",
"const",
"int",
"folder_id",
",",
"const",
"int",
"ver",
",",
"const",
"bool",
"do_check",
")",
"{",
"static",
"char",
"path",
"[",
"FILE_MAX",
"]",
"=",
"\"",
"\"",
";",
"bool",
"ok",
";",
"switch",
"(",
"folder_id",
")",
"{",
"case",
"BLENDER_RESOURCE_PATH_USER",
":",
"ok",
"=",
"get_path_user",
"(",
"path",
",",
"sizeof",
"(",
"path",
")",
",",
"NULL",
",",
"NULL",
",",
"ver",
")",
";",
"break",
";",
"case",
"BLENDER_RESOURCE_PATH_LOCAL",
":",
"ok",
"=",
"get_path_local",
"(",
"path",
",",
"sizeof",
"(",
"path",
")",
",",
"NULL",
",",
"NULL",
",",
"ver",
")",
";",
"break",
";",
"case",
"BLENDER_RESOURCE_PATH_SYSTEM",
":",
"ok",
"=",
"get_path_system",
"(",
"path",
",",
"sizeof",
"(",
"path",
")",
",",
"NULL",
",",
"NULL",
",",
"ver",
")",
";",
"break",
";",
"default",
":",
"path",
"[",
"0",
"]",
"=",
"'",
"\\0",
"'",
";",
"ok",
"=",
"false",
";",
"BLI_assert",
"(",
"!",
"\"",
"\"",
")",
";",
"break",
";",
"}",
"if",
"(",
"!",
"ok",
"&&",
"do_check",
")",
"{",
"return",
"NULL",
";",
"}",
"return",
"path",
";",
"}"
] | Returns the path of the top-level version-specific local, user or system directory. | [
"Returns",
"the",
"path",
"of",
"the",
"top",
"-",
"level",
"version",
"-",
"specific",
"local",
"user",
"or",
"system",
"directory",
"."
] | [
"/* in case do_check is false */"
] | [
{
"param": "folder_id",
"type": "int"
},
{
"param": "ver",
"type": "int"
},
{
"param": "do_check",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "folder_id",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ver",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "do_check",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
fbac9e6b773ec9d73709e9911960a43cff55b585 | DemonRem/blender | source/blender/blenkernel/intern/appdir.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | where_am_i | void | static void where_am_i(char *fullname, const size_t maxlen, const char *name)
{
#ifdef WITH_BINRELOC
/* linux uses binreloc since argv[0] is not reliable, call br_init( NULL ) first */
{
const char *path = NULL;
path = br_find_exe(NULL);
if (path) {
BLI_strncpy(fullname, path, maxlen);
free((void *)path);
return;
}
}
#endif
#ifdef _WIN32
{
wchar_t *fullname_16 = MEM_mallocN(maxlen * sizeof(wchar_t), "ProgramPath");
if (GetModuleFileNameW(0, fullname_16, maxlen)) {
conv_utf_16_to_8(fullname_16, fullname, maxlen);
if (!BLI_exists(fullname)) {
CLOG_ERROR(&LOG, "path can't be found: \"%.*s\"", (int)maxlen, fullname);
MessageBox(
NULL, "path contains invalid characters or is too long (see console)", "Error", MB_OK);
}
MEM_freeN(fullname_16);
return;
}
MEM_freeN(fullname_16);
}
#endif
/* unix and non linux */
if (name && name[0]) {
BLI_strncpy(fullname, name, maxlen);
if (name[0] == '.') {
BLI_path_cwd(fullname, maxlen);
#ifdef _WIN32
BLI_path_program_extensions_add_win32(fullname, maxlen);
#endif
}
else if (BLI_last_slash(name)) {
// full path
BLI_strncpy(fullname, name, maxlen);
#ifdef _WIN32
BLI_path_program_extensions_add_win32(fullname, maxlen);
#endif
}
else {
BLI_path_program_search(fullname, maxlen, name);
}
/* Remove "/./" and "/../" so string comparisons can be used on the path. */
BLI_cleanup_path(NULL, fullname);
#if defined(DEBUG)
if (!STREQ(name, fullname)) {
CLOG_INFO(&LOG, 2, "guessing '%s' == '%s'", name, fullname);
}
#endif
}
} | /**
* Checks if name is a fully qualified filename to an executable.
* If not it searches $PATH for the file. On Windows it also
* adds the correct extension (.com .exe etc) from
* $PATHEXT if necessary. Also on Windows it translates
* the name to its 8.3 version to prevent problems with
* spaces and stuff. Final result is returned in fullname.
*
* \param fullname: The full path and full name of the executable
* (must be FILE_MAX minimum)
* \param name: The name of the executable (usually argv[0]) to be checked
*/ | Checks if name is a fully qualified filename to an executable.
If not it searches $PATH for the file. On Windows it also
adds the correct extension (.com .exe etc) from
$PATHEXT if necessary. Also on Windows it translates
the name to its 8.3 version to prevent problems with
spaces and stuff. Final result is returned in fullname.
\param fullname: The full path and full name of the executable
(must be FILE_MAX minimum)
\param name: The name of the executable (usually argv[0]) to be checked | [
"Checks",
"if",
"name",
"is",
"a",
"fully",
"qualified",
"filename",
"to",
"an",
"executable",
".",
"If",
"not",
"it",
"searches",
"$PATH",
"for",
"the",
"file",
".",
"On",
"Windows",
"it",
"also",
"adds",
"the",
"correct",
"extension",
"(",
".",
"com",
".",
"exe",
"etc",
")",
"from",
"$PATHEXT",
"if",
"necessary",
".",
"Also",
"on",
"Windows",
"it",
"translates",
"the",
"name",
"to",
"its",
"8",
".",
"3",
"version",
"to",
"prevent",
"problems",
"with",
"spaces",
"and",
"stuff",
".",
"Final",
"result",
"is",
"returned",
"in",
"fullname",
".",
"\\",
"param",
"fullname",
":",
"The",
"full",
"path",
"and",
"full",
"name",
"of",
"the",
"executable",
"(",
"must",
"be",
"FILE_MAX",
"minimum",
")",
"\\",
"param",
"name",
":",
"The",
"name",
"of",
"the",
"executable",
"(",
"usually",
"argv",
"[",
"0",
"]",
")",
"to",
"be",
"checked"
] | static void where_am_i(char *fullname, const size_t maxlen, const char *name)
{
#ifdef WITH_BINRELOC
{
const char *path = NULL;
path = br_find_exe(NULL);
if (path) {
BLI_strncpy(fullname, path, maxlen);
free((void *)path);
return;
}
}
#endif
#ifdef _WIN32
{
wchar_t *fullname_16 = MEM_mallocN(maxlen * sizeof(wchar_t), "ProgramPath");
if (GetModuleFileNameW(0, fullname_16, maxlen)) {
conv_utf_16_to_8(fullname_16, fullname, maxlen);
if (!BLI_exists(fullname)) {
CLOG_ERROR(&LOG, "path can't be found: \"%.*s\"", (int)maxlen, fullname);
MessageBox(
NULL, "path contains invalid characters or is too long (see console)", "Error", MB_OK);
}
MEM_freeN(fullname_16);
return;
}
MEM_freeN(fullname_16);
}
#endif
if (name && name[0]) {
BLI_strncpy(fullname, name, maxlen);
if (name[0] == '.') {
BLI_path_cwd(fullname, maxlen);
#ifdef _WIN32
BLI_path_program_extensions_add_win32(fullname, maxlen);
#endif
}
else if (BLI_last_slash(name)) {
BLI_strncpy(fullname, name, maxlen);
#ifdef _WIN32
BLI_path_program_extensions_add_win32(fullname, maxlen);
#endif
}
else {
BLI_path_program_search(fullname, maxlen, name);
}
BLI_cleanup_path(NULL, fullname);
#if defined(DEBUG)
if (!STREQ(name, fullname)) {
CLOG_INFO(&LOG, 2, "guessing '%s' == '%s'", name, fullname);
}
#endif
}
} | [
"static",
"void",
"where_am_i",
"(",
"char",
"*",
"fullname",
",",
"const",
"size_t",
"maxlen",
",",
"const",
"char",
"*",
"name",
")",
"{",
"#ifdef",
"WITH_BINRELOC",
"{",
"const",
"char",
"*",
"path",
"=",
"NULL",
";",
"path",
"=",
"br_find_exe",
"(",
"NULL",
")",
";",
"if",
"(",
"path",
")",
"{",
"BLI_strncpy",
"(",
"fullname",
",",
"path",
",",
"maxlen",
")",
";",
"free",
"(",
"(",
"void",
"*",
")",
"path",
")",
";",
"return",
";",
"}",
"}",
"#endif",
"#ifdef",
"_WIN32",
"{",
"wchar_t",
"*",
"fullname_16",
"=",
"MEM_mallocN",
"(",
"maxlen",
"*",
"sizeof",
"(",
"wchar_t",
")",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"GetModuleFileNameW",
"(",
"0",
",",
"fullname_16",
",",
"maxlen",
")",
")",
"{",
"conv_utf_16_to_8",
"(",
"fullname_16",
",",
"fullname",
",",
"maxlen",
")",
";",
"if",
"(",
"!",
"BLI_exists",
"(",
"fullname",
")",
")",
"{",
"CLOG_ERROR",
"(",
"&",
"LOG",
",",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"(",
"int",
")",
"maxlen",
",",
"fullname",
")",
";",
"MessageBox",
"(",
"NULL",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"MB_OK",
")",
";",
"}",
"MEM_freeN",
"(",
"fullname_16",
")",
";",
"return",
";",
"}",
"MEM_freeN",
"(",
"fullname_16",
")",
";",
"}",
"#endif",
"if",
"(",
"name",
"&&",
"name",
"[",
"0",
"]",
")",
"{",
"BLI_strncpy",
"(",
"fullname",
",",
"name",
",",
"maxlen",
")",
";",
"if",
"(",
"name",
"[",
"0",
"]",
"==",
"'",
"'",
")",
"{",
"BLI_path_cwd",
"(",
"fullname",
",",
"maxlen",
")",
";",
"#ifdef",
"_WIN32",
"BLI_path_program_extensions_add_win32",
"(",
"fullname",
",",
"maxlen",
")",
";",
"#endif",
"}",
"else",
"if",
"(",
"BLI_last_slash",
"(",
"name",
")",
")",
"{",
"BLI_strncpy",
"(",
"fullname",
",",
"name",
",",
"maxlen",
")",
";",
"#ifdef",
"_WIN32",
"BLI_path_program_extensions_add_win32",
"(",
"fullname",
",",
"maxlen",
")",
";",
"#endif",
"}",
"else",
"{",
"BLI_path_program_search",
"(",
"fullname",
",",
"maxlen",
",",
"name",
")",
";",
"}",
"BLI_cleanup_path",
"(",
"NULL",
",",
"fullname",
")",
";",
"#if",
"defined",
"(",
"DEBUG",
")",
"\n",
"if",
"(",
"!",
"STREQ",
"(",
"name",
",",
"fullname",
")",
")",
"{",
"CLOG_INFO",
"(",
"&",
"LOG",
",",
"2",
",",
"\"",
"\"",
",",
"name",
",",
"fullname",
")",
";",
"}",
"#endif",
"}",
"}"
] | Checks if name is a fully qualified filename to an executable. | [
"Checks",
"if",
"name",
"is",
"a",
"fully",
"qualified",
"filename",
"to",
"an",
"executable",
"."
] | [
"/* linux uses binreloc since argv[0] is not reliable, call br_init( NULL ) first */",
"/* unix and non linux */",
"// full path",
"/* Remove \"/./\" and \"/../\" so string comparisons can be used on the path. */"
] | [
{
"param": "fullname",
"type": "char"
},
{
"param": "maxlen",
"type": "size_t"
},
{
"param": "name",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fullname",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "maxlen",
"type": "size_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
fbac9e6b773ec9d73709e9911960a43cff55b585 | DemonRem/blender | source/blender/blenkernel/intern/appdir.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | where_is_temp | void | static void where_is_temp(char *fullname, char *basename, const size_t maxlen, char *userdir)
{
/* Clear existing temp dir, if needed. */
BKE_tempdir_session_purge();
fullname[0] = '\0';
if (basename) {
basename[0] = '\0';
}
if (userdir && BLI_is_dir(userdir)) {
BLI_strncpy(fullname, userdir, maxlen);
}
#ifdef WIN32
if (fullname[0] == '\0') {
const char *tmp = BLI_getenv("TEMP"); /* Windows */
if (tmp && BLI_is_dir(tmp)) {
BLI_strncpy(fullname, tmp, maxlen);
}
}
#else
/* Other OS's - Try TMP and TMPDIR */
if (fullname[0] == '\0') {
const char *tmp = BLI_getenv("TMP");
if (tmp && BLI_is_dir(tmp)) {
BLI_strncpy(fullname, tmp, maxlen);
}
}
if (fullname[0] == '\0') {
const char *tmp = BLI_getenv("TMPDIR");
if (tmp && BLI_is_dir(tmp)) {
BLI_strncpy(fullname, tmp, maxlen);
}
}
#endif
if (fullname[0] == '\0') {
BLI_strncpy(fullname, "/tmp/", maxlen);
}
else {
/* add a trailing slash if needed */
BLI_add_slash(fullname);
#ifdef WIN32
if (userdir && userdir != fullname) {
/* also set user pref to show %TEMP%. /tmp/ is just plain confusing for Windows users. */
BLI_strncpy(userdir, fullname, maxlen);
}
#endif
}
/* Now that we have a valid temp dir, add system-generated unique sub-dir. */
if (basename) {
/* 'XXXXXX' is kind of tag to be replaced by mktemp-familly by an uuid. */
char *tmp_name = BLI_strdupcat(fullname, "blender_XXXXXX");
const size_t ln = strlen(tmp_name) + 1;
if (ln <= maxlen) {
#ifdef WIN32
if (_mktemp_s(tmp_name, ln) == 0) {
BLI_dir_create_recursive(tmp_name);
}
#else
if (mkdtemp(tmp_name) == NULL) {
BLI_dir_create_recursive(tmp_name);
}
#endif
}
if (BLI_is_dir(tmp_name)) {
BLI_strncpy(basename, fullname, maxlen);
BLI_strncpy(fullname, tmp_name, maxlen);
BLI_add_slash(fullname);
}
else {
CLOG_WARN(&LOG,
"Could not generate a temp file name for '%s', falling back to '%s'",
tmp_name,
fullname);
}
MEM_freeN(tmp_name);
}
} | /**
* Gets the temp directory when blender first runs.
* If the default path is not found, use try $TEMP
*
* Also make sure the temp dir has a trailing slash
*
* \param fullname: The full path to the temporary temp directory
* \param basename: The full path to the persistent temp directory (may be NULL)
* \param maxlen: The size of the fullname buffer
* \param userdir: Directory specified in user preferences
*/ | Gets the temp directory when blender first runs.
If the default path is not found, use try $TEMP
Also make sure the temp dir has a trailing slash
\param fullname: The full path to the temporary temp directory
\param basename: The full path to the persistent temp directory (may be NULL)
\param maxlen: The size of the fullname buffer
\param userdir: Directory specified in user preferences | [
"Gets",
"the",
"temp",
"directory",
"when",
"blender",
"first",
"runs",
".",
"If",
"the",
"default",
"path",
"is",
"not",
"found",
"use",
"try",
"$TEMP",
"Also",
"make",
"sure",
"the",
"temp",
"dir",
"has",
"a",
"trailing",
"slash",
"\\",
"param",
"fullname",
":",
"The",
"full",
"path",
"to",
"the",
"temporary",
"temp",
"directory",
"\\",
"param",
"basename",
":",
"The",
"full",
"path",
"to",
"the",
"persistent",
"temp",
"directory",
"(",
"may",
"be",
"NULL",
")",
"\\",
"param",
"maxlen",
":",
"The",
"size",
"of",
"the",
"fullname",
"buffer",
"\\",
"param",
"userdir",
":",
"Directory",
"specified",
"in",
"user",
"preferences"
] | static void where_is_temp(char *fullname, char *basename, const size_t maxlen, char *userdir)
{
BKE_tempdir_session_purge();
fullname[0] = '\0';
if (basename) {
basename[0] = '\0';
}
if (userdir && BLI_is_dir(userdir)) {
BLI_strncpy(fullname, userdir, maxlen);
}
#ifdef WIN32
if (fullname[0] == '\0') {
const char *tmp = BLI_getenv("TEMP");
if (tmp && BLI_is_dir(tmp)) {
BLI_strncpy(fullname, tmp, maxlen);
}
}
#else
if (fullname[0] == '\0') {
const char *tmp = BLI_getenv("TMP");
if (tmp && BLI_is_dir(tmp)) {
BLI_strncpy(fullname, tmp, maxlen);
}
}
if (fullname[0] == '\0') {
const char *tmp = BLI_getenv("TMPDIR");
if (tmp && BLI_is_dir(tmp)) {
BLI_strncpy(fullname, tmp, maxlen);
}
}
#endif
if (fullname[0] == '\0') {
BLI_strncpy(fullname, "/tmp/", maxlen);
}
else {
BLI_add_slash(fullname);
#ifdef WIN32
if (userdir && userdir != fullname) {
BLI_strncpy(userdir, fullname, maxlen);
}
#endif
}
if (basename) {
char *tmp_name = BLI_strdupcat(fullname, "blender_XXXXXX");
const size_t ln = strlen(tmp_name) + 1;
if (ln <= maxlen) {
#ifdef WIN32
if (_mktemp_s(tmp_name, ln) == 0) {
BLI_dir_create_recursive(tmp_name);
}
#else
if (mkdtemp(tmp_name) == NULL) {
BLI_dir_create_recursive(tmp_name);
}
#endif
}
if (BLI_is_dir(tmp_name)) {
BLI_strncpy(basename, fullname, maxlen);
BLI_strncpy(fullname, tmp_name, maxlen);
BLI_add_slash(fullname);
}
else {
CLOG_WARN(&LOG,
"Could not generate a temp file name for '%s', falling back to '%s'",
tmp_name,
fullname);
}
MEM_freeN(tmp_name);
}
} | [
"static",
"void",
"where_is_temp",
"(",
"char",
"*",
"fullname",
",",
"char",
"*",
"basename",
",",
"const",
"size_t",
"maxlen",
",",
"char",
"*",
"userdir",
")",
"{",
"BKE_tempdir_session_purge",
"(",
")",
";",
"fullname",
"[",
"0",
"]",
"=",
"'",
"\\0",
"'",
";",
"if",
"(",
"basename",
")",
"{",
"basename",
"[",
"0",
"]",
"=",
"'",
"\\0",
"'",
";",
"}",
"if",
"(",
"userdir",
"&&",
"BLI_is_dir",
"(",
"userdir",
")",
")",
"{",
"BLI_strncpy",
"(",
"fullname",
",",
"userdir",
",",
"maxlen",
")",
";",
"}",
"#ifdef",
"WIN32",
"if",
"(",
"fullname",
"[",
"0",
"]",
"==",
"'",
"\\0",
"'",
")",
"{",
"const",
"char",
"*",
"tmp",
"=",
"BLI_getenv",
"(",
"\"",
"\"",
")",
";",
"if",
"(",
"tmp",
"&&",
"BLI_is_dir",
"(",
"tmp",
")",
")",
"{",
"BLI_strncpy",
"(",
"fullname",
",",
"tmp",
",",
"maxlen",
")",
";",
"}",
"}",
"#else",
"if",
"(",
"fullname",
"[",
"0",
"]",
"==",
"'",
"\\0",
"'",
")",
"{",
"const",
"char",
"*",
"tmp",
"=",
"BLI_getenv",
"(",
"\"",
"\"",
")",
";",
"if",
"(",
"tmp",
"&&",
"BLI_is_dir",
"(",
"tmp",
")",
")",
"{",
"BLI_strncpy",
"(",
"fullname",
",",
"tmp",
",",
"maxlen",
")",
";",
"}",
"}",
"if",
"(",
"fullname",
"[",
"0",
"]",
"==",
"'",
"\\0",
"'",
")",
"{",
"const",
"char",
"*",
"tmp",
"=",
"BLI_getenv",
"(",
"\"",
"\"",
")",
";",
"if",
"(",
"tmp",
"&&",
"BLI_is_dir",
"(",
"tmp",
")",
")",
"{",
"BLI_strncpy",
"(",
"fullname",
",",
"tmp",
",",
"maxlen",
")",
";",
"}",
"}",
"#endif",
"if",
"(",
"fullname",
"[",
"0",
"]",
"==",
"'",
"\\0",
"'",
")",
"{",
"BLI_strncpy",
"(",
"fullname",
",",
"\"",
"\"",
",",
"maxlen",
")",
";",
"}",
"else",
"{",
"BLI_add_slash",
"(",
"fullname",
")",
";",
"#ifdef",
"WIN32",
"if",
"(",
"userdir",
"&&",
"userdir",
"!=",
"fullname",
")",
"{",
"BLI_strncpy",
"(",
"userdir",
",",
"fullname",
",",
"maxlen",
")",
";",
"}",
"#endif",
"}",
"if",
"(",
"basename",
")",
"{",
"char",
"*",
"tmp_name",
"=",
"BLI_strdupcat",
"(",
"fullname",
",",
"\"",
"\"",
")",
";",
"const",
"size_t",
"ln",
"=",
"strlen",
"(",
"tmp_name",
")",
"+",
"1",
";",
"if",
"(",
"ln",
"<=",
"maxlen",
")",
"{",
"#ifdef",
"WIN32",
"if",
"(",
"_mktemp_s",
"(",
"tmp_name",
",",
"ln",
")",
"==",
"0",
")",
"{",
"BLI_dir_create_recursive",
"(",
"tmp_name",
")",
";",
"}",
"#else",
"if",
"(",
"mkdtemp",
"(",
"tmp_name",
")",
"==",
"NULL",
")",
"{",
"BLI_dir_create_recursive",
"(",
"tmp_name",
")",
";",
"}",
"#endif",
"}",
"if",
"(",
"BLI_is_dir",
"(",
"tmp_name",
")",
")",
"{",
"BLI_strncpy",
"(",
"basename",
",",
"fullname",
",",
"maxlen",
")",
";",
"BLI_strncpy",
"(",
"fullname",
",",
"tmp_name",
",",
"maxlen",
")",
";",
"BLI_add_slash",
"(",
"fullname",
")",
";",
"}",
"else",
"{",
"CLOG_WARN",
"(",
"&",
"LOG",
",",
"\"",
"\"",
",",
"tmp_name",
",",
"fullname",
")",
";",
"}",
"MEM_freeN",
"(",
"tmp_name",
")",
";",
"}",
"}"
] | Gets the temp directory when blender first runs. | [
"Gets",
"the",
"temp",
"directory",
"when",
"blender",
"first",
"runs",
"."
] | [
"/* Clear existing temp dir, if needed. */",
"/* Windows */",
"/* Other OS's - Try TMP and TMPDIR */",
"/* add a trailing slash if needed */",
"/* also set user pref to show %TEMP%. /tmp/ is just plain confusing for Windows users. */",
"/* Now that we have a valid temp dir, add system-generated unique sub-dir. */",
"/* 'XXXXXX' is kind of tag to be replaced by mktemp-familly by an uuid. */"
] | [
{
"param": "fullname",
"type": "char"
},
{
"param": "basename",
"type": "char"
},
{
"param": "maxlen",
"type": "size_t"
},
{
"param": "userdir",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fullname",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "basename",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "maxlen",
"type": "size_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "userdir",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
fbac9e6b773ec9d73709e9911960a43cff55b585 | DemonRem/blender | source/blender/blenkernel/intern/appdir.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | BKE_tempdir_session_purge | void | void BKE_tempdir_session_purge(void)
{
if (btempdir_session[0] && BLI_is_dir(btempdir_session)) {
BLI_delete(btempdir_session, true, true);
}
} | /**
* Delete content of this instance's temp dir.
*/ | Delete content of this instance's temp dir. | [
"Delete",
"content",
"of",
"this",
"instance",
"'",
"s",
"temp",
"dir",
"."
] | void BKE_tempdir_session_purge(void)
{
if (btempdir_session[0] && BLI_is_dir(btempdir_session)) {
BLI_delete(btempdir_session, true, true);
}
} | [
"void",
"BKE_tempdir_session_purge",
"(",
"void",
")",
"{",
"if",
"(",
"btempdir_session",
"[",
"0",
"]",
"&&",
"BLI_is_dir",
"(",
"btempdir_session",
")",
")",
"{",
"BLI_delete",
"(",
"btempdir_session",
",",
"true",
",",
"true",
")",
";",
"}",
"}"
] | Delete content of this instance's temp dir. | [
"Delete",
"content",
"of",
"this",
"instance",
"'",
"s",
"temp",
"dir",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
fbac9e6b773ec9d73709e9911960a43cff55b585 | DemonRem/blender | source/blender/blenkernel/intern/appdir.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | BKE_appdir_font_folder_default | bool | bool BKE_appdir_font_folder_default(char *dir)
{
bool success = false;
#ifdef WIN32
wchar_t wpath[FILE_MAXDIR];
success = SHGetSpecialFolderPathW(0, wpath, CSIDL_FONTS, 0);
if (success) {
wcscat(wpath, L"\\");
BLI_strncpy_wchar_as_utf8(dir, wpath, FILE_MAXDIR);
}
#endif
/* TODO: Values for other platforms. */
UNUSED_VARS(dir);
return success;
} | /* Gets a good default directory for fonts */ | Gets a good default directory for fonts | [
"Gets",
"a",
"good",
"default",
"directory",
"for",
"fonts"
] | bool BKE_appdir_font_folder_default(char *dir)
{
bool success = false;
#ifdef WIN32
wchar_t wpath[FILE_MAXDIR];
success = SHGetSpecialFolderPathW(0, wpath, CSIDL_FONTS, 0);
if (success) {
wcscat(wpath, L"\\");
BLI_strncpy_wchar_as_utf8(dir, wpath, FILE_MAXDIR);
}
#endif
UNUSED_VARS(dir);
return success;
} | [
"bool",
"BKE_appdir_font_folder_default",
"(",
"char",
"*",
"dir",
")",
"{",
"bool",
"success",
"=",
"false",
";",
"#ifdef",
"WIN32",
"wchar_t",
"wpath",
"[",
"FILE_MAXDIR",
"]",
";",
"success",
"=",
"SHGetSpecialFolderPathW",
"(",
"0",
",",
"wpath",
",",
"CSIDL_FONTS",
",",
"0",
")",
";",
"if",
"(",
"success",
")",
"{",
"wcscat",
"(",
"wpath",
",",
"L\"",
"\\\\",
"\"",
")",
";",
"BLI_strncpy_wchar_as_utf8",
"(",
"dir",
",",
"wpath",
",",
"FILE_MAXDIR",
")",
";",
"}",
"#endif",
"UNUSED_VARS",
"(",
"dir",
")",
";",
"return",
"success",
";",
"}"
] | Gets a good default directory for fonts | [
"Gets",
"a",
"good",
"default",
"directory",
"for",
"fonts"
] | [
"/* TODO: Values for other platforms. */"
] | [
{
"param": "dir",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dir",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9dbf7b35bc57bcb96cb775c2a80891f6c404f32b | DemonRem/blender | source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | bakeModifier | void | static void bakeModifier(Main *bmain, Depsgraph *depsgraph, GpencilModifierData *md, Object *ob)
{
LatticeGpencilModifierData *mmd = (LatticeGpencilModifierData *)md;
Scene *scene = DEG_get_evaluated_scene(depsgraph);
struct LatticeDeformData *ldata = NULL;
bGPdata *gpd = ob->data;
int oldframe = (int)DEG_get_ctime(depsgraph);
if (mmd->object == NULL) {
return;
}
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
/* apply lattice effects on this frame
* NOTE: this assumes that we don't want lattice animation on non-keyframed frames
*/
CFRA = gpf->framenum;
BKE_scene_graph_update_for_newframe(depsgraph, bmain);
/* recalculate lattice data */
BKE_gpencil_lattice_init(ob);
/* compute lattice effects on this frame */
for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
deformStroke(md, depsgraph, ob, gpl, gpf, gps);
}
}
}
/* free lingering data */
ldata = (struct LatticeDeformData *)mmd->cache_data;
if (ldata) {
end_latt_deform(ldata);
mmd->cache_data = NULL;
}
/* return frame state and DB to original state */
CFRA = oldframe;
BKE_scene_graph_update_for_newframe(depsgraph, bmain);
} | /* FIXME: Ideally we be doing this on a copy of the main depsgraph
* (i.e. one where we don't have to worry about restoring state)
*/ | Ideally we be doing this on a copy of the main depsgraph | [
"Ideally",
"we",
"be",
"doing",
"this",
"on",
"a",
"copy",
"of",
"the",
"main",
"depsgraph"
] | static void bakeModifier(Main *bmain, Depsgraph *depsgraph, GpencilModifierData *md, Object *ob)
{
LatticeGpencilModifierData *mmd = (LatticeGpencilModifierData *)md;
Scene *scene = DEG_get_evaluated_scene(depsgraph);
struct LatticeDeformData *ldata = NULL;
bGPdata *gpd = ob->data;
int oldframe = (int)DEG_get_ctime(depsgraph);
if (mmd->object == NULL) {
return;
}
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
CFRA = gpf->framenum;
BKE_scene_graph_update_for_newframe(depsgraph, bmain);
BKE_gpencil_lattice_init(ob);
for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
deformStroke(md, depsgraph, ob, gpl, gpf, gps);
}
}
}
ldata = (struct LatticeDeformData *)mmd->cache_data;
if (ldata) {
end_latt_deform(ldata);
mmd->cache_data = NULL;
}
CFRA = oldframe;
BKE_scene_graph_update_for_newframe(depsgraph, bmain);
} | [
"static",
"void",
"bakeModifier",
"(",
"Main",
"*",
"bmain",
",",
"Depsgraph",
"*",
"depsgraph",
",",
"GpencilModifierData",
"*",
"md",
",",
"Object",
"*",
"ob",
")",
"{",
"LatticeGpencilModifierData",
"*",
"mmd",
"=",
"(",
"LatticeGpencilModifierData",
"*",
")",
"md",
";",
"Scene",
"*",
"scene",
"=",
"DEG_get_evaluated_scene",
"(",
"depsgraph",
")",
";",
"struct",
"LatticeDeformData",
"*",
"ldata",
"=",
"NULL",
";",
"bGPdata",
"*",
"gpd",
"=",
"ob",
"->",
"data",
";",
"int",
"oldframe",
"=",
"(",
"int",
")",
"DEG_get_ctime",
"(",
"depsgraph",
")",
";",
"if",
"(",
"mmd",
"->",
"object",
"==",
"NULL",
")",
"{",
"return",
";",
"}",
"for",
"(",
"bGPDlayer",
"*",
"gpl",
"=",
"gpd",
"->",
"layers",
".",
"first",
";",
"gpl",
";",
"gpl",
"=",
"gpl",
"->",
"next",
")",
"{",
"for",
"(",
"bGPDframe",
"*",
"gpf",
"=",
"gpl",
"->",
"frames",
".",
"first",
";",
"gpf",
";",
"gpf",
"=",
"gpf",
"->",
"next",
")",
"{",
"CFRA",
"=",
"gpf",
"->",
"framenum",
";",
"BKE_scene_graph_update_for_newframe",
"(",
"depsgraph",
",",
"bmain",
")",
";",
"BKE_gpencil_lattice_init",
"(",
"ob",
")",
";",
"for",
"(",
"bGPDstroke",
"*",
"gps",
"=",
"gpf",
"->",
"strokes",
".",
"first",
";",
"gps",
";",
"gps",
"=",
"gps",
"->",
"next",
")",
"{",
"deformStroke",
"(",
"md",
",",
"depsgraph",
",",
"ob",
",",
"gpl",
",",
"gpf",
",",
"gps",
")",
";",
"}",
"}",
"}",
"ldata",
"=",
"(",
"struct",
"LatticeDeformData",
"*",
")",
"mmd",
"->",
"cache_data",
";",
"if",
"(",
"ldata",
")",
"{",
"end_latt_deform",
"(",
"ldata",
")",
";",
"mmd",
"->",
"cache_data",
"=",
"NULL",
";",
"}",
"CFRA",
"=",
"oldframe",
";",
"BKE_scene_graph_update_for_newframe",
"(",
"depsgraph",
",",
"bmain",
")",
";",
"}"
] | FIXME: Ideally we be doing this on a copy of the main depsgraph
(i.e. | [
"FIXME",
":",
"Ideally",
"we",
"be",
"doing",
"this",
"on",
"a",
"copy",
"of",
"the",
"main",
"depsgraph",
"(",
"i",
".",
"e",
"."
] | [
"/* apply lattice effects on this frame\n * NOTE: this assumes that we don't want lattice animation on non-keyframed frames\n */",
"/* recalculate lattice data */",
"/* compute lattice effects on this frame */",
"/* free lingering data */",
"/* return frame state and DB to original state */"
] | [
{
"param": "bmain",
"type": "Main"
},
{
"param": "depsgraph",
"type": "Depsgraph"
},
{
"param": "md",
"type": "GpencilModifierData"
},
{
"param": "ob",
"type": "Object"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bmain",
"type": "Main",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "depsgraph",
"type": "Depsgraph",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "md",
"type": "GpencilModifierData",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ob",
"type": "Object",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4a5887c312267da448b0793d33cdb7fbe81e10ed | DemonRem/blender | source/blender/modifiers/intern/MOD_subsurf.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | subdiv_descriptor_ensure | Subdiv | static Subdiv *subdiv_descriptor_ensure(SubsurfModifierData *smd,
const SubdivSettings *subdiv_settings,
const Mesh *mesh)
{
SubsurfRuntimeData *runtime_data = (SubsurfRuntimeData *)smd->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(SubsurfModifierData *smd,
const SubdivSettings *subdiv_settings,
const Mesh *mesh)
{
SubsurfRuntimeData *runtime_data = (SubsurfRuntimeData *)smd->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",
"(",
"SubsurfModifierData",
"*",
"smd",
",",
"const",
"SubdivSettings",
"*",
"subdiv_settings",
",",
"const",
"Mesh",
"*",
"mesh",
")",
"{",
"SubsurfRuntimeData",
"*",
"runtime_data",
"=",
"(",
"SubsurfRuntimeData",
"*",
")",
"smd",
"->",
"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": "smd",
"type": "SubsurfModifierData"
},
{
"param": "subdiv_settings",
"type": "SubdivSettings"
},
{
"param": "mesh",
"type": "Mesh"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "smd",
"type": "SubsurfModifierData",
"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": []
} |
4a5887c312267da448b0793d33cdb7fbe81e10ed | DemonRem/blender | source/blender/modifiers/intern/MOD_subsurf.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | subdiv_mesh_settings_init | void | static void subdiv_mesh_settings_init(SubdivToMeshSettings *settings,
const SubsurfModifierData *smd,
const ModifierEvalContext *ctx)
{
const int level = subdiv_levels_for_modifier_get(smd, ctx);
settings->resolution = (1 << level) + 1;
settings->use_optimal_display = (smd->flags & eSubsurfModifierFlag_ControlEdges);
} | /* Subdivide into fully qualified mesh. */ | Subdivide into fully qualified mesh. | [
"Subdivide",
"into",
"fully",
"qualified",
"mesh",
"."
] | static void subdiv_mesh_settings_init(SubdivToMeshSettings *settings,
const SubsurfModifierData *smd,
const ModifierEvalContext *ctx)
{
const int level = subdiv_levels_for_modifier_get(smd, ctx);
settings->resolution = (1 << level) + 1;
settings->use_optimal_display = (smd->flags & eSubsurfModifierFlag_ControlEdges);
} | [
"static",
"void",
"subdiv_mesh_settings_init",
"(",
"SubdivToMeshSettings",
"*",
"settings",
",",
"const",
"SubsurfModifierData",
"*",
"smd",
",",
"const",
"ModifierEvalContext",
"*",
"ctx",
")",
"{",
"const",
"int",
"level",
"=",
"subdiv_levels_for_modifier_get",
"(",
"smd",
",",
"ctx",
")",
";",
"settings",
"->",
"resolution",
"=",
"(",
"1",
"<<",
"level",
")",
"+",
"1",
";",
"settings",
"->",
"use_optimal_display",
"=",
"(",
"smd",
"->",
"flags",
"&",
"eSubsurfModifierFlag_ControlEdges",
")",
";",
"}"
] | Subdivide into fully qualified mesh. | [
"Subdivide",
"into",
"fully",
"qualified",
"mesh",
"."
] | [] | [
{
"param": "settings",
"type": "SubdivToMeshSettings"
},
{
"param": "smd",
"type": "SubsurfModifierData"
},
{
"param": "ctx",
"type": "ModifierEvalContext"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "settings",
"type": "SubdivToMeshSettings",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "smd",
"type": "SubsurfModifierData",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ctx",
"type": "ModifierEvalContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
941c2b608e65e20e6541aa93d767c33dfe062495 | DemonRem/blender | source/blender/blenlib/intern/system.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | BLI_system_backtrace | void | void BLI_system_backtrace(FILE *fp)
{
/* ------------- */
/* Linux / Apple */
#if defined(__linux__) || defined(__APPLE__)
# define SIZE 100
void *buffer[SIZE];
int nptrs;
char **strings;
int i;
/* include a backtrace for good measure */
nptrs = backtrace(buffer, SIZE);
strings = backtrace_symbols(buffer, nptrs);
for (i = 0; i < nptrs; i++) {
fputs(strings[i], fp);
fputc('\n', fp);
}
free(strings);
# undef SIZE
/* -------- */
/* Windows */
#elif defined(_MSC_VER)
# ifndef NDEBUG
# define MAXSYMBOL 256
# define SIZE 100
unsigned short i;
void *stack[SIZE];
unsigned short nframes;
SYMBOL_INFO *symbolinfo;
HANDLE process;
process = GetCurrentProcess();
SymInitialize(process, NULL, TRUE);
nframes = CaptureStackBackTrace(0, SIZE, stack, NULL);
symbolinfo = MEM_callocN(sizeof(SYMBOL_INFO) + MAXSYMBOL * sizeof(char), "crash Symbol table");
symbolinfo->MaxNameLen = MAXSYMBOL - 1;
symbolinfo->SizeOfStruct = sizeof(SYMBOL_INFO);
for (i = 0; i < nframes; i++) {
SymFromAddr(process, (DWORD64)(stack[i]), 0, symbolinfo);
fprintf(fp, "%u: %s - 0x%0llX\n", nframes - i - 1, symbolinfo->Name, symbolinfo->Address);
}
MEM_freeN(symbolinfo);
# undef MAXSYMBOL
# undef SIZE
# else
fprintf(fp, "Crash backtrace not supported on release builds\n");
# endif /* NDEBUG */
#else /* _MSC_VER */
/* ------------------ */
/* non msvc/osx/linux */
(void)fp;
#endif
} | /**
* Write a backtrace into a file for systems which support it.
*/ | Write a backtrace into a file for systems which support it. | [
"Write",
"a",
"backtrace",
"into",
"a",
"file",
"for",
"systems",
"which",
"support",
"it",
"."
] | void BLI_system_backtrace(FILE *fp)
{
#if defined(__linux__) || defined(__APPLE__)
# define SIZE 100
void *buffer[SIZE];
int nptrs;
char **strings;
int i;
nptrs = backtrace(buffer, SIZE);
strings = backtrace_symbols(buffer, nptrs);
for (i = 0; i < nptrs; i++) {
fputs(strings[i], fp);
fputc('\n', fp);
}
free(strings);
# undef SIZE
#elif defined(_MSC_VER)
# ifndef NDEBUG
# define MAXSYMBOL 256
# define SIZE 100
unsigned short i;
void *stack[SIZE];
unsigned short nframes;
SYMBOL_INFO *symbolinfo;
HANDLE process;
process = GetCurrentProcess();
SymInitialize(process, NULL, TRUE);
nframes = CaptureStackBackTrace(0, SIZE, stack, NULL);
symbolinfo = MEM_callocN(sizeof(SYMBOL_INFO) + MAXSYMBOL * sizeof(char), "crash Symbol table");
symbolinfo->MaxNameLen = MAXSYMBOL - 1;
symbolinfo->SizeOfStruct = sizeof(SYMBOL_INFO);
for (i = 0; i < nframes; i++) {
SymFromAddr(process, (DWORD64)(stack[i]), 0, symbolinfo);
fprintf(fp, "%u: %s - 0x%0llX\n", nframes - i - 1, symbolinfo->Name, symbolinfo->Address);
}
MEM_freeN(symbolinfo);
# undef MAXSYMBOL
# undef SIZE
# else
fprintf(fp, "Crash backtrace not supported on release builds\n");
# endif
#else
(void)fp;
#endif
} | [
"void",
"BLI_system_backtrace",
"(",
"FILE",
"*",
"fp",
")",
"{",
"#if",
"defined",
"(",
"__linux__",
")",
"||",
"defined",
"(",
"__APPLE__",
")",
"\n\n",
"# define",
"SIZE",
" 100",
"\n",
"void",
"*",
"buffer",
"[",
"SIZE",
"]",
";",
"int",
"nptrs",
";",
"char",
"*",
"*",
"strings",
";",
"int",
"i",
";",
"nptrs",
"=",
"backtrace",
"(",
"buffer",
",",
"SIZE",
")",
";",
"strings",
"=",
"backtrace_symbols",
"(",
"buffer",
",",
"nptrs",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"nptrs",
";",
"i",
"++",
")",
"{",
"fputs",
"(",
"strings",
"[",
"i",
"]",
",",
"fp",
")",
";",
"fputc",
"(",
"'",
"\\n",
"'",
",",
"fp",
")",
";",
"}",
"free",
"(",
"strings",
")",
";",
"# undef",
" SIZE",
"\n\n",
"#elif",
"defined",
"(",
"_MSC_VER",
")",
"\n\n",
"# ifndef",
"NDEBUG",
"# define",
"MAXSYMBOL",
" 256",
"\n",
"# define",
"SIZE",
" 100",
"\n",
"unsigned",
"short",
"i",
";",
"void",
"*",
"stack",
"[",
"SIZE",
"]",
";",
"unsigned",
"short",
"nframes",
";",
"SYMBOL_INFO",
"*",
"symbolinfo",
";",
"HANDLE",
"process",
";",
"process",
"=",
"GetCurrentProcess",
"(",
")",
";",
"SymInitialize",
"(",
"process",
",",
"NULL",
",",
"TRUE",
")",
";",
"nframes",
"=",
"CaptureStackBackTrace",
"(",
"0",
",",
"SIZE",
",",
"stack",
",",
"NULL",
")",
";",
"symbolinfo",
"=",
"MEM_callocN",
"(",
"sizeof",
"(",
"SYMBOL_INFO",
")",
"+",
"MAXSYMBOL",
"*",
"sizeof",
"(",
"char",
")",
",",
"\"",
"\"",
")",
";",
"symbolinfo",
"->",
"MaxNameLen",
"=",
"MAXSYMBOL",
"-",
"1",
";",
"symbolinfo",
"->",
"SizeOfStruct",
"=",
"sizeof",
"(",
"SYMBOL_INFO",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"nframes",
";",
"i",
"++",
")",
"{",
"SymFromAddr",
"(",
"process",
",",
"(",
"DWORD64",
")",
"(",
"stack",
"[",
"i",
"]",
")",
",",
"0",
",",
"symbolinfo",
")",
";",
"fprintf",
"(",
"fp",
",",
"\"",
"\\n",
"\"",
",",
"nframes",
"-",
"i",
"-",
"1",
",",
"symbolinfo",
"->",
"Name",
",",
"symbolinfo",
"->",
"Address",
")",
";",
"}",
"MEM_freeN",
"(",
"symbolinfo",
")",
";",
"# undef",
" MAXSYMBOL",
"\n",
"# undef",
" SIZE",
"\n",
"# else",
"fprintf",
"(",
"fp",
",",
"\"",
"\\n",
"\"",
")",
";",
"# endif",
"#else",
"(",
"void",
")",
"fp",
";",
"#endif",
"}"
] | Write a backtrace into a file for systems which support it. | [
"Write",
"a",
"backtrace",
"into",
"a",
"file",
"for",
"systems",
"which",
"support",
"it",
"."
] | [
"/* ------------- */",
"/* Linux / Apple */",
"/* include a backtrace for good measure */",
"/* -------- */",
"/* Windows */",
"/* NDEBUG */",
"/* _MSC_VER */",
"/* ------------------ */",
"/* non msvc/osx/linux */"
] | [
{
"param": "fp",
"type": "FILE"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fp",
"type": "FILE",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
dc435efd86bca3a60fdcb7498865b68af3d28314 | DemonRem/blender | source/blender/editors/screen/glutil.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | bglPolygonOffset | void | void bglPolygonOffset(float viewdist, float dist)
{
static float winmat[16], offset = 0.0f;
if (dist != 0.0f) {
// glEnable(GL_POLYGON_OFFSET_FILL);
// glPolygonOffset(-1.0, -1.0);
/* hack below is to mimic polygon offset */
GPU_matrix_projection_get(winmat);
/* dist is from camera to center point */
float offs = bglPolygonOffsetCalc(winmat, viewdist, dist);
winmat[14] -= offs;
offset += offs;
}
else {
winmat[14] += offset;
offset = 0.0;
}
GPU_matrix_projection_set(winmat);
} | /**
* \note \a viewdist is only for ortho at the moment.
*/ | \note \a viewdist is only for ortho at the moment. | [
"\\",
"note",
"\\",
"a",
"viewdist",
"is",
"only",
"for",
"ortho",
"at",
"the",
"moment",
"."
] | void bglPolygonOffset(float viewdist, float dist)
{
static float winmat[16], offset = 0.0f;
if (dist != 0.0f) {
GPU_matrix_projection_get(winmat);
float offs = bglPolygonOffsetCalc(winmat, viewdist, dist);
winmat[14] -= offs;
offset += offs;
}
else {
winmat[14] += offset;
offset = 0.0;
}
GPU_matrix_projection_set(winmat);
} | [
"void",
"bglPolygonOffset",
"(",
"float",
"viewdist",
",",
"float",
"dist",
")",
"{",
"static",
"float",
"winmat",
"[",
"16",
"]",
",",
"offset",
"=",
"0.0f",
";",
"if",
"(",
"dist",
"!=",
"0.0f",
")",
"{",
"GPU_matrix_projection_get",
"(",
"winmat",
")",
";",
"float",
"offs",
"=",
"bglPolygonOffsetCalc",
"(",
"winmat",
",",
"viewdist",
",",
"dist",
")",
";",
"winmat",
"[",
"14",
"]",
"-=",
"offs",
";",
"offset",
"+=",
"offs",
";",
"}",
"else",
"{",
"winmat",
"[",
"14",
"]",
"+=",
"offset",
";",
"offset",
"=",
"0.0",
";",
"}",
"GPU_matrix_projection_set",
"(",
"winmat",
")",
";",
"}"
] | \note \a viewdist is only for ortho at the moment. | [
"\\",
"note",
"\\",
"a",
"viewdist",
"is",
"only",
"for",
"ortho",
"at",
"the",
"moment",
"."
] | [
"// glEnable(GL_POLYGON_OFFSET_FILL);",
"// glPolygonOffset(-1.0, -1.0);",
"/* hack below is to mimic polygon offset */",
"/* dist is from camera to center point */"
] | [
{
"param": "viewdist",
"type": "float"
},
{
"param": "dist",
"type": "float"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "viewdist",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dist",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
dc435efd86bca3a60fdcb7498865b68af3d28314 | DemonRem/blender | source/blender/editors/screen/glutil.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | ED_draw_imbuf_clipping | void | void ED_draw_imbuf_clipping(ImBuf *ibuf,
float x,
float y,
int zoomfilter,
ColorManagedViewSettings *view_settings,
ColorManagedDisplaySettings *display_settings,
float clip_min_x,
float clip_min_y,
float clip_max_x,
float clip_max_y,
float zoom_x,
float zoom_y)
{
bool force_fallback = false;
bool need_fallback = true;
/* Early out */
if (ibuf->rect == NULL && ibuf->rect_float == NULL) {
return;
}
/* Single channel images could not be transformed using GLSL yet */
force_fallback |= ibuf->channels == 1;
/* If user decided not to use GLSL, fallback to glaDrawPixelsAuto */
force_fallback |= (ED_draw_imbuf_method(ibuf) != IMAGE_DRAW_METHOD_GLSL);
/* Try to draw buffer using GLSL display transform */
if (force_fallback == false) {
int ok;
IMMDrawPixelsTexState state = {0};
/* We want GLSL state to be fully handled by OCIO. */
state.do_shader_unbind = false;
immDrawPixelsTexSetupAttributes(&state);
if (ibuf->rect_float) {
if (ibuf->float_colorspace) {
ok = IMB_colormanagement_setup_glsl_draw_from_space(
view_settings, display_settings, ibuf->float_colorspace, ibuf->dither, true);
}
else {
ok = IMB_colormanagement_setup_glsl_draw(
view_settings, display_settings, ibuf->dither, true);
}
}
else {
ok = IMB_colormanagement_setup_glsl_draw_from_space(
view_settings, display_settings, ibuf->rect_colorspace, ibuf->dither, false);
}
if (ok) {
if (ibuf->rect_float) {
int format = 0;
if (ibuf->channels == 3) {
format = GL_RGB;
}
else if (ibuf->channels == 4) {
format = GL_RGBA;
}
else {
BLI_assert(!"Incompatible number of channels for GLSL display");
}
if (format != 0) {
immDrawPixelsTex_clipping(&state,
x,
y,
ibuf->x,
ibuf->y,
format,
GL_FLOAT,
zoomfilter,
ibuf->rect_float,
clip_min_x,
clip_min_y,
clip_max_x,
clip_max_y,
zoom_x,
zoom_y,
NULL);
}
}
else if (ibuf->rect) {
/* ibuf->rect is always RGBA */
immDrawPixelsTex_clipping(&state,
x,
y,
ibuf->x,
ibuf->y,
GL_RGBA,
GL_UNSIGNED_BYTE,
zoomfilter,
ibuf->rect,
clip_min_x,
clip_min_y,
clip_max_x,
clip_max_y,
zoom_x,
zoom_y,
NULL);
}
IMB_colormanagement_finish_glsl_draw();
need_fallback = false;
}
}
/* In case GLSL failed or not usable, fallback to glaDrawPixelsAuto */
if (need_fallback) {
unsigned char *display_buffer;
void *cache_handle;
display_buffer = IMB_display_buffer_acquire(
ibuf, view_settings, display_settings, &cache_handle);
if (display_buffer) {
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR);
immDrawPixelsTex_clipping(&state,
x,
y,
ibuf->x,
ibuf->y,
GL_RGBA,
GL_UNSIGNED_BYTE,
zoomfilter,
display_buffer,
clip_min_x,
clip_min_y,
clip_max_x,
clip_max_y,
zoom_x,
zoom_y,
NULL);
}
IMB_display_buffer_release(cache_handle);
}
} | /* Draw given image buffer on a screen using GLSL for display transform */ | Draw given image buffer on a screen using GLSL for display transform | [
"Draw",
"given",
"image",
"buffer",
"on",
"a",
"screen",
"using",
"GLSL",
"for",
"display",
"transform"
] | void ED_draw_imbuf_clipping(ImBuf *ibuf,
float x,
float y,
int zoomfilter,
ColorManagedViewSettings *view_settings,
ColorManagedDisplaySettings *display_settings,
float clip_min_x,
float clip_min_y,
float clip_max_x,
float clip_max_y,
float zoom_x,
float zoom_y)
{
bool force_fallback = false;
bool need_fallback = true;
if (ibuf->rect == NULL && ibuf->rect_float == NULL) {
return;
}
force_fallback |= ibuf->channels == 1;
force_fallback |= (ED_draw_imbuf_method(ibuf) != IMAGE_DRAW_METHOD_GLSL);
if (force_fallback == false) {
int ok;
IMMDrawPixelsTexState state = {0};
state.do_shader_unbind = false;
immDrawPixelsTexSetupAttributes(&state);
if (ibuf->rect_float) {
if (ibuf->float_colorspace) {
ok = IMB_colormanagement_setup_glsl_draw_from_space(
view_settings, display_settings, ibuf->float_colorspace, ibuf->dither, true);
}
else {
ok = IMB_colormanagement_setup_glsl_draw(
view_settings, display_settings, ibuf->dither, true);
}
}
else {
ok = IMB_colormanagement_setup_glsl_draw_from_space(
view_settings, display_settings, ibuf->rect_colorspace, ibuf->dither, false);
}
if (ok) {
if (ibuf->rect_float) {
int format = 0;
if (ibuf->channels == 3) {
format = GL_RGB;
}
else if (ibuf->channels == 4) {
format = GL_RGBA;
}
else {
BLI_assert(!"Incompatible number of channels for GLSL display");
}
if (format != 0) {
immDrawPixelsTex_clipping(&state,
x,
y,
ibuf->x,
ibuf->y,
format,
GL_FLOAT,
zoomfilter,
ibuf->rect_float,
clip_min_x,
clip_min_y,
clip_max_x,
clip_max_y,
zoom_x,
zoom_y,
NULL);
}
}
else if (ibuf->rect) {
immDrawPixelsTex_clipping(&state,
x,
y,
ibuf->x,
ibuf->y,
GL_RGBA,
GL_UNSIGNED_BYTE,
zoomfilter,
ibuf->rect,
clip_min_x,
clip_min_y,
clip_max_x,
clip_max_y,
zoom_x,
zoom_y,
NULL);
}
IMB_colormanagement_finish_glsl_draw();
need_fallback = false;
}
}
if (need_fallback) {
unsigned char *display_buffer;
void *cache_handle;
display_buffer = IMB_display_buffer_acquire(
ibuf, view_settings, display_settings, &cache_handle);
if (display_buffer) {
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR);
immDrawPixelsTex_clipping(&state,
x,
y,
ibuf->x,
ibuf->y,
GL_RGBA,
GL_UNSIGNED_BYTE,
zoomfilter,
display_buffer,
clip_min_x,
clip_min_y,
clip_max_x,
clip_max_y,
zoom_x,
zoom_y,
NULL);
}
IMB_display_buffer_release(cache_handle);
}
} | [
"void",
"ED_draw_imbuf_clipping",
"(",
"ImBuf",
"*",
"ibuf",
",",
"float",
"x",
",",
"float",
"y",
",",
"int",
"zoomfilter",
",",
"ColorManagedViewSettings",
"*",
"view_settings",
",",
"ColorManagedDisplaySettings",
"*",
"display_settings",
",",
"float",
"clip_min_x",
",",
"float",
"clip_min_y",
",",
"float",
"clip_max_x",
",",
"float",
"clip_max_y",
",",
"float",
"zoom_x",
",",
"float",
"zoom_y",
")",
"{",
"bool",
"force_fallback",
"=",
"false",
";",
"bool",
"need_fallback",
"=",
"true",
";",
"if",
"(",
"ibuf",
"->",
"rect",
"==",
"NULL",
"&&",
"ibuf",
"->",
"rect_float",
"==",
"NULL",
")",
"{",
"return",
";",
"}",
"force_fallback",
"|=",
"ibuf",
"->",
"channels",
"==",
"1",
";",
"force_fallback",
"|=",
"(",
"ED_draw_imbuf_method",
"(",
"ibuf",
")",
"!=",
"IMAGE_DRAW_METHOD_GLSL",
")",
";",
"if",
"(",
"force_fallback",
"==",
"false",
")",
"{",
"int",
"ok",
";",
"IMMDrawPixelsTexState",
"state",
"=",
"{",
"0",
"}",
";",
"state",
".",
"do_shader_unbind",
"=",
"false",
";",
"immDrawPixelsTexSetupAttributes",
"(",
"&",
"state",
")",
";",
"if",
"(",
"ibuf",
"->",
"rect_float",
")",
"{",
"if",
"(",
"ibuf",
"->",
"float_colorspace",
")",
"{",
"ok",
"=",
"IMB_colormanagement_setup_glsl_draw_from_space",
"(",
"view_settings",
",",
"display_settings",
",",
"ibuf",
"->",
"float_colorspace",
",",
"ibuf",
"->",
"dither",
",",
"true",
")",
";",
"}",
"else",
"{",
"ok",
"=",
"IMB_colormanagement_setup_glsl_draw",
"(",
"view_settings",
",",
"display_settings",
",",
"ibuf",
"->",
"dither",
",",
"true",
")",
";",
"}",
"}",
"else",
"{",
"ok",
"=",
"IMB_colormanagement_setup_glsl_draw_from_space",
"(",
"view_settings",
",",
"display_settings",
",",
"ibuf",
"->",
"rect_colorspace",
",",
"ibuf",
"->",
"dither",
",",
"false",
")",
";",
"}",
"if",
"(",
"ok",
")",
"{",
"if",
"(",
"ibuf",
"->",
"rect_float",
")",
"{",
"int",
"format",
"=",
"0",
";",
"if",
"(",
"ibuf",
"->",
"channels",
"==",
"3",
")",
"{",
"format",
"=",
"GL_RGB",
";",
"}",
"else",
"if",
"(",
"ibuf",
"->",
"channels",
"==",
"4",
")",
"{",
"format",
"=",
"GL_RGBA",
";",
"}",
"else",
"{",
"BLI_assert",
"(",
"!",
"\"",
"\"",
")",
";",
"}",
"if",
"(",
"format",
"!=",
"0",
")",
"{",
"immDrawPixelsTex_clipping",
"(",
"&",
"state",
",",
"x",
",",
"y",
",",
"ibuf",
"->",
"x",
",",
"ibuf",
"->",
"y",
",",
"format",
",",
"GL_FLOAT",
",",
"zoomfilter",
",",
"ibuf",
"->",
"rect_float",
",",
"clip_min_x",
",",
"clip_min_y",
",",
"clip_max_x",
",",
"clip_max_y",
",",
"zoom_x",
",",
"zoom_y",
",",
"NULL",
")",
";",
"}",
"}",
"else",
"if",
"(",
"ibuf",
"->",
"rect",
")",
"{",
"immDrawPixelsTex_clipping",
"(",
"&",
"state",
",",
"x",
",",
"y",
",",
"ibuf",
"->",
"x",
",",
"ibuf",
"->",
"y",
",",
"GL_RGBA",
",",
"GL_UNSIGNED_BYTE",
",",
"zoomfilter",
",",
"ibuf",
"->",
"rect",
",",
"clip_min_x",
",",
"clip_min_y",
",",
"clip_max_x",
",",
"clip_max_y",
",",
"zoom_x",
",",
"zoom_y",
",",
"NULL",
")",
";",
"}",
"IMB_colormanagement_finish_glsl_draw",
"(",
")",
";",
"need_fallback",
"=",
"false",
";",
"}",
"}",
"if",
"(",
"need_fallback",
")",
"{",
"unsigned",
"char",
"*",
"display_buffer",
";",
"void",
"*",
"cache_handle",
";",
"display_buffer",
"=",
"IMB_display_buffer_acquire",
"(",
"ibuf",
",",
"view_settings",
",",
"display_settings",
",",
"&",
"cache_handle",
")",
";",
"if",
"(",
"display_buffer",
")",
"{",
"IMMDrawPixelsTexState",
"state",
"=",
"immDrawPixelsTexSetup",
"(",
"GPU_SHADER_2D_IMAGE_COLOR",
")",
";",
"immDrawPixelsTex_clipping",
"(",
"&",
"state",
",",
"x",
",",
"y",
",",
"ibuf",
"->",
"x",
",",
"ibuf",
"->",
"y",
",",
"GL_RGBA",
",",
"GL_UNSIGNED_BYTE",
",",
"zoomfilter",
",",
"display_buffer",
",",
"clip_min_x",
",",
"clip_min_y",
",",
"clip_max_x",
",",
"clip_max_y",
",",
"zoom_x",
",",
"zoom_y",
",",
"NULL",
")",
";",
"}",
"IMB_display_buffer_release",
"(",
"cache_handle",
")",
";",
"}",
"}"
] | Draw given image buffer on a screen using GLSL for display transform | [
"Draw",
"given",
"image",
"buffer",
"on",
"a",
"screen",
"using",
"GLSL",
"for",
"display",
"transform"
] | [
"/* Early out */",
"/* Single channel images could not be transformed using GLSL yet */",
"/* If user decided not to use GLSL, fallback to glaDrawPixelsAuto */",
"/* Try to draw buffer using GLSL display transform */",
"/* We want GLSL state to be fully handled by OCIO. */",
"/* ibuf->rect is always RGBA */",
"/* In case GLSL failed or not usable, fallback to glaDrawPixelsAuto */"
] | [
{
"param": "ibuf",
"type": "ImBuf"
},
{
"param": "x",
"type": "float"
},
{
"param": "y",
"type": "float"
},
{
"param": "zoomfilter",
"type": "int"
},
{
"param": "view_settings",
"type": "ColorManagedViewSettings"
},
{
"param": "display_settings",
"type": "ColorManagedDisplaySettings"
},
{
"param": "clip_min_x",
"type": "float"
},
{
"param": "clip_min_y",
"type": "float"
},
{
"param": "clip_max_x",
"type": "float"
},
{
"param": "clip_max_y",
"type": "float"
},
{
"param": "zoom_x",
"type": "float"
},
{
"param": "zoom_y",
"type": "float"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ibuf",
"type": "ImBuf",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "x",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "y",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "zoomfilter",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "view_settings",
"type": "ColorManagedViewSettings",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "display_settings",
"type": "ColorManagedDisplaySettings",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "clip_min_x",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "clip_min_y",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "clip_max_x",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "clip_max_y",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "zoom_x",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "zoom_y",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
dc435efd86bca3a60fdcb7498865b68af3d28314 | DemonRem/blender | source/blender/editors/screen/glutil.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | immDrawBorderCorners | void | void immDrawBorderCorners(unsigned int pos, const rcti *border, float zoomx, float zoomy)
{
float delta_x = 4.0f * UI_DPI_FAC / zoomx;
float delta_y = 4.0f * UI_DPI_FAC / zoomy;
delta_x = min_ff(delta_x, border->xmax - border->xmin);
delta_y = min_ff(delta_y, border->ymax - border->ymin);
/* left bottom corner */
immBegin(GPU_PRIM_LINE_STRIP, 3);
immVertex2f(pos, border->xmin, border->ymin + delta_y);
immVertex2f(pos, border->xmin, border->ymin);
immVertex2f(pos, border->xmin + delta_x, border->ymin);
immEnd();
/* left top corner */
immBegin(GPU_PRIM_LINE_STRIP, 3);
immVertex2f(pos, border->xmin, border->ymax - delta_y);
immVertex2f(pos, border->xmin, border->ymax);
immVertex2f(pos, border->xmin + delta_x, border->ymax);
immEnd();
/* right bottom corner */
immBegin(GPU_PRIM_LINE_STRIP, 3);
immVertex2f(pos, border->xmax - delta_x, border->ymin);
immVertex2f(pos, border->xmax, border->ymin);
immVertex2f(pos, border->xmax, border->ymin + delta_y);
immEnd();
/* right top corner */
immBegin(GPU_PRIM_LINE_STRIP, 3);
immVertex2f(pos, border->xmax - delta_x, border->ymax);
immVertex2f(pos, border->xmax, border->ymax);
immVertex2f(pos, border->xmax, border->ymax - delta_y);
immEnd();
} | /* don't move to GPU_immediate_util.h because this uses user-prefs
* and isn't very low level */ | don't move to GPU_immediate_util.h because this uses user-prefs
and isn't very low level | [
"don",
"'",
"t",
"move",
"to",
"GPU_immediate_util",
".",
"h",
"because",
"this",
"uses",
"user",
"-",
"prefs",
"and",
"isn",
"'",
"t",
"very",
"low",
"level"
] | void immDrawBorderCorners(unsigned int pos, const rcti *border, float zoomx, float zoomy)
{
float delta_x = 4.0f * UI_DPI_FAC / zoomx;
float delta_y = 4.0f * UI_DPI_FAC / zoomy;
delta_x = min_ff(delta_x, border->xmax - border->xmin);
delta_y = min_ff(delta_y, border->ymax - border->ymin);
immBegin(GPU_PRIM_LINE_STRIP, 3);
immVertex2f(pos, border->xmin, border->ymin + delta_y);
immVertex2f(pos, border->xmin, border->ymin);
immVertex2f(pos, border->xmin + delta_x, border->ymin);
immEnd();
immBegin(GPU_PRIM_LINE_STRIP, 3);
immVertex2f(pos, border->xmin, border->ymax - delta_y);
immVertex2f(pos, border->xmin, border->ymax);
immVertex2f(pos, border->xmin + delta_x, border->ymax);
immEnd();
immBegin(GPU_PRIM_LINE_STRIP, 3);
immVertex2f(pos, border->xmax - delta_x, border->ymin);
immVertex2f(pos, border->xmax, border->ymin);
immVertex2f(pos, border->xmax, border->ymin + delta_y);
immEnd();
immBegin(GPU_PRIM_LINE_STRIP, 3);
immVertex2f(pos, border->xmax - delta_x, border->ymax);
immVertex2f(pos, border->xmax, border->ymax);
immVertex2f(pos, border->xmax, border->ymax - delta_y);
immEnd();
} | [
"void",
"immDrawBorderCorners",
"(",
"unsigned",
"int",
"pos",
",",
"const",
"rcti",
"*",
"border",
",",
"float",
"zoomx",
",",
"float",
"zoomy",
")",
"{",
"float",
"delta_x",
"=",
"4.0f",
"*",
"UI_DPI_FAC",
"/",
"zoomx",
";",
"float",
"delta_y",
"=",
"4.0f",
"*",
"UI_DPI_FAC",
"/",
"zoomy",
";",
"delta_x",
"=",
"min_ff",
"(",
"delta_x",
",",
"border",
"->",
"xmax",
"-",
"border",
"->",
"xmin",
")",
";",
"delta_y",
"=",
"min_ff",
"(",
"delta_y",
",",
"border",
"->",
"ymax",
"-",
"border",
"->",
"ymin",
")",
";",
"immBegin",
"(",
"GPU_PRIM_LINE_STRIP",
",",
"3",
")",
";",
"immVertex2f",
"(",
"pos",
",",
"border",
"->",
"xmin",
",",
"border",
"->",
"ymin",
"+",
"delta_y",
")",
";",
"immVertex2f",
"(",
"pos",
",",
"border",
"->",
"xmin",
",",
"border",
"->",
"ymin",
")",
";",
"immVertex2f",
"(",
"pos",
",",
"border",
"->",
"xmin",
"+",
"delta_x",
",",
"border",
"->",
"ymin",
")",
";",
"immEnd",
"(",
")",
";",
"immBegin",
"(",
"GPU_PRIM_LINE_STRIP",
",",
"3",
")",
";",
"immVertex2f",
"(",
"pos",
",",
"border",
"->",
"xmin",
",",
"border",
"->",
"ymax",
"-",
"delta_y",
")",
";",
"immVertex2f",
"(",
"pos",
",",
"border",
"->",
"xmin",
",",
"border",
"->",
"ymax",
")",
";",
"immVertex2f",
"(",
"pos",
",",
"border",
"->",
"xmin",
"+",
"delta_x",
",",
"border",
"->",
"ymax",
")",
";",
"immEnd",
"(",
")",
";",
"immBegin",
"(",
"GPU_PRIM_LINE_STRIP",
",",
"3",
")",
";",
"immVertex2f",
"(",
"pos",
",",
"border",
"->",
"xmax",
"-",
"delta_x",
",",
"border",
"->",
"ymin",
")",
";",
"immVertex2f",
"(",
"pos",
",",
"border",
"->",
"xmax",
",",
"border",
"->",
"ymin",
")",
";",
"immVertex2f",
"(",
"pos",
",",
"border",
"->",
"xmax",
",",
"border",
"->",
"ymin",
"+",
"delta_y",
")",
";",
"immEnd",
"(",
")",
";",
"immBegin",
"(",
"GPU_PRIM_LINE_STRIP",
",",
"3",
")",
";",
"immVertex2f",
"(",
"pos",
",",
"border",
"->",
"xmax",
"-",
"delta_x",
",",
"border",
"->",
"ymax",
")",
";",
"immVertex2f",
"(",
"pos",
",",
"border",
"->",
"xmax",
",",
"border",
"->",
"ymax",
")",
";",
"immVertex2f",
"(",
"pos",
",",
"border",
"->",
"xmax",
",",
"border",
"->",
"ymax",
"-",
"delta_y",
")",
";",
"immEnd",
"(",
")",
";",
"}"
] | don't move to GPU_immediate_util.h because this uses user-prefs
and isn't very low level | [
"don",
"'",
"t",
"move",
"to",
"GPU_immediate_util",
".",
"h",
"because",
"this",
"uses",
"user",
"-",
"prefs",
"and",
"isn",
"'",
"t",
"very",
"low",
"level"
] | [
"/* left bottom corner */",
"/* left top corner */",
"/* right bottom corner */",
"/* right top corner */"
] | [
{
"param": "pos",
"type": "unsigned int"
},
{
"param": "border",
"type": "rcti"
},
{
"param": "zoomx",
"type": "float"
},
{
"param": "zoomy",
"type": "float"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pos",
"type": "unsigned int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "border",
"type": "rcti",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "zoomx",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "zoomy",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5c9f0707aa938aa2c6f24c6458ea95c91fec2bf3 | DemonRem/blender | source/blender/editors/animation/anim_deps.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | ANIM_list_elem_update | void | void ANIM_list_elem_update(Main *bmain, Scene *scene, bAnimListElem *ale)
{
ID *id;
FCurve *fcu;
AnimData *adt;
id = ale->id;
if (!id) {
return;
}
/* tag AnimData for refresh so that other views will update in realtime with these changes */
adt = BKE_animdata_from_id(id);
if (adt) {
DEG_id_tag_update(id, ID_RECALC_ANIMATION);
if (adt->action != NULL) {
DEG_id_tag_update(&adt->action->id, ID_RECALC_ANIMATION);
}
}
/* Tag copy on the main object if updating anything directly inside AnimData */
if (ELEM(ale->type,
ANIMTYPE_ANIMDATA,
ANIMTYPE_NLAACTION,
ANIMTYPE_NLATRACK,
ANIMTYPE_NLACURVE)) {
DEG_id_tag_update(id, ID_RECALC_ANIMATION);
return;
}
/* update data */
fcu = (ale->datatype == ALE_FCURVE) ? ale->key_data : NULL;
if (fcu && fcu->rna_path) {
/* if we have an fcurve, call the update for the property we
* are editing, this is then expected to do the proper redraws
* and depsgraph updates */
PointerRNA id_ptr, ptr;
PropertyRNA *prop;
RNA_id_pointer_create(id, &id_ptr);
if (RNA_path_resolve_property(&id_ptr, fcu->rna_path, &ptr, &prop)) {
RNA_property_update_main(bmain, scene, &ptr, prop);
}
}
else {
/* in other case we do standard depsgraph update, ideally
* we'd be calling property update functions here too ... */
DEG_id_tag_update(id,
ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY |
ID_RECALC_ANIMATION); // XXX or do we want something more restrictive?
}
} | /* tags the given anim list element for refreshes (if applicable)
* due to Animation Editor editing
*/ | tags the given anim list element for refreshes (if applicable)
due to Animation Editor editing | [
"tags",
"the",
"given",
"anim",
"list",
"element",
"for",
"refreshes",
"(",
"if",
"applicable",
")",
"due",
"to",
"Animation",
"Editor",
"editing"
] | void ANIM_list_elem_update(Main *bmain, Scene *scene, bAnimListElem *ale)
{
ID *id;
FCurve *fcu;
AnimData *adt;
id = ale->id;
if (!id) {
return;
}
adt = BKE_animdata_from_id(id);
if (adt) {
DEG_id_tag_update(id, ID_RECALC_ANIMATION);
if (adt->action != NULL) {
DEG_id_tag_update(&adt->action->id, ID_RECALC_ANIMATION);
}
}
if (ELEM(ale->type,
ANIMTYPE_ANIMDATA,
ANIMTYPE_NLAACTION,
ANIMTYPE_NLATRACK,
ANIMTYPE_NLACURVE)) {
DEG_id_tag_update(id, ID_RECALC_ANIMATION);
return;
}
fcu = (ale->datatype == ALE_FCURVE) ? ale->key_data : NULL;
if (fcu && fcu->rna_path) {
PointerRNA id_ptr, ptr;
PropertyRNA *prop;
RNA_id_pointer_create(id, &id_ptr);
if (RNA_path_resolve_property(&id_ptr, fcu->rna_path, &ptr, &prop)) {
RNA_property_update_main(bmain, scene, &ptr, prop);
}
}
else {
DEG_id_tag_update(id,
ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY |
ID_RECALC_ANIMATION);
}
} | [
"void",
"ANIM_list_elem_update",
"(",
"Main",
"*",
"bmain",
",",
"Scene",
"*",
"scene",
",",
"bAnimListElem",
"*",
"ale",
")",
"{",
"ID",
"*",
"id",
";",
"FCurve",
"*",
"fcu",
";",
"AnimData",
"*",
"adt",
";",
"id",
"=",
"ale",
"->",
"id",
";",
"if",
"(",
"!",
"id",
")",
"{",
"return",
";",
"}",
"adt",
"=",
"BKE_animdata_from_id",
"(",
"id",
")",
";",
"if",
"(",
"adt",
")",
"{",
"DEG_id_tag_update",
"(",
"id",
",",
"ID_RECALC_ANIMATION",
")",
";",
"if",
"(",
"adt",
"->",
"action",
"!=",
"NULL",
")",
"{",
"DEG_id_tag_update",
"(",
"&",
"adt",
"->",
"action",
"->",
"id",
",",
"ID_RECALC_ANIMATION",
")",
";",
"}",
"}",
"if",
"(",
"ELEM",
"(",
"ale",
"->",
"type",
",",
"ANIMTYPE_ANIMDATA",
",",
"ANIMTYPE_NLAACTION",
",",
"ANIMTYPE_NLATRACK",
",",
"ANIMTYPE_NLACURVE",
")",
")",
"{",
"DEG_id_tag_update",
"(",
"id",
",",
"ID_RECALC_ANIMATION",
")",
";",
"return",
";",
"}",
"fcu",
"=",
"(",
"ale",
"->",
"datatype",
"==",
"ALE_FCURVE",
")",
"?",
"ale",
"->",
"key_data",
":",
"NULL",
";",
"if",
"(",
"fcu",
"&&",
"fcu",
"->",
"rna_path",
")",
"{",
"PointerRNA",
"id_ptr",
",",
"ptr",
";",
"PropertyRNA",
"*",
"prop",
";",
"RNA_id_pointer_create",
"(",
"id",
",",
"&",
"id_ptr",
")",
";",
"if",
"(",
"RNA_path_resolve_property",
"(",
"&",
"id_ptr",
",",
"fcu",
"->",
"rna_path",
",",
"&",
"ptr",
",",
"&",
"prop",
")",
")",
"{",
"RNA_property_update_main",
"(",
"bmain",
",",
"scene",
",",
"&",
"ptr",
",",
"prop",
")",
";",
"}",
"}",
"else",
"{",
"DEG_id_tag_update",
"(",
"id",
",",
"ID_RECALC_TRANSFORM",
"|",
"ID_RECALC_GEOMETRY",
"|",
"ID_RECALC_ANIMATION",
")",
";",
"}",
"}"
] | tags the given anim list element for refreshes (if applicable)
due to Animation Editor editing | [
"tags",
"the",
"given",
"anim",
"list",
"element",
"for",
"refreshes",
"(",
"if",
"applicable",
")",
"due",
"to",
"Animation",
"Editor",
"editing"
] | [
"/* tag AnimData for refresh so that other views will update in realtime with these changes */",
"/* Tag copy on the main object if updating anything directly inside AnimData */",
"/* update data */",
"/* if we have an fcurve, call the update for the property we\n * are editing, this is then expected to do the proper redraws\n * and depsgraph updates */",
"/* in other case we do standard depsgraph update, ideally\n * we'd be calling property update functions here too ... */",
"// XXX or do we want something more restrictive?"
] | [
{
"param": "bmain",
"type": "Main"
},
{
"param": "scene",
"type": "Scene"
},
{
"param": "ale",
"type": "bAnimListElem"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bmain",
"type": "Main",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scene",
"type": "Scene",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ale",
"type": "bAnimListElem",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5c9f0707aa938aa2c6f24c6458ea95c91fec2bf3 | DemonRem/blender | source/blender/editors/animation/anim_deps.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | ANIM_id_update | void | void ANIM_id_update(Main *bmain, ID *id)
{
if (id) {
DEG_id_tag_update_ex(
bmain,
id,
ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY |
ID_RECALC_ANIMATION); // XXX or do we want something more restrictive?
}
} | /* tags the given ID block for refreshes (if applicable) due to
* Animation Editor editing */ | tags the given ID block for refreshes (if applicable) due to
Animation Editor editing | [
"tags",
"the",
"given",
"ID",
"block",
"for",
"refreshes",
"(",
"if",
"applicable",
")",
"due",
"to",
"Animation",
"Editor",
"editing"
] | void ANIM_id_update(Main *bmain, ID *id)
{
if (id) {
DEG_id_tag_update_ex(
bmain,
id,
ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY |
ID_RECALC_ANIMATION);
}
} | [
"void",
"ANIM_id_update",
"(",
"Main",
"*",
"bmain",
",",
"ID",
"*",
"id",
")",
"{",
"if",
"(",
"id",
")",
"{",
"DEG_id_tag_update_ex",
"(",
"bmain",
",",
"id",
",",
"ID_RECALC_TRANSFORM",
"|",
"ID_RECALC_GEOMETRY",
"|",
"ID_RECALC_ANIMATION",
")",
";",
"}",
"}"
] | tags the given ID block for refreshes (if applicable) due to
Animation Editor editing | [
"tags",
"the",
"given",
"ID",
"block",
"for",
"refreshes",
"(",
"if",
"applicable",
")",
"due",
"to",
"Animation",
"Editor",
"editing"
] | [
"// XXX or do we want something more restrictive?"
] | [
{
"param": "bmain",
"type": "Main"
},
{
"param": "id",
"type": "ID"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bmain",
"type": "Main",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "id",
"type": "ID",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5c9f0707aa938aa2c6f24c6458ea95c91fec2bf3 | DemonRem/blender | source/blender/editors/animation/anim_deps.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | animchan_sync_group | void | static void animchan_sync_group(bAnimContext *ac, bAnimListElem *ale, bActionGroup **active_agrp)
{
bActionGroup *agrp = (bActionGroup *)ale->data;
ID *owner_id = ale->id;
/* major priority is selection status
* so we need both a group and an owner
*/
if (ELEM(NULL, agrp, owner_id)) {
return;
}
/* for standard Objects, check if group is the name of some bone */
if (GS(owner_id->name) == ID_OB) {
Object *ob = (Object *)owner_id;
/* check if there are bones, and whether the name matches any
* NOTE: this feature will only really work if groups by default contain the F-Curves
* for a single bone.
*/
if (ob->pose) {
bPoseChannel *pchan = BKE_pose_channel_find_name(ob->pose, agrp->name);
bArmature *arm = ob->data;
if (pchan) {
bActionGroup *bgrp;
/* if one matches, sync the selection status */
if ((pchan->bone) && (pchan->bone->flag & BONE_SELECTED)) {
agrp->flag |= AGRP_SELECTED;
}
else {
agrp->flag &= ~AGRP_SELECTED;
}
/* also sync active group status */
if ((ob == ac->obact) && (pchan->bone == arm->act_bone)) {
/* if no previous F-Curve has active flag, then we're the first and only one to get it */
if (*active_agrp == NULL) {
agrp->flag |= AGRP_ACTIVE;
*active_agrp = agrp;
}
else {
/* someone else has already taken it - set as not active */
agrp->flag &= ~AGRP_ACTIVE;
}
}
else {
/* this can't possibly be active now */
agrp->flag &= ~AGRP_ACTIVE;
}
/* sync group colors */
bgrp = (bActionGroup *)BLI_findlink(&ob->pose->agroups, (pchan->agrp_index - 1));
if (bgrp) {
agrp->customCol = bgrp->customCol;
action_group_colors_sync(agrp, bgrp);
}
}
}
}
} | /* perform syncing updates for Action Groups */ | perform syncing updates for Action Groups | [
"perform",
"syncing",
"updates",
"for",
"Action",
"Groups"
] | static void animchan_sync_group(bAnimContext *ac, bAnimListElem *ale, bActionGroup **active_agrp)
{
bActionGroup *agrp = (bActionGroup *)ale->data;
ID *owner_id = ale->id;
if (ELEM(NULL, agrp, owner_id)) {
return;
}
if (GS(owner_id->name) == ID_OB) {
Object *ob = (Object *)owner_id;
if (ob->pose) {
bPoseChannel *pchan = BKE_pose_channel_find_name(ob->pose, agrp->name);
bArmature *arm = ob->data;
if (pchan) {
bActionGroup *bgrp;
if ((pchan->bone) && (pchan->bone->flag & BONE_SELECTED)) {
agrp->flag |= AGRP_SELECTED;
}
else {
agrp->flag &= ~AGRP_SELECTED;
}
if ((ob == ac->obact) && (pchan->bone == arm->act_bone)) {
if (*active_agrp == NULL) {
agrp->flag |= AGRP_ACTIVE;
*active_agrp = agrp;
}
else {
agrp->flag &= ~AGRP_ACTIVE;
}
}
else {
agrp->flag &= ~AGRP_ACTIVE;
}
bgrp = (bActionGroup *)BLI_findlink(&ob->pose->agroups, (pchan->agrp_index - 1));
if (bgrp) {
agrp->customCol = bgrp->customCol;
action_group_colors_sync(agrp, bgrp);
}
}
}
}
} | [
"static",
"void",
"animchan_sync_group",
"(",
"bAnimContext",
"*",
"ac",
",",
"bAnimListElem",
"*",
"ale",
",",
"bActionGroup",
"*",
"*",
"active_agrp",
")",
"{",
"bActionGroup",
"*",
"agrp",
"=",
"(",
"bActionGroup",
"*",
")",
"ale",
"->",
"data",
";",
"ID",
"*",
"owner_id",
"=",
"ale",
"->",
"id",
";",
"if",
"(",
"ELEM",
"(",
"NULL",
",",
"agrp",
",",
"owner_id",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"GS",
"(",
"owner_id",
"->",
"name",
")",
"==",
"ID_OB",
")",
"{",
"Object",
"*",
"ob",
"=",
"(",
"Object",
"*",
")",
"owner_id",
";",
"if",
"(",
"ob",
"->",
"pose",
")",
"{",
"bPoseChannel",
"*",
"pchan",
"=",
"BKE_pose_channel_find_name",
"(",
"ob",
"->",
"pose",
",",
"agrp",
"->",
"name",
")",
";",
"bArmature",
"*",
"arm",
"=",
"ob",
"->",
"data",
";",
"if",
"(",
"pchan",
")",
"{",
"bActionGroup",
"*",
"bgrp",
";",
"if",
"(",
"(",
"pchan",
"->",
"bone",
")",
"&&",
"(",
"pchan",
"->",
"bone",
"->",
"flag",
"&",
"BONE_SELECTED",
")",
")",
"{",
"agrp",
"->",
"flag",
"|=",
"AGRP_SELECTED",
";",
"}",
"else",
"{",
"agrp",
"->",
"flag",
"&=",
"~",
"AGRP_SELECTED",
";",
"}",
"if",
"(",
"(",
"ob",
"==",
"ac",
"->",
"obact",
")",
"&&",
"(",
"pchan",
"->",
"bone",
"==",
"arm",
"->",
"act_bone",
")",
")",
"{",
"if",
"(",
"*",
"active_agrp",
"==",
"NULL",
")",
"{",
"agrp",
"->",
"flag",
"|=",
"AGRP_ACTIVE",
";",
"*",
"active_agrp",
"=",
"agrp",
";",
"}",
"else",
"{",
"agrp",
"->",
"flag",
"&=",
"~",
"AGRP_ACTIVE",
";",
"}",
"}",
"else",
"{",
"agrp",
"->",
"flag",
"&=",
"~",
"AGRP_ACTIVE",
";",
"}",
"bgrp",
"=",
"(",
"bActionGroup",
"*",
")",
"BLI_findlink",
"(",
"&",
"ob",
"->",
"pose",
"->",
"agroups",
",",
"(",
"pchan",
"->",
"agrp_index",
"-",
"1",
")",
")",
";",
"if",
"(",
"bgrp",
")",
"{",
"agrp",
"->",
"customCol",
"=",
"bgrp",
"->",
"customCol",
";",
"action_group_colors_sync",
"(",
"agrp",
",",
"bgrp",
")",
";",
"}",
"}",
"}",
"}",
"}"
] | perform syncing updates for Action Groups | [
"perform",
"syncing",
"updates",
"for",
"Action",
"Groups"
] | [
"/* major priority is selection status\n * so we need both a group and an owner\n */",
"/* for standard Objects, check if group is the name of some bone */",
"/* check if there are bones, and whether the name matches any\n * NOTE: this feature will only really work if groups by default contain the F-Curves\n * for a single bone.\n */",
"/* if one matches, sync the selection status */",
"/* also sync active group status */",
"/* if no previous F-Curve has active flag, then we're the first and only one to get it */",
"/* someone else has already taken it - set as not active */",
"/* this can't possibly be active now */",
"/* sync group colors */"
] | [
{
"param": "ac",
"type": "bAnimContext"
},
{
"param": "ale",
"type": "bAnimListElem"
},
{
"param": "active_agrp",
"type": "bActionGroup"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ac",
"type": "bAnimContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ale",
"type": "bAnimListElem",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "active_agrp",
"type": "bActionGroup",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5c9f0707aa938aa2c6f24c6458ea95c91fec2bf3 | DemonRem/blender | source/blender/editors/animation/anim_deps.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | animchan_sync_fcurve | void | static void animchan_sync_fcurve(bAnimContext *UNUSED(ac),
bAnimListElem *ale,
FCurve **active_fcurve)
{
FCurve *fcu = (FCurve *)ale->data;
ID *owner_id = ale->id;
/* major priority is selection status, so refer to the checks done in anim_filter.c
* skip_fcurve_selected_data() for reference about what's going on here...
*/
if (ELEM(NULL, fcu, fcu->rna_path, owner_id)) {
return;
}
if (GS(owner_id->name) == ID_SCE) {
Scene *scene = (Scene *)owner_id;
/* only affect if F-Curve involves sequence_editor.sequences */
if ((fcu->rna_path) && strstr(fcu->rna_path, "sequences_all")) {
Editing *ed = BKE_sequencer_editing_get(scene, false);
Sequence *seq;
char *seq_name;
/* get strip name, and check if this strip is selected */
seq_name = BLI_str_quoted_substrN(fcu->rna_path, "sequences_all[");
seq = BKE_sequence_get_by_name(ed->seqbasep, seq_name, false);
if (seq_name) {
MEM_freeN(seq_name);
}
/* update selection status */
if (seq) {
if (seq->flag & SELECT) {
fcu->flag |= FCURVE_SELECTED;
}
else {
fcu->flag &= ~FCURVE_SELECTED;
}
}
}
}
else if (GS(owner_id->name) == ID_NT) {
bNodeTree *ntree = (bNodeTree *)owner_id;
/* check for selected nodes */
if ((fcu->rna_path) && strstr(fcu->rna_path, "nodes")) {
bNode *node;
char *node_name;
/* get strip name, and check if this strip is selected */
node_name = BLI_str_quoted_substrN(fcu->rna_path, "nodes[");
node = nodeFindNodebyName(ntree, node_name);
if (node_name) {
MEM_freeN(node_name);
}
/* update selection/active status */
if (node) {
/* update selection status */
if (node->flag & NODE_SELECT) {
fcu->flag |= FCURVE_SELECTED;
}
else {
fcu->flag &= ~FCURVE_SELECTED;
}
/* update active status */
/* XXX: this may interfere with setting bones as active if both exist at once;
* then again, if that's the case, production setups aren't likely to be animating
* nodes while working with bones?
*/
if (node->flag & NODE_ACTIVE) {
if (*active_fcurve == NULL) {
fcu->flag |= FCURVE_ACTIVE;
*active_fcurve = fcu;
}
else {
fcu->flag &= ~FCURVE_ACTIVE;
}
}
else {
fcu->flag &= ~FCURVE_ACTIVE;
}
}
}
}
} | /* perform syncing updates for F-Curves */ | perform syncing updates for F-Curves | [
"perform",
"syncing",
"updates",
"for",
"F",
"-",
"Curves"
] | static void animchan_sync_fcurve(bAnimContext *UNUSED(ac),
bAnimListElem *ale,
FCurve **active_fcurve)
{
FCurve *fcu = (FCurve *)ale->data;
ID *owner_id = ale->id;
if (ELEM(NULL, fcu, fcu->rna_path, owner_id)) {
return;
}
if (GS(owner_id->name) == ID_SCE) {
Scene *scene = (Scene *)owner_id;
if ((fcu->rna_path) && strstr(fcu->rna_path, "sequences_all")) {
Editing *ed = BKE_sequencer_editing_get(scene, false);
Sequence *seq;
char *seq_name;
seq_name = BLI_str_quoted_substrN(fcu->rna_path, "sequences_all[");
seq = BKE_sequence_get_by_name(ed->seqbasep, seq_name, false);
if (seq_name) {
MEM_freeN(seq_name);
}
if (seq) {
if (seq->flag & SELECT) {
fcu->flag |= FCURVE_SELECTED;
}
else {
fcu->flag &= ~FCURVE_SELECTED;
}
}
}
}
else if (GS(owner_id->name) == ID_NT) {
bNodeTree *ntree = (bNodeTree *)owner_id;
if ((fcu->rna_path) && strstr(fcu->rna_path, "nodes")) {
bNode *node;
char *node_name;
node_name = BLI_str_quoted_substrN(fcu->rna_path, "nodes[");
node = nodeFindNodebyName(ntree, node_name);
if (node_name) {
MEM_freeN(node_name);
}
if (node) {
if (node->flag & NODE_SELECT) {
fcu->flag |= FCURVE_SELECTED;
}
else {
fcu->flag &= ~FCURVE_SELECTED;
}
if (node->flag & NODE_ACTIVE) {
if (*active_fcurve == NULL) {
fcu->flag |= FCURVE_ACTIVE;
*active_fcurve = fcu;
}
else {
fcu->flag &= ~FCURVE_ACTIVE;
}
}
else {
fcu->flag &= ~FCURVE_ACTIVE;
}
}
}
}
} | [
"static",
"void",
"animchan_sync_fcurve",
"(",
"bAnimContext",
"*",
"UNUSED",
"(",
"ac",
")",
",",
"bAnimListElem",
"*",
"ale",
",",
"FCurve",
"*",
"*",
"active_fcurve",
")",
"{",
"FCurve",
"*",
"fcu",
"=",
"(",
"FCurve",
"*",
")",
"ale",
"->",
"data",
";",
"ID",
"*",
"owner_id",
"=",
"ale",
"->",
"id",
";",
"if",
"(",
"ELEM",
"(",
"NULL",
",",
"fcu",
",",
"fcu",
"->",
"rna_path",
",",
"owner_id",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"GS",
"(",
"owner_id",
"->",
"name",
")",
"==",
"ID_SCE",
")",
"{",
"Scene",
"*",
"scene",
"=",
"(",
"Scene",
"*",
")",
"owner_id",
";",
"if",
"(",
"(",
"fcu",
"->",
"rna_path",
")",
"&&",
"strstr",
"(",
"fcu",
"->",
"rna_path",
",",
"\"",
"\"",
")",
")",
"{",
"Editing",
"*",
"ed",
"=",
"BKE_sequencer_editing_get",
"(",
"scene",
",",
"false",
")",
";",
"Sequence",
"*",
"seq",
";",
"char",
"*",
"seq_name",
";",
"seq_name",
"=",
"BLI_str_quoted_substrN",
"(",
"fcu",
"->",
"rna_path",
",",
"\"",
"\"",
")",
";",
"seq",
"=",
"BKE_sequence_get_by_name",
"(",
"ed",
"->",
"seqbasep",
",",
"seq_name",
",",
"false",
")",
";",
"if",
"(",
"seq_name",
")",
"{",
"MEM_freeN",
"(",
"seq_name",
")",
";",
"}",
"if",
"(",
"seq",
")",
"{",
"if",
"(",
"seq",
"->",
"flag",
"&",
"SELECT",
")",
"{",
"fcu",
"->",
"flag",
"|=",
"FCURVE_SELECTED",
";",
"}",
"else",
"{",
"fcu",
"->",
"flag",
"&=",
"~",
"FCURVE_SELECTED",
";",
"}",
"}",
"}",
"}",
"else",
"if",
"(",
"GS",
"(",
"owner_id",
"->",
"name",
")",
"==",
"ID_NT",
")",
"{",
"bNodeTree",
"*",
"ntree",
"=",
"(",
"bNodeTree",
"*",
")",
"owner_id",
";",
"if",
"(",
"(",
"fcu",
"->",
"rna_path",
")",
"&&",
"strstr",
"(",
"fcu",
"->",
"rna_path",
",",
"\"",
"\"",
")",
")",
"{",
"bNode",
"*",
"node",
";",
"char",
"*",
"node_name",
";",
"node_name",
"=",
"BLI_str_quoted_substrN",
"(",
"fcu",
"->",
"rna_path",
",",
"\"",
"\"",
")",
";",
"node",
"=",
"nodeFindNodebyName",
"(",
"ntree",
",",
"node_name",
")",
";",
"if",
"(",
"node_name",
")",
"{",
"MEM_freeN",
"(",
"node_name",
")",
";",
"}",
"if",
"(",
"node",
")",
"{",
"if",
"(",
"node",
"->",
"flag",
"&",
"NODE_SELECT",
")",
"{",
"fcu",
"->",
"flag",
"|=",
"FCURVE_SELECTED",
";",
"}",
"else",
"{",
"fcu",
"->",
"flag",
"&=",
"~",
"FCURVE_SELECTED",
";",
"}",
"if",
"(",
"node",
"->",
"flag",
"&",
"NODE_ACTIVE",
")",
"{",
"if",
"(",
"*",
"active_fcurve",
"==",
"NULL",
")",
"{",
"fcu",
"->",
"flag",
"|=",
"FCURVE_ACTIVE",
";",
"*",
"active_fcurve",
"=",
"fcu",
";",
"}",
"else",
"{",
"fcu",
"->",
"flag",
"&=",
"~",
"FCURVE_ACTIVE",
";",
"}",
"}",
"else",
"{",
"fcu",
"->",
"flag",
"&=",
"~",
"FCURVE_ACTIVE",
";",
"}",
"}",
"}",
"}",
"}"
] | perform syncing updates for F-Curves | [
"perform",
"syncing",
"updates",
"for",
"F",
"-",
"Curves"
] | [
"/* major priority is selection status, so refer to the checks done in anim_filter.c\n * skip_fcurve_selected_data() for reference about what's going on here...\n */",
"/* only affect if F-Curve involves sequence_editor.sequences */",
"/* get strip name, and check if this strip is selected */",
"/* update selection status */",
"/* check for selected nodes */",
"/* get strip name, and check if this strip is selected */",
"/* update selection/active status */",
"/* update selection status */",
"/* update active status */",
"/* XXX: this may interfere with setting bones as active if both exist at once;\n * then again, if that's the case, production setups aren't likely to be animating\n * nodes while working with bones?\n */"
] | [
{
"param": "UNUSED",
"type": "bAnimContext"
},
{
"param": "ale",
"type": "bAnimListElem"
},
{
"param": "active_fcurve",
"type": "FCurve"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "UNUSED",
"type": "bAnimContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ale",
"type": "bAnimListElem",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "active_fcurve",
"type": "FCurve",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5c9f0707aa938aa2c6f24c6458ea95c91fec2bf3 | DemonRem/blender | source/blender/editors/animation/anim_deps.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | animchan_sync_gplayer | void | static void animchan_sync_gplayer(bAnimContext *UNUSED(ac), bAnimListElem *ale)
{
bGPDlayer *gpl = (bGPDlayer *)ale->data;
/* Make sure the selection flags agree with the "active" flag.
* The selection flags are used in the Dopesheet only, whereas
* the active flag is used everywhere else. Hence, we try to
* sync these here so that it all seems to be have as the user
* expects - T50184
*
* Assume that we only really do this when the active status changes.
* (NOTE: This may prove annoying if it means selection is always lost)
*/
if (gpl->flag & GP_LAYER_ACTIVE) {
gpl->flag |= GP_LAYER_SELECT;
}
else {
gpl->flag &= ~GP_LAYER_SELECT;
}
} | /* perform syncing updates for GPencil Layers */ | perform syncing updates for GPencil Layers | [
"perform",
"syncing",
"updates",
"for",
"GPencil",
"Layers"
] | static void animchan_sync_gplayer(bAnimContext *UNUSED(ac), bAnimListElem *ale)
{
bGPDlayer *gpl = (bGPDlayer *)ale->data;
if (gpl->flag & GP_LAYER_ACTIVE) {
gpl->flag |= GP_LAYER_SELECT;
}
else {
gpl->flag &= ~GP_LAYER_SELECT;
}
} | [
"static",
"void",
"animchan_sync_gplayer",
"(",
"bAnimContext",
"*",
"UNUSED",
"(",
"ac",
")",
",",
"bAnimListElem",
"*",
"ale",
")",
"{",
"bGPDlayer",
"*",
"gpl",
"=",
"(",
"bGPDlayer",
"*",
")",
"ale",
"->",
"data",
";",
"if",
"(",
"gpl",
"->",
"flag",
"&",
"GP_LAYER_ACTIVE",
")",
"{",
"gpl",
"->",
"flag",
"|=",
"GP_LAYER_SELECT",
";",
"}",
"else",
"{",
"gpl",
"->",
"flag",
"&=",
"~",
"GP_LAYER_SELECT",
";",
"}",
"}"
] | perform syncing updates for GPencil Layers | [
"perform",
"syncing",
"updates",
"for",
"GPencil",
"Layers"
] | [
"/* Make sure the selection flags agree with the \"active\" flag.\n * The selection flags are used in the Dopesheet only, whereas\n * the active flag is used everywhere else. Hence, we try to\n * sync these here so that it all seems to be have as the user\n * expects - T50184\n *\n * Assume that we only really do this when the active status changes.\n * (NOTE: This may prove annoying if it means selection is always lost)\n */"
] | [
{
"param": "UNUSED",
"type": "bAnimContext"
},
{
"param": "ale",
"type": "bAnimListElem"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "UNUSED",
"type": "bAnimContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ale",
"type": "bAnimListElem",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5c9f0707aa938aa2c6f24c6458ea95c91fec2bf3 | DemonRem/blender | source/blender/editors/animation/anim_deps.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | ANIM_sync_animchannels_to_data | void | void ANIM_sync_animchannels_to_data(const bContext *C)
{
bAnimContext ac;
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
bActionGroup *active_agrp = NULL;
FCurve *active_fcurve = NULL;
/* get animation context info for filtering the channels */
if (ANIM_animdata_get_context(C, &ac) == 0) {
return;
}
/* filter data */
/* NOTE: we want all channels, since we want to be able to set selection status on some of them
* even when collapsed... however,
* don't include duplicates so that selection statuses don't override each other.
*/
filter = ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_CHANNELS | ANIMFILTER_NODUPLIS;
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* flush settings as appropriate depending on the types of the channels */
for (ale = anim_data.first; ale; ale = ale->next) {
switch (ale->type) {
case ANIMTYPE_GROUP:
animchan_sync_group(&ac, ale, &active_agrp);
break;
case ANIMTYPE_FCURVE:
animchan_sync_fcurve(&ac, ale, &active_fcurve);
break;
case ANIMTYPE_GPLAYER:
animchan_sync_gplayer(&ac, ale);
break;
}
}
ANIM_animdata_freelist(&anim_data);
} | /* Main call to be exported to animation editors */ | Main call to be exported to animation editors | [
"Main",
"call",
"to",
"be",
"exported",
"to",
"animation",
"editors"
] | void ANIM_sync_animchannels_to_data(const bContext *C)
{
bAnimContext ac;
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
bActionGroup *active_agrp = NULL;
FCurve *active_fcurve = NULL;
if (ANIM_animdata_get_context(C, &ac) == 0) {
return;
}
filter = ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_CHANNELS | ANIMFILTER_NODUPLIS;
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
for (ale = anim_data.first; ale; ale = ale->next) {
switch (ale->type) {
case ANIMTYPE_GROUP:
animchan_sync_group(&ac, ale, &active_agrp);
break;
case ANIMTYPE_FCURVE:
animchan_sync_fcurve(&ac, ale, &active_fcurve);
break;
case ANIMTYPE_GPLAYER:
animchan_sync_gplayer(&ac, ale);
break;
}
}
ANIM_animdata_freelist(&anim_data);
} | [
"void",
"ANIM_sync_animchannels_to_data",
"(",
"const",
"bContext",
"*",
"C",
")",
"{",
"bAnimContext",
"ac",
";",
"ListBase",
"anim_data",
"=",
"{",
"NULL",
",",
"NULL",
"}",
";",
"bAnimListElem",
"*",
"ale",
";",
"int",
"filter",
";",
"bActionGroup",
"*",
"active_agrp",
"=",
"NULL",
";",
"FCurve",
"*",
"active_fcurve",
"=",
"NULL",
";",
"if",
"(",
"ANIM_animdata_get_context",
"(",
"C",
",",
"&",
"ac",
")",
"==",
"0",
")",
"{",
"return",
";",
"}",
"filter",
"=",
"ANIMFILTER_DATA_VISIBLE",
"|",
"ANIMFILTER_LIST_CHANNELS",
"|",
"ANIMFILTER_NODUPLIS",
";",
"ANIM_animdata_filter",
"(",
"&",
"ac",
",",
"&",
"anim_data",
",",
"filter",
",",
"ac",
".",
"data",
",",
"ac",
".",
"datatype",
")",
";",
"for",
"(",
"ale",
"=",
"anim_data",
".",
"first",
";",
"ale",
";",
"ale",
"=",
"ale",
"->",
"next",
")",
"{",
"switch",
"(",
"ale",
"->",
"type",
")",
"{",
"case",
"ANIMTYPE_GROUP",
":",
"animchan_sync_group",
"(",
"&",
"ac",
",",
"ale",
",",
"&",
"active_agrp",
")",
";",
"break",
";",
"case",
"ANIMTYPE_FCURVE",
":",
"animchan_sync_fcurve",
"(",
"&",
"ac",
",",
"ale",
",",
"&",
"active_fcurve",
")",
";",
"break",
";",
"case",
"ANIMTYPE_GPLAYER",
":",
"animchan_sync_gplayer",
"(",
"&",
"ac",
",",
"ale",
")",
";",
"break",
";",
"}",
"}",
"ANIM_animdata_freelist",
"(",
"&",
"anim_data",
")",
";",
"}"
] | Main call to be exported to animation editors | [
"Main",
"call",
"to",
"be",
"exported",
"to",
"animation",
"editors"
] | [
"/* get animation context info for filtering the channels */",
"/* filter data */",
"/* NOTE: we want all channels, since we want to be able to set selection status on some of them\n * even when collapsed... however,\n * don't include duplicates so that selection statuses don't override each other.\n */",
"/* flush settings as appropriate depending on the types of the channels */"
] | [
{
"param": "C",
"type": "bContext"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d84beb79be6dbb68e03c623ca1e97f3c70a8850d | DemonRem/blender | source/blender/editors/space_text/text_format_py.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | txtfmt_py_find_builtinfunc | int | static int txtfmt_py_find_builtinfunc(const char *string)
{
int i, len;
/* list is from...
* ", ".join(['"%s"' % kw
* for kw in __import__("keyword").kwlist
* if kw not in {"False", "None", "True", "def", "class"}])
*
* ... and for this code:
* print("\n".join(['else if (STR_LITERAL_STARTSWITH(string, "%s", len)) i = len;' % kw
* for kw in __import__("keyword").kwlist
* if kw not in {"False", "None", "True", "def", "class"}]))
*/
/* Keep aligned args for readability. */
/* clang-format off */
if (STR_LITERAL_STARTSWITH(string, "assert", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "async", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "await", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "and", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "as", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "break", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "continue", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "del", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "elif", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "else", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "except", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "finally", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "for", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "from", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "global", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "if", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "import", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "in", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "is", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "lambda", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "nonlocal", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "not", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "or", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "pass", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "raise", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "return", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "try", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "while", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "with", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "yield", len)) { i = len;
} else { i = 0;
}
/* clang-format on */
/* If next source char is an identifier (eg. 'i' in "definite") no match */
if (i == 0 || text_check_identifier(string[i])) {
return -1;
}
return i;
} | /**
* Checks the specified source string for a Python built-in function name. This
* name must start at the beginning of the source string and must be followed by
* a non-identifier (see #text_check_identifier(char)) or null character.
*
* If a built-in function is found, the length of the matching name is returned.
* Otherwise, -1 is returned.
*
* See:
* http://docs.python.org/py3k/reference/lexical_analysis.html#keywords
*/ | Checks the specified source string for a Python built-in function name. This
name must start at the beginning of the source string and must be followed by
a non-identifier ) or null character.
If a built-in function is found, the length of the matching name is returned.
Otherwise, -1 is returned.
| [
"Checks",
"the",
"specified",
"source",
"string",
"for",
"a",
"Python",
"built",
"-",
"in",
"function",
"name",
".",
"This",
"name",
"must",
"start",
"at",
"the",
"beginning",
"of",
"the",
"source",
"string",
"and",
"must",
"be",
"followed",
"by",
"a",
"non",
"-",
"identifier",
")",
"or",
"null",
"character",
".",
"If",
"a",
"built",
"-",
"in",
"function",
"is",
"found",
"the",
"length",
"of",
"the",
"matching",
"name",
"is",
"returned",
".",
"Otherwise",
"-",
"1",
"is",
"returned",
"."
] | static int txtfmt_py_find_builtinfunc(const char *string)
{
int i, len;
if (STR_LITERAL_STARTSWITH(string, "assert", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "async", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "await", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "and", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "as", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "break", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "continue", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "del", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "elif", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "else", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "except", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "finally", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "for", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "from", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "global", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "if", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "import", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "in", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "is", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "lambda", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "nonlocal", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "not", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "or", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "pass", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "raise", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "return", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "try", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "while", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "with", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "yield", len)) { i = len;
} else { i = 0;
}
if (i == 0 || text_check_identifier(string[i])) {
return -1;
}
return i;
} | [
"static",
"int",
"txtfmt_py_find_builtinfunc",
"(",
"const",
"char",
"*",
"string",
")",
"{",
"int",
"i",
",",
"len",
";",
"if",
"(",
"STR_LITERAL_STARTSWITH",
"(",
"string",
",",
"\"",
"\"",
",",
"len",
")",
")",
"{",
"i",
"=",
"len",
";",
"}",
"else",
"if",
"(",
"STR_LITERAL_STARTSWITH",
"(",
"string",
",",
"\"",
"\"",
",",
"len",
")",
")",
"{",
"i",
"=",
"len",
";",
"}",
"else",
"if",
"(",
"STR_LITERAL_STARTSWITH",
"(",
"string",
",",
"\"",
"\"",
",",
"len",
")",
")",
"{",
"i",
"=",
"len",
";",
"}",
"else",
"if",
"(",
"STR_LITERAL_STARTSWITH",
"(",
"string",
",",
"\"",
"\"",
",",
"len",
")",
")",
"{",
"i",
"=",
"len",
";",
"}",
"else",
"if",
"(",
"STR_LITERAL_STARTSWITH",
"(",
"string",
",",
"\"",
"\"",
",",
"len",
")",
")",
"{",
"i",
"=",
"len",
";",
"}",
"else",
"if",
"(",
"STR_LITERAL_STARTSWITH",
"(",
"string",
",",
"\"",
"\"",
",",
"len",
")",
")",
"{",
"i",
"=",
"len",
";",
"}",
"else",
"if",
"(",
"STR_LITERAL_STARTSWITH",
"(",
"string",
",",
"\"",
"\"",
",",
"len",
")",
")",
"{",
"i",
"=",
"len",
";",
"}",
"else",
"if",
"(",
"STR_LITERAL_STARTSWITH",
"(",
"string",
",",
"\"",
"\"",
",",
"len",
")",
")",
"{",
"i",
"=",
"len",
";",
"}",
"else",
"if",
"(",
"STR_LITERAL_STARTSWITH",
"(",
"string",
",",
"\"",
"\"",
",",
"len",
")",
")",
"{",
"i",
"=",
"len",
";",
"}",
"else",
"if",
"(",
"STR_LITERAL_STARTSWITH",
"(",
"string",
",",
"\"",
"\"",
",",
"len",
")",
")",
"{",
"i",
"=",
"len",
";",
"}",
"else",
"if",
"(",
"STR_LITERAL_STARTSWITH",
"(",
"string",
",",
"\"",
"\"",
",",
"len",
")",
")",
"{",
"i",
"=",
"len",
";",
"}",
"else",
"if",
"(",
"STR_LITERAL_STARTSWITH",
"(",
"string",
",",
"\"",
"\"",
",",
"len",
")",
")",
"{",
"i",
"=",
"len",
";",
"}",
"else",
"if",
"(",
"STR_LITERAL_STARTSWITH",
"(",
"string",
",",
"\"",
"\"",
",",
"len",
")",
")",
"{",
"i",
"=",
"len",
";",
"}",
"else",
"if",
"(",
"STR_LITERAL_STARTSWITH",
"(",
"string",
",",
"\"",
"\"",
",",
"len",
")",
")",
"{",
"i",
"=",
"len",
";",
"}",
"else",
"if",
"(",
"STR_LITERAL_STARTSWITH",
"(",
"string",
",",
"\"",
"\"",
",",
"len",
")",
")",
"{",
"i",
"=",
"len",
";",
"}",
"else",
"if",
"(",
"STR_LITERAL_STARTSWITH",
"(",
"string",
",",
"\"",
"\"",
",",
"len",
")",
")",
"{",
"i",
"=",
"len",
";",
"}",
"else",
"if",
"(",
"STR_LITERAL_STARTSWITH",
"(",
"string",
",",
"\"",
"\"",
",",
"len",
")",
")",
"{",
"i",
"=",
"len",
";",
"}",
"else",
"if",
"(",
"STR_LITERAL_STARTSWITH",
"(",
"string",
",",
"\"",
"\"",
",",
"len",
")",
")",
"{",
"i",
"=",
"len",
";",
"}",
"else",
"if",
"(",
"STR_LITERAL_STARTSWITH",
"(",
"string",
",",
"\"",
"\"",
",",
"len",
")",
")",
"{",
"i",
"=",
"len",
";",
"}",
"else",
"if",
"(",
"STR_LITERAL_STARTSWITH",
"(",
"string",
",",
"\"",
"\"",
",",
"len",
")",
")",
"{",
"i",
"=",
"len",
";",
"}",
"else",
"if",
"(",
"STR_LITERAL_STARTSWITH",
"(",
"string",
",",
"\"",
"\"",
",",
"len",
")",
")",
"{",
"i",
"=",
"len",
";",
"}",
"else",
"if",
"(",
"STR_LITERAL_STARTSWITH",
"(",
"string",
",",
"\"",
"\"",
",",
"len",
")",
")",
"{",
"i",
"=",
"len",
";",
"}",
"else",
"if",
"(",
"STR_LITERAL_STARTSWITH",
"(",
"string",
",",
"\"",
"\"",
",",
"len",
")",
")",
"{",
"i",
"=",
"len",
";",
"}",
"else",
"if",
"(",
"STR_LITERAL_STARTSWITH",
"(",
"string",
",",
"\"",
"\"",
",",
"len",
")",
")",
"{",
"i",
"=",
"len",
";",
"}",
"else",
"if",
"(",
"STR_LITERAL_STARTSWITH",
"(",
"string",
",",
"\"",
"\"",
",",
"len",
")",
")",
"{",
"i",
"=",
"len",
";",
"}",
"else",
"if",
"(",
"STR_LITERAL_STARTSWITH",
"(",
"string",
",",
"\"",
"\"",
",",
"len",
")",
")",
"{",
"i",
"=",
"len",
";",
"}",
"else",
"if",
"(",
"STR_LITERAL_STARTSWITH",
"(",
"string",
",",
"\"",
"\"",
",",
"len",
")",
")",
"{",
"i",
"=",
"len",
";",
"}",
"else",
"if",
"(",
"STR_LITERAL_STARTSWITH",
"(",
"string",
",",
"\"",
"\"",
",",
"len",
")",
")",
"{",
"i",
"=",
"len",
";",
"}",
"else",
"if",
"(",
"STR_LITERAL_STARTSWITH",
"(",
"string",
",",
"\"",
"\"",
",",
"len",
")",
")",
"{",
"i",
"=",
"len",
";",
"}",
"else",
"if",
"(",
"STR_LITERAL_STARTSWITH",
"(",
"string",
",",
"\"",
"\"",
",",
"len",
")",
")",
"{",
"i",
"=",
"len",
";",
"}",
"else",
"{",
"i",
"=",
"0",
";",
"}",
"if",
"(",
"i",
"==",
"0",
"||",
"text_check_identifier",
"(",
"string",
"[",
"i",
"]",
")",
")",
"{",
"return",
"-1",
";",
"}",
"return",
"i",
";",
"}"
] | Checks the specified source string for a Python built-in function name. | [
"Checks",
"the",
"specified",
"source",
"string",
"for",
"a",
"Python",
"built",
"-",
"in",
"function",
"name",
"."
] | [
"/* list is from...\n * \", \".join(['\"%s\"' % kw\n * for kw in __import__(\"keyword\").kwlist\n * if kw not in {\"False\", \"None\", \"True\", \"def\", \"class\"}])\n *\n * ... and for this code:\n * print(\"\\n\".join(['else if (STR_LITERAL_STARTSWITH(string, \"%s\", len)) i = len;' % kw\n * for kw in __import__(\"keyword\").kwlist\n * if kw not in {\"False\", \"None\", \"True\", \"def\", \"class\"}]))\n */",
"/* Keep aligned args for readability. */",
"/* clang-format off */",
"/* clang-format on */",
"/* If next source char is an identifier (eg. 'i' in \"definite\") no match */"
] | [
{
"param": "string",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "string",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d84beb79be6dbb68e03c623ca1e97f3c70a8850d | DemonRem/blender | source/blender/editors/space_text/text_format_py.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | txtfmt_py_find_specialvar | int | static int txtfmt_py_find_specialvar(const char *string)
{
int i, len;
/* Keep aligned args for readability. */
/* clang-format off */
if (STR_LITERAL_STARTSWITH(string, "def", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "class", len)) { i = len;
} else { i = 0;
}
/* clang-format on */
/* If next source char is an identifier (eg. 'i' in "definite") no match */
if (i == 0 || text_check_identifier(string[i])) {
return -1;
}
return i;
} | /* Checks the specified source string for a Python special name. This name must
* start at the beginning of the source string and must be followed by a non-
* identifier (see text_check_identifier(char)) or null character.
*
* If a special name is found, the length of the matching name is returned.
* Otherwise, -1 is returned. */ | Checks the specified source string for a Python special name. This name must
start at the beginning of the source string and must be followed by a non
identifier ) or null character.
If a special name is found, the length of the matching name is returned.
Otherwise, -1 is returned. | [
"Checks",
"the",
"specified",
"source",
"string",
"for",
"a",
"Python",
"special",
"name",
".",
"This",
"name",
"must",
"start",
"at",
"the",
"beginning",
"of",
"the",
"source",
"string",
"and",
"must",
"be",
"followed",
"by",
"a",
"non",
"identifier",
")",
"or",
"null",
"character",
".",
"If",
"a",
"special",
"name",
"is",
"found",
"the",
"length",
"of",
"the",
"matching",
"name",
"is",
"returned",
".",
"Otherwise",
"-",
"1",
"is",
"returned",
"."
] | static int txtfmt_py_find_specialvar(const char *string)
{
int i, len;
if (STR_LITERAL_STARTSWITH(string, "def", len)) { i = len;
} else if (STR_LITERAL_STARTSWITH(string, "class", len)) { i = len;
} else { i = 0;
}
if (i == 0 || text_check_identifier(string[i])) {
return -1;
}
return i;
} | [
"static",
"int",
"txtfmt_py_find_specialvar",
"(",
"const",
"char",
"*",
"string",
")",
"{",
"int",
"i",
",",
"len",
";",
"if",
"(",
"STR_LITERAL_STARTSWITH",
"(",
"string",
",",
"\"",
"\"",
",",
"len",
")",
")",
"{",
"i",
"=",
"len",
";",
"}",
"else",
"if",
"(",
"STR_LITERAL_STARTSWITH",
"(",
"string",
",",
"\"",
"\"",
",",
"len",
")",
")",
"{",
"i",
"=",
"len",
";",
"}",
"else",
"{",
"i",
"=",
"0",
";",
"}",
"if",
"(",
"i",
"==",
"0",
"||",
"text_check_identifier",
"(",
"string",
"[",
"i",
"]",
")",
")",
"{",
"return",
"-1",
";",
"}",
"return",
"i",
";",
"}"
] | Checks the specified source string for a Python special name. | [
"Checks",
"the",
"specified",
"source",
"string",
"for",
"a",
"Python",
"special",
"name",
"."
] | [
"/* Keep aligned args for readability. */",
"/* clang-format off */",
"/* clang-format on */",
"/* If next source char is an identifier (eg. 'i' in \"definite\") no match */"
] | [
{
"param": "string",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "string",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4ae64c7ca5f085aaafaa393f6f1c161df57101fd | DemonRem/blender | source/blender/editors/transform/transform_gizmo_2d.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | gizmo2d_calc_bounds | void | static void gizmo2d_calc_bounds(const bContext *C, float *r_center, float *r_min, float *r_max)
{
float min_buf[2], max_buf[2];
if (r_min == NULL) {
r_min = min_buf;
}
if (r_max == NULL) {
r_max = max_buf;
}
ScrArea *sa = CTX_wm_area(C);
if (sa->spacetype == SPACE_IMAGE) {
SpaceImage *sima = sa->spacedata.first;
ViewLayer *view_layer = CTX_data_view_layer(C);
Image *ima = ED_space_image(sima);
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
view_layer, NULL, &objects_len);
if (!ED_uvedit_minmax_multi(CTX_data_scene(C), ima, objects, objects_len, r_min, r_max)) {
zero_v2(r_min);
zero_v2(r_max);
}
MEM_freeN(objects);
}
else {
zero_v2(r_min);
zero_v2(r_max);
}
mid_v2_v2v2(r_center, r_min, r_max);
} | /**
* Calculates origin in view space, use with #gizmo2d_origin_to_region.
*/ | Calculates origin in view space, use with #gizmo2d_origin_to_region. | [
"Calculates",
"origin",
"in",
"view",
"space",
"use",
"with",
"#gizmo2d_origin_to_region",
"."
] | static void gizmo2d_calc_bounds(const bContext *C, float *r_center, float *r_min, float *r_max)
{
float min_buf[2], max_buf[2];
if (r_min == NULL) {
r_min = min_buf;
}
if (r_max == NULL) {
r_max = max_buf;
}
ScrArea *sa = CTX_wm_area(C);
if (sa->spacetype == SPACE_IMAGE) {
SpaceImage *sima = sa->spacedata.first;
ViewLayer *view_layer = CTX_data_view_layer(C);
Image *ima = ED_space_image(sima);
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
view_layer, NULL, &objects_len);
if (!ED_uvedit_minmax_multi(CTX_data_scene(C), ima, objects, objects_len, r_min, r_max)) {
zero_v2(r_min);
zero_v2(r_max);
}
MEM_freeN(objects);
}
else {
zero_v2(r_min);
zero_v2(r_max);
}
mid_v2_v2v2(r_center, r_min, r_max);
} | [
"static",
"void",
"gizmo2d_calc_bounds",
"(",
"const",
"bContext",
"*",
"C",
",",
"float",
"*",
"r_center",
",",
"float",
"*",
"r_min",
",",
"float",
"*",
"r_max",
")",
"{",
"float",
"min_buf",
"[",
"2",
"]",
",",
"max_buf",
"[",
"2",
"]",
";",
"if",
"(",
"r_min",
"==",
"NULL",
")",
"{",
"r_min",
"=",
"min_buf",
";",
"}",
"if",
"(",
"r_max",
"==",
"NULL",
")",
"{",
"r_max",
"=",
"max_buf",
";",
"}",
"ScrArea",
"*",
"sa",
"=",
"CTX_wm_area",
"(",
"C",
")",
";",
"if",
"(",
"sa",
"->",
"spacetype",
"==",
"SPACE_IMAGE",
")",
"{",
"SpaceImage",
"*",
"sima",
"=",
"sa",
"->",
"spacedata",
".",
"first",
";",
"ViewLayer",
"*",
"view_layer",
"=",
"CTX_data_view_layer",
"(",
"C",
")",
";",
"Image",
"*",
"ima",
"=",
"ED_space_image",
"(",
"sima",
")",
";",
"uint",
"objects_len",
"=",
"0",
";",
"Object",
"*",
"*",
"objects",
"=",
"BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs",
"(",
"view_layer",
",",
"NULL",
",",
"&",
"objects_len",
")",
";",
"if",
"(",
"!",
"ED_uvedit_minmax_multi",
"(",
"CTX_data_scene",
"(",
"C",
")",
",",
"ima",
",",
"objects",
",",
"objects_len",
",",
"r_min",
",",
"r_max",
")",
")",
"{",
"zero_v2",
"(",
"r_min",
")",
";",
"zero_v2",
"(",
"r_max",
")",
";",
"}",
"MEM_freeN",
"(",
"objects",
")",
";",
"}",
"else",
"{",
"zero_v2",
"(",
"r_min",
")",
";",
"zero_v2",
"(",
"r_max",
")",
";",
"}",
"mid_v2_v2v2",
"(",
"r_center",
",",
"r_min",
",",
"r_max",
")",
";",
"}"
] | Calculates origin in view space, use with #gizmo2d_origin_to_region. | [
"Calculates",
"origin",
"in",
"view",
"space",
"use",
"with",
"#gizmo2d_origin_to_region",
"."
] | [] | [
{
"param": "C",
"type": "bContext"
},
{
"param": "r_center",
"type": "float"
},
{
"param": "r_min",
"type": "float"
},
{
"param": "r_max",
"type": "float"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "r_center",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "r_min",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "r_max",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0fb8f5558191121270d203905e230ebf0bc5730d | DemonRem/blender | source/blender/draw/modes/edit_lattice_mode.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | EDIT_LATTICE_cache_init | void | static void EDIT_LATTICE_cache_init(void *vedata)
{
EDIT_LATTICE_PassList *psl = ((EDIT_LATTICE_Data *)vedata)->psl;
EDIT_LATTICE_StorageList *stl = ((EDIT_LATTICE_Data *)vedata)->stl;
const DRWContextState *draw_ctx = DRW_context_state_get();
RegionView3D *rv3d = draw_ctx->rv3d;
EDIT_LATTICE_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg];
if (!stl->g_data) {
/* Alloc transient pointers */
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;
psl->wire_pass = DRW_pass_create("Lattice Wire", state);
stl->g_data->wire_shgrp = DRW_shgroup_create(sh_data->wire, psl->wire_pass);
if (rv3d->rflag & RV3D_CLIPPING) {
DRW_shgroup_state_enable(stl->g_data->wire_shgrp, DRW_STATE_CLIP_PLANES);
}
state = DRW_STATE_WRITE_COLOR;
psl->vert_pass = DRW_pass_create("Lattice Verts", state);
stl->g_data->vert_shgrp = DRW_shgroup_create(sh_data->overlay_vert, psl->vert_pass);
DRW_shgroup_uniform_block(stl->g_data->vert_shgrp, "globalsBlock", G_draw.block_ubo);
if (rv3d->rflag & RV3D_CLIPPING) {
DRW_shgroup_state_enable(stl->g_data->vert_shgrp, DRW_STATE_CLIP_PLANES);
}
}
} | /* 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_LATTICE_cache_init(void *vedata)
{
EDIT_LATTICE_PassList *psl = ((EDIT_LATTICE_Data *)vedata)->psl;
EDIT_LATTICE_StorageList *stl = ((EDIT_LATTICE_Data *)vedata)->stl;
const DRWContextState *draw_ctx = DRW_context_state_get();
RegionView3D *rv3d = draw_ctx->rv3d;
EDIT_LATTICE_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg];
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;
psl->wire_pass = DRW_pass_create("Lattice Wire", state);
stl->g_data->wire_shgrp = DRW_shgroup_create(sh_data->wire, psl->wire_pass);
if (rv3d->rflag & RV3D_CLIPPING) {
DRW_shgroup_state_enable(stl->g_data->wire_shgrp, DRW_STATE_CLIP_PLANES);
}
state = DRW_STATE_WRITE_COLOR;
psl->vert_pass = DRW_pass_create("Lattice Verts", state);
stl->g_data->vert_shgrp = DRW_shgroup_create(sh_data->overlay_vert, psl->vert_pass);
DRW_shgroup_uniform_block(stl->g_data->vert_shgrp, "globalsBlock", G_draw.block_ubo);
if (rv3d->rflag & RV3D_CLIPPING) {
DRW_shgroup_state_enable(stl->g_data->vert_shgrp, DRW_STATE_CLIP_PLANES);
}
}
} | [
"static",
"void",
"EDIT_LATTICE_cache_init",
"(",
"void",
"*",
"vedata",
")",
"{",
"EDIT_LATTICE_PassList",
"*",
"psl",
"=",
"(",
"(",
"EDIT_LATTICE_Data",
"*",
")",
"vedata",
")",
"->",
"psl",
";",
"EDIT_LATTICE_StorageList",
"*",
"stl",
"=",
"(",
"(",
"EDIT_LATTICE_Data",
"*",
")",
"vedata",
")",
"->",
"stl",
";",
"const",
"DRWContextState",
"*",
"draw_ctx",
"=",
"DRW_context_state_get",
"(",
")",
";",
"RegionView3D",
"*",
"rv3d",
"=",
"draw_ctx",
"->",
"rv3d",
";",
"EDIT_LATTICE_Shaders",
"*",
"sh_data",
"=",
"&",
"e_data",
".",
"sh_data",
"[",
"draw_ctx",
"->",
"sh_cfg",
"]",
";",
"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",
";",
"psl",
"->",
"wire_pass",
"=",
"DRW_pass_create",
"(",
"\"",
"\"",
",",
"state",
")",
";",
"stl",
"->",
"g_data",
"->",
"wire_shgrp",
"=",
"DRW_shgroup_create",
"(",
"sh_data",
"->",
"wire",
",",
"psl",
"->",
"wire_pass",
")",
";",
"if",
"(",
"rv3d",
"->",
"rflag",
"&",
"RV3D_CLIPPING",
")",
"{",
"DRW_shgroup_state_enable",
"(",
"stl",
"->",
"g_data",
"->",
"wire_shgrp",
",",
"DRW_STATE_CLIP_PLANES",
")",
";",
"}",
"state",
"=",
"DRW_STATE_WRITE_COLOR",
";",
"psl",
"->",
"vert_pass",
"=",
"DRW_pass_create",
"(",
"\"",
"\"",
",",
"state",
")",
";",
"stl",
"->",
"g_data",
"->",
"vert_shgrp",
"=",
"DRW_shgroup_create",
"(",
"sh_data",
"->",
"overlay_vert",
",",
"psl",
"->",
"vert_pass",
")",
";",
"DRW_shgroup_uniform_block",
"(",
"stl",
"->",
"g_data",
"->",
"vert_shgrp",
",",
"\"",
"\"",
",",
"G_draw",
".",
"block_ubo",
")",
";",
"if",
"(",
"rv3d",
"->",
"rflag",
"&",
"RV3D_CLIPPING",
")",
"{",
"DRW_shgroup_state_enable",
"(",
"stl",
"->",
"g_data",
"->",
"vert_shgrp",
",",
"DRW_STATE_CLIP_PLANES",
")",
";",
"}",
"}",
"}"
] | 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 */"
] | [
{
"param": "vedata",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "vedata",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0fb8f5558191121270d203905e230ebf0bc5730d | DemonRem/blender | source/blender/draw/modes/edit_lattice_mode.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | EDIT_LATTICE_cache_populate | void | static void EDIT_LATTICE_cache_populate(void *vedata, Object *ob)
{
EDIT_LATTICE_PassList *psl = ((EDIT_LATTICE_Data *)vedata)->psl;
EDIT_LATTICE_StorageList *stl = ((EDIT_LATTICE_Data *)vedata)->stl;
const DRWContextState *draw_ctx = DRW_context_state_get();
UNUSED_VARS(psl);
if (ob->type == OB_LATTICE) {
if ((ob == draw_ctx->object_edit) || BKE_object_is_in_editmode(ob)) {
/* Get geometry cache */
struct GPUBatch *geom;
geom = DRW_cache_lattice_wire_get(ob, true);
DRW_shgroup_call(stl->g_data->wire_shgrp, geom, ob);
geom = DRW_cache_lattice_vert_overlay_get(ob);
DRW_shgroup_call(stl->g_data->vert_shgrp, geom, ob);
}
}
} | /* Add geometry to shadingGroups. Execute for each objects */ | Add geometry to shadingGroups. Execute for each objects | [
"Add",
"geometry",
"to",
"shadingGroups",
".",
"Execute",
"for",
"each",
"objects"
] | static void EDIT_LATTICE_cache_populate(void *vedata, Object *ob)
{
EDIT_LATTICE_PassList *psl = ((EDIT_LATTICE_Data *)vedata)->psl;
EDIT_LATTICE_StorageList *stl = ((EDIT_LATTICE_Data *)vedata)->stl;
const DRWContextState *draw_ctx = DRW_context_state_get();
UNUSED_VARS(psl);
if (ob->type == OB_LATTICE) {
if ((ob == draw_ctx->object_edit) || BKE_object_is_in_editmode(ob)) {
struct GPUBatch *geom;
geom = DRW_cache_lattice_wire_get(ob, true);
DRW_shgroup_call(stl->g_data->wire_shgrp, geom, ob);
geom = DRW_cache_lattice_vert_overlay_get(ob);
DRW_shgroup_call(stl->g_data->vert_shgrp, geom, ob);
}
}
} | [
"static",
"void",
"EDIT_LATTICE_cache_populate",
"(",
"void",
"*",
"vedata",
",",
"Object",
"*",
"ob",
")",
"{",
"EDIT_LATTICE_PassList",
"*",
"psl",
"=",
"(",
"(",
"EDIT_LATTICE_Data",
"*",
")",
"vedata",
")",
"->",
"psl",
";",
"EDIT_LATTICE_StorageList",
"*",
"stl",
"=",
"(",
"(",
"EDIT_LATTICE_Data",
"*",
")",
"vedata",
")",
"->",
"stl",
";",
"const",
"DRWContextState",
"*",
"draw_ctx",
"=",
"DRW_context_state_get",
"(",
")",
";",
"UNUSED_VARS",
"(",
"psl",
")",
";",
"if",
"(",
"ob",
"->",
"type",
"==",
"OB_LATTICE",
")",
"{",
"if",
"(",
"(",
"ob",
"==",
"draw_ctx",
"->",
"object_edit",
")",
"||",
"BKE_object_is_in_editmode",
"(",
"ob",
")",
")",
"{",
"struct",
"GPUBatch",
"*",
"geom",
";",
"geom",
"=",
"DRW_cache_lattice_wire_get",
"(",
"ob",
",",
"true",
")",
";",
"DRW_shgroup_call",
"(",
"stl",
"->",
"g_data",
"->",
"wire_shgrp",
",",
"geom",
",",
"ob",
")",
";",
"geom",
"=",
"DRW_cache_lattice_vert_overlay_get",
"(",
"ob",
")",
";",
"DRW_shgroup_call",
"(",
"stl",
"->",
"g_data",
"->",
"vert_shgrp",
",",
"geom",
",",
"ob",
")",
";",
"}",
"}",
"}"
] | Add geometry to shadingGroups. | [
"Add",
"geometry",
"to",
"shadingGroups",
"."
] | [
"/* Get geometry cache */"
] | [
{
"param": "vedata",
"type": "void"
},
{
"param": "ob",
"type": "Object"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "vedata",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ob",
"type": "Object",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0fb8f5558191121270d203905e230ebf0bc5730d | DemonRem/blender | source/blender/draw/modes/edit_lattice_mode.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | EDIT_LATTICE_draw_scene | void | static void EDIT_LATTICE_draw_scene(void *vedata)
{
EDIT_LATTICE_PassList *psl = ((EDIT_LATTICE_Data *)vedata)->psl;
EDIT_LATTICE_FramebufferList *fbl = ((EDIT_LATTICE_Data *)vedata)->fbl;
/* Default framebuffer and texture */
DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
UNUSED_VARS(fbl);
MULTISAMPLE_SYNC_ENABLE(dfbl, dtxl);
/* Show / hide entire passes, swap framebuffers ... whatever you fancy */
/*
* DRW_framebuffer_texture_detach(dtxl->depth);
* DRW_framebuffer_bind(fbl->custom_fb);
* DRW_draw_pass(psl->pass);
* DRW_framebuffer_texture_attach(dfbl->default_fb, dtxl->depth, 0, 0);
* DRW_framebuffer_bind(dfbl->default_fb);
*/
/* ... or just render passes on default framebuffer. */
DRW_draw_pass(psl->wire_pass);
DRW_draw_pass(psl->vert_pass);
MULTISAMPLE_SYNC_DISABLE(dfbl, dtxl);
/* If you changed framebuffer, double check you rebind
* the default one with its textures attached before finishing */
} | /* Draw time ! Control rendering pipeline from here */ | Draw time . Control rendering pipeline from here | [
"Draw",
"time",
".",
"Control",
"rendering",
"pipeline",
"from",
"here"
] | static void EDIT_LATTICE_draw_scene(void *vedata)
{
EDIT_LATTICE_PassList *psl = ((EDIT_LATTICE_Data *)vedata)->psl;
EDIT_LATTICE_FramebufferList *fbl = ((EDIT_LATTICE_Data *)vedata)->fbl;
DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
UNUSED_VARS(fbl);
MULTISAMPLE_SYNC_ENABLE(dfbl, dtxl);
DRW_draw_pass(psl->wire_pass);
DRW_draw_pass(psl->vert_pass);
MULTISAMPLE_SYNC_DISABLE(dfbl, dtxl);
} | [
"static",
"void",
"EDIT_LATTICE_draw_scene",
"(",
"void",
"*",
"vedata",
")",
"{",
"EDIT_LATTICE_PassList",
"*",
"psl",
"=",
"(",
"(",
"EDIT_LATTICE_Data",
"*",
")",
"vedata",
")",
"->",
"psl",
";",
"EDIT_LATTICE_FramebufferList",
"*",
"fbl",
"=",
"(",
"(",
"EDIT_LATTICE_Data",
"*",
")",
"vedata",
")",
"->",
"fbl",
";",
"DefaultFramebufferList",
"*",
"dfbl",
"=",
"DRW_viewport_framebuffer_list_get",
"(",
")",
";",
"DefaultTextureList",
"*",
"dtxl",
"=",
"DRW_viewport_texture_list_get",
"(",
")",
";",
"UNUSED_VARS",
"(",
"fbl",
")",
";",
"MULTISAMPLE_SYNC_ENABLE",
"(",
"dfbl",
",",
"dtxl",
")",
";",
"DRW_draw_pass",
"(",
"psl",
"->",
"wire_pass",
")",
";",
"DRW_draw_pass",
"(",
"psl",
"->",
"vert_pass",
")",
";",
"MULTISAMPLE_SYNC_DISABLE",
"(",
"dfbl",
",",
"dtxl",
")",
";",
"}"
] | Draw time ! | [
"Draw",
"time",
"!"
] | [
"/* Default framebuffer and texture */",
"/* Show / hide entire passes, swap framebuffers ... whatever you fancy */",
"/*\n * DRW_framebuffer_texture_detach(dtxl->depth);\n * DRW_framebuffer_bind(fbl->custom_fb);\n * DRW_draw_pass(psl->pass);\n * DRW_framebuffer_texture_attach(dfbl->default_fb, dtxl->depth, 0, 0);\n * DRW_framebuffer_bind(dfbl->default_fb);\n */",
"/* ... or just render passes on default framebuffer. */",
"/* If you changed framebuffer, double check you rebind\n * the default one with its textures attached before finishing */"
] | [
{
"param": "vedata",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "vedata",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0fb8f5558191121270d203905e230ebf0bc5730d | DemonRem/blender | source/blender/draw/modes/edit_lattice_mode.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | EDIT_LATTICE_engine_free | void | static void EDIT_LATTICE_engine_free(void)
{
for (int sh_data_index = 0; sh_data_index < ARRAY_SIZE(e_data.sh_data); sh_data_index++) {
EDIT_LATTICE_Shaders *sh_data = &e_data.sh_data[sh_data_index];
/* Don't free builtins. */
sh_data->wire = NULL;
GPUShader **sh_data_as_array = (GPUShader **)sh_data;
for (int i = 0; i < (sizeof(EDIT_LATTICE_Shaders) / sizeof(GPUShader *)); i++) {
DRW_SHADER_FREE_SAFE(sh_data_as_array[i]);
}
}
} | /* Cleanup when destroying the engine.
* This is not per viewport ! only when quitting blender.
* Mostly used for freeing shaders */ | Cleanup when destroying the engine.
This is not per viewport . only when quitting blender.
Mostly used for freeing shaders | [
"Cleanup",
"when",
"destroying",
"the",
"engine",
".",
"This",
"is",
"not",
"per",
"viewport",
".",
"only",
"when",
"quitting",
"blender",
".",
"Mostly",
"used",
"for",
"freeing",
"shaders"
] | static void EDIT_LATTICE_engine_free(void)
{
for (int sh_data_index = 0; sh_data_index < ARRAY_SIZE(e_data.sh_data); sh_data_index++) {
EDIT_LATTICE_Shaders *sh_data = &e_data.sh_data[sh_data_index];
sh_data->wire = NULL;
GPUShader **sh_data_as_array = (GPUShader **)sh_data;
for (int i = 0; i < (sizeof(EDIT_LATTICE_Shaders) / sizeof(GPUShader *)); i++) {
DRW_SHADER_FREE_SAFE(sh_data_as_array[i]);
}
}
} | [
"static",
"void",
"EDIT_LATTICE_engine_free",
"(",
"void",
")",
"{",
"for",
"(",
"int",
"sh_data_index",
"=",
"0",
";",
"sh_data_index",
"<",
"ARRAY_SIZE",
"(",
"e_data",
".",
"sh_data",
")",
";",
"sh_data_index",
"++",
")",
"{",
"EDIT_LATTICE_Shaders",
"*",
"sh_data",
"=",
"&",
"e_data",
".",
"sh_data",
"[",
"sh_data_index",
"]",
";",
"sh_data",
"->",
"wire",
"=",
"NULL",
";",
"GPUShader",
"*",
"*",
"sh_data_as_array",
"=",
"(",
"GPUShader",
"*",
"*",
")",
"sh_data",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"(",
"sizeof",
"(",
"EDIT_LATTICE_Shaders",
")",
"/",
"sizeof",
"(",
"GPUShader",
"*",
")",
")",
";",
"i",
"++",
")",
"{",
"DRW_SHADER_FREE_SAFE",
"(",
"sh_data_as_array",
"[",
"i",
"]",
")",
";",
"}",
"}",
"}"
] | Cleanup when destroying the engine. | [
"Cleanup",
"when",
"destroying",
"the",
"engine",
"."
] | [
"/* Don't free builtins. */"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
1776f5352377dbd562bda33fd80c822ad2c8a61f | DemonRem/blender | source/blender/draw/engines/eevee/eevee_shadows.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | EEVEE_shadows_caster_add | void | void EEVEE_shadows_caster_add(EEVEE_ViewLayerData *UNUSED(sldata),
EEVEE_StorageList *stl,
struct GPUBatch *geom,
Object *ob)
{
DRW_shgroup_call(stl->g_data->shadow_shgrp, geom, ob);
} | /* Add a shadow caster to the shadowpasses */ | Add a shadow caster to the shadowpasses | [
"Add",
"a",
"shadow",
"caster",
"to",
"the",
"shadowpasses"
] | void EEVEE_shadows_caster_add(EEVEE_ViewLayerData *UNUSED(sldata),
EEVEE_StorageList *stl,
struct GPUBatch *geom,
Object *ob)
{
DRW_shgroup_call(stl->g_data->shadow_shgrp, geom, ob);
} | [
"void",
"EEVEE_shadows_caster_add",
"(",
"EEVEE_ViewLayerData",
"*",
"UNUSED",
"(",
"sldata",
")",
",",
"EEVEE_StorageList",
"*",
"stl",
",",
"struct",
"GPUBatch",
"*",
"geom",
",",
"Object",
"*",
"ob",
")",
"{",
"DRW_shgroup_call",
"(",
"stl",
"->",
"g_data",
"->",
"shadow_shgrp",
",",
"geom",
",",
"ob",
")",
";",
"}"
] | Add a shadow caster to the shadowpasses | [
"Add",
"a",
"shadow",
"caster",
"to",
"the",
"shadowpasses"
] | [] | [
{
"param": "UNUSED",
"type": "EEVEE_ViewLayerData"
},
{
"param": "stl",
"type": "EEVEE_StorageList"
},
{
"param": "geom",
"type": "struct GPUBatch"
},
{
"param": "ob",
"type": "Object"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "UNUSED",
"type": "EEVEE_ViewLayerData",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "stl",
"type": "EEVEE_StorageList",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "geom",
"type": "struct GPUBatch",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ob",
"type": "Object",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1776f5352377dbd562bda33fd80c822ad2c8a61f | DemonRem/blender | source/blender/draw/engines/eevee/eevee_shadows.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | EEVEE_shadows_caster_register | void | void EEVEE_shadows_caster_register(EEVEE_ViewLayerData *sldata, Object *ob)
{
EEVEE_LightsInfo *linfo = sldata->lights;
EEVEE_ShadowCasterBuffer *backbuffer = linfo->shcaster_backbuffer;
EEVEE_ShadowCasterBuffer *frontbuffer = linfo->shcaster_frontbuffer;
bool update = true;
int id = frontbuffer->count;
/* Make sure shadow_casters is big enough. */
if (id + 1 >= frontbuffer->alloc_count) {
frontbuffer->alloc_count += SH_CASTER_ALLOC_CHUNK;
frontbuffer->bbox = MEM_reallocN(frontbuffer->bbox,
sizeof(EEVEE_BoundBox) * frontbuffer->alloc_count);
BLI_BITMAP_RESIZE(frontbuffer->update, frontbuffer->alloc_count);
}
if (ob->base_flag & BASE_FROM_DUPLI) {
/* Duplis will always refresh the shadowmaps as if they were deleted each frame. */
/* TODO(fclem) fix this. */
update = true;
}
else {
EEVEE_ObjectEngineData *oedata = EEVEE_object_data_ensure(ob);
int past_id = oedata->shadow_caster_id;
oedata->shadow_caster_id = id;
/* Update flags in backbuffer. */
if (past_id > -1 && past_id < backbuffer->count) {
BLI_BITMAP_SET(backbuffer->update, past_id, oedata->need_update);
}
update = oedata->need_update;
oedata->need_update = false;
}
if (update) {
BLI_BITMAP_ENABLE(frontbuffer->update, id);
}
/* Update World AABB in frontbuffer. */
BoundBox *bb = BKE_object_boundbox_get(ob);
float min[3], max[3];
INIT_MINMAX(min, max);
for (int i = 0; i < 8; i++) {
float vec[3];
copy_v3_v3(vec, bb->vec[i]);
mul_m4_v3(ob->obmat, vec);
minmax_v3v3_v3(min, max, vec);
}
EEVEE_BoundBox *aabb = &frontbuffer->bbox[id];
add_v3_v3v3(aabb->center, min, max);
mul_v3_fl(aabb->center, 0.5f);
sub_v3_v3v3(aabb->halfdim, aabb->center, max);
aabb->halfdim[0] = fabsf(aabb->halfdim[0]);
aabb->halfdim[1] = fabsf(aabb->halfdim[1]);
aabb->halfdim[2] = fabsf(aabb->halfdim[2]);
minmax_v3v3_v3(linfo->shcaster_aabb.min, linfo->shcaster_aabb.max, min);
minmax_v3v3_v3(linfo->shcaster_aabb.min, linfo->shcaster_aabb.max, max);
frontbuffer->count++;
} | /* Make that object update shadow casting lights inside its influence bounding box. */ | Make that object update shadow casting lights inside its influence bounding box. | [
"Make",
"that",
"object",
"update",
"shadow",
"casting",
"lights",
"inside",
"its",
"influence",
"bounding",
"box",
"."
] | void EEVEE_shadows_caster_register(EEVEE_ViewLayerData *sldata, Object *ob)
{
EEVEE_LightsInfo *linfo = sldata->lights;
EEVEE_ShadowCasterBuffer *backbuffer = linfo->shcaster_backbuffer;
EEVEE_ShadowCasterBuffer *frontbuffer = linfo->shcaster_frontbuffer;
bool update = true;
int id = frontbuffer->count;
if (id + 1 >= frontbuffer->alloc_count) {
frontbuffer->alloc_count += SH_CASTER_ALLOC_CHUNK;
frontbuffer->bbox = MEM_reallocN(frontbuffer->bbox,
sizeof(EEVEE_BoundBox) * frontbuffer->alloc_count);
BLI_BITMAP_RESIZE(frontbuffer->update, frontbuffer->alloc_count);
}
if (ob->base_flag & BASE_FROM_DUPLI) {
update = true;
}
else {
EEVEE_ObjectEngineData *oedata = EEVEE_object_data_ensure(ob);
int past_id = oedata->shadow_caster_id;
oedata->shadow_caster_id = id;
if (past_id > -1 && past_id < backbuffer->count) {
BLI_BITMAP_SET(backbuffer->update, past_id, oedata->need_update);
}
update = oedata->need_update;
oedata->need_update = false;
}
if (update) {
BLI_BITMAP_ENABLE(frontbuffer->update, id);
}
BoundBox *bb = BKE_object_boundbox_get(ob);
float min[3], max[3];
INIT_MINMAX(min, max);
for (int i = 0; i < 8; i++) {
float vec[3];
copy_v3_v3(vec, bb->vec[i]);
mul_m4_v3(ob->obmat, vec);
minmax_v3v3_v3(min, max, vec);
}
EEVEE_BoundBox *aabb = &frontbuffer->bbox[id];
add_v3_v3v3(aabb->center, min, max);
mul_v3_fl(aabb->center, 0.5f);
sub_v3_v3v3(aabb->halfdim, aabb->center, max);
aabb->halfdim[0] = fabsf(aabb->halfdim[0]);
aabb->halfdim[1] = fabsf(aabb->halfdim[1]);
aabb->halfdim[2] = fabsf(aabb->halfdim[2]);
minmax_v3v3_v3(linfo->shcaster_aabb.min, linfo->shcaster_aabb.max, min);
minmax_v3v3_v3(linfo->shcaster_aabb.min, linfo->shcaster_aabb.max, max);
frontbuffer->count++;
} | [
"void",
"EEVEE_shadows_caster_register",
"(",
"EEVEE_ViewLayerData",
"*",
"sldata",
",",
"Object",
"*",
"ob",
")",
"{",
"EEVEE_LightsInfo",
"*",
"linfo",
"=",
"sldata",
"->",
"lights",
";",
"EEVEE_ShadowCasterBuffer",
"*",
"backbuffer",
"=",
"linfo",
"->",
"shcaster_backbuffer",
";",
"EEVEE_ShadowCasterBuffer",
"*",
"frontbuffer",
"=",
"linfo",
"->",
"shcaster_frontbuffer",
";",
"bool",
"update",
"=",
"true",
";",
"int",
"id",
"=",
"frontbuffer",
"->",
"count",
";",
"if",
"(",
"id",
"+",
"1",
">=",
"frontbuffer",
"->",
"alloc_count",
")",
"{",
"frontbuffer",
"->",
"alloc_count",
"+=",
"SH_CASTER_ALLOC_CHUNK",
";",
"frontbuffer",
"->",
"bbox",
"=",
"MEM_reallocN",
"(",
"frontbuffer",
"->",
"bbox",
",",
"sizeof",
"(",
"EEVEE_BoundBox",
")",
"*",
"frontbuffer",
"->",
"alloc_count",
")",
";",
"BLI_BITMAP_RESIZE",
"(",
"frontbuffer",
"->",
"update",
",",
"frontbuffer",
"->",
"alloc_count",
")",
";",
"}",
"if",
"(",
"ob",
"->",
"base_flag",
"&",
"BASE_FROM_DUPLI",
")",
"{",
"update",
"=",
"true",
";",
"}",
"else",
"{",
"EEVEE_ObjectEngineData",
"*",
"oedata",
"=",
"EEVEE_object_data_ensure",
"(",
"ob",
")",
";",
"int",
"past_id",
"=",
"oedata",
"->",
"shadow_caster_id",
";",
"oedata",
"->",
"shadow_caster_id",
"=",
"id",
";",
"if",
"(",
"past_id",
">",
"-1",
"&&",
"past_id",
"<",
"backbuffer",
"->",
"count",
")",
"{",
"BLI_BITMAP_SET",
"(",
"backbuffer",
"->",
"update",
",",
"past_id",
",",
"oedata",
"->",
"need_update",
")",
";",
"}",
"update",
"=",
"oedata",
"->",
"need_update",
";",
"oedata",
"->",
"need_update",
"=",
"false",
";",
"}",
"if",
"(",
"update",
")",
"{",
"BLI_BITMAP_ENABLE",
"(",
"frontbuffer",
"->",
"update",
",",
"id",
")",
";",
"}",
"BoundBox",
"*",
"bb",
"=",
"BKE_object_boundbox_get",
"(",
"ob",
")",
";",
"float",
"min",
"[",
"3",
"]",
",",
"max",
"[",
"3",
"]",
";",
"INIT_MINMAX",
"(",
"min",
",",
"max",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"8",
";",
"i",
"++",
")",
"{",
"float",
"vec",
"[",
"3",
"]",
";",
"copy_v3_v3",
"(",
"vec",
",",
"bb",
"->",
"vec",
"[",
"i",
"]",
")",
";",
"mul_m4_v3",
"(",
"ob",
"->",
"obmat",
",",
"vec",
")",
";",
"minmax_v3v3_v3",
"(",
"min",
",",
"max",
",",
"vec",
")",
";",
"}",
"EEVEE_BoundBox",
"*",
"aabb",
"=",
"&",
"frontbuffer",
"->",
"bbox",
"[",
"id",
"]",
";",
"add_v3_v3v3",
"(",
"aabb",
"->",
"center",
",",
"min",
",",
"max",
")",
";",
"mul_v3_fl",
"(",
"aabb",
"->",
"center",
",",
"0.5f",
")",
";",
"sub_v3_v3v3",
"(",
"aabb",
"->",
"halfdim",
",",
"aabb",
"->",
"center",
",",
"max",
")",
";",
"aabb",
"->",
"halfdim",
"[",
"0",
"]",
"=",
"fabsf",
"(",
"aabb",
"->",
"halfdim",
"[",
"0",
"]",
")",
";",
"aabb",
"->",
"halfdim",
"[",
"1",
"]",
"=",
"fabsf",
"(",
"aabb",
"->",
"halfdim",
"[",
"1",
"]",
")",
";",
"aabb",
"->",
"halfdim",
"[",
"2",
"]",
"=",
"fabsf",
"(",
"aabb",
"->",
"halfdim",
"[",
"2",
"]",
")",
";",
"minmax_v3v3_v3",
"(",
"linfo",
"->",
"shcaster_aabb",
".",
"min",
",",
"linfo",
"->",
"shcaster_aabb",
".",
"max",
",",
"min",
")",
";",
"minmax_v3v3_v3",
"(",
"linfo",
"->",
"shcaster_aabb",
".",
"min",
",",
"linfo",
"->",
"shcaster_aabb",
".",
"max",
",",
"max",
")",
";",
"frontbuffer",
"->",
"count",
"++",
";",
"}"
] | Make that object update shadow casting lights inside its influence bounding box. | [
"Make",
"that",
"object",
"update",
"shadow",
"casting",
"lights",
"inside",
"its",
"influence",
"bounding",
"box",
"."
] | [
"/* Make sure shadow_casters is big enough. */",
"/* Duplis will always refresh the shadowmaps as if they were deleted each frame. */",
"/* TODO(fclem) fix this. */",
"/* Update flags in backbuffer. */",
"/* Update World AABB in frontbuffer. */"
] | [
{
"param": "sldata",
"type": "EEVEE_ViewLayerData"
},
{
"param": "ob",
"type": "Object"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sldata",
"type": "EEVEE_ViewLayerData",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ob",
"type": "Object",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d160fba401348df13d833cde074ddb59908ddfec | DemonRem/blender | source/blender/editors/sculpt_paint/paint_mask.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | is_effected_lasso | bool | static bool is_effected_lasso(LassoMaskData *data, float co[3])
{
float scr_co_f[2];
int scr_co_s[2];
float co_final[3];
flip_v3_v3(co_final, co, data->symmpass);
/* first project point to 2d space */
ED_view3d_project_float_v2_m4(data->vc->ar, co_final, scr_co_f, data->projviewobjmat);
scr_co_s[0] = scr_co_f[0];
scr_co_s[1] = scr_co_f[1];
/* clip against screen, because lasso is limited to screen only */
if ((scr_co_s[0] < data->rect.xmin) || (scr_co_s[1] < data->rect.ymin) ||
(scr_co_s[0] >= data->rect.xmax) || (scr_co_s[1] >= data->rect.ymax)) {
return false;
}
scr_co_s[0] -= data->rect.xmin;
scr_co_s[1] -= data->rect.ymin;
return BLI_BITMAP_TEST_BOOL(data->px, scr_co_s[1] * data->width + scr_co_s[0]);
} | /**
* Lasso select. This could be defined as part of #VIEW3D_OT_select_lasso,
* still the shortcuts conflict, so we will use a separate operator.
*/ | Lasso select. This could be defined as part of #VIEW3D_OT_select_lasso,
still the shortcuts conflict, so we will use a separate operator. | [
"Lasso",
"select",
".",
"This",
"could",
"be",
"defined",
"as",
"part",
"of",
"#VIEW3D_OT_select_lasso",
"still",
"the",
"shortcuts",
"conflict",
"so",
"we",
"will",
"use",
"a",
"separate",
"operator",
"."
] | static bool is_effected_lasso(LassoMaskData *data, float co[3])
{
float scr_co_f[2];
int scr_co_s[2];
float co_final[3];
flip_v3_v3(co_final, co, data->symmpass);
ED_view3d_project_float_v2_m4(data->vc->ar, co_final, scr_co_f, data->projviewobjmat);
scr_co_s[0] = scr_co_f[0];
scr_co_s[1] = scr_co_f[1];
if ((scr_co_s[0] < data->rect.xmin) || (scr_co_s[1] < data->rect.ymin) ||
(scr_co_s[0] >= data->rect.xmax) || (scr_co_s[1] >= data->rect.ymax)) {
return false;
}
scr_co_s[0] -= data->rect.xmin;
scr_co_s[1] -= data->rect.ymin;
return BLI_BITMAP_TEST_BOOL(data->px, scr_co_s[1] * data->width + scr_co_s[0]);
} | [
"static",
"bool",
"is_effected_lasso",
"(",
"LassoMaskData",
"*",
"data",
",",
"float",
"co",
"[",
"3",
"]",
")",
"{",
"float",
"scr_co_f",
"[",
"2",
"]",
";",
"int",
"scr_co_s",
"[",
"2",
"]",
";",
"float",
"co_final",
"[",
"3",
"]",
";",
"flip_v3_v3",
"(",
"co_final",
",",
"co",
",",
"data",
"->",
"symmpass",
")",
";",
"ED_view3d_project_float_v2_m4",
"(",
"data",
"->",
"vc",
"->",
"ar",
",",
"co_final",
",",
"scr_co_f",
",",
"data",
"->",
"projviewobjmat",
")",
";",
"scr_co_s",
"[",
"0",
"]",
"=",
"scr_co_f",
"[",
"0",
"]",
";",
"scr_co_s",
"[",
"1",
"]",
"=",
"scr_co_f",
"[",
"1",
"]",
";",
"if",
"(",
"(",
"scr_co_s",
"[",
"0",
"]",
"<",
"data",
"->",
"rect",
".",
"xmin",
")",
"||",
"(",
"scr_co_s",
"[",
"1",
"]",
"<",
"data",
"->",
"rect",
".",
"ymin",
")",
"||",
"(",
"scr_co_s",
"[",
"0",
"]",
">=",
"data",
"->",
"rect",
".",
"xmax",
")",
"||",
"(",
"scr_co_s",
"[",
"1",
"]",
">=",
"data",
"->",
"rect",
".",
"ymax",
")",
")",
"{",
"return",
"false",
";",
"}",
"scr_co_s",
"[",
"0",
"]",
"-=",
"data",
"->",
"rect",
".",
"xmin",
";",
"scr_co_s",
"[",
"1",
"]",
"-=",
"data",
"->",
"rect",
".",
"ymin",
";",
"return",
"BLI_BITMAP_TEST_BOOL",
"(",
"data",
"->",
"px",
",",
"scr_co_s",
"[",
"1",
"]",
"*",
"data",
"->",
"width",
"+",
"scr_co_s",
"[",
"0",
"]",
")",
";",
"}"
] | Lasso select. | [
"Lasso",
"select",
"."
] | [
"/* first project point to 2d space */",
"/* clip against screen, because lasso is limited to screen only */"
] | [
{
"param": "data",
"type": "LassoMaskData"
},
{
"param": "co",
"type": "float"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": "LassoMaskData",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "co",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3c87df55b2be7b8a9df713ef6b204c798926cfcf | DemonRem/blender | source/blender/blenlib/intern/threads.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | BLI_threadpool_init | void | void BLI_threadpool_init(ListBase *threadbase, void *(*do_thread)(void *), int tot)
{
int a;
if (threadbase != NULL && tot > 0) {
BLI_listbase_clear(threadbase);
if (tot > RE_MAX_THREAD) {
tot = RE_MAX_THREAD;
}
else if (tot < 1) {
tot = 1;
}
for (a = 0; a < tot; a++) {
ThreadSlot *tslot = MEM_callocN(sizeof(ThreadSlot), "threadslot");
BLI_addtail(threadbase, tslot);
tslot->do_thread = do_thread;
tslot->avail = 1;
}
}
unsigned int level = atomic_fetch_and_add_u(&thread_levels, 1);
if (level == 0) {
MEM_set_lock_callback(BLI_lock_malloc_thread, BLI_unlock_malloc_thread);
#ifdef USE_APPLE_OMP_FIX
/* workaround for Apple gcc 4.2.1 omp vs background thread bug,
* we copy gomp thread local storage pointer to setting it again
* inside the thread that we start */
thread_tls_data = pthread_getspecific(gomp_tls_key);
#endif
}
} | /* tot = 0 only initializes malloc mutex in a safe way (see sequence.c)
* problem otherwise: scene render will kill of the mutex!
*/ | tot = 0 only initializes malloc mutex in a safe way
problem otherwise: scene render will kill of the mutex! | [
"tot",
"=",
"0",
"only",
"initializes",
"malloc",
"mutex",
"in",
"a",
"safe",
"way",
"problem",
"otherwise",
":",
"scene",
"render",
"will",
"kill",
"of",
"the",
"mutex!"
] | void BLI_threadpool_init(ListBase *threadbase, void *(*do_thread)(void *), int tot)
{
int a;
if (threadbase != NULL && tot > 0) {
BLI_listbase_clear(threadbase);
if (tot > RE_MAX_THREAD) {
tot = RE_MAX_THREAD;
}
else if (tot < 1) {
tot = 1;
}
for (a = 0; a < tot; a++) {
ThreadSlot *tslot = MEM_callocN(sizeof(ThreadSlot), "threadslot");
BLI_addtail(threadbase, tslot);
tslot->do_thread = do_thread;
tslot->avail = 1;
}
}
unsigned int level = atomic_fetch_and_add_u(&thread_levels, 1);
if (level == 0) {
MEM_set_lock_callback(BLI_lock_malloc_thread, BLI_unlock_malloc_thread);
#ifdef USE_APPLE_OMP_FIX
thread_tls_data = pthread_getspecific(gomp_tls_key);
#endif
}
} | [
"void",
"BLI_threadpool_init",
"(",
"ListBase",
"*",
"threadbase",
",",
"void",
"*",
"(",
"*",
"do_thread",
")",
"(",
"void",
"*",
")",
",",
"int",
"tot",
")",
"{",
"int",
"a",
";",
"if",
"(",
"threadbase",
"!=",
"NULL",
"&&",
"tot",
">",
"0",
")",
"{",
"BLI_listbase_clear",
"(",
"threadbase",
")",
";",
"if",
"(",
"tot",
">",
"RE_MAX_THREAD",
")",
"{",
"tot",
"=",
"RE_MAX_THREAD",
";",
"}",
"else",
"if",
"(",
"tot",
"<",
"1",
")",
"{",
"tot",
"=",
"1",
";",
"}",
"for",
"(",
"a",
"=",
"0",
";",
"a",
"<",
"tot",
";",
"a",
"++",
")",
"{",
"ThreadSlot",
"*",
"tslot",
"=",
"MEM_callocN",
"(",
"sizeof",
"(",
"ThreadSlot",
")",
",",
"\"",
"\"",
")",
";",
"BLI_addtail",
"(",
"threadbase",
",",
"tslot",
")",
";",
"tslot",
"->",
"do_thread",
"=",
"do_thread",
";",
"tslot",
"->",
"avail",
"=",
"1",
";",
"}",
"}",
"unsigned",
"int",
"level",
"=",
"atomic_fetch_and_add_u",
"(",
"&",
"thread_levels",
",",
"1",
")",
";",
"if",
"(",
"level",
"==",
"0",
")",
"{",
"MEM_set_lock_callback",
"(",
"BLI_lock_malloc_thread",
",",
"BLI_unlock_malloc_thread",
")",
";",
"#ifdef",
"USE_APPLE_OMP_FIX",
"thread_tls_data",
"=",
"pthread_getspecific",
"(",
"gomp_tls_key",
")",
";",
"#endif",
"}",
"}"
] | tot = 0 only initializes malloc mutex in a safe way (see sequence.c)
problem otherwise: scene render will kill of the mutex! | [
"tot",
"=",
"0",
"only",
"initializes",
"malloc",
"mutex",
"in",
"a",
"safe",
"way",
"(",
"see",
"sequence",
".",
"c",
")",
"problem",
"otherwise",
":",
"scene",
"render",
"will",
"kill",
"of",
"the",
"mutex!"
] | [
"/* workaround for Apple gcc 4.2.1 omp vs background thread bug,\n * we copy gomp thread local storage pointer to setting it again\n * inside the thread that we start */"
] | [
{
"param": "threadbase",
"type": "ListBase"
},
{
"param": "do_thread",
"type": "void"
},
{
"param": "tot",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "threadbase",
"type": "ListBase",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "do_thread",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tot",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3c87df55b2be7b8a9df713ef6b204c798926cfcf | DemonRem/blender | source/blender/blenlib/intern/threads.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | BLI_threadpool_available_thread_index | int | int BLI_threadpool_available_thread_index(ListBase *threadbase)
{
ThreadSlot *tslot;
int counter = 0;
for (tslot = threadbase->first; tslot; tslot = tslot->next, counter++) {
if (tslot->avail) {
return counter;
}
}
return 0;
} | /* returns thread number, for sample patterns or threadsafe tables */ | returns thread number, for sample patterns or threadsafe tables | [
"returns",
"thread",
"number",
"for",
"sample",
"patterns",
"or",
"threadsafe",
"tables"
] | int BLI_threadpool_available_thread_index(ListBase *threadbase)
{
ThreadSlot *tslot;
int counter = 0;
for (tslot = threadbase->first; tslot; tslot = tslot->next, counter++) {
if (tslot->avail) {
return counter;
}
}
return 0;
} | [
"int",
"BLI_threadpool_available_thread_index",
"(",
"ListBase",
"*",
"threadbase",
")",
"{",
"ThreadSlot",
"*",
"tslot",
";",
"int",
"counter",
"=",
"0",
";",
"for",
"(",
"tslot",
"=",
"threadbase",
"->",
"first",
";",
"tslot",
";",
"tslot",
"=",
"tslot",
"->",
"next",
",",
"counter",
"++",
")",
"{",
"if",
"(",
"tslot",
"->",
"avail",
")",
"{",
"return",
"counter",
";",
"}",
"}",
"return",
"0",
";",
"}"
] | returns thread number, for sample patterns or threadsafe tables | [
"returns",
"thread",
"number",
"for",
"sample",
"patterns",
"or",
"threadsafe",
"tables"
] | [] | [
{
"param": "threadbase",
"type": "ListBase"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "threadbase",
"type": "ListBase",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
2081c69a1a453c0b141fc0f0cf91aae60b5808cc | DemonRem/blender | source/blender/editors/space_node/node_draw.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | node_tree_from_ID | bNodeTree | static bNodeTree *node_tree_from_ID(ID *id)
{
if (id) {
short idtype = GS(id->name);
switch (idtype) {
case ID_NT:
return (bNodeTree *)id;
case ID_MA:
return ((Material *)id)->nodetree;
case ID_LA:
return ((Light *)id)->nodetree;
case ID_WO:
return ((World *)id)->nodetree;
case ID_SCE:
return ((Scene *)id)->nodetree;
case ID_TE:
return ((Tex *)id)->nodetree;
case ID_LS:
return ((FreestyleLineStyle *)id)->nodetree;
}
}
return NULL;
} | /* id is supposed to contain a node tree */ | id is supposed to contain a node tree | [
"id",
"is",
"supposed",
"to",
"contain",
"a",
"node",
"tree"
] | static bNodeTree *node_tree_from_ID(ID *id)
{
if (id) {
short idtype = GS(id->name);
switch (idtype) {
case ID_NT:
return (bNodeTree *)id;
case ID_MA:
return ((Material *)id)->nodetree;
case ID_LA:
return ((Light *)id)->nodetree;
case ID_WO:
return ((World *)id)->nodetree;
case ID_SCE:
return ((Scene *)id)->nodetree;
case ID_TE:
return ((Tex *)id)->nodetree;
case ID_LS:
return ((FreestyleLineStyle *)id)->nodetree;
}
}
return NULL;
} | [
"static",
"bNodeTree",
"*",
"node_tree_from_ID",
"(",
"ID",
"*",
"id",
")",
"{",
"if",
"(",
"id",
")",
"{",
"short",
"idtype",
"=",
"GS",
"(",
"id",
"->",
"name",
")",
";",
"switch",
"(",
"idtype",
")",
"{",
"case",
"ID_NT",
":",
"return",
"(",
"bNodeTree",
"*",
")",
"id",
";",
"case",
"ID_MA",
":",
"return",
"(",
"(",
"Material",
"*",
")",
"id",
")",
"->",
"nodetree",
";",
"case",
"ID_LA",
":",
"return",
"(",
"(",
"Light",
"*",
")",
"id",
")",
"->",
"nodetree",
";",
"case",
"ID_WO",
":",
"return",
"(",
"(",
"World",
"*",
")",
"id",
")",
"->",
"nodetree",
";",
"case",
"ID_SCE",
":",
"return",
"(",
"(",
"Scene",
"*",
")",
"id",
")",
"->",
"nodetree",
";",
"case",
"ID_TE",
":",
"return",
"(",
"(",
"Tex",
"*",
")",
"id",
")",
"->",
"nodetree",
";",
"case",
"ID_LS",
":",
"return",
"(",
"(",
"FreestyleLineStyle",
"*",
")",
"id",
")",
"->",
"nodetree",
";",
"}",
"}",
"return",
"NULL",
";",
"}"
] | id is supposed to contain a node tree | [
"id",
"is",
"supposed",
"to",
"contain",
"a",
"node",
"tree"
] | [] | [
{
"param": "id",
"type": "ID"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "id",
"type": "ID",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
2081c69a1a453c0b141fc0f0cf91aae60b5808cc | DemonRem/blender | source/blender/editors/space_node/node_draw.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | draw_group_overlay | void | static void draw_group_overlay(const bContext *C, ARegion *ar)
{
View2D *v2d = &ar->v2d;
rctf rect = v2d->cur;
uiBlock *block;
float color[4];
/* shade node groups to separate them visually */
GPU_blend(true);
UI_GetThemeColorShadeAlpha4fv(TH_NODE_GROUP, 0, 0, color);
UI_draw_roundbox_corner_set(UI_CNR_NONE);
UI_draw_roundbox_4fv(true, rect.xmin, rect.ymin, rect.xmax, rect.ymax, 0, color);
GPU_blend(false);
/* set the block bounds to clip mouse events from underlying nodes */
block = UI_block_begin(C, ar, "node tree bounds block", UI_EMBOSS);
UI_block_bounds_set_explicit(block, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
UI_block_flag_enable(block, UI_BLOCK_CLIP_EVENTS);
UI_block_end(C, block);
} | /* shade the parent node group and add a uiBlock to clip mouse events */ | shade the parent node group and add a uiBlock to clip mouse events | [
"shade",
"the",
"parent",
"node",
"group",
"and",
"add",
"a",
"uiBlock",
"to",
"clip",
"mouse",
"events"
] | static void draw_group_overlay(const bContext *C, ARegion *ar)
{
View2D *v2d = &ar->v2d;
rctf rect = v2d->cur;
uiBlock *block;
float color[4];
GPU_blend(true);
UI_GetThemeColorShadeAlpha4fv(TH_NODE_GROUP, 0, 0, color);
UI_draw_roundbox_corner_set(UI_CNR_NONE);
UI_draw_roundbox_4fv(true, rect.xmin, rect.ymin, rect.xmax, rect.ymax, 0, color);
GPU_blend(false);
block = UI_block_begin(C, ar, "node tree bounds block", UI_EMBOSS);
UI_block_bounds_set_explicit(block, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
UI_block_flag_enable(block, UI_BLOCK_CLIP_EVENTS);
UI_block_end(C, block);
} | [
"static",
"void",
"draw_group_overlay",
"(",
"const",
"bContext",
"*",
"C",
",",
"ARegion",
"*",
"ar",
")",
"{",
"View2D",
"*",
"v2d",
"=",
"&",
"ar",
"->",
"v2d",
";",
"rctf",
"rect",
"=",
"v2d",
"->",
"cur",
";",
"uiBlock",
"*",
"block",
";",
"float",
"color",
"[",
"4",
"]",
";",
"GPU_blend",
"(",
"true",
")",
";",
"UI_GetThemeColorShadeAlpha4fv",
"(",
"TH_NODE_GROUP",
",",
"0",
",",
"0",
",",
"color",
")",
";",
"UI_draw_roundbox_corner_set",
"(",
"UI_CNR_NONE",
")",
";",
"UI_draw_roundbox_4fv",
"(",
"true",
",",
"rect",
".",
"xmin",
",",
"rect",
".",
"ymin",
",",
"rect",
".",
"xmax",
",",
"rect",
".",
"ymax",
",",
"0",
",",
"color",
")",
";",
"GPU_blend",
"(",
"false",
")",
";",
"block",
"=",
"UI_block_begin",
"(",
"C",
",",
"ar",
",",
"\"",
"\"",
",",
"UI_EMBOSS",
")",
";",
"UI_block_bounds_set_explicit",
"(",
"block",
",",
"rect",
".",
"xmin",
",",
"rect",
".",
"ymin",
",",
"rect",
".",
"xmax",
",",
"rect",
".",
"ymax",
")",
";",
"UI_block_flag_enable",
"(",
"block",
",",
"UI_BLOCK_CLIP_EVENTS",
")",
";",
"UI_block_end",
"(",
"C",
",",
"block",
")",
";",
"}"
] | shade the parent node group and add a uiBlock to clip mouse events | [
"shade",
"the",
"parent",
"node",
"group",
"and",
"add",
"a",
"uiBlock",
"to",
"clip",
"mouse",
"events"
] | [
"/* shade node groups to separate them visually */",
"/* set the block bounds to clip mouse events from underlying nodes */"
] | [
{
"param": "C",
"type": "bContext"
},
{
"param": "ar",
"type": "ARegion"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ar",
"type": "ARegion",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
63e382e22803335f4c7cce5ba0526677b97b2f8e | DemonRem/blender | source/blender/editors/interface/interface_utils.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | UI_butstore_create | uiButStore | uiButStore *UI_butstore_create(uiBlock *block)
{
uiButStore *bs_handle = MEM_callocN(sizeof(uiButStore), __func__);
bs_handle->block = block;
BLI_addtail(&block->butstore, bs_handle);
return bs_handle;
} | /**
* Create a new button store, the caller must manage and run #UI_butstore_free
*/ | Create a new button store, the caller must manage and run #UI_butstore_free | [
"Create",
"a",
"new",
"button",
"store",
"the",
"caller",
"must",
"manage",
"and",
"run",
"#UI_butstore_free"
] | uiButStore *UI_butstore_create(uiBlock *block)
{
uiButStore *bs_handle = MEM_callocN(sizeof(uiButStore), __func__);
bs_handle->block = block;
BLI_addtail(&block->butstore, bs_handle);
return bs_handle;
} | [
"uiButStore",
"*",
"UI_butstore_create",
"(",
"uiBlock",
"*",
"block",
")",
"{",
"uiButStore",
"*",
"bs_handle",
"=",
"MEM_callocN",
"(",
"sizeof",
"(",
"uiButStore",
")",
",",
"__func__",
")",
";",
"bs_handle",
"->",
"block",
"=",
"block",
";",
"BLI_addtail",
"(",
"&",
"block",
"->",
"butstore",
",",
"bs_handle",
")",
";",
"return",
"bs_handle",
";",
"}"
] | Create a new button store, the caller must manage and run #UI_butstore_free | [
"Create",
"a",
"new",
"button",
"store",
"the",
"caller",
"must",
"manage",
"and",
"run",
"#UI_butstore_free"
] | [] | [
{
"param": "block",
"type": "uiBlock"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "block",
"type": "uiBlock",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
63e382e22803335f4c7cce5ba0526677b97b2f8e | DemonRem/blender | source/blender/editors/interface/interface_utils.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | UI_butstore_register_update | bool | bool UI_butstore_register_update(uiBlock *block, uiBut *but_dst, const uiBut *but_src)
{
uiButStore *bs_handle;
bool found = false;
for (bs_handle = block->butstore.first; bs_handle; bs_handle = bs_handle->next) {
uiButStoreElem *bs_elem;
for (bs_elem = bs_handle->items.first; bs_elem; bs_elem = bs_elem->next) {
if (*bs_elem->but_p == but_src) {
*bs_elem->but_p = but_dst;
found = true;
}
}
}
return found;
} | /**
* Update the pointer for a registered button.
*/ | Update the pointer for a registered button. | [
"Update",
"the",
"pointer",
"for",
"a",
"registered",
"button",
"."
] | bool UI_butstore_register_update(uiBlock *block, uiBut *but_dst, const uiBut *but_src)
{
uiButStore *bs_handle;
bool found = false;
for (bs_handle = block->butstore.first; bs_handle; bs_handle = bs_handle->next) {
uiButStoreElem *bs_elem;
for (bs_elem = bs_handle->items.first; bs_elem; bs_elem = bs_elem->next) {
if (*bs_elem->but_p == but_src) {
*bs_elem->but_p = but_dst;
found = true;
}
}
}
return found;
} | [
"bool",
"UI_butstore_register_update",
"(",
"uiBlock",
"*",
"block",
",",
"uiBut",
"*",
"but_dst",
",",
"const",
"uiBut",
"*",
"but_src",
")",
"{",
"uiButStore",
"*",
"bs_handle",
";",
"bool",
"found",
"=",
"false",
";",
"for",
"(",
"bs_handle",
"=",
"block",
"->",
"butstore",
".",
"first",
";",
"bs_handle",
";",
"bs_handle",
"=",
"bs_handle",
"->",
"next",
")",
"{",
"uiButStoreElem",
"*",
"bs_elem",
";",
"for",
"(",
"bs_elem",
"=",
"bs_handle",
"->",
"items",
".",
"first",
";",
"bs_elem",
";",
"bs_elem",
"=",
"bs_elem",
"->",
"next",
")",
"{",
"if",
"(",
"*",
"bs_elem",
"->",
"but_p",
"==",
"but_src",
")",
"{",
"*",
"bs_elem",
"->",
"but_p",
"=",
"but_dst",
";",
"found",
"=",
"true",
";",
"}",
"}",
"}",
"return",
"found",
";",
"}"
] | Update the pointer for a registered button. | [
"Update",
"the",
"pointer",
"for",
"a",
"registered",
"button",
"."
] | [] | [
{
"param": "block",
"type": "uiBlock"
},
{
"param": "but_dst",
"type": "uiBut"
},
{
"param": "but_src",
"type": "uiBut"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "block",
"type": "uiBlock",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "but_dst",
"type": "uiBut",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "but_src",
"type": "uiBut",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
63e382e22803335f4c7cce5ba0526677b97b2f8e | DemonRem/blender | source/blender/editors/interface/interface_utils.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | UI_butstore_clear | void | void UI_butstore_clear(uiBlock *block)
{
uiButStore *bs_handle;
for (bs_handle = block->butstore.first; bs_handle; bs_handle = bs_handle->next) {
uiButStoreElem *bs_elem;
bs_handle->block = NULL;
for (bs_elem = bs_handle->items.first; bs_elem; bs_elem = bs_elem->next) {
*bs_elem->but_p = NULL;
}
}
} | /**
* NULL all pointers, don't free since the owner needs to be able to inspect.
*/ | NULL all pointers, don't free since the owner needs to be able to inspect. | [
"NULL",
"all",
"pointers",
"don",
"'",
"t",
"free",
"since",
"the",
"owner",
"needs",
"to",
"be",
"able",
"to",
"inspect",
"."
] | void UI_butstore_clear(uiBlock *block)
{
uiButStore *bs_handle;
for (bs_handle = block->butstore.first; bs_handle; bs_handle = bs_handle->next) {
uiButStoreElem *bs_elem;
bs_handle->block = NULL;
for (bs_elem = bs_handle->items.first; bs_elem; bs_elem = bs_elem->next) {
*bs_elem->but_p = NULL;
}
}
} | [
"void",
"UI_butstore_clear",
"(",
"uiBlock",
"*",
"block",
")",
"{",
"uiButStore",
"*",
"bs_handle",
";",
"for",
"(",
"bs_handle",
"=",
"block",
"->",
"butstore",
".",
"first",
";",
"bs_handle",
";",
"bs_handle",
"=",
"bs_handle",
"->",
"next",
")",
"{",
"uiButStoreElem",
"*",
"bs_elem",
";",
"bs_handle",
"->",
"block",
"=",
"NULL",
";",
"for",
"(",
"bs_elem",
"=",
"bs_handle",
"->",
"items",
".",
"first",
";",
"bs_elem",
";",
"bs_elem",
"=",
"bs_elem",
"->",
"next",
")",
"{",
"*",
"bs_elem",
"->",
"but_p",
"=",
"NULL",
";",
"}",
"}",
"}"
] | NULL all pointers, don't free since the owner needs to be able to inspect. | [
"NULL",
"all",
"pointers",
"don",
"'",
"t",
"free",
"since",
"the",
"owner",
"needs",
"to",
"be",
"able",
"to",
"inspect",
"."
] | [] | [
{
"param": "block",
"type": "uiBlock"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "block",
"type": "uiBlock",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
63e382e22803335f4c7cce5ba0526677b97b2f8e | DemonRem/blender | source/blender/editors/interface/interface_utils.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | UI_butstore_update | void | void UI_butstore_update(uiBlock *block)
{
uiButStore *bs_handle;
/* move this list to the new block */
if (block->oldblock) {
if (block->oldblock->butstore.first) {
block->butstore = block->oldblock->butstore;
BLI_listbase_clear(&block->oldblock->butstore);
}
}
if (LIKELY(block->butstore.first == NULL)) {
return;
}
/* warning, loop-in-loop, in practice we only store <10 buttons at a time,
* so this isn't going to be a problem, if that changes old-new mapping can be cached first */
for (bs_handle = block->butstore.first; bs_handle; bs_handle = bs_handle->next) {
BLI_assert((bs_handle->block == NULL) || (bs_handle->block == block) ||
(block->oldblock && block->oldblock == bs_handle->block));
if (bs_handle->block == block->oldblock) {
uiButStoreElem *bs_elem;
bs_handle->block = block;
for (bs_elem = bs_handle->items.first; bs_elem; bs_elem = bs_elem->next) {
if (*bs_elem->but_p) {
uiBut *but_new = ui_but_find_new(block, *bs_elem->but_p);
/* can be NULL if the buttons removed,
* note: we could allow passing in a callback when buttons are removed
* so the caller can cleanup */
*bs_elem->but_p = but_new;
}
}
}
}
} | /**
* Map freed buttons from the old block and update pointers.
*/ | Map freed buttons from the old block and update pointers. | [
"Map",
"freed",
"buttons",
"from",
"the",
"old",
"block",
"and",
"update",
"pointers",
"."
] | void UI_butstore_update(uiBlock *block)
{
uiButStore *bs_handle;
if (block->oldblock) {
if (block->oldblock->butstore.first) {
block->butstore = block->oldblock->butstore;
BLI_listbase_clear(&block->oldblock->butstore);
}
}
if (LIKELY(block->butstore.first == NULL)) {
return;
}
for (bs_handle = block->butstore.first; bs_handle; bs_handle = bs_handle->next) {
BLI_assert((bs_handle->block == NULL) || (bs_handle->block == block) ||
(block->oldblock && block->oldblock == bs_handle->block));
if (bs_handle->block == block->oldblock) {
uiButStoreElem *bs_elem;
bs_handle->block = block;
for (bs_elem = bs_handle->items.first; bs_elem; bs_elem = bs_elem->next) {
if (*bs_elem->but_p) {
uiBut *but_new = ui_but_find_new(block, *bs_elem->but_p);
*bs_elem->but_p = but_new;
}
}
}
}
} | [
"void",
"UI_butstore_update",
"(",
"uiBlock",
"*",
"block",
")",
"{",
"uiButStore",
"*",
"bs_handle",
";",
"if",
"(",
"block",
"->",
"oldblock",
")",
"{",
"if",
"(",
"block",
"->",
"oldblock",
"->",
"butstore",
".",
"first",
")",
"{",
"block",
"->",
"butstore",
"=",
"block",
"->",
"oldblock",
"->",
"butstore",
";",
"BLI_listbase_clear",
"(",
"&",
"block",
"->",
"oldblock",
"->",
"butstore",
")",
";",
"}",
"}",
"if",
"(",
"LIKELY",
"(",
"block",
"->",
"butstore",
".",
"first",
"==",
"NULL",
")",
")",
"{",
"return",
";",
"}",
"for",
"(",
"bs_handle",
"=",
"block",
"->",
"butstore",
".",
"first",
";",
"bs_handle",
";",
"bs_handle",
"=",
"bs_handle",
"->",
"next",
")",
"{",
"BLI_assert",
"(",
"(",
"bs_handle",
"->",
"block",
"==",
"NULL",
")",
"||",
"(",
"bs_handle",
"->",
"block",
"==",
"block",
")",
"||",
"(",
"block",
"->",
"oldblock",
"&&",
"block",
"->",
"oldblock",
"==",
"bs_handle",
"->",
"block",
")",
")",
";",
"if",
"(",
"bs_handle",
"->",
"block",
"==",
"block",
"->",
"oldblock",
")",
"{",
"uiButStoreElem",
"*",
"bs_elem",
";",
"bs_handle",
"->",
"block",
"=",
"block",
";",
"for",
"(",
"bs_elem",
"=",
"bs_handle",
"->",
"items",
".",
"first",
";",
"bs_elem",
";",
"bs_elem",
"=",
"bs_elem",
"->",
"next",
")",
"{",
"if",
"(",
"*",
"bs_elem",
"->",
"but_p",
")",
"{",
"uiBut",
"*",
"but_new",
"=",
"ui_but_find_new",
"(",
"block",
",",
"*",
"bs_elem",
"->",
"but_p",
")",
";",
"*",
"bs_elem",
"->",
"but_p",
"=",
"but_new",
";",
"}",
"}",
"}",
"}",
"}"
] | Map freed buttons from the old block and update pointers. | [
"Map",
"freed",
"buttons",
"from",
"the",
"old",
"block",
"and",
"update",
"pointers",
"."
] | [
"/* move this list to the new block */",
"/* warning, loop-in-loop, in practice we only store <10 buttons at a time,\n * so this isn't going to be a problem, if that changes old-new mapping can be cached first */",
"/* can be NULL if the buttons removed,\n * note: we could allow passing in a callback when buttons are removed\n * so the caller can cleanup */"
] | [
{
"param": "block",
"type": "uiBlock"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "block",
"type": "uiBlock",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5cf7cb4e7c4695a8ac0f776020ca6c46a4a8983a | DemonRem/blender | source/blender/editors/interface/view2d_ops.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | view_pan_invoke | int | static int view_pan_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
wmWindow *window = CTX_wm_window(C);
v2dViewPanData *vpd;
View2D *v2d;
/* set up customdata */
if (!view_pan_init(C, op)) {
return OPERATOR_PASS_THROUGH;
}
vpd = op->customdata;
v2d = vpd->v2d;
/* set initial settings */
vpd->startx = vpd->lastx = event->x;
vpd->starty = vpd->lasty = event->y;
vpd->invoke_event = event->type;
if (event->type == MOUSEPAN) {
RNA_int_set(op->ptr, "deltax", event->prevx - event->x);
RNA_int_set(op->ptr, "deltay", event->prevy - event->y);
view_pan_apply(C, op);
view_pan_exit(op);
return OPERATOR_FINISHED;
}
RNA_int_set(op->ptr, "deltax", 0);
RNA_int_set(op->ptr, "deltay", 0);
if (v2d->keepofs & V2D_LOCKOFS_X) {
WM_cursor_modal_set(window, WM_CURSOR_NS_SCROLL);
}
else if (v2d->keepofs & V2D_LOCKOFS_Y) {
WM_cursor_modal_set(window, WM_CURSOR_EW_SCROLL);
}
else {
WM_cursor_modal_set(window, WM_CURSOR_NSEW_SCROLL);
}
/* add temp handler */
WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
} | /* set up modal operator and relevant settings */ | set up modal operator and relevant settings | [
"set",
"up",
"modal",
"operator",
"and",
"relevant",
"settings"
] | static int view_pan_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
wmWindow *window = CTX_wm_window(C);
v2dViewPanData *vpd;
View2D *v2d;
if (!view_pan_init(C, op)) {
return OPERATOR_PASS_THROUGH;
}
vpd = op->customdata;
v2d = vpd->v2d;
vpd->startx = vpd->lastx = event->x;
vpd->starty = vpd->lasty = event->y;
vpd->invoke_event = event->type;
if (event->type == MOUSEPAN) {
RNA_int_set(op->ptr, "deltax", event->prevx - event->x);
RNA_int_set(op->ptr, "deltay", event->prevy - event->y);
view_pan_apply(C, op);
view_pan_exit(op);
return OPERATOR_FINISHED;
}
RNA_int_set(op->ptr, "deltax", 0);
RNA_int_set(op->ptr, "deltay", 0);
if (v2d->keepofs & V2D_LOCKOFS_X) {
WM_cursor_modal_set(window, WM_CURSOR_NS_SCROLL);
}
else if (v2d->keepofs & V2D_LOCKOFS_Y) {
WM_cursor_modal_set(window, WM_CURSOR_EW_SCROLL);
}
else {
WM_cursor_modal_set(window, WM_CURSOR_NSEW_SCROLL);
}
WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
} | [
"static",
"int",
"view_pan_invoke",
"(",
"bContext",
"*",
"C",
",",
"wmOperator",
"*",
"op",
",",
"const",
"wmEvent",
"*",
"event",
")",
"{",
"wmWindow",
"*",
"window",
"=",
"CTX_wm_window",
"(",
"C",
")",
";",
"v2dViewPanData",
"*",
"vpd",
";",
"View2D",
"*",
"v2d",
";",
"if",
"(",
"!",
"view_pan_init",
"(",
"C",
",",
"op",
")",
")",
"{",
"return",
"OPERATOR_PASS_THROUGH",
";",
"}",
"vpd",
"=",
"op",
"->",
"customdata",
";",
"v2d",
"=",
"vpd",
"->",
"v2d",
";",
"vpd",
"->",
"startx",
"=",
"vpd",
"->",
"lastx",
"=",
"event",
"->",
"x",
";",
"vpd",
"->",
"starty",
"=",
"vpd",
"->",
"lasty",
"=",
"event",
"->",
"y",
";",
"vpd",
"->",
"invoke_event",
"=",
"event",
"->",
"type",
";",
"if",
"(",
"event",
"->",
"type",
"==",
"MOUSEPAN",
")",
"{",
"RNA_int_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"event",
"->",
"prevx",
"-",
"event",
"->",
"x",
")",
";",
"RNA_int_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"event",
"->",
"prevy",
"-",
"event",
"->",
"y",
")",
";",
"view_pan_apply",
"(",
"C",
",",
"op",
")",
";",
"view_pan_exit",
"(",
"op",
")",
";",
"return",
"OPERATOR_FINISHED",
";",
"}",
"RNA_int_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"0",
")",
";",
"RNA_int_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"0",
")",
";",
"if",
"(",
"v2d",
"->",
"keepofs",
"&",
"V2D_LOCKOFS_X",
")",
"{",
"WM_cursor_modal_set",
"(",
"window",
",",
"WM_CURSOR_NS_SCROLL",
")",
";",
"}",
"else",
"if",
"(",
"v2d",
"->",
"keepofs",
"&",
"V2D_LOCKOFS_Y",
")",
"{",
"WM_cursor_modal_set",
"(",
"window",
",",
"WM_CURSOR_EW_SCROLL",
")",
";",
"}",
"else",
"{",
"WM_cursor_modal_set",
"(",
"window",
",",
"WM_CURSOR_NSEW_SCROLL",
")",
";",
"}",
"WM_event_add_modal_handler",
"(",
"C",
",",
"op",
")",
";",
"return",
"OPERATOR_RUNNING_MODAL",
";",
"}"
] | set up modal operator and relevant settings | [
"set",
"up",
"modal",
"operator",
"and",
"relevant",
"settings"
] | [
"/* set up customdata */",
"/* set initial settings */",
"/* add temp handler */"
] | [
{
"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": []
} |
5cf7cb4e7c4695a8ac0f776020ca6c46a4a8983a | DemonRem/blender | source/blender/editors/interface/view2d_ops.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | view_pan_modal | int | static int view_pan_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
v2dViewPanData *vpd = op->customdata;
/* execute the events */
switch (event->type) {
case MOUSEMOVE: {
/* calculate new delta transform, then store mouse-coordinates for next-time */
RNA_int_set(op->ptr, "deltax", (vpd->lastx - event->x));
RNA_int_set(op->ptr, "deltay", (vpd->lasty - event->y));
vpd->lastx = event->x;
vpd->lasty = event->y;
view_pan_apply(C, op);
break;
}
/* XXX - Mode switching isn't implemented. See comments in 36818.
* switch to zoom */
#if 0
case LEFTMOUSE:
if (event->val == KM_PRESS) {
/* calculate overall delta mouse-movement for redo */
RNA_int_set(op->ptr, "deltax", (vpd->startx - vpd->lastx));
RNA_int_set(op->ptr, "deltay", (vpd->starty - vpd->lasty));
view_pan_exit(op);
WM_cursor_modal_restore(CTX_wm_window(C));
WM_operator_name_call(C, "VIEW2D_OT_zoom", WM_OP_INVOKE_DEFAULT, NULL);
return OPERATOR_FINISHED;
}
#endif
default:
if (event->type == vpd->invoke_event || event->type == ESCKEY) {
if (event->val == KM_RELEASE) {
/* calculate overall delta mouse-movement for redo */
RNA_int_set(op->ptr, "deltax", (vpd->startx - vpd->lastx));
RNA_int_set(op->ptr, "deltay", (vpd->starty - vpd->lasty));
view_pan_exit(op);
WM_cursor_modal_restore(CTX_wm_window(C));
return OPERATOR_FINISHED;
}
}
break;
}
return OPERATOR_RUNNING_MODAL;
} | /* handle user input - calculations of mouse-movement
* need to be done here, not in the apply callback! */ | handle user input - calculations of mouse-movement
need to be done here, not in the apply callback! | [
"handle",
"user",
"input",
"-",
"calculations",
"of",
"mouse",
"-",
"movement",
"need",
"to",
"be",
"done",
"here",
"not",
"in",
"the",
"apply",
"callback!"
] | static int view_pan_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
v2dViewPanData *vpd = op->customdata;
switch (event->type) {
case MOUSEMOVE: {
RNA_int_set(op->ptr, "deltax", (vpd->lastx - event->x));
RNA_int_set(op->ptr, "deltay", (vpd->lasty - event->y));
vpd->lastx = event->x;
vpd->lasty = event->y;
view_pan_apply(C, op);
break;
}
#if 0
case LEFTMOUSE:
if (event->val == KM_PRESS) {
RNA_int_set(op->ptr, "deltax", (vpd->startx - vpd->lastx));
RNA_int_set(op->ptr, "deltay", (vpd->starty - vpd->lasty));
view_pan_exit(op);
WM_cursor_modal_restore(CTX_wm_window(C));
WM_operator_name_call(C, "VIEW2D_OT_zoom", WM_OP_INVOKE_DEFAULT, NULL);
return OPERATOR_FINISHED;
}
#endif
default:
if (event->type == vpd->invoke_event || event->type == ESCKEY) {
if (event->val == KM_RELEASE) {
RNA_int_set(op->ptr, "deltax", (vpd->startx - vpd->lastx));
RNA_int_set(op->ptr, "deltay", (vpd->starty - vpd->lasty));
view_pan_exit(op);
WM_cursor_modal_restore(CTX_wm_window(C));
return OPERATOR_FINISHED;
}
}
break;
}
return OPERATOR_RUNNING_MODAL;
} | [
"static",
"int",
"view_pan_modal",
"(",
"bContext",
"*",
"C",
",",
"wmOperator",
"*",
"op",
",",
"const",
"wmEvent",
"*",
"event",
")",
"{",
"v2dViewPanData",
"*",
"vpd",
"=",
"op",
"->",
"customdata",
";",
"switch",
"(",
"event",
"->",
"type",
")",
"{",
"case",
"MOUSEMOVE",
":",
"{",
"RNA_int_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"(",
"vpd",
"->",
"lastx",
"-",
"event",
"->",
"x",
")",
")",
";",
"RNA_int_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"(",
"vpd",
"->",
"lasty",
"-",
"event",
"->",
"y",
")",
")",
";",
"vpd",
"->",
"lastx",
"=",
"event",
"->",
"x",
";",
"vpd",
"->",
"lasty",
"=",
"event",
"->",
"y",
";",
"view_pan_apply",
"(",
"C",
",",
"op",
")",
";",
"break",
";",
"}",
"#if",
"0",
"\n",
"case",
"LEFTMOUSE",
":",
"if",
"(",
"event",
"->",
"val",
"==",
"KM_PRESS",
")",
"{",
"RNA_int_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"(",
"vpd",
"->",
"startx",
"-",
"vpd",
"->",
"lastx",
")",
")",
";",
"RNA_int_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"(",
"vpd",
"->",
"starty",
"-",
"vpd",
"->",
"lasty",
")",
")",
";",
"view_pan_exit",
"(",
"op",
")",
";",
"WM_cursor_modal_restore",
"(",
"CTX_wm_window",
"(",
"C",
")",
")",
";",
"WM_operator_name_call",
"(",
"C",
",",
"\"",
"\"",
",",
"WM_OP_INVOKE_DEFAULT",
",",
"NULL",
")",
";",
"return",
"OPERATOR_FINISHED",
";",
"}",
"#endif",
"default",
":",
"if",
"(",
"event",
"->",
"type",
"==",
"vpd",
"->",
"invoke_event",
"||",
"event",
"->",
"type",
"==",
"ESCKEY",
")",
"{",
"if",
"(",
"event",
"->",
"val",
"==",
"KM_RELEASE",
")",
"{",
"RNA_int_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"(",
"vpd",
"->",
"startx",
"-",
"vpd",
"->",
"lastx",
")",
")",
";",
"RNA_int_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"(",
"vpd",
"->",
"starty",
"-",
"vpd",
"->",
"lasty",
")",
")",
";",
"view_pan_exit",
"(",
"op",
")",
";",
"WM_cursor_modal_restore",
"(",
"CTX_wm_window",
"(",
"C",
")",
")",
";",
"return",
"OPERATOR_FINISHED",
";",
"}",
"}",
"break",
";",
"}",
"return",
"OPERATOR_RUNNING_MODAL",
";",
"}"
] | handle user input - calculations of mouse-movement
need to be done here, not in the apply callback! | [
"handle",
"user",
"input",
"-",
"calculations",
"of",
"mouse",
"-",
"movement",
"need",
"to",
"be",
"done",
"here",
"not",
"in",
"the",
"apply",
"callback!"
] | [
"/* execute the events */",
"/* calculate new delta transform, then store mouse-coordinates for next-time */",
"/* XXX - Mode switching isn't implemented. See comments in 36818.\n * switch to zoom */",
"/* calculate overall delta mouse-movement for redo */",
"/* calculate overall delta mouse-movement for redo */"
] | [
{
"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": []
} |
5cf7cb4e7c4695a8ac0f776020ca6c46a4a8983a | DemonRem/blender | source/blender/editors/interface/view2d_ops.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | view_scrollright_exec | int | static int view_scrollright_exec(bContext *C, wmOperator *op)
{
v2dViewPanData *vpd;
/* initialize default settings (and validate if ok to run) */
if (!view_pan_init(C, op)) {
return OPERATOR_PASS_THROUGH;
}
/* also, check if can pan in horizontal axis */
vpd = op->customdata;
if (vpd->v2d->keepofs & V2D_LOCKOFS_X) {
view_pan_exit(op);
return OPERATOR_PASS_THROUGH;
}
/* set RNA-Props - only movement in positive x-direction */
RNA_int_set(op->ptr, "deltax", 40);
RNA_int_set(op->ptr, "deltay", 0);
/* apply movement, then we're done */
view_pan_apply(C, op);
view_pan_exit(op);
return OPERATOR_FINISHED;
} | /* this operator only needs this single callback, where it calls the view_pan_*() methods */ | this operator only needs this single callback, where it calls the view_pan_*() methods | [
"this",
"operator",
"only",
"needs",
"this",
"single",
"callback",
"where",
"it",
"calls",
"the",
"view_pan_",
"*",
"()",
"methods"
] | static int view_scrollright_exec(bContext *C, wmOperator *op)
{
v2dViewPanData *vpd;
if (!view_pan_init(C, op)) {
return OPERATOR_PASS_THROUGH;
}
vpd = op->customdata;
if (vpd->v2d->keepofs & V2D_LOCKOFS_X) {
view_pan_exit(op);
return OPERATOR_PASS_THROUGH;
}
RNA_int_set(op->ptr, "deltax", 40);
RNA_int_set(op->ptr, "deltay", 0);
view_pan_apply(C, op);
view_pan_exit(op);
return OPERATOR_FINISHED;
} | [
"static",
"int",
"view_scrollright_exec",
"(",
"bContext",
"*",
"C",
",",
"wmOperator",
"*",
"op",
")",
"{",
"v2dViewPanData",
"*",
"vpd",
";",
"if",
"(",
"!",
"view_pan_init",
"(",
"C",
",",
"op",
")",
")",
"{",
"return",
"OPERATOR_PASS_THROUGH",
";",
"}",
"vpd",
"=",
"op",
"->",
"customdata",
";",
"if",
"(",
"vpd",
"->",
"v2d",
"->",
"keepofs",
"&",
"V2D_LOCKOFS_X",
")",
"{",
"view_pan_exit",
"(",
"op",
")",
";",
"return",
"OPERATOR_PASS_THROUGH",
";",
"}",
"RNA_int_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"40",
")",
";",
"RNA_int_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"0",
")",
";",
"view_pan_apply",
"(",
"C",
",",
"op",
")",
";",
"view_pan_exit",
"(",
"op",
")",
";",
"return",
"OPERATOR_FINISHED",
";",
"}"
] | this operator only needs this single callback, where it calls the view_pan_*() methods | [
"this",
"operator",
"only",
"needs",
"this",
"single",
"callback",
"where",
"it",
"calls",
"the",
"view_pan_",
"*",
"()",
"methods"
] | [
"/* initialize default settings (and validate if ok to run) */",
"/* also, check if can pan in horizontal axis */",
"/* set RNA-Props - only movement in positive x-direction */",
"/* apply movement, then we're done */"
] | [
{
"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": []
} |
5cf7cb4e7c4695a8ac0f776020ca6c46a4a8983a | DemonRem/blender | source/blender/editors/interface/view2d_ops.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | view_scrollleft_exec | int | static int view_scrollleft_exec(bContext *C, wmOperator *op)
{
v2dViewPanData *vpd;
/* initialize default settings (and validate if ok to run) */
if (!view_pan_init(C, op)) {
return OPERATOR_PASS_THROUGH;
}
/* also, check if can pan in horizontal axis */
vpd = op->customdata;
if (vpd->v2d->keepofs & V2D_LOCKOFS_X) {
view_pan_exit(op);
return OPERATOR_PASS_THROUGH;
}
/* set RNA-Props - only movement in negative x-direction */
RNA_int_set(op->ptr, "deltax", -40);
RNA_int_set(op->ptr, "deltay", 0);
/* apply movement, then we're done */
view_pan_apply(C, op);
view_pan_exit(op);
return OPERATOR_FINISHED;
} | /* this operator only needs this single callback, where it calls the view_pan_*() methods */ | this operator only needs this single callback, where it calls the view_pan_*() methods | [
"this",
"operator",
"only",
"needs",
"this",
"single",
"callback",
"where",
"it",
"calls",
"the",
"view_pan_",
"*",
"()",
"methods"
] | static int view_scrollleft_exec(bContext *C, wmOperator *op)
{
v2dViewPanData *vpd;
if (!view_pan_init(C, op)) {
return OPERATOR_PASS_THROUGH;
}
vpd = op->customdata;
if (vpd->v2d->keepofs & V2D_LOCKOFS_X) {
view_pan_exit(op);
return OPERATOR_PASS_THROUGH;
}
RNA_int_set(op->ptr, "deltax", -40);
RNA_int_set(op->ptr, "deltay", 0);
view_pan_apply(C, op);
view_pan_exit(op);
return OPERATOR_FINISHED;
} | [
"static",
"int",
"view_scrollleft_exec",
"(",
"bContext",
"*",
"C",
",",
"wmOperator",
"*",
"op",
")",
"{",
"v2dViewPanData",
"*",
"vpd",
";",
"if",
"(",
"!",
"view_pan_init",
"(",
"C",
",",
"op",
")",
")",
"{",
"return",
"OPERATOR_PASS_THROUGH",
";",
"}",
"vpd",
"=",
"op",
"->",
"customdata",
";",
"if",
"(",
"vpd",
"->",
"v2d",
"->",
"keepofs",
"&",
"V2D_LOCKOFS_X",
")",
"{",
"view_pan_exit",
"(",
"op",
")",
";",
"return",
"OPERATOR_PASS_THROUGH",
";",
"}",
"RNA_int_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"-40",
")",
";",
"RNA_int_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"0",
")",
";",
"view_pan_apply",
"(",
"C",
",",
"op",
")",
";",
"view_pan_exit",
"(",
"op",
")",
";",
"return",
"OPERATOR_FINISHED",
";",
"}"
] | this operator only needs this single callback, where it calls the view_pan_*() methods | [
"this",
"operator",
"only",
"needs",
"this",
"single",
"callback",
"where",
"it",
"calls",
"the",
"view_pan_",
"*",
"()",
"methods"
] | [
"/* initialize default settings (and validate if ok to run) */",
"/* also, check if can pan in horizontal axis */",
"/* set RNA-Props - only movement in negative x-direction */",
"/* apply movement, then we're done */"
] | [
{
"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": []
} |
5cf7cb4e7c4695a8ac0f776020ca6c46a4a8983a | DemonRem/blender | source/blender/editors/interface/view2d_ops.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | view_scrolldown_exec | int | static int view_scrolldown_exec(bContext *C, wmOperator *op)
{
v2dViewPanData *vpd;
/* initialize default settings (and validate if ok to run) */
if (!view_pan_init(C, op)) {
return OPERATOR_PASS_THROUGH;
}
/* also, check if can pan in vertical axis */
vpd = op->customdata;
if (vpd->v2d->keepofs & V2D_LOCKOFS_Y) {
view_pan_exit(op);
return OPERATOR_PASS_THROUGH;
}
/* set RNA-Props */
RNA_int_set(op->ptr, "deltax", 0);
RNA_int_set(op->ptr, "deltay", -40);
PropertyRNA *prop = RNA_struct_find_property(op->ptr, "page");
if (RNA_property_is_set(op->ptr, prop) && RNA_property_boolean_get(op->ptr, prop)) {
ARegion *ar = CTX_wm_region(C);
RNA_int_set(op->ptr, "deltay", ar->v2d.mask.ymin - ar->v2d.mask.ymax);
}
/* apply movement, then we're done */
view_pan_apply(C, op);
view_pan_exit(op);
return OPERATOR_FINISHED;
} | /* this operator only needs this single callback, where it calls the view_pan_*() methods */ | this operator only needs this single callback, where it calls the view_pan_*() methods | [
"this",
"operator",
"only",
"needs",
"this",
"single",
"callback",
"where",
"it",
"calls",
"the",
"view_pan_",
"*",
"()",
"methods"
] | static int view_scrolldown_exec(bContext *C, wmOperator *op)
{
v2dViewPanData *vpd;
if (!view_pan_init(C, op)) {
return OPERATOR_PASS_THROUGH;
}
vpd = op->customdata;
if (vpd->v2d->keepofs & V2D_LOCKOFS_Y) {
view_pan_exit(op);
return OPERATOR_PASS_THROUGH;
}
RNA_int_set(op->ptr, "deltax", 0);
RNA_int_set(op->ptr, "deltay", -40);
PropertyRNA *prop = RNA_struct_find_property(op->ptr, "page");
if (RNA_property_is_set(op->ptr, prop) && RNA_property_boolean_get(op->ptr, prop)) {
ARegion *ar = CTX_wm_region(C);
RNA_int_set(op->ptr, "deltay", ar->v2d.mask.ymin - ar->v2d.mask.ymax);
}
view_pan_apply(C, op);
view_pan_exit(op);
return OPERATOR_FINISHED;
} | [
"static",
"int",
"view_scrolldown_exec",
"(",
"bContext",
"*",
"C",
",",
"wmOperator",
"*",
"op",
")",
"{",
"v2dViewPanData",
"*",
"vpd",
";",
"if",
"(",
"!",
"view_pan_init",
"(",
"C",
",",
"op",
")",
")",
"{",
"return",
"OPERATOR_PASS_THROUGH",
";",
"}",
"vpd",
"=",
"op",
"->",
"customdata",
";",
"if",
"(",
"vpd",
"->",
"v2d",
"->",
"keepofs",
"&",
"V2D_LOCKOFS_Y",
")",
"{",
"view_pan_exit",
"(",
"op",
")",
";",
"return",
"OPERATOR_PASS_THROUGH",
";",
"}",
"RNA_int_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"0",
")",
";",
"RNA_int_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"-40",
")",
";",
"PropertyRNA",
"*",
"prop",
"=",
"RNA_struct_find_property",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"RNA_property_is_set",
"(",
"op",
"->",
"ptr",
",",
"prop",
")",
"&&",
"RNA_property_boolean_get",
"(",
"op",
"->",
"ptr",
",",
"prop",
")",
")",
"{",
"ARegion",
"*",
"ar",
"=",
"CTX_wm_region",
"(",
"C",
")",
";",
"RNA_int_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"ar",
"->",
"v2d",
".",
"mask",
".",
"ymin",
"-",
"ar",
"->",
"v2d",
".",
"mask",
".",
"ymax",
")",
";",
"}",
"view_pan_apply",
"(",
"C",
",",
"op",
")",
";",
"view_pan_exit",
"(",
"op",
")",
";",
"return",
"OPERATOR_FINISHED",
";",
"}"
] | this operator only needs this single callback, where it calls the view_pan_*() methods | [
"this",
"operator",
"only",
"needs",
"this",
"single",
"callback",
"where",
"it",
"calls",
"the",
"view_pan_",
"*",
"()",
"methods"
] | [
"/* initialize default settings (and validate if ok to run) */",
"/* also, check if can pan in vertical axis */",
"/* set RNA-Props */",
"/* apply movement, then we're done */"
] | [
{
"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": []
} |
5cf7cb4e7c4695a8ac0f776020ca6c46a4a8983a | DemonRem/blender | source/blender/editors/interface/view2d_ops.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | view_scrollup_exec | int | static int view_scrollup_exec(bContext *C, wmOperator *op)
{
v2dViewPanData *vpd;
/* initialize default settings (and validate if ok to run) */
if (!view_pan_init(C, op)) {
return OPERATOR_PASS_THROUGH;
}
/* also, check if can pan in vertical axis */
vpd = op->customdata;
if (vpd->v2d->keepofs & V2D_LOCKOFS_Y) {
view_pan_exit(op);
return OPERATOR_PASS_THROUGH;
}
/* set RNA-Props */
RNA_int_set(op->ptr, "deltax", 0);
RNA_int_set(op->ptr, "deltay", 40);
PropertyRNA *prop = RNA_struct_find_property(op->ptr, "page");
if (RNA_property_is_set(op->ptr, prop) && RNA_property_boolean_get(op->ptr, prop)) {
ARegion *ar = CTX_wm_region(C);
RNA_int_set(op->ptr, "deltay", BLI_rcti_size_y(&ar->v2d.mask));
}
/* apply movement, then we're done */
view_pan_apply(C, op);
view_pan_exit(op);
return OPERATOR_FINISHED;
} | /* this operator only needs this single callback, where it calls the view_pan_*() methods */ | this operator only needs this single callback, where it calls the view_pan_*() methods | [
"this",
"operator",
"only",
"needs",
"this",
"single",
"callback",
"where",
"it",
"calls",
"the",
"view_pan_",
"*",
"()",
"methods"
] | static int view_scrollup_exec(bContext *C, wmOperator *op)
{
v2dViewPanData *vpd;
if (!view_pan_init(C, op)) {
return OPERATOR_PASS_THROUGH;
}
vpd = op->customdata;
if (vpd->v2d->keepofs & V2D_LOCKOFS_Y) {
view_pan_exit(op);
return OPERATOR_PASS_THROUGH;
}
RNA_int_set(op->ptr, "deltax", 0);
RNA_int_set(op->ptr, "deltay", 40);
PropertyRNA *prop = RNA_struct_find_property(op->ptr, "page");
if (RNA_property_is_set(op->ptr, prop) && RNA_property_boolean_get(op->ptr, prop)) {
ARegion *ar = CTX_wm_region(C);
RNA_int_set(op->ptr, "deltay", BLI_rcti_size_y(&ar->v2d.mask));
}
view_pan_apply(C, op);
view_pan_exit(op);
return OPERATOR_FINISHED;
} | [
"static",
"int",
"view_scrollup_exec",
"(",
"bContext",
"*",
"C",
",",
"wmOperator",
"*",
"op",
")",
"{",
"v2dViewPanData",
"*",
"vpd",
";",
"if",
"(",
"!",
"view_pan_init",
"(",
"C",
",",
"op",
")",
")",
"{",
"return",
"OPERATOR_PASS_THROUGH",
";",
"}",
"vpd",
"=",
"op",
"->",
"customdata",
";",
"if",
"(",
"vpd",
"->",
"v2d",
"->",
"keepofs",
"&",
"V2D_LOCKOFS_Y",
")",
"{",
"view_pan_exit",
"(",
"op",
")",
";",
"return",
"OPERATOR_PASS_THROUGH",
";",
"}",
"RNA_int_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"0",
")",
";",
"RNA_int_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"40",
")",
";",
"PropertyRNA",
"*",
"prop",
"=",
"RNA_struct_find_property",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"RNA_property_is_set",
"(",
"op",
"->",
"ptr",
",",
"prop",
")",
"&&",
"RNA_property_boolean_get",
"(",
"op",
"->",
"ptr",
",",
"prop",
")",
")",
"{",
"ARegion",
"*",
"ar",
"=",
"CTX_wm_region",
"(",
"C",
")",
";",
"RNA_int_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"BLI_rcti_size_y",
"(",
"&",
"ar",
"->",
"v2d",
".",
"mask",
")",
")",
";",
"}",
"view_pan_apply",
"(",
"C",
",",
"op",
")",
";",
"view_pan_exit",
"(",
"op",
")",
";",
"return",
"OPERATOR_FINISHED",
";",
"}"
] | this operator only needs this single callback, where it calls the view_pan_*() methods | [
"this",
"operator",
"only",
"needs",
"this",
"single",
"callback",
"where",
"it",
"calls",
"the",
"view_pan_",
"*",
"()",
"methods"
] | [
"/* initialize default settings (and validate if ok to run) */",
"/* also, check if can pan in vertical axis */",
"/* set RNA-Props */",
"/* apply movement, then we're done */"
] | [
{
"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": []
} |
5cf7cb4e7c4695a8ac0f776020ca6c46a4a8983a | DemonRem/blender | source/blender/editors/interface/view2d_ops.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | view_zoom_axis_lock_defaults | void | static void view_zoom_axis_lock_defaults(bContext *C, bool r_do_zoom_xy[2])
{
ScrArea *sa = CTX_wm_area(C);
r_do_zoom_xy[0] = true;
r_do_zoom_xy[1] = true;
/* default not to zoom the sequencer vertically */
if (sa && sa->spacetype == SPACE_SEQ) {
ARegion *ar = CTX_wm_region(C);
if (ar && ar->regiontype == RGN_TYPE_WINDOW) {
r_do_zoom_xy[1] = false;
}
}
} | /**
* Clamp by convention rather then locking flags,
* for ndof and +/- keys
*/ | Clamp by convention rather then locking flags,
for ndof and +/- keys | [
"Clamp",
"by",
"convention",
"rather",
"then",
"locking",
"flags",
"for",
"ndof",
"and",
"+",
"/",
"-",
"keys"
] | static void view_zoom_axis_lock_defaults(bContext *C, bool r_do_zoom_xy[2])
{
ScrArea *sa = CTX_wm_area(C);
r_do_zoom_xy[0] = true;
r_do_zoom_xy[1] = true;
if (sa && sa->spacetype == SPACE_SEQ) {
ARegion *ar = CTX_wm_region(C);
if (ar && ar->regiontype == RGN_TYPE_WINDOW) {
r_do_zoom_xy[1] = false;
}
}
} | [
"static",
"void",
"view_zoom_axis_lock_defaults",
"(",
"bContext",
"*",
"C",
",",
"bool",
"r_do_zoom_xy",
"[",
"2",
"]",
")",
"{",
"ScrArea",
"*",
"sa",
"=",
"CTX_wm_area",
"(",
"C",
")",
";",
"r_do_zoom_xy",
"[",
"0",
"]",
"=",
"true",
";",
"r_do_zoom_xy",
"[",
"1",
"]",
"=",
"true",
";",
"if",
"(",
"sa",
"&&",
"sa",
"->",
"spacetype",
"==",
"SPACE_SEQ",
")",
"{",
"ARegion",
"*",
"ar",
"=",
"CTX_wm_region",
"(",
"C",
")",
";",
"if",
"(",
"ar",
"&&",
"ar",
"->",
"regiontype",
"==",
"RGN_TYPE_WINDOW",
")",
"{",
"r_do_zoom_xy",
"[",
"1",
"]",
"=",
"false",
";",
"}",
"}",
"}"
] | Clamp by convention rather then locking flags,
for ndof and +/- keys | [
"Clamp",
"by",
"convention",
"rather",
"then",
"locking",
"flags",
"for",
"ndof",
"and",
"+",
"/",
"-",
"keys"
] | [
"/* default not to zoom the sequencer vertically */"
] | [
{
"param": "C",
"type": "bContext"
},
{
"param": "r_do_zoom_xy",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "r_do_zoom_xy",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5cf7cb4e7c4695a8ac0f776020ca6c46a4a8983a | DemonRem/blender | source/blender/editors/interface/view2d_ops.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | view_zoom_poll | bool | static bool view_zoom_poll(bContext *C)
{
ARegion *ar = CTX_wm_region(C);
View2D *v2d;
/* check if there's a region in context to work with */
if (ar == NULL) {
return false;
}
/* Do not show that in 3DView context. */
if (CTX_wm_region_view3d(C)) {
return false;
}
v2d = &ar->v2d;
/* check that 2d-view is zoomable */
if ((v2d->keepzoom & V2D_LOCKZOOM_X) && (v2d->keepzoom & V2D_LOCKZOOM_Y)) {
return false;
}
/* view is zoomable */
return true;
} | /* check if step-zoom can be applied */ | check if step-zoom can be applied | [
"check",
"if",
"step",
"-",
"zoom",
"can",
"be",
"applied"
] | static bool view_zoom_poll(bContext *C)
{
ARegion *ar = CTX_wm_region(C);
View2D *v2d;
if (ar == NULL) {
return false;
}
if (CTX_wm_region_view3d(C)) {
return false;
}
v2d = &ar->v2d;
if ((v2d->keepzoom & V2D_LOCKZOOM_X) && (v2d->keepzoom & V2D_LOCKZOOM_Y)) {
return false;
}
return true;
} | [
"static",
"bool",
"view_zoom_poll",
"(",
"bContext",
"*",
"C",
")",
"{",
"ARegion",
"*",
"ar",
"=",
"CTX_wm_region",
"(",
"C",
")",
";",
"View2D",
"*",
"v2d",
";",
"if",
"(",
"ar",
"==",
"NULL",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"CTX_wm_region_view3d",
"(",
"C",
")",
")",
"{",
"return",
"false",
";",
"}",
"v2d",
"=",
"&",
"ar",
"->",
"v2d",
";",
"if",
"(",
"(",
"v2d",
"->",
"keepzoom",
"&",
"V2D_LOCKZOOM_X",
")",
"&&",
"(",
"v2d",
"->",
"keepzoom",
"&",
"V2D_LOCKZOOM_Y",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] | check if step-zoom can be applied | [
"check",
"if",
"step",
"-",
"zoom",
"can",
"be",
"applied"
] | [
"/* check if there's a region in context to work with */",
"/* Do not show that in 3DView context. */",
"/* check that 2d-view is zoomable */",
"/* view is zoomable */"
] | [
{
"param": "C",
"type": "bContext"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5cf7cb4e7c4695a8ac0f776020ca6c46a4a8983a | DemonRem/blender | source/blender/editors/interface/view2d_ops.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | view_zoomin_exec | int | static int view_zoomin_exec(bContext *C, wmOperator *op)
{
bool do_zoom_xy[2];
/* check that there's an active region, as View2D data resides there */
if (!view_zoom_poll(C)) {
return OPERATOR_PASS_THROUGH;
}
view_zoom_axis_lock_defaults(C, do_zoom_xy);
/* set RNA-Props - zooming in by uniform factor */
RNA_float_set(op->ptr, "zoomfacx", do_zoom_xy[0] ? 0.0375f : 0.0f);
RNA_float_set(op->ptr, "zoomfacy", do_zoom_xy[1] ? 0.0375f : 0.0f);
/* apply movement, then we're done */
view_zoomstep_apply(C, op);
view_zoomstep_exit(op);
return OPERATOR_FINISHED;
} | /* this operator only needs this single callback, where it calls the view_zoom_*() methods */ | this operator only needs this single callback, where it calls the view_zoom_*() methods | [
"this",
"operator",
"only",
"needs",
"this",
"single",
"callback",
"where",
"it",
"calls",
"the",
"view_zoom_",
"*",
"()",
"methods"
] | static int view_zoomin_exec(bContext *C, wmOperator *op)
{
bool do_zoom_xy[2];
if (!view_zoom_poll(C)) {
return OPERATOR_PASS_THROUGH;
}
view_zoom_axis_lock_defaults(C, do_zoom_xy);
RNA_float_set(op->ptr, "zoomfacx", do_zoom_xy[0] ? 0.0375f : 0.0f);
RNA_float_set(op->ptr, "zoomfacy", do_zoom_xy[1] ? 0.0375f : 0.0f);
view_zoomstep_apply(C, op);
view_zoomstep_exit(op);
return OPERATOR_FINISHED;
} | [
"static",
"int",
"view_zoomin_exec",
"(",
"bContext",
"*",
"C",
",",
"wmOperator",
"*",
"op",
")",
"{",
"bool",
"do_zoom_xy",
"[",
"2",
"]",
";",
"if",
"(",
"!",
"view_zoom_poll",
"(",
"C",
")",
")",
"{",
"return",
"OPERATOR_PASS_THROUGH",
";",
"}",
"view_zoom_axis_lock_defaults",
"(",
"C",
",",
"do_zoom_xy",
")",
";",
"RNA_float_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"do_zoom_xy",
"[",
"0",
"]",
"?",
"0.0375f",
":",
"0.0f",
")",
";",
"RNA_float_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"do_zoom_xy",
"[",
"1",
"]",
"?",
"0.0375f",
":",
"0.0f",
")",
";",
"view_zoomstep_apply",
"(",
"C",
",",
"op",
")",
";",
"view_zoomstep_exit",
"(",
"op",
")",
";",
"return",
"OPERATOR_FINISHED",
";",
"}"
] | this operator only needs this single callback, where it calls the view_zoom_*() methods | [
"this",
"operator",
"only",
"needs",
"this",
"single",
"callback",
"where",
"it",
"calls",
"the",
"view_zoom_",
"*",
"()",
"methods"
] | [
"/* check that there's an active region, as View2D data resides there */",
"/* set RNA-Props - zooming in by uniform factor */",
"/* apply movement, then we're done */"
] | [
{
"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": []
} |
5cf7cb4e7c4695a8ac0f776020ca6c46a4a8983a | DemonRem/blender | source/blender/editors/interface/view2d_ops.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | view_zoomout_exec | int | static int view_zoomout_exec(bContext *C, wmOperator *op)
{
bool do_zoom_xy[2];
/* check that there's an active region, as View2D data resides there */
if (!view_zoom_poll(C)) {
return OPERATOR_PASS_THROUGH;
}
view_zoom_axis_lock_defaults(C, do_zoom_xy);
/* set RNA-Props - zooming in by uniform factor */
RNA_float_set(op->ptr, "zoomfacx", do_zoom_xy[0] ? -0.0375f : 0.0f);
RNA_float_set(op->ptr, "zoomfacy", do_zoom_xy[1] ? -0.0375f : 0.0f);
/* apply movement, then we're done */
view_zoomstep_apply(C, op);
view_zoomstep_exit(op);
return OPERATOR_FINISHED;
} | /* this operator only needs this single callback, where it calls the view_zoom_*() methods */ | this operator only needs this single callback, where it calls the view_zoom_*() methods | [
"this",
"operator",
"only",
"needs",
"this",
"single",
"callback",
"where",
"it",
"calls",
"the",
"view_zoom_",
"*",
"()",
"methods"
] | static int view_zoomout_exec(bContext *C, wmOperator *op)
{
bool do_zoom_xy[2];
if (!view_zoom_poll(C)) {
return OPERATOR_PASS_THROUGH;
}
view_zoom_axis_lock_defaults(C, do_zoom_xy);
RNA_float_set(op->ptr, "zoomfacx", do_zoom_xy[0] ? -0.0375f : 0.0f);
RNA_float_set(op->ptr, "zoomfacy", do_zoom_xy[1] ? -0.0375f : 0.0f);
view_zoomstep_apply(C, op);
view_zoomstep_exit(op);
return OPERATOR_FINISHED;
} | [
"static",
"int",
"view_zoomout_exec",
"(",
"bContext",
"*",
"C",
",",
"wmOperator",
"*",
"op",
")",
"{",
"bool",
"do_zoom_xy",
"[",
"2",
"]",
";",
"if",
"(",
"!",
"view_zoom_poll",
"(",
"C",
")",
")",
"{",
"return",
"OPERATOR_PASS_THROUGH",
";",
"}",
"view_zoom_axis_lock_defaults",
"(",
"C",
",",
"do_zoom_xy",
")",
";",
"RNA_float_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"do_zoom_xy",
"[",
"0",
"]",
"?",
"-0.0375f",
":",
"0.0f",
")",
";",
"RNA_float_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"do_zoom_xy",
"[",
"1",
"]",
"?",
"-0.0375f",
":",
"0.0f",
")",
";",
"view_zoomstep_apply",
"(",
"C",
",",
"op",
")",
";",
"view_zoomstep_exit",
"(",
"op",
")",
";",
"return",
"OPERATOR_FINISHED",
";",
"}"
] | this operator only needs this single callback, where it calls the view_zoom_*() methods | [
"this",
"operator",
"only",
"needs",
"this",
"single",
"callback",
"where",
"it",
"calls",
"the",
"view_zoom_",
"*",
"()",
"methods"
] | [
"/* check that there's an active region, as View2D data resides there */",
"/* set RNA-Props - zooming in by uniform factor */",
"/* apply movement, then we're done */"
] | [
{
"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": []
} |
5cf7cb4e7c4695a8ac0f776020ca6c46a4a8983a | DemonRem/blender | source/blender/editors/interface/view2d_ops.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | view_zoomdrag_invoke | int | static int view_zoomdrag_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
wmWindow *window = CTX_wm_window(C);
v2dViewZoomData *vzd;
View2D *v2d;
/* set up customdata */
if (!view_zoomdrag_init(C, op)) {
return OPERATOR_PASS_THROUGH;
}
vzd = op->customdata;
v2d = vzd->v2d;
if (event->type == MOUSEZOOM || event->type == MOUSEPAN) {
float dx, dy, fac;
vzd->lastx = event->prevx;
vzd->lasty = event->prevy;
/* As we have only 1D information (magnify value), feed both axes
* with magnify information that is stored in x axis
*/
fac = 0.01f * (event->prevx - event->x);
dx = fac * BLI_rctf_size_x(&v2d->cur) / 10.0f;
if (event->type == MOUSEPAN) {
fac = 0.01f * (event->prevy - event->y);
}
dy = fac * BLI_rctf_size_y(&v2d->cur) / 10.0f;
/* support trackpad zoom to always zoom entirely - the v2d code uses portrait or
* landscape exceptions */
if (v2d->keepzoom & V2D_KEEPASPECT) {
if (fabsf(dx) > fabsf(dy)) {
dy = dx;
}
else {
dx = dy;
}
}
RNA_float_set(op->ptr, "deltax", dx);
RNA_float_set(op->ptr, "deltay", dy);
view_zoomdrag_apply(C, op);
view_zoomdrag_exit(C, op);
return OPERATOR_FINISHED;
}
/* set initial settings */
vzd->lastx = event->x;
vzd->lasty = event->y;
RNA_float_set(op->ptr, "deltax", 0);
RNA_float_set(op->ptr, "deltay", 0);
/* for modal exit test */
vzd->invoke_event = event->type;
if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) {
ARegion *ar = CTX_wm_region(C);
/* store initial mouse position (in view space) */
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &vzd->mx_2d, &vzd->my_2d);
}
if (v2d->keepofs & V2D_LOCKOFS_X) {
WM_cursor_modal_set(window, WM_CURSOR_NS_SCROLL);
}
else if (v2d->keepofs & V2D_LOCKOFS_Y) {
WM_cursor_modal_set(window, WM_CURSOR_EW_SCROLL);
}
else {
WM_cursor_modal_set(window, WM_CURSOR_NSEW_SCROLL);
}
/* add temp handler */
WM_event_add_modal_handler(C, op);
if (U.viewzoom == USER_ZOOM_CONT) {
/* needs a timer to continue redrawing */
vzd->timer = WM_event_add_timer(CTX_wm_manager(C), window, TIMER, 0.01f);
vzd->timer_lastdraw = PIL_check_seconds_timer();
}
return OPERATOR_RUNNING_MODAL;
} | /* set up modal operator and relevant settings */ | set up modal operator and relevant settings | [
"set",
"up",
"modal",
"operator",
"and",
"relevant",
"settings"
] | static int view_zoomdrag_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
wmWindow *window = CTX_wm_window(C);
v2dViewZoomData *vzd;
View2D *v2d;
if (!view_zoomdrag_init(C, op)) {
return OPERATOR_PASS_THROUGH;
}
vzd = op->customdata;
v2d = vzd->v2d;
if (event->type == MOUSEZOOM || event->type == MOUSEPAN) {
float dx, dy, fac;
vzd->lastx = event->prevx;
vzd->lasty = event->prevy;
fac = 0.01f * (event->prevx - event->x);
dx = fac * BLI_rctf_size_x(&v2d->cur) / 10.0f;
if (event->type == MOUSEPAN) {
fac = 0.01f * (event->prevy - event->y);
}
dy = fac * BLI_rctf_size_y(&v2d->cur) / 10.0f;
if (v2d->keepzoom & V2D_KEEPASPECT) {
if (fabsf(dx) > fabsf(dy)) {
dy = dx;
}
else {
dx = dy;
}
}
RNA_float_set(op->ptr, "deltax", dx);
RNA_float_set(op->ptr, "deltay", dy);
view_zoomdrag_apply(C, op);
view_zoomdrag_exit(C, op);
return OPERATOR_FINISHED;
}
vzd->lastx = event->x;
vzd->lasty = event->y;
RNA_float_set(op->ptr, "deltax", 0);
RNA_float_set(op->ptr, "deltay", 0);
vzd->invoke_event = event->type;
if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) {
ARegion *ar = CTX_wm_region(C);
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &vzd->mx_2d, &vzd->my_2d);
}
if (v2d->keepofs & V2D_LOCKOFS_X) {
WM_cursor_modal_set(window, WM_CURSOR_NS_SCROLL);
}
else if (v2d->keepofs & V2D_LOCKOFS_Y) {
WM_cursor_modal_set(window, WM_CURSOR_EW_SCROLL);
}
else {
WM_cursor_modal_set(window, WM_CURSOR_NSEW_SCROLL);
}
WM_event_add_modal_handler(C, op);
if (U.viewzoom == USER_ZOOM_CONT) {
vzd->timer = WM_event_add_timer(CTX_wm_manager(C), window, TIMER, 0.01f);
vzd->timer_lastdraw = PIL_check_seconds_timer();
}
return OPERATOR_RUNNING_MODAL;
} | [
"static",
"int",
"view_zoomdrag_invoke",
"(",
"bContext",
"*",
"C",
",",
"wmOperator",
"*",
"op",
",",
"const",
"wmEvent",
"*",
"event",
")",
"{",
"wmWindow",
"*",
"window",
"=",
"CTX_wm_window",
"(",
"C",
")",
";",
"v2dViewZoomData",
"*",
"vzd",
";",
"View2D",
"*",
"v2d",
";",
"if",
"(",
"!",
"view_zoomdrag_init",
"(",
"C",
",",
"op",
")",
")",
"{",
"return",
"OPERATOR_PASS_THROUGH",
";",
"}",
"vzd",
"=",
"op",
"->",
"customdata",
";",
"v2d",
"=",
"vzd",
"->",
"v2d",
";",
"if",
"(",
"event",
"->",
"type",
"==",
"MOUSEZOOM",
"||",
"event",
"->",
"type",
"==",
"MOUSEPAN",
")",
"{",
"float",
"dx",
",",
"dy",
",",
"fac",
";",
"vzd",
"->",
"lastx",
"=",
"event",
"->",
"prevx",
";",
"vzd",
"->",
"lasty",
"=",
"event",
"->",
"prevy",
";",
"fac",
"=",
"0.01f",
"*",
"(",
"event",
"->",
"prevx",
"-",
"event",
"->",
"x",
")",
";",
"dx",
"=",
"fac",
"*",
"BLI_rctf_size_x",
"(",
"&",
"v2d",
"->",
"cur",
")",
"/",
"10.0f",
";",
"if",
"(",
"event",
"->",
"type",
"==",
"MOUSEPAN",
")",
"{",
"fac",
"=",
"0.01f",
"*",
"(",
"event",
"->",
"prevy",
"-",
"event",
"->",
"y",
")",
";",
"}",
"dy",
"=",
"fac",
"*",
"BLI_rctf_size_y",
"(",
"&",
"v2d",
"->",
"cur",
")",
"/",
"10.0f",
";",
"if",
"(",
"v2d",
"->",
"keepzoom",
"&",
"V2D_KEEPASPECT",
")",
"{",
"if",
"(",
"fabsf",
"(",
"dx",
")",
">",
"fabsf",
"(",
"dy",
")",
")",
"{",
"dy",
"=",
"dx",
";",
"}",
"else",
"{",
"dx",
"=",
"dy",
";",
"}",
"}",
"RNA_float_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"dx",
")",
";",
"RNA_float_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"dy",
")",
";",
"view_zoomdrag_apply",
"(",
"C",
",",
"op",
")",
";",
"view_zoomdrag_exit",
"(",
"C",
",",
"op",
")",
";",
"return",
"OPERATOR_FINISHED",
";",
"}",
"vzd",
"->",
"lastx",
"=",
"event",
"->",
"x",
";",
"vzd",
"->",
"lasty",
"=",
"event",
"->",
"y",
";",
"RNA_float_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"0",
")",
";",
"RNA_float_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"0",
")",
";",
"vzd",
"->",
"invoke_event",
"=",
"event",
"->",
"type",
";",
"if",
"(",
"U",
".",
"uiflag",
"&",
"USER_ZOOM_TO_MOUSEPOS",
")",
"{",
"ARegion",
"*",
"ar",
"=",
"CTX_wm_region",
"(",
"C",
")",
";",
"UI_view2d_region_to_view",
"(",
"&",
"ar",
"->",
"v2d",
",",
"event",
"->",
"mval",
"[",
"0",
"]",
",",
"event",
"->",
"mval",
"[",
"1",
"]",
",",
"&",
"vzd",
"->",
"mx_2d",
",",
"&",
"vzd",
"->",
"my_2d",
")",
";",
"}",
"if",
"(",
"v2d",
"->",
"keepofs",
"&",
"V2D_LOCKOFS_X",
")",
"{",
"WM_cursor_modal_set",
"(",
"window",
",",
"WM_CURSOR_NS_SCROLL",
")",
";",
"}",
"else",
"if",
"(",
"v2d",
"->",
"keepofs",
"&",
"V2D_LOCKOFS_Y",
")",
"{",
"WM_cursor_modal_set",
"(",
"window",
",",
"WM_CURSOR_EW_SCROLL",
")",
";",
"}",
"else",
"{",
"WM_cursor_modal_set",
"(",
"window",
",",
"WM_CURSOR_NSEW_SCROLL",
")",
";",
"}",
"WM_event_add_modal_handler",
"(",
"C",
",",
"op",
")",
";",
"if",
"(",
"U",
".",
"viewzoom",
"==",
"USER_ZOOM_CONT",
")",
"{",
"vzd",
"->",
"timer",
"=",
"WM_event_add_timer",
"(",
"CTX_wm_manager",
"(",
"C",
")",
",",
"window",
",",
"TIMER",
",",
"0.01f",
")",
";",
"vzd",
"->",
"timer_lastdraw",
"=",
"PIL_check_seconds_timer",
"(",
")",
";",
"}",
"return",
"OPERATOR_RUNNING_MODAL",
";",
"}"
] | set up modal operator and relevant settings | [
"set",
"up",
"modal",
"operator",
"and",
"relevant",
"settings"
] | [
"/* set up customdata */",
"/* As we have only 1D information (magnify value), feed both axes\n * with magnify information that is stored in x axis\n */",
"/* support trackpad zoom to always zoom entirely - the v2d code uses portrait or\n * landscape exceptions */",
"/* set initial settings */",
"/* for modal exit test */",
"/* store initial mouse position (in view space) */",
"/* add temp handler */",
"/* needs a timer to continue redrawing */"
] | [
{
"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": []
} |
5cf7cb4e7c4695a8ac0f776020ca6c46a4a8983a | DemonRem/blender | source/blender/editors/interface/view2d_ops.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | view_zoomdrag_modal | int | static int view_zoomdrag_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
v2dViewZoomData *vzd = op->customdata;
View2D *v2d = vzd->v2d;
/* execute the events */
if (event->type == TIMER && event->customdata == vzd->timer) {
view_zoomdrag_apply(C, op);
}
else if (event->type == MOUSEMOVE) {
float dx, dy;
float zoomfac = 0.01f;
/* some view2d's (graph) don't have min/max zoom, or extreme ones */
if (v2d->maxzoom > 0.0f) {
zoomfac = clamp_f(0.001f * v2d->maxzoom, 0.001f, 0.01f);
}
/* calculate new delta transform, based on zooming mode */
if (U.viewzoom == USER_ZOOM_SCALE) {
/* 'scale' zooming */
float dist;
float len_old[2];
float len_new[2];
/* x-axis transform */
dist = BLI_rcti_size_x(&v2d->mask) / 2.0f;
len_old[0] = fabsf(vzd->lastx - vzd->ar->winrct.xmin - dist);
len_new[0] = fabsf(event->x - vzd->ar->winrct.xmin - dist);
len_old[0] *= zoomfac * BLI_rctf_size_x(&v2d->cur);
len_new[0] *= zoomfac * BLI_rctf_size_x(&v2d->cur);
/* y-axis transform */
dist = BLI_rcti_size_y(&v2d->mask) / 2.0f;
len_old[1] = fabsf(vzd->lasty - vzd->ar->winrct.ymin - dist);
len_new[1] = fabsf(event->y - vzd->ar->winrct.ymin - dist);
len_old[1] *= zoomfac * BLI_rctf_size_y(&v2d->cur);
len_new[1] *= zoomfac * BLI_rctf_size_y(&v2d->cur);
/* Calculate distance */
if (v2d->keepzoom & V2D_KEEPASPECT) {
dist = len_v2(len_new) - len_v2(len_old);
dx = dy = dist;
}
else {
dx = len_new[0] - len_old[0];
dy = len_new[1] - len_old[1];
}
}
else {
/* 'continuous' or 'dolly' */
float fac;
/* x-axis transform */
fac = zoomfac * (event->x - vzd->lastx);
dx = fac * BLI_rctf_size_x(&v2d->cur);
/* y-axis transform */
fac = zoomfac * (event->y - vzd->lasty);
dy = fac * BLI_rctf_size_y(&v2d->cur);
/* Only respect user setting zoom axis if the view does not have any zoom restrictions
* any will be scaled uniformly */
if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0 && (v2d->keepzoom & V2D_LOCKZOOM_Y) == 0 &&
(v2d->keepzoom & V2D_KEEPASPECT)) {
if (U.uiflag & USER_ZOOM_HORIZ) {
dy = 0;
}
else {
dx = 0;
}
}
}
/* support zoom to always zoom entirely - the v2d code uses portrait or
* landscape exceptions */
if (v2d->keepzoom & V2D_KEEPASPECT) {
if (fabsf(dx) > fabsf(dy)) {
dy = dx;
}
else {
dx = dy;
}
}
/* set transform amount, and add current deltas to stored total delta (for redo) */
RNA_float_set(op->ptr, "deltax", dx);
RNA_float_set(op->ptr, "deltay", dy);
vzd->dx += dx;
vzd->dy += dy;
/* Store mouse coordinates for next time, if not doing continuous zoom:
* - Continuous zoom only depends on distance of mouse
* to starting point to determine rate of change.
*/
if (U.viewzoom != USER_ZOOM_CONT) { // XXX store this setting as RNA prop?
vzd->lastx = event->x;
vzd->lasty = event->y;
}
/* apply zooming */
view_zoomdrag_apply(C, op);
}
else if (event->type == vzd->invoke_event || event->type == ESCKEY) {
if (event->val == KM_RELEASE) {
/* for redo, store the overall deltas - need to respect zoom-locks here... */
if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0) {
RNA_float_set(op->ptr, "deltax", vzd->dx);
}
else {
RNA_float_set(op->ptr, "deltax", 0);
}
if ((v2d->keepzoom & V2D_LOCKZOOM_Y) == 0) {
RNA_float_set(op->ptr, "deltay", vzd->dy);
}
else {
RNA_float_set(op->ptr, "deltay", 0);
}
/* free customdata */
view_zoomdrag_exit(C, op);
WM_cursor_modal_restore(CTX_wm_window(C));
return OPERATOR_FINISHED;
}
}
return OPERATOR_RUNNING_MODAL;
} | /* handle user input - calculations of mouse-movement need to be done here,
* not in the apply callback! */ | handle user input - calculations of mouse-movement need to be done here,
not in the apply callback! | [
"handle",
"user",
"input",
"-",
"calculations",
"of",
"mouse",
"-",
"movement",
"need",
"to",
"be",
"done",
"here",
"not",
"in",
"the",
"apply",
"callback!"
] | static int view_zoomdrag_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
v2dViewZoomData *vzd = op->customdata;
View2D *v2d = vzd->v2d;
if (event->type == TIMER && event->customdata == vzd->timer) {
view_zoomdrag_apply(C, op);
}
else if (event->type == MOUSEMOVE) {
float dx, dy;
float zoomfac = 0.01f;
if (v2d->maxzoom > 0.0f) {
zoomfac = clamp_f(0.001f * v2d->maxzoom, 0.001f, 0.01f);
}
if (U.viewzoom == USER_ZOOM_SCALE) {
float dist;
float len_old[2];
float len_new[2];
dist = BLI_rcti_size_x(&v2d->mask) / 2.0f;
len_old[0] = fabsf(vzd->lastx - vzd->ar->winrct.xmin - dist);
len_new[0] = fabsf(event->x - vzd->ar->winrct.xmin - dist);
len_old[0] *= zoomfac * BLI_rctf_size_x(&v2d->cur);
len_new[0] *= zoomfac * BLI_rctf_size_x(&v2d->cur);
dist = BLI_rcti_size_y(&v2d->mask) / 2.0f;
len_old[1] = fabsf(vzd->lasty - vzd->ar->winrct.ymin - dist);
len_new[1] = fabsf(event->y - vzd->ar->winrct.ymin - dist);
len_old[1] *= zoomfac * BLI_rctf_size_y(&v2d->cur);
len_new[1] *= zoomfac * BLI_rctf_size_y(&v2d->cur);
if (v2d->keepzoom & V2D_KEEPASPECT) {
dist = len_v2(len_new) - len_v2(len_old);
dx = dy = dist;
}
else {
dx = len_new[0] - len_old[0];
dy = len_new[1] - len_old[1];
}
}
else {
float fac;
fac = zoomfac * (event->x - vzd->lastx);
dx = fac * BLI_rctf_size_x(&v2d->cur);
fac = zoomfac * (event->y - vzd->lasty);
dy = fac * BLI_rctf_size_y(&v2d->cur);
if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0 && (v2d->keepzoom & V2D_LOCKZOOM_Y) == 0 &&
(v2d->keepzoom & V2D_KEEPASPECT)) {
if (U.uiflag & USER_ZOOM_HORIZ) {
dy = 0;
}
else {
dx = 0;
}
}
}
if (v2d->keepzoom & V2D_KEEPASPECT) {
if (fabsf(dx) > fabsf(dy)) {
dy = dx;
}
else {
dx = dy;
}
}
RNA_float_set(op->ptr, "deltax", dx);
RNA_float_set(op->ptr, "deltay", dy);
vzd->dx += dx;
vzd->dy += dy;
if (U.viewzoom != USER_ZOOM_CONT) {
vzd->lastx = event->x;
vzd->lasty = event->y;
}
view_zoomdrag_apply(C, op);
}
else if (event->type == vzd->invoke_event || event->type == ESCKEY) {
if (event->val == KM_RELEASE) {
if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0) {
RNA_float_set(op->ptr, "deltax", vzd->dx);
}
else {
RNA_float_set(op->ptr, "deltax", 0);
}
if ((v2d->keepzoom & V2D_LOCKZOOM_Y) == 0) {
RNA_float_set(op->ptr, "deltay", vzd->dy);
}
else {
RNA_float_set(op->ptr, "deltay", 0);
}
view_zoomdrag_exit(C, op);
WM_cursor_modal_restore(CTX_wm_window(C));
return OPERATOR_FINISHED;
}
}
return OPERATOR_RUNNING_MODAL;
} | [
"static",
"int",
"view_zoomdrag_modal",
"(",
"bContext",
"*",
"C",
",",
"wmOperator",
"*",
"op",
",",
"const",
"wmEvent",
"*",
"event",
")",
"{",
"v2dViewZoomData",
"*",
"vzd",
"=",
"op",
"->",
"customdata",
";",
"View2D",
"*",
"v2d",
"=",
"vzd",
"->",
"v2d",
";",
"if",
"(",
"event",
"->",
"type",
"==",
"TIMER",
"&&",
"event",
"->",
"customdata",
"==",
"vzd",
"->",
"timer",
")",
"{",
"view_zoomdrag_apply",
"(",
"C",
",",
"op",
")",
";",
"}",
"else",
"if",
"(",
"event",
"->",
"type",
"==",
"MOUSEMOVE",
")",
"{",
"float",
"dx",
",",
"dy",
";",
"float",
"zoomfac",
"=",
"0.01f",
";",
"if",
"(",
"v2d",
"->",
"maxzoom",
">",
"0.0f",
")",
"{",
"zoomfac",
"=",
"clamp_f",
"(",
"0.001f",
"*",
"v2d",
"->",
"maxzoom",
",",
"0.001f",
",",
"0.01f",
")",
";",
"}",
"if",
"(",
"U",
".",
"viewzoom",
"==",
"USER_ZOOM_SCALE",
")",
"{",
"float",
"dist",
";",
"float",
"len_old",
"[",
"2",
"]",
";",
"float",
"len_new",
"[",
"2",
"]",
";",
"dist",
"=",
"BLI_rcti_size_x",
"(",
"&",
"v2d",
"->",
"mask",
")",
"/",
"2.0f",
";",
"len_old",
"[",
"0",
"]",
"=",
"fabsf",
"(",
"vzd",
"->",
"lastx",
"-",
"vzd",
"->",
"ar",
"->",
"winrct",
".",
"xmin",
"-",
"dist",
")",
";",
"len_new",
"[",
"0",
"]",
"=",
"fabsf",
"(",
"event",
"->",
"x",
"-",
"vzd",
"->",
"ar",
"->",
"winrct",
".",
"xmin",
"-",
"dist",
")",
";",
"len_old",
"[",
"0",
"]",
"*=",
"zoomfac",
"*",
"BLI_rctf_size_x",
"(",
"&",
"v2d",
"->",
"cur",
")",
";",
"len_new",
"[",
"0",
"]",
"*=",
"zoomfac",
"*",
"BLI_rctf_size_x",
"(",
"&",
"v2d",
"->",
"cur",
")",
";",
"dist",
"=",
"BLI_rcti_size_y",
"(",
"&",
"v2d",
"->",
"mask",
")",
"/",
"2.0f",
";",
"len_old",
"[",
"1",
"]",
"=",
"fabsf",
"(",
"vzd",
"->",
"lasty",
"-",
"vzd",
"->",
"ar",
"->",
"winrct",
".",
"ymin",
"-",
"dist",
")",
";",
"len_new",
"[",
"1",
"]",
"=",
"fabsf",
"(",
"event",
"->",
"y",
"-",
"vzd",
"->",
"ar",
"->",
"winrct",
".",
"ymin",
"-",
"dist",
")",
";",
"len_old",
"[",
"1",
"]",
"*=",
"zoomfac",
"*",
"BLI_rctf_size_y",
"(",
"&",
"v2d",
"->",
"cur",
")",
";",
"len_new",
"[",
"1",
"]",
"*=",
"zoomfac",
"*",
"BLI_rctf_size_y",
"(",
"&",
"v2d",
"->",
"cur",
")",
";",
"if",
"(",
"v2d",
"->",
"keepzoom",
"&",
"V2D_KEEPASPECT",
")",
"{",
"dist",
"=",
"len_v2",
"(",
"len_new",
")",
"-",
"len_v2",
"(",
"len_old",
")",
";",
"dx",
"=",
"dy",
"=",
"dist",
";",
"}",
"else",
"{",
"dx",
"=",
"len_new",
"[",
"0",
"]",
"-",
"len_old",
"[",
"0",
"]",
";",
"dy",
"=",
"len_new",
"[",
"1",
"]",
"-",
"len_old",
"[",
"1",
"]",
";",
"}",
"}",
"else",
"{",
"float",
"fac",
";",
"fac",
"=",
"zoomfac",
"*",
"(",
"event",
"->",
"x",
"-",
"vzd",
"->",
"lastx",
")",
";",
"dx",
"=",
"fac",
"*",
"BLI_rctf_size_x",
"(",
"&",
"v2d",
"->",
"cur",
")",
";",
"fac",
"=",
"zoomfac",
"*",
"(",
"event",
"->",
"y",
"-",
"vzd",
"->",
"lasty",
")",
";",
"dy",
"=",
"fac",
"*",
"BLI_rctf_size_y",
"(",
"&",
"v2d",
"->",
"cur",
")",
";",
"if",
"(",
"(",
"v2d",
"->",
"keepzoom",
"&",
"V2D_LOCKZOOM_X",
")",
"==",
"0",
"&&",
"(",
"v2d",
"->",
"keepzoom",
"&",
"V2D_LOCKZOOM_Y",
")",
"==",
"0",
"&&",
"(",
"v2d",
"->",
"keepzoom",
"&",
"V2D_KEEPASPECT",
")",
")",
"{",
"if",
"(",
"U",
".",
"uiflag",
"&",
"USER_ZOOM_HORIZ",
")",
"{",
"dy",
"=",
"0",
";",
"}",
"else",
"{",
"dx",
"=",
"0",
";",
"}",
"}",
"}",
"if",
"(",
"v2d",
"->",
"keepzoom",
"&",
"V2D_KEEPASPECT",
")",
"{",
"if",
"(",
"fabsf",
"(",
"dx",
")",
">",
"fabsf",
"(",
"dy",
")",
")",
"{",
"dy",
"=",
"dx",
";",
"}",
"else",
"{",
"dx",
"=",
"dy",
";",
"}",
"}",
"RNA_float_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"dx",
")",
";",
"RNA_float_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"dy",
")",
";",
"vzd",
"->",
"dx",
"+=",
"dx",
";",
"vzd",
"->",
"dy",
"+=",
"dy",
";",
"if",
"(",
"U",
".",
"viewzoom",
"!=",
"USER_ZOOM_CONT",
")",
"{",
"vzd",
"->",
"lastx",
"=",
"event",
"->",
"x",
";",
"vzd",
"->",
"lasty",
"=",
"event",
"->",
"y",
";",
"}",
"view_zoomdrag_apply",
"(",
"C",
",",
"op",
")",
";",
"}",
"else",
"if",
"(",
"event",
"->",
"type",
"==",
"vzd",
"->",
"invoke_event",
"||",
"event",
"->",
"type",
"==",
"ESCKEY",
")",
"{",
"if",
"(",
"event",
"->",
"val",
"==",
"KM_RELEASE",
")",
"{",
"if",
"(",
"(",
"v2d",
"->",
"keepzoom",
"&",
"V2D_LOCKZOOM_X",
")",
"==",
"0",
")",
"{",
"RNA_float_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"vzd",
"->",
"dx",
")",
";",
"}",
"else",
"{",
"RNA_float_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"0",
")",
";",
"}",
"if",
"(",
"(",
"v2d",
"->",
"keepzoom",
"&",
"V2D_LOCKZOOM_Y",
")",
"==",
"0",
")",
"{",
"RNA_float_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"vzd",
"->",
"dy",
")",
";",
"}",
"else",
"{",
"RNA_float_set",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
",",
"0",
")",
";",
"}",
"view_zoomdrag_exit",
"(",
"C",
",",
"op",
")",
";",
"WM_cursor_modal_restore",
"(",
"CTX_wm_window",
"(",
"C",
")",
")",
";",
"return",
"OPERATOR_FINISHED",
";",
"}",
"}",
"return",
"OPERATOR_RUNNING_MODAL",
";",
"}"
] | handle user input - calculations of mouse-movement need to be done here,
not in the apply callback! | [
"handle",
"user",
"input",
"-",
"calculations",
"of",
"mouse",
"-",
"movement",
"need",
"to",
"be",
"done",
"here",
"not",
"in",
"the",
"apply",
"callback!"
] | [
"/* execute the events */",
"/* some view2d's (graph) don't have min/max zoom, or extreme ones */",
"/* calculate new delta transform, based on zooming mode */",
"/* 'scale' zooming */",
"/* x-axis transform */",
"/* y-axis transform */",
"/* Calculate distance */",
"/* 'continuous' or 'dolly' */",
"/* x-axis transform */",
"/* y-axis transform */",
"/* Only respect user setting zoom axis if the view does not have any zoom restrictions\n * any will be scaled uniformly */",
"/* support zoom to always zoom entirely - the v2d code uses portrait or\n * landscape exceptions */",
"/* set transform amount, and add current deltas to stored total delta (for redo) */",
"/* Store mouse coordinates for next time, if not doing continuous zoom:\n * - Continuous zoom only depends on distance of mouse\n * to starting point to determine rate of change.\n */",
"// XXX store this setting as RNA prop?",
"/* apply zooming */",
"/* for redo, store the overall deltas - need to respect zoom-locks here... */",
"/* free customdata */"
] | [
{
"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": []
} |
5cf7cb4e7c4695a8ac0f776020ca6c46a4a8983a | DemonRem/blender | source/blender/editors/interface/view2d_ops.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | view_borderzoom_exec | int | static int view_borderzoom_exec(bContext *C, wmOperator *op)
{
ARegion *ar = CTX_wm_region(C);
View2D *v2d = &ar->v2d;
rctf rect;
rctf cur_new = v2d->cur;
const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
/* convert coordinates of rect to 'tot' rect coordinates */
WM_operator_properties_border_to_rctf(op, &rect);
UI_view2d_region_to_view_rctf(v2d, &rect, &rect);
/* check if zooming in/out view */
const bool zoom_in = !RNA_boolean_get(op->ptr, "zoom_out");
if (zoom_in) {
/* zoom in:
* - 'cur' rect will be defined by the coordinates of the border region
* - just set the 'cur' rect to have the same coordinates as the border region
* if zoom is allowed to be changed
*/
if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0) {
cur_new.xmin = rect.xmin;
cur_new.xmax = rect.xmax;
}
if ((v2d->keepzoom & V2D_LOCKZOOM_Y) == 0) {
cur_new.ymin = rect.ymin;
cur_new.ymax = rect.ymax;
}
}
else {
/* zoom out:
* - the current 'cur' rect coordinates are going to end up where the 'rect' ones are,
* but the 'cur' rect coordinates will need to be adjusted to take in more of the view
* - calculate zoom factor, and adjust using center-point
*/
float zoom, center, size;
/* TODO: is this zoom factor calculation valid?
* It seems to produce same results every time... */
if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0) {
size = BLI_rctf_size_x(&cur_new);
zoom = size / BLI_rctf_size_x(&rect);
center = BLI_rctf_cent_x(&cur_new);
cur_new.xmin = center - (size * zoom);
cur_new.xmax = center + (size * zoom);
}
if ((v2d->keepzoom & V2D_LOCKZOOM_Y) == 0) {
size = BLI_rctf_size_y(&cur_new);
zoom = size / BLI_rctf_size_y(&rect);
center = BLI_rctf_cent_y(&cur_new);
cur_new.ymin = center - (size * zoom);
cur_new.ymax = center + (size * zoom);
}
}
UI_view2d_smooth_view(C, ar, &cur_new, smooth_viewtx);
return OPERATOR_FINISHED;
} | /**
* The user defines a rect using standard box select tools, and we use this rect to
* define the new zoom-level of the view in the following ways:
*
* -# LEFTMOUSE - zoom in to view
* -# RIGHTMOUSE - zoom out of view
*
* Currently, these key mappings are hardcoded, but it shouldn't be too important to
* have custom keymappings for this...
*/ | The user defines a rect using standard box select tools, and we use this rect to
define the new zoom-level of the view in the following ways.
-# LEFTMOUSE - zoom in to view
-# RIGHTMOUSE - zoom out of view
Currently, these key mappings are hardcoded, but it shouldn't be too important to
have custom keymappings for this | [
"The",
"user",
"defines",
"a",
"rect",
"using",
"standard",
"box",
"select",
"tools",
"and",
"we",
"use",
"this",
"rect",
"to",
"define",
"the",
"new",
"zoom",
"-",
"level",
"of",
"the",
"view",
"in",
"the",
"following",
"ways",
".",
"-",
"#",
"LEFTMOUSE",
"-",
"zoom",
"in",
"to",
"view",
"-",
"#",
"RIGHTMOUSE",
"-",
"zoom",
"out",
"of",
"view",
"Currently",
"these",
"key",
"mappings",
"are",
"hardcoded",
"but",
"it",
"shouldn",
"'",
"t",
"be",
"too",
"important",
"to",
"have",
"custom",
"keymappings",
"for",
"this"
] | static int view_borderzoom_exec(bContext *C, wmOperator *op)
{
ARegion *ar = CTX_wm_region(C);
View2D *v2d = &ar->v2d;
rctf rect;
rctf cur_new = v2d->cur;
const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
WM_operator_properties_border_to_rctf(op, &rect);
UI_view2d_region_to_view_rctf(v2d, &rect, &rect);
const bool zoom_in = !RNA_boolean_get(op->ptr, "zoom_out");
if (zoom_in) {
if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0) {
cur_new.xmin = rect.xmin;
cur_new.xmax = rect.xmax;
}
if ((v2d->keepzoom & V2D_LOCKZOOM_Y) == 0) {
cur_new.ymin = rect.ymin;
cur_new.ymax = rect.ymax;
}
}
else {
float zoom, center, size;
if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0) {
size = BLI_rctf_size_x(&cur_new);
zoom = size / BLI_rctf_size_x(&rect);
center = BLI_rctf_cent_x(&cur_new);
cur_new.xmin = center - (size * zoom);
cur_new.xmax = center + (size * zoom);
}
if ((v2d->keepzoom & V2D_LOCKZOOM_Y) == 0) {
size = BLI_rctf_size_y(&cur_new);
zoom = size / BLI_rctf_size_y(&rect);
center = BLI_rctf_cent_y(&cur_new);
cur_new.ymin = center - (size * zoom);
cur_new.ymax = center + (size * zoom);
}
}
UI_view2d_smooth_view(C, ar, &cur_new, smooth_viewtx);
return OPERATOR_FINISHED;
} | [
"static",
"int",
"view_borderzoom_exec",
"(",
"bContext",
"*",
"C",
",",
"wmOperator",
"*",
"op",
")",
"{",
"ARegion",
"*",
"ar",
"=",
"CTX_wm_region",
"(",
"C",
")",
";",
"View2D",
"*",
"v2d",
"=",
"&",
"ar",
"->",
"v2d",
";",
"rctf",
"rect",
";",
"rctf",
"cur_new",
"=",
"v2d",
"->",
"cur",
";",
"const",
"int",
"smooth_viewtx",
"=",
"WM_operator_smooth_viewtx_get",
"(",
"op",
")",
";",
"WM_operator_properties_border_to_rctf",
"(",
"op",
",",
"&",
"rect",
")",
";",
"UI_view2d_region_to_view_rctf",
"(",
"v2d",
",",
"&",
"rect",
",",
"&",
"rect",
")",
";",
"const",
"bool",
"zoom_in",
"=",
"!",
"RNA_boolean_get",
"(",
"op",
"->",
"ptr",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"zoom_in",
")",
"{",
"if",
"(",
"(",
"v2d",
"->",
"keepzoom",
"&",
"V2D_LOCKZOOM_X",
")",
"==",
"0",
")",
"{",
"cur_new",
".",
"xmin",
"=",
"rect",
".",
"xmin",
";",
"cur_new",
".",
"xmax",
"=",
"rect",
".",
"xmax",
";",
"}",
"if",
"(",
"(",
"v2d",
"->",
"keepzoom",
"&",
"V2D_LOCKZOOM_Y",
")",
"==",
"0",
")",
"{",
"cur_new",
".",
"ymin",
"=",
"rect",
".",
"ymin",
";",
"cur_new",
".",
"ymax",
"=",
"rect",
".",
"ymax",
";",
"}",
"}",
"else",
"{",
"float",
"zoom",
",",
"center",
",",
"size",
";",
"if",
"(",
"(",
"v2d",
"->",
"keepzoom",
"&",
"V2D_LOCKZOOM_X",
")",
"==",
"0",
")",
"{",
"size",
"=",
"BLI_rctf_size_x",
"(",
"&",
"cur_new",
")",
";",
"zoom",
"=",
"size",
"/",
"BLI_rctf_size_x",
"(",
"&",
"rect",
")",
";",
"center",
"=",
"BLI_rctf_cent_x",
"(",
"&",
"cur_new",
")",
";",
"cur_new",
".",
"xmin",
"=",
"center",
"-",
"(",
"size",
"*",
"zoom",
")",
";",
"cur_new",
".",
"xmax",
"=",
"center",
"+",
"(",
"size",
"*",
"zoom",
")",
";",
"}",
"if",
"(",
"(",
"v2d",
"->",
"keepzoom",
"&",
"V2D_LOCKZOOM_Y",
")",
"==",
"0",
")",
"{",
"size",
"=",
"BLI_rctf_size_y",
"(",
"&",
"cur_new",
")",
";",
"zoom",
"=",
"size",
"/",
"BLI_rctf_size_y",
"(",
"&",
"rect",
")",
";",
"center",
"=",
"BLI_rctf_cent_y",
"(",
"&",
"cur_new",
")",
";",
"cur_new",
".",
"ymin",
"=",
"center",
"-",
"(",
"size",
"*",
"zoom",
")",
";",
"cur_new",
".",
"ymax",
"=",
"center",
"+",
"(",
"size",
"*",
"zoom",
")",
";",
"}",
"}",
"UI_view2d_smooth_view",
"(",
"C",
",",
"ar",
",",
"&",
"cur_new",
",",
"smooth_viewtx",
")",
";",
"return",
"OPERATOR_FINISHED",
";",
"}"
] | The user defines a rect using standard box select tools, and we use this rect to
define the new zoom-level of the view in the following ways: | [
"The",
"user",
"defines",
"a",
"rect",
"using",
"standard",
"box",
"select",
"tools",
"and",
"we",
"use",
"this",
"rect",
"to",
"define",
"the",
"new",
"zoom",
"-",
"level",
"of",
"the",
"view",
"in",
"the",
"following",
"ways",
":"
] | [
"/* convert coordinates of rect to 'tot' rect coordinates */",
"/* check if zooming in/out view */",
"/* zoom in:\n * - 'cur' rect will be defined by the coordinates of the border region\n * - just set the 'cur' rect to have the same coordinates as the border region\n * if zoom is allowed to be changed\n */",
"/* zoom out:\n * - the current 'cur' rect coordinates are going to end up where the 'rect' ones are,\n * but the 'cur' rect coordinates will need to be adjusted to take in more of the view\n * - calculate zoom factor, and adjust using center-point\n */",
"/* TODO: is this zoom factor calculation valid?\n * It seems to produce same results every time... */"
] | [
{
"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": []
} |
5cf7cb4e7c4695a8ac0f776020ca6c46a4a8983a | DemonRem/blender | source/blender/editors/interface/view2d_ops.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | smooth_view_rect_to_fac | float | static float smooth_view_rect_to_fac(const rctf *rect_a, const rctf *rect_b)
{
const float size_a[2] = {BLI_rctf_size_x(rect_a), BLI_rctf_size_y(rect_a)};
const float size_b[2] = {BLI_rctf_size_x(rect_b), BLI_rctf_size_y(rect_b)};
const float cent_a[2] = {BLI_rctf_cent_x(rect_a), BLI_rctf_cent_y(rect_a)};
const float cent_b[2] = {BLI_rctf_cent_x(rect_b), BLI_rctf_cent_y(rect_b)};
float fac_max = 0.0f;
float tfac;
int i;
for (i = 0; i < 2; i++) {
/* axis translation normalized to scale */
tfac = fabsf(cent_a[i] - cent_b[i]) / min_ff(size_a[i], size_b[i]);
fac_max = max_ff(fac_max, tfac);
if (fac_max >= 1.0f) {
break;
}
/* axis scale difference, x2 so doubling or half gives 1.0f */
tfac = (1.0f - (min_ff(size_a[i], size_b[i]) / max_ff(size_a[i], size_b[i]))) * 2.0f;
fac_max = max_ff(fac_max, tfac);
if (fac_max >= 1.0f) {
break;
}
}
return min_ff(fac_max, 1.0f);
} | /**
* function to get a factor out of a rectangle
*
* note: this doesn't always work as well as it might because the target size
* may not be reached because of clamping the desired rect, we _could_
* attempt to clamp the rect before working out the zoom factor but its
* not really worthwhile for the few cases this happens.
*/ | function to get a factor out of a rectangle
note: this doesn't always work as well as it might because the target size
may not be reached because of clamping the desired rect, we _could_
attempt to clamp the rect before working out the zoom factor but its
not really worthwhile for the few cases this happens. | [
"function",
"to",
"get",
"a",
"factor",
"out",
"of",
"a",
"rectangle",
"note",
":",
"this",
"doesn",
"'",
"t",
"always",
"work",
"as",
"well",
"as",
"it",
"might",
"because",
"the",
"target",
"size",
"may",
"not",
"be",
"reached",
"because",
"of",
"clamping",
"the",
"desired",
"rect",
"we",
"_could_",
"attempt",
"to",
"clamp",
"the",
"rect",
"before",
"working",
"out",
"the",
"zoom",
"factor",
"but",
"its",
"not",
"really",
"worthwhile",
"for",
"the",
"few",
"cases",
"this",
"happens",
"."
] | static float smooth_view_rect_to_fac(const rctf *rect_a, const rctf *rect_b)
{
const float size_a[2] = {BLI_rctf_size_x(rect_a), BLI_rctf_size_y(rect_a)};
const float size_b[2] = {BLI_rctf_size_x(rect_b), BLI_rctf_size_y(rect_b)};
const float cent_a[2] = {BLI_rctf_cent_x(rect_a), BLI_rctf_cent_y(rect_a)};
const float cent_b[2] = {BLI_rctf_cent_x(rect_b), BLI_rctf_cent_y(rect_b)};
float fac_max = 0.0f;
float tfac;
int i;
for (i = 0; i < 2; i++) {
tfac = fabsf(cent_a[i] - cent_b[i]) / min_ff(size_a[i], size_b[i]);
fac_max = max_ff(fac_max, tfac);
if (fac_max >= 1.0f) {
break;
}
tfac = (1.0f - (min_ff(size_a[i], size_b[i]) / max_ff(size_a[i], size_b[i]))) * 2.0f;
fac_max = max_ff(fac_max, tfac);
if (fac_max >= 1.0f) {
break;
}
}
return min_ff(fac_max, 1.0f);
} | [
"static",
"float",
"smooth_view_rect_to_fac",
"(",
"const",
"rctf",
"*",
"rect_a",
",",
"const",
"rctf",
"*",
"rect_b",
")",
"{",
"const",
"float",
"size_a",
"[",
"2",
"]",
"=",
"{",
"BLI_rctf_size_x",
"(",
"rect_a",
")",
",",
"BLI_rctf_size_y",
"(",
"rect_a",
")",
"}",
";",
"const",
"float",
"size_b",
"[",
"2",
"]",
"=",
"{",
"BLI_rctf_size_x",
"(",
"rect_b",
")",
",",
"BLI_rctf_size_y",
"(",
"rect_b",
")",
"}",
";",
"const",
"float",
"cent_a",
"[",
"2",
"]",
"=",
"{",
"BLI_rctf_cent_x",
"(",
"rect_a",
")",
",",
"BLI_rctf_cent_y",
"(",
"rect_a",
")",
"}",
";",
"const",
"float",
"cent_b",
"[",
"2",
"]",
"=",
"{",
"BLI_rctf_cent_x",
"(",
"rect_b",
")",
",",
"BLI_rctf_cent_y",
"(",
"rect_b",
")",
"}",
";",
"float",
"fac_max",
"=",
"0.0f",
";",
"float",
"tfac",
";",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"2",
";",
"i",
"++",
")",
"{",
"tfac",
"=",
"fabsf",
"(",
"cent_a",
"[",
"i",
"]",
"-",
"cent_b",
"[",
"i",
"]",
")",
"/",
"min_ff",
"(",
"size_a",
"[",
"i",
"]",
",",
"size_b",
"[",
"i",
"]",
")",
";",
"fac_max",
"=",
"max_ff",
"(",
"fac_max",
",",
"tfac",
")",
";",
"if",
"(",
"fac_max",
">=",
"1.0f",
")",
"{",
"break",
";",
"}",
"tfac",
"=",
"(",
"1.0f",
"-",
"(",
"min_ff",
"(",
"size_a",
"[",
"i",
"]",
",",
"size_b",
"[",
"i",
"]",
")",
"/",
"max_ff",
"(",
"size_a",
"[",
"i",
"]",
",",
"size_b",
"[",
"i",
"]",
")",
")",
")",
"*",
"2.0f",
";",
"fac_max",
"=",
"max_ff",
"(",
"fac_max",
",",
"tfac",
")",
";",
"if",
"(",
"fac_max",
">=",
"1.0f",
")",
"{",
"break",
";",
"}",
"}",
"return",
"min_ff",
"(",
"fac_max",
",",
"1.0f",
")",
";",
"}"
] | function to get a factor out of a rectangle
note: this doesn't always work as well as it might because the target size
may not be reached because of clamping the desired rect, we _could_
attempt to clamp the rect before working out the zoom factor but its
not really worthwhile for the few cases this happens. | [
"function",
"to",
"get",
"a",
"factor",
"out",
"of",
"a",
"rectangle",
"note",
":",
"this",
"doesn",
"'",
"t",
"always",
"work",
"as",
"well",
"as",
"it",
"might",
"because",
"the",
"target",
"size",
"may",
"not",
"be",
"reached",
"because",
"of",
"clamping",
"the",
"desired",
"rect",
"we",
"_could_",
"attempt",
"to",
"clamp",
"the",
"rect",
"before",
"working",
"out",
"the",
"zoom",
"factor",
"but",
"its",
"not",
"really",
"worthwhile",
"for",
"the",
"few",
"cases",
"this",
"happens",
"."
] | [
"/* axis translation normalized to scale */",
"/* axis scale difference, x2 so doubling or half gives 1.0f */"
] | [
{
"param": "rect_a",
"type": "rctf"
},
{
"param": "rect_b",
"type": "rctf"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "rect_a",
"type": "rctf",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rect_b",
"type": "rctf",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5cf7cb4e7c4695a8ac0f776020ca6c46a4a8983a | DemonRem/blender | source/blender/editors/interface/view2d_ops.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | UI_view2d_smooth_view | void | void UI_view2d_smooth_view(bContext *C, ARegion *ar, const rctf *cur, const int smooth_viewtx)
{
wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *win = CTX_wm_window(C);
View2D *v2d = &ar->v2d;
struct SmoothView2DStore sms = {{0}};
bool ok = false;
float fac = 1.0f;
/* initialize sms */
sms.new_cur = v2d->cur;
/* store the options we want to end with */
if (cur) {
sms.new_cur = *cur;
}
if (cur) {
fac = smooth_view_rect_to_fac(&v2d->cur, cur);
}
if (smooth_viewtx && fac > FLT_EPSILON) {
bool changed = false;
if (BLI_rctf_compare(&sms.new_cur, &v2d->cur, FLT_EPSILON) == false) {
changed = true;
}
/* The new view is different from the old one
* so animate the view */
if (changed) {
sms.orig_cur = v2d->cur;
sms.time_allowed = (double)smooth_viewtx / 1000.0;
/* scale the time allowed the change in view */
sms.time_allowed *= (double)fac;
/* keep track of running timer! */
if (v2d->sms == NULL) {
v2d->sms = MEM_mallocN(sizeof(struct SmoothView2DStore), "smoothview v2d");
}
*v2d->sms = sms;
if (v2d->smooth_timer) {
WM_event_remove_timer(wm, win, v2d->smooth_timer);
}
/* TIMER1 is hardcoded in keymap */
/* max 30 frs/sec */
v2d->smooth_timer = WM_event_add_timer(wm, win, TIMER1, 1.0 / 100.0);
ok = true;
}
}
/* if we get here nothing happens */
if (ok == false) {
v2d->cur = sms.new_cur;
UI_view2d_curRect_validate(v2d);
ED_region_tag_redraw_no_rebuild(ar);
UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
}
} | /* will start timer if appropriate */
/* the arguments are the desired situation */ | will start timer if appropriate
the arguments are the desired situation | [
"will",
"start",
"timer",
"if",
"appropriate",
"the",
"arguments",
"are",
"the",
"desired",
"situation"
] | void UI_view2d_smooth_view(bContext *C, ARegion *ar, const rctf *cur, const int smooth_viewtx)
{
wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *win = CTX_wm_window(C);
View2D *v2d = &ar->v2d;
struct SmoothView2DStore sms = {{0}};
bool ok = false;
float fac = 1.0f;
sms.new_cur = v2d->cur;
if (cur) {
sms.new_cur = *cur;
}
if (cur) {
fac = smooth_view_rect_to_fac(&v2d->cur, cur);
}
if (smooth_viewtx && fac > FLT_EPSILON) {
bool changed = false;
if (BLI_rctf_compare(&sms.new_cur, &v2d->cur, FLT_EPSILON) == false) {
changed = true;
}
if (changed) {
sms.orig_cur = v2d->cur;
sms.time_allowed = (double)smooth_viewtx / 1000.0;
sms.time_allowed *= (double)fac;
if (v2d->sms == NULL) {
v2d->sms = MEM_mallocN(sizeof(struct SmoothView2DStore), "smoothview v2d");
}
*v2d->sms = sms;
if (v2d->smooth_timer) {
WM_event_remove_timer(wm, win, v2d->smooth_timer);
}
v2d->smooth_timer = WM_event_add_timer(wm, win, TIMER1, 1.0 / 100.0);
ok = true;
}
}
if (ok == false) {
v2d->cur = sms.new_cur;
UI_view2d_curRect_validate(v2d);
ED_region_tag_redraw_no_rebuild(ar);
UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
}
} | [
"void",
"UI_view2d_smooth_view",
"(",
"bContext",
"*",
"C",
",",
"ARegion",
"*",
"ar",
",",
"const",
"rctf",
"*",
"cur",
",",
"const",
"int",
"smooth_viewtx",
")",
"{",
"wmWindowManager",
"*",
"wm",
"=",
"CTX_wm_manager",
"(",
"C",
")",
";",
"wmWindow",
"*",
"win",
"=",
"CTX_wm_window",
"(",
"C",
")",
";",
"View2D",
"*",
"v2d",
"=",
"&",
"ar",
"->",
"v2d",
";",
"struct",
"SmoothView2DStore",
"sms",
"=",
"{",
"{",
"0",
"}",
"}",
";",
"bool",
"ok",
"=",
"false",
";",
"float",
"fac",
"=",
"1.0f",
";",
"sms",
".",
"new_cur",
"=",
"v2d",
"->",
"cur",
";",
"if",
"(",
"cur",
")",
"{",
"sms",
".",
"new_cur",
"=",
"*",
"cur",
";",
"}",
"if",
"(",
"cur",
")",
"{",
"fac",
"=",
"smooth_view_rect_to_fac",
"(",
"&",
"v2d",
"->",
"cur",
",",
"cur",
")",
";",
"}",
"if",
"(",
"smooth_viewtx",
"&&",
"fac",
">",
"FLT_EPSILON",
")",
"{",
"bool",
"changed",
"=",
"false",
";",
"if",
"(",
"BLI_rctf_compare",
"(",
"&",
"sms",
".",
"new_cur",
",",
"&",
"v2d",
"->",
"cur",
",",
"FLT_EPSILON",
")",
"==",
"false",
")",
"{",
"changed",
"=",
"true",
";",
"}",
"if",
"(",
"changed",
")",
"{",
"sms",
".",
"orig_cur",
"=",
"v2d",
"->",
"cur",
";",
"sms",
".",
"time_allowed",
"=",
"(",
"double",
")",
"smooth_viewtx",
"/",
"1000.0",
";",
"sms",
".",
"time_allowed",
"*=",
"(",
"double",
")",
"fac",
";",
"if",
"(",
"v2d",
"->",
"sms",
"==",
"NULL",
")",
"{",
"v2d",
"->",
"sms",
"=",
"MEM_mallocN",
"(",
"sizeof",
"(",
"struct",
"SmoothView2DStore",
")",
",",
"\"",
"\"",
")",
";",
"}",
"*",
"v2d",
"->",
"sms",
"=",
"sms",
";",
"if",
"(",
"v2d",
"->",
"smooth_timer",
")",
"{",
"WM_event_remove_timer",
"(",
"wm",
",",
"win",
",",
"v2d",
"->",
"smooth_timer",
")",
";",
"}",
"v2d",
"->",
"smooth_timer",
"=",
"WM_event_add_timer",
"(",
"wm",
",",
"win",
",",
"TIMER1",
",",
"1.0",
"/",
"100.0",
")",
";",
"ok",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"ok",
"==",
"false",
")",
"{",
"v2d",
"->",
"cur",
"=",
"sms",
".",
"new_cur",
";",
"UI_view2d_curRect_validate",
"(",
"v2d",
")",
";",
"ED_region_tag_redraw_no_rebuild",
"(",
"ar",
")",
";",
"UI_view2d_sync",
"(",
"CTX_wm_screen",
"(",
"C",
")",
",",
"CTX_wm_area",
"(",
"C",
")",
",",
"v2d",
",",
"V2D_LOCK_COPY",
")",
";",
"}",
"}"
] | will start timer if appropriate
the arguments are the desired situation | [
"will",
"start",
"timer",
"if",
"appropriate",
"the",
"arguments",
"are",
"the",
"desired",
"situation"
] | [
"/* initialize sms */",
"/* store the options we want to end with */",
"/* The new view is different from the old one\n * so animate the view */",
"/* scale the time allowed the change in view */",
"/* keep track of running timer! */",
"/* TIMER1 is hardcoded in keymap */",
"/* max 30 frs/sec */",
"/* if we get here nothing happens */"
] | [
{
"param": "C",
"type": "bContext"
},
{
"param": "ar",
"type": "ARegion"
},
{
"param": "cur",
"type": "rctf"
},
{
"param": "smooth_viewtx",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ar",
"type": "ARegion",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cur",
"type": "rctf",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "smooth_viewtx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5cf7cb4e7c4695a8ac0f776020ca6c46a4a8983a | DemonRem/blender | source/blender/editors/interface/view2d_ops.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | scroller_activate_init | void | static void scroller_activate_init(bContext *C,
wmOperator *op,
const wmEvent *event,
const char in_scroller)
{
v2dScrollerMove *vsm;
View2DScrollers *scrollers;
ARegion *ar = CTX_wm_region(C);
View2D *v2d = &ar->v2d;
rctf tot_cur_union;
float mask_size;
/* set custom-data for operator */
vsm = MEM_callocN(sizeof(v2dScrollerMove), "v2dScrollerMove");
op->customdata = vsm;
/* set general data */
vsm->v2d = v2d;
vsm->ar = ar;
vsm->scroller = in_scroller;
/* store mouse-coordinates, and convert mouse/screen coordinates to region coordinates */
vsm->lastx = event->x;
vsm->lasty = event->y;
/* 'zone' depends on where mouse is relative to bubble
* - zooming must be allowed on this axis, otherwise, default to pan
*/
scrollers = UI_view2d_scrollers_calc(v2d, NULL);
/* Use a union of 'cur' & 'tot' in case the current view is far outside 'tot'. In this cases
* moving the scroll bars has far too little effect and the view can get stuck T31476. */
tot_cur_union = v2d->tot;
BLI_rctf_union(&tot_cur_union, &v2d->cur);
if (in_scroller == 'h') {
/* horizontal scroller - calculate adjustment factor first */
mask_size = (float)BLI_rcti_size_x(&v2d->hor);
vsm->fac = BLI_rctf_size_x(&tot_cur_union) / mask_size;
/* pixel rounding */
vsm->fac_round = (BLI_rctf_size_x(&v2d->cur)) / (float)(BLI_rcti_size_x(&ar->winrct) + 1);
/* get 'zone' (i.e. which part of scroller is activated) */
vsm->zone = mouse_in_scroller_handle(
event->mval[0], v2d->hor.xmin, v2d->hor.xmax, scrollers->hor_min, scrollers->hor_max);
if ((v2d->keepzoom & V2D_LOCKZOOM_X) && ELEM(vsm->zone, SCROLLHANDLE_MIN, SCROLLHANDLE_MAX)) {
/* default to scroll, as handles not usable */
vsm->zone = SCROLLHANDLE_BAR;
}
vsm->scrollbarwidth = scrollers->hor_max - scrollers->hor_min;
vsm->scrollbar_orig = ((scrollers->hor_max + scrollers->hor_min) / 2) + ar->winrct.xmin;
}
else {
/* vertical scroller - calculate adjustment factor first */
mask_size = (float)BLI_rcti_size_y(&v2d->vert);
vsm->fac = BLI_rctf_size_y(&tot_cur_union) / mask_size;
/* pixel rounding */
vsm->fac_round = (BLI_rctf_size_y(&v2d->cur)) / (float)(BLI_rcti_size_y(&ar->winrct) + 1);
/* get 'zone' (i.e. which part of scroller is activated) */
vsm->zone = mouse_in_scroller_handle(
event->mval[1], v2d->vert.ymin, v2d->vert.ymax, scrollers->vert_min, scrollers->vert_max);
if ((v2d->keepzoom & V2D_LOCKZOOM_Y) && ELEM(vsm->zone, SCROLLHANDLE_MIN, SCROLLHANDLE_MAX)) {
/* default to scroll, as handles not usable */
vsm->zone = SCROLLHANDLE_BAR;
}
vsm->scrollbarwidth = scrollers->vert_max - scrollers->vert_min;
vsm->scrollbar_orig = ((scrollers->vert_max + scrollers->vert_min) / 2) + ar->winrct.ymin;
}
UI_view2d_scrollers_free(scrollers);
ED_region_tag_redraw_no_rebuild(ar);
} | /* initialize customdata for scroller manipulation operator */ | initialize customdata for scroller manipulation operator | [
"initialize",
"customdata",
"for",
"scroller",
"manipulation",
"operator"
] | static void scroller_activate_init(bContext *C,
wmOperator *op,
const wmEvent *event,
const char in_scroller)
{
v2dScrollerMove *vsm;
View2DScrollers *scrollers;
ARegion *ar = CTX_wm_region(C);
View2D *v2d = &ar->v2d;
rctf tot_cur_union;
float mask_size;
vsm = MEM_callocN(sizeof(v2dScrollerMove), "v2dScrollerMove");
op->customdata = vsm;
vsm->v2d = v2d;
vsm->ar = ar;
vsm->scroller = in_scroller;
vsm->lastx = event->x;
vsm->lasty = event->y;
scrollers = UI_view2d_scrollers_calc(v2d, NULL);
tot_cur_union = v2d->tot;
BLI_rctf_union(&tot_cur_union, &v2d->cur);
if (in_scroller == 'h') {
mask_size = (float)BLI_rcti_size_x(&v2d->hor);
vsm->fac = BLI_rctf_size_x(&tot_cur_union) / mask_size;
vsm->fac_round = (BLI_rctf_size_x(&v2d->cur)) / (float)(BLI_rcti_size_x(&ar->winrct) + 1);
vsm->zone = mouse_in_scroller_handle(
event->mval[0], v2d->hor.xmin, v2d->hor.xmax, scrollers->hor_min, scrollers->hor_max);
if ((v2d->keepzoom & V2D_LOCKZOOM_X) && ELEM(vsm->zone, SCROLLHANDLE_MIN, SCROLLHANDLE_MAX)) {
vsm->zone = SCROLLHANDLE_BAR;
}
vsm->scrollbarwidth = scrollers->hor_max - scrollers->hor_min;
vsm->scrollbar_orig = ((scrollers->hor_max + scrollers->hor_min) / 2) + ar->winrct.xmin;
}
else {
mask_size = (float)BLI_rcti_size_y(&v2d->vert);
vsm->fac = BLI_rctf_size_y(&tot_cur_union) / mask_size;
vsm->fac_round = (BLI_rctf_size_y(&v2d->cur)) / (float)(BLI_rcti_size_y(&ar->winrct) + 1);
vsm->zone = mouse_in_scroller_handle(
event->mval[1], v2d->vert.ymin, v2d->vert.ymax, scrollers->vert_min, scrollers->vert_max);
if ((v2d->keepzoom & V2D_LOCKZOOM_Y) && ELEM(vsm->zone, SCROLLHANDLE_MIN, SCROLLHANDLE_MAX)) {
vsm->zone = SCROLLHANDLE_BAR;
}
vsm->scrollbarwidth = scrollers->vert_max - scrollers->vert_min;
vsm->scrollbar_orig = ((scrollers->vert_max + scrollers->vert_min) / 2) + ar->winrct.ymin;
}
UI_view2d_scrollers_free(scrollers);
ED_region_tag_redraw_no_rebuild(ar);
} | [
"static",
"void",
"scroller_activate_init",
"(",
"bContext",
"*",
"C",
",",
"wmOperator",
"*",
"op",
",",
"const",
"wmEvent",
"*",
"event",
",",
"const",
"char",
"in_scroller",
")",
"{",
"v2dScrollerMove",
"*",
"vsm",
";",
"View2DScrollers",
"*",
"scrollers",
";",
"ARegion",
"*",
"ar",
"=",
"CTX_wm_region",
"(",
"C",
")",
";",
"View2D",
"*",
"v2d",
"=",
"&",
"ar",
"->",
"v2d",
";",
"rctf",
"tot_cur_union",
";",
"float",
"mask_size",
";",
"vsm",
"=",
"MEM_callocN",
"(",
"sizeof",
"(",
"v2dScrollerMove",
")",
",",
"\"",
"\"",
")",
";",
"op",
"->",
"customdata",
"=",
"vsm",
";",
"vsm",
"->",
"v2d",
"=",
"v2d",
";",
"vsm",
"->",
"ar",
"=",
"ar",
";",
"vsm",
"->",
"scroller",
"=",
"in_scroller",
";",
"vsm",
"->",
"lastx",
"=",
"event",
"->",
"x",
";",
"vsm",
"->",
"lasty",
"=",
"event",
"->",
"y",
";",
"scrollers",
"=",
"UI_view2d_scrollers_calc",
"(",
"v2d",
",",
"NULL",
")",
";",
"tot_cur_union",
"=",
"v2d",
"->",
"tot",
";",
"BLI_rctf_union",
"(",
"&",
"tot_cur_union",
",",
"&",
"v2d",
"->",
"cur",
")",
";",
"if",
"(",
"in_scroller",
"==",
"'",
"'",
")",
"{",
"mask_size",
"=",
"(",
"float",
")",
"BLI_rcti_size_x",
"(",
"&",
"v2d",
"->",
"hor",
")",
";",
"vsm",
"->",
"fac",
"=",
"BLI_rctf_size_x",
"(",
"&",
"tot_cur_union",
")",
"/",
"mask_size",
";",
"vsm",
"->",
"fac_round",
"=",
"(",
"BLI_rctf_size_x",
"(",
"&",
"v2d",
"->",
"cur",
")",
")",
"/",
"(",
"float",
")",
"(",
"BLI_rcti_size_x",
"(",
"&",
"ar",
"->",
"winrct",
")",
"+",
"1",
")",
";",
"vsm",
"->",
"zone",
"=",
"mouse_in_scroller_handle",
"(",
"event",
"->",
"mval",
"[",
"0",
"]",
",",
"v2d",
"->",
"hor",
".",
"xmin",
",",
"v2d",
"->",
"hor",
".",
"xmax",
",",
"scrollers",
"->",
"hor_min",
",",
"scrollers",
"->",
"hor_max",
")",
";",
"if",
"(",
"(",
"v2d",
"->",
"keepzoom",
"&",
"V2D_LOCKZOOM_X",
")",
"&&",
"ELEM",
"(",
"vsm",
"->",
"zone",
",",
"SCROLLHANDLE_MIN",
",",
"SCROLLHANDLE_MAX",
")",
")",
"{",
"vsm",
"->",
"zone",
"=",
"SCROLLHANDLE_BAR",
";",
"}",
"vsm",
"->",
"scrollbarwidth",
"=",
"scrollers",
"->",
"hor_max",
"-",
"scrollers",
"->",
"hor_min",
";",
"vsm",
"->",
"scrollbar_orig",
"=",
"(",
"(",
"scrollers",
"->",
"hor_max",
"+",
"scrollers",
"->",
"hor_min",
")",
"/",
"2",
")",
"+",
"ar",
"->",
"winrct",
".",
"xmin",
";",
"}",
"else",
"{",
"mask_size",
"=",
"(",
"float",
")",
"BLI_rcti_size_y",
"(",
"&",
"v2d",
"->",
"vert",
")",
";",
"vsm",
"->",
"fac",
"=",
"BLI_rctf_size_y",
"(",
"&",
"tot_cur_union",
")",
"/",
"mask_size",
";",
"vsm",
"->",
"fac_round",
"=",
"(",
"BLI_rctf_size_y",
"(",
"&",
"v2d",
"->",
"cur",
")",
")",
"/",
"(",
"float",
")",
"(",
"BLI_rcti_size_y",
"(",
"&",
"ar",
"->",
"winrct",
")",
"+",
"1",
")",
";",
"vsm",
"->",
"zone",
"=",
"mouse_in_scroller_handle",
"(",
"event",
"->",
"mval",
"[",
"1",
"]",
",",
"v2d",
"->",
"vert",
".",
"ymin",
",",
"v2d",
"->",
"vert",
".",
"ymax",
",",
"scrollers",
"->",
"vert_min",
",",
"scrollers",
"->",
"vert_max",
")",
";",
"if",
"(",
"(",
"v2d",
"->",
"keepzoom",
"&",
"V2D_LOCKZOOM_Y",
")",
"&&",
"ELEM",
"(",
"vsm",
"->",
"zone",
",",
"SCROLLHANDLE_MIN",
",",
"SCROLLHANDLE_MAX",
")",
")",
"{",
"vsm",
"->",
"zone",
"=",
"SCROLLHANDLE_BAR",
";",
"}",
"vsm",
"->",
"scrollbarwidth",
"=",
"scrollers",
"->",
"vert_max",
"-",
"scrollers",
"->",
"vert_min",
";",
"vsm",
"->",
"scrollbar_orig",
"=",
"(",
"(",
"scrollers",
"->",
"vert_max",
"+",
"scrollers",
"->",
"vert_min",
")",
"/",
"2",
")",
"+",
"ar",
"->",
"winrct",
".",
"ymin",
";",
"}",
"UI_view2d_scrollers_free",
"(",
"scrollers",
")",
";",
"ED_region_tag_redraw_no_rebuild",
"(",
"ar",
")",
";",
"}"
] | initialize customdata for scroller manipulation operator | [
"initialize",
"customdata",
"for",
"scroller",
"manipulation",
"operator"
] | [
"/* set custom-data for operator */",
"/* set general data */",
"/* store mouse-coordinates, and convert mouse/screen coordinates to region coordinates */",
"/* 'zone' depends on where mouse is relative to bubble\n * - zooming must be allowed on this axis, otherwise, default to pan\n */",
"/* Use a union of 'cur' & 'tot' in case the current view is far outside 'tot'. In this cases\n * moving the scroll bars has far too little effect and the view can get stuck T31476. */",
"/* horizontal scroller - calculate adjustment factor first */",
"/* pixel rounding */",
"/* get 'zone' (i.e. which part of scroller is activated) */",
"/* default to scroll, as handles not usable */",
"/* vertical scroller - calculate adjustment factor first */",
"/* pixel rounding */",
"/* get 'zone' (i.e. which part of scroller is activated) */",
"/* default to scroll, as handles not usable */"
] | [
{
"param": "C",
"type": "bContext"
},
{
"param": "op",
"type": "wmOperator"
},
{
"param": "event",
"type": "wmEvent"
},
{
"param": "in_scroller",
"type": "char"
}
] | {
"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
},
{
"identifier": "in_scroller",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5cf7cb4e7c4695a8ac0f776020ca6c46a4a8983a | DemonRem/blender | source/blender/editors/interface/view2d_ops.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | scroller_activate_modal | int | static int scroller_activate_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
v2dScrollerMove *vsm = op->customdata;
/* execute the events */
switch (event->type) {
case MOUSEMOVE: {
/* calculate new delta transform, then store mouse-coordinates for next-time */
if (ELEM(vsm->zone, SCROLLHANDLE_BAR, SCROLLHANDLE_MAX)) {
/* if using bar (i.e. 'panning') or 'max' zoom widget */
switch (vsm->scroller) {
case 'h': /* horizontal scroller - so only horizontal movement
* ('cur' moves opposite to mouse) */
vsm->delta = (float)(event->x - vsm->lastx);
break;
case 'v': /* vertical scroller - so only vertical movement
* ('cur' moves opposite to mouse) */
vsm->delta = (float)(event->y - vsm->lasty);
break;
}
}
else if (vsm->zone == SCROLLHANDLE_MIN) {
/* using 'min' zoom widget */
switch (vsm->scroller) {
case 'h': /* horizontal scroller - so only horizontal movement
* ('cur' moves with mouse) */
vsm->delta = (float)(vsm->lastx - event->x);
break;
case 'v': /* vertical scroller - so only vertical movement
* ('cur' moves with to mouse) */
vsm->delta = (float)(vsm->lasty - event->y);
break;
}
}
/* store previous coordinates */
vsm->lastx = event->x;
vsm->lasty = event->y;
scroller_activate_apply(C, op);
break;
}
case LEFTMOUSE:
case MIDDLEMOUSE:
if (event->val == KM_RELEASE) {
/* single-click was in empty space outside bubble, so scroll by 1 'page' */
if (ELEM(vsm->zone, SCROLLHANDLE_MIN_OUTSIDE, SCROLLHANDLE_MAX_OUTSIDE)) {
if (vsm->zone == SCROLLHANDLE_MIN_OUTSIDE) {
vsm->delta = -vsm->scrollbarwidth * 0.8f;
}
else if (vsm->zone == SCROLLHANDLE_MAX_OUTSIDE) {
vsm->delta = vsm->scrollbarwidth * 0.8f;
}
scroller_activate_apply(C, op);
scroller_activate_exit(C, op);
return OPERATOR_FINISHED;
}
/* otherwise, end the drag action */
if (vsm->lastx || vsm->lasty) {
scroller_activate_exit(C, op);
return OPERATOR_FINISHED;
}
}
break;
}
return OPERATOR_RUNNING_MODAL;
} | /**
* Handle user input for scrollers - calculations of mouse-movement need to be done here,
* not in the apply callback!
*/ | Handle user input for scrollers - calculations of mouse-movement need to be done here,
not in the apply callback! | [
"Handle",
"user",
"input",
"for",
"scrollers",
"-",
"calculations",
"of",
"mouse",
"-",
"movement",
"need",
"to",
"be",
"done",
"here",
"not",
"in",
"the",
"apply",
"callback!"
] | static int scroller_activate_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
v2dScrollerMove *vsm = op->customdata;
switch (event->type) {
case MOUSEMOVE: {
if (ELEM(vsm->zone, SCROLLHANDLE_BAR, SCROLLHANDLE_MAX)) {
switch (vsm->scroller) {
case 'h':
vsm->delta = (float)(event->x - vsm->lastx);
break;
case 'v':
vsm->delta = (float)(event->y - vsm->lasty);
break;
}
}
else if (vsm->zone == SCROLLHANDLE_MIN) {
switch (vsm->scroller) {
case 'h':
vsm->delta = (float)(vsm->lastx - event->x);
break;
case 'v':
vsm->delta = (float)(vsm->lasty - event->y);
break;
}
}
vsm->lastx = event->x;
vsm->lasty = event->y;
scroller_activate_apply(C, op);
break;
}
case LEFTMOUSE:
case MIDDLEMOUSE:
if (event->val == KM_RELEASE) {
if (ELEM(vsm->zone, SCROLLHANDLE_MIN_OUTSIDE, SCROLLHANDLE_MAX_OUTSIDE)) {
if (vsm->zone == SCROLLHANDLE_MIN_OUTSIDE) {
vsm->delta = -vsm->scrollbarwidth * 0.8f;
}
else if (vsm->zone == SCROLLHANDLE_MAX_OUTSIDE) {
vsm->delta = vsm->scrollbarwidth * 0.8f;
}
scroller_activate_apply(C, op);
scroller_activate_exit(C, op);
return OPERATOR_FINISHED;
}
if (vsm->lastx || vsm->lasty) {
scroller_activate_exit(C, op);
return OPERATOR_FINISHED;
}
}
break;
}
return OPERATOR_RUNNING_MODAL;
} | [
"static",
"int",
"scroller_activate_modal",
"(",
"bContext",
"*",
"C",
",",
"wmOperator",
"*",
"op",
",",
"const",
"wmEvent",
"*",
"event",
")",
"{",
"v2dScrollerMove",
"*",
"vsm",
"=",
"op",
"->",
"customdata",
";",
"switch",
"(",
"event",
"->",
"type",
")",
"{",
"case",
"MOUSEMOVE",
":",
"{",
"if",
"(",
"ELEM",
"(",
"vsm",
"->",
"zone",
",",
"SCROLLHANDLE_BAR",
",",
"SCROLLHANDLE_MAX",
")",
")",
"{",
"switch",
"(",
"vsm",
"->",
"scroller",
")",
"{",
"case",
"'",
"'",
":",
"vsm",
"->",
"delta",
"=",
"(",
"float",
")",
"(",
"event",
"->",
"x",
"-",
"vsm",
"->",
"lastx",
")",
";",
"break",
";",
"case",
"'",
"'",
":",
"vsm",
"->",
"delta",
"=",
"(",
"float",
")",
"(",
"event",
"->",
"y",
"-",
"vsm",
"->",
"lasty",
")",
";",
"break",
";",
"}",
"}",
"else",
"if",
"(",
"vsm",
"->",
"zone",
"==",
"SCROLLHANDLE_MIN",
")",
"{",
"switch",
"(",
"vsm",
"->",
"scroller",
")",
"{",
"case",
"'",
"'",
":",
"vsm",
"->",
"delta",
"=",
"(",
"float",
")",
"(",
"vsm",
"->",
"lastx",
"-",
"event",
"->",
"x",
")",
";",
"break",
";",
"case",
"'",
"'",
":",
"vsm",
"->",
"delta",
"=",
"(",
"float",
")",
"(",
"vsm",
"->",
"lasty",
"-",
"event",
"->",
"y",
")",
";",
"break",
";",
"}",
"}",
"vsm",
"->",
"lastx",
"=",
"event",
"->",
"x",
";",
"vsm",
"->",
"lasty",
"=",
"event",
"->",
"y",
";",
"scroller_activate_apply",
"(",
"C",
",",
"op",
")",
";",
"break",
";",
"}",
"case",
"LEFTMOUSE",
":",
"case",
"MIDDLEMOUSE",
":",
"if",
"(",
"event",
"->",
"val",
"==",
"KM_RELEASE",
")",
"{",
"if",
"(",
"ELEM",
"(",
"vsm",
"->",
"zone",
",",
"SCROLLHANDLE_MIN_OUTSIDE",
",",
"SCROLLHANDLE_MAX_OUTSIDE",
")",
")",
"{",
"if",
"(",
"vsm",
"->",
"zone",
"==",
"SCROLLHANDLE_MIN_OUTSIDE",
")",
"{",
"vsm",
"->",
"delta",
"=",
"-",
"vsm",
"->",
"scrollbarwidth",
"*",
"0.8f",
";",
"}",
"else",
"if",
"(",
"vsm",
"->",
"zone",
"==",
"SCROLLHANDLE_MAX_OUTSIDE",
")",
"{",
"vsm",
"->",
"delta",
"=",
"vsm",
"->",
"scrollbarwidth",
"*",
"0.8f",
";",
"}",
"scroller_activate_apply",
"(",
"C",
",",
"op",
")",
";",
"scroller_activate_exit",
"(",
"C",
",",
"op",
")",
";",
"return",
"OPERATOR_FINISHED",
";",
"}",
"if",
"(",
"vsm",
"->",
"lastx",
"||",
"vsm",
"->",
"lasty",
")",
"{",
"scroller_activate_exit",
"(",
"C",
",",
"op",
")",
";",
"return",
"OPERATOR_FINISHED",
";",
"}",
"}",
"break",
";",
"}",
"return",
"OPERATOR_RUNNING_MODAL",
";",
"}"
] | Handle user input for scrollers - calculations of mouse-movement need to be done here,
not in the apply callback! | [
"Handle",
"user",
"input",
"for",
"scrollers",
"-",
"calculations",
"of",
"mouse",
"-",
"movement",
"need",
"to",
"be",
"done",
"here",
"not",
"in",
"the",
"apply",
"callback!"
] | [
"/* execute the events */",
"/* calculate new delta transform, then store mouse-coordinates for next-time */",
"/* if using bar (i.e. 'panning') or 'max' zoom widget */",
"/* horizontal scroller - so only horizontal movement\n * ('cur' moves opposite to mouse) */",
"/* vertical scroller - so only vertical movement\n * ('cur' moves opposite to mouse) */",
"/* using 'min' zoom widget */",
"/* horizontal scroller - so only horizontal movement\n * ('cur' moves with mouse) */",
"/* vertical scroller - so only vertical movement\n * ('cur' moves with to mouse) */",
"/* store previous coordinates */",
"/* single-click was in empty space outside bubble, so scroll by 1 'page' */",
"/* otherwise, end the drag action */"
] | [
{
"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": []
} |
5cf7cb4e7c4695a8ac0f776020ca6c46a4a8983a | DemonRem/blender | source/blender/editors/interface/view2d_ops.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | scroller_activate_invoke | int | static int scroller_activate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
ARegion *ar = CTX_wm_region(C);
View2D *v2d = &ar->v2d;
/* check if mouse in scrollbars, if they're enabled */
const char in_scroller = UI_view2d_mouse_in_scrollers(ar, v2d, event->x, event->y);
/* if in a scroller, init customdata then set modal handler which will
* catch mouse-down to start doing useful stuff */
if (in_scroller) {
v2dScrollerMove *vsm;
/* initialize customdata */
scroller_activate_init(C, op, event, in_scroller);
vsm = (v2dScrollerMove *)op->customdata;
/* support for quick jump to location - gtk and qt do this on linux */
if (event->type == MIDDLEMOUSE) {
switch (vsm->scroller) {
case 'h': /* horizontal scroller - so only horizontal movement
* ('cur' moves opposite to mouse) */
vsm->delta = (float)(event->x - vsm->scrollbar_orig);
break;
case 'v': /* vertical scroller - so only vertical movement
* ('cur' moves opposite to mouse) */
vsm->delta = (float)(event->y - vsm->scrollbar_orig);
break;
}
scroller_activate_apply(C, op);
vsm->zone = SCROLLHANDLE_BAR;
}
/* check if zoom zones are inappropriate (i.e. zoom widgets not shown), so cannot continue
* NOTE: see view2d.c for latest conditions, and keep this in sync with that
*/
if (ELEM(vsm->zone, SCROLLHANDLE_MIN, SCROLLHANDLE_MAX)) {
if (((vsm->scroller == 'h') && (v2d->scroll & V2D_SCROLL_HORIZONTAL_HANDLES) == 0) ||
((vsm->scroller == 'v') && (v2d->scroll & V2D_SCROLL_VERTICAL_HANDLES) == 0)) {
/* switch to bar (i.e. no scaling gets handled) */
vsm->zone = SCROLLHANDLE_BAR;
}
}
/* check if zone is inappropriate (i.e. 'bar' but panning is banned), so cannot continue */
if (vsm->zone == SCROLLHANDLE_BAR) {
if (((vsm->scroller == 'h') && (v2d->keepofs & V2D_LOCKOFS_X)) ||
((vsm->scroller == 'v') && (v2d->keepofs & V2D_LOCKOFS_Y))) {
/* free customdata initialized */
scroller_activate_exit(C, op);
/* can't catch this event for ourselves, so let it go to someone else? */
return OPERATOR_PASS_THROUGH;
}
}
/* zone is also inappropriate if scroller is not visible... */
if (((vsm->scroller == 'h') && (v2d->scroll & (V2D_SCROLL_HORIZONTAL_FULLR))) ||
((vsm->scroller == 'v') && (v2d->scroll & (V2D_SCROLL_VERTICAL_FULLR)))) {
/* free customdata initialized */
scroller_activate_exit(C, op);
/* can't catch this event for ourselves, so let it go to someone else? */
/* XXX note: if handlers use mask rect to clip input, input will fail for this case */
return OPERATOR_PASS_THROUGH;
}
/* activate the scroller */
if (vsm->scroller == 'h') {
v2d->scroll_ui |= V2D_SCROLL_H_ACTIVE;
}
else {
v2d->scroll_ui |= V2D_SCROLL_V_ACTIVE;
}
/* still ok, so can add */
WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
}
else {
/* not in scroller, so nothing happened...
* (pass through let's something else catch event) */
return OPERATOR_PASS_THROUGH;
}
} | /* a click (or click drag in progress)
* should have occurred, so check if it happened in scrollbar */ | a click (or click drag in progress)
should have occurred, so check if it happened in scrollbar | [
"a",
"click",
"(",
"or",
"click",
"drag",
"in",
"progress",
")",
"should",
"have",
"occurred",
"so",
"check",
"if",
"it",
"happened",
"in",
"scrollbar"
] | static int scroller_activate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
ARegion *ar = CTX_wm_region(C);
View2D *v2d = &ar->v2d;
const char in_scroller = UI_view2d_mouse_in_scrollers(ar, v2d, event->x, event->y);
if (in_scroller) {
v2dScrollerMove *vsm;
scroller_activate_init(C, op, event, in_scroller);
vsm = (v2dScrollerMove *)op->customdata;
if (event->type == MIDDLEMOUSE) {
switch (vsm->scroller) {
case 'h':
vsm->delta = (float)(event->x - vsm->scrollbar_orig);
break;
case 'v':
vsm->delta = (float)(event->y - vsm->scrollbar_orig);
break;
}
scroller_activate_apply(C, op);
vsm->zone = SCROLLHANDLE_BAR;
}
if (ELEM(vsm->zone, SCROLLHANDLE_MIN, SCROLLHANDLE_MAX)) {
if (((vsm->scroller == 'h') && (v2d->scroll & V2D_SCROLL_HORIZONTAL_HANDLES) == 0) ||
((vsm->scroller == 'v') && (v2d->scroll & V2D_SCROLL_VERTICAL_HANDLES) == 0)) {
vsm->zone = SCROLLHANDLE_BAR;
}
}
if (vsm->zone == SCROLLHANDLE_BAR) {
if (((vsm->scroller == 'h') && (v2d->keepofs & V2D_LOCKOFS_X)) ||
((vsm->scroller == 'v') && (v2d->keepofs & V2D_LOCKOFS_Y))) {
scroller_activate_exit(C, op);
return OPERATOR_PASS_THROUGH;
}
}
if (((vsm->scroller == 'h') && (v2d->scroll & (V2D_SCROLL_HORIZONTAL_FULLR))) ||
((vsm->scroller == 'v') && (v2d->scroll & (V2D_SCROLL_VERTICAL_FULLR)))) {
scroller_activate_exit(C, op);
return OPERATOR_PASS_THROUGH;
}
if (vsm->scroller == 'h') {
v2d->scroll_ui |= V2D_SCROLL_H_ACTIVE;
}
else {
v2d->scroll_ui |= V2D_SCROLL_V_ACTIVE;
}
WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
}
else {
return OPERATOR_PASS_THROUGH;
}
} | [
"static",
"int",
"scroller_activate_invoke",
"(",
"bContext",
"*",
"C",
",",
"wmOperator",
"*",
"op",
",",
"const",
"wmEvent",
"*",
"event",
")",
"{",
"ARegion",
"*",
"ar",
"=",
"CTX_wm_region",
"(",
"C",
")",
";",
"View2D",
"*",
"v2d",
"=",
"&",
"ar",
"->",
"v2d",
";",
"const",
"char",
"in_scroller",
"=",
"UI_view2d_mouse_in_scrollers",
"(",
"ar",
",",
"v2d",
",",
"event",
"->",
"x",
",",
"event",
"->",
"y",
")",
";",
"if",
"(",
"in_scroller",
")",
"{",
"v2dScrollerMove",
"*",
"vsm",
";",
"scroller_activate_init",
"(",
"C",
",",
"op",
",",
"event",
",",
"in_scroller",
")",
";",
"vsm",
"=",
"(",
"v2dScrollerMove",
"*",
")",
"op",
"->",
"customdata",
";",
"if",
"(",
"event",
"->",
"type",
"==",
"MIDDLEMOUSE",
")",
"{",
"switch",
"(",
"vsm",
"->",
"scroller",
")",
"{",
"case",
"'",
"'",
":",
"vsm",
"->",
"delta",
"=",
"(",
"float",
")",
"(",
"event",
"->",
"x",
"-",
"vsm",
"->",
"scrollbar_orig",
")",
";",
"break",
";",
"case",
"'",
"'",
":",
"vsm",
"->",
"delta",
"=",
"(",
"float",
")",
"(",
"event",
"->",
"y",
"-",
"vsm",
"->",
"scrollbar_orig",
")",
";",
"break",
";",
"}",
"scroller_activate_apply",
"(",
"C",
",",
"op",
")",
";",
"vsm",
"->",
"zone",
"=",
"SCROLLHANDLE_BAR",
";",
"}",
"if",
"(",
"ELEM",
"(",
"vsm",
"->",
"zone",
",",
"SCROLLHANDLE_MIN",
",",
"SCROLLHANDLE_MAX",
")",
")",
"{",
"if",
"(",
"(",
"(",
"vsm",
"->",
"scroller",
"==",
"'",
"'",
")",
"&&",
"(",
"v2d",
"->",
"scroll",
"&",
"V2D_SCROLL_HORIZONTAL_HANDLES",
")",
"==",
"0",
")",
"||",
"(",
"(",
"vsm",
"->",
"scroller",
"==",
"'",
"'",
")",
"&&",
"(",
"v2d",
"->",
"scroll",
"&",
"V2D_SCROLL_VERTICAL_HANDLES",
")",
"==",
"0",
")",
")",
"{",
"vsm",
"->",
"zone",
"=",
"SCROLLHANDLE_BAR",
";",
"}",
"}",
"if",
"(",
"vsm",
"->",
"zone",
"==",
"SCROLLHANDLE_BAR",
")",
"{",
"if",
"(",
"(",
"(",
"vsm",
"->",
"scroller",
"==",
"'",
"'",
")",
"&&",
"(",
"v2d",
"->",
"keepofs",
"&",
"V2D_LOCKOFS_X",
")",
")",
"||",
"(",
"(",
"vsm",
"->",
"scroller",
"==",
"'",
"'",
")",
"&&",
"(",
"v2d",
"->",
"keepofs",
"&",
"V2D_LOCKOFS_Y",
")",
")",
")",
"{",
"scroller_activate_exit",
"(",
"C",
",",
"op",
")",
";",
"return",
"OPERATOR_PASS_THROUGH",
";",
"}",
"}",
"if",
"(",
"(",
"(",
"vsm",
"->",
"scroller",
"==",
"'",
"'",
")",
"&&",
"(",
"v2d",
"->",
"scroll",
"&",
"(",
"V2D_SCROLL_HORIZONTAL_FULLR",
")",
")",
")",
"||",
"(",
"(",
"vsm",
"->",
"scroller",
"==",
"'",
"'",
")",
"&&",
"(",
"v2d",
"->",
"scroll",
"&",
"(",
"V2D_SCROLL_VERTICAL_FULLR",
")",
")",
")",
")",
"{",
"scroller_activate_exit",
"(",
"C",
",",
"op",
")",
";",
"return",
"OPERATOR_PASS_THROUGH",
";",
"}",
"if",
"(",
"vsm",
"->",
"scroller",
"==",
"'",
"'",
")",
"{",
"v2d",
"->",
"scroll_ui",
"|=",
"V2D_SCROLL_H_ACTIVE",
";",
"}",
"else",
"{",
"v2d",
"->",
"scroll_ui",
"|=",
"V2D_SCROLL_V_ACTIVE",
";",
"}",
"WM_event_add_modal_handler",
"(",
"C",
",",
"op",
")",
";",
"return",
"OPERATOR_RUNNING_MODAL",
";",
"}",
"else",
"{",
"return",
"OPERATOR_PASS_THROUGH",
";",
"}",
"}"
] | a click (or click drag in progress)
should have occurred, so check if it happened in scrollbar | [
"a",
"click",
"(",
"or",
"click",
"drag",
"in",
"progress",
")",
"should",
"have",
"occurred",
"so",
"check",
"if",
"it",
"happened",
"in",
"scrollbar"
] | [
"/* check if mouse in scrollbars, if they're enabled */",
"/* if in a scroller, init customdata then set modal handler which will\n * catch mouse-down to start doing useful stuff */",
"/* initialize customdata */",
"/* support for quick jump to location - gtk and qt do this on linux */",
"/* horizontal scroller - so only horizontal movement\n * ('cur' moves opposite to mouse) */",
"/* vertical scroller - so only vertical movement\n * ('cur' moves opposite to mouse) */",
"/* check if zoom zones are inappropriate (i.e. zoom widgets not shown), so cannot continue\n * NOTE: see view2d.c for latest conditions, and keep this in sync with that\n */",
"/* switch to bar (i.e. no scaling gets handled) */",
"/* check if zone is inappropriate (i.e. 'bar' but panning is banned), so cannot continue */",
"/* free customdata initialized */",
"/* can't catch this event for ourselves, so let it go to someone else? */",
"/* zone is also inappropriate if scroller is not visible... */",
"/* free customdata initialized */",
"/* can't catch this event for ourselves, so let it go to someone else? */",
"/* XXX note: if handlers use mask rect to clip input, input will fail for this case */",
"/* activate the scroller */",
"/* still ok, so can add */",
"/* not in scroller, so nothing happened...\n * (pass through let's something else catch event) */"
] | [
{
"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": []
} |
5cf7cb4e7c4695a8ac0f776020ca6c46a4a8983a | DemonRem/blender | source/blender/editors/interface/view2d_ops.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | VIEW2D_OT_scroller_activate | void | static void VIEW2D_OT_scroller_activate(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Scroller Activate";
ot->description = "Scroll view by mouse click and drag";
ot->idname = "VIEW2D_OT_scroller_activate";
/* flags */
ot->flag = OPTYPE_BLOCKING;
/* api callbacks */
ot->invoke = scroller_activate_invoke;
ot->modal = scroller_activate_modal;
ot->cancel = scroller_activate_cancel;
ot->poll = scroller_activate_poll;
} | /* LMB-Drag in Scrollers - not repeatable operator! */ | LMB-Drag in Scrollers - not repeatable operator! | [
"LMB",
"-",
"Drag",
"in",
"Scrollers",
"-",
"not",
"repeatable",
"operator!"
] | static void VIEW2D_OT_scroller_activate(wmOperatorType *ot)
{
ot->name = "Scroller Activate";
ot->description = "Scroll view by mouse click and drag";
ot->idname = "VIEW2D_OT_scroller_activate";
ot->flag = OPTYPE_BLOCKING;
ot->invoke = scroller_activate_invoke;
ot->modal = scroller_activate_modal;
ot->cancel = scroller_activate_cancel;
ot->poll = scroller_activate_poll;
} | [
"static",
"void",
"VIEW2D_OT_scroller_activate",
"(",
"wmOperatorType",
"*",
"ot",
")",
"{",
"ot",
"->",
"name",
"=",
"\"",
"\"",
";",
"ot",
"->",
"description",
"=",
"\"",
"\"",
";",
"ot",
"->",
"idname",
"=",
"\"",
"\"",
";",
"ot",
"->",
"flag",
"=",
"OPTYPE_BLOCKING",
";",
"ot",
"->",
"invoke",
"=",
"scroller_activate_invoke",
";",
"ot",
"->",
"modal",
"=",
"scroller_activate_modal",
";",
"ot",
"->",
"cancel",
"=",
"scroller_activate_cancel",
";",
"ot",
"->",
"poll",
"=",
"scroller_activate_poll",
";",
"}"
] | LMB-Drag in Scrollers - not repeatable operator! | [
"LMB",
"-",
"Drag",
"in",
"Scrollers",
"-",
"not",
"repeatable",
"operator!"
] | [
"/* identifiers */",
"/* flags */",
"/* api callbacks */"
] | [
{
"param": "ot",
"type": "wmOperatorType"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ot",
"type": "wmOperatorType",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
535366b78fa101c5b84296f13be86a27409f7186 | DemonRem/blender | source/blender/blenfont/intern/blf_glyph.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | blf_kerning_cache_new | KerningCacheBLF | KerningCacheBLF *blf_kerning_cache_new(FontBLF *font, GlyphCacheBLF *gc)
{
KerningCacheBLF *kc;
kc = (KerningCacheBLF *)MEM_callocN(sizeof(KerningCacheBLF), "blf_kerning_cache_new");
kc->next = NULL;
kc->prev = NULL;
kc->mode = font->kerning_mode;
unsigned int i, j;
for (i = 0; i < 0x80; i++) {
for (j = 0; j < 0x80; j++) {
GlyphBLF *g = blf_glyph_search(gc, i);
if (!g) {
FT_UInt glyph_index = FT_Get_Char_Index(font->face, i);
g = blf_glyph_add(font, gc, glyph_index, i);
}
/* Can fail on certain fonts */
GlyphBLF *g_prev = blf_glyph_search(gc, j);
FT_Vector delta = {
.x = 0,
.y = 0,
};
if (g && g_prev && FT_Get_Kerning(font->face, g_prev->idx, g->idx, kc->mode, &delta) == 0) {
kc->table[i][j] = (int)delta.x >> 6;
}
else {
kc->table[i][j] = 0;
}
}
}
BLI_addhead(&font->kerning_caches, kc);
return kc;
} | /* Create a new glyph cache for the current kerning mode. */ | Create a new glyph cache for the current kerning mode. | [
"Create",
"a",
"new",
"glyph",
"cache",
"for",
"the",
"current",
"kerning",
"mode",
"."
] | KerningCacheBLF *blf_kerning_cache_new(FontBLF *font, GlyphCacheBLF *gc)
{
KerningCacheBLF *kc;
kc = (KerningCacheBLF *)MEM_callocN(sizeof(KerningCacheBLF), "blf_kerning_cache_new");
kc->next = NULL;
kc->prev = NULL;
kc->mode = font->kerning_mode;
unsigned int i, j;
for (i = 0; i < 0x80; i++) {
for (j = 0; j < 0x80; j++) {
GlyphBLF *g = blf_glyph_search(gc, i);
if (!g) {
FT_UInt glyph_index = FT_Get_Char_Index(font->face, i);
g = blf_glyph_add(font, gc, glyph_index, i);
}
GlyphBLF *g_prev = blf_glyph_search(gc, j);
FT_Vector delta = {
.x = 0,
.y = 0,
};
if (g && g_prev && FT_Get_Kerning(font->face, g_prev->idx, g->idx, kc->mode, &delta) == 0) {
kc->table[i][j] = (int)delta.x >> 6;
}
else {
kc->table[i][j] = 0;
}
}
}
BLI_addhead(&font->kerning_caches, kc);
return kc;
} | [
"KerningCacheBLF",
"*",
"blf_kerning_cache_new",
"(",
"FontBLF",
"*",
"font",
",",
"GlyphCacheBLF",
"*",
"gc",
")",
"{",
"KerningCacheBLF",
"*",
"kc",
";",
"kc",
"=",
"(",
"KerningCacheBLF",
"*",
")",
"MEM_callocN",
"(",
"sizeof",
"(",
"KerningCacheBLF",
")",
",",
"\"",
"\"",
")",
";",
"kc",
"->",
"next",
"=",
"NULL",
";",
"kc",
"->",
"prev",
"=",
"NULL",
";",
"kc",
"->",
"mode",
"=",
"font",
"->",
"kerning_mode",
";",
"unsigned",
"int",
"i",
",",
"j",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"0x80",
";",
"i",
"++",
")",
"{",
"for",
"(",
"j",
"=",
"0",
";",
"j",
"<",
"0x80",
";",
"j",
"++",
")",
"{",
"GlyphBLF",
"*",
"g",
"=",
"blf_glyph_search",
"(",
"gc",
",",
"i",
")",
";",
"if",
"(",
"!",
"g",
")",
"{",
"FT_UInt",
"glyph_index",
"=",
"FT_Get_Char_Index",
"(",
"font",
"->",
"face",
",",
"i",
")",
";",
"g",
"=",
"blf_glyph_add",
"(",
"font",
",",
"gc",
",",
"glyph_index",
",",
"i",
")",
";",
"}",
"GlyphBLF",
"*",
"g_prev",
"=",
"blf_glyph_search",
"(",
"gc",
",",
"j",
")",
";",
"FT_Vector",
"delta",
"=",
"{",
".",
"x",
"=",
"0",
",",
".",
"y",
"=",
"0",
",",
"}",
";",
"if",
"(",
"g",
"&&",
"g_prev",
"&&",
"FT_Get_Kerning",
"(",
"font",
"->",
"face",
",",
"g_prev",
"->",
"idx",
",",
"g",
"->",
"idx",
",",
"kc",
"->",
"mode",
",",
"&",
"delta",
")",
"==",
"0",
")",
"{",
"kc",
"->",
"table",
"[",
"i",
"]",
"[",
"j",
"]",
"=",
"(",
"int",
")",
"delta",
".",
"x",
">>",
"6",
";",
"}",
"else",
"{",
"kc",
"->",
"table",
"[",
"i",
"]",
"[",
"j",
"]",
"=",
"0",
";",
"}",
"}",
"}",
"BLI_addhead",
"(",
"&",
"font",
"->",
"kerning_caches",
",",
"kc",
")",
";",
"return",
"kc",
";",
"}"
] | Create a new glyph cache for the current kerning mode. | [
"Create",
"a",
"new",
"glyph",
"cache",
"for",
"the",
"current",
"kerning",
"mode",
"."
] | [
"/* Can fail on certain fonts */"
] | [
{
"param": "font",
"type": "FontBLF"
},
{
"param": "gc",
"type": "GlyphCacheBLF"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "font",
"type": "FontBLF",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gc",
"type": "GlyphCacheBLF",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
535366b78fa101c5b84296f13be86a27409f7186 | DemonRem/blender | source/blender/blenfont/intern/blf_glyph.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | blf_glyph_cache_new | GlyphCacheBLF | GlyphCacheBLF *blf_glyph_cache_new(FontBLF *font)
{
GlyphCacheBLF *gc;
gc = (GlyphCacheBLF *)MEM_callocN(sizeof(GlyphCacheBLF), "blf_glyph_cache_new");
gc->next = NULL;
gc->prev = NULL;
gc->size = font->size;
gc->dpi = font->dpi;
memset(gc->glyph_ascii_table, 0, sizeof(gc->glyph_ascii_table));
memset(gc->bucket, 0, sizeof(gc->bucket));
gc->textures = (GPUTexture **)MEM_callocN(sizeof(GPUTexture *) * 256, __func__);
gc->textures_len = 256;
gc->texture_current = BLF_TEXTURE_UNSET;
gc->offset_x = 3; /* enough padding for blur */
gc->offset_y = 3; /* enough padding for blur */
gc->pad = 6;
gc->glyphs_len_max = (int)font->face->num_glyphs;
gc->glyphs_len_free = (int)font->face->num_glyphs;
gc->ascender = ((float)font->face->size->metrics.ascender) / 64.0f;
gc->descender = ((float)font->face->size->metrics.descender) / 64.0f;
if (FT_IS_SCALABLE(font->face)) {
gc->glyph_width_max = (int)((float)(font->face->bbox.xMax - font->face->bbox.xMin) *
(((float)font->face->size->metrics.x_ppem) /
((float)font->face->units_per_EM)));
gc->glyph_height_max = (int)((float)(font->face->bbox.yMax - font->face->bbox.yMin) *
(((float)font->face->size->metrics.y_ppem) /
((float)font->face->units_per_EM)));
}
else {
gc->glyph_width_max = (int)(((float)font->face->size->metrics.max_advance) / 64.0f);
gc->glyph_height_max = (int)(((float)font->face->size->metrics.height) / 64.0f);
}
/* can happen with size 1 fonts */
CLAMP_MIN(gc->glyph_width_max, 1);
CLAMP_MIN(gc->glyph_height_max, 1);
gc->p2_width = 0;
gc->p2_height = 0;
BLI_addhead(&font->cache, gc);
return gc;
} | /* Create a new glyph cache for the current size and dpi. */ | Create a new glyph cache for the current size and dpi. | [
"Create",
"a",
"new",
"glyph",
"cache",
"for",
"the",
"current",
"size",
"and",
"dpi",
"."
] | GlyphCacheBLF *blf_glyph_cache_new(FontBLF *font)
{
GlyphCacheBLF *gc;
gc = (GlyphCacheBLF *)MEM_callocN(sizeof(GlyphCacheBLF), "blf_glyph_cache_new");
gc->next = NULL;
gc->prev = NULL;
gc->size = font->size;
gc->dpi = font->dpi;
memset(gc->glyph_ascii_table, 0, sizeof(gc->glyph_ascii_table));
memset(gc->bucket, 0, sizeof(gc->bucket));
gc->textures = (GPUTexture **)MEM_callocN(sizeof(GPUTexture *) * 256, __func__);
gc->textures_len = 256;
gc->texture_current = BLF_TEXTURE_UNSET;
gc->offset_x = 3;
gc->offset_y = 3;
gc->pad = 6;
gc->glyphs_len_max = (int)font->face->num_glyphs;
gc->glyphs_len_free = (int)font->face->num_glyphs;
gc->ascender = ((float)font->face->size->metrics.ascender) / 64.0f;
gc->descender = ((float)font->face->size->metrics.descender) / 64.0f;
if (FT_IS_SCALABLE(font->face)) {
gc->glyph_width_max = (int)((float)(font->face->bbox.xMax - font->face->bbox.xMin) *
(((float)font->face->size->metrics.x_ppem) /
((float)font->face->units_per_EM)));
gc->glyph_height_max = (int)((float)(font->face->bbox.yMax - font->face->bbox.yMin) *
(((float)font->face->size->metrics.y_ppem) /
((float)font->face->units_per_EM)));
}
else {
gc->glyph_width_max = (int)(((float)font->face->size->metrics.max_advance) / 64.0f);
gc->glyph_height_max = (int)(((float)font->face->size->metrics.height) / 64.0f);
}
CLAMP_MIN(gc->glyph_width_max, 1);
CLAMP_MIN(gc->glyph_height_max, 1);
gc->p2_width = 0;
gc->p2_height = 0;
BLI_addhead(&font->cache, gc);
return gc;
} | [
"GlyphCacheBLF",
"*",
"blf_glyph_cache_new",
"(",
"FontBLF",
"*",
"font",
")",
"{",
"GlyphCacheBLF",
"*",
"gc",
";",
"gc",
"=",
"(",
"GlyphCacheBLF",
"*",
")",
"MEM_callocN",
"(",
"sizeof",
"(",
"GlyphCacheBLF",
")",
",",
"\"",
"\"",
")",
";",
"gc",
"->",
"next",
"=",
"NULL",
";",
"gc",
"->",
"prev",
"=",
"NULL",
";",
"gc",
"->",
"size",
"=",
"font",
"->",
"size",
";",
"gc",
"->",
"dpi",
"=",
"font",
"->",
"dpi",
";",
"memset",
"(",
"gc",
"->",
"glyph_ascii_table",
",",
"0",
",",
"sizeof",
"(",
"gc",
"->",
"glyph_ascii_table",
")",
")",
";",
"memset",
"(",
"gc",
"->",
"bucket",
",",
"0",
",",
"sizeof",
"(",
"gc",
"->",
"bucket",
")",
")",
";",
"gc",
"->",
"textures",
"=",
"(",
"GPUTexture",
"*",
"*",
")",
"MEM_callocN",
"(",
"sizeof",
"(",
"GPUTexture",
"*",
")",
"*",
"256",
",",
"__func__",
")",
";",
"gc",
"->",
"textures_len",
"=",
"256",
";",
"gc",
"->",
"texture_current",
"=",
"BLF_TEXTURE_UNSET",
";",
"gc",
"->",
"offset_x",
"=",
"3",
";",
"gc",
"->",
"offset_y",
"=",
"3",
";",
"gc",
"->",
"pad",
"=",
"6",
";",
"gc",
"->",
"glyphs_len_max",
"=",
"(",
"int",
")",
"font",
"->",
"face",
"->",
"num_glyphs",
";",
"gc",
"->",
"glyphs_len_free",
"=",
"(",
"int",
")",
"font",
"->",
"face",
"->",
"num_glyphs",
";",
"gc",
"->",
"ascender",
"=",
"(",
"(",
"float",
")",
"font",
"->",
"face",
"->",
"size",
"->",
"metrics",
".",
"ascender",
")",
"/",
"64.0f",
";",
"gc",
"->",
"descender",
"=",
"(",
"(",
"float",
")",
"font",
"->",
"face",
"->",
"size",
"->",
"metrics",
".",
"descender",
")",
"/",
"64.0f",
";",
"if",
"(",
"FT_IS_SCALABLE",
"(",
"font",
"->",
"face",
")",
")",
"{",
"gc",
"->",
"glyph_width_max",
"=",
"(",
"int",
")",
"(",
"(",
"float",
")",
"(",
"font",
"->",
"face",
"->",
"bbox",
".",
"xMax",
"-",
"font",
"->",
"face",
"->",
"bbox",
".",
"xMin",
")",
"*",
"(",
"(",
"(",
"float",
")",
"font",
"->",
"face",
"->",
"size",
"->",
"metrics",
".",
"x_ppem",
")",
"/",
"(",
"(",
"float",
")",
"font",
"->",
"face",
"->",
"units_per_EM",
")",
")",
")",
";",
"gc",
"->",
"glyph_height_max",
"=",
"(",
"int",
")",
"(",
"(",
"float",
")",
"(",
"font",
"->",
"face",
"->",
"bbox",
".",
"yMax",
"-",
"font",
"->",
"face",
"->",
"bbox",
".",
"yMin",
")",
"*",
"(",
"(",
"(",
"float",
")",
"font",
"->",
"face",
"->",
"size",
"->",
"metrics",
".",
"y_ppem",
")",
"/",
"(",
"(",
"float",
")",
"font",
"->",
"face",
"->",
"units_per_EM",
")",
")",
")",
";",
"}",
"else",
"{",
"gc",
"->",
"glyph_width_max",
"=",
"(",
"int",
")",
"(",
"(",
"(",
"float",
")",
"font",
"->",
"face",
"->",
"size",
"->",
"metrics",
".",
"max_advance",
")",
"/",
"64.0f",
")",
";",
"gc",
"->",
"glyph_height_max",
"=",
"(",
"int",
")",
"(",
"(",
"(",
"float",
")",
"font",
"->",
"face",
"->",
"size",
"->",
"metrics",
".",
"height",
")",
"/",
"64.0f",
")",
";",
"}",
"CLAMP_MIN",
"(",
"gc",
"->",
"glyph_width_max",
",",
"1",
")",
";",
"CLAMP_MIN",
"(",
"gc",
"->",
"glyph_height_max",
",",
"1",
")",
";",
"gc",
"->",
"p2_width",
"=",
"0",
";",
"gc",
"->",
"p2_height",
"=",
"0",
";",
"BLI_addhead",
"(",
"&",
"font",
"->",
"cache",
",",
"gc",
")",
";",
"return",
"gc",
";",
"}"
] | Create a new glyph cache for the current size and dpi. | [
"Create",
"a",
"new",
"glyph",
"cache",
"for",
"the",
"current",
"size",
"and",
"dpi",
"."
] | [
"/* enough padding for blur */",
"/* enough padding for blur */",
"/* can happen with size 1 fonts */"
] | [
{
"param": "font",
"type": "FontBLF"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "font",
"type": "FontBLF",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
602031a6854b6f095c57d1fab906d3fd92984ce1 | DemonRem/blender | source/blender/editors/space_outliner/outliner_dragdrop.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | outliner_dropzone_find | TreeElement | static TreeElement *outliner_dropzone_find(const SpaceOutliner *soops,
const float fmval[2],
const bool children)
{
TreeElement *te;
for (te = soops->tree.first; te; te = te->next) {
TreeElement *te_valid = outliner_dropzone_element(te, fmval, children);
if (te_valid) {
return te_valid;
}
}
return NULL;
} | /* Find tree element to drop into. */ | Find tree element to drop into. | [
"Find",
"tree",
"element",
"to",
"drop",
"into",
"."
] | static TreeElement *outliner_dropzone_find(const SpaceOutliner *soops,
const float fmval[2],
const bool children)
{
TreeElement *te;
for (te = soops->tree.first; te; te = te->next) {
TreeElement *te_valid = outliner_dropzone_element(te, fmval, children);
if (te_valid) {
return te_valid;
}
}
return NULL;
} | [
"static",
"TreeElement",
"*",
"outliner_dropzone_find",
"(",
"const",
"SpaceOutliner",
"*",
"soops",
",",
"const",
"float",
"fmval",
"[",
"2",
"]",
",",
"const",
"bool",
"children",
")",
"{",
"TreeElement",
"*",
"te",
";",
"for",
"(",
"te",
"=",
"soops",
"->",
"tree",
".",
"first",
";",
"te",
";",
"te",
"=",
"te",
"->",
"next",
")",
"{",
"TreeElement",
"*",
"te_valid",
"=",
"outliner_dropzone_element",
"(",
"te",
",",
"fmval",
",",
"children",
")",
";",
"if",
"(",
"te_valid",
")",
"{",
"return",
"te_valid",
";",
"}",
"}",
"return",
"NULL",
";",
"}"
] | Find tree element to drop into. | [
"Find",
"tree",
"element",
"to",
"drop",
"into",
"."
] | [] | [
{
"param": "soops",
"type": "SpaceOutliner"
},
{
"param": "fmval",
"type": "float"
},
{
"param": "children",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "soops",
"type": "SpaceOutliner",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fmval",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "children",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
602031a6854b6f095c57d1fab906d3fd92984ce1 | DemonRem/blender | source/blender/editors/space_outliner/outliner_dragdrop.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | outliner_drop_insert_find | TreeElement | static TreeElement *outliner_drop_insert_find(bContext *C,
const wmEvent *event,
TreeElementInsertType *r_insert_type)
{
SpaceOutliner *soops = CTX_wm_space_outliner(C);
ARegion *ar = CTX_wm_region(C);
TreeElement *te_hovered;
float view_mval[2];
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &view_mval[0], &view_mval[1]);
te_hovered = outliner_find_item_at_y(soops, &soops->tree, view_mval[1]);
if (te_hovered) {
/* Mouse hovers an element (ignoring x-axis),
* now find out how to insert the dragged item exactly. */
const float margin = UI_UNIT_Y * (1.0f / 4);
if (view_mval[1] < (te_hovered->ys + margin)) {
if (TSELEM_OPEN(TREESTORE(te_hovered), soops)) {
/* inserting after a open item means we insert into it, but as first child */
if (BLI_listbase_is_empty(&te_hovered->subtree)) {
*r_insert_type = TE_INSERT_INTO;
return te_hovered;
}
else {
*r_insert_type = TE_INSERT_BEFORE;
return te_hovered->subtree.first;
}
}
else {
*r_insert_type = TE_INSERT_AFTER;
return te_hovered;
}
}
else if (view_mval[1] > (te_hovered->ys + (3 * margin))) {
*r_insert_type = TE_INSERT_BEFORE;
return te_hovered;
}
else {
*r_insert_type = TE_INSERT_INTO;
return te_hovered;
}
}
else {
/* Mouse doesn't hover any item (ignoring x-axis),
* so it's either above list bounds or below. */
TreeElement *first = soops->tree.first;
TreeElement *last = soops->tree.last;
if (view_mval[1] < last->ys) {
*r_insert_type = TE_INSERT_AFTER;
return last;
}
else if (view_mval[1] > (first->ys + UI_UNIT_Y)) {
*r_insert_type = TE_INSERT_BEFORE;
return first;
}
else {
BLI_assert(0);
return NULL;
}
}
} | /* Find tree element to drop into, with additional before and after reorder support. */ | Find tree element to drop into, with additional before and after reorder support. | [
"Find",
"tree",
"element",
"to",
"drop",
"into",
"with",
"additional",
"before",
"and",
"after",
"reorder",
"support",
"."
] | static TreeElement *outliner_drop_insert_find(bContext *C,
const wmEvent *event,
TreeElementInsertType *r_insert_type)
{
SpaceOutliner *soops = CTX_wm_space_outliner(C);
ARegion *ar = CTX_wm_region(C);
TreeElement *te_hovered;
float view_mval[2];
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &view_mval[0], &view_mval[1]);
te_hovered = outliner_find_item_at_y(soops, &soops->tree, view_mval[1]);
if (te_hovered) {
const float margin = UI_UNIT_Y * (1.0f / 4);
if (view_mval[1] < (te_hovered->ys + margin)) {
if (TSELEM_OPEN(TREESTORE(te_hovered), soops)) {
if (BLI_listbase_is_empty(&te_hovered->subtree)) {
*r_insert_type = TE_INSERT_INTO;
return te_hovered;
}
else {
*r_insert_type = TE_INSERT_BEFORE;
return te_hovered->subtree.first;
}
}
else {
*r_insert_type = TE_INSERT_AFTER;
return te_hovered;
}
}
else if (view_mval[1] > (te_hovered->ys + (3 * margin))) {
*r_insert_type = TE_INSERT_BEFORE;
return te_hovered;
}
else {
*r_insert_type = TE_INSERT_INTO;
return te_hovered;
}
}
else {
TreeElement *first = soops->tree.first;
TreeElement *last = soops->tree.last;
if (view_mval[1] < last->ys) {
*r_insert_type = TE_INSERT_AFTER;
return last;
}
else if (view_mval[1] > (first->ys + UI_UNIT_Y)) {
*r_insert_type = TE_INSERT_BEFORE;
return first;
}
else {
BLI_assert(0);
return NULL;
}
}
} | [
"static",
"TreeElement",
"*",
"outliner_drop_insert_find",
"(",
"bContext",
"*",
"C",
",",
"const",
"wmEvent",
"*",
"event",
",",
"TreeElementInsertType",
"*",
"r_insert_type",
")",
"{",
"SpaceOutliner",
"*",
"soops",
"=",
"CTX_wm_space_outliner",
"(",
"C",
")",
";",
"ARegion",
"*",
"ar",
"=",
"CTX_wm_region",
"(",
"C",
")",
";",
"TreeElement",
"*",
"te_hovered",
";",
"float",
"view_mval",
"[",
"2",
"]",
";",
"UI_view2d_region_to_view",
"(",
"&",
"ar",
"->",
"v2d",
",",
"event",
"->",
"mval",
"[",
"0",
"]",
",",
"event",
"->",
"mval",
"[",
"1",
"]",
",",
"&",
"view_mval",
"[",
"0",
"]",
",",
"&",
"view_mval",
"[",
"1",
"]",
")",
";",
"te_hovered",
"=",
"outliner_find_item_at_y",
"(",
"soops",
",",
"&",
"soops",
"->",
"tree",
",",
"view_mval",
"[",
"1",
"]",
")",
";",
"if",
"(",
"te_hovered",
")",
"{",
"const",
"float",
"margin",
"=",
"UI_UNIT_Y",
"*",
"(",
"1.0f",
"/",
"4",
")",
";",
"if",
"(",
"view_mval",
"[",
"1",
"]",
"<",
"(",
"te_hovered",
"->",
"ys",
"+",
"margin",
")",
")",
"{",
"if",
"(",
"TSELEM_OPEN",
"(",
"TREESTORE",
"(",
"te_hovered",
")",
",",
"soops",
")",
")",
"{",
"if",
"(",
"BLI_listbase_is_empty",
"(",
"&",
"te_hovered",
"->",
"subtree",
")",
")",
"{",
"*",
"r_insert_type",
"=",
"TE_INSERT_INTO",
";",
"return",
"te_hovered",
";",
"}",
"else",
"{",
"*",
"r_insert_type",
"=",
"TE_INSERT_BEFORE",
";",
"return",
"te_hovered",
"->",
"subtree",
".",
"first",
";",
"}",
"}",
"else",
"{",
"*",
"r_insert_type",
"=",
"TE_INSERT_AFTER",
";",
"return",
"te_hovered",
";",
"}",
"}",
"else",
"if",
"(",
"view_mval",
"[",
"1",
"]",
">",
"(",
"te_hovered",
"->",
"ys",
"+",
"(",
"3",
"*",
"margin",
")",
")",
")",
"{",
"*",
"r_insert_type",
"=",
"TE_INSERT_BEFORE",
";",
"return",
"te_hovered",
";",
"}",
"else",
"{",
"*",
"r_insert_type",
"=",
"TE_INSERT_INTO",
";",
"return",
"te_hovered",
";",
"}",
"}",
"else",
"{",
"TreeElement",
"*",
"first",
"=",
"soops",
"->",
"tree",
".",
"first",
";",
"TreeElement",
"*",
"last",
"=",
"soops",
"->",
"tree",
".",
"last",
";",
"if",
"(",
"view_mval",
"[",
"1",
"]",
"<",
"last",
"->",
"ys",
")",
"{",
"*",
"r_insert_type",
"=",
"TE_INSERT_AFTER",
";",
"return",
"last",
";",
"}",
"else",
"if",
"(",
"view_mval",
"[",
"1",
"]",
">",
"(",
"first",
"->",
"ys",
"+",
"UI_UNIT_Y",
")",
")",
"{",
"*",
"r_insert_type",
"=",
"TE_INSERT_BEFORE",
";",
"return",
"first",
";",
"}",
"else",
"{",
"BLI_assert",
"(",
"0",
")",
";",
"return",
"NULL",
";",
"}",
"}",
"}"
] | Find tree element to drop into, with additional before and after reorder support. | [
"Find",
"tree",
"element",
"to",
"drop",
"into",
"with",
"additional",
"before",
"and",
"after",
"reorder",
"support",
"."
] | [
"/* Mouse hovers an element (ignoring x-axis),\n * now find out how to insert the dragged item exactly. */",
"/* inserting after a open item means we insert into it, but as first child */",
"/* Mouse doesn't hover any item (ignoring x-axis),\n * so it's either above list bounds or below. */"
] | [
{
"param": "C",
"type": "bContext"
},
{
"param": "event",
"type": "wmEvent"
},
{
"param": "r_insert_type",
"type": "TreeElementInsertType"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "event",
"type": "wmEvent",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "r_insert_type",
"type": "TreeElementInsertType",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
602031a6854b6f095c57d1fab906d3fd92984ce1 | DemonRem/blender | source/blender/editors/space_outliner/outliner_dragdrop.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | OUTLINER_OT_item_drag_drop | void | void OUTLINER_OT_item_drag_drop(wmOperatorType *ot)
{
ot->name = "Drag and Drop";
ot->idname = "OUTLINER_OT_item_drag_drop";
ot->description = "Drag and drop element to another place";
ot->invoke = outliner_item_drag_drop_invoke;
ot->poll = ED_operator_outliner_active;
} | /* Outliner drag and drop. This operator mostly exists to support dragging
* from outliner text instead of only from the icon, and also to show a
* hint in the statusbar keymap. */ | Outliner drag and drop. This operator mostly exists to support dragging
from outliner text instead of only from the icon, and also to show a
hint in the statusbar keymap. | [
"Outliner",
"drag",
"and",
"drop",
".",
"This",
"operator",
"mostly",
"exists",
"to",
"support",
"dragging",
"from",
"outliner",
"text",
"instead",
"of",
"only",
"from",
"the",
"icon",
"and",
"also",
"to",
"show",
"a",
"hint",
"in",
"the",
"statusbar",
"keymap",
"."
] | void OUTLINER_OT_item_drag_drop(wmOperatorType *ot)
{
ot->name = "Drag and Drop";
ot->idname = "OUTLINER_OT_item_drag_drop";
ot->description = "Drag and drop element to another place";
ot->invoke = outliner_item_drag_drop_invoke;
ot->poll = ED_operator_outliner_active;
} | [
"void",
"OUTLINER_OT_item_drag_drop",
"(",
"wmOperatorType",
"*",
"ot",
")",
"{",
"ot",
"->",
"name",
"=",
"\"",
"\"",
";",
"ot",
"->",
"idname",
"=",
"\"",
"\"",
";",
"ot",
"->",
"description",
"=",
"\"",
"\"",
";",
"ot",
"->",
"invoke",
"=",
"outliner_item_drag_drop_invoke",
";",
"ot",
"->",
"poll",
"=",
"ED_operator_outliner_active",
";",
"}"
] | Outliner drag and drop. | [
"Outliner",
"drag",
"and",
"drop",
"."
] | [] | [
{
"param": "ot",
"type": "wmOperatorType"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ot",
"type": "wmOperatorType",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
251bc86a3f524d343411e453a3cbdc8dc30be279 | DemonRem/blender | source/blender/editors/interface/interface_region_search.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | UI_search_item_add | bool | bool UI_search_item_add(uiSearchItems *items, const char *name, void *poin, int iconid)
{
/* hijack for autocomplete */
if (items->autocpl) {
UI_autocomplete_update_name(items->autocpl, name);
return true;
}
/* hijack for finding active item */
if (items->active) {
if (poin == items->active) {
items->offset_i = items->totitem;
}
items->totitem++;
return true;
}
if (items->totitem >= items->maxitem) {
items->more = 1;
return false;
}
/* skip first items in list */
if (items->offset_i > 0) {
items->offset_i--;
return true;
}
if (items->names) {
BLI_strncpy(items->names[items->totitem], name, items->maxstrlen);
}
if (items->pointers) {
items->pointers[items->totitem] = poin;
}
if (items->icons) {
items->icons[items->totitem] = iconid;
}
items->totitem++;
return true;
} | /* exported for use by search callbacks */
/* returns zero if nothing to add */ | exported for use by search callbacks
returns zero if nothing to add | [
"exported",
"for",
"use",
"by",
"search",
"callbacks",
"returns",
"zero",
"if",
"nothing",
"to",
"add"
] | bool UI_search_item_add(uiSearchItems *items, const char *name, void *poin, int iconid)
{
if (items->autocpl) {
UI_autocomplete_update_name(items->autocpl, name);
return true;
}
if (items->active) {
if (poin == items->active) {
items->offset_i = items->totitem;
}
items->totitem++;
return true;
}
if (items->totitem >= items->maxitem) {
items->more = 1;
return false;
}
if (items->offset_i > 0) {
items->offset_i--;
return true;
}
if (items->names) {
BLI_strncpy(items->names[items->totitem], name, items->maxstrlen);
}
if (items->pointers) {
items->pointers[items->totitem] = poin;
}
if (items->icons) {
items->icons[items->totitem] = iconid;
}
items->totitem++;
return true;
} | [
"bool",
"UI_search_item_add",
"(",
"uiSearchItems",
"*",
"items",
",",
"const",
"char",
"*",
"name",
",",
"void",
"*",
"poin",
",",
"int",
"iconid",
")",
"{",
"if",
"(",
"items",
"->",
"autocpl",
")",
"{",
"UI_autocomplete_update_name",
"(",
"items",
"->",
"autocpl",
",",
"name",
")",
";",
"return",
"true",
";",
"}",
"if",
"(",
"items",
"->",
"active",
")",
"{",
"if",
"(",
"poin",
"==",
"items",
"->",
"active",
")",
"{",
"items",
"->",
"offset_i",
"=",
"items",
"->",
"totitem",
";",
"}",
"items",
"->",
"totitem",
"++",
";",
"return",
"true",
";",
"}",
"if",
"(",
"items",
"->",
"totitem",
">=",
"items",
"->",
"maxitem",
")",
"{",
"items",
"->",
"more",
"=",
"1",
";",
"return",
"false",
";",
"}",
"if",
"(",
"items",
"->",
"offset_i",
">",
"0",
")",
"{",
"items",
"->",
"offset_i",
"--",
";",
"return",
"true",
";",
"}",
"if",
"(",
"items",
"->",
"names",
")",
"{",
"BLI_strncpy",
"(",
"items",
"->",
"names",
"[",
"items",
"->",
"totitem",
"]",
",",
"name",
",",
"items",
"->",
"maxstrlen",
")",
";",
"}",
"if",
"(",
"items",
"->",
"pointers",
")",
"{",
"items",
"->",
"pointers",
"[",
"items",
"->",
"totitem",
"]",
"=",
"poin",
";",
"}",
"if",
"(",
"items",
"->",
"icons",
")",
"{",
"items",
"->",
"icons",
"[",
"items",
"->",
"totitem",
"]",
"=",
"iconid",
";",
"}",
"items",
"->",
"totitem",
"++",
";",
"return",
"true",
";",
"}"
] | exported for use by search callbacks
returns zero if nothing to add | [
"exported",
"for",
"use",
"by",
"search",
"callbacks",
"returns",
"zero",
"if",
"nothing",
"to",
"add"
] | [
"/* hijack for autocomplete */",
"/* hijack for finding active item */",
"/* skip first items in list */"
] | [
{
"param": "items",
"type": "uiSearchItems"
},
{
"param": "name",
"type": "char"
},
{
"param": "poin",
"type": "void"
},
{
"param": "iconid",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "items",
"type": "uiSearchItems",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "poin",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "iconid",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
251bc86a3f524d343411e453a3cbdc8dc30be279 | DemonRem/blender | source/blender/editors/interface/interface_region_search.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | ui_searchbox_select | void | static void ui_searchbox_select(bContext *C, ARegion *ar, uiBut *but, int step)
{
uiSearchboxData *data = ar->regiondata;
/* apply step */
data->active += step;
if (data->items.totitem == 0) {
data->active = -1;
}
else if (data->active >= data->items.totitem) {
if (data->items.more) {
data->items.offset++;
data->active = data->items.totitem - 1;
ui_searchbox_update(C, ar, but, false);
}
else {
data->active = data->items.totitem - 1;
}
}
else if (data->active < 0) {
if (data->items.offset) {
data->items.offset--;
data->active = 0;
ui_searchbox_update(C, ar, but, false);
}
else {
/* only let users step into an 'unset' state for unlink buttons */
data->active = (but->flag & UI_BUT_VALUE_CLEAR) ? -1 : 0;
}
}
ED_region_tag_redraw(ar);
} | /* ar is the search box itself */ | ar is the search box itself | [
"ar",
"is",
"the",
"search",
"box",
"itself"
] | static void ui_searchbox_select(bContext *C, ARegion *ar, uiBut *but, int step)
{
uiSearchboxData *data = ar->regiondata;
data->active += step;
if (data->items.totitem == 0) {
data->active = -1;
}
else if (data->active >= data->items.totitem) {
if (data->items.more) {
data->items.offset++;
data->active = data->items.totitem - 1;
ui_searchbox_update(C, ar, but, false);
}
else {
data->active = data->items.totitem - 1;
}
}
else if (data->active < 0) {
if (data->items.offset) {
data->items.offset--;
data->active = 0;
ui_searchbox_update(C, ar, but, false);
}
else {
data->active = (but->flag & UI_BUT_VALUE_CLEAR) ? -1 : 0;
}
}
ED_region_tag_redraw(ar);
} | [
"static",
"void",
"ui_searchbox_select",
"(",
"bContext",
"*",
"C",
",",
"ARegion",
"*",
"ar",
",",
"uiBut",
"*",
"but",
",",
"int",
"step",
")",
"{",
"uiSearchboxData",
"*",
"data",
"=",
"ar",
"->",
"regiondata",
";",
"data",
"->",
"active",
"+=",
"step",
";",
"if",
"(",
"data",
"->",
"items",
".",
"totitem",
"==",
"0",
")",
"{",
"data",
"->",
"active",
"=",
"-1",
";",
"}",
"else",
"if",
"(",
"data",
"->",
"active",
">=",
"data",
"->",
"items",
".",
"totitem",
")",
"{",
"if",
"(",
"data",
"->",
"items",
".",
"more",
")",
"{",
"data",
"->",
"items",
".",
"offset",
"++",
";",
"data",
"->",
"active",
"=",
"data",
"->",
"items",
".",
"totitem",
"-",
"1",
";",
"ui_searchbox_update",
"(",
"C",
",",
"ar",
",",
"but",
",",
"false",
")",
";",
"}",
"else",
"{",
"data",
"->",
"active",
"=",
"data",
"->",
"items",
".",
"totitem",
"-",
"1",
";",
"}",
"}",
"else",
"if",
"(",
"data",
"->",
"active",
"<",
"0",
")",
"{",
"if",
"(",
"data",
"->",
"items",
".",
"offset",
")",
"{",
"data",
"->",
"items",
".",
"offset",
"--",
";",
"data",
"->",
"active",
"=",
"0",
";",
"ui_searchbox_update",
"(",
"C",
",",
"ar",
",",
"but",
",",
"false",
")",
";",
"}",
"else",
"{",
"data",
"->",
"active",
"=",
"(",
"but",
"->",
"flag",
"&",
"UI_BUT_VALUE_CLEAR",
")",
"?",
"-1",
":",
"0",
";",
"}",
"}",
"ED_region_tag_redraw",
"(",
"ar",
")",
";",
"}"
] | ar is the search box itself | [
"ar",
"is",
"the",
"search",
"box",
"itself"
] | [
"/* apply step */",
"/* only let users step into an 'unset' state for unlink buttons */"
] | [
{
"param": "C",
"type": "bContext"
},
{
"param": "ar",
"type": "ARegion"
},
{
"param": "but",
"type": "uiBut"
},
{
"param": "step",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ar",
"type": "ARegion",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "but",
"type": "uiBut",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "step",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
251bc86a3f524d343411e453a3cbdc8dc30be279 | DemonRem/blender | source/blender/editors/interface/interface_region_search.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | ui_searchbox_apply | bool | bool ui_searchbox_apply(uiBut *but, ARegion *ar)
{
uiSearchboxData *data = ar->regiondata;
but->func_arg2 = NULL;
if (data->active != -1) {
const char *name = data->items.names[data->active];
const char *name_sep = data->use_sep ? strrchr(name, UI_SEP_CHAR) : NULL;
BLI_strncpy(but->editstr, name, name_sep ? (name_sep - name) : data->items.maxstrlen);
but->func_arg2 = data->items.pointers[data->active];
return true;
}
else if (but->flag & UI_BUT_VALUE_CLEAR) {
/* It is valid for _VALUE_CLEAR flavor to have no active element
* (it's a valid way to unlink). */
but->editstr[0] = '\0';
return true;
}
else {
return false;
}
} | /* string validated to be of correct length (but->hardmax) */ | string validated to be of correct length (but->hardmax) | [
"string",
"validated",
"to",
"be",
"of",
"correct",
"length",
"(",
"but",
"-",
">",
"hardmax",
")"
] | bool ui_searchbox_apply(uiBut *but, ARegion *ar)
{
uiSearchboxData *data = ar->regiondata;
but->func_arg2 = NULL;
if (data->active != -1) {
const char *name = data->items.names[data->active];
const char *name_sep = data->use_sep ? strrchr(name, UI_SEP_CHAR) : NULL;
BLI_strncpy(but->editstr, name, name_sep ? (name_sep - name) : data->items.maxstrlen);
but->func_arg2 = data->items.pointers[data->active];
return true;
}
else if (but->flag & UI_BUT_VALUE_CLEAR) {
but->editstr[0] = '\0';
return true;
}
else {
return false;
}
} | [
"bool",
"ui_searchbox_apply",
"(",
"uiBut",
"*",
"but",
",",
"ARegion",
"*",
"ar",
")",
"{",
"uiSearchboxData",
"*",
"data",
"=",
"ar",
"->",
"regiondata",
";",
"but",
"->",
"func_arg2",
"=",
"NULL",
";",
"if",
"(",
"data",
"->",
"active",
"!=",
"-1",
")",
"{",
"const",
"char",
"*",
"name",
"=",
"data",
"->",
"items",
".",
"names",
"[",
"data",
"->",
"active",
"]",
";",
"const",
"char",
"*",
"name_sep",
"=",
"data",
"->",
"use_sep",
"?",
"strrchr",
"(",
"name",
",",
"UI_SEP_CHAR",
")",
":",
"NULL",
";",
"BLI_strncpy",
"(",
"but",
"->",
"editstr",
",",
"name",
",",
"name_sep",
"?",
"(",
"name_sep",
"-",
"name",
")",
":",
"data",
"->",
"items",
".",
"maxstrlen",
")",
";",
"but",
"->",
"func_arg2",
"=",
"data",
"->",
"items",
".",
"pointers",
"[",
"data",
"->",
"active",
"]",
";",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"but",
"->",
"flag",
"&",
"UI_BUT_VALUE_CLEAR",
")",
"{",
"but",
"->",
"editstr",
"[",
"0",
"]",
"=",
"'",
"\\0",
"'",
";",
"return",
"true",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}"
] | string validated to be of correct length (but->hardmax) | [
"string",
"validated",
"to",
"be",
"of",
"correct",
"length",
"(",
"but",
"-",
">",
"hardmax",
")"
] | [
"/* It is valid for _VALUE_CLEAR flavor to have no active element\n * (it's a valid way to unlink). */"
] | [
{
"param": "but",
"type": "uiBut"
},
{
"param": "ar",
"type": "ARegion"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "but",
"type": "uiBut",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ar",
"type": "ARegion",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
251bc86a3f524d343411e453a3cbdc8dc30be279 | DemonRem/blender | source/blender/editors/interface/interface_region_search.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | ui_searchbox_update | void | void ui_searchbox_update(bContext *C, ARegion *ar, uiBut *but, const bool reset)
{
uiSearchboxData *data = ar->regiondata;
/* reset vars */
data->items.totitem = 0;
data->items.more = 0;
if (reset == false) {
data->items.offset_i = data->items.offset;
}
else {
data->items.offset_i = data->items.offset = 0;
data->active = -1;
/* handle active */
if (but->search_func && but->func_arg2) {
data->items.active = but->func_arg2;
but->search_func(C, but->search_arg, but->editstr, &data->items);
data->items.active = NULL;
/* found active item, calculate real offset by centering it */
if (data->items.totitem) {
/* first case, begin of list */
if (data->items.offset_i < data->items.maxitem) {
data->active = data->items.offset_i;
data->items.offset_i = 0;
}
else {
/* second case, end of list */
if (data->items.totitem - data->items.offset_i <= data->items.maxitem) {
data->active = data->items.offset_i - data->items.totitem + data->items.maxitem;
data->items.offset_i = data->items.totitem - data->items.maxitem;
}
else {
/* center active item */
data->items.offset_i -= data->items.maxitem / 2;
data->active = data->items.maxitem / 2;
}
}
}
data->items.offset = data->items.offset_i;
data->items.totitem = 0;
}
}
/* callback */
if (but->search_func) {
but->search_func(C, but->search_arg, but->editstr, &data->items);
}
/* handle case where editstr is equal to one of items */
if (reset && data->active == -1) {
int a;
for (a = 0; a < data->items.totitem; a++) {
const char *name = data->items.names[a];
const char *name_sep = data->use_sep ? strrchr(name, UI_SEP_CHAR) : NULL;
if (STREQLEN(but->editstr, name, name_sep ? (name_sep - name) : data->items.maxstrlen)) {
data->active = a;
break;
}
}
if (data->items.totitem == 1 && but->editstr[0]) {
data->active = 0;
}
}
/* validate selected item */
ui_searchbox_select(C, ar, but, 0);
ED_region_tag_redraw(ar);
} | /* ar is the search box itself */ | ar is the search box itself | [
"ar",
"is",
"the",
"search",
"box",
"itself"
] | void ui_searchbox_update(bContext *C, ARegion *ar, uiBut *but, const bool reset)
{
uiSearchboxData *data = ar->regiondata;
data->items.totitem = 0;
data->items.more = 0;
if (reset == false) {
data->items.offset_i = data->items.offset;
}
else {
data->items.offset_i = data->items.offset = 0;
data->active = -1;
if (but->search_func && but->func_arg2) {
data->items.active = but->func_arg2;
but->search_func(C, but->search_arg, but->editstr, &data->items);
data->items.active = NULL;
if (data->items.totitem) {
if (data->items.offset_i < data->items.maxitem) {
data->active = data->items.offset_i;
data->items.offset_i = 0;
}
else {
if (data->items.totitem - data->items.offset_i <= data->items.maxitem) {
data->active = data->items.offset_i - data->items.totitem + data->items.maxitem;
data->items.offset_i = data->items.totitem - data->items.maxitem;
}
else {
data->items.offset_i -= data->items.maxitem / 2;
data->active = data->items.maxitem / 2;
}
}
}
data->items.offset = data->items.offset_i;
data->items.totitem = 0;
}
}
if (but->search_func) {
but->search_func(C, but->search_arg, but->editstr, &data->items);
}
if (reset && data->active == -1) {
int a;
for (a = 0; a < data->items.totitem; a++) {
const char *name = data->items.names[a];
const char *name_sep = data->use_sep ? strrchr(name, UI_SEP_CHAR) : NULL;
if (STREQLEN(but->editstr, name, name_sep ? (name_sep - name) : data->items.maxstrlen)) {
data->active = a;
break;
}
}
if (data->items.totitem == 1 && but->editstr[0]) {
data->active = 0;
}
}
ui_searchbox_select(C, ar, but, 0);
ED_region_tag_redraw(ar);
} | [
"void",
"ui_searchbox_update",
"(",
"bContext",
"*",
"C",
",",
"ARegion",
"*",
"ar",
",",
"uiBut",
"*",
"but",
",",
"const",
"bool",
"reset",
")",
"{",
"uiSearchboxData",
"*",
"data",
"=",
"ar",
"->",
"regiondata",
";",
"data",
"->",
"items",
".",
"totitem",
"=",
"0",
";",
"data",
"->",
"items",
".",
"more",
"=",
"0",
";",
"if",
"(",
"reset",
"==",
"false",
")",
"{",
"data",
"->",
"items",
".",
"offset_i",
"=",
"data",
"->",
"items",
".",
"offset",
";",
"}",
"else",
"{",
"data",
"->",
"items",
".",
"offset_i",
"=",
"data",
"->",
"items",
".",
"offset",
"=",
"0",
";",
"data",
"->",
"active",
"=",
"-1",
";",
"if",
"(",
"but",
"->",
"search_func",
"&&",
"but",
"->",
"func_arg2",
")",
"{",
"data",
"->",
"items",
".",
"active",
"=",
"but",
"->",
"func_arg2",
";",
"but",
"->",
"search_func",
"(",
"C",
",",
"but",
"->",
"search_arg",
",",
"but",
"->",
"editstr",
",",
"&",
"data",
"->",
"items",
")",
";",
"data",
"->",
"items",
".",
"active",
"=",
"NULL",
";",
"if",
"(",
"data",
"->",
"items",
".",
"totitem",
")",
"{",
"if",
"(",
"data",
"->",
"items",
".",
"offset_i",
"<",
"data",
"->",
"items",
".",
"maxitem",
")",
"{",
"data",
"->",
"active",
"=",
"data",
"->",
"items",
".",
"offset_i",
";",
"data",
"->",
"items",
".",
"offset_i",
"=",
"0",
";",
"}",
"else",
"{",
"if",
"(",
"data",
"->",
"items",
".",
"totitem",
"-",
"data",
"->",
"items",
".",
"offset_i",
"<=",
"data",
"->",
"items",
".",
"maxitem",
")",
"{",
"data",
"->",
"active",
"=",
"data",
"->",
"items",
".",
"offset_i",
"-",
"data",
"->",
"items",
".",
"totitem",
"+",
"data",
"->",
"items",
".",
"maxitem",
";",
"data",
"->",
"items",
".",
"offset_i",
"=",
"data",
"->",
"items",
".",
"totitem",
"-",
"data",
"->",
"items",
".",
"maxitem",
";",
"}",
"else",
"{",
"data",
"->",
"items",
".",
"offset_i",
"-=",
"data",
"->",
"items",
".",
"maxitem",
"/",
"2",
";",
"data",
"->",
"active",
"=",
"data",
"->",
"items",
".",
"maxitem",
"/",
"2",
";",
"}",
"}",
"}",
"data",
"->",
"items",
".",
"offset",
"=",
"data",
"->",
"items",
".",
"offset_i",
";",
"data",
"->",
"items",
".",
"totitem",
"=",
"0",
";",
"}",
"}",
"if",
"(",
"but",
"->",
"search_func",
")",
"{",
"but",
"->",
"search_func",
"(",
"C",
",",
"but",
"->",
"search_arg",
",",
"but",
"->",
"editstr",
",",
"&",
"data",
"->",
"items",
")",
";",
"}",
"if",
"(",
"reset",
"&&",
"data",
"->",
"active",
"==",
"-1",
")",
"{",
"int",
"a",
";",
"for",
"(",
"a",
"=",
"0",
";",
"a",
"<",
"data",
"->",
"items",
".",
"totitem",
";",
"a",
"++",
")",
"{",
"const",
"char",
"*",
"name",
"=",
"data",
"->",
"items",
".",
"names",
"[",
"a",
"]",
";",
"const",
"char",
"*",
"name_sep",
"=",
"data",
"->",
"use_sep",
"?",
"strrchr",
"(",
"name",
",",
"UI_SEP_CHAR",
")",
":",
"NULL",
";",
"if",
"(",
"STREQLEN",
"(",
"but",
"->",
"editstr",
",",
"name",
",",
"name_sep",
"?",
"(",
"name_sep",
"-",
"name",
")",
":",
"data",
"->",
"items",
".",
"maxstrlen",
")",
")",
"{",
"data",
"->",
"active",
"=",
"a",
";",
"break",
";",
"}",
"}",
"if",
"(",
"data",
"->",
"items",
".",
"totitem",
"==",
"1",
"&&",
"but",
"->",
"editstr",
"[",
"0",
"]",
")",
"{",
"data",
"->",
"active",
"=",
"0",
";",
"}",
"}",
"ui_searchbox_select",
"(",
"C",
",",
"ar",
",",
"but",
",",
"0",
")",
";",
"ED_region_tag_redraw",
"(",
"ar",
")",
";",
"}"
] | ar is the search box itself | [
"ar",
"is",
"the",
"search",
"box",
"itself"
] | [
"/* reset vars */",
"/* handle active */",
"/* found active item, calculate real offset by centering it */",
"/* first case, begin of list */",
"/* second case, end of list */",
"/* center active item */",
"/* callback */",
"/* handle case where editstr is equal to one of items */",
"/* validate selected item */"
] | [
{
"param": "C",
"type": "bContext"
},
{
"param": "ar",
"type": "ARegion"
},
{
"param": "but",
"type": "uiBut"
},
{
"param": "reset",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "C",
"type": "bContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ar",
"type": "ARegion",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "but",
"type": "uiBut",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reset",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
251bc86a3f524d343411e453a3cbdc8dc30be279 | DemonRem/blender | source/blender/editors/interface/interface_region_search.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | ui_but_search_refresh | void | void ui_but_search_refresh(uiBut *but)
{
uiSearchItems *items;
int x1;
/* possibly very large lists (such as ID datablocks) only
* only validate string RNA buts (not pointers) */
if (but->rnaprop && RNA_property_type(but->rnaprop) != PROP_STRING) {
return;
}
items = MEM_callocN(sizeof(uiSearchItems), "search items");
/* setup search struct */
items->maxitem = 10;
items->maxstrlen = 256;
items->names = MEM_callocN(items->maxitem * sizeof(void *), "search names");
for (x1 = 0; x1 < items->maxitem; x1++) {
items->names[x1] = MEM_callocN(but->hardmax + 1, "search names");
}
but->search_func(but->block->evil_C, but->search_arg, but->drawstr, items);
/* only redalert when we are sure of it, this can miss cases when >10 matches */
if (items->totitem == 0) {
UI_but_flag_enable(but, UI_BUT_REDALERT);
}
else if (items->more == 0) {
if (UI_search_items_find_index(items, but->drawstr) == -1) {
UI_but_flag_enable(but, UI_BUT_REDALERT);
}
}
for (x1 = 0; x1 < items->maxitem; x1++) {
MEM_freeN(items->names[x1]);
}
MEM_freeN(items->names);
MEM_freeN(items);
} | /* sets red alert if button holds a string it can't find */
/* XXX weak: search_func adds all partial matches... */ | sets red alert if button holds a string it can't find
XXX weak: search_func adds all partial matches | [
"sets",
"red",
"alert",
"if",
"button",
"holds",
"a",
"string",
"it",
"can",
"'",
"t",
"find",
"XXX",
"weak",
":",
"search_func",
"adds",
"all",
"partial",
"matches"
] | void ui_but_search_refresh(uiBut *but)
{
uiSearchItems *items;
int x1;
if (but->rnaprop && RNA_property_type(but->rnaprop) != PROP_STRING) {
return;
}
items = MEM_callocN(sizeof(uiSearchItems), "search items");
items->maxitem = 10;
items->maxstrlen = 256;
items->names = MEM_callocN(items->maxitem * sizeof(void *), "search names");
for (x1 = 0; x1 < items->maxitem; x1++) {
items->names[x1] = MEM_callocN(but->hardmax + 1, "search names");
}
but->search_func(but->block->evil_C, but->search_arg, but->drawstr, items);
if (items->totitem == 0) {
UI_but_flag_enable(but, UI_BUT_REDALERT);
}
else if (items->more == 0) {
if (UI_search_items_find_index(items, but->drawstr) == -1) {
UI_but_flag_enable(but, UI_BUT_REDALERT);
}
}
for (x1 = 0; x1 < items->maxitem; x1++) {
MEM_freeN(items->names[x1]);
}
MEM_freeN(items->names);
MEM_freeN(items);
} | [
"void",
"ui_but_search_refresh",
"(",
"uiBut",
"*",
"but",
")",
"{",
"uiSearchItems",
"*",
"items",
";",
"int",
"x1",
";",
"if",
"(",
"but",
"->",
"rnaprop",
"&&",
"RNA_property_type",
"(",
"but",
"->",
"rnaprop",
")",
"!=",
"PROP_STRING",
")",
"{",
"return",
";",
"}",
"items",
"=",
"MEM_callocN",
"(",
"sizeof",
"(",
"uiSearchItems",
")",
",",
"\"",
"\"",
")",
";",
"items",
"->",
"maxitem",
"=",
"10",
";",
"items",
"->",
"maxstrlen",
"=",
"256",
";",
"items",
"->",
"names",
"=",
"MEM_callocN",
"(",
"items",
"->",
"maxitem",
"*",
"sizeof",
"(",
"void",
"*",
")",
",",
"\"",
"\"",
")",
";",
"for",
"(",
"x1",
"=",
"0",
";",
"x1",
"<",
"items",
"->",
"maxitem",
";",
"x1",
"++",
")",
"{",
"items",
"->",
"names",
"[",
"x1",
"]",
"=",
"MEM_callocN",
"(",
"but",
"->",
"hardmax",
"+",
"1",
",",
"\"",
"\"",
")",
";",
"}",
"but",
"->",
"search_func",
"(",
"but",
"->",
"block",
"->",
"evil_C",
",",
"but",
"->",
"search_arg",
",",
"but",
"->",
"drawstr",
",",
"items",
")",
";",
"if",
"(",
"items",
"->",
"totitem",
"==",
"0",
")",
"{",
"UI_but_flag_enable",
"(",
"but",
",",
"UI_BUT_REDALERT",
")",
";",
"}",
"else",
"if",
"(",
"items",
"->",
"more",
"==",
"0",
")",
"{",
"if",
"(",
"UI_search_items_find_index",
"(",
"items",
",",
"but",
"->",
"drawstr",
")",
"==",
"-1",
")",
"{",
"UI_but_flag_enable",
"(",
"but",
",",
"UI_BUT_REDALERT",
")",
";",
"}",
"}",
"for",
"(",
"x1",
"=",
"0",
";",
"x1",
"<",
"items",
"->",
"maxitem",
";",
"x1",
"++",
")",
"{",
"MEM_freeN",
"(",
"items",
"->",
"names",
"[",
"x1",
"]",
")",
";",
"}",
"MEM_freeN",
"(",
"items",
"->",
"names",
")",
";",
"MEM_freeN",
"(",
"items",
")",
";",
"}"
] | sets red alert if button holds a string it can't find
XXX weak: search_func adds all partial matches... | [
"sets",
"red",
"alert",
"if",
"button",
"holds",
"a",
"string",
"it",
"can",
"'",
"t",
"find",
"XXX",
"weak",
":",
"search_func",
"adds",
"all",
"partial",
"matches",
"..."
] | [
"/* possibly very large lists (such as ID datablocks) only\n * only validate string RNA buts (not pointers) */",
"/* setup search struct */",
"/* only redalert when we are sure of it, this can miss cases when >10 matches */"
] | [
{
"param": "but",
"type": "uiBut"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "but",
"type": "uiBut",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
68eea4f278b2d027c0ed262d7245d031905836d2 | DemonRem/blender | source/blender/editors/space_outliner/space_outliner.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | ED_spacetype_outliner | void | void ED_spacetype_outliner(void)
{
SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype time");
ARegionType *art;
st->spaceid = SPACE_OUTLINER;
strncpy(st->name, "Outliner", BKE_ST_MAXNAME);
st->new = outliner_new;
st->free = outliner_free;
st->init = outliner_init;
st->duplicate = outliner_duplicate;
st->operatortypes = outliner_operatortypes;
st->keymap = outliner_keymap;
st->dropboxes = outliner_dropboxes;
st->id_remap = outliner_id_remap;
st->deactivate = outliner_deactivate;
/* regions: main window */
art = MEM_callocN(sizeof(ARegionType), "spacetype outliner region");
art->regionid = RGN_TYPE_WINDOW;
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D;
art->init = outliner_main_region_init;
art->draw = outliner_main_region_draw;
art->free = outliner_main_region_free;
art->listener = outliner_main_region_listener;
art->message_subscribe = outliner_main_region_message_subscribe;
BLI_addhead(&st->regiontypes, art);
/* regions: header */
art = MEM_callocN(sizeof(ARegionType), "spacetype outliner header region");
art->regionid = RGN_TYPE_HEADER;
art->prefsizey = HEADERY;
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_HEADER;
art->init = outliner_header_region_init;
art->draw = outliner_header_region_draw;
art->free = outliner_header_region_free;
art->listener = outliner_header_region_listener;
BLI_addhead(&st->regiontypes, art);
BKE_spacetype_register(st);
} | /* only called once, from space_api/spacetypes.c */ | only called once, from space_api/spacetypes.c | [
"only",
"called",
"once",
"from",
"space_api",
"/",
"spacetypes",
".",
"c"
] | void ED_spacetype_outliner(void)
{
SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype time");
ARegionType *art;
st->spaceid = SPACE_OUTLINER;
strncpy(st->name, "Outliner", BKE_ST_MAXNAME);
st->new = outliner_new;
st->free = outliner_free;
st->init = outliner_init;
st->duplicate = outliner_duplicate;
st->operatortypes = outliner_operatortypes;
st->keymap = outliner_keymap;
st->dropboxes = outliner_dropboxes;
st->id_remap = outliner_id_remap;
st->deactivate = outliner_deactivate;
art = MEM_callocN(sizeof(ARegionType), "spacetype outliner region");
art->regionid = RGN_TYPE_WINDOW;
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D;
art->init = outliner_main_region_init;
art->draw = outliner_main_region_draw;
art->free = outliner_main_region_free;
art->listener = outliner_main_region_listener;
art->message_subscribe = outliner_main_region_message_subscribe;
BLI_addhead(&st->regiontypes, art);
art = MEM_callocN(sizeof(ARegionType), "spacetype outliner header region");
art->regionid = RGN_TYPE_HEADER;
art->prefsizey = HEADERY;
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_HEADER;
art->init = outliner_header_region_init;
art->draw = outliner_header_region_draw;
art->free = outliner_header_region_free;
art->listener = outliner_header_region_listener;
BLI_addhead(&st->regiontypes, art);
BKE_spacetype_register(st);
} | [
"void",
"ED_spacetype_outliner",
"(",
"void",
")",
"{",
"SpaceType",
"*",
"st",
"=",
"MEM_callocN",
"(",
"sizeof",
"(",
"SpaceType",
")",
",",
"\"",
"\"",
")",
";",
"ARegionType",
"*",
"art",
";",
"st",
"->",
"spaceid",
"=",
"SPACE_OUTLINER",
";",
"strncpy",
"(",
"st",
"->",
"name",
",",
"\"",
"\"",
",",
"BKE_ST_MAXNAME",
")",
";",
"st",
"->",
"new",
"=",
"outliner_new",
";",
"st",
"->",
"free",
"=",
"outliner_free",
";",
"st",
"->",
"init",
"=",
"outliner_init",
";",
"st",
"->",
"duplicate",
"=",
"outliner_duplicate",
";",
"st",
"->",
"operatortypes",
"=",
"outliner_operatortypes",
";",
"st",
"->",
"keymap",
"=",
"outliner_keymap",
";",
"st",
"->",
"dropboxes",
"=",
"outliner_dropboxes",
";",
"st",
"->",
"id_remap",
"=",
"outliner_id_remap",
";",
"st",
"->",
"deactivate",
"=",
"outliner_deactivate",
";",
"art",
"=",
"MEM_callocN",
"(",
"sizeof",
"(",
"ARegionType",
")",
",",
"\"",
"\"",
")",
";",
"art",
"->",
"regionid",
"=",
"RGN_TYPE_WINDOW",
";",
"art",
"->",
"keymapflag",
"=",
"ED_KEYMAP_UI",
"|",
"ED_KEYMAP_VIEW2D",
";",
"art",
"->",
"init",
"=",
"outliner_main_region_init",
";",
"art",
"->",
"draw",
"=",
"outliner_main_region_draw",
";",
"art",
"->",
"free",
"=",
"outliner_main_region_free",
";",
"art",
"->",
"listener",
"=",
"outliner_main_region_listener",
";",
"art",
"->",
"message_subscribe",
"=",
"outliner_main_region_message_subscribe",
";",
"BLI_addhead",
"(",
"&",
"st",
"->",
"regiontypes",
",",
"art",
")",
";",
"art",
"=",
"MEM_callocN",
"(",
"sizeof",
"(",
"ARegionType",
")",
",",
"\"",
"\"",
")",
";",
"art",
"->",
"regionid",
"=",
"RGN_TYPE_HEADER",
";",
"art",
"->",
"prefsizey",
"=",
"HEADERY",
";",
"art",
"->",
"keymapflag",
"=",
"ED_KEYMAP_UI",
"|",
"ED_KEYMAP_VIEW2D",
"|",
"ED_KEYMAP_HEADER",
";",
"art",
"->",
"init",
"=",
"outliner_header_region_init",
";",
"art",
"->",
"draw",
"=",
"outliner_header_region_draw",
";",
"art",
"->",
"free",
"=",
"outliner_header_region_free",
";",
"art",
"->",
"listener",
"=",
"outliner_header_region_listener",
";",
"BLI_addhead",
"(",
"&",
"st",
"->",
"regiontypes",
",",
"art",
")",
";",
"BKE_spacetype_register",
"(",
"st",
")",
";",
"}"
] | only called once, from space_api/spacetypes.c | [
"only",
"called",
"once",
"from",
"space_api",
"/",
"spacetypes",
".",
"c"
] | [
"/* regions: main window */",
"/* regions: header */"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
b56403dfb6d6db2754fd8b493d040332354db724 | DemonRem/blender | source/blender/blenkernel/intern/softbody.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | sb_deflect_face | int | static int sb_deflect_face(Object *ob,
float *actpos,
float *facenormal,
float *force,
float *cf,
float time,
float *vel,
float *intrusion)
{
float s_actpos[3];
int deflected;
copy_v3_v3(s_actpos, actpos);
deflected = sb_detect_vertex_collisionCached(
s_actpos, facenormal, cf, force, ob, time, vel, intrusion);
#if 0
deflected = sb_detect_vertex_collisionCachedEx(
s_actpos, facenormal, cf, force, ob, time, vel, intrusion);
#endif
return (deflected);
} | /* sandbox to plug in various deflection algos */ | sandbox to plug in various deflection algos | [
"sandbox",
"to",
"plug",
"in",
"various",
"deflection",
"algos"
] | static int sb_deflect_face(Object *ob,
float *actpos,
float *facenormal,
float *force,
float *cf,
float time,
float *vel,
float *intrusion)
{
float s_actpos[3];
int deflected;
copy_v3_v3(s_actpos, actpos);
deflected = sb_detect_vertex_collisionCached(
s_actpos, facenormal, cf, force, ob, time, vel, intrusion);
#if 0
deflected = sb_detect_vertex_collisionCachedEx(
s_actpos, facenormal, cf, force, ob, time, vel, intrusion);
#endif
return (deflected);
} | [
"static",
"int",
"sb_deflect_face",
"(",
"Object",
"*",
"ob",
",",
"float",
"*",
"actpos",
",",
"float",
"*",
"facenormal",
",",
"float",
"*",
"force",
",",
"float",
"*",
"cf",
",",
"float",
"time",
",",
"float",
"*",
"vel",
",",
"float",
"*",
"intrusion",
")",
"{",
"float",
"s_actpos",
"[",
"3",
"]",
";",
"int",
"deflected",
";",
"copy_v3_v3",
"(",
"s_actpos",
",",
"actpos",
")",
";",
"deflected",
"=",
"sb_detect_vertex_collisionCached",
"(",
"s_actpos",
",",
"facenormal",
",",
"cf",
",",
"force",
",",
"ob",
",",
"time",
",",
"vel",
",",
"intrusion",
")",
";",
"#if",
"0",
"\n",
"deflected",
"=",
"sb_detect_vertex_collisionCachedEx",
"(",
"s_actpos",
",",
"facenormal",
",",
"cf",
",",
"force",
",",
"ob",
",",
"time",
",",
"vel",
",",
"intrusion",
")",
";",
"#endif",
"return",
"(",
"deflected",
")",
";",
"}"
] | sandbox to plug in various deflection algos | [
"sandbox",
"to",
"plug",
"in",
"various",
"deflection",
"algos"
] | [] | [
{
"param": "ob",
"type": "Object"
},
{
"param": "actpos",
"type": "float"
},
{
"param": "facenormal",
"type": "float"
},
{
"param": "force",
"type": "float"
},
{
"param": "cf",
"type": "float"
},
{
"param": "time",
"type": "float"
},
{
"param": "vel",
"type": "float"
},
{
"param": "intrusion",
"type": "float"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ob",
"type": "Object",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "actpos",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "facenormal",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "force",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cf",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "time",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "vel",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "intrusion",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b56403dfb6d6db2754fd8b493d040332354db724 | DemonRem/blender | source/blender/blenkernel/intern/softbody.c | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | C | sbNew | SoftBody | SoftBody *sbNew(Scene *scene)
{
SoftBody *sb;
sb = MEM_callocN(sizeof(SoftBody), "softbody");
sb->mediafrict = 0.5f;
sb->nodemass = 1.0f;
sb->grav = 9.8f;
sb->physics_speed = 1.0f;
sb->rklimit = 0.1f;
sb->goalspring = 0.5f;
sb->goalfrict = 0.0f;
sb->mingoal = 0.0f;
sb->maxgoal = 1.0f;
sb->defgoal = 0.7f;
sb->inspring = 0.5f;
sb->infrict = 0.5f;
/*todo backward file compat should copy inspring to inpush while reading old files*/
sb->inpush = 0.5f;
sb->interval = 10;
sb->sfra = scene->r.sfra;
sb->efra = scene->r.efra;
sb->colball = 0.49f;
sb->balldamp = 0.50f;
sb->ballstiff = 1.0f;
sb->sbc_mode = 1;
sb->minloops = 10;
sb->maxloops = 300;
sb->choke = 3;
sb_new_scratch(sb);
/*todo backward file compat should set sb->shearstiff = 1.0f while reading old files*/
sb->shearstiff = 1.0f;
sb->solverflags |= SBSO_OLDERR;
sb->shared = MEM_callocN(sizeof(*sb->shared), "SoftBody_Shared");
sb->shared->pointcache = BKE_ptcache_add(&sb->shared->ptcaches);
if (!sb->effector_weights) {
sb->effector_weights = BKE_effector_add_weights(NULL);
}
sb->last_frame = MINFRAME - 1;
return sb;
} | /* allocates and initializes general main data */ | allocates and initializes general main data | [
"allocates",
"and",
"initializes",
"general",
"main",
"data"
] | SoftBody *sbNew(Scene *scene)
{
SoftBody *sb;
sb = MEM_callocN(sizeof(SoftBody), "softbody");
sb->mediafrict = 0.5f;
sb->nodemass = 1.0f;
sb->grav = 9.8f;
sb->physics_speed = 1.0f;
sb->rklimit = 0.1f;
sb->goalspring = 0.5f;
sb->goalfrict = 0.0f;
sb->mingoal = 0.0f;
sb->maxgoal = 1.0f;
sb->defgoal = 0.7f;
sb->inspring = 0.5f;
sb->infrict = 0.5f;
sb->inpush = 0.5f;
sb->interval = 10;
sb->sfra = scene->r.sfra;
sb->efra = scene->r.efra;
sb->colball = 0.49f;
sb->balldamp = 0.50f;
sb->ballstiff = 1.0f;
sb->sbc_mode = 1;
sb->minloops = 10;
sb->maxloops = 300;
sb->choke = 3;
sb_new_scratch(sb);
sb->shearstiff = 1.0f;
sb->solverflags |= SBSO_OLDERR;
sb->shared = MEM_callocN(sizeof(*sb->shared), "SoftBody_Shared");
sb->shared->pointcache = BKE_ptcache_add(&sb->shared->ptcaches);
if (!sb->effector_weights) {
sb->effector_weights = BKE_effector_add_weights(NULL);
}
sb->last_frame = MINFRAME - 1;
return sb;
} | [
"SoftBody",
"*",
"sbNew",
"(",
"Scene",
"*",
"scene",
")",
"{",
"SoftBody",
"*",
"sb",
";",
"sb",
"=",
"MEM_callocN",
"(",
"sizeof",
"(",
"SoftBody",
")",
",",
"\"",
"\"",
")",
";",
"sb",
"->",
"mediafrict",
"=",
"0.5f",
";",
"sb",
"->",
"nodemass",
"=",
"1.0f",
";",
"sb",
"->",
"grav",
"=",
"9.8f",
";",
"sb",
"->",
"physics_speed",
"=",
"1.0f",
";",
"sb",
"->",
"rklimit",
"=",
"0.1f",
";",
"sb",
"->",
"goalspring",
"=",
"0.5f",
";",
"sb",
"->",
"goalfrict",
"=",
"0.0f",
";",
"sb",
"->",
"mingoal",
"=",
"0.0f",
";",
"sb",
"->",
"maxgoal",
"=",
"1.0f",
";",
"sb",
"->",
"defgoal",
"=",
"0.7f",
";",
"sb",
"->",
"inspring",
"=",
"0.5f",
";",
"sb",
"->",
"infrict",
"=",
"0.5f",
";",
"sb",
"->",
"inpush",
"=",
"0.5f",
";",
"sb",
"->",
"interval",
"=",
"10",
";",
"sb",
"->",
"sfra",
"=",
"scene",
"->",
"r",
".",
"sfra",
";",
"sb",
"->",
"efra",
"=",
"scene",
"->",
"r",
".",
"efra",
";",
"sb",
"->",
"colball",
"=",
"0.49f",
";",
"sb",
"->",
"balldamp",
"=",
"0.50f",
";",
"sb",
"->",
"ballstiff",
"=",
"1.0f",
";",
"sb",
"->",
"sbc_mode",
"=",
"1",
";",
"sb",
"->",
"minloops",
"=",
"10",
";",
"sb",
"->",
"maxloops",
"=",
"300",
";",
"sb",
"->",
"choke",
"=",
"3",
";",
"sb_new_scratch",
"(",
"sb",
")",
";",
"sb",
"->",
"shearstiff",
"=",
"1.0f",
";",
"sb",
"->",
"solverflags",
"|=",
"SBSO_OLDERR",
";",
"sb",
"->",
"shared",
"=",
"MEM_callocN",
"(",
"sizeof",
"(",
"*",
"sb",
"->",
"shared",
")",
",",
"\"",
"\"",
")",
";",
"sb",
"->",
"shared",
"->",
"pointcache",
"=",
"BKE_ptcache_add",
"(",
"&",
"sb",
"->",
"shared",
"->",
"ptcaches",
")",
";",
"if",
"(",
"!",
"sb",
"->",
"effector_weights",
")",
"{",
"sb",
"->",
"effector_weights",
"=",
"BKE_effector_add_weights",
"(",
"NULL",
")",
";",
"}",
"sb",
"->",
"last_frame",
"=",
"MINFRAME",
"-",
"1",
";",
"return",
"sb",
";",
"}"
] | allocates and initializes general main data | [
"allocates",
"and",
"initializes",
"general",
"main",
"data"
] | [
"/*todo backward file compat should copy inspring to inpush while reading old files*/",
"/*todo backward file compat should set sb->shearstiff = 1.0f while reading old files*/"
] | [
{
"param": "scene",
"type": "Scene"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "scene",
"type": "Scene",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |