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
cc1b4868b979c31f78163582b3bb6568e3e1eda0
ViditGoel/ComputerGraphics
openGL_codes/FILL_ALGORITHM/Fill_Boundary.c
[ "MIT" ]
C
onMouseClick
void
void onMouseClick(int button, int state, int x, int y) { Color fillColor = {color.r, color.g , color.b}; // red color will be filled Color boundaryColor = {0.0f, 0.0f, 0.0f}; // black- boundary // Point p = {350,350}; //a point inside the square BoundaryFill(p.x, p.y, fillColor, boundaryColor); }
//Function 5: Mouse Click Function
Function 5: Mouse Click Function
[ "Function", "5", ":", "Mouse", "Click", "Function" ]
void onMouseClick(int button, int state, int x, int y) { Color fillColor = {color.r, color.g , color.b}; Color boundaryColor = {0.0f, 0.0f, 0.0f}; BoundaryFill(p.x, p.y, fillColor, boundaryColor); }
[ "void", "onMouseClick", "(", "int", "button", ",", "int", "state", ",", "int", "x", ",", "int", "y", ")", "{", "Color", "fillColor", "=", "{", "color", ".", "r", ",", "color", ".", "g", ",", "color", ".", "b", "}", ";", "Color", "boundaryColor", "=", "{", "0.0f", ",", "0.0f", ",", "0.0f", "}", ";", "BoundaryFill", "(", "p", ".", "x", ",", "p", ".", "y", ",", "fillColor", ",", "boundaryColor", ")", ";", "}" ]
Function 5: Mouse Click Function
[ "Function", "5", ":", "Mouse", "Click", "Function" ]
[ "// red color will be filled", "// black- boundary", "// Point p = {350,350}; //a point inside the square" ]
[ { "param": "button", "type": "int" }, { "param": "state", "type": "int" }, { "param": "x", "type": "int" }, { "param": "y", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "button", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "state", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "x", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "y", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
500f01ab370ba54ad921cbe6859bc4e6b287a4cc
ViditGoel/ComputerGraphics
openGL_codes/Transformation-3D/3D_Transformation.c
[ "MIT" ]
C
RotateX
void
void RotateX(float angle) { angle = angle*3.142/180; theMatrix[1][1] = cos(angle); theMatrix[1][2] = -sin(angle); theMatrix[2][1] = sin(angle); theMatrix[2][2] = cos(angle); }
//Rotation Function:****************************************** //Parallel to x-
Rotation Function: Parallel to x
[ "Rotation", "Function", ":", "Parallel", "to", "x" ]
void RotateX(float angle) { angle = angle*3.142/180; theMatrix[1][1] = cos(angle); theMatrix[1][2] = -sin(angle); theMatrix[2][1] = sin(angle); theMatrix[2][2] = cos(angle); }
[ "void", "RotateX", "(", "float", "angle", ")", "{", "angle", "=", "angle", "*", "3.142", "/", "180", ";", "theMatrix", "[", "1", "]", "[", "1", "]", "=", "cos", "(", "angle", ")", ";", "theMatrix", "[", "1", "]", "[", "2", "]", "=", "-", "sin", "(", "angle", ")", ";", "theMatrix", "[", "2", "]", "[", "1", "]", "=", "sin", "(", "angle", ")", ";", "theMatrix", "[", "2", "]", "[", "2", "]", "=", "cos", "(", "angle", ")", ";", "}" ]
Rotation Function: Parallel to x
[ "Rotation", "Function", ":", "Parallel", "to", "x" ]
[]
[ { "param": "angle", "type": "float" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "angle", "type": "float", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
500f01ab370ba54ad921cbe6859bc4e6b287a4cc
ViditGoel/ComputerGraphics
openGL_codes/Transformation-3D/3D_Transformation.c
[ "MIT" ]
C
Reflection_xy
void
void Reflection_xy() { for(int i=0;i<8;i++) { output[i][0]=input[i][0]; output[i][1]=input[i][1]; output[i][2]=-(input[i][2]); } }
//Reflection Function:****************************************************** //Reflection plane xy:
Reflection Function: Reflection plane xy.
[ "Reflection", "Function", ":", "Reflection", "plane", "xy", "." ]
void Reflection_xy() { for(int i=0;i<8;i++) { output[i][0]=input[i][0]; output[i][1]=input[i][1]; output[i][2]=-(input[i][2]); } }
[ "void", "Reflection_xy", "(", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "8", ";", "i", "++", ")", "{", "output", "[", "i", "]", "[", "0", "]", "=", "input", "[", "i", "]", "[", "0", "]", ";", "output", "[", "i", "]", "[", "1", "]", "=", "input", "[", "i", "]", "[", "1", "]", ";", "output", "[", "i", "]", "[", "2", "]", "=", "-", "(", "input", "[", "i", "]", "[", "2", "]", ")", ";", "}", "}" ]
Reflection Function: Reflection plane xy:
[ "Reflection", "Function", ":", "Reflection", "plane", "xy", ":" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
500f01ab370ba54ad921cbe6859bc4e6b287a4cc
ViditGoel/ComputerGraphics
openGL_codes/Transformation-3D/3D_Transformation.c
[ "MIT" ]
C
Axes
void
void Axes(void) { glColor3f (0.0, 0.0, 0.0); // Set the color to BLACK glBegin(GL_LINES); // Plotting X-Axis glVertex2s(-1000 ,0); glVertex2s( 1000 ,0); glEnd(); glBegin(GL_LINES); // Plotting Y-Axis glVertex2s(0 ,-1000); glVertex2s(0 , 1000); glEnd(); }
//X and Y axis lines Black Line:*********************************************
X and Y axis lines Black Line.
[ "X", "and", "Y", "axis", "lines", "Black", "Line", "." ]
void Axes(void) { glColor3f (0.0, 0.0, 0.0); glBegin(GL_LINES); glVertex2s(-1000 ,0); glVertex2s( 1000 ,0); glEnd(); glBegin(GL_LINES); glVertex2s(0 ,-1000); glVertex2s(0 , 1000); glEnd(); }
[ "void", "Axes", "(", "void", ")", "{", "glColor3f", "(", "0.0", ",", "0.0", ",", "0.0", ")", ";", "glBegin", "(", "GL_LINES", ")", ";", "glVertex2s", "(", "-1000", ",", "0", ")", ";", "glVertex2s", "(", "1000", ",", "0", ")", ";", "glEnd", "(", ")", ";", "glBegin", "(", "GL_LINES", ")", ";", "glVertex2s", "(", "0", ",", "-1000", ")", ";", "glVertex2s", "(", "0", ",", "1000", ")", ";", "glEnd", "(", ")", ";", "}" ]
X and Y axis lines Black Line:
[ "X", "and", "Y", "axis", "lines", "Black", "Line", ":" ]
[ "// Set the color to BLACK", "// Plotting X-Axis", "// Plotting Y-Axis" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
1edf7653c719a96b7e3d363da6ba158a41d70d0e
DemonRem/blender
source/blender/blenlib/BLI_map.h
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
reserve
void
void reserve(uint min_usable_slots) { if (m_array.slots_usable() < min_usable_slots) { this->grow(min_usable_slots); } }
/** * Allocate memory such that at least min_usable_slots can be added before the map has to grow * again. */
Allocate memory such that at least min_usable_slots can be added before the map has to grow again.
[ "Allocate", "memory", "such", "that", "at", "least", "min_usable_slots", "can", "be", "added", "before", "the", "map", "has", "to", "grow", "again", "." ]
void reserve(uint min_usable_slots) { if (m_array.slots_usable() < min_usable_slots) { this->grow(min_usable_slots); } }
[ "void", "reserve", "(", "uint", "min_usable_slots", ")", "{", "if", "(", "m_array", ".", "slots_usable", "(", ")", "<", "min_usable_slots", ")", "{", "this", "->", "grow", "(", "min_usable_slots", ")", ";", "}", "}" ]
Allocate memory such that at least min_usable_slots can be added before the map has to grow again.
[ "Allocate", "memory", "such", "that", "at", "least", "min_usable_slots", "can", "be", "added", "before", "the", "map", "has", "to", "grow", "again", "." ]
[]
[ { "param": "min_usable_slots", "type": "uint" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "min_usable_slots", "type": "uint", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a73e4034ca6918f39c176e3a4a4e133154f86227
DemonRem/blender
source/blender/python/intern/bpy_interface.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BPY_context_update
void
void BPY_context_update(bContext *C) { /* don't do this from a non-main (e.g. render) thread, it can cause a race * condition on C->data.recursion. ideal solution would be to disable * context entirely from non-main threads, but that's more complicated */ if (!BLI_thread_is_main()) { return; } BPy_SetContext(C); BPY_modules_update(C); /* can give really bad results if this isn't here */ }
/* use for updating while a python script runs - in case of file load */
use for updating while a python script runs - in case of file load
[ "use", "for", "updating", "while", "a", "python", "script", "runs", "-", "in", "case", "of", "file", "load" ]
void BPY_context_update(bContext *C) { if (!BLI_thread_is_main()) { return; } BPy_SetContext(C); BPY_modules_update(C); }
[ "void", "BPY_context_update", "(", "bContext", "*", "C", ")", "{", "if", "(", "!", "BLI_thread_is_main", "(", ")", ")", "{", "return", ";", "}", "BPy_SetContext", "(", "C", ")", ";", "BPY_modules_update", "(", "C", ")", ";", "}" ]
use for updating while a python script runs - in case of file load
[ "use", "for", "updating", "while", "a", "python", "script", "runs", "-", "in", "case", "of", "file", "load" ]
[ "/* don't do this from a non-main (e.g. render) thread, it can cause a race\n * condition on C->data.recursion. ideal solution would be to disable\n * context entirely from non-main threads, but that's more complicated */", "/* can give really bad results if this isn't here */" ]
[ { "param": "C", "type": "bContext" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "C", "type": "bContext", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a73e4034ca6918f39c176e3a4a4e133154f86227
DemonRem/blender
source/blender/python/intern/bpy_interface.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
bpy_context_clear
void
void bpy_context_clear(bContext *UNUSED(C), PyGILState_STATE *gilstate) { py_call_level--; if (gilstate) { PyGILState_Release(*gilstate); } if (py_call_level < 0) { fprintf(stderr, "ERROR: Python context internal state bug. this should not happen!\n"); } else if (py_call_level == 0) { /* XXX - Calling classes currently wont store the context :\, * cant set NULL because of this. but this is very flakey still. */ #if 0 BPy_SetContext(NULL); #endif #ifdef TIME_PY_RUN bpy_timer_run_tot += PIL_check_seconds_timer() - bpy_timer_run; bpy_timer_count++; #endif } }
/* context should be used but not now because it causes some bugs */
context should be used but not now because it causes some bugs
[ "context", "should", "be", "used", "but", "not", "now", "because", "it", "causes", "some", "bugs" ]
void bpy_context_clear(bContext *UNUSED(C), PyGILState_STATE *gilstate) { py_call_level--; if (gilstate) { PyGILState_Release(*gilstate); } if (py_call_level < 0) { fprintf(stderr, "ERROR: Python context internal state bug. this should not happen!\n"); } else if (py_call_level == 0) { #if 0 BPy_SetContext(NULL); #endif #ifdef TIME_PY_RUN bpy_timer_run_tot += PIL_check_seconds_timer() - bpy_timer_run; bpy_timer_count++; #endif } }
[ "void", "bpy_context_clear", "(", "bContext", "*", "UNUSED", "(", "C", ")", ",", "PyGILState_STATE", "*", "gilstate", ")", "{", "py_call_level", "--", ";", "if", "(", "gilstate", ")", "{", "PyGILState_Release", "(", "*", "gilstate", ")", ";", "}", "if", "(", "py_call_level", "<", "0", ")", "{", "fprintf", "(", "stderr", ",", "\"", "\\n", "\"", ")", ";", "}", "else", "if", "(", "py_call_level", "==", "0", ")", "{", "#if", "0", "\n", "BPy_SetContext", "(", "NULL", ")", ";", "#endif", "#ifdef", "TIME_PY_RUN", "bpy_timer_run_tot", "+=", "PIL_check_seconds_timer", "(", ")", "-", "bpy_timer_run", ";", "bpy_timer_count", "++", ";", "#endif", "}", "}" ]
context should be used but not now because it causes some bugs
[ "context", "should", "be", "used", "but", "not", "now", "because", "it", "causes", "some", "bugs" ]
[ "/* XXX - Calling classes currently wont store the context :\\,\n * cant set NULL because of this. but this is very flakey still. */" ]
[ { "param": "UNUSED", "type": "bContext" }, { "param": "gilstate", "type": "PyGILState_STATE" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "UNUSED", "type": "bContext", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "gilstate", "type": "PyGILState_STATE", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a73e4034ca6918f39c176e3a4a4e133154f86227
DemonRem/blender
source/blender/python/intern/bpy_interface.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BPY_execute_string_as_intptr
bool
bool BPY_execute_string_as_intptr( bContext *C, const char *imports[], const char *expr, const bool verbose, intptr_t *r_value) { BLI_assert(r_value && expr); PyGILState_STATE gilstate; bool ok = true; if (expr[0] == '\0') { *r_value = 0; return ok; } bpy_context_set(C, &gilstate); ok = PyC_RunString_AsIntPtr(imports, expr, "<expr as intptr>", r_value); if (ok == false) { if (verbose) { BPy_errors_to_report_ex(CTX_wm_reports(C), false, false); } else { PyErr_Clear(); } } bpy_context_clear(C, &gilstate); return ok; }
/** * Support both int and pointers. * * \return success */
Support both int and pointers. \return success
[ "Support", "both", "int", "and", "pointers", ".", "\\", "return", "success" ]
bool BPY_execute_string_as_intptr( bContext *C, const char *imports[], const char *expr, const bool verbose, intptr_t *r_value) { BLI_assert(r_value && expr); PyGILState_STATE gilstate; bool ok = true; if (expr[0] == '\0') { *r_value = 0; return ok; } bpy_context_set(C, &gilstate); ok = PyC_RunString_AsIntPtr(imports, expr, "<expr as intptr>", r_value); if (ok == false) { if (verbose) { BPy_errors_to_report_ex(CTX_wm_reports(C), false, false); } else { PyErr_Clear(); } } bpy_context_clear(C, &gilstate); return ok; }
[ "bool", "BPY_execute_string_as_intptr", "(", "bContext", "*", "C", ",", "const", "char", "*", "imports", "[", "]", ",", "const", "char", "*", "expr", ",", "const", "bool", "verbose", ",", "intptr_t", "*", "r_value", ")", "{", "BLI_assert", "(", "r_value", "&&", "expr", ")", ";", "PyGILState_STATE", "gilstate", ";", "bool", "ok", "=", "true", ";", "if", "(", "expr", "[", "0", "]", "==", "'", "\\0", "'", ")", "{", "*", "r_value", "=", "0", ";", "return", "ok", ";", "}", "bpy_context_set", "(", "C", ",", "&", "gilstate", ")", ";", "ok", "=", "PyC_RunString_AsIntPtr", "(", "imports", ",", "expr", ",", "\"", "\"", ",", "r_value", ")", ";", "if", "(", "ok", "==", "false", ")", "{", "if", "(", "verbose", ")", "{", "BPy_errors_to_report_ex", "(", "CTX_wm_reports", "(", "C", ")", ",", "false", ",", "false", ")", ";", "}", "else", "{", "PyErr_Clear", "(", ")", ";", "}", "}", "bpy_context_clear", "(", "C", ",", "&", "gilstate", ")", ";", "return", "ok", ";", "}" ]
Support both int and pointers.
[ "Support", "both", "int", "and", "pointers", "." ]
[]
[ { "param": "C", "type": "bContext" }, { "param": "imports", "type": "char" }, { "param": "expr", "type": "char" }, { "param": "verbose", "type": "bool" }, { "param": "r_value", "type": "intptr_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "C", "type": "bContext", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "imports", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "expr", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "verbose", "type": "bool", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "r_value", "type": "intptr_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a73e4034ca6918f39c176e3a4a4e133154f86227
DemonRem/blender
source/blender/python/intern/bpy_interface.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
dealloc_obj_dealloc
void
static void dealloc_obj_dealloc(PyObject *self) { bpy_module_delay_init(((dealloc_obj *)self)->mod); /* Note, for subclassed PyObjects we cant just call PyObject_DEL() directly or it will crash */ dealloc_obj_Type.tp_free(self); }
/* use our own dealloc so we can free a property if we use one */
use our own dealloc so we can free a property if we use one
[ "use", "our", "own", "dealloc", "so", "we", "can", "free", "a", "property", "if", "we", "use", "one" ]
static void dealloc_obj_dealloc(PyObject *self) { bpy_module_delay_init(((dealloc_obj *)self)->mod); dealloc_obj_Type.tp_free(self); }
[ "static", "void", "dealloc_obj_dealloc", "(", "PyObject", "*", "self", ")", "{", "bpy_module_delay_init", "(", "(", "(", "dealloc_obj", "*", ")", "self", ")", "->", "mod", ")", ";", "dealloc_obj_Type", ".", "tp_free", "(", "self", ")", ";", "}" ]
use our own dealloc so we can free a property if we use one
[ "use", "our", "own", "dealloc", "so", "we", "can", "free", "a", "property", "if", "we", "use", "one" ]
[ "/* Note, for subclassed PyObjects we cant just call PyObject_DEL() directly or it will crash */" ]
[ { "param": "self", "type": "PyObject" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": "PyObject", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a42ab048907fe677adbe1b44acd730987fe3017c
DemonRem/blender
source/blender/editors/space_userpref/space_userpref.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
userpref_navigation_region_init
void
static void userpref_navigation_region_init(wmWindowManager *wm, ARegion *ar) { ar->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE; ED_region_panels_init(wm, ar); }
/* add handlers, stuff you only do once or on area/region changes */
add handlers, stuff you only do once or on area/region changes
[ "add", "handlers", "stuff", "you", "only", "do", "once", "or", "on", "area", "/", "region", "changes" ]
static void userpref_navigation_region_init(wmWindowManager *wm, ARegion *ar) { ar->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE; ED_region_panels_init(wm, ar); }
[ "static", "void", "userpref_navigation_region_init", "(", "wmWindowManager", "*", "wm", ",", "ARegion", "*", "ar", ")", "{", "ar", "->", "v2d", ".", "scroll", "=", "V2D_SCROLL_RIGHT", "|", "V2D_SCROLL_VERTICAL_HIDE", ";", "ED_region_panels_init", "(", "wm", ",", "ar", ")", ";", "}" ]
add handlers, stuff you only do once or on area/region changes
[ "add", "handlers", "stuff", "you", "only", "do", "once", "or", "on", "area", "/", "region", "changes" ]
[]
[ { "param": "wm", "type": "wmWindowManager" }, { "param": "ar", "type": "ARegion" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "wm", "type": "wmWindowManager", "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": [] }
a42ab048907fe677adbe1b44acd730987fe3017c
DemonRem/blender
source/blender/editors/space_userpref/space_userpref.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
userpref_execute_region_init
void
static void userpref_execute_region_init(wmWindowManager *wm, ARegion *ar) { ED_region_panels_init(wm, ar); ar->v2d.keepzoom |= V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y; }
/* add handlers, stuff you only do once or on area/region changes */
add handlers, stuff you only do once or on area/region changes
[ "add", "handlers", "stuff", "you", "only", "do", "once", "or", "on", "area", "/", "region", "changes" ]
static void userpref_execute_region_init(wmWindowManager *wm, ARegion *ar) { ED_region_panels_init(wm, ar); ar->v2d.keepzoom |= V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y; }
[ "static", "void", "userpref_execute_region_init", "(", "wmWindowManager", "*", "wm", ",", "ARegion", "*", "ar", ")", "{", "ED_region_panels_init", "(", "wm", ",", "ar", ")", ";", "ar", "->", "v2d", ".", "keepzoom", "|=", "V2D_LOCKZOOM_X", "|", "V2D_LOCKZOOM_Y", ";", "}" ]
add handlers, stuff you only do once or on area/region changes
[ "add", "handlers", "stuff", "you", "only", "do", "once", "or", "on", "area", "/", "region", "changes" ]
[]
[ { "param": "wm", "type": "wmWindowManager" }, { "param": "ar", "type": "ARegion" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "wm", "type": "wmWindowManager", "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": [] }
a42ab048907fe677adbe1b44acd730987fe3017c
DemonRem/blender
source/blender/editors/space_userpref/space_userpref.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
ED_spacetype_userpref
void
void ED_spacetype_userpref(void) { SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype userpref"); ARegionType *art; st->spaceid = SPACE_USERPREF; strncpy(st->name, "Userpref", BKE_ST_MAXNAME); st->new = userpref_new; st->free = userpref_free; st->init = userpref_init; st->duplicate = userpref_duplicate; st->operatortypes = userpref_operatortypes; st->keymap = userpref_keymap; /* regions: main window */ art = MEM_callocN(sizeof(ARegionType), "spacetype userpref region"); art->regionid = RGN_TYPE_WINDOW; art->init = userpref_main_region_init; art->draw = userpref_main_region_draw; art->listener = userpref_main_region_listener; art->keymapflag = ED_KEYMAP_UI; BLI_addhead(&st->regiontypes, art); /* regions: header */ art = MEM_callocN(sizeof(ARegionType), "spacetype userpref region"); art->regionid = RGN_TYPE_HEADER; art->prefsizey = HEADERY; art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_HEADER; art->listener = userpref_header_listener; art->init = userpref_header_region_init; art->draw = userpref_header_region_draw; BLI_addhead(&st->regiontypes, art); /* regions: navigation window */ art = MEM_callocN(sizeof(ARegionType), "spacetype userpref region"); art->regionid = RGN_TYPE_NAV_BAR; art->prefsizex = UI_NAVIGATION_REGION_WIDTH; art->init = userpref_navigation_region_init; art->draw = userpref_navigation_region_draw; art->listener = userpref_navigation_region_listener; art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_NAVBAR; BLI_addhead(&st->regiontypes, art); /* regions: execution window */ art = MEM_callocN(sizeof(ARegionType), "spacetype userpref region"); art->regionid = RGN_TYPE_EXECUTE; art->init = userpref_execute_region_init; art->layout = ED_region_panels_layout; art->draw = ED_region_panels_draw; art->listener = userpref_execute_region_listener; art->keymapflag = ED_KEYMAP_UI; BLI_addhead(&st->regiontypes, art); BKE_spacetype_register(st); }
/* only called once, from space/spacetypes.c */
only called once, from space/spacetypes.c
[ "only", "called", "once", "from", "space", "/", "spacetypes", ".", "c" ]
void ED_spacetype_userpref(void) { SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype userpref"); ARegionType *art; st->spaceid = SPACE_USERPREF; strncpy(st->name, "Userpref", BKE_ST_MAXNAME); st->new = userpref_new; st->free = userpref_free; st->init = userpref_init; st->duplicate = userpref_duplicate; st->operatortypes = userpref_operatortypes; st->keymap = userpref_keymap; art = MEM_callocN(sizeof(ARegionType), "spacetype userpref region"); art->regionid = RGN_TYPE_WINDOW; art->init = userpref_main_region_init; art->draw = userpref_main_region_draw; art->listener = userpref_main_region_listener; art->keymapflag = ED_KEYMAP_UI; BLI_addhead(&st->regiontypes, art); art = MEM_callocN(sizeof(ARegionType), "spacetype userpref region"); art->regionid = RGN_TYPE_HEADER; art->prefsizey = HEADERY; art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_HEADER; art->listener = userpref_header_listener; art->init = userpref_header_region_init; art->draw = userpref_header_region_draw; BLI_addhead(&st->regiontypes, art); art = MEM_callocN(sizeof(ARegionType), "spacetype userpref region"); art->regionid = RGN_TYPE_NAV_BAR; art->prefsizex = UI_NAVIGATION_REGION_WIDTH; art->init = userpref_navigation_region_init; art->draw = userpref_navigation_region_draw; art->listener = userpref_navigation_region_listener; art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_NAVBAR; BLI_addhead(&st->regiontypes, art); art = MEM_callocN(sizeof(ARegionType), "spacetype userpref region"); art->regionid = RGN_TYPE_EXECUTE; art->init = userpref_execute_region_init; art->layout = ED_region_panels_layout; art->draw = ED_region_panels_draw; art->listener = userpref_execute_region_listener; art->keymapflag = ED_KEYMAP_UI; BLI_addhead(&st->regiontypes, art); BKE_spacetype_register(st); }
[ "void", "ED_spacetype_userpref", "(", "void", ")", "{", "SpaceType", "*", "st", "=", "MEM_callocN", "(", "sizeof", "(", "SpaceType", ")", ",", "\"", "\"", ")", ";", "ARegionType", "*", "art", ";", "st", "->", "spaceid", "=", "SPACE_USERPREF", ";", "strncpy", "(", "st", "->", "name", ",", "\"", "\"", ",", "BKE_ST_MAXNAME", ")", ";", "st", "->", "new", "=", "userpref_new", ";", "st", "->", "free", "=", "userpref_free", ";", "st", "->", "init", "=", "userpref_init", ";", "st", "->", "duplicate", "=", "userpref_duplicate", ";", "st", "->", "operatortypes", "=", "userpref_operatortypes", ";", "st", "->", "keymap", "=", "userpref_keymap", ";", "art", "=", "MEM_callocN", "(", "sizeof", "(", "ARegionType", ")", ",", "\"", "\"", ")", ";", "art", "->", "regionid", "=", "RGN_TYPE_WINDOW", ";", "art", "->", "init", "=", "userpref_main_region_init", ";", "art", "->", "draw", "=", "userpref_main_region_draw", ";", "art", "->", "listener", "=", "userpref_main_region_listener", ";", "art", "->", "keymapflag", "=", "ED_KEYMAP_UI", ";", "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", "->", "listener", "=", "userpref_header_listener", ";", "art", "->", "init", "=", "userpref_header_region_init", ";", "art", "->", "draw", "=", "userpref_header_region_draw", ";", "BLI_addhead", "(", "&", "st", "->", "regiontypes", ",", "art", ")", ";", "art", "=", "MEM_callocN", "(", "sizeof", "(", "ARegionType", ")", ",", "\"", "\"", ")", ";", "art", "->", "regionid", "=", "RGN_TYPE_NAV_BAR", ";", "art", "->", "prefsizex", "=", "UI_NAVIGATION_REGION_WIDTH", ";", "art", "->", "init", "=", "userpref_navigation_region_init", ";", "art", "->", "draw", "=", "userpref_navigation_region_draw", ";", "art", "->", "listener", "=", "userpref_navigation_region_listener", ";", "art", "->", "keymapflag", "=", "ED_KEYMAP_UI", "|", "ED_KEYMAP_NAVBAR", ";", "BLI_addhead", "(", "&", "st", "->", "regiontypes", ",", "art", ")", ";", "art", "=", "MEM_callocN", "(", "sizeof", "(", "ARegionType", ")", ",", "\"", "\"", ")", ";", "art", "->", "regionid", "=", "RGN_TYPE_EXECUTE", ";", "art", "->", "init", "=", "userpref_execute_region_init", ";", "art", "->", "layout", "=", "ED_region_panels_layout", ";", "art", "->", "draw", "=", "ED_region_panels_draw", ";", "art", "->", "listener", "=", "userpref_execute_region_listener", ";", "art", "->", "keymapflag", "=", "ED_KEYMAP_UI", ";", "BLI_addhead", "(", "&", "st", "->", "regiontypes", ",", "art", ")", ";", "BKE_spacetype_register", "(", "st", ")", ";", "}" ]
only called once, from space/spacetypes.c
[ "only", "called", "once", "from", "space", "/", "spacetypes", ".", "c" ]
[ "/* regions: main window */", "/* regions: header */", "/* regions: navigation window */", "/* regions: execution window */" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
0accbe607eb4fa4b247f17da61f1f27f618a769e
DemonRem/blender
source/blender/modifiers/intern/MOD_weighted_normal.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
modepair_cmp_by_val_inverse
int
static int modepair_cmp_by_val_inverse(const void *p1, const void *p2) { ModePair *r1 = (ModePair *)p1; ModePair *r2 = (ModePair *)p2; return (r1->val < r2->val) ? 1 : ((r1->val > r2->val) ? -1 : 0); }
/* Sorting function used in modifier, sorts in decreasing order. */
Sorting function used in modifier, sorts in decreasing order.
[ "Sorting", "function", "used", "in", "modifier", "sorts", "in", "decreasing", "order", "." ]
static int modepair_cmp_by_val_inverse(const void *p1, const void *p2) { ModePair *r1 = (ModePair *)p1; ModePair *r2 = (ModePair *)p2; return (r1->val < r2->val) ? 1 : ((r1->val > r2->val) ? -1 : 0); }
[ "static", "int", "modepair_cmp_by_val_inverse", "(", "const", "void", "*", "p1", ",", "const", "void", "*", "p2", ")", "{", "ModePair", "*", "r1", "=", "(", "ModePair", "*", ")", "p1", ";", "ModePair", "*", "r2", "=", "(", "ModePair", "*", ")", "p2", ";", "return", "(", "r1", "->", "val", "<", "r2", "->", "val", ")", "?", "1", ":", "(", "(", "r1", "->", "val", ">", "r2", "->", "val", ")", "?", "-1", ":", "0", ")", ";", "}" ]
Sorting function used in modifier, sorts in decreasing order.
[ "Sorting", "function", "used", "in", "modifier", "sorts", "in", "decreasing", "order", "." ]
[]
[ { "param": "p1", "type": "void" }, { "param": "p2", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "p1", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "p2", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0accbe607eb4fa4b247f17da61f1f27f618a769e
DemonRem/blender
source/blender/modifiers/intern/MOD_weighted_normal.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
check_item_poly_strength
bool
static bool check_item_poly_strength(WeightedNormalData *wn_data, WeightedNormalDataAggregateItem *item_data, const int mp_index) { BLI_assert(wn_data->poly_strength != NULL); const int mp_strength = wn_data->poly_strength[mp_index]; if (mp_strength > item_data->curr_strength) { item_data->curr_strength = mp_strength; item_data->curr_val = 0.0f; item_data->num_loops = 0; zero_v3(item_data->normal); } return mp_strength == item_data->curr_strength; }
/** * Check strength of given poly compared to those found so far for that given item * (vertex or smooth fan), and reset matching item_data in case we get a stronger new strength. */
Check strength of given poly compared to those found so far for that given item (vertex or smooth fan), and reset matching item_data in case we get a stronger new strength.
[ "Check", "strength", "of", "given", "poly", "compared", "to", "those", "found", "so", "far", "for", "that", "given", "item", "(", "vertex", "or", "smooth", "fan", ")", "and", "reset", "matching", "item_data", "in", "case", "we", "get", "a", "stronger", "new", "strength", "." ]
static bool check_item_poly_strength(WeightedNormalData *wn_data, WeightedNormalDataAggregateItem *item_data, const int mp_index) { BLI_assert(wn_data->poly_strength != NULL); const int mp_strength = wn_data->poly_strength[mp_index]; if (mp_strength > item_data->curr_strength) { item_data->curr_strength = mp_strength; item_data->curr_val = 0.0f; item_data->num_loops = 0; zero_v3(item_data->normal); } return mp_strength == item_data->curr_strength; }
[ "static", "bool", "check_item_poly_strength", "(", "WeightedNormalData", "*", "wn_data", ",", "WeightedNormalDataAggregateItem", "*", "item_data", ",", "const", "int", "mp_index", ")", "{", "BLI_assert", "(", "wn_data", "->", "poly_strength", "!=", "NULL", ")", ";", "const", "int", "mp_strength", "=", "wn_data", "->", "poly_strength", "[", "mp_index", "]", ";", "if", "(", "mp_strength", ">", "item_data", "->", "curr_strength", ")", "{", "item_data", "->", "curr_strength", "=", "mp_strength", ";", "item_data", "->", "curr_val", "=", "0.0f", ";", "item_data", "->", "num_loops", "=", "0", ";", "zero_v3", "(", "item_data", "->", "normal", ")", ";", "}", "return", "mp_strength", "==", "item_data", "->", "curr_strength", ";", "}" ]
Check strength of given poly compared to those found so far for that given item (vertex or smooth fan), and reset matching item_data in case we get a stronger new strength.
[ "Check", "strength", "of", "given", "poly", "compared", "to", "those", "found", "so", "far", "for", "that", "given", "item", "(", "vertex", "or", "smooth", "fan", ")", "and", "reset", "matching", "item_data", "in", "case", "we", "get", "a", "stronger", "new", "strength", "." ]
[]
[ { "param": "wn_data", "type": "WeightedNormalData" }, { "param": "item_data", "type": "WeightedNormalDataAggregateItem" }, { "param": "mp_index", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "wn_data", "type": "WeightedNormalData", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "item_data", "type": "WeightedNormalDataAggregateItem", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "mp_index", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
8e796a7981a3826518b94381414a10f9a28c9edd
DemonRem/blender
source/blender/windowmanager/intern/wm_cursors.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
convert_to_ghost_standard_cursor
GHOST_TStandardCursor
static GHOST_TStandardCursor convert_to_ghost_standard_cursor(WMCursorType curs) { switch (curs) { case WM_CURSOR_DEFAULT: return GHOST_kStandardCursorDefault; case WM_CURSOR_WAIT: return GHOST_kStandardCursorWait; case WM_CURSOR_EDIT: case WM_CURSOR_CROSS: return GHOST_kStandardCursorCrosshair; case WM_CURSOR_X_MOVE: return GHOST_kStandardCursorLeftRight; case WM_CURSOR_Y_MOVE: return GHOST_kStandardCursorUpDown; case WM_CURSOR_COPY: return GHOST_kStandardCursorCopy; case WM_CURSOR_HAND: return GHOST_kStandardCursorMove; case WM_CURSOR_H_SPLIT: return GHOST_kStandardCursorHorizontalSplit; case WM_CURSOR_V_SPLIT: return GHOST_kStandardCursorVerticalSplit; case WM_CURSOR_STOP: return GHOST_kStandardCursorStop; case WM_CURSOR_KNIFE: return GHOST_kStandardCursorKnife; case WM_CURSOR_NSEW_SCROLL: return GHOST_kStandardCursorNSEWScroll; case WM_CURSOR_NS_SCROLL: return GHOST_kStandardCursorNSScroll; case WM_CURSOR_EW_SCROLL: return GHOST_kStandardCursorEWScroll; case WM_CURSOR_EYEDROPPER: return GHOST_kStandardCursorEyedropper; case WM_CURSOR_N_ARROW: return GHOST_kStandardCursorUpArrow; case WM_CURSOR_S_ARROW: return GHOST_kStandardCursorDownArrow; case WM_CURSOR_PAINT: return GHOST_kStandardCursorCrosshairA; case WM_CURSOR_DOT: return GHOST_kStandardCursorCrosshairB; case WM_CURSOR_CROSSC: return GHOST_kStandardCursorCrosshairC; case WM_CURSOR_ERASER: return GHOST_kStandardCursorEraser; case WM_CURSOR_ZOOM_IN: return GHOST_kStandardCursorZoomIn; case WM_CURSOR_ZOOM_OUT: return GHOST_kStandardCursorZoomOut; case WM_CURSOR_TEXT_EDIT: return GHOST_kStandardCursorText; case WM_CURSOR_PAINT_BRUSH: return GHOST_kStandardCursorPencil; case WM_CURSOR_E_ARROW: return GHOST_kStandardCursorRightArrow; case WM_CURSOR_W_ARROW: return GHOST_kStandardCursorLeftArrow; default: return GHOST_kStandardCursorCustom; } }
/* Blender cursor to GHOST standard cursor conversion. */
Blender cursor to GHOST standard cursor conversion.
[ "Blender", "cursor", "to", "GHOST", "standard", "cursor", "conversion", "." ]
static GHOST_TStandardCursor convert_to_ghost_standard_cursor(WMCursorType curs) { switch (curs) { case WM_CURSOR_DEFAULT: return GHOST_kStandardCursorDefault; case WM_CURSOR_WAIT: return GHOST_kStandardCursorWait; case WM_CURSOR_EDIT: case WM_CURSOR_CROSS: return GHOST_kStandardCursorCrosshair; case WM_CURSOR_X_MOVE: return GHOST_kStandardCursorLeftRight; case WM_CURSOR_Y_MOVE: return GHOST_kStandardCursorUpDown; case WM_CURSOR_COPY: return GHOST_kStandardCursorCopy; case WM_CURSOR_HAND: return GHOST_kStandardCursorMove; case WM_CURSOR_H_SPLIT: return GHOST_kStandardCursorHorizontalSplit; case WM_CURSOR_V_SPLIT: return GHOST_kStandardCursorVerticalSplit; case WM_CURSOR_STOP: return GHOST_kStandardCursorStop; case WM_CURSOR_KNIFE: return GHOST_kStandardCursorKnife; case WM_CURSOR_NSEW_SCROLL: return GHOST_kStandardCursorNSEWScroll; case WM_CURSOR_NS_SCROLL: return GHOST_kStandardCursorNSScroll; case WM_CURSOR_EW_SCROLL: return GHOST_kStandardCursorEWScroll; case WM_CURSOR_EYEDROPPER: return GHOST_kStandardCursorEyedropper; case WM_CURSOR_N_ARROW: return GHOST_kStandardCursorUpArrow; case WM_CURSOR_S_ARROW: return GHOST_kStandardCursorDownArrow; case WM_CURSOR_PAINT: return GHOST_kStandardCursorCrosshairA; case WM_CURSOR_DOT: return GHOST_kStandardCursorCrosshairB; case WM_CURSOR_CROSSC: return GHOST_kStandardCursorCrosshairC; case WM_CURSOR_ERASER: return GHOST_kStandardCursorEraser; case WM_CURSOR_ZOOM_IN: return GHOST_kStandardCursorZoomIn; case WM_CURSOR_ZOOM_OUT: return GHOST_kStandardCursorZoomOut; case WM_CURSOR_TEXT_EDIT: return GHOST_kStandardCursorText; case WM_CURSOR_PAINT_BRUSH: return GHOST_kStandardCursorPencil; case WM_CURSOR_E_ARROW: return GHOST_kStandardCursorRightArrow; case WM_CURSOR_W_ARROW: return GHOST_kStandardCursorLeftArrow; default: return GHOST_kStandardCursorCustom; } }
[ "static", "GHOST_TStandardCursor", "convert_to_ghost_standard_cursor", "(", "WMCursorType", "curs", ")", "{", "switch", "(", "curs", ")", "{", "case", "WM_CURSOR_DEFAULT", ":", "return", "GHOST_kStandardCursorDefault", ";", "case", "WM_CURSOR_WAIT", ":", "return", "GHOST_kStandardCursorWait", ";", "case", "WM_CURSOR_EDIT", ":", "case", "WM_CURSOR_CROSS", ":", "return", "GHOST_kStandardCursorCrosshair", ";", "case", "WM_CURSOR_X_MOVE", ":", "return", "GHOST_kStandardCursorLeftRight", ";", "case", "WM_CURSOR_Y_MOVE", ":", "return", "GHOST_kStandardCursorUpDown", ";", "case", "WM_CURSOR_COPY", ":", "return", "GHOST_kStandardCursorCopy", ";", "case", "WM_CURSOR_HAND", ":", "return", "GHOST_kStandardCursorMove", ";", "case", "WM_CURSOR_H_SPLIT", ":", "return", "GHOST_kStandardCursorHorizontalSplit", ";", "case", "WM_CURSOR_V_SPLIT", ":", "return", "GHOST_kStandardCursorVerticalSplit", ";", "case", "WM_CURSOR_STOP", ":", "return", "GHOST_kStandardCursorStop", ";", "case", "WM_CURSOR_KNIFE", ":", "return", "GHOST_kStandardCursorKnife", ";", "case", "WM_CURSOR_NSEW_SCROLL", ":", "return", "GHOST_kStandardCursorNSEWScroll", ";", "case", "WM_CURSOR_NS_SCROLL", ":", "return", "GHOST_kStandardCursorNSScroll", ";", "case", "WM_CURSOR_EW_SCROLL", ":", "return", "GHOST_kStandardCursorEWScroll", ";", "case", "WM_CURSOR_EYEDROPPER", ":", "return", "GHOST_kStandardCursorEyedropper", ";", "case", "WM_CURSOR_N_ARROW", ":", "return", "GHOST_kStandardCursorUpArrow", ";", "case", "WM_CURSOR_S_ARROW", ":", "return", "GHOST_kStandardCursorDownArrow", ";", "case", "WM_CURSOR_PAINT", ":", "return", "GHOST_kStandardCursorCrosshairA", ";", "case", "WM_CURSOR_DOT", ":", "return", "GHOST_kStandardCursorCrosshairB", ";", "case", "WM_CURSOR_CROSSC", ":", "return", "GHOST_kStandardCursorCrosshairC", ";", "case", "WM_CURSOR_ERASER", ":", "return", "GHOST_kStandardCursorEraser", ";", "case", "WM_CURSOR_ZOOM_IN", ":", "return", "GHOST_kStandardCursorZoomIn", ";", "case", "WM_CURSOR_ZOOM_OUT", ":", "return", "GHOST_kStandardCursorZoomOut", ";", "case", "WM_CURSOR_TEXT_EDIT", ":", "return", "GHOST_kStandardCursorText", ";", "case", "WM_CURSOR_PAINT_BRUSH", ":", "return", "GHOST_kStandardCursorPencil", ";", "case", "WM_CURSOR_E_ARROW", ":", "return", "GHOST_kStandardCursorRightArrow", ";", "case", "WM_CURSOR_W_ARROW", ":", "return", "GHOST_kStandardCursorLeftArrow", ";", "default", ":", "return", "GHOST_kStandardCursorCustom", ";", "}", "}" ]
Blender cursor to GHOST standard cursor conversion.
[ "Blender", "cursor", "to", "GHOST", "standard", "cursor", "conversion", "." ]
[]
[ { "param": "curs", "type": "WMCursorType" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "curs", "type": "WMCursorType", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
8e796a7981a3826518b94381414a10f9a28c9edd
DemonRem/blender
source/blender/windowmanager/intern/wm_cursors.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
WM_cursor_wait
void
void WM_cursor_wait(bool val) { if (!G.background) { wmWindowManager *wm = G_MAIN->wm.first; wmWindow *win = wm ? wm->windows.first : NULL; for (; win; win = win->next) { if (val) { WM_cursor_modal_set(win, WM_CURSOR_WAIT); } else { WM_cursor_modal_restore(win); } } } }
/* to allow usage all over, we do entire WM */
to allow usage all over, we do entire WM
[ "to", "allow", "usage", "all", "over", "we", "do", "entire", "WM" ]
void WM_cursor_wait(bool val) { if (!G.background) { wmWindowManager *wm = G_MAIN->wm.first; wmWindow *win = wm ? wm->windows.first : NULL; for (; win; win = win->next) { if (val) { WM_cursor_modal_set(win, WM_CURSOR_WAIT); } else { WM_cursor_modal_restore(win); } } } }
[ "void", "WM_cursor_wait", "(", "bool", "val", ")", "{", "if", "(", "!", "G", ".", "background", ")", "{", "wmWindowManager", "*", "wm", "=", "G_MAIN", "->", "wm", ".", "first", ";", "wmWindow", "*", "win", "=", "wm", "?", "wm", "->", "windows", ".", "first", ":", "NULL", ";", "for", "(", ";", "win", ";", "win", "=", "win", "->", "next", ")", "{", "if", "(", "val", ")", "{", "WM_cursor_modal_set", "(", "win", ",", "WM_CURSOR_WAIT", ")", ";", "}", "else", "{", "WM_cursor_modal_restore", "(", "win", ")", ";", "}", "}", "}", "}" ]
to allow usage all over, we do entire WM
[ "to", "allow", "usage", "all", "over", "we", "do", "entire", "WM" ]
[]
[ { "param": "val", "type": "bool" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "val", "type": "bool", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
8e796a7981a3826518b94381414a10f9a28c9edd
DemonRem/blender
source/blender/windowmanager/intern/wm_cursors.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
WM_cursor_grab_enable
void
void WM_cursor_grab_enable(wmWindow *win, int wrap, bool hide, int bounds[4]) { /* Only grab cursor when not running debug. * It helps not to get a stuck WM when hitting a breakpoint * */ GHOST_TGrabCursorMode mode = GHOST_kGrabNormal; GHOST_TAxisFlag mode_axis = GHOST_kAxisX | GHOST_kGrabAxisY; if (bounds) { wm_cursor_position_to_ghost(win, &bounds[0], &bounds[1]); wm_cursor_position_to_ghost(win, &bounds[2], &bounds[3]); } if (hide) { mode = GHOST_kGrabHide; } else if (wrap) { mode = GHOST_kGrabWrap; if (wrap == WM_CURSOR_WRAP_X) { mode_axis = GHOST_kAxisX; } if (wrap == WM_CURSOR_WRAP_Y) { mode_axis = GHOST_kGrabAxisY; } } if ((G.debug & G_DEBUG) == 0) { if (win->ghostwin) { /* Note: There is no tabletdata on Windows if no tablet device is connected. */ if (win->eventstate->is_motion_absolute == false) { GHOST_SetCursorGrab(win->ghostwin, mode, mode_axis, bounds, NULL); } win->grabcursor = mode; } } }
/** * \param bounds: can be NULL */
\param bounds: can be NULL
[ "\\", "param", "bounds", ":", "can", "be", "NULL" ]
void WM_cursor_grab_enable(wmWindow *win, int wrap, bool hide, int bounds[4]) { GHOST_TGrabCursorMode mode = GHOST_kGrabNormal; GHOST_TAxisFlag mode_axis = GHOST_kAxisX | GHOST_kGrabAxisY; if (bounds) { wm_cursor_position_to_ghost(win, &bounds[0], &bounds[1]); wm_cursor_position_to_ghost(win, &bounds[2], &bounds[3]); } if (hide) { mode = GHOST_kGrabHide; } else if (wrap) { mode = GHOST_kGrabWrap; if (wrap == WM_CURSOR_WRAP_X) { mode_axis = GHOST_kAxisX; } if (wrap == WM_CURSOR_WRAP_Y) { mode_axis = GHOST_kGrabAxisY; } } if ((G.debug & G_DEBUG) == 0) { if (win->ghostwin) { if (win->eventstate->is_motion_absolute == false) { GHOST_SetCursorGrab(win->ghostwin, mode, mode_axis, bounds, NULL); } win->grabcursor = mode; } } }
[ "void", "WM_cursor_grab_enable", "(", "wmWindow", "*", "win", ",", "int", "wrap", ",", "bool", "hide", ",", "int", "bounds", "[", "4", "]", ")", "{", "GHOST_TGrabCursorMode", "mode", "=", "GHOST_kGrabNormal", ";", "GHOST_TAxisFlag", "mode_axis", "=", "GHOST_kAxisX", "|", "GHOST_kGrabAxisY", ";", "if", "(", "bounds", ")", "{", "wm_cursor_position_to_ghost", "(", "win", ",", "&", "bounds", "[", "0", "]", ",", "&", "bounds", "[", "1", "]", ")", ";", "wm_cursor_position_to_ghost", "(", "win", ",", "&", "bounds", "[", "2", "]", ",", "&", "bounds", "[", "3", "]", ")", ";", "}", "if", "(", "hide", ")", "{", "mode", "=", "GHOST_kGrabHide", ";", "}", "else", "if", "(", "wrap", ")", "{", "mode", "=", "GHOST_kGrabWrap", ";", "if", "(", "wrap", "==", "WM_CURSOR_WRAP_X", ")", "{", "mode_axis", "=", "GHOST_kAxisX", ";", "}", "if", "(", "wrap", "==", "WM_CURSOR_WRAP_Y", ")", "{", "mode_axis", "=", "GHOST_kGrabAxisY", ";", "}", "}", "if", "(", "(", "G", ".", "debug", "&", "G_DEBUG", ")", "==", "0", ")", "{", "if", "(", "win", "->", "ghostwin", ")", "{", "if", "(", "win", "->", "eventstate", "->", "is_motion_absolute", "==", "false", ")", "{", "GHOST_SetCursorGrab", "(", "win", "->", "ghostwin", ",", "mode", ",", "mode_axis", ",", "bounds", ",", "NULL", ")", ";", "}", "win", "->", "grabcursor", "=", "mode", ";", "}", "}", "}" ]
\param bounds: can be NULL
[ "\\", "param", "bounds", ":", "can", "be", "NULL" ]
[ "/* Only grab cursor when not running debug.\n * It helps not to get a stuck WM when hitting a breakpoint\n * */", "/* Note: There is no tabletdata on Windows if no tablet device is connected. */" ]
[ { "param": "win", "type": "wmWindow" }, { "param": "wrap", "type": "int" }, { "param": "hide", "type": "bool" }, { "param": "bounds", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "win", "type": "wmWindow", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "wrap", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "hide", "type": "bool", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "bounds", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0aec6d5e6a0a6b40e9bc5245cbf9754a1ec51dab
DemonRem/blender
source/blender/editors/space_file/file_draw.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
file_draw_tooltip_func
char
static char *file_draw_tooltip_func(bContext *UNUSED(C), void *argN, const char *UNUSED(tip)) { char *dyn_tooltip = argN; return BLI_strdup(dyn_tooltip); }
/* Dummy helper - we need dynamic tooltips here. */
Dummy helper - we need dynamic tooltips here.
[ "Dummy", "helper", "-", "we", "need", "dynamic", "tooltips", "here", "." ]
static char *file_draw_tooltip_func(bContext *UNUSED(C), void *argN, const char *UNUSED(tip)) { char *dyn_tooltip = argN; return BLI_strdup(dyn_tooltip); }
[ "static", "char", "*", "file_draw_tooltip_func", "(", "bContext", "*", "UNUSED", "(", "C", ")", ",", "void", "*", "argN", ",", "const", "char", "*", "UNUSED", "(", "tip", ")", ")", "{", "char", "*", "dyn_tooltip", "=", "argN", ";", "return", "BLI_strdup", "(", "dyn_tooltip", ")", ";", "}" ]
Dummy helper - we need dynamic tooltips here.
[ "Dummy", "helper", "-", "we", "need", "dynamic", "tooltips", "here", "." ]
[]
[ { "param": "UNUSED", "type": "char" }, { "param": "argN", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "UNUSED", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "argN", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0aec6d5e6a0a6b40e9bc5245cbf9754a1ec51dab
DemonRem/blender
source/blender/editors/space_file/file_draw.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
filelist_get_details_column_string
char
static const char *filelist_get_details_column_string(FileAttributeColumnType column, const FileDirEntry *file, const bool small_size, const bool update_stat_strings) { switch (column) { case COLUMN_DATETIME: if (!(file->typeflag & FILE_TYPE_BLENDERLIB) && !FILENAME_IS_CURRPAR(file->relpath)) { if ((file->entry->datetime_str[0] == '\0') || update_stat_strings) { char date[FILELIST_DIRENTRY_DATE_LEN], time[FILELIST_DIRENTRY_TIME_LEN]; bool is_today, is_yesterday; BLI_filelist_entry_datetime_to_string( NULL, file->entry->time, small_size, time, date, &is_today, &is_yesterday); if (is_today || is_yesterday) { BLI_strncpy(date, is_today ? N_("Today") : N_("Yesterday"), sizeof(date)); } BLI_snprintf( file->entry->datetime_str, sizeof(file->entry->datetime_str), "%s %s", date, time); } return file->entry->datetime_str; } break; case COLUMN_SIZE: if ((file->typeflag & (FILE_TYPE_BLENDER | FILE_TYPE_BLENDER_BACKUP)) || !(file->typeflag & (FILE_TYPE_DIR | FILE_TYPE_BLENDERLIB))) { if ((file->entry->size_str[0] == '\0') || update_stat_strings) { BLI_filelist_entry_size_to_string( NULL, file->entry->size, small_size, file->entry->size_str); } return file->entry->size_str; } break; default: break; } return NULL; }
/** * Updates the stat string stored in file->entry if necessary. */
Updates the stat string stored in file->entry if necessary.
[ "Updates", "the", "stat", "string", "stored", "in", "file", "-", ">", "entry", "if", "necessary", "." ]
static const char *filelist_get_details_column_string(FileAttributeColumnType column, const FileDirEntry *file, const bool small_size, const bool update_stat_strings) { switch (column) { case COLUMN_DATETIME: if (!(file->typeflag & FILE_TYPE_BLENDERLIB) && !FILENAME_IS_CURRPAR(file->relpath)) { if ((file->entry->datetime_str[0] == '\0') || update_stat_strings) { char date[FILELIST_DIRENTRY_DATE_LEN], time[FILELIST_DIRENTRY_TIME_LEN]; bool is_today, is_yesterday; BLI_filelist_entry_datetime_to_string( NULL, file->entry->time, small_size, time, date, &is_today, &is_yesterday); if (is_today || is_yesterday) { BLI_strncpy(date, is_today ? N_("Today") : N_("Yesterday"), sizeof(date)); } BLI_snprintf( file->entry->datetime_str, sizeof(file->entry->datetime_str), "%s %s", date, time); } return file->entry->datetime_str; } break; case COLUMN_SIZE: if ((file->typeflag & (FILE_TYPE_BLENDER | FILE_TYPE_BLENDER_BACKUP)) || !(file->typeflag & (FILE_TYPE_DIR | FILE_TYPE_BLENDERLIB))) { if ((file->entry->size_str[0] == '\0') || update_stat_strings) { BLI_filelist_entry_size_to_string( NULL, file->entry->size, small_size, file->entry->size_str); } return file->entry->size_str; } break; default: break; } return NULL; }
[ "static", "const", "char", "*", "filelist_get_details_column_string", "(", "FileAttributeColumnType", "column", ",", "const", "FileDirEntry", "*", "file", ",", "const", "bool", "small_size", ",", "const", "bool", "update_stat_strings", ")", "{", "switch", "(", "column", ")", "{", "case", "COLUMN_DATETIME", ":", "if", "(", "!", "(", "file", "->", "typeflag", "&", "FILE_TYPE_BLENDERLIB", ")", "&&", "!", "FILENAME_IS_CURRPAR", "(", "file", "->", "relpath", ")", ")", "{", "if", "(", "(", "file", "->", "entry", "->", "datetime_str", "[", "0", "]", "==", "'", "\\0", "'", ")", "||", "update_stat_strings", ")", "{", "char", "date", "[", "FILELIST_DIRENTRY_DATE_LEN", "]", ",", "time", "[", "FILELIST_DIRENTRY_TIME_LEN", "]", ";", "bool", "is_today", ",", "is_yesterday", ";", "BLI_filelist_entry_datetime_to_string", "(", "NULL", ",", "file", "->", "entry", "->", "time", ",", "small_size", ",", "time", ",", "date", ",", "&", "is_today", ",", "&", "is_yesterday", ")", ";", "if", "(", "is_today", "||", "is_yesterday", ")", "{", "BLI_strncpy", "(", "date", ",", "is_today", "?", "N_", "(", "\"", "\"", ")", ":", "N_", "(", "\"", "\"", ")", ",", "sizeof", "(", "date", ")", ")", ";", "}", "BLI_snprintf", "(", "file", "->", "entry", "->", "datetime_str", ",", "sizeof", "(", "file", "->", "entry", "->", "datetime_str", ")", ",", "\"", "\"", ",", "date", ",", "time", ")", ";", "}", "return", "file", "->", "entry", "->", "datetime_str", ";", "}", "break", ";", "case", "COLUMN_SIZE", ":", "if", "(", "(", "file", "->", "typeflag", "&", "(", "FILE_TYPE_BLENDER", "|", "FILE_TYPE_BLENDER_BACKUP", ")", ")", "||", "!", "(", "file", "->", "typeflag", "&", "(", "FILE_TYPE_DIR", "|", "FILE_TYPE_BLENDERLIB", ")", ")", ")", "{", "if", "(", "(", "file", "->", "entry", "->", "size_str", "[", "0", "]", "==", "'", "\\0", "'", ")", "||", "update_stat_strings", ")", "{", "BLI_filelist_entry_size_to_string", "(", "NULL", ",", "file", "->", "entry", "->", "size", ",", "small_size", ",", "file", "->", "entry", "->", "size_str", ")", ";", "}", "return", "file", "->", "entry", "->", "size_str", ";", "}", "break", ";", "default", ":", "break", ";", "}", "return", "NULL", ";", "}" ]
Updates the stat string stored in file->entry if necessary.
[ "Updates", "the", "stat", "string", "stored", "in", "file", "-", ">", "entry", "if", "necessary", "." ]
[]
[ { "param": "column", "type": "FileAttributeColumnType" }, { "param": "file", "type": "FileDirEntry" }, { "param": "small_size", "type": "bool" }, { "param": "update_stat_strings", "type": "bool" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "column", "type": "FileAttributeColumnType", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "file", "type": "FileDirEntry", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "small_size", "type": "bool", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "update_stat_strings", "type": "bool", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4b0af273f7fcf645f91b51dd07da074d34c921bb
DemonRem/blender
source/blender/draw/engines/eevee/eevee_lightprobes.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
EEVEE_lightbake_cache_init
void
void EEVEE_lightbake_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, GPUTexture *rt_color, GPUTexture *rt_depth) { EEVEE_PassList *psl = vedata->psl; LightCache *light_cache = vedata->stl->g_data->light_cache; EEVEE_LightProbesInfo *pinfo = sldata->probes; { DRW_PASS_CREATE(psl->probe_glossy_compute, DRW_STATE_WRITE_COLOR); DRWShadingGroup *grp = DRW_shgroup_create(EEVEE_shaders_probe_filter_glossy_sh_get(), psl->probe_glossy_compute); DRW_shgroup_uniform_float(grp, "intensityFac", &pinfo->intensity_fac, 1); DRW_shgroup_uniform_float(grp, "sampleCount", &pinfo->samples_len, 1); DRW_shgroup_uniform_float(grp, "invSampleCount", &pinfo->samples_len_inv, 1); DRW_shgroup_uniform_float(grp, "roughnessSquared", &pinfo->roughness, 1); DRW_shgroup_uniform_float(grp, "lodFactor", &pinfo->lodfactor, 1); DRW_shgroup_uniform_float(grp, "lodMax", &pinfo->lod_rt_max, 1); DRW_shgroup_uniform_float(grp, "texelSize", &pinfo->texel_size, 1); DRW_shgroup_uniform_float(grp, "paddingSize", &pinfo->padding_size, 1); DRW_shgroup_uniform_float(grp, "fireflyFactor", &pinfo->firefly_fac, 1); DRW_shgroup_uniform_int(grp, "Layer", &pinfo->layer, 1); DRW_shgroup_uniform_texture(grp, "texHammersley", e_data.hammersley); // DRW_shgroup_uniform_texture(grp, "texJitter", e_data.jitter); DRW_shgroup_uniform_texture(grp, "probeHdr", rt_color); DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo); struct GPUBatch *geom = DRW_cache_fullscreen_quad_get(); DRW_shgroup_call(grp, geom, NULL); } { DRW_PASS_CREATE(psl->probe_diffuse_compute, DRW_STATE_WRITE_COLOR); DRWShadingGroup *grp = DRW_shgroup_create(EEVEE_shaders_probe_filter_diffuse_sh_get(), psl->probe_diffuse_compute); #ifdef IRRADIANCE_SH_L2 DRW_shgroup_uniform_int(grp, "probeSize", &pinfo->shres, 1); #else DRW_shgroup_uniform_float(grp, "sampleCount", &pinfo->samples_len, 1); DRW_shgroup_uniform_float(grp, "invSampleCount", &pinfo->samples_len_inv, 1); DRW_shgroup_uniform_float(grp, "lodFactor", &pinfo->lodfactor, 1); DRW_shgroup_uniform_float(grp, "lodMax", &pinfo->lod_rt_max, 1); DRW_shgroup_uniform_texture(grp, "texHammersley", e_data.hammersley); #endif DRW_shgroup_uniform_float(grp, "intensityFac", &pinfo->intensity_fac, 1); DRW_shgroup_uniform_texture(grp, "probeHdr", rt_color); DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo); struct GPUBatch *geom = DRW_cache_fullscreen_quad_get(); DRW_shgroup_call(grp, geom, NULL); } { DRW_PASS_CREATE(psl->probe_visibility_compute, DRW_STATE_WRITE_COLOR); DRWShadingGroup *grp = DRW_shgroup_create(EEVEE_shaders_probe_filter_visibility_sh_get(), psl->probe_visibility_compute); DRW_shgroup_uniform_int(grp, "outputSize", &pinfo->shres, 1); DRW_shgroup_uniform_float(grp, "visibilityRange", &pinfo->visibility_range, 1); DRW_shgroup_uniform_float(grp, "visibilityBlur", &pinfo->visibility_blur, 1); DRW_shgroup_uniform_float(grp, "sampleCount", &pinfo->samples_len, 1); DRW_shgroup_uniform_float(grp, "invSampleCount", &pinfo->samples_len_inv, 1); DRW_shgroup_uniform_float(grp, "storedTexelSize", &pinfo->texel_size, 1); DRW_shgroup_uniform_float(grp, "nearClip", &pinfo->near_clip, 1); DRW_shgroup_uniform_float(grp, "farClip", &pinfo->far_clip, 1); DRW_shgroup_uniform_texture(grp, "texHammersley", e_data.hammersley); DRW_shgroup_uniform_texture(grp, "probeDepth", rt_depth); DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo); struct GPUBatch *geom = DRW_cache_fullscreen_quad_get(); DRW_shgroup_call(grp, geom, NULL); } { DRW_PASS_CREATE(psl->probe_grid_fill, DRW_STATE_WRITE_COLOR); DRWShadingGroup *grp = DRW_shgroup_create(EEVEE_shaders_probe_grid_fill_sh_get(), psl->probe_grid_fill); DRW_shgroup_uniform_texture_ref(grp, "irradianceGrid", &light_cache->grid_tx.tex); struct GPUBatch *geom = DRW_cache_fullscreen_quad_get(); DRW_shgroup_call(grp, geom, NULL); } }
/* Only init the passes useful for rendering the light cache. */
Only init the passes useful for rendering the light cache.
[ "Only", "init", "the", "passes", "useful", "for", "rendering", "the", "light", "cache", "." ]
void EEVEE_lightbake_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, GPUTexture *rt_color, GPUTexture *rt_depth) { EEVEE_PassList *psl = vedata->psl; LightCache *light_cache = vedata->stl->g_data->light_cache; EEVEE_LightProbesInfo *pinfo = sldata->probes; { DRW_PASS_CREATE(psl->probe_glossy_compute, DRW_STATE_WRITE_COLOR); DRWShadingGroup *grp = DRW_shgroup_create(EEVEE_shaders_probe_filter_glossy_sh_get(), psl->probe_glossy_compute); DRW_shgroup_uniform_float(grp, "intensityFac", &pinfo->intensity_fac, 1); DRW_shgroup_uniform_float(grp, "sampleCount", &pinfo->samples_len, 1); DRW_shgroup_uniform_float(grp, "invSampleCount", &pinfo->samples_len_inv, 1); DRW_shgroup_uniform_float(grp, "roughnessSquared", &pinfo->roughness, 1); DRW_shgroup_uniform_float(grp, "lodFactor", &pinfo->lodfactor, 1); DRW_shgroup_uniform_float(grp, "lodMax", &pinfo->lod_rt_max, 1); DRW_shgroup_uniform_float(grp, "texelSize", &pinfo->texel_size, 1); DRW_shgroup_uniform_float(grp, "paddingSize", &pinfo->padding_size, 1); DRW_shgroup_uniform_float(grp, "fireflyFactor", &pinfo->firefly_fac, 1); DRW_shgroup_uniform_int(grp, "Layer", &pinfo->layer, 1); DRW_shgroup_uniform_texture(grp, "texHammersley", e_data.hammersley); DRW_shgroup_uniform_texture(grp, "probeHdr", rt_color); DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo); struct GPUBatch *geom = DRW_cache_fullscreen_quad_get(); DRW_shgroup_call(grp, geom, NULL); } { DRW_PASS_CREATE(psl->probe_diffuse_compute, DRW_STATE_WRITE_COLOR); DRWShadingGroup *grp = DRW_shgroup_create(EEVEE_shaders_probe_filter_diffuse_sh_get(), psl->probe_diffuse_compute); #ifdef IRRADIANCE_SH_L2 DRW_shgroup_uniform_int(grp, "probeSize", &pinfo->shres, 1); #else DRW_shgroup_uniform_float(grp, "sampleCount", &pinfo->samples_len, 1); DRW_shgroup_uniform_float(grp, "invSampleCount", &pinfo->samples_len_inv, 1); DRW_shgroup_uniform_float(grp, "lodFactor", &pinfo->lodfactor, 1); DRW_shgroup_uniform_float(grp, "lodMax", &pinfo->lod_rt_max, 1); DRW_shgroup_uniform_texture(grp, "texHammersley", e_data.hammersley); #endif DRW_shgroup_uniform_float(grp, "intensityFac", &pinfo->intensity_fac, 1); DRW_shgroup_uniform_texture(grp, "probeHdr", rt_color); DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo); struct GPUBatch *geom = DRW_cache_fullscreen_quad_get(); DRW_shgroup_call(grp, geom, NULL); } { DRW_PASS_CREATE(psl->probe_visibility_compute, DRW_STATE_WRITE_COLOR); DRWShadingGroup *grp = DRW_shgroup_create(EEVEE_shaders_probe_filter_visibility_sh_get(), psl->probe_visibility_compute); DRW_shgroup_uniform_int(grp, "outputSize", &pinfo->shres, 1); DRW_shgroup_uniform_float(grp, "visibilityRange", &pinfo->visibility_range, 1); DRW_shgroup_uniform_float(grp, "visibilityBlur", &pinfo->visibility_blur, 1); DRW_shgroup_uniform_float(grp, "sampleCount", &pinfo->samples_len, 1); DRW_shgroup_uniform_float(grp, "invSampleCount", &pinfo->samples_len_inv, 1); DRW_shgroup_uniform_float(grp, "storedTexelSize", &pinfo->texel_size, 1); DRW_shgroup_uniform_float(grp, "nearClip", &pinfo->near_clip, 1); DRW_shgroup_uniform_float(grp, "farClip", &pinfo->far_clip, 1); DRW_shgroup_uniform_texture(grp, "texHammersley", e_data.hammersley); DRW_shgroup_uniform_texture(grp, "probeDepth", rt_depth); DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo); struct GPUBatch *geom = DRW_cache_fullscreen_quad_get(); DRW_shgroup_call(grp, geom, NULL); } { DRW_PASS_CREATE(psl->probe_grid_fill, DRW_STATE_WRITE_COLOR); DRWShadingGroup *grp = DRW_shgroup_create(EEVEE_shaders_probe_grid_fill_sh_get(), psl->probe_grid_fill); DRW_shgroup_uniform_texture_ref(grp, "irradianceGrid", &light_cache->grid_tx.tex); struct GPUBatch *geom = DRW_cache_fullscreen_quad_get(); DRW_shgroup_call(grp, geom, NULL); } }
[ "void", "EEVEE_lightbake_cache_init", "(", "EEVEE_ViewLayerData", "*", "sldata", ",", "EEVEE_Data", "*", "vedata", ",", "GPUTexture", "*", "rt_color", ",", "GPUTexture", "*", "rt_depth", ")", "{", "EEVEE_PassList", "*", "psl", "=", "vedata", "->", "psl", ";", "LightCache", "*", "light_cache", "=", "vedata", "->", "stl", "->", "g_data", "->", "light_cache", ";", "EEVEE_LightProbesInfo", "*", "pinfo", "=", "sldata", "->", "probes", ";", "{", "DRW_PASS_CREATE", "(", "psl", "->", "probe_glossy_compute", ",", "DRW_STATE_WRITE_COLOR", ")", ";", "DRWShadingGroup", "*", "grp", "=", "DRW_shgroup_create", "(", "EEVEE_shaders_probe_filter_glossy_sh_get", "(", ")", ",", "psl", "->", "probe_glossy_compute", ")", ";", "DRW_shgroup_uniform_float", "(", "grp", ",", "\"", "\"", ",", "&", "pinfo", "->", "intensity_fac", ",", "1", ")", ";", "DRW_shgroup_uniform_float", "(", "grp", ",", "\"", "\"", ",", "&", "pinfo", "->", "samples_len", ",", "1", ")", ";", "DRW_shgroup_uniform_float", "(", "grp", ",", "\"", "\"", ",", "&", "pinfo", "->", "samples_len_inv", ",", "1", ")", ";", "DRW_shgroup_uniform_float", "(", "grp", ",", "\"", "\"", ",", "&", "pinfo", "->", "roughness", ",", "1", ")", ";", "DRW_shgroup_uniform_float", "(", "grp", ",", "\"", "\"", ",", "&", "pinfo", "->", "lodfactor", ",", "1", ")", ";", "DRW_shgroup_uniform_float", "(", "grp", ",", "\"", "\"", ",", "&", "pinfo", "->", "lod_rt_max", ",", "1", ")", ";", "DRW_shgroup_uniform_float", "(", "grp", ",", "\"", "\"", ",", "&", "pinfo", "->", "texel_size", ",", "1", ")", ";", "DRW_shgroup_uniform_float", "(", "grp", ",", "\"", "\"", ",", "&", "pinfo", "->", "padding_size", ",", "1", ")", ";", "DRW_shgroup_uniform_float", "(", "grp", ",", "\"", "\"", ",", "&", "pinfo", "->", "firefly_fac", ",", "1", ")", ";", "DRW_shgroup_uniform_int", "(", "grp", ",", "\"", "\"", ",", "&", "pinfo", "->", "layer", ",", "1", ")", ";", "DRW_shgroup_uniform_texture", "(", "grp", ",", "\"", "\"", ",", "e_data", ".", "hammersley", ")", ";", "DRW_shgroup_uniform_texture", "(", "grp", ",", "\"", "\"", ",", "rt_color", ")", ";", "DRW_shgroup_uniform_block", "(", "grp", ",", "\"", "\"", ",", "sldata", "->", "common_ubo", ")", ";", "struct", "GPUBatch", "*", "geom", "=", "DRW_cache_fullscreen_quad_get", "(", ")", ";", "DRW_shgroup_call", "(", "grp", ",", "geom", ",", "NULL", ")", ";", "}", "{", "DRW_PASS_CREATE", "(", "psl", "->", "probe_diffuse_compute", ",", "DRW_STATE_WRITE_COLOR", ")", ";", "DRWShadingGroup", "*", "grp", "=", "DRW_shgroup_create", "(", "EEVEE_shaders_probe_filter_diffuse_sh_get", "(", ")", ",", "psl", "->", "probe_diffuse_compute", ")", ";", "#ifdef", "IRRADIANCE_SH_L2", "DRW_shgroup_uniform_int", "(", "grp", ",", "\"", "\"", ",", "&", "pinfo", "->", "shres", ",", "1", ")", ";", "#else", "DRW_shgroup_uniform_float", "(", "grp", ",", "\"", "\"", ",", "&", "pinfo", "->", "samples_len", ",", "1", ")", ";", "DRW_shgroup_uniform_float", "(", "grp", ",", "\"", "\"", ",", "&", "pinfo", "->", "samples_len_inv", ",", "1", ")", ";", "DRW_shgroup_uniform_float", "(", "grp", ",", "\"", "\"", ",", "&", "pinfo", "->", "lodfactor", ",", "1", ")", ";", "DRW_shgroup_uniform_float", "(", "grp", ",", "\"", "\"", ",", "&", "pinfo", "->", "lod_rt_max", ",", "1", ")", ";", "DRW_shgroup_uniform_texture", "(", "grp", ",", "\"", "\"", ",", "e_data", ".", "hammersley", ")", ";", "#endif", "DRW_shgroup_uniform_float", "(", "grp", ",", "\"", "\"", ",", "&", "pinfo", "->", "intensity_fac", ",", "1", ")", ";", "DRW_shgroup_uniform_texture", "(", "grp", ",", "\"", "\"", ",", "rt_color", ")", ";", "DRW_shgroup_uniform_block", "(", "grp", ",", "\"", "\"", ",", "sldata", "->", "common_ubo", ")", ";", "struct", "GPUBatch", "*", "geom", "=", "DRW_cache_fullscreen_quad_get", "(", ")", ";", "DRW_shgroup_call", "(", "grp", ",", "geom", ",", "NULL", ")", ";", "}", "{", "DRW_PASS_CREATE", "(", "psl", "->", "probe_visibility_compute", ",", "DRW_STATE_WRITE_COLOR", ")", ";", "DRWShadingGroup", "*", "grp", "=", "DRW_shgroup_create", "(", "EEVEE_shaders_probe_filter_visibility_sh_get", "(", ")", ",", "psl", "->", "probe_visibility_compute", ")", ";", "DRW_shgroup_uniform_int", "(", "grp", ",", "\"", "\"", ",", "&", "pinfo", "->", "shres", ",", "1", ")", ";", "DRW_shgroup_uniform_float", "(", "grp", ",", "\"", "\"", ",", "&", "pinfo", "->", "visibility_range", ",", "1", ")", ";", "DRW_shgroup_uniform_float", "(", "grp", ",", "\"", "\"", ",", "&", "pinfo", "->", "visibility_blur", ",", "1", ")", ";", "DRW_shgroup_uniform_float", "(", "grp", ",", "\"", "\"", ",", "&", "pinfo", "->", "samples_len", ",", "1", ")", ";", "DRW_shgroup_uniform_float", "(", "grp", ",", "\"", "\"", ",", "&", "pinfo", "->", "samples_len_inv", ",", "1", ")", ";", "DRW_shgroup_uniform_float", "(", "grp", ",", "\"", "\"", ",", "&", "pinfo", "->", "texel_size", ",", "1", ")", ";", "DRW_shgroup_uniform_float", "(", "grp", ",", "\"", "\"", ",", "&", "pinfo", "->", "near_clip", ",", "1", ")", ";", "DRW_shgroup_uniform_float", "(", "grp", ",", "\"", "\"", ",", "&", "pinfo", "->", "far_clip", ",", "1", ")", ";", "DRW_shgroup_uniform_texture", "(", "grp", ",", "\"", "\"", ",", "e_data", ".", "hammersley", ")", ";", "DRW_shgroup_uniform_texture", "(", "grp", ",", "\"", "\"", ",", "rt_depth", ")", ";", "DRW_shgroup_uniform_block", "(", "grp", ",", "\"", "\"", ",", "sldata", "->", "common_ubo", ")", ";", "struct", "GPUBatch", "*", "geom", "=", "DRW_cache_fullscreen_quad_get", "(", ")", ";", "DRW_shgroup_call", "(", "grp", ",", "geom", ",", "NULL", ")", ";", "}", "{", "DRW_PASS_CREATE", "(", "psl", "->", "probe_grid_fill", ",", "DRW_STATE_WRITE_COLOR", ")", ";", "DRWShadingGroup", "*", "grp", "=", "DRW_shgroup_create", "(", "EEVEE_shaders_probe_grid_fill_sh_get", "(", ")", ",", "psl", "->", "probe_grid_fill", ")", ";", "DRW_shgroup_uniform_texture_ref", "(", "grp", ",", "\"", "\"", ",", "&", "light_cache", "->", "grid_tx", ".", "tex", ")", ";", "struct", "GPUBatch", "*", "geom", "=", "DRW_cache_fullscreen_quad_get", "(", ")", ";", "DRW_shgroup_call", "(", "grp", ",", "geom", ",", "NULL", ")", ";", "}", "}" ]
Only init the passes useful for rendering the light cache.
[ "Only", "init", "the", "passes", "useful", "for", "rendering", "the", "light", "cache", "." ]
[ "// DRW_shgroup_uniform_texture(grp, \"texJitter\", e_data.jitter);" ]
[ { "param": "sldata", "type": "EEVEE_ViewLayerData" }, { "param": "vedata", "type": "EEVEE_Data" }, { "param": "rt_color", "type": "GPUTexture" }, { "param": "rt_depth", "type": "GPUTexture" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "sldata", "type": "EEVEE_ViewLayerData", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "vedata", "type": "EEVEE_Data", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rt_color", "type": "GPUTexture", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rt_depth", "type": "GPUTexture", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4b0af273f7fcf645f91b51dd07da074d34c921bb
DemonRem/blender
source/blender/draw/engines/eevee/eevee_lightprobes.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
EEVEE_lightbake_render_scene
void
void EEVEE_lightbake_render_scene(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, struct GPUFrameBuffer *face_fb[6], const float pos[3], float near_clip, float far_clip) { EEVEE_BakeRenderData brdata = { .vedata = vedata, .sldata = sldata, .face_fb = face_fb, }; render_cubemap(lightbake_render_scene_face, &brdata, pos, near_clip, far_clip, true); }
/* Render the scene to the probe_rt texture. */
Render the scene to the probe_rt texture.
[ "Render", "the", "scene", "to", "the", "probe_rt", "texture", "." ]
void EEVEE_lightbake_render_scene(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, struct GPUFrameBuffer *face_fb[6], const float pos[3], float near_clip, float far_clip) { EEVEE_BakeRenderData brdata = { .vedata = vedata, .sldata = sldata, .face_fb = face_fb, }; render_cubemap(lightbake_render_scene_face, &brdata, pos, near_clip, far_clip, true); }
[ "void", "EEVEE_lightbake_render_scene", "(", "EEVEE_ViewLayerData", "*", "sldata", ",", "EEVEE_Data", "*", "vedata", ",", "struct", "GPUFrameBuffer", "*", "face_fb", "[", "6", "]", ",", "const", "float", "pos", "[", "3", "]", ",", "float", "near_clip", ",", "float", "far_clip", ")", "{", "EEVEE_BakeRenderData", "brdata", "=", "{", ".", "vedata", "=", "vedata", ",", ".", "sldata", "=", "sldata", ",", ".", "face_fb", "=", "face_fb", ",", "}", ";", "render_cubemap", "(", "lightbake_render_scene_face", ",", "&", "brdata", ",", "pos", ",", "near_clip", ",", "far_clip", ",", "true", ")", ";", "}" ]
Render the scene to the probe_rt texture.
[ "Render", "the", "scene", "to", "the", "probe_rt", "texture", "." ]
[]
[ { "param": "sldata", "type": "EEVEE_ViewLayerData" }, { "param": "vedata", "type": "EEVEE_Data" }, { "param": "face_fb", "type": "struct GPUFrameBuffer" }, { "param": "pos", "type": "float" }, { "param": "near_clip", "type": "float" }, { "param": "far_clip", "type": "float" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "sldata", "type": "EEVEE_ViewLayerData", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "vedata", "type": "EEVEE_Data", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "face_fb", "type": "struct GPUFrameBuffer", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pos", "type": "float", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "near_clip", "type": "float", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "far_clip", "type": "float", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4b0af273f7fcf645f91b51dd07da074d34c921bb
DemonRem/blender
source/blender/draw/engines/eevee/eevee_lightprobes.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
downsample_planar
void
static void downsample_planar(void *vedata, int level) { EEVEE_PassList *psl = ((EEVEE_Data *)vedata)->psl; EEVEE_StorageList *stl = ((EEVEE_Data *)vedata)->stl; const float *size = DRW_viewport_size_get(); copy_v2_v2(stl->g_data->planar_texel_size, size); for (int i = 0; i < level - 1; i++) { stl->g_data->planar_texel_size[0] /= 2.0f; stl->g_data->planar_texel_size[1] /= 2.0f; min_ff(floorf(stl->g_data->planar_texel_size[0]), 1.0f); min_ff(floorf(stl->g_data->planar_texel_size[1]), 1.0f); } invert_v2(stl->g_data->planar_texel_size); DRW_draw_pass(psl->probe_planar_downsample_ps); }
/* Actually a simple down-sampling. */
Actually a simple down-sampling.
[ "Actually", "a", "simple", "down", "-", "sampling", "." ]
static void downsample_planar(void *vedata, int level) { EEVEE_PassList *psl = ((EEVEE_Data *)vedata)->psl; EEVEE_StorageList *stl = ((EEVEE_Data *)vedata)->stl; const float *size = DRW_viewport_size_get(); copy_v2_v2(stl->g_data->planar_texel_size, size); for (int i = 0; i < level - 1; i++) { stl->g_data->planar_texel_size[0] /= 2.0f; stl->g_data->planar_texel_size[1] /= 2.0f; min_ff(floorf(stl->g_data->planar_texel_size[0]), 1.0f); min_ff(floorf(stl->g_data->planar_texel_size[1]), 1.0f); } invert_v2(stl->g_data->planar_texel_size); DRW_draw_pass(psl->probe_planar_downsample_ps); }
[ "static", "void", "downsample_planar", "(", "void", "*", "vedata", ",", "int", "level", ")", "{", "EEVEE_PassList", "*", "psl", "=", "(", "(", "EEVEE_Data", "*", ")", "vedata", ")", "->", "psl", ";", "EEVEE_StorageList", "*", "stl", "=", "(", "(", "EEVEE_Data", "*", ")", "vedata", ")", "->", "stl", ";", "const", "float", "*", "size", "=", "DRW_viewport_size_get", "(", ")", ";", "copy_v2_v2", "(", "stl", "->", "g_data", "->", "planar_texel_size", ",", "size", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "level", "-", "1", ";", "i", "++", ")", "{", "stl", "->", "g_data", "->", "planar_texel_size", "[", "0", "]", "/=", "2.0f", ";", "stl", "->", "g_data", "->", "planar_texel_size", "[", "1", "]", "/=", "2.0f", ";", "min_ff", "(", "floorf", "(", "stl", "->", "g_data", "->", "planar_texel_size", "[", "0", "]", ")", ",", "1.0f", ")", ";", "min_ff", "(", "floorf", "(", "stl", "->", "g_data", "->", "planar_texel_size", "[", "1", "]", ")", ",", "1.0f", ")", ";", "}", "invert_v2", "(", "stl", "->", "g_data", "->", "planar_texel_size", ")", ";", "DRW_draw_pass", "(", "psl", "->", "probe_planar_downsample_ps", ")", ";", "}" ]
Actually a simple down-sampling.
[ "Actually", "a", "simple", "down", "-", "sampling", "." ]
[]
[ { "param": "vedata", "type": "void" }, { "param": "level", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "vedata", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "level", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a4b96c9e59c8559504c8f419e3d1ce0feb44c89a
DemonRem/blender
source/blender/blenloader/intern/readblenentry.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BLO_blendhandle_from_file
BlendHandle
BlendHandle *BLO_blendhandle_from_file(const char *filepath, ReportList *reports) { BlendHandle *bh; bh = (BlendHandle *)blo_filedata_from_file(filepath, reports); return bh; }
/** * Open a blendhandle from a file path. * * \param filepath: The file path to open. * \param reports: Report errors in opening the file (can be NULL). * \return A handle on success, or NULL on failure. */
Open a blendhandle from a file path. \param filepath: The file path to open. \param reports: Report errors in opening the file (can be NULL). \return A handle on success, or NULL on failure.
[ "Open", "a", "blendhandle", "from", "a", "file", "path", ".", "\\", "param", "filepath", ":", "The", "file", "path", "to", "open", ".", "\\", "param", "reports", ":", "Report", "errors", "in", "opening", "the", "file", "(", "can", "be", "NULL", ")", ".", "\\", "return", "A", "handle", "on", "success", "or", "NULL", "on", "failure", "." ]
BlendHandle *BLO_blendhandle_from_file(const char *filepath, ReportList *reports) { BlendHandle *bh; bh = (BlendHandle *)blo_filedata_from_file(filepath, reports); return bh; }
[ "BlendHandle", "*", "BLO_blendhandle_from_file", "(", "const", "char", "*", "filepath", ",", "ReportList", "*", "reports", ")", "{", "BlendHandle", "*", "bh", ";", "bh", "=", "(", "BlendHandle", "*", ")", "blo_filedata_from_file", "(", "filepath", ",", "reports", ")", ";", "return", "bh", ";", "}" ]
Open a blendhandle from a file path.
[ "Open", "a", "blendhandle", "from", "a", "file", "path", "." ]
[]
[ { "param": "filepath", "type": "char" }, { "param": "reports", "type": "ReportList" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "filepath", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "reports", "type": "ReportList", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a4b96c9e59c8559504c8f419e3d1ce0feb44c89a
DemonRem/blender
source/blender/blenloader/intern/readblenentry.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BLO_blendhandle_get_datablock_names
LinkNode
LinkNode *BLO_blendhandle_get_datablock_names(BlendHandle *bh, int ofblocktype, int *tot_names) { FileData *fd = (FileData *)bh; LinkNode *names = NULL; BHead *bhead; int tot = 0; for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) { if (bhead->code == ofblocktype) { const char *idname = blo_bhead_id_name(fd, bhead); BLI_linklist_prepend(&names, strdup(idname + 2)); tot++; } else if (bhead->code == ENDB) { break; } } *tot_names = tot; return names; }
/** * Gets the names of all the data-blocks in a file of a certain type * (e.g. all the scene names in a file). * * \param bh: The blendhandle to access. * \param ofblocktype: The type of names to get. * \param tot_names: The length of the returned list. * \return A BLI_linklist of strings. The string links should be freed with malloc. */
Gets the names of all the data-blocks in a file of a certain type . \param bh: The blendhandle to access. \param ofblocktype: The type of names to get. \param tot_names: The length of the returned list. \return A BLI_linklist of strings. The string links should be freed with malloc.
[ "Gets", "the", "names", "of", "all", "the", "data", "-", "blocks", "in", "a", "file", "of", "a", "certain", "type", ".", "\\", "param", "bh", ":", "The", "blendhandle", "to", "access", ".", "\\", "param", "ofblocktype", ":", "The", "type", "of", "names", "to", "get", ".", "\\", "param", "tot_names", ":", "The", "length", "of", "the", "returned", "list", ".", "\\", "return", "A", "BLI_linklist", "of", "strings", ".", "The", "string", "links", "should", "be", "freed", "with", "malloc", "." ]
LinkNode *BLO_blendhandle_get_datablock_names(BlendHandle *bh, int ofblocktype, int *tot_names) { FileData *fd = (FileData *)bh; LinkNode *names = NULL; BHead *bhead; int tot = 0; for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) { if (bhead->code == ofblocktype) { const char *idname = blo_bhead_id_name(fd, bhead); BLI_linklist_prepend(&names, strdup(idname + 2)); tot++; } else if (bhead->code == ENDB) { break; } } *tot_names = tot; return names; }
[ "LinkNode", "*", "BLO_blendhandle_get_datablock_names", "(", "BlendHandle", "*", "bh", ",", "int", "ofblocktype", ",", "int", "*", "tot_names", ")", "{", "FileData", "*", "fd", "=", "(", "FileData", "*", ")", "bh", ";", "LinkNode", "*", "names", "=", "NULL", ";", "BHead", "*", "bhead", ";", "int", "tot", "=", "0", ";", "for", "(", "bhead", "=", "blo_bhead_first", "(", "fd", ")", ";", "bhead", ";", "bhead", "=", "blo_bhead_next", "(", "fd", ",", "bhead", ")", ")", "{", "if", "(", "bhead", "->", "code", "==", "ofblocktype", ")", "{", "const", "char", "*", "idname", "=", "blo_bhead_id_name", "(", "fd", ",", "bhead", ")", ";", "BLI_linklist_prepend", "(", "&", "names", ",", "strdup", "(", "idname", "+", "2", ")", ")", ";", "tot", "++", ";", "}", "else", "if", "(", "bhead", "->", "code", "==", "ENDB", ")", "{", "break", ";", "}", "}", "*", "tot_names", "=", "tot", ";", "return", "names", ";", "}" ]
Gets the names of all the data-blocks in a file of a certain type (e.g.
[ "Gets", "the", "names", "of", "all", "the", "data", "-", "blocks", "in", "a", "file", "of", "a", "certain", "type", "(", "e", ".", "g", "." ]
[]
[ { "param": "bh", "type": "BlendHandle" }, { "param": "ofblocktype", "type": "int" }, { "param": "tot_names", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "bh", "type": "BlendHandle", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ofblocktype", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "tot_names", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a4b96c9e59c8559504c8f419e3d1ce0feb44c89a
DemonRem/blender
source/blender/blenloader/intern/readblenentry.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BLO_blendhandle_get_previews
LinkNode
LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *tot_prev) { FileData *fd = (FileData *)bh; LinkNode *previews = NULL; BHead *bhead; int looking = 0; PreviewImage *prv = NULL; PreviewImage *new_prv = NULL; int tot = 0; for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) { if (bhead->code == ofblocktype) { const char *idname = blo_bhead_id_name(fd, bhead); switch (GS(idname)) { case ID_MA: /* fall through */ case ID_TE: /* fall through */ case ID_IM: /* fall through */ case ID_WO: /* fall through */ case ID_LA: /* fall through */ case ID_OB: /* fall through */ case ID_GR: /* fall through */ case ID_SCE: /* fall through */ new_prv = MEM_callocN(sizeof(PreviewImage), "newpreview"); BLI_linklist_prepend(&previews, new_prv); tot++; looking = 1; break; default: break; } } else if (bhead->code == DATA) { if (looking) { if (bhead->SDNAnr == DNA_struct_find_nr(fd->filesdna, "PreviewImage")) { prv = BLO_library_read_struct(fd, bhead, "PreviewImage"); if (prv) { memcpy(new_prv, prv, sizeof(PreviewImage)); if (prv->rect[0] && prv->w[0] && prv->h[0]) { bhead = blo_bhead_next(fd, bhead); BLI_assert((new_prv->w[0] * new_prv->h[0] * sizeof(uint)) == bhead->len); new_prv->rect[0] = BLO_library_read_struct(fd, bhead, "PreviewImage Icon Rect"); } else { /* This should not be needed, but can happen in 'broken' .blend files, * better handle this gracefully than crashing. */ BLI_assert(prv->rect[0] == NULL && prv->w[0] == 0 && prv->h[0] == 0); new_prv->rect[0] = NULL; new_prv->w[0] = new_prv->h[0] = 0; } if (prv->rect[1] && prv->w[1] && prv->h[1]) { bhead = blo_bhead_next(fd, bhead); BLI_assert((new_prv->w[1] * new_prv->h[1] * sizeof(uint)) == bhead->len); new_prv->rect[1] = BLO_library_read_struct(fd, bhead, "PreviewImage Image Rect"); } else { /* This should not be needed, but can happen in 'broken' .blend files, * better handle this gracefully than crashing. */ BLI_assert(prv->rect[1] == NULL && prv->w[1] == 0 && prv->h[1] == 0); new_prv->rect[1] = NULL; new_prv->w[1] = new_prv->h[1] = 0; } MEM_freeN(prv); } } } } else if (bhead->code == ENDB) { break; } else { looking = 0; new_prv = NULL; prv = NULL; } } *tot_prev = tot; return previews; }
/** * Gets the previews of all the data-blocks in a file of a certain type * (e.g. all the scene previews in a file). * * \param bh: The blendhandle to access. * \param ofblocktype: The type of names to get. * \param tot_prev: The length of the returned list. * \return A BLI_linklist of PreviewImage. The PreviewImage links should be freed with malloc. */
Gets the previews of all the data-blocks in a file of a certain type . \param bh: The blendhandle to access. \param ofblocktype: The type of names to get. \param tot_prev: The length of the returned list.
[ "Gets", "the", "previews", "of", "all", "the", "data", "-", "blocks", "in", "a", "file", "of", "a", "certain", "type", ".", "\\", "param", "bh", ":", "The", "blendhandle", "to", "access", ".", "\\", "param", "ofblocktype", ":", "The", "type", "of", "names", "to", "get", ".", "\\", "param", "tot_prev", ":", "The", "length", "of", "the", "returned", "list", "." ]
LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *tot_prev) { FileData *fd = (FileData *)bh; LinkNode *previews = NULL; BHead *bhead; int looking = 0; PreviewImage *prv = NULL; PreviewImage *new_prv = NULL; int tot = 0; for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) { if (bhead->code == ofblocktype) { const char *idname = blo_bhead_id_name(fd, bhead); switch (GS(idname)) { case ID_MA: case ID_TE: case ID_IM: case ID_WO: case ID_LA: case ID_OB: case ID_GR: case ID_SCE: new_prv = MEM_callocN(sizeof(PreviewImage), "newpreview"); BLI_linklist_prepend(&previews, new_prv); tot++; looking = 1; break; default: break; } } else if (bhead->code == DATA) { if (looking) { if (bhead->SDNAnr == DNA_struct_find_nr(fd->filesdna, "PreviewImage")) { prv = BLO_library_read_struct(fd, bhead, "PreviewImage"); if (prv) { memcpy(new_prv, prv, sizeof(PreviewImage)); if (prv->rect[0] && prv->w[0] && prv->h[0]) { bhead = blo_bhead_next(fd, bhead); BLI_assert((new_prv->w[0] * new_prv->h[0] * sizeof(uint)) == bhead->len); new_prv->rect[0] = BLO_library_read_struct(fd, bhead, "PreviewImage Icon Rect"); } else { BLI_assert(prv->rect[0] == NULL && prv->w[0] == 0 && prv->h[0] == 0); new_prv->rect[0] = NULL; new_prv->w[0] = new_prv->h[0] = 0; } if (prv->rect[1] && prv->w[1] && prv->h[1]) { bhead = blo_bhead_next(fd, bhead); BLI_assert((new_prv->w[1] * new_prv->h[1] * sizeof(uint)) == bhead->len); new_prv->rect[1] = BLO_library_read_struct(fd, bhead, "PreviewImage Image Rect"); } else { BLI_assert(prv->rect[1] == NULL && prv->w[1] == 0 && prv->h[1] == 0); new_prv->rect[1] = NULL; new_prv->w[1] = new_prv->h[1] = 0; } MEM_freeN(prv); } } } } else if (bhead->code == ENDB) { break; } else { looking = 0; new_prv = NULL; prv = NULL; } } *tot_prev = tot; return previews; }
[ "LinkNode", "*", "BLO_blendhandle_get_previews", "(", "BlendHandle", "*", "bh", ",", "int", "ofblocktype", ",", "int", "*", "tot_prev", ")", "{", "FileData", "*", "fd", "=", "(", "FileData", "*", ")", "bh", ";", "LinkNode", "*", "previews", "=", "NULL", ";", "BHead", "*", "bhead", ";", "int", "looking", "=", "0", ";", "PreviewImage", "*", "prv", "=", "NULL", ";", "PreviewImage", "*", "new_prv", "=", "NULL", ";", "int", "tot", "=", "0", ";", "for", "(", "bhead", "=", "blo_bhead_first", "(", "fd", ")", ";", "bhead", ";", "bhead", "=", "blo_bhead_next", "(", "fd", ",", "bhead", ")", ")", "{", "if", "(", "bhead", "->", "code", "==", "ofblocktype", ")", "{", "const", "char", "*", "idname", "=", "blo_bhead_id_name", "(", "fd", ",", "bhead", ")", ";", "switch", "(", "GS", "(", "idname", ")", ")", "{", "case", "ID_MA", ":", "case", "ID_TE", ":", "case", "ID_IM", ":", "case", "ID_WO", ":", "case", "ID_LA", ":", "case", "ID_OB", ":", "case", "ID_GR", ":", "case", "ID_SCE", ":", "new_prv", "=", "MEM_callocN", "(", "sizeof", "(", "PreviewImage", ")", ",", "\"", "\"", ")", ";", "BLI_linklist_prepend", "(", "&", "previews", ",", "new_prv", ")", ";", "tot", "++", ";", "looking", "=", "1", ";", "break", ";", "default", ":", "break", ";", "}", "}", "else", "if", "(", "bhead", "->", "code", "==", "DATA", ")", "{", "if", "(", "looking", ")", "{", "if", "(", "bhead", "->", "SDNAnr", "==", "DNA_struct_find_nr", "(", "fd", "->", "filesdna", ",", "\"", "\"", ")", ")", "{", "prv", "=", "BLO_library_read_struct", "(", "fd", ",", "bhead", ",", "\"", "\"", ")", ";", "if", "(", "prv", ")", "{", "memcpy", "(", "new_prv", ",", "prv", ",", "sizeof", "(", "PreviewImage", ")", ")", ";", "if", "(", "prv", "->", "rect", "[", "0", "]", "&&", "prv", "->", "w", "[", "0", "]", "&&", "prv", "->", "h", "[", "0", "]", ")", "{", "bhead", "=", "blo_bhead_next", "(", "fd", ",", "bhead", ")", ";", "BLI_assert", "(", "(", "new_prv", "->", "w", "[", "0", "]", "*", "new_prv", "->", "h", "[", "0", "]", "*", "sizeof", "(", "uint", ")", ")", "==", "bhead", "->", "len", ")", ";", "new_prv", "->", "rect", "[", "0", "]", "=", "BLO_library_read_struct", "(", "fd", ",", "bhead", ",", "\"", "\"", ")", ";", "}", "else", "{", "BLI_assert", "(", "prv", "->", "rect", "[", "0", "]", "==", "NULL", "&&", "prv", "->", "w", "[", "0", "]", "==", "0", "&&", "prv", "->", "h", "[", "0", "]", "==", "0", ")", ";", "new_prv", "->", "rect", "[", "0", "]", "=", "NULL", ";", "new_prv", "->", "w", "[", "0", "]", "=", "new_prv", "->", "h", "[", "0", "]", "=", "0", ";", "}", "if", "(", "prv", "->", "rect", "[", "1", "]", "&&", "prv", "->", "w", "[", "1", "]", "&&", "prv", "->", "h", "[", "1", "]", ")", "{", "bhead", "=", "blo_bhead_next", "(", "fd", ",", "bhead", ")", ";", "BLI_assert", "(", "(", "new_prv", "->", "w", "[", "1", "]", "*", "new_prv", "->", "h", "[", "1", "]", "*", "sizeof", "(", "uint", ")", ")", "==", "bhead", "->", "len", ")", ";", "new_prv", "->", "rect", "[", "1", "]", "=", "BLO_library_read_struct", "(", "fd", ",", "bhead", ",", "\"", "\"", ")", ";", "}", "else", "{", "BLI_assert", "(", "prv", "->", "rect", "[", "1", "]", "==", "NULL", "&&", "prv", "->", "w", "[", "1", "]", "==", "0", "&&", "prv", "->", "h", "[", "1", "]", "==", "0", ")", ";", "new_prv", "->", "rect", "[", "1", "]", "=", "NULL", ";", "new_prv", "->", "w", "[", "1", "]", "=", "new_prv", "->", "h", "[", "1", "]", "=", "0", ";", "}", "MEM_freeN", "(", "prv", ")", ";", "}", "}", "}", "}", "else", "if", "(", "bhead", "->", "code", "==", "ENDB", ")", "{", "break", ";", "}", "else", "{", "looking", "=", "0", ";", "new_prv", "=", "NULL", ";", "prv", "=", "NULL", ";", "}", "}", "*", "tot_prev", "=", "tot", ";", "return", "previews", ";", "}" ]
Gets the previews of all the data-blocks in a file of a certain type (e.g.
[ "Gets", "the", "previews", "of", "all", "the", "data", "-", "blocks", "in", "a", "file", "of", "a", "certain", "type", "(", "e", ".", "g", "." ]
[ "/* fall through */", "/* fall through */", "/* fall through */", "/* fall through */", "/* fall through */", "/* fall through */", "/* fall through */", "/* fall through */", "/* This should not be needed, but can happen in 'broken' .blend files,\n * better handle this gracefully than crashing. */", "/* This should not be needed, but can happen in 'broken' .blend files,\n * better handle this gracefully than crashing. */" ]
[ { "param": "bh", "type": "BlendHandle" }, { "param": "ofblocktype", "type": "int" }, { "param": "tot_prev", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "bh", "type": "BlendHandle", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ofblocktype", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "tot_prev", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a4b96c9e59c8559504c8f419e3d1ce0feb44c89a
DemonRem/blender
source/blender/blenloader/intern/readblenentry.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BLO_blendhandle_get_linkable_groups
LinkNode
LinkNode *BLO_blendhandle_get_linkable_groups(BlendHandle *bh) { FileData *fd = (FileData *)bh; GSet *gathered = BLI_gset_ptr_new("linkable_groups gh"); LinkNode *names = NULL; BHead *bhead; for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) { if (bhead->code == ENDB) { break; } else if (BKE_idcode_is_valid(bhead->code)) { if (BKE_idcode_is_linkable(bhead->code)) { const char *str = BKE_idcode_to_name(bhead->code); if (BLI_gset_add(gathered, (void *)str)) { BLI_linklist_prepend(&names, strdup(str)); } } } } BLI_gset_free(gathered, NULL); return names; }
/** * Gets the names of all the linkable data-block types available in a file. * (e.g. "Scene", "Mesh", "Light", etc.). * * \param bh: The blendhandle to access. * \return A BLI_linklist of strings. The string links should be freed with malloc. */
Gets the names of all the linkable data-block types available in a file. \param bh: The blendhandle to access. \return A BLI_linklist of strings. The string links should be freed with malloc.
[ "Gets", "the", "names", "of", "all", "the", "linkable", "data", "-", "block", "types", "available", "in", "a", "file", ".", "\\", "param", "bh", ":", "The", "blendhandle", "to", "access", ".", "\\", "return", "A", "BLI_linklist", "of", "strings", ".", "The", "string", "links", "should", "be", "freed", "with", "malloc", "." ]
LinkNode *BLO_blendhandle_get_linkable_groups(BlendHandle *bh) { FileData *fd = (FileData *)bh; GSet *gathered = BLI_gset_ptr_new("linkable_groups gh"); LinkNode *names = NULL; BHead *bhead; for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) { if (bhead->code == ENDB) { break; } else if (BKE_idcode_is_valid(bhead->code)) { if (BKE_idcode_is_linkable(bhead->code)) { const char *str = BKE_idcode_to_name(bhead->code); if (BLI_gset_add(gathered, (void *)str)) { BLI_linklist_prepend(&names, strdup(str)); } } } } BLI_gset_free(gathered, NULL); return names; }
[ "LinkNode", "*", "BLO_blendhandle_get_linkable_groups", "(", "BlendHandle", "*", "bh", ")", "{", "FileData", "*", "fd", "=", "(", "FileData", "*", ")", "bh", ";", "GSet", "*", "gathered", "=", "BLI_gset_ptr_new", "(", "\"", "\"", ")", ";", "LinkNode", "*", "names", "=", "NULL", ";", "BHead", "*", "bhead", ";", "for", "(", "bhead", "=", "blo_bhead_first", "(", "fd", ")", ";", "bhead", ";", "bhead", "=", "blo_bhead_next", "(", "fd", ",", "bhead", ")", ")", "{", "if", "(", "bhead", "->", "code", "==", "ENDB", ")", "{", "break", ";", "}", "else", "if", "(", "BKE_idcode_is_valid", "(", "bhead", "->", "code", ")", ")", "{", "if", "(", "BKE_idcode_is_linkable", "(", "bhead", "->", "code", ")", ")", "{", "const", "char", "*", "str", "=", "BKE_idcode_to_name", "(", "bhead", "->", "code", ")", ";", "if", "(", "BLI_gset_add", "(", "gathered", ",", "(", "void", "*", ")", "str", ")", ")", "{", "BLI_linklist_prepend", "(", "&", "names", ",", "strdup", "(", "str", ")", ")", ";", "}", "}", "}", "}", "BLI_gset_free", "(", "gathered", ",", "NULL", ")", ";", "return", "names", ";", "}" ]
Gets the names of all the linkable data-block types available in a file.
[ "Gets", "the", "names", "of", "all", "the", "linkable", "data", "-", "block", "types", "available", "in", "a", "file", "." ]
[]
[ { "param": "bh", "type": "BlendHandle" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "bh", "type": "BlendHandle", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a4b96c9e59c8559504c8f419e3d1ce0feb44c89a
DemonRem/blender
source/blender/blenloader/intern/readblenentry.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BLO_blendhandle_close
void
void BLO_blendhandle_close(BlendHandle *bh) { FileData *fd = (FileData *)bh; blo_filedata_free(fd); }
/** * Close and free a blendhandle. The handle becomes invalid after this call. * * \param bh: The handle to close. */
Close and free a blendhandle. The handle becomes invalid after this call. \param bh: The handle to close.
[ "Close", "and", "free", "a", "blendhandle", ".", "The", "handle", "becomes", "invalid", "after", "this", "call", ".", "\\", "param", "bh", ":", "The", "handle", "to", "close", "." ]
void BLO_blendhandle_close(BlendHandle *bh) { FileData *fd = (FileData *)bh; blo_filedata_free(fd); }
[ "void", "BLO_blendhandle_close", "(", "BlendHandle", "*", "bh", ")", "{", "FileData", "*", "fd", "=", "(", "FileData", "*", ")", "bh", ";", "blo_filedata_free", "(", "fd", ")", ";", "}" ]
Close and free a blendhandle.
[ "Close", "and", "free", "a", "blendhandle", "." ]
[]
[ { "param": "bh", "type": "BlendHandle" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "bh", "type": "BlendHandle", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a4b96c9e59c8559504c8f419e3d1ce0feb44c89a
DemonRem/blender
source/blender/blenloader/intern/readblenentry.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BLO_read_from_file
BlendFileData
BlendFileData *BLO_read_from_file(const char *filepath, eBLOReadSkip skip_flags, ReportList *reports) { BlendFileData *bfd = NULL; FileData *fd; fd = blo_filedata_from_file(filepath, reports); if (fd) { fd->reports = reports; fd->skip_flags = skip_flags; bfd = blo_read_file_internal(fd, filepath); blo_filedata_free(fd); } return bfd; }
/** * Open a blender file from a pathname. The function returns NULL * and sets a report in the list if it cannot open the file. * * \param filepath: The path of the file to open. * \param reports: If the return value is NULL, errors indicating the cause of the failure. * \return The data of the file. */
Open a blender file from a pathname. The function returns NULL and sets a report in the list if it cannot open the file. \param filepath: The path of the file to open. \param reports: If the return value is NULL, errors indicating the cause of the failure. \return The data of the file.
[ "Open", "a", "blender", "file", "from", "a", "pathname", ".", "The", "function", "returns", "NULL", "and", "sets", "a", "report", "in", "the", "list", "if", "it", "cannot", "open", "the", "file", ".", "\\", "param", "filepath", ":", "The", "path", "of", "the", "file", "to", "open", ".", "\\", "param", "reports", ":", "If", "the", "return", "value", "is", "NULL", "errors", "indicating", "the", "cause", "of", "the", "failure", ".", "\\", "return", "The", "data", "of", "the", "file", "." ]
BlendFileData *BLO_read_from_file(const char *filepath, eBLOReadSkip skip_flags, ReportList *reports) { BlendFileData *bfd = NULL; FileData *fd; fd = blo_filedata_from_file(filepath, reports); if (fd) { fd->reports = reports; fd->skip_flags = skip_flags; bfd = blo_read_file_internal(fd, filepath); blo_filedata_free(fd); } return bfd; }
[ "BlendFileData", "*", "BLO_read_from_file", "(", "const", "char", "*", "filepath", ",", "eBLOReadSkip", "skip_flags", ",", "ReportList", "*", "reports", ")", "{", "BlendFileData", "*", "bfd", "=", "NULL", ";", "FileData", "*", "fd", ";", "fd", "=", "blo_filedata_from_file", "(", "filepath", ",", "reports", ")", ";", "if", "(", "fd", ")", "{", "fd", "->", "reports", "=", "reports", ";", "fd", "->", "skip_flags", "=", "skip_flags", ";", "bfd", "=", "blo_read_file_internal", "(", "fd", ",", "filepath", ")", ";", "blo_filedata_free", "(", "fd", ")", ";", "}", "return", "bfd", ";", "}" ]
Open a blender file from a pathname.
[ "Open", "a", "blender", "file", "from", "a", "pathname", "." ]
[]
[ { "param": "filepath", "type": "char" }, { "param": "skip_flags", "type": "eBLOReadSkip" }, { "param": "reports", "type": "ReportList" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "filepath", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "skip_flags", "type": "eBLOReadSkip", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "reports", "type": "ReportList", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a4b96c9e59c8559504c8f419e3d1ce0feb44c89a
DemonRem/blender
source/blender/blenloader/intern/readblenentry.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BLO_read_from_memory
BlendFileData
BlendFileData *BLO_read_from_memory(const void *mem, int memsize, eBLOReadSkip skip_flags, ReportList *reports) { BlendFileData *bfd = NULL; FileData *fd; fd = blo_filedata_from_memory(mem, memsize, reports); if (fd) { fd->reports = reports; fd->skip_flags = skip_flags; bfd = blo_read_file_internal(fd, ""); blo_filedata_free(fd); } return bfd; }
/** * Open a blender file from memory. The function returns NULL * and sets a report in the list if it cannot open the file. * * \param mem: The file data. * \param memsize: The length of \a mem. * \param reports: If the return value is NULL, errors indicating the cause of the failure. * \return The data of the file. */
Open a blender file from memory. The function returns NULL and sets a report in the list if it cannot open the file. \param mem: The file data. \param memsize: The length of \a mem. \param reports: If the return value is NULL, errors indicating the cause of the failure. \return The data of the file.
[ "Open", "a", "blender", "file", "from", "memory", ".", "The", "function", "returns", "NULL", "and", "sets", "a", "report", "in", "the", "list", "if", "it", "cannot", "open", "the", "file", ".", "\\", "param", "mem", ":", "The", "file", "data", ".", "\\", "param", "memsize", ":", "The", "length", "of", "\\", "a", "mem", ".", "\\", "param", "reports", ":", "If", "the", "return", "value", "is", "NULL", "errors", "indicating", "the", "cause", "of", "the", "failure", ".", "\\", "return", "The", "data", "of", "the", "file", "." ]
BlendFileData *BLO_read_from_memory(const void *mem, int memsize, eBLOReadSkip skip_flags, ReportList *reports) { BlendFileData *bfd = NULL; FileData *fd; fd = blo_filedata_from_memory(mem, memsize, reports); if (fd) { fd->reports = reports; fd->skip_flags = skip_flags; bfd = blo_read_file_internal(fd, ""); blo_filedata_free(fd); } return bfd; }
[ "BlendFileData", "*", "BLO_read_from_memory", "(", "const", "void", "*", "mem", ",", "int", "memsize", ",", "eBLOReadSkip", "skip_flags", ",", "ReportList", "*", "reports", ")", "{", "BlendFileData", "*", "bfd", "=", "NULL", ";", "FileData", "*", "fd", ";", "fd", "=", "blo_filedata_from_memory", "(", "mem", ",", "memsize", ",", "reports", ")", ";", "if", "(", "fd", ")", "{", "fd", "->", "reports", "=", "reports", ";", "fd", "->", "skip_flags", "=", "skip_flags", ";", "bfd", "=", "blo_read_file_internal", "(", "fd", ",", "\"", "\"", ")", ";", "blo_filedata_free", "(", "fd", ")", ";", "}", "return", "bfd", ";", "}" ]
Open a blender file from memory.
[ "Open", "a", "blender", "file", "from", "memory", "." ]
[]
[ { "param": "mem", "type": "void" }, { "param": "memsize", "type": "int" }, { "param": "skip_flags", "type": "eBLOReadSkip" }, { "param": "reports", "type": "ReportList" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "mem", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "memsize", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "skip_flags", "type": "eBLOReadSkip", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "reports", "type": "ReportList", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a4b96c9e59c8559504c8f419e3d1ce0feb44c89a
DemonRem/blender
source/blender/blenloader/intern/readblenentry.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BLO_read_from_memfile
BlendFileData
BlendFileData *BLO_read_from_memfile(Main *oldmain, const char *filename, MemFile *memfile, eBLOReadSkip skip_flags, ReportList *reports) { BlendFileData *bfd = NULL; FileData *fd; ListBase old_mainlist; fd = blo_filedata_from_memfile(memfile, reports); if (fd) { fd->reports = reports; fd->skip_flags = skip_flags; BLI_strncpy(fd->relabase, filename, sizeof(fd->relabase)); /* clear ob->proxy_from pointers in old main */ blo_clear_proxy_pointers_from_lib(oldmain); /* separate libraries from old main */ blo_split_main(&old_mainlist, oldmain); /* add the library pointers in oldmap lookup */ blo_add_library_pointer_map(&old_mainlist, fd); /* makes lookup of existing images in old main */ blo_make_image_pointer_map(fd, oldmain); /* makes lookup of existing light caches in old main */ blo_make_scene_pointer_map(fd, oldmain); /* makes lookup of existing video clips in old main */ blo_make_movieclip_pointer_map(fd, oldmain); /* make lookups of existing sound data in old main */ blo_make_sound_pointer_map(fd, oldmain); /* removed packed data from this trick - it's internal data that needs saves */ bfd = blo_read_file_internal(fd, filename); /* ensures relinked light caches are not freed */ blo_end_scene_pointer_map(fd, oldmain); /* ensures relinked images are not freed */ blo_end_image_pointer_map(fd, oldmain); /* ensures relinked movie clips are not freed */ blo_end_movieclip_pointer_map(fd, oldmain); /* ensures relinked sounds are not freed */ blo_end_sound_pointer_map(fd, oldmain); /* Still in-use libraries have already been moved from oldmain to new mainlist, * but oldmain itself shall *never* be 'transferred' to new mainlist! */ BLI_assert(old_mainlist.first == oldmain); if (bfd && old_mainlist.first != old_mainlist.last) { /* Even though directly used libs have been already moved to new main, * indirect ones have not. * This is a bit annoying, but we have no choice but to keep them all for now - * means some now unused data may remain in memory, but think we'll have to live with it. */ Main *libmain, *libmain_next; Main *newmain = bfd->main; ListBase new_mainlist = {newmain, newmain}; for (libmain = oldmain->next; libmain; libmain = libmain_next) { libmain_next = libmain->next; /* Note that LIB_INDIRECT does not work with libraries themselves, so we use non-NULL * parent to detect indirect-linked ones. */ if (libmain->curlib && (libmain->curlib->parent != NULL)) { BLI_remlink(&old_mainlist, libmain); BLI_addtail(&new_mainlist, libmain); } else { #ifdef PRINT_DEBUG printf("Dropped Main for lib: %s\n", libmain->curlib->id.name); #endif } } /* In any case, we need to move all lib data-blocks themselves - those are * 'first level data', getting rid of them would imply updating spaces & co * to prevent invalid pointers access. */ BLI_movelisttolist(&newmain->libraries, &oldmain->libraries); blo_join_main(&new_mainlist); } #if 0 printf("Remaining mains/libs in oldmain: %d\n", BLI_listbase_count(&fd->old_mainlist) - 1); #endif /* That way, libs (aka mains) we did not reuse in new undone/redone state * will be cleared together with oldmain... */ blo_join_main(&old_mainlist); blo_filedata_free(fd); } return bfd; }
/** * Used for undo/redo, skips part of libraries reading * (assuming their data are already loaded & valid). * * \param oldmain: old main, * from which we will keep libraries and other data-blocks that should not have changed. * \param filename: current file, only for retrieving library data. */
Used for undo/redo, skips part of libraries reading (assuming their data are already loaded & valid). \param oldmain: old main, from which we will keep libraries and other data-blocks that should not have changed. \param filename: current file, only for retrieving library data.
[ "Used", "for", "undo", "/", "redo", "skips", "part", "of", "libraries", "reading", "(", "assuming", "their", "data", "are", "already", "loaded", "&", "valid", ")", ".", "\\", "param", "oldmain", ":", "old", "main", "from", "which", "we", "will", "keep", "libraries", "and", "other", "data", "-", "blocks", "that", "should", "not", "have", "changed", ".", "\\", "param", "filename", ":", "current", "file", "only", "for", "retrieving", "library", "data", "." ]
BlendFileData *BLO_read_from_memfile(Main *oldmain, const char *filename, MemFile *memfile, eBLOReadSkip skip_flags, ReportList *reports) { BlendFileData *bfd = NULL; FileData *fd; ListBase old_mainlist; fd = blo_filedata_from_memfile(memfile, reports); if (fd) { fd->reports = reports; fd->skip_flags = skip_flags; BLI_strncpy(fd->relabase, filename, sizeof(fd->relabase)); blo_clear_proxy_pointers_from_lib(oldmain); blo_split_main(&old_mainlist, oldmain); blo_add_library_pointer_map(&old_mainlist, fd); blo_make_image_pointer_map(fd, oldmain); blo_make_scene_pointer_map(fd, oldmain); blo_make_movieclip_pointer_map(fd, oldmain); blo_make_sound_pointer_map(fd, oldmain); bfd = blo_read_file_internal(fd, filename); blo_end_scene_pointer_map(fd, oldmain); blo_end_image_pointer_map(fd, oldmain); blo_end_movieclip_pointer_map(fd, oldmain); blo_end_sound_pointer_map(fd, oldmain); BLI_assert(old_mainlist.first == oldmain); if (bfd && old_mainlist.first != old_mainlist.last) { Main *libmain, *libmain_next; Main *newmain = bfd->main; ListBase new_mainlist = {newmain, newmain}; for (libmain = oldmain->next; libmain; libmain = libmain_next) { libmain_next = libmain->next; if (libmain->curlib && (libmain->curlib->parent != NULL)) { BLI_remlink(&old_mainlist, libmain); BLI_addtail(&new_mainlist, libmain); } else { #ifdef PRINT_DEBUG printf("Dropped Main for lib: %s\n", libmain->curlib->id.name); #endif } } BLI_movelisttolist(&newmain->libraries, &oldmain->libraries); blo_join_main(&new_mainlist); } #if 0 printf("Remaining mains/libs in oldmain: %d\n", BLI_listbase_count(&fd->old_mainlist) - 1); #endif blo_join_main(&old_mainlist); blo_filedata_free(fd); } return bfd; }
[ "BlendFileData", "*", "BLO_read_from_memfile", "(", "Main", "*", "oldmain", ",", "const", "char", "*", "filename", ",", "MemFile", "*", "memfile", ",", "eBLOReadSkip", "skip_flags", ",", "ReportList", "*", "reports", ")", "{", "BlendFileData", "*", "bfd", "=", "NULL", ";", "FileData", "*", "fd", ";", "ListBase", "old_mainlist", ";", "fd", "=", "blo_filedata_from_memfile", "(", "memfile", ",", "reports", ")", ";", "if", "(", "fd", ")", "{", "fd", "->", "reports", "=", "reports", ";", "fd", "->", "skip_flags", "=", "skip_flags", ";", "BLI_strncpy", "(", "fd", "->", "relabase", ",", "filename", ",", "sizeof", "(", "fd", "->", "relabase", ")", ")", ";", "blo_clear_proxy_pointers_from_lib", "(", "oldmain", ")", ";", "blo_split_main", "(", "&", "old_mainlist", ",", "oldmain", ")", ";", "blo_add_library_pointer_map", "(", "&", "old_mainlist", ",", "fd", ")", ";", "blo_make_image_pointer_map", "(", "fd", ",", "oldmain", ")", ";", "blo_make_scene_pointer_map", "(", "fd", ",", "oldmain", ")", ";", "blo_make_movieclip_pointer_map", "(", "fd", ",", "oldmain", ")", ";", "blo_make_sound_pointer_map", "(", "fd", ",", "oldmain", ")", ";", "bfd", "=", "blo_read_file_internal", "(", "fd", ",", "filename", ")", ";", "blo_end_scene_pointer_map", "(", "fd", ",", "oldmain", ")", ";", "blo_end_image_pointer_map", "(", "fd", ",", "oldmain", ")", ";", "blo_end_movieclip_pointer_map", "(", "fd", ",", "oldmain", ")", ";", "blo_end_sound_pointer_map", "(", "fd", ",", "oldmain", ")", ";", "BLI_assert", "(", "old_mainlist", ".", "first", "==", "oldmain", ")", ";", "if", "(", "bfd", "&&", "old_mainlist", ".", "first", "!=", "old_mainlist", ".", "last", ")", "{", "Main", "*", "libmain", ",", "*", "libmain_next", ";", "Main", "*", "newmain", "=", "bfd", "->", "main", ";", "ListBase", "new_mainlist", "=", "{", "newmain", ",", "newmain", "}", ";", "for", "(", "libmain", "=", "oldmain", "->", "next", ";", "libmain", ";", "libmain", "=", "libmain_next", ")", "{", "libmain_next", "=", "libmain", "->", "next", ";", "if", "(", "libmain", "->", "curlib", "&&", "(", "libmain", "->", "curlib", "->", "parent", "!=", "NULL", ")", ")", "{", "BLI_remlink", "(", "&", "old_mainlist", ",", "libmain", ")", ";", "BLI_addtail", "(", "&", "new_mainlist", ",", "libmain", ")", ";", "}", "else", "{", "#ifdef", "PRINT_DEBUG", "printf", "(", "\"", "\\n", "\"", ",", "libmain", "->", "curlib", "->", "id", ".", "name", ")", ";", "#endif", "}", "}", "BLI_movelisttolist", "(", "&", "newmain", "->", "libraries", ",", "&", "oldmain", "->", "libraries", ")", ";", "blo_join_main", "(", "&", "new_mainlist", ")", ";", "}", "#if", "0", "\n", "printf", "(", "\"", "\\n", "\"", ",", "BLI_listbase_count", "(", "&", "fd", "->", "old_mainlist", ")", "-", "1", ")", ";", "#endif", "blo_join_main", "(", "&", "old_mainlist", ")", ";", "blo_filedata_free", "(", "fd", ")", ";", "}", "return", "bfd", ";", "}" ]
Used for undo/redo, skips part of libraries reading (assuming their data are already loaded & valid).
[ "Used", "for", "undo", "/", "redo", "skips", "part", "of", "libraries", "reading", "(", "assuming", "their", "data", "are", "already", "loaded", "&", "valid", ")", "." ]
[ "/* clear ob->proxy_from pointers in old main */", "/* separate libraries from old main */", "/* add the library pointers in oldmap lookup */", "/* makes lookup of existing images in old main */", "/* makes lookup of existing light caches in old main */", "/* makes lookup of existing video clips in old main */", "/* make lookups of existing sound data in old main */", "/* removed packed data from this trick - it's internal data that needs saves */", "/* ensures relinked light caches are not freed */", "/* ensures relinked images are not freed */", "/* ensures relinked movie clips are not freed */", "/* ensures relinked sounds are not freed */", "/* Still in-use libraries have already been moved from oldmain to new mainlist,\n * but oldmain itself shall *never* be 'transferred' to new mainlist! */", "/* Even though directly used libs have been already moved to new main,\n * indirect ones have not.\n * This is a bit annoying, but we have no choice but to keep them all for now -\n * means some now unused data may remain in memory, but think we'll have to live with it. */", "/* Note that LIB_INDIRECT does not work with libraries themselves, so we use non-NULL\n * parent to detect indirect-linked ones. */", "/* In any case, we need to move all lib data-blocks themselves - those are\n * 'first level data', getting rid of them would imply updating spaces & co\n * to prevent invalid pointers access. */", "/* That way, libs (aka mains) we did not reuse in new undone/redone state\n * will be cleared together with oldmain... */" ]
[ { "param": "oldmain", "type": "Main" }, { "param": "filename", "type": "char" }, { "param": "memfile", "type": "MemFile" }, { "param": "skip_flags", "type": "eBLOReadSkip" }, { "param": "reports", "type": "ReportList" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "oldmain", "type": "Main", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "filename", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "memfile", "type": "MemFile", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "skip_flags", "type": "eBLOReadSkip", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "reports", "type": "ReportList", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a4b96c9e59c8559504c8f419e3d1ce0feb44c89a
DemonRem/blender
source/blender/blenloader/intern/readblenentry.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BLO_blendfiledata_free
void
void BLO_blendfiledata_free(BlendFileData *bfd) { if (bfd->main) { BKE_main_free(bfd->main); } if (bfd->user) { MEM_freeN(bfd->user); } MEM_freeN(bfd); }
/** * Frees a BlendFileData structure and *all* the data associated with it * (the userdef data, and the main libblock data). * * \param bfd: The structure to free. */
Frees a BlendFileData structure and *all* the data associated with it (the userdef data, and the main libblock data). \param bfd: The structure to free.
[ "Frees", "a", "BlendFileData", "structure", "and", "*", "all", "*", "the", "data", "associated", "with", "it", "(", "the", "userdef", "data", "and", "the", "main", "libblock", "data", ")", ".", "\\", "param", "bfd", ":", "The", "structure", "to", "free", "." ]
void BLO_blendfiledata_free(BlendFileData *bfd) { if (bfd->main) { BKE_main_free(bfd->main); } if (bfd->user) { MEM_freeN(bfd->user); } MEM_freeN(bfd); }
[ "void", "BLO_blendfiledata_free", "(", "BlendFileData", "*", "bfd", ")", "{", "if", "(", "bfd", "->", "main", ")", "{", "BKE_main_free", "(", "bfd", "->", "main", ")", ";", "}", "if", "(", "bfd", "->", "user", ")", "{", "MEM_freeN", "(", "bfd", "->", "user", ")", ";", "}", "MEM_freeN", "(", "bfd", ")", ";", "}" ]
Frees a BlendFileData structure and *all* the data associated with it (the userdef data, and the main libblock data).
[ "Frees", "a", "BlendFileData", "structure", "and", "*", "all", "*", "the", "data", "associated", "with", "it", "(", "the", "userdef", "data", "and", "the", "main", "libblock", "data", ")", "." ]
[]
[ { "param": "bfd", "type": "BlendFileData" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "bfd", "type": "BlendFileData", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3159464072e842826376dd549387fdc2d02171a2
DemonRem/blender
source/blender/editors/transform/transform_orientations.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
bm_mesh_elems_select_get_n__internal
null
static unsigned int bm_mesh_elems_select_get_n__internal( BMesh *bm, BMElem **elems, const unsigned int n, const BMIterType itype, const char htype) { BMIter iter; BMElem *ele; unsigned int i; BLI_assert(ELEM(htype, BM_VERT, BM_EDGE, BM_FACE)); BLI_assert(ELEM(itype, BM_VERTS_OF_MESH, BM_EDGES_OF_MESH, BM_FACES_OF_MESH)); if (!BLI_listbase_is_empty(&bm->selected)) { /* quick check */ BMEditSelection *ese; i = 0; for (ese = bm->selected.last; ese; ese = ese->prev) { /* shouldn't need this check */ if (BM_elem_flag_test(ese->ele, BM_ELEM_SELECT)) { /* only use contiguous selection */ if (ese->htype != htype) { i = 0; break; } elems[i++] = ese->ele; if (n == i) { break; } } else { BLI_assert(0); } } if (i == 0) { /* pass */ } else if (i == n) { return i; } } i = 0; BM_ITER_MESH (ele, &iter, bm, itype) { BLI_assert(ele->head.htype == htype); if (BM_elem_flag_test(ele, BM_ELEM_SELECT)) { elems[i++] = ele; if (n == i) { break; } } } return i; }
/** * utility function - get first n, selected vert/edge/faces */
utility function - get first n, selected vert/edge/faces
[ "utility", "function", "-", "get", "first", "n", "selected", "vert", "/", "edge", "/", "faces" ]
static unsigned int bm_mesh_elems_select_get_n__internal( BMesh *bm, BMElem **elems, const unsigned int n, const BMIterType itype, const char htype) { BMIter iter; BMElem *ele; unsigned int i; BLI_assert(ELEM(htype, BM_VERT, BM_EDGE, BM_FACE)); BLI_assert(ELEM(itype, BM_VERTS_OF_MESH, BM_EDGES_OF_MESH, BM_FACES_OF_MESH)); if (!BLI_listbase_is_empty(&bm->selected)) { BMEditSelection *ese; i = 0; for (ese = bm->selected.last; ese; ese = ese->prev) { if (BM_elem_flag_test(ese->ele, BM_ELEM_SELECT)) { if (ese->htype != htype) { i = 0; break; } elems[i++] = ese->ele; if (n == i) { break; } } else { BLI_assert(0); } } if (i == 0) { } else if (i == n) { return i; } } i = 0; BM_ITER_MESH (ele, &iter, bm, itype) { BLI_assert(ele->head.htype == htype); if (BM_elem_flag_test(ele, BM_ELEM_SELECT)) { elems[i++] = ele; if (n == i) { break; } } } return i; }
[ "static", "unsigned", "int", "bm_mesh_elems_select_get_n__internal", "(", "BMesh", "*", "bm", ",", "BMElem", "*", "*", "elems", ",", "const", "unsigned", "int", "n", ",", "const", "BMIterType", "itype", ",", "const", "char", "htype", ")", "{", "BMIter", "iter", ";", "BMElem", "*", "ele", ";", "unsigned", "int", "i", ";", "BLI_assert", "(", "ELEM", "(", "htype", ",", "BM_VERT", ",", "BM_EDGE", ",", "BM_FACE", ")", ")", ";", "BLI_assert", "(", "ELEM", "(", "itype", ",", "BM_VERTS_OF_MESH", ",", "BM_EDGES_OF_MESH", ",", "BM_FACES_OF_MESH", ")", ")", ";", "if", "(", "!", "BLI_listbase_is_empty", "(", "&", "bm", "->", "selected", ")", ")", "{", "BMEditSelection", "*", "ese", ";", "i", "=", "0", ";", "for", "(", "ese", "=", "bm", "->", "selected", ".", "last", ";", "ese", ";", "ese", "=", "ese", "->", "prev", ")", "{", "if", "(", "BM_elem_flag_test", "(", "ese", "->", "ele", ",", "BM_ELEM_SELECT", ")", ")", "{", "if", "(", "ese", "->", "htype", "!=", "htype", ")", "{", "i", "=", "0", ";", "break", ";", "}", "elems", "[", "i", "++", "]", "=", "ese", "->", "ele", ";", "if", "(", "n", "==", "i", ")", "{", "break", ";", "}", "}", "else", "{", "BLI_assert", "(", "0", ")", ";", "}", "}", "if", "(", "i", "==", "0", ")", "{", "}", "else", "if", "(", "i", "==", "n", ")", "{", "return", "i", ";", "}", "}", "i", "=", "0", ";", "BM_ITER_MESH", "(", "ele", ",", "&", "iter", ",", "bm", ",", "itype", ")", "", "{", "BLI_assert", "(", "ele", "->", "head", ".", "htype", "==", "htype", ")", ";", "if", "(", "BM_elem_flag_test", "(", "ele", ",", "BM_ELEM_SELECT", ")", ")", "{", "elems", "[", "i", "++", "]", "=", "ele", ";", "if", "(", "n", "==", "i", ")", "{", "break", ";", "}", "}", "}", "return", "i", ";", "}" ]
utility function - get first n, selected vert/edge/faces
[ "utility", "function", "-", "get", "first", "n", "selected", "vert", "/", "edge", "/", "faces" ]
[ "/* quick check */", "/* shouldn't need this check */", "/* only use contiguous selection */", "/* pass */" ]
[ { "param": "bm", "type": "BMesh" }, { "param": "elems", "type": "BMElem" }, { "param": "n", "type": "unsigned int" }, { "param": "itype", "type": "BMIterType" }, { "param": "htype", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "bm", "type": "BMesh", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "elems", "type": "BMElem", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "n", "type": "unsigned int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "itype", "type": "BMIterType", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "htype", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
8e2c3a11ac03b0b2602dc428c5dbda3fe35a3e32
DemonRem/blender
source/blender/blenkernel/intern/main.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
which_libbase
ListBase
ListBase *which_libbase(Main *bmain, short type) { switch ((ID_Type)type) { case ID_SCE: return &(bmain->scenes); case ID_LI: return &(bmain->libraries); case ID_OB: return &(bmain->objects); case ID_ME: return &(bmain->meshes); case ID_CU: return &(bmain->curves); case ID_MB: return &(bmain->metaballs); case ID_MA: return &(bmain->materials); case ID_TE: return &(bmain->textures); case ID_IM: return &(bmain->images); case ID_LT: return &(bmain->lattices); case ID_LA: return &(bmain->lights); case ID_CA: return &(bmain->cameras); case ID_IP: return &(bmain->ipo); case ID_KE: return &(bmain->shapekeys); case ID_WO: return &(bmain->worlds); case ID_SCR: return &(bmain->screens); case ID_VF: return &(bmain->fonts); case ID_TXT: return &(bmain->texts); case ID_SPK: return &(bmain->speakers); case ID_LP: return &(bmain->lightprobes); case ID_SO: return &(bmain->sounds); case ID_GR: return &(bmain->collections); case ID_AR: return &(bmain->armatures); case ID_AC: return &(bmain->actions); case ID_NT: return &(bmain->nodetrees); case ID_BR: return &(bmain->brushes); case ID_PA: return &(bmain->particles); case ID_WM: return &(bmain->wm); case ID_GD: return &(bmain->gpencils); case ID_MC: return &(bmain->movieclips); case ID_MSK: return &(bmain->masks); case ID_LS: return &(bmain->linestyles); case ID_PAL: return &(bmain->palettes); case ID_PC: return &(bmain->paintcurves); case ID_CF: return &(bmain->cachefiles); case ID_WS: return &(bmain->workspaces); } return NULL; }
/** * \return A pointer to the \a ListBase of given \a bmain for requested \a type ID type. */
\return A pointer to the \a ListBase of given \a bmain for requested \a type ID type.
[ "\\", "return", "A", "pointer", "to", "the", "\\", "a", "ListBase", "of", "given", "\\", "a", "bmain", "for", "requested", "\\", "a", "type", "ID", "type", "." ]
ListBase *which_libbase(Main *bmain, short type) { switch ((ID_Type)type) { case ID_SCE: return &(bmain->scenes); case ID_LI: return &(bmain->libraries); case ID_OB: return &(bmain->objects); case ID_ME: return &(bmain->meshes); case ID_CU: return &(bmain->curves); case ID_MB: return &(bmain->metaballs); case ID_MA: return &(bmain->materials); case ID_TE: return &(bmain->textures); case ID_IM: return &(bmain->images); case ID_LT: return &(bmain->lattices); case ID_LA: return &(bmain->lights); case ID_CA: return &(bmain->cameras); case ID_IP: return &(bmain->ipo); case ID_KE: return &(bmain->shapekeys); case ID_WO: return &(bmain->worlds); case ID_SCR: return &(bmain->screens); case ID_VF: return &(bmain->fonts); case ID_TXT: return &(bmain->texts); case ID_SPK: return &(bmain->speakers); case ID_LP: return &(bmain->lightprobes); case ID_SO: return &(bmain->sounds); case ID_GR: return &(bmain->collections); case ID_AR: return &(bmain->armatures); case ID_AC: return &(bmain->actions); case ID_NT: return &(bmain->nodetrees); case ID_BR: return &(bmain->brushes); case ID_PA: return &(bmain->particles); case ID_WM: return &(bmain->wm); case ID_GD: return &(bmain->gpencils); case ID_MC: return &(bmain->movieclips); case ID_MSK: return &(bmain->masks); case ID_LS: return &(bmain->linestyles); case ID_PAL: return &(bmain->palettes); case ID_PC: return &(bmain->paintcurves); case ID_CF: return &(bmain->cachefiles); case ID_WS: return &(bmain->workspaces); } return NULL; }
[ "ListBase", "*", "which_libbase", "(", "Main", "*", "bmain", ",", "short", "type", ")", "{", "switch", "(", "(", "ID_Type", ")", "type", ")", "{", "case", "ID_SCE", ":", "return", "&", "(", "bmain", "->", "scenes", ")", ";", "case", "ID_LI", ":", "return", "&", "(", "bmain", "->", "libraries", ")", ";", "case", "ID_OB", ":", "return", "&", "(", "bmain", "->", "objects", ")", ";", "case", "ID_ME", ":", "return", "&", "(", "bmain", "->", "meshes", ")", ";", "case", "ID_CU", ":", "return", "&", "(", "bmain", "->", "curves", ")", ";", "case", "ID_MB", ":", "return", "&", "(", "bmain", "->", "metaballs", ")", ";", "case", "ID_MA", ":", "return", "&", "(", "bmain", "->", "materials", ")", ";", "case", "ID_TE", ":", "return", "&", "(", "bmain", "->", "textures", ")", ";", "case", "ID_IM", ":", "return", "&", "(", "bmain", "->", "images", ")", ";", "case", "ID_LT", ":", "return", "&", "(", "bmain", "->", "lattices", ")", ";", "case", "ID_LA", ":", "return", "&", "(", "bmain", "->", "lights", ")", ";", "case", "ID_CA", ":", "return", "&", "(", "bmain", "->", "cameras", ")", ";", "case", "ID_IP", ":", "return", "&", "(", "bmain", "->", "ipo", ")", ";", "case", "ID_KE", ":", "return", "&", "(", "bmain", "->", "shapekeys", ")", ";", "case", "ID_WO", ":", "return", "&", "(", "bmain", "->", "worlds", ")", ";", "case", "ID_SCR", ":", "return", "&", "(", "bmain", "->", "screens", ")", ";", "case", "ID_VF", ":", "return", "&", "(", "bmain", "->", "fonts", ")", ";", "case", "ID_TXT", ":", "return", "&", "(", "bmain", "->", "texts", ")", ";", "case", "ID_SPK", ":", "return", "&", "(", "bmain", "->", "speakers", ")", ";", "case", "ID_LP", ":", "return", "&", "(", "bmain", "->", "lightprobes", ")", ";", "case", "ID_SO", ":", "return", "&", "(", "bmain", "->", "sounds", ")", ";", "case", "ID_GR", ":", "return", "&", "(", "bmain", "->", "collections", ")", ";", "case", "ID_AR", ":", "return", "&", "(", "bmain", "->", "armatures", ")", ";", "case", "ID_AC", ":", "return", "&", "(", "bmain", "->", "actions", ")", ";", "case", "ID_NT", ":", "return", "&", "(", "bmain", "->", "nodetrees", ")", ";", "case", "ID_BR", ":", "return", "&", "(", "bmain", "->", "brushes", ")", ";", "case", "ID_PA", ":", "return", "&", "(", "bmain", "->", "particles", ")", ";", "case", "ID_WM", ":", "return", "&", "(", "bmain", "->", "wm", ")", ";", "case", "ID_GD", ":", "return", "&", "(", "bmain", "->", "gpencils", ")", ";", "case", "ID_MC", ":", "return", "&", "(", "bmain", "->", "movieclips", ")", ";", "case", "ID_MSK", ":", "return", "&", "(", "bmain", "->", "masks", ")", ";", "case", "ID_LS", ":", "return", "&", "(", "bmain", "->", "linestyles", ")", ";", "case", "ID_PAL", ":", "return", "&", "(", "bmain", "->", "palettes", ")", ";", "case", "ID_PC", ":", "return", "&", "(", "bmain", "->", "paintcurves", ")", ";", "case", "ID_CF", ":", "return", "&", "(", "bmain", "->", "cachefiles", ")", ";", "case", "ID_WS", ":", "return", "&", "(", "bmain", "->", "workspaces", ")", ";", "}", "return", "NULL", ";", "}" ]
\return A pointer to the \a ListBase of given \a bmain for requested \a type ID type.
[ "\\", "return", "A", "pointer", "to", "the", "\\", "a", "ListBase", "of", "given", "\\", "a", "bmain", "for", "requested", "\\", "a", "type", "ID", "type", "." ]
[]
[ { "param": "bmain", "type": "Main" }, { "param": "type", "type": "short" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "bmain", "type": "Main", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "type", "type": "short", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
368a6b46c7e47a30b3d95399186a4ed3efaf3ebb
DemonRem/blender
source/blender/modifiers/intern/MOD_weightvgmix.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
mix_weight
float
static float mix_weight(float weight, float weight2, char mix_mode) { #if 0 /* * XXX Don't know why, but the switch version takes many CPU time, * and produces lag in realtime playback... */ switch (mix_mode) { case MOD_WVG_MIX_ADD: return (weight + weight2); case MOD_WVG_MIX_SUB: return (weight - weight2); case MOD_WVG_MIX_MUL: return (weight * weight2); case MOD_WVG_MIX_DIV: /* Avoid dividing by zero (or really small values). */ if (0.0 <= weight2 < MOD_WVG_ZEROFLOOR) { weight2 = MOD_WVG_ZEROFLOOR; } else if (-MOD_WVG_ZEROFLOOR < weight2) { weight2 = -MOD_WVG_ZEROFLOOR; } return (weight / weight2); case MOD_WVG_MIX_DIF: return (weight < weight2 ? weight2 - weight : weight - weight2); case MOD_WVG_MIX_AVG: return (weight + weight2) / 2.0; case MOD_WVG_MIX_SET: default: return weight2; } #endif if (mix_mode == MOD_WVG_MIX_SET) { return weight2; } else if (mix_mode == MOD_WVG_MIX_ADD) { return (weight + weight2); } else if (mix_mode == MOD_WVG_MIX_SUB) { return (weight - weight2); } else if (mix_mode == MOD_WVG_MIX_MUL) { return (weight * weight2); } else if (mix_mode == MOD_WVG_MIX_DIV) { /* Avoid dividing by zero (or really small values). */ if (weight2 < 0.0f && weight2 > -MOD_WVG_ZEROFLOOR) { weight2 = -MOD_WVG_ZEROFLOOR; } else if (weight2 >= 0.0f && weight2 < MOD_WVG_ZEROFLOOR) { weight2 = MOD_WVG_ZEROFLOOR; } return (weight / weight2); } else if (mix_mode == MOD_WVG_MIX_DIF) { return (weight < weight2 ? weight2 - weight : weight - weight2); } else if (mix_mode == MOD_WVG_MIX_AVG) { return (weight + weight2) * 0.5f; } else { return weight2; } }
/** * This mixes the old weight with the new weight factor. */
This mixes the old weight with the new weight factor.
[ "This", "mixes", "the", "old", "weight", "with", "the", "new", "weight", "factor", "." ]
static float mix_weight(float weight, float weight2, char mix_mode) { #if 0 switch (mix_mode) { case MOD_WVG_MIX_ADD: return (weight + weight2); case MOD_WVG_MIX_SUB: return (weight - weight2); case MOD_WVG_MIX_MUL: return (weight * weight2); case MOD_WVG_MIX_DIV: if (0.0 <= weight2 < MOD_WVG_ZEROFLOOR) { weight2 = MOD_WVG_ZEROFLOOR; } else if (-MOD_WVG_ZEROFLOOR < weight2) { weight2 = -MOD_WVG_ZEROFLOOR; } return (weight / weight2); case MOD_WVG_MIX_DIF: return (weight < weight2 ? weight2 - weight : weight - weight2); case MOD_WVG_MIX_AVG: return (weight + weight2) / 2.0; case MOD_WVG_MIX_SET: default: return weight2; } #endif if (mix_mode == MOD_WVG_MIX_SET) { return weight2; } else if (mix_mode == MOD_WVG_MIX_ADD) { return (weight + weight2); } else if (mix_mode == MOD_WVG_MIX_SUB) { return (weight - weight2); } else if (mix_mode == MOD_WVG_MIX_MUL) { return (weight * weight2); } else if (mix_mode == MOD_WVG_MIX_DIV) { if (weight2 < 0.0f && weight2 > -MOD_WVG_ZEROFLOOR) { weight2 = -MOD_WVG_ZEROFLOOR; } else if (weight2 >= 0.0f && weight2 < MOD_WVG_ZEROFLOOR) { weight2 = MOD_WVG_ZEROFLOOR; } return (weight / weight2); } else if (mix_mode == MOD_WVG_MIX_DIF) { return (weight < weight2 ? weight2 - weight : weight - weight2); } else if (mix_mode == MOD_WVG_MIX_AVG) { return (weight + weight2) * 0.5f; } else { return weight2; } }
[ "static", "float", "mix_weight", "(", "float", "weight", ",", "float", "weight2", ",", "char", "mix_mode", ")", "{", "#if", "0", "\n", "switch", "(", "mix_mode", ")", "{", "case", "MOD_WVG_MIX_ADD", ":", "return", "(", "weight", "+", "weight2", ")", ";", "case", "MOD_WVG_MIX_SUB", ":", "return", "(", "weight", "-", "weight2", ")", ";", "case", "MOD_WVG_MIX_MUL", ":", "return", "(", "weight", "*", "weight2", ")", ";", "case", "MOD_WVG_MIX_DIV", ":", "if", "(", "0.0", "<=", "weight2", "<", "MOD_WVG_ZEROFLOOR", ")", "{", "weight2", "=", "MOD_WVG_ZEROFLOOR", ";", "}", "else", "if", "(", "-", "MOD_WVG_ZEROFLOOR", "<", "weight2", ")", "{", "weight2", "=", "-", "MOD_WVG_ZEROFLOOR", ";", "}", "return", "(", "weight", "/", "weight2", ")", ";", "case", "MOD_WVG_MIX_DIF", ":", "return", "(", "weight", "<", "weight2", "?", "weight2", "-", "weight", ":", "weight", "-", "weight2", ")", ";", "case", "MOD_WVG_MIX_AVG", ":", "return", "(", "weight", "+", "weight2", ")", "/", "2.0", ";", "case", "MOD_WVG_MIX_SET", ":", "default", ":", "return", "weight2", ";", "}", "#endif", "if", "(", "mix_mode", "==", "MOD_WVG_MIX_SET", ")", "{", "return", "weight2", ";", "}", "else", "if", "(", "mix_mode", "==", "MOD_WVG_MIX_ADD", ")", "{", "return", "(", "weight", "+", "weight2", ")", ";", "}", "else", "if", "(", "mix_mode", "==", "MOD_WVG_MIX_SUB", ")", "{", "return", "(", "weight", "-", "weight2", ")", ";", "}", "else", "if", "(", "mix_mode", "==", "MOD_WVG_MIX_MUL", ")", "{", "return", "(", "weight", "*", "weight2", ")", ";", "}", "else", "if", "(", "mix_mode", "==", "MOD_WVG_MIX_DIV", ")", "{", "if", "(", "weight2", "<", "0.0f", "&&", "weight2", ">", "-", "MOD_WVG_ZEROFLOOR", ")", "{", "weight2", "=", "-", "MOD_WVG_ZEROFLOOR", ";", "}", "else", "if", "(", "weight2", ">=", "0.0f", "&&", "weight2", "<", "MOD_WVG_ZEROFLOOR", ")", "{", "weight2", "=", "MOD_WVG_ZEROFLOOR", ";", "}", "return", "(", "weight", "/", "weight2", ")", ";", "}", "else", "if", "(", "mix_mode", "==", "MOD_WVG_MIX_DIF", ")", "{", "return", "(", "weight", "<", "weight2", "?", "weight2", "-", "weight", ":", "weight", "-", "weight2", ")", ";", "}", "else", "if", "(", "mix_mode", "==", "MOD_WVG_MIX_AVG", ")", "{", "return", "(", "weight", "+", "weight2", ")", "*", "0.5f", ";", "}", "else", "{", "return", "weight2", ";", "}", "}" ]
This mixes the old weight with the new weight factor.
[ "This", "mixes", "the", "old", "weight", "with", "the", "new", "weight", "factor", "." ]
[ "/*\n * XXX Don't know why, but the switch version takes many CPU time,\n * and produces lag in realtime playback...\n */", "/* Avoid dividing by zero (or really small values). */", "/* Avoid dividing by zero (or really small values). */" ]
[ { "param": "weight", "type": "float" }, { "param": "weight2", "type": "float" }, { "param": "mix_mode", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "weight", "type": "float", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "weight2", "type": "float", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "mix_mode", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3b0f4d9c2aa8ca184292b7d55cba215c9c872c41
DemonRem/blender
source/blender/blenkernel/intern/cachefile.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BKE_cachefile_free
void
void BKE_cachefile_free(CacheFile *cache_file) { BKE_animdata_free((ID *)cache_file, false); cachefile_handle_free(cache_file); BLI_freelistN(&cache_file->object_paths); }
/** Free (or release) any data used by this cachefile (does not free the cachefile itself). */
Free (or release) any data used by this cachefile (does not free the cachefile itself).
[ "Free", "(", "or", "release", ")", "any", "data", "used", "by", "this", "cachefile", "(", "does", "not", "free", "the", "cachefile", "itself", ")", "." ]
void BKE_cachefile_free(CacheFile *cache_file) { BKE_animdata_free((ID *)cache_file, false); cachefile_handle_free(cache_file); BLI_freelistN(&cache_file->object_paths); }
[ "void", "BKE_cachefile_free", "(", "CacheFile", "*", "cache_file", ")", "{", "BKE_animdata_free", "(", "(", "ID", "*", ")", "cache_file", ",", "false", ")", ";", "cachefile_handle_free", "(", "cache_file", ")", ";", "BLI_freelistN", "(", "&", "cache_file", "->", "object_paths", ")", ";", "}" ]
Free (or release) any data used by this cachefile (does not free the cachefile itself).
[ "Free", "(", "or", "release", ")", "any", "data", "used", "by", "this", "cachefile", "(", "does", "not", "free", "the", "cachefile", "itself", ")", "." ]
[]
[ { "param": "cache_file", "type": "CacheFile" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cache_file", "type": "CacheFile", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3b0f4d9c2aa8ca184292b7d55cba215c9c872c41
DemonRem/blender
source/blender/blenkernel/intern/cachefile.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BKE_cachefile_copy_data
void
void BKE_cachefile_copy_data(Main *UNUSED(bmain), CacheFile *cache_file_dst, const CacheFile *UNUSED(cache_file_src), const int UNUSED(flag)) { cache_file_dst->handle = NULL; cache_file_dst->handle_readers = NULL; BLI_duplicatelist(&cache_file_dst->object_paths, &cache_file_dst->object_paths); }
/** * Only copy internal data of CacheFile ID from source to already * allocated/initialized destination. * You probably never want to use that directly, * use #BKE_id_copy or #BKE_id_copy_ex for typical needs. * * WARNING! This function will not handle ID user count! * * \param flag: Copying options (see BKE_library.h's LIB_ID_COPY_... flags for more). */
Only copy internal data of CacheFile ID from source to already allocated/initialized destination. You probably never want to use that directly, use #BKE_id_copy or #BKE_id_copy_ex for typical needs. WARNING. This function will not handle ID user count! \param flag: Copying options .
[ "Only", "copy", "internal", "data", "of", "CacheFile", "ID", "from", "source", "to", "already", "allocated", "/", "initialized", "destination", ".", "You", "probably", "never", "want", "to", "use", "that", "directly", "use", "#BKE_id_copy", "or", "#BKE_id_copy_ex", "for", "typical", "needs", ".", "WARNING", ".", "This", "function", "will", "not", "handle", "ID", "user", "count!", "\\", "param", "flag", ":", "Copying", "options", "." ]
void BKE_cachefile_copy_data(Main *UNUSED(bmain), CacheFile *cache_file_dst, const CacheFile *UNUSED(cache_file_src), const int UNUSED(flag)) { cache_file_dst->handle = NULL; cache_file_dst->handle_readers = NULL; BLI_duplicatelist(&cache_file_dst->object_paths, &cache_file_dst->object_paths); }
[ "void", "BKE_cachefile_copy_data", "(", "Main", "*", "UNUSED", "(", "bmain", ")", ",", "CacheFile", "*", "cache_file_dst", ",", "const", "CacheFile", "*", "UNUSED", "(", "cache_file_src", ")", ",", "const", "int", "UNUSED", "(", "flag", ")", ")", "{", "cache_file_dst", "->", "handle", "=", "NULL", ";", "cache_file_dst", "->", "handle_readers", "=", "NULL", ";", "BLI_duplicatelist", "(", "&", "cache_file_dst", "->", "object_paths", ",", "&", "cache_file_dst", "->", "object_paths", ")", ";", "}" ]
Only copy internal data of CacheFile ID from source to already allocated/initialized destination.
[ "Only", "copy", "internal", "data", "of", "CacheFile", "ID", "from", "source", "to", "already", "allocated", "/", "initialized", "destination", "." ]
[]
[ { "param": "UNUSED", "type": "int" }, { "param": "cache_file_dst", "type": "CacheFile" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "UNUSED", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "cache_file_dst", "type": "CacheFile", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b8f8e5303e259a835d6eacc66143ab23a3d805a
DemonRem/blender
source/blender/blenkernel/intern/anim.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
animviz_settings_init
void
void animviz_settings_init(bAnimVizSettings *avs) { /* sanity check */ if (avs == NULL) { return; } /* path settings */ avs->path_bc = avs->path_ac = 10; avs->path_sf = 1; /* xxx - take from scene instead? */ avs->path_ef = 250; /* xxx - take from scene instead? */ avs->path_viewflag = (MOTIONPATH_VIEW_KFRAS | MOTIONPATH_VIEW_KFNOS); avs->path_step = 1; avs->path_bakeflag |= MOTIONPATH_BAKE_HEADS; }
/* Initialize the default settings for animation visualization */
Initialize the default settings for animation visualization
[ "Initialize", "the", "default", "settings", "for", "animation", "visualization" ]
void animviz_settings_init(bAnimVizSettings *avs) { if (avs == NULL) { return; } avs->path_bc = avs->path_ac = 10; avs->path_sf = 1; avs->path_ef = 250; avs->path_viewflag = (MOTIONPATH_VIEW_KFRAS | MOTIONPATH_VIEW_KFNOS); avs->path_step = 1; avs->path_bakeflag |= MOTIONPATH_BAKE_HEADS; }
[ "void", "animviz_settings_init", "(", "bAnimVizSettings", "*", "avs", ")", "{", "if", "(", "avs", "==", "NULL", ")", "{", "return", ";", "}", "avs", "->", "path_bc", "=", "avs", "->", "path_ac", "=", "10", ";", "avs", "->", "path_sf", "=", "1", ";", "avs", "->", "path_ef", "=", "250", ";", "avs", "->", "path_viewflag", "=", "(", "MOTIONPATH_VIEW_KFRAS", "|", "MOTIONPATH_VIEW_KFNOS", ")", ";", "avs", "->", "path_step", "=", "1", ";", "avs", "->", "path_bakeflag", "|=", "MOTIONPATH_BAKE_HEADS", ";", "}" ]
Initialize the default settings for animation visualization
[ "Initialize", "the", "default", "settings", "for", "animation", "visualization" ]
[ "/* sanity check */", "/* path settings */", "/* xxx - take from scene instead? */", "/* xxx - take from scene instead? */" ]
[ { "param": "avs", "type": "bAnimVizSettings" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "avs", "type": "bAnimVizSettings", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b8f8e5303e259a835d6eacc66143ab23a3d805a
DemonRem/blender
source/blender/blenkernel/intern/anim.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
animviz_free_motionpath_cache
void
void animviz_free_motionpath_cache(bMotionPath *mpath) { /* sanity check */ if (mpath == NULL) { return; } /* free the path if necessary */ if (mpath->points) { MEM_freeN(mpath->points); } GPU_VERTBUF_DISCARD_SAFE(mpath->points_vbo); GPU_BATCH_DISCARD_SAFE(mpath->batch_line); GPU_BATCH_DISCARD_SAFE(mpath->batch_points); /* reset the relevant parameters */ mpath->points = NULL; mpath->length = 0; }
/* Free the given motion path's cache */
Free the given motion path's cache
[ "Free", "the", "given", "motion", "path", "'", "s", "cache" ]
void animviz_free_motionpath_cache(bMotionPath *mpath) { if (mpath == NULL) { return; } if (mpath->points) { MEM_freeN(mpath->points); } GPU_VERTBUF_DISCARD_SAFE(mpath->points_vbo); GPU_BATCH_DISCARD_SAFE(mpath->batch_line); GPU_BATCH_DISCARD_SAFE(mpath->batch_points); mpath->points = NULL; mpath->length = 0; }
[ "void", "animviz_free_motionpath_cache", "(", "bMotionPath", "*", "mpath", ")", "{", "if", "(", "mpath", "==", "NULL", ")", "{", "return", ";", "}", "if", "(", "mpath", "->", "points", ")", "{", "MEM_freeN", "(", "mpath", "->", "points", ")", ";", "}", "GPU_VERTBUF_DISCARD_SAFE", "(", "mpath", "->", "points_vbo", ")", ";", "GPU_BATCH_DISCARD_SAFE", "(", "mpath", "->", "batch_line", ")", ";", "GPU_BATCH_DISCARD_SAFE", "(", "mpath", "->", "batch_points", ")", ";", "mpath", "->", "points", "=", "NULL", ";", "mpath", "->", "length", "=", "0", ";", "}" ]
Free the given motion path's cache
[ "Free", "the", "given", "motion", "path", "'", "s", "cache" ]
[ "/* sanity check */", "/* free the path if necessary */", "/* reset the relevant parameters */" ]
[ { "param": "mpath", "type": "bMotionPath" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "mpath", "type": "bMotionPath", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b8f8e5303e259a835d6eacc66143ab23a3d805a
DemonRem/blender
source/blender/blenkernel/intern/anim.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
animviz_free_motionpath
void
void animviz_free_motionpath(bMotionPath *mpath) { /* sanity check */ if (mpath == NULL) { return; } /* free the cache first */ animviz_free_motionpath_cache(mpath); /* now the instance itself */ MEM_freeN(mpath); }
/* Free the given motion path instance and its data * NOTE: this frees the motion path given! */
Free the given motion path instance and its data NOTE: this frees the motion path given!
[ "Free", "the", "given", "motion", "path", "instance", "and", "its", "data", "NOTE", ":", "this", "frees", "the", "motion", "path", "given!" ]
void animviz_free_motionpath(bMotionPath *mpath) { if (mpath == NULL) { return; } animviz_free_motionpath_cache(mpath); MEM_freeN(mpath); }
[ "void", "animviz_free_motionpath", "(", "bMotionPath", "*", "mpath", ")", "{", "if", "(", "mpath", "==", "NULL", ")", "{", "return", ";", "}", "animviz_free_motionpath_cache", "(", "mpath", ")", ";", "MEM_freeN", "(", "mpath", ")", ";", "}" ]
Free the given motion path instance and its data NOTE: this frees the motion path given!
[ "Free", "the", "given", "motion", "path", "instance", "and", "its", "data", "NOTE", ":", "this", "frees", "the", "motion", "path", "given!" ]
[ "/* sanity check */", "/* free the cache first */", "/* now the instance itself */" ]
[ { "param": "mpath", "type": "bMotionPath" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "mpath", "type": "bMotionPath", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b8f8e5303e259a835d6eacc66143ab23a3d805a
DemonRem/blender
source/blender/blenkernel/intern/anim.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
animviz_copy_motionpath
bMotionPath
bMotionPath *animviz_copy_motionpath(const bMotionPath *mpath_src) { bMotionPath *mpath_dst; if (mpath_src == NULL) { return NULL; } mpath_dst = MEM_dupallocN(mpath_src); mpath_dst->points = MEM_dupallocN(mpath_src->points); /* should get recreated on draw... */ mpath_dst->points_vbo = NULL; mpath_dst->batch_line = NULL; mpath_dst->batch_points = NULL; return mpath_dst; }
/* Make a copy of motionpath data, so that viewing with copy on write works */
Make a copy of motionpath data, so that viewing with copy on write works
[ "Make", "a", "copy", "of", "motionpath", "data", "so", "that", "viewing", "with", "copy", "on", "write", "works" ]
bMotionPath *animviz_copy_motionpath(const bMotionPath *mpath_src) { bMotionPath *mpath_dst; if (mpath_src == NULL) { return NULL; } mpath_dst = MEM_dupallocN(mpath_src); mpath_dst->points = MEM_dupallocN(mpath_src->points); mpath_dst->points_vbo = NULL; mpath_dst->batch_line = NULL; mpath_dst->batch_points = NULL; return mpath_dst; }
[ "bMotionPath", "*", "animviz_copy_motionpath", "(", "const", "bMotionPath", "*", "mpath_src", ")", "{", "bMotionPath", "*", "mpath_dst", ";", "if", "(", "mpath_src", "==", "NULL", ")", "{", "return", "NULL", ";", "}", "mpath_dst", "=", "MEM_dupallocN", "(", "mpath_src", ")", ";", "mpath_dst", "->", "points", "=", "MEM_dupallocN", "(", "mpath_src", "->", "points", ")", ";", "mpath_dst", "->", "points_vbo", "=", "NULL", ";", "mpath_dst", "->", "batch_line", "=", "NULL", ";", "mpath_dst", "->", "batch_points", "=", "NULL", ";", "return", "mpath_dst", ";", "}" ]
Make a copy of motionpath data, so that viewing with copy on write works
[ "Make", "a", "copy", "of", "motionpath", "data", "so", "that", "viewing", "with", "copy", "on", "write", "works" ]
[ "/* should get recreated on draw... */" ]
[ { "param": "mpath_src", "type": "bMotionPath" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "mpath_src", "type": "bMotionPath", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b8f8e5303e259a835d6eacc66143ab23a3d805a
DemonRem/blender
source/blender/blenkernel/intern/anim.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
animviz_verify_motionpaths
bMotionPath
bMotionPath *animviz_verify_motionpaths(ReportList *reports, Scene *scene, Object *ob, bPoseChannel *pchan) { bAnimVizSettings *avs; bMotionPath *mpath, **dst; /* sanity checks */ if (ELEM(NULL, scene, ob)) { return NULL; } /* get destination data */ if (pchan) { /* paths for posechannel - assume that posechannel belongs to the object */ avs = &ob->pose->avs; dst = &pchan->mpath; } else { /* paths for object */ avs = &ob->avs; dst = &ob->mpath; } /* avoid 0 size allocs */ if (avs->path_sf >= avs->path_ef) { BKE_reportf(reports, RPT_ERROR, "Motion path frame extents invalid for %s (%d to %d)%s", (pchan) ? pchan->name : ob->id.name, avs->path_sf, avs->path_ef, (avs->path_sf == avs->path_ef) ? TIP_(", cannot have single-frame paths") : ""); return NULL; } /* if there is already a motionpath, just return that, * provided it's settings are ok (saves extra free+alloc) */ if (*dst != NULL) { int expected_length = avs->path_ef - avs->path_sf; mpath = *dst; /* Path is "valid" if length is valid, * but must also be of the same length as is being requested. */ if ((mpath->start_frame != mpath->end_frame) && (mpath->length > 0)) { /* outer check ensures that we have some curve data for this path */ if (mpath->length == expected_length) { /* return/use this as it is already valid length */ return mpath; } else { /* clear the existing path (as the range has changed), and reallocate below */ animviz_free_motionpath_cache(mpath); } } } else { /* create a new motionpath, and assign it */ mpath = MEM_callocN(sizeof(bMotionPath), "bMotionPath"); *dst = mpath; } /* set settings from the viz settings */ mpath->start_frame = avs->path_sf; mpath->end_frame = avs->path_ef; mpath->length = mpath->end_frame - mpath->start_frame; if (avs->path_bakeflag & MOTIONPATH_BAKE_HEADS) { mpath->flag |= MOTIONPATH_FLAG_BHEAD; } else { mpath->flag &= ~MOTIONPATH_FLAG_BHEAD; } /* set default custom values */ mpath->color[0] = 1.0; /* Red */ mpath->color[1] = 0.0; mpath->color[2] = 0.0; mpath->line_thickness = 2; mpath->flag |= MOTIONPATH_FLAG_LINES; /* draw lines by default */ /* allocate a cache */ mpath->points = MEM_callocN(sizeof(bMotionPathVert) * mpath->length, "bMotionPathVerts"); /* tag viz settings as currently having some path(s) which use it */ avs->path_bakeflag |= MOTIONPATH_BAKE_HAS_PATHS; /* return it */ return mpath; }
/** * Setup motion paths for the given data. * \note Only used when explicitly calculating paths on bones which may/may not be consider already * * \param scene: Current scene (for frame ranges, etc.) * \param ob: Object to add paths for (must be provided) * \param pchan: Posechannel to add paths for (optional; if not provided, object-paths are assumed) */
Setup motion paths for the given data. \note Only used when explicitly calculating paths on bones which may/may not be consider already \param scene: Current scene (for frame ranges, etc.) \param ob: Object to add paths for (must be provided) \param pchan: Posechannel to add paths for (optional; if not provided, object-paths are assumed)
[ "Setup", "motion", "paths", "for", "the", "given", "data", ".", "\\", "note", "Only", "used", "when", "explicitly", "calculating", "paths", "on", "bones", "which", "may", "/", "may", "not", "be", "consider", "already", "\\", "param", "scene", ":", "Current", "scene", "(", "for", "frame", "ranges", "etc", ".", ")", "\\", "param", "ob", ":", "Object", "to", "add", "paths", "for", "(", "must", "be", "provided", ")", "\\", "param", "pchan", ":", "Posechannel", "to", "add", "paths", "for", "(", "optional", ";", "if", "not", "provided", "object", "-", "paths", "are", "assumed", ")" ]
bMotionPath *animviz_verify_motionpaths(ReportList *reports, Scene *scene, Object *ob, bPoseChannel *pchan) { bAnimVizSettings *avs; bMotionPath *mpath, **dst; if (ELEM(NULL, scene, ob)) { return NULL; } if (pchan) { avs = &ob->pose->avs; dst = &pchan->mpath; } else { avs = &ob->avs; dst = &ob->mpath; } if (avs->path_sf >= avs->path_ef) { BKE_reportf(reports, RPT_ERROR, "Motion path frame extents invalid for %s (%d to %d)%s", (pchan) ? pchan->name : ob->id.name, avs->path_sf, avs->path_ef, (avs->path_sf == avs->path_ef) ? TIP_(", cannot have single-frame paths") : ""); return NULL; } if (*dst != NULL) { int expected_length = avs->path_ef - avs->path_sf; mpath = *dst; if ((mpath->start_frame != mpath->end_frame) && (mpath->length > 0)) { if (mpath->length == expected_length) { return mpath; } else { animviz_free_motionpath_cache(mpath); } } } else { mpath = MEM_callocN(sizeof(bMotionPath), "bMotionPath"); *dst = mpath; } mpath->start_frame = avs->path_sf; mpath->end_frame = avs->path_ef; mpath->length = mpath->end_frame - mpath->start_frame; if (avs->path_bakeflag & MOTIONPATH_BAKE_HEADS) { mpath->flag |= MOTIONPATH_FLAG_BHEAD; } else { mpath->flag &= ~MOTIONPATH_FLAG_BHEAD; } mpath->color[0] = 1.0; mpath->color[1] = 0.0; mpath->color[2] = 0.0; mpath->line_thickness = 2; mpath->flag |= MOTIONPATH_FLAG_LINES; mpath->points = MEM_callocN(sizeof(bMotionPathVert) * mpath->length, "bMotionPathVerts"); avs->path_bakeflag |= MOTIONPATH_BAKE_HAS_PATHS; return mpath; }
[ "bMotionPath", "*", "animviz_verify_motionpaths", "(", "ReportList", "*", "reports", ",", "Scene", "*", "scene", ",", "Object", "*", "ob", ",", "bPoseChannel", "*", "pchan", ")", "{", "bAnimVizSettings", "*", "avs", ";", "bMotionPath", "*", "mpath", ",", "*", "*", "dst", ";", "if", "(", "ELEM", "(", "NULL", ",", "scene", ",", "ob", ")", ")", "{", "return", "NULL", ";", "}", "if", "(", "pchan", ")", "{", "avs", "=", "&", "ob", "->", "pose", "->", "avs", ";", "dst", "=", "&", "pchan", "->", "mpath", ";", "}", "else", "{", "avs", "=", "&", "ob", "->", "avs", ";", "dst", "=", "&", "ob", "->", "mpath", ";", "}", "if", "(", "avs", "->", "path_sf", ">=", "avs", "->", "path_ef", ")", "{", "BKE_reportf", "(", "reports", ",", "RPT_ERROR", ",", "\"", "\"", ",", "(", "pchan", ")", "?", "pchan", "->", "name", ":", "ob", "->", "id", ".", "name", ",", "avs", "->", "path_sf", ",", "avs", "->", "path_ef", ",", "(", "avs", "->", "path_sf", "==", "avs", "->", "path_ef", ")", "?", "TIP_", "(", "\"", "\"", ")", ":", "\"", "\"", ")", ";", "return", "NULL", ";", "}", "if", "(", "*", "dst", "!=", "NULL", ")", "{", "int", "expected_length", "=", "avs", "->", "path_ef", "-", "avs", "->", "path_sf", ";", "mpath", "=", "*", "dst", ";", "if", "(", "(", "mpath", "->", "start_frame", "!=", "mpath", "->", "end_frame", ")", "&&", "(", "mpath", "->", "length", ">", "0", ")", ")", "{", "if", "(", "mpath", "->", "length", "==", "expected_length", ")", "{", "return", "mpath", ";", "}", "else", "{", "animviz_free_motionpath_cache", "(", "mpath", ")", ";", "}", "}", "}", "else", "{", "mpath", "=", "MEM_callocN", "(", "sizeof", "(", "bMotionPath", ")", ",", "\"", "\"", ")", ";", "*", "dst", "=", "mpath", ";", "}", "mpath", "->", "start_frame", "=", "avs", "->", "path_sf", ";", "mpath", "->", "end_frame", "=", "avs", "->", "path_ef", ";", "mpath", "->", "length", "=", "mpath", "->", "end_frame", "-", "mpath", "->", "start_frame", ";", "if", "(", "avs", "->", "path_bakeflag", "&", "MOTIONPATH_BAKE_HEADS", ")", "{", "mpath", "->", "flag", "|=", "MOTIONPATH_FLAG_BHEAD", ";", "}", "else", "{", "mpath", "->", "flag", "&=", "~", "MOTIONPATH_FLAG_BHEAD", ";", "}", "mpath", "->", "color", "[", "0", "]", "=", "1.0", ";", "mpath", "->", "color", "[", "1", "]", "=", "0.0", ";", "mpath", "->", "color", "[", "2", "]", "=", "0.0", ";", "mpath", "->", "line_thickness", "=", "2", ";", "mpath", "->", "flag", "|=", "MOTIONPATH_FLAG_LINES", ";", "mpath", "->", "points", "=", "MEM_callocN", "(", "sizeof", "(", "bMotionPathVert", ")", "*", "mpath", "->", "length", ",", "\"", "\"", ")", ";", "avs", "->", "path_bakeflag", "|=", "MOTIONPATH_BAKE_HAS_PATHS", ";", "return", "mpath", ";", "}" ]
Setup motion paths for the given data.
[ "Setup", "motion", "paths", "for", "the", "given", "data", "." ]
[ "/* sanity checks */", "/* get destination data */", "/* paths for posechannel - assume that posechannel belongs to the object */", "/* paths for object */", "/* avoid 0 size allocs */", "/* if there is already a motionpath, just return that,\n * provided it's settings are ok (saves extra free+alloc)\n */", "/* Path is \"valid\" if length is valid,\n * but must also be of the same length as is being requested. */", "/* outer check ensures that we have some curve data for this path */", "/* return/use this as it is already valid length */", "/* clear the existing path (as the range has changed), and reallocate below */", "/* create a new motionpath, and assign it */", "/* set settings from the viz settings */", "/* set default custom values */", "/* Red */", "/* draw lines by default */", "/* allocate a cache */", "/* tag viz settings as currently having some path(s) which use it */", "/* return it */" ]
[ { "param": "reports", "type": "ReportList" }, { "param": "scene", "type": "Scene" }, { "param": "ob", "type": "Object" }, { "param": "pchan", "type": "bPoseChannel" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "reports", "type": "ReportList", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "scene", "type": "Scene", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ob", "type": "Object", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pchan", "type": "bPoseChannel", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b8f8e5303e259a835d6eacc66143ab23a3d805a
DemonRem/blender
source/blender/blenkernel/intern/anim.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
free_path
void
void free_path(Path *path) { if (path->data) { MEM_freeN(path->data); } MEM_freeN(path); }
/* free curve path data * NOTE: frees the path itself! * NOTE: this is increasingly inaccurate with non-uniform BevPoint subdivisions [#24633] */
free curve path data NOTE: frees the path itself. NOTE: this is increasingly inaccurate with non-uniform BevPoint subdivisions [#24633]
[ "free", "curve", "path", "data", "NOTE", ":", "frees", "the", "path", "itself", ".", "NOTE", ":", "this", "is", "increasingly", "inaccurate", "with", "non", "-", "uniform", "BevPoint", "subdivisions", "[", "#24633", "]" ]
void free_path(Path *path) { if (path->data) { MEM_freeN(path->data); } MEM_freeN(path); }
[ "void", "free_path", "(", "Path", "*", "path", ")", "{", "if", "(", "path", "->", "data", ")", "{", "MEM_freeN", "(", "path", "->", "data", ")", ";", "}", "MEM_freeN", "(", "path", ")", ";", "}" ]
free curve path data NOTE: frees the path itself!
[ "free", "curve", "path", "data", "NOTE", ":", "frees", "the", "path", "itself!" ]
[]
[ { "param": "path", "type": "Path" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "path", "type": "Path", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b8f8e5303e259a835d6eacc66143ab23a3d805a
DemonRem/blender
source/blender/blenkernel/intern/anim.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
calc_curvepath
void
void calc_curvepath(Object *ob, ListBase *nurbs) { BevList *bl; BevPoint *bevp, *bevpn, *bevpfirst, *bevplast; PathPoint *pp; Nurb *nu; Path *path; float *fp, *dist, *maxdist, xyz[3]; float fac, d = 0, fac1, fac2; int a, tot, cycl = 0; /* in a path vertices are with equal differences: path->len = number of verts */ /* NOW WITH BEVELCURVE!!! */ if (ob == NULL || ob->type != OB_CURVE) { return; } if (ob->runtime.curve_cache->path) { free_path(ob->runtime.curve_cache->path); } ob->runtime.curve_cache->path = NULL; /* weak! can only use first curve */ bl = ob->runtime.curve_cache->bev.first; if (bl == NULL || !bl->nr) { return; } nu = nurbs->first; ob->runtime.curve_cache->path = path = MEM_callocN(sizeof(Path), "calc_curvepath"); /* if POLY: last vertice != first vertice */ cycl = (bl->poly != -1); tot = cycl ? bl->nr : bl->nr - 1; path->len = tot + 1; /* Exception: vector handle paths and polygon paths should be subdivided * at least a factor resolution. */ if (path->len < nu->resolu * SEGMENTSU(nu)) { path->len = nu->resolu * SEGMENTSU(nu); } dist = (float *)MEM_mallocN(sizeof(float) * (tot + 1), "calcpathdist"); /* all lengths in *dist */ bevp = bevpfirst = bl->bevpoints; fp = dist; *fp = 0.0f; for (a = 0; a < tot; a++) { fp++; if (cycl && a == tot - 1) { sub_v3_v3v3(xyz, bevpfirst->vec, bevp->vec); } else { sub_v3_v3v3(xyz, (bevp + 1)->vec, bevp->vec); } *fp = *(fp - 1) + len_v3(xyz); bevp++; } path->totdist = *fp; /* the path verts in path->data */ /* now also with TILT value */ pp = path->data = (PathPoint *)MEM_callocN(sizeof(PathPoint) * path->len, "pathdata"); bevp = bevpfirst; bevpn = bevp + 1; bevplast = bevpfirst + (bl->nr - 1); if (UNLIKELY(bevpn > bevplast)) { bevpn = cycl ? bevpfirst : bevplast; } fp = dist + 1; maxdist = dist + tot; fac = 1.0f / ((float)path->len - 1.0f); fac = fac * path->totdist; for (a = 0; a < path->len; a++) { d = ((float)a) * fac; /* we're looking for location (distance) 'd' in the array */ if (LIKELY(tot > 0)) { while ((fp < maxdist) && (d >= *fp)) { fp++; if (bevp < bevplast) { bevp++; } bevpn = bevp + 1; if (UNLIKELY(bevpn > bevplast)) { bevpn = cycl ? bevpfirst : bevplast; } } fac1 = (*(fp)-d) / (*(fp) - *(fp - 1)); fac2 = 1.0f - fac1; } else { fac1 = 1.0f; fac2 = 0.0f; } interp_v3_v3v3(pp->vec, bevp->vec, bevpn->vec, fac2); pp->vec[3] = fac1 * bevp->tilt + fac2 * bevpn->tilt; pp->radius = fac1 * bevp->radius + fac2 * bevpn->radius; pp->weight = fac1 * bevp->weight + fac2 * bevpn->weight; interp_qt_qtqt(pp->quat, bevp->quat, bevpn->quat, fac2); normalize_qt(pp->quat); pp++; } MEM_freeN(dist); }
/* calculate a curve-deform path for a curve * - only called from displist.c -> do_makeDispListCurveTypes */
calculate a curve-deform path for a curve - only called from displist.c -> do_makeDispListCurveTypes
[ "calculate", "a", "curve", "-", "deform", "path", "for", "a", "curve", "-", "only", "called", "from", "displist", ".", "c", "-", ">", "do_makeDispListCurveTypes" ]
void calc_curvepath(Object *ob, ListBase *nurbs) { BevList *bl; BevPoint *bevp, *bevpn, *bevpfirst, *bevplast; PathPoint *pp; Nurb *nu; Path *path; float *fp, *dist, *maxdist, xyz[3]; float fac, d = 0, fac1, fac2; int a, tot, cycl = 0; if (ob == NULL || ob->type != OB_CURVE) { return; } if (ob->runtime.curve_cache->path) { free_path(ob->runtime.curve_cache->path); } ob->runtime.curve_cache->path = NULL; bl = ob->runtime.curve_cache->bev.first; if (bl == NULL || !bl->nr) { return; } nu = nurbs->first; ob->runtime.curve_cache->path = path = MEM_callocN(sizeof(Path), "calc_curvepath"); cycl = (bl->poly != -1); tot = cycl ? bl->nr : bl->nr - 1; path->len = tot + 1; if (path->len < nu->resolu * SEGMENTSU(nu)) { path->len = nu->resolu * SEGMENTSU(nu); } dist = (float *)MEM_mallocN(sizeof(float) * (tot + 1), "calcpathdist"); bevp = bevpfirst = bl->bevpoints; fp = dist; *fp = 0.0f; for (a = 0; a < tot; a++) { fp++; if (cycl && a == tot - 1) { sub_v3_v3v3(xyz, bevpfirst->vec, bevp->vec); } else { sub_v3_v3v3(xyz, (bevp + 1)->vec, bevp->vec); } *fp = *(fp - 1) + len_v3(xyz); bevp++; } path->totdist = *fp; pp = path->data = (PathPoint *)MEM_callocN(sizeof(PathPoint) * path->len, "pathdata"); bevp = bevpfirst; bevpn = bevp + 1; bevplast = bevpfirst + (bl->nr - 1); if (UNLIKELY(bevpn > bevplast)) { bevpn = cycl ? bevpfirst : bevplast; } fp = dist + 1; maxdist = dist + tot; fac = 1.0f / ((float)path->len - 1.0f); fac = fac * path->totdist; for (a = 0; a < path->len; a++) { d = ((float)a) * fac; if (LIKELY(tot > 0)) { while ((fp < maxdist) && (d >= *fp)) { fp++; if (bevp < bevplast) { bevp++; } bevpn = bevp + 1; if (UNLIKELY(bevpn > bevplast)) { bevpn = cycl ? bevpfirst : bevplast; } } fac1 = (*(fp)-d) / (*(fp) - *(fp - 1)); fac2 = 1.0f - fac1; } else { fac1 = 1.0f; fac2 = 0.0f; } interp_v3_v3v3(pp->vec, bevp->vec, bevpn->vec, fac2); pp->vec[3] = fac1 * bevp->tilt + fac2 * bevpn->tilt; pp->radius = fac1 * bevp->radius + fac2 * bevpn->radius; pp->weight = fac1 * bevp->weight + fac2 * bevpn->weight; interp_qt_qtqt(pp->quat, bevp->quat, bevpn->quat, fac2); normalize_qt(pp->quat); pp++; } MEM_freeN(dist); }
[ "void", "calc_curvepath", "(", "Object", "*", "ob", ",", "ListBase", "*", "nurbs", ")", "{", "BevList", "*", "bl", ";", "BevPoint", "*", "bevp", ",", "*", "bevpn", ",", "*", "bevpfirst", ",", "*", "bevplast", ";", "PathPoint", "*", "pp", ";", "Nurb", "*", "nu", ";", "Path", "*", "path", ";", "float", "*", "fp", ",", "*", "dist", ",", "*", "maxdist", ",", "xyz", "[", "3", "]", ";", "float", "fac", ",", "d", "=", "0", ",", "fac1", ",", "fac2", ";", "int", "a", ",", "tot", ",", "cycl", "=", "0", ";", "if", "(", "ob", "==", "NULL", "||", "ob", "->", "type", "!=", "OB_CURVE", ")", "{", "return", ";", "}", "if", "(", "ob", "->", "runtime", ".", "curve_cache", "->", "path", ")", "{", "free_path", "(", "ob", "->", "runtime", ".", "curve_cache", "->", "path", ")", ";", "}", "ob", "->", "runtime", ".", "curve_cache", "->", "path", "=", "NULL", ";", "bl", "=", "ob", "->", "runtime", ".", "curve_cache", "->", "bev", ".", "first", ";", "if", "(", "bl", "==", "NULL", "||", "!", "bl", "->", "nr", ")", "{", "return", ";", "}", "nu", "=", "nurbs", "->", "first", ";", "ob", "->", "runtime", ".", "curve_cache", "->", "path", "=", "path", "=", "MEM_callocN", "(", "sizeof", "(", "Path", ")", ",", "\"", "\"", ")", ";", "cycl", "=", "(", "bl", "->", "poly", "!=", "-1", ")", ";", "tot", "=", "cycl", "?", "bl", "->", "nr", ":", "bl", "->", "nr", "-", "1", ";", "path", "->", "len", "=", "tot", "+", "1", ";", "if", "(", "path", "->", "len", "<", "nu", "->", "resolu", "*", "SEGMENTSU", "(", "nu", ")", ")", "{", "path", "->", "len", "=", "nu", "->", "resolu", "*", "SEGMENTSU", "(", "nu", ")", ";", "}", "dist", "=", "(", "float", "*", ")", "MEM_mallocN", "(", "sizeof", "(", "float", ")", "*", "(", "tot", "+", "1", ")", ",", "\"", "\"", ")", ";", "bevp", "=", "bevpfirst", "=", "bl", "->", "bevpoints", ";", "fp", "=", "dist", ";", "*", "fp", "=", "0.0f", ";", "for", "(", "a", "=", "0", ";", "a", "<", "tot", ";", "a", "++", ")", "{", "fp", "++", ";", "if", "(", "cycl", "&&", "a", "==", "tot", "-", "1", ")", "{", "sub_v3_v3v3", "(", "xyz", ",", "bevpfirst", "->", "vec", ",", "bevp", "->", "vec", ")", ";", "}", "else", "{", "sub_v3_v3v3", "(", "xyz", ",", "(", "bevp", "+", "1", ")", "->", "vec", ",", "bevp", "->", "vec", ")", ";", "}", "*", "fp", "=", "*", "(", "fp", "-", "1", ")", "+", "len_v3", "(", "xyz", ")", ";", "bevp", "++", ";", "}", "path", "->", "totdist", "=", "*", "fp", ";", "pp", "=", "path", "->", "data", "=", "(", "PathPoint", "*", ")", "MEM_callocN", "(", "sizeof", "(", "PathPoint", ")", "*", "path", "->", "len", ",", "\"", "\"", ")", ";", "bevp", "=", "bevpfirst", ";", "bevpn", "=", "bevp", "+", "1", ";", "bevplast", "=", "bevpfirst", "+", "(", "bl", "->", "nr", "-", "1", ")", ";", "if", "(", "UNLIKELY", "(", "bevpn", ">", "bevplast", ")", ")", "{", "bevpn", "=", "cycl", "?", "bevpfirst", ":", "bevplast", ";", "}", "fp", "=", "dist", "+", "1", ";", "maxdist", "=", "dist", "+", "tot", ";", "fac", "=", "1.0f", "/", "(", "(", "float", ")", "path", "->", "len", "-", "1.0f", ")", ";", "fac", "=", "fac", "*", "path", "->", "totdist", ";", "for", "(", "a", "=", "0", ";", "a", "<", "path", "->", "len", ";", "a", "++", ")", "{", "d", "=", "(", "(", "float", ")", "a", ")", "*", "fac", ";", "if", "(", "LIKELY", "(", "tot", ">", "0", ")", ")", "{", "while", "(", "(", "fp", "<", "maxdist", ")", "&&", "(", "d", ">=", "*", "fp", ")", ")", "{", "fp", "++", ";", "if", "(", "bevp", "<", "bevplast", ")", "{", "bevp", "++", ";", "}", "bevpn", "=", "bevp", "+", "1", ";", "if", "(", "UNLIKELY", "(", "bevpn", ">", "bevplast", ")", ")", "{", "bevpn", "=", "cycl", "?", "bevpfirst", ":", "bevplast", ";", "}", "}", "fac1", "=", "(", "*", "(", "fp", ")", "-", "d", ")", "/", "(", "*", "(", "fp", ")", "-", "*", "(", "fp", "-", "1", ")", ")", ";", "fac2", "=", "1.0f", "-", "fac1", ";", "}", "else", "{", "fac1", "=", "1.0f", ";", "fac2", "=", "0.0f", ";", "}", "interp_v3_v3v3", "(", "pp", "->", "vec", ",", "bevp", "->", "vec", ",", "bevpn", "->", "vec", ",", "fac2", ")", ";", "pp", "->", "vec", "[", "3", "]", "=", "fac1", "*", "bevp", "->", "tilt", "+", "fac2", "*", "bevpn", "->", "tilt", ";", "pp", "->", "radius", "=", "fac1", "*", "bevp", "->", "radius", "+", "fac2", "*", "bevpn", "->", "radius", ";", "pp", "->", "weight", "=", "fac1", "*", "bevp", "->", "weight", "+", "fac2", "*", "bevpn", "->", "weight", ";", "interp_qt_qtqt", "(", "pp", "->", "quat", ",", "bevp", "->", "quat", ",", "bevpn", "->", "quat", ",", "fac2", ")", ";", "normalize_qt", "(", "pp", "->", "quat", ")", ";", "pp", "++", ";", "}", "MEM_freeN", "(", "dist", ")", ";", "}" ]
calculate a curve-deform path for a curve - only called from displist.c -> do_makeDispListCurveTypes
[ "calculate", "a", "curve", "-", "deform", "path", "for", "a", "curve", "-", "only", "called", "from", "displist", ".", "c", "-", ">", "do_makeDispListCurveTypes" ]
[ "/* in a path vertices are with equal differences: path->len = number of verts */", "/* NOW WITH BEVELCURVE!!! */", "/* weak! can only use first curve */", "/* if POLY: last vertice != first vertice */", "/* Exception: vector handle paths and polygon paths should be subdivided\n * at least a factor resolution. */", "/* all lengths in *dist */", "/* the path verts in path->data */", "/* now also with TILT value */", "/* we're looking for location (distance) 'd' in the array */" ]
[ { "param": "ob", "type": "Object" }, { "param": "nurbs", "type": "ListBase" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ob", "type": "Object", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "nurbs", "type": "ListBase", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b7cb181374c5000f94048c00020ec2a3556b579
DemonRem/blender
source/blender/blenkernel/intern/idcode.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BKE_idcode_to_name
char
const char *BKE_idcode_to_name(short idcode) { IDType *idt = idtype_from_code(idcode); BLI_assert(idt); return idt ? idt->name : NULL; }
/** * Convert an idcode into a name. * * \param idcode: The code to convert. * \return A static string representing the name of * the code. */
Convert an idcode into a name. \param idcode: The code to convert. \return A static string representing the name of the code.
[ "Convert", "an", "idcode", "into", "a", "name", ".", "\\", "param", "idcode", ":", "The", "code", "to", "convert", ".", "\\", "return", "A", "static", "string", "representing", "the", "name", "of", "the", "code", "." ]
const char *BKE_idcode_to_name(short idcode) { IDType *idt = idtype_from_code(idcode); BLI_assert(idt); return idt ? idt->name : NULL; }
[ "const", "char", "*", "BKE_idcode_to_name", "(", "short", "idcode", ")", "{", "IDType", "*", "idt", "=", "idtype_from_code", "(", "idcode", ")", ";", "BLI_assert", "(", "idt", ")", ";", "return", "idt", "?", "idt", "->", "name", ":", "NULL", ";", "}" ]
Convert an idcode into a name.
[ "Convert", "an", "idcode", "into", "a", "name", "." ]
[]
[ { "param": "idcode", "type": "short" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "idcode", "type": "short", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b7cb181374c5000f94048c00020ec2a3556b579
DemonRem/blender
source/blender/blenkernel/intern/idcode.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BKE_idcode_from_name
null
short BKE_idcode_from_name(const char *name) { IDType *idt = idtype_from_name(name); BLI_assert(idt); return idt ? idt->code : 0; }
/** * Convert a name into an idcode (ie. ID_SCE) * * \param name: The name to convert. * \return The code for the name, or 0 if invalid. */
Convert a name into an idcode \param name: The name to convert. \return The code for the name, or 0 if invalid.
[ "Convert", "a", "name", "into", "an", "idcode", "\\", "param", "name", ":", "The", "name", "to", "convert", ".", "\\", "return", "The", "code", "for", "the", "name", "or", "0", "if", "invalid", "." ]
short BKE_idcode_from_name(const char *name) { IDType *idt = idtype_from_name(name); BLI_assert(idt); return idt ? idt->code : 0; }
[ "short", "BKE_idcode_from_name", "(", "const", "char", "*", "name", ")", "{", "IDType", "*", "idt", "=", "idtype_from_name", "(", "name", ")", ";", "BLI_assert", "(", "idt", ")", ";", "return", "idt", "?", "idt", "->", "code", ":", "0", ";", "}" ]
Convert a name into an idcode (ie.
[ "Convert", "a", "name", "into", "an", "idcode", "(", "ie", "." ]
[]
[ { "param": "name", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "name", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b7cb181374c5000f94048c00020ec2a3556b579
DemonRem/blender
source/blender/blenkernel/intern/idcode.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BKE_idcode_to_idfilter
int
int BKE_idcode_to_idfilter(const short idcode) { #define CASE_IDFILTER(_id) \ case ID_##_id: \ return FILTER_ID_##_id switch (idcode) { CASE_IDFILTER(AC); CASE_IDFILTER(AR); CASE_IDFILTER(BR); CASE_IDFILTER(CA); CASE_IDFILTER(CF); CASE_IDFILTER(CU); CASE_IDFILTER(GD); CASE_IDFILTER(GR); CASE_IDFILTER(IM); CASE_IDFILTER(LA); CASE_IDFILTER(LS); CASE_IDFILTER(LT); CASE_IDFILTER(MA); CASE_IDFILTER(MB); CASE_IDFILTER(MC); CASE_IDFILTER(ME); CASE_IDFILTER(MSK); CASE_IDFILTER(NT); CASE_IDFILTER(OB); CASE_IDFILTER(PA); CASE_IDFILTER(PAL); CASE_IDFILTER(PC); CASE_IDFILTER(LP); CASE_IDFILTER(SCE); CASE_IDFILTER(SPK); CASE_IDFILTER(SO); CASE_IDFILTER(TE); CASE_IDFILTER(TXT); CASE_IDFILTER(VF); CASE_IDFILTER(WO); CASE_IDFILTER(WS); default: return 0; } #undef CASE_IDFILTER }
/** * Convert an idcode into an idfilter (e.g. ID_OB -> FILTER_ID_OB). */
Convert an idcode into an idfilter .
[ "Convert", "an", "idcode", "into", "an", "idfilter", "." ]
int BKE_idcode_to_idfilter(const short idcode) { #define CASE_IDFILTER(_id) \ case ID_##_id: \ return FILTER_ID_##_id switch (idcode) { CASE_IDFILTER(AC); CASE_IDFILTER(AR); CASE_IDFILTER(BR); CASE_IDFILTER(CA); CASE_IDFILTER(CF); CASE_IDFILTER(CU); CASE_IDFILTER(GD); CASE_IDFILTER(GR); CASE_IDFILTER(IM); CASE_IDFILTER(LA); CASE_IDFILTER(LS); CASE_IDFILTER(LT); CASE_IDFILTER(MA); CASE_IDFILTER(MB); CASE_IDFILTER(MC); CASE_IDFILTER(ME); CASE_IDFILTER(MSK); CASE_IDFILTER(NT); CASE_IDFILTER(OB); CASE_IDFILTER(PA); CASE_IDFILTER(PAL); CASE_IDFILTER(PC); CASE_IDFILTER(LP); CASE_IDFILTER(SCE); CASE_IDFILTER(SPK); CASE_IDFILTER(SO); CASE_IDFILTER(TE); CASE_IDFILTER(TXT); CASE_IDFILTER(VF); CASE_IDFILTER(WO); CASE_IDFILTER(WS); default: return 0; } #undef CASE_IDFILTER }
[ "int", "BKE_idcode_to_idfilter", "(", "const", "short", "idcode", ")", "{", "#define", "CASE_IDFILTER", "(", "_id", ")", " \\\n case ID_##_id: \\\n return FILTER_ID_##_id", "\n\n", "switch", "(", "idcode", ")", "{", "CASE_IDFILTER", "(", "AC", ")", ";", "CASE_IDFILTER", "(", "AR", ")", ";", "CASE_IDFILTER", "(", "BR", ")", ";", "CASE_IDFILTER", "(", "CA", ")", ";", "CASE_IDFILTER", "(", "CF", ")", ";", "CASE_IDFILTER", "(", "CU", ")", ";", "CASE_IDFILTER", "(", "GD", ")", ";", "CASE_IDFILTER", "(", "GR", ")", ";", "CASE_IDFILTER", "(", "IM", ")", ";", "CASE_IDFILTER", "(", "LA", ")", ";", "CASE_IDFILTER", "(", "LS", ")", ";", "CASE_IDFILTER", "(", "LT", ")", ";", "CASE_IDFILTER", "(", "MA", ")", ";", "CASE_IDFILTER", "(", "MB", ")", ";", "CASE_IDFILTER", "(", "MC", ")", ";", "CASE_IDFILTER", "(", "ME", ")", ";", "CASE_IDFILTER", "(", "MSK", ")", ";", "CASE_IDFILTER", "(", "NT", ")", ";", "CASE_IDFILTER", "(", "OB", ")", ";", "CASE_IDFILTER", "(", "PA", ")", ";", "CASE_IDFILTER", "(", "PAL", ")", ";", "CASE_IDFILTER", "(", "PC", ")", ";", "CASE_IDFILTER", "(", "LP", ")", ";", "CASE_IDFILTER", "(", "SCE", ")", ";", "CASE_IDFILTER", "(", "SPK", ")", ";", "CASE_IDFILTER", "(", "SO", ")", ";", "CASE_IDFILTER", "(", "TE", ")", ";", "CASE_IDFILTER", "(", "TXT", ")", ";", "CASE_IDFILTER", "(", "VF", ")", ";", "CASE_IDFILTER", "(", "WO", ")", ";", "CASE_IDFILTER", "(", "WS", ")", ";", "default", ":", "return", "0", ";", "}", "#undef", " CASE_IDFILTER", "\n", "}" ]
Convert an idcode into an idfilter (e.g.
[ "Convert", "an", "idcode", "into", "an", "idfilter", "(", "e", ".", "g", "." ]
[]
[ { "param": "idcode", "type": "short" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "idcode", "type": "short", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b7cb181374c5000f94048c00020ec2a3556b579
DemonRem/blender
source/blender/blenkernel/intern/idcode.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BKE_idcode_from_idfilter
null
short BKE_idcode_from_idfilter(const int idfilter) { #define CASE_IDFILTER(_id) \ case FILTER_ID_##_id: \ return ID_##_id switch (idfilter) { CASE_IDFILTER(AC); CASE_IDFILTER(AR); CASE_IDFILTER(BR); CASE_IDFILTER(CA); CASE_IDFILTER(CF); CASE_IDFILTER(CU); CASE_IDFILTER(GD); CASE_IDFILTER(GR); CASE_IDFILTER(IM); CASE_IDFILTER(LA); CASE_IDFILTER(LS); CASE_IDFILTER(LT); CASE_IDFILTER(MA); CASE_IDFILTER(MB); CASE_IDFILTER(MC); CASE_IDFILTER(ME); CASE_IDFILTER(MSK); CASE_IDFILTER(NT); CASE_IDFILTER(OB); CASE_IDFILTER(PA); CASE_IDFILTER(PAL); CASE_IDFILTER(PC); CASE_IDFILTER(LP); CASE_IDFILTER(SCE); CASE_IDFILTER(SPK); CASE_IDFILTER(SO); CASE_IDFILTER(TE); CASE_IDFILTER(TXT); CASE_IDFILTER(VF); CASE_IDFILTER(WO); default: return 0; } #undef CASE_IDFILTER }
/** * Convert an idfilter into an idcode (e.g. FILTER_ID_OB -> ID_OB). */
Convert an idfilter into an idcode .
[ "Convert", "an", "idfilter", "into", "an", "idcode", "." ]
short BKE_idcode_from_idfilter(const int idfilter) { #define CASE_IDFILTER(_id) \ case FILTER_ID_##_id: \ return ID_##_id switch (idfilter) { CASE_IDFILTER(AC); CASE_IDFILTER(AR); CASE_IDFILTER(BR); CASE_IDFILTER(CA); CASE_IDFILTER(CF); CASE_IDFILTER(CU); CASE_IDFILTER(GD); CASE_IDFILTER(GR); CASE_IDFILTER(IM); CASE_IDFILTER(LA); CASE_IDFILTER(LS); CASE_IDFILTER(LT); CASE_IDFILTER(MA); CASE_IDFILTER(MB); CASE_IDFILTER(MC); CASE_IDFILTER(ME); CASE_IDFILTER(MSK); CASE_IDFILTER(NT); CASE_IDFILTER(OB); CASE_IDFILTER(PA); CASE_IDFILTER(PAL); CASE_IDFILTER(PC); CASE_IDFILTER(LP); CASE_IDFILTER(SCE); CASE_IDFILTER(SPK); CASE_IDFILTER(SO); CASE_IDFILTER(TE); CASE_IDFILTER(TXT); CASE_IDFILTER(VF); CASE_IDFILTER(WO); default: return 0; } #undef CASE_IDFILTER }
[ "short", "BKE_idcode_from_idfilter", "(", "const", "int", "idfilter", ")", "{", "#define", "CASE_IDFILTER", "(", "_id", ")", " \\\n case FILTER_ID_##_id: \\\n return ID_##_id", "\n\n", "switch", "(", "idfilter", ")", "{", "CASE_IDFILTER", "(", "AC", ")", ";", "CASE_IDFILTER", "(", "AR", ")", ";", "CASE_IDFILTER", "(", "BR", ")", ";", "CASE_IDFILTER", "(", "CA", ")", ";", "CASE_IDFILTER", "(", "CF", ")", ";", "CASE_IDFILTER", "(", "CU", ")", ";", "CASE_IDFILTER", "(", "GD", ")", ";", "CASE_IDFILTER", "(", "GR", ")", ";", "CASE_IDFILTER", "(", "IM", ")", ";", "CASE_IDFILTER", "(", "LA", ")", ";", "CASE_IDFILTER", "(", "LS", ")", ";", "CASE_IDFILTER", "(", "LT", ")", ";", "CASE_IDFILTER", "(", "MA", ")", ";", "CASE_IDFILTER", "(", "MB", ")", ";", "CASE_IDFILTER", "(", "MC", ")", ";", "CASE_IDFILTER", "(", "ME", ")", ";", "CASE_IDFILTER", "(", "MSK", ")", ";", "CASE_IDFILTER", "(", "NT", ")", ";", "CASE_IDFILTER", "(", "OB", ")", ";", "CASE_IDFILTER", "(", "PA", ")", ";", "CASE_IDFILTER", "(", "PAL", ")", ";", "CASE_IDFILTER", "(", "PC", ")", ";", "CASE_IDFILTER", "(", "LP", ")", ";", "CASE_IDFILTER", "(", "SCE", ")", ";", "CASE_IDFILTER", "(", "SPK", ")", ";", "CASE_IDFILTER", "(", "SO", ")", ";", "CASE_IDFILTER", "(", "TE", ")", ";", "CASE_IDFILTER", "(", "TXT", ")", ";", "CASE_IDFILTER", "(", "VF", ")", ";", "CASE_IDFILTER", "(", "WO", ")", ";", "default", ":", "return", "0", ";", "}", "#undef", " CASE_IDFILTER", "\n", "}" ]
Convert an idfilter into an idcode (e.g.
[ "Convert", "an", "idfilter", "into", "an", "idcode", "(", "e", ".", "g", "." ]
[]
[ { "param": "idfilter", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "idfilter", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b7cb181374c5000f94048c00020ec2a3556b579
DemonRem/blender
source/blender/blenkernel/intern/idcode.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BKE_idcode_to_index
int
int BKE_idcode_to_index(const short idcode) { #define CASE_IDINDEX(_id) \ case ID_##_id: \ return INDEX_ID_##_id switch ((ID_Type)idcode) { CASE_IDINDEX(AC); CASE_IDINDEX(AR); CASE_IDINDEX(BR); CASE_IDINDEX(CA); CASE_IDINDEX(CF); CASE_IDINDEX(CU); CASE_IDINDEX(GD); CASE_IDINDEX(GR); CASE_IDINDEX(IM); CASE_IDINDEX(KE); CASE_IDINDEX(IP); CASE_IDINDEX(LA); CASE_IDINDEX(LI); CASE_IDINDEX(LS); CASE_IDINDEX(LT); CASE_IDINDEX(MA); CASE_IDINDEX(MB); CASE_IDINDEX(MC); CASE_IDINDEX(ME); CASE_IDINDEX(MSK); CASE_IDINDEX(NT); CASE_IDINDEX(OB); CASE_IDINDEX(PA); CASE_IDINDEX(PAL); CASE_IDINDEX(PC); CASE_IDINDEX(LP); CASE_IDINDEX(SCE); CASE_IDINDEX(SCR); CASE_IDINDEX(SPK); CASE_IDINDEX(SO); CASE_IDINDEX(TE); CASE_IDINDEX(TXT); CASE_IDINDEX(VF); CASE_IDINDEX(WM); CASE_IDINDEX(WO); CASE_IDINDEX(WS); } BLI_assert(0); return -1; #undef CASE_IDINDEX }
/** * Convert an idcode into an index (e.g. ID_OB -> INDEX_ID_OB). */
Convert an idcode into an index .
[ "Convert", "an", "idcode", "into", "an", "index", "." ]
int BKE_idcode_to_index(const short idcode) { #define CASE_IDINDEX(_id) \ case ID_##_id: \ return INDEX_ID_##_id switch ((ID_Type)idcode) { CASE_IDINDEX(AC); CASE_IDINDEX(AR); CASE_IDINDEX(BR); CASE_IDINDEX(CA); CASE_IDINDEX(CF); CASE_IDINDEX(CU); CASE_IDINDEX(GD); CASE_IDINDEX(GR); CASE_IDINDEX(IM); CASE_IDINDEX(KE); CASE_IDINDEX(IP); CASE_IDINDEX(LA); CASE_IDINDEX(LI); CASE_IDINDEX(LS); CASE_IDINDEX(LT); CASE_IDINDEX(MA); CASE_IDINDEX(MB); CASE_IDINDEX(MC); CASE_IDINDEX(ME); CASE_IDINDEX(MSK); CASE_IDINDEX(NT); CASE_IDINDEX(OB); CASE_IDINDEX(PA); CASE_IDINDEX(PAL); CASE_IDINDEX(PC); CASE_IDINDEX(LP); CASE_IDINDEX(SCE); CASE_IDINDEX(SCR); CASE_IDINDEX(SPK); CASE_IDINDEX(SO); CASE_IDINDEX(TE); CASE_IDINDEX(TXT); CASE_IDINDEX(VF); CASE_IDINDEX(WM); CASE_IDINDEX(WO); CASE_IDINDEX(WS); } BLI_assert(0); return -1; #undef CASE_IDINDEX }
[ "int", "BKE_idcode_to_index", "(", "const", "short", "idcode", ")", "{", "#define", "CASE_IDINDEX", "(", "_id", ")", " \\\n case ID_##_id: \\\n return INDEX_ID_##_id", "\n\n", "switch", "(", "(", "ID_Type", ")", "idcode", ")", "{", "CASE_IDINDEX", "(", "AC", ")", ";", "CASE_IDINDEX", "(", "AR", ")", ";", "CASE_IDINDEX", "(", "BR", ")", ";", "CASE_IDINDEX", "(", "CA", ")", ";", "CASE_IDINDEX", "(", "CF", ")", ";", "CASE_IDINDEX", "(", "CU", ")", ";", "CASE_IDINDEX", "(", "GD", ")", ";", "CASE_IDINDEX", "(", "GR", ")", ";", "CASE_IDINDEX", "(", "IM", ")", ";", "CASE_IDINDEX", "(", "KE", ")", ";", "CASE_IDINDEX", "(", "IP", ")", ";", "CASE_IDINDEX", "(", "LA", ")", ";", "CASE_IDINDEX", "(", "LI", ")", ";", "CASE_IDINDEX", "(", "LS", ")", ";", "CASE_IDINDEX", "(", "LT", ")", ";", "CASE_IDINDEX", "(", "MA", ")", ";", "CASE_IDINDEX", "(", "MB", ")", ";", "CASE_IDINDEX", "(", "MC", ")", ";", "CASE_IDINDEX", "(", "ME", ")", ";", "CASE_IDINDEX", "(", "MSK", ")", ";", "CASE_IDINDEX", "(", "NT", ")", ";", "CASE_IDINDEX", "(", "OB", ")", ";", "CASE_IDINDEX", "(", "PA", ")", ";", "CASE_IDINDEX", "(", "PAL", ")", ";", "CASE_IDINDEX", "(", "PC", ")", ";", "CASE_IDINDEX", "(", "LP", ")", ";", "CASE_IDINDEX", "(", "SCE", ")", ";", "CASE_IDINDEX", "(", "SCR", ")", ";", "CASE_IDINDEX", "(", "SPK", ")", ";", "CASE_IDINDEX", "(", "SO", ")", ";", "CASE_IDINDEX", "(", "TE", ")", ";", "CASE_IDINDEX", "(", "TXT", ")", ";", "CASE_IDINDEX", "(", "VF", ")", ";", "CASE_IDINDEX", "(", "WM", ")", ";", "CASE_IDINDEX", "(", "WO", ")", ";", "CASE_IDINDEX", "(", "WS", ")", ";", "}", "BLI_assert", "(", "0", ")", ";", "return", "-1", ";", "#undef", " CASE_IDINDEX", "\n", "}" ]
Convert an idcode into an index (e.g.
[ "Convert", "an", "idcode", "into", "an", "index", "(", "e", ".", "g", "." ]
[]
[ { "param": "idcode", "type": "short" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "idcode", "type": "short", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b7cb181374c5000f94048c00020ec2a3556b579
DemonRem/blender
source/blender/blenkernel/intern/idcode.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BKE_idcode_from_index
null
short BKE_idcode_from_index(const int index) { #define CASE_IDCODE(_id) \ case INDEX_ID_##_id: \ return ID_##_id switch (index) { CASE_IDCODE(AC); CASE_IDCODE(AR); CASE_IDCODE(BR); CASE_IDCODE(CA); CASE_IDCODE(CF); CASE_IDCODE(CU); CASE_IDCODE(GD); CASE_IDCODE(GR); CASE_IDCODE(IM); CASE_IDCODE(KE); CASE_IDCODE(IP); CASE_IDCODE(LA); CASE_IDCODE(LI); CASE_IDCODE(LS); CASE_IDCODE(LT); CASE_IDCODE(MA); CASE_IDCODE(MB); CASE_IDCODE(MC); CASE_IDCODE(ME); CASE_IDCODE(MSK); CASE_IDCODE(NT); CASE_IDCODE(OB); CASE_IDCODE(PA); CASE_IDCODE(PAL); CASE_IDCODE(PC); CASE_IDCODE(LP); CASE_IDCODE(SCE); CASE_IDCODE(SCR); CASE_IDCODE(SPK); CASE_IDCODE(SO); CASE_IDCODE(TE); CASE_IDCODE(TXT); CASE_IDCODE(VF); CASE_IDCODE(WM); CASE_IDCODE(WO); CASE_IDCODE(WS); } BLI_assert(0); return -1; #undef CASE_IDCODE }
/** * Get an idcode from an index (e.g. INDEX_ID_OB -> ID_OB). */
Get an idcode from an index .
[ "Get", "an", "idcode", "from", "an", "index", "." ]
short BKE_idcode_from_index(const int index) { #define CASE_IDCODE(_id) \ case INDEX_ID_##_id: \ return ID_##_id switch (index) { CASE_IDCODE(AC); CASE_IDCODE(AR); CASE_IDCODE(BR); CASE_IDCODE(CA); CASE_IDCODE(CF); CASE_IDCODE(CU); CASE_IDCODE(GD); CASE_IDCODE(GR); CASE_IDCODE(IM); CASE_IDCODE(KE); CASE_IDCODE(IP); CASE_IDCODE(LA); CASE_IDCODE(LI); CASE_IDCODE(LS); CASE_IDCODE(LT); CASE_IDCODE(MA); CASE_IDCODE(MB); CASE_IDCODE(MC); CASE_IDCODE(ME); CASE_IDCODE(MSK); CASE_IDCODE(NT); CASE_IDCODE(OB); CASE_IDCODE(PA); CASE_IDCODE(PAL); CASE_IDCODE(PC); CASE_IDCODE(LP); CASE_IDCODE(SCE); CASE_IDCODE(SCR); CASE_IDCODE(SPK); CASE_IDCODE(SO); CASE_IDCODE(TE); CASE_IDCODE(TXT); CASE_IDCODE(VF); CASE_IDCODE(WM); CASE_IDCODE(WO); CASE_IDCODE(WS); } BLI_assert(0); return -1; #undef CASE_IDCODE }
[ "short", "BKE_idcode_from_index", "(", "const", "int", "index", ")", "{", "#define", "CASE_IDCODE", "(", "_id", ")", " \\\n case INDEX_ID_##_id: \\\n return ID_##_id", "\n\n", "switch", "(", "index", ")", "{", "CASE_IDCODE", "(", "AC", ")", ";", "CASE_IDCODE", "(", "AR", ")", ";", "CASE_IDCODE", "(", "BR", ")", ";", "CASE_IDCODE", "(", "CA", ")", ";", "CASE_IDCODE", "(", "CF", ")", ";", "CASE_IDCODE", "(", "CU", ")", ";", "CASE_IDCODE", "(", "GD", ")", ";", "CASE_IDCODE", "(", "GR", ")", ";", "CASE_IDCODE", "(", "IM", ")", ";", "CASE_IDCODE", "(", "KE", ")", ";", "CASE_IDCODE", "(", "IP", ")", ";", "CASE_IDCODE", "(", "LA", ")", ";", "CASE_IDCODE", "(", "LI", ")", ";", "CASE_IDCODE", "(", "LS", ")", ";", "CASE_IDCODE", "(", "LT", ")", ";", "CASE_IDCODE", "(", "MA", ")", ";", "CASE_IDCODE", "(", "MB", ")", ";", "CASE_IDCODE", "(", "MC", ")", ";", "CASE_IDCODE", "(", "ME", ")", ";", "CASE_IDCODE", "(", "MSK", ")", ";", "CASE_IDCODE", "(", "NT", ")", ";", "CASE_IDCODE", "(", "OB", ")", ";", "CASE_IDCODE", "(", "PA", ")", ";", "CASE_IDCODE", "(", "PAL", ")", ";", "CASE_IDCODE", "(", "PC", ")", ";", "CASE_IDCODE", "(", "LP", ")", ";", "CASE_IDCODE", "(", "SCE", ")", ";", "CASE_IDCODE", "(", "SCR", ")", ";", "CASE_IDCODE", "(", "SPK", ")", ";", "CASE_IDCODE", "(", "SO", ")", ";", "CASE_IDCODE", "(", "TE", ")", ";", "CASE_IDCODE", "(", "TXT", ")", ";", "CASE_IDCODE", "(", "VF", ")", ";", "CASE_IDCODE", "(", "WM", ")", ";", "CASE_IDCODE", "(", "WO", ")", ";", "CASE_IDCODE", "(", "WS", ")", ";", "}", "BLI_assert", "(", "0", ")", ";", "return", "-1", ";", "#undef", " CASE_IDCODE", "\n", "}" ]
Get an idcode from an index (e.g.
[ "Get", "an", "idcode", "from", "an", "index", "(", "e", ".", "g", "." ]
[]
[ { "param": "index", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "index", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b7cb181374c5000f94048c00020ec2a3556b579
DemonRem/blender
source/blender/blenkernel/intern/idcode.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BKE_idcode_to_name_plural
char
const char *BKE_idcode_to_name_plural(short idcode) { IDType *idt = idtype_from_code(idcode); BLI_assert(idt); return idt ? idt->plural : NULL; }
/** * Convert an idcode into a name (plural). * * \param idcode: The code to convert. * \return A static string representing the name of * the code. */
Convert an idcode into a name (plural). \param idcode: The code to convert. \return A static string representing the name of the code.
[ "Convert", "an", "idcode", "into", "a", "name", "(", "plural", ")", ".", "\\", "param", "idcode", ":", "The", "code", "to", "convert", ".", "\\", "return", "A", "static", "string", "representing", "the", "name", "of", "the", "code", "." ]
const char *BKE_idcode_to_name_plural(short idcode) { IDType *idt = idtype_from_code(idcode); BLI_assert(idt); return idt ? idt->plural : NULL; }
[ "const", "char", "*", "BKE_idcode_to_name_plural", "(", "short", "idcode", ")", "{", "IDType", "*", "idt", "=", "idtype_from_code", "(", "idcode", ")", ";", "BLI_assert", "(", "idt", ")", ";", "return", "idt", "?", "idt", "->", "plural", ":", "NULL", ";", "}" ]
Convert an idcode into a name (plural).
[ "Convert", "an", "idcode", "into", "a", "name", "(", "plural", ")", "." ]
[]
[ { "param": "idcode", "type": "short" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "idcode", "type": "short", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b7cb181374c5000f94048c00020ec2a3556b579
DemonRem/blender
source/blender/blenkernel/intern/idcode.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BKE_idcode_to_translation_context
char
const char *BKE_idcode_to_translation_context(short idcode) { IDType *idt = idtype_from_code(idcode); BLI_assert(idt); return idt ? idt->i18n_context : BLT_I18NCONTEXT_DEFAULT; }
/** * Convert an idcode into its translations' context. * * \param idcode: The code to convert. * \return A static string representing the i18n context of the code. */
Convert an idcode into its translations' context. \param idcode: The code to convert. \return A static string representing the i18n context of the code.
[ "Convert", "an", "idcode", "into", "its", "translations", "'", "context", ".", "\\", "param", "idcode", ":", "The", "code", "to", "convert", ".", "\\", "return", "A", "static", "string", "representing", "the", "i18n", "context", "of", "the", "code", "." ]
const char *BKE_idcode_to_translation_context(short idcode) { IDType *idt = idtype_from_code(idcode); BLI_assert(idt); return idt ? idt->i18n_context : BLT_I18NCONTEXT_DEFAULT; }
[ "const", "char", "*", "BKE_idcode_to_translation_context", "(", "short", "idcode", ")", "{", "IDType", "*", "idt", "=", "idtype_from_code", "(", "idcode", ")", ";", "BLI_assert", "(", "idt", ")", ";", "return", "idt", "?", "idt", "->", "i18n_context", ":", "BLT_I18NCONTEXT_DEFAULT", ";", "}" ]
Convert an idcode into its translations' context.
[ "Convert", "an", "idcode", "into", "its", "translations", "'", "context", "." ]
[]
[ { "param": "idcode", "type": "short" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "idcode", "type": "short", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
d42436ecb40ff1b3c99bf0627ac55c8f1e8c45f6
DemonRem/blender
source/blender/blenkernel/intern/sound.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BKE_sound_free
void
void BKE_sound_free(bSound *sound) { /* No animdata here. */ if (sound->packedfile) { BKE_packedfile_free(sound->packedfile); sound->packedfile = NULL; } sound_free_audio(sound); BKE_sound_free_waveform(sound); if (sound->spinlock) { BLI_spin_end(sound->spinlock); MEM_freeN(sound->spinlock); sound->spinlock = NULL; } }
/** Free (or release) any data used by this sound (does not free the sound itself). */
Free (or release) any data used by this sound (does not free the sound itself).
[ "Free", "(", "or", "release", ")", "any", "data", "used", "by", "this", "sound", "(", "does", "not", "free", "the", "sound", "itself", ")", "." ]
void BKE_sound_free(bSound *sound) { if (sound->packedfile) { BKE_packedfile_free(sound->packedfile); sound->packedfile = NULL; } sound_free_audio(sound); BKE_sound_free_waveform(sound); if (sound->spinlock) { BLI_spin_end(sound->spinlock); MEM_freeN(sound->spinlock); sound->spinlock = NULL; } }
[ "void", "BKE_sound_free", "(", "bSound", "*", "sound", ")", "{", "if", "(", "sound", "->", "packedfile", ")", "{", "BKE_packedfile_free", "(", "sound", "->", "packedfile", ")", ";", "sound", "->", "packedfile", "=", "NULL", ";", "}", "sound_free_audio", "(", "sound", ")", ";", "BKE_sound_free_waveform", "(", "sound", ")", ";", "if", "(", "sound", "->", "spinlock", ")", "{", "BLI_spin_end", "(", "sound", "->", "spinlock", ")", ";", "MEM_freeN", "(", "sound", "->", "spinlock", ")", ";", "sound", "->", "spinlock", "=", "NULL", ";", "}", "}" ]
Free (or release) any data used by this sound (does not free the sound itself).
[ "Free", "(", "or", "release", ")", "any", "data", "used", "by", "this", "sound", "(", "does", "not", "free", "the", "sound", "itself", ")", "." ]
[ "/* No animdata here. */" ]
[ { "param": "sound", "type": "bSound" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "sound", "type": "bSound", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
d42436ecb40ff1b3c99bf0627ac55c8f1e8c45f6
DemonRem/blender
source/blender/blenkernel/intern/sound.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BKE_sound_copy_data
void
void BKE_sound_copy_data(Main *UNUSED(bmain), bSound *sound_dst, const bSound *UNUSED(sound_src), const int UNUSED(flag)) { sound_dst->handle = NULL; sound_dst->cache = NULL; sound_dst->waveform = NULL; sound_dst->playback_handle = NULL; sound_dst->spinlock = MEM_mallocN(sizeof(SpinLock), "sound_spinlock"); BLI_spin_init(sound_dst->spinlock); /* Just to be sure, should not have any value actually after reading time. */ sound_dst->ipo = NULL; sound_dst->newpackedfile = NULL; if (sound_dst->packedfile) { sound_dst->packedfile = BKE_packedfile_duplicate(sound_dst->packedfile); } BKE_sound_reset_runtime(sound_dst); }
/** * Only copy internal data of Sound ID from source * to already allocated/initialized destination. * You probably never want to use that directly, * use #BKE_id_copy or #BKE_id_copy_ex for typical needs. * * WARNING! This function will not handle ID user count! * * \param flag: Copying options (see BKE_library.h's LIB_ID_COPY_... flags for more). */
Only copy internal data of Sound ID from source to already allocated/initialized destination. You probably never want to use that directly, use #BKE_id_copy or #BKE_id_copy_ex for typical needs. WARNING. This function will not handle ID user count! \param flag: Copying options .
[ "Only", "copy", "internal", "data", "of", "Sound", "ID", "from", "source", "to", "already", "allocated", "/", "initialized", "destination", ".", "You", "probably", "never", "want", "to", "use", "that", "directly", "use", "#BKE_id_copy", "or", "#BKE_id_copy_ex", "for", "typical", "needs", ".", "WARNING", ".", "This", "function", "will", "not", "handle", "ID", "user", "count!", "\\", "param", "flag", ":", "Copying", "options", "." ]
void BKE_sound_copy_data(Main *UNUSED(bmain), bSound *sound_dst, const bSound *UNUSED(sound_src), const int UNUSED(flag)) { sound_dst->handle = NULL; sound_dst->cache = NULL; sound_dst->waveform = NULL; sound_dst->playback_handle = NULL; sound_dst->spinlock = MEM_mallocN(sizeof(SpinLock), "sound_spinlock"); BLI_spin_init(sound_dst->spinlock); sound_dst->ipo = NULL; sound_dst->newpackedfile = NULL; if (sound_dst->packedfile) { sound_dst->packedfile = BKE_packedfile_duplicate(sound_dst->packedfile); } BKE_sound_reset_runtime(sound_dst); }
[ "void", "BKE_sound_copy_data", "(", "Main", "*", "UNUSED", "(", "bmain", ")", ",", "bSound", "*", "sound_dst", ",", "const", "bSound", "*", "UNUSED", "(", "sound_src", ")", ",", "const", "int", "UNUSED", "(", "flag", ")", ")", "{", "sound_dst", "->", "handle", "=", "NULL", ";", "sound_dst", "->", "cache", "=", "NULL", ";", "sound_dst", "->", "waveform", "=", "NULL", ";", "sound_dst", "->", "playback_handle", "=", "NULL", ";", "sound_dst", "->", "spinlock", "=", "MEM_mallocN", "(", "sizeof", "(", "SpinLock", ")", ",", "\"", "\"", ")", ";", "BLI_spin_init", "(", "sound_dst", "->", "spinlock", ")", ";", "sound_dst", "->", "ipo", "=", "NULL", ";", "sound_dst", "->", "newpackedfile", "=", "NULL", ";", "if", "(", "sound_dst", "->", "packedfile", ")", "{", "sound_dst", "->", "packedfile", "=", "BKE_packedfile_duplicate", "(", "sound_dst", "->", "packedfile", ")", ";", "}", "BKE_sound_reset_runtime", "(", "sound_dst", ")", ";", "}" ]
Only copy internal data of Sound ID from source to already allocated/initialized destination.
[ "Only", "copy", "internal", "data", "of", "Sound", "ID", "from", "source", "to", "already", "allocated", "/", "initialized", "destination", "." ]
[ "/* Just to be sure, should not have any value actually after reading time. */" ]
[ { "param": "UNUSED", "type": "int" }, { "param": "sound_dst", "type": "bSound" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "UNUSED", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "sound_dst", "type": "bSound", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b3095c792565b23ef59a119852de3a03d64cff7
DemonRem/blender
source/blender/makesdna/intern/dna_genfile.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
ispointer
bool
static bool ispointer(const char *name) { /* check if pointer or function pointer */ return (name[0] == '*' || (name[0] == '(' && name[1] == '*')); }
/** * Return true if the name indicates a pointer of some kind. */
Return true if the name indicates a pointer of some kind.
[ "Return", "true", "if", "the", "name", "indicates", "a", "pointer", "of", "some", "kind", "." ]
static bool ispointer(const char *name) { return (name[0] == '*' || (name[0] == '(' && name[1] == '*')); }
[ "static", "bool", "ispointer", "(", "const", "char", "*", "name", ")", "{", "return", "(", "name", "[", "0", "]", "==", "'", "'", "||", "(", "name", "[", "0", "]", "==", "'", "'", "&&", "name", "[", "1", "]", "==", "'", "'", ")", ")", ";", "}" ]
Return true if the name indicates a pointer of some kind.
[ "Return", "true", "if", "the", "name", "indicates", "a", "pointer", "of", "some", "kind", "." ]
[ "/* check if pointer or function pointer */" ]
[ { "param": "name", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "name", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b3095c792565b23ef59a119852de3a03d64cff7
DemonRem/blender
source/blender/makesdna/intern/dna_genfile.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
DNA_elem_size_nr
int
int DNA_elem_size_nr(const SDNA *sdna, short type, short name) { int len; const char *cp = sdna->names[name]; len = 0; /* is it a pointer or function pointer? */ if (ispointer(cp)) { /* has the name an extra length? (array) */ len = sdna->pointer_size * sdna->names_array_len[name]; } else if (sdna->types_size[type]) { /* has the name an extra length? (array) */ len = (int)sdna->types_size[type] * sdna->names_array_len[name]; } return len; }
/** * Returns the size of struct fields of the specified type and name. * * \param type: Index into sdna->types/types_size * \param name: Index into sdna->names, * needed to extract possible pointer/array information. */
Returns the size of struct fields of the specified type and name. \param type: Index into sdna->types/types_size \param name: Index into sdna->names, needed to extract possible pointer/array information.
[ "Returns", "the", "size", "of", "struct", "fields", "of", "the", "specified", "type", "and", "name", ".", "\\", "param", "type", ":", "Index", "into", "sdna", "-", ">", "types", "/", "types_size", "\\", "param", "name", ":", "Index", "into", "sdna", "-", ">", "names", "needed", "to", "extract", "possible", "pointer", "/", "array", "information", "." ]
int DNA_elem_size_nr(const SDNA *sdna, short type, short name) { int len; const char *cp = sdna->names[name]; len = 0; if (ispointer(cp)) { len = sdna->pointer_size * sdna->names_array_len[name]; } else if (sdna->types_size[type]) { len = (int)sdna->types_size[type] * sdna->names_array_len[name]; } return len; }
[ "int", "DNA_elem_size_nr", "(", "const", "SDNA", "*", "sdna", ",", "short", "type", ",", "short", "name", ")", "{", "int", "len", ";", "const", "char", "*", "cp", "=", "sdna", "->", "names", "[", "name", "]", ";", "len", "=", "0", ";", "if", "(", "ispointer", "(", "cp", ")", ")", "{", "len", "=", "sdna", "->", "pointer_size", "*", "sdna", "->", "names_array_len", "[", "name", "]", ";", "}", "else", "if", "(", "sdna", "->", "types_size", "[", "type", "]", ")", "{", "len", "=", "(", "int", ")", "sdna", "->", "types_size", "[", "type", "]", "*", "sdna", "->", "names_array_len", "[", "name", "]", ";", "}", "return", "len", ";", "}" ]
Returns the size of struct fields of the specified type and name.
[ "Returns", "the", "size", "of", "struct", "fields", "of", "the", "specified", "type", "and", "name", "." ]
[ "/* is it a pointer or function pointer? */", "/* has the name an extra length? (array) */", "/* has the name an extra length? (array) */" ]
[ { "param": "sdna", "type": "SDNA" }, { "param": "type", "type": "short" }, { "param": "name", "type": "short" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "sdna", "type": "SDNA", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "type", "type": "short", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "name", "type": "short", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b3095c792565b23ef59a119852de3a03d64cff7
DemonRem/blender
source/blender/makesdna/intern/dna_genfile.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
DNA_sdna_from_data
SDNA
SDNA *DNA_sdna_from_data(const void *data, const int data_len, bool do_endian_swap, bool data_alloc, const char **r_error_message) { SDNA *sdna = MEM_mallocN(sizeof(*sdna), "sdna"); const char *error_message = NULL; sdna->data_len = data_len; if (data_alloc) { char *data_copy = MEM_mallocN(data_len, "sdna_data"); memcpy(data_copy, data, data_len); sdna->data = data_copy; } else { sdna->data = data; } sdna->data_alloc = data_alloc; if (init_structDNA(sdna, do_endian_swap, &error_message)) { return sdna; } else { if (r_error_message == NULL) { fprintf(stderr, "Error decoding blend file SDNA: %s\n", error_message); } else { *r_error_message = error_message; } DNA_sdna_free(sdna); return NULL; } }
/** * Constructs and returns a decoded SDNA structure from the given encoded SDNA data block. */
Constructs and returns a decoded SDNA structure from the given encoded SDNA data block.
[ "Constructs", "and", "returns", "a", "decoded", "SDNA", "structure", "from", "the", "given", "encoded", "SDNA", "data", "block", "." ]
SDNA *DNA_sdna_from_data(const void *data, const int data_len, bool do_endian_swap, bool data_alloc, const char **r_error_message) { SDNA *sdna = MEM_mallocN(sizeof(*sdna), "sdna"); const char *error_message = NULL; sdna->data_len = data_len; if (data_alloc) { char *data_copy = MEM_mallocN(data_len, "sdna_data"); memcpy(data_copy, data, data_len); sdna->data = data_copy; } else { sdna->data = data; } sdna->data_alloc = data_alloc; if (init_structDNA(sdna, do_endian_swap, &error_message)) { return sdna; } else { if (r_error_message == NULL) { fprintf(stderr, "Error decoding blend file SDNA: %s\n", error_message); } else { *r_error_message = error_message; } DNA_sdna_free(sdna); return NULL; } }
[ "SDNA", "*", "DNA_sdna_from_data", "(", "const", "void", "*", "data", ",", "const", "int", "data_len", ",", "bool", "do_endian_swap", ",", "bool", "data_alloc", ",", "const", "char", "*", "*", "r_error_message", ")", "{", "SDNA", "*", "sdna", "=", "MEM_mallocN", "(", "sizeof", "(", "*", "sdna", ")", ",", "\"", "\"", ")", ";", "const", "char", "*", "error_message", "=", "NULL", ";", "sdna", "->", "data_len", "=", "data_len", ";", "if", "(", "data_alloc", ")", "{", "char", "*", "data_copy", "=", "MEM_mallocN", "(", "data_len", ",", "\"", "\"", ")", ";", "memcpy", "(", "data_copy", ",", "data", ",", "data_len", ")", ";", "sdna", "->", "data", "=", "data_copy", ";", "}", "else", "{", "sdna", "->", "data", "=", "data", ";", "}", "sdna", "->", "data_alloc", "=", "data_alloc", ";", "if", "(", "init_structDNA", "(", "sdna", ",", "do_endian_swap", ",", "&", "error_message", ")", ")", "{", "return", "sdna", ";", "}", "else", "{", "if", "(", "r_error_message", "==", "NULL", ")", "{", "fprintf", "(", "stderr", ",", "\"", "\\n", "\"", ",", "error_message", ")", ";", "}", "else", "{", "*", "r_error_message", "=", "error_message", ";", "}", "DNA_sdna_free", "(", "sdna", ")", ";", "return", "NULL", ";", "}", "}" ]
Constructs and returns a decoded SDNA structure from the given encoded SDNA data block.
[ "Constructs", "and", "returns", "a", "decoded", "SDNA", "structure", "from", "the", "given", "encoded", "SDNA", "data", "block", "." ]
[]
[ { "param": "data", "type": "void" }, { "param": "data_len", "type": "int" }, { "param": "do_endian_swap", "type": "bool" }, { "param": "data_alloc", "type": "bool" }, { "param": "r_error_message", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "data", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data_len", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "do_endian_swap", "type": "bool", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data_alloc", "type": "bool", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "r_error_message", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b3095c792565b23ef59a119852de3a03d64cff7
DemonRem/blender
source/blender/makesdna/intern/dna_genfile.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
DNA_struct_get_compareflags
char
const char *DNA_struct_get_compareflags(const SDNA *oldsdna, const SDNA *newsdna) { int a, b; const short *sp_old, *sp_new; const char *str1, *str2; char *compflags; if (oldsdna->structs_len == 0) { printf("error: file without SDNA\n"); return NULL; } compflags = MEM_callocN(oldsdna->structs_len, "compflags"); /* we check all structs in 'oldsdna' and compare them with * the structs in 'newsdna' */ unsigned int newsdna_index_last = 0; for (a = 0; a < oldsdna->structs_len; a++) { sp_old = oldsdna->structs[a]; /* search for type in cur */ int sp_new_index = DNA_struct_find_nr_ex( newsdna, oldsdna->types[sp_old[0]], &newsdna_index_last); /* The next indices will almost always match */ newsdna_index_last++; if (sp_new_index != -1) { sp_new = newsdna->structs[sp_new_index]; /* initial assumption */ compflags[a] = SDNA_CMP_NOT_EQUAL; /* compare length and amount of elems */ if (sp_new[1] == sp_old[1]) { if (newsdna->types_size[sp_new[0]] == oldsdna->types_size[sp_old[0]]) { /* same length, same amount of elems, now per type and name */ b = sp_old[1]; sp_old += 2; sp_new += 2; while (b > 0) { str1 = newsdna->types[sp_new[0]]; str2 = oldsdna->types[sp_old[0]]; if (strcmp(str1, str2) != 0) { break; } str1 = newsdna->names[sp_new[1]]; str2 = oldsdna->names[sp_old[1]]; if (strcmp(str1, str2) != 0) { break; } /* same type and same name, now pointersize */ if (ispointer(str1)) { if (oldsdna->pointer_size != newsdna->pointer_size) { break; } } b--; sp_old += 2; sp_new += 2; } if (b == 0) { /* no differences found */ compflags[a] = SDNA_CMP_EQUAL; } } } } } /* first struct in util.h is struct Link, this is skipped in compflags (als # 0). * was a bug, and this way dirty patched! Solve this later.... */ compflags[0] = SDNA_CMP_EQUAL; /* Because structs can be inside structs, we recursively * set flags when a struct is altered */ for (a = 0; a < oldsdna->structs_len; a++) { if (compflags[a] == SDNA_CMP_NOT_EQUAL) { recurs_test_compflags(oldsdna, compflags, a); } } #if 0 for (a = 0; a < oldsdna->structs_len; a++) { if (compflags[a] == SDNA_CMP_NOT_EQUAL) { spold = oldsdna->structs[a]; printf("changed: %s\n", oldsdna->types[spold[0]]); } } #endif return compflags; }
/** * Constructs and returns an array of byte flags with one element for each struct in oldsdna, * indicating how it compares to newsdna: */
Constructs and returns an array of byte flags with one element for each struct in oldsdna, indicating how it compares to newsdna.
[ "Constructs", "and", "returns", "an", "array", "of", "byte", "flags", "with", "one", "element", "for", "each", "struct", "in", "oldsdna", "indicating", "how", "it", "compares", "to", "newsdna", "." ]
const char *DNA_struct_get_compareflags(const SDNA *oldsdna, const SDNA *newsdna) { int a, b; const short *sp_old, *sp_new; const char *str1, *str2; char *compflags; if (oldsdna->structs_len == 0) { printf("error: file without SDNA\n"); return NULL; } compflags = MEM_callocN(oldsdna->structs_len, "compflags"); unsigned int newsdna_index_last = 0; for (a = 0; a < oldsdna->structs_len; a++) { sp_old = oldsdna->structs[a]; int sp_new_index = DNA_struct_find_nr_ex( newsdna, oldsdna->types[sp_old[0]], &newsdna_index_last); newsdna_index_last++; if (sp_new_index != -1) { sp_new = newsdna->structs[sp_new_index]; compflags[a] = SDNA_CMP_NOT_EQUAL; if (sp_new[1] == sp_old[1]) { if (newsdna->types_size[sp_new[0]] == oldsdna->types_size[sp_old[0]]) { b = sp_old[1]; sp_old += 2; sp_new += 2; while (b > 0) { str1 = newsdna->types[sp_new[0]]; str2 = oldsdna->types[sp_old[0]]; if (strcmp(str1, str2) != 0) { break; } str1 = newsdna->names[sp_new[1]]; str2 = oldsdna->names[sp_old[1]]; if (strcmp(str1, str2) != 0) { break; } if (ispointer(str1)) { if (oldsdna->pointer_size != newsdna->pointer_size) { break; } } b--; sp_old += 2; sp_new += 2; } if (b == 0) { compflags[a] = SDNA_CMP_EQUAL; } } } } } compflags[0] = SDNA_CMP_EQUAL; for (a = 0; a < oldsdna->structs_len; a++) { if (compflags[a] == SDNA_CMP_NOT_EQUAL) { recurs_test_compflags(oldsdna, compflags, a); } } #if 0 for (a = 0; a < oldsdna->structs_len; a++) { if (compflags[a] == SDNA_CMP_NOT_EQUAL) { spold = oldsdna->structs[a]; printf("changed: %s\n", oldsdna->types[spold[0]]); } } #endif return compflags; }
[ "const", "char", "*", "DNA_struct_get_compareflags", "(", "const", "SDNA", "*", "oldsdna", ",", "const", "SDNA", "*", "newsdna", ")", "{", "int", "a", ",", "b", ";", "const", "short", "*", "sp_old", ",", "*", "sp_new", ";", "const", "char", "*", "str1", ",", "*", "str2", ";", "char", "*", "compflags", ";", "if", "(", "oldsdna", "->", "structs_len", "==", "0", ")", "{", "printf", "(", "\"", "\\n", "\"", ")", ";", "return", "NULL", ";", "}", "compflags", "=", "MEM_callocN", "(", "oldsdna", "->", "structs_len", ",", "\"", "\"", ")", ";", "unsigned", "int", "newsdna_index_last", "=", "0", ";", "for", "(", "a", "=", "0", ";", "a", "<", "oldsdna", "->", "structs_len", ";", "a", "++", ")", "{", "sp_old", "=", "oldsdna", "->", "structs", "[", "a", "]", ";", "int", "sp_new_index", "=", "DNA_struct_find_nr_ex", "(", "newsdna", ",", "oldsdna", "->", "types", "[", "sp_old", "[", "0", "]", "]", ",", "&", "newsdna_index_last", ")", ";", "newsdna_index_last", "++", ";", "if", "(", "sp_new_index", "!=", "-1", ")", "{", "sp_new", "=", "newsdna", "->", "structs", "[", "sp_new_index", "]", ";", "compflags", "[", "a", "]", "=", "SDNA_CMP_NOT_EQUAL", ";", "if", "(", "sp_new", "[", "1", "]", "==", "sp_old", "[", "1", "]", ")", "{", "if", "(", "newsdna", "->", "types_size", "[", "sp_new", "[", "0", "]", "]", "==", "oldsdna", "->", "types_size", "[", "sp_old", "[", "0", "]", "]", ")", "{", "b", "=", "sp_old", "[", "1", "]", ";", "sp_old", "+=", "2", ";", "sp_new", "+=", "2", ";", "while", "(", "b", ">", "0", ")", "{", "str1", "=", "newsdna", "->", "types", "[", "sp_new", "[", "0", "]", "]", ";", "str2", "=", "oldsdna", "->", "types", "[", "sp_old", "[", "0", "]", "]", ";", "if", "(", "strcmp", "(", "str1", ",", "str2", ")", "!=", "0", ")", "{", "break", ";", "}", "str1", "=", "newsdna", "->", "names", "[", "sp_new", "[", "1", "]", "]", ";", "str2", "=", "oldsdna", "->", "names", "[", "sp_old", "[", "1", "]", "]", ";", "if", "(", "strcmp", "(", "str1", ",", "str2", ")", "!=", "0", ")", "{", "break", ";", "}", "if", "(", "ispointer", "(", "str1", ")", ")", "{", "if", "(", "oldsdna", "->", "pointer_size", "!=", "newsdna", "->", "pointer_size", ")", "{", "break", ";", "}", "}", "b", "--", ";", "sp_old", "+=", "2", ";", "sp_new", "+=", "2", ";", "}", "if", "(", "b", "==", "0", ")", "{", "compflags", "[", "a", "]", "=", "SDNA_CMP_EQUAL", ";", "}", "}", "}", "}", "}", "compflags", "[", "0", "]", "=", "SDNA_CMP_EQUAL", ";", "for", "(", "a", "=", "0", ";", "a", "<", "oldsdna", "->", "structs_len", ";", "a", "++", ")", "{", "if", "(", "compflags", "[", "a", "]", "==", "SDNA_CMP_NOT_EQUAL", ")", "{", "recurs_test_compflags", "(", "oldsdna", ",", "compflags", ",", "a", ")", ";", "}", "}", "#if", "0", "\n", "for", "(", "a", "=", "0", ";", "a", "<", "oldsdna", "->", "structs_len", ";", "a", "++", ")", "{", "if", "(", "compflags", "[", "a", "]", "==", "SDNA_CMP_NOT_EQUAL", ")", "{", "spold", "=", "oldsdna", "->", "structs", "[", "a", "]", ";", "printf", "(", "\"", "\\n", "\"", ",", "oldsdna", "->", "types", "[", "spold", "[", "0", "]", "]", ")", ";", "}", "}", "#endif", "return", "compflags", ";", "}" ]
Constructs and returns an array of byte flags with one element for each struct in oldsdna, indicating how it compares to newsdna:
[ "Constructs", "and", "returns", "an", "array", "of", "byte", "flags", "with", "one", "element", "for", "each", "struct", "in", "oldsdna", "indicating", "how", "it", "compares", "to", "newsdna", ":" ]
[ "/* we check all structs in 'oldsdna' and compare them with\n * the structs in 'newsdna'\n */", "/* search for type in cur */", "/* The next indices will almost always match */", "/* initial assumption */", "/* compare length and amount of elems */", "/* same length, same amount of elems, now per type and name */", "/* same type and same name, now pointersize */", "/* no differences found */", "/* first struct in util.h is struct Link, this is skipped in compflags (als # 0).\n * was a bug, and this way dirty patched! Solve this later....\n */", "/* Because structs can be inside structs, we recursively\n * set flags when a struct is altered\n */" ]
[ { "param": "oldsdna", "type": "SDNA" }, { "param": "newsdna", "type": "SDNA" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "oldsdna", "type": "SDNA", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "newsdna", "type": "SDNA", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b3095c792565b23ef59a119852de3a03d64cff7
DemonRem/blender
source/blender/makesdna/intern/dna_genfile.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
sdna_type_nr
eSDNA_Type
static eSDNA_Type sdna_type_nr(const char *dna_type) { if (STR_ELEM(dna_type, "char", "const char")) { return SDNA_TYPE_CHAR; } else if (STR_ELEM(dna_type, "uchar", "unsigned char")) { return SDNA_TYPE_UCHAR; } else if (STR_ELEM(dna_type, "short")) { return SDNA_TYPE_SHORT; } else if (STR_ELEM(dna_type, "ushort", "unsigned short")) { return SDNA_TYPE_USHORT; } else if (STR_ELEM(dna_type, "int")) { return SDNA_TYPE_INT; } else if (STR_ELEM(dna_type, "float")) { return SDNA_TYPE_FLOAT; } else if (STR_ELEM(dna_type, "double")) { return SDNA_TYPE_DOUBLE; } else if (STR_ELEM(dna_type, "int64_t")) { return SDNA_TYPE_INT64; } else if (STR_ELEM(dna_type, "uint64_t")) { return SDNA_TYPE_UINT64; } /* invalid! */ else { return -1; } }
/** * Converts the name of a primitive type to its enumeration code. */
Converts the name of a primitive type to its enumeration code.
[ "Converts", "the", "name", "of", "a", "primitive", "type", "to", "its", "enumeration", "code", "." ]
static eSDNA_Type sdna_type_nr(const char *dna_type) { if (STR_ELEM(dna_type, "char", "const char")) { return SDNA_TYPE_CHAR; } else if (STR_ELEM(dna_type, "uchar", "unsigned char")) { return SDNA_TYPE_UCHAR; } else if (STR_ELEM(dna_type, "short")) { return SDNA_TYPE_SHORT; } else if (STR_ELEM(dna_type, "ushort", "unsigned short")) { return SDNA_TYPE_USHORT; } else if (STR_ELEM(dna_type, "int")) { return SDNA_TYPE_INT; } else if (STR_ELEM(dna_type, "float")) { return SDNA_TYPE_FLOAT; } else if (STR_ELEM(dna_type, "double")) { return SDNA_TYPE_DOUBLE; } else if (STR_ELEM(dna_type, "int64_t")) { return SDNA_TYPE_INT64; } else if (STR_ELEM(dna_type, "uint64_t")) { return SDNA_TYPE_UINT64; } else { return -1; } }
[ "static", "eSDNA_Type", "sdna_type_nr", "(", "const", "char", "*", "dna_type", ")", "{", "if", "(", "STR_ELEM", "(", "dna_type", ",", "\"", "\"", ",", "\"", "\"", ")", ")", "{", "return", "SDNA_TYPE_CHAR", ";", "}", "else", "if", "(", "STR_ELEM", "(", "dna_type", ",", "\"", "\"", ",", "\"", "\"", ")", ")", "{", "return", "SDNA_TYPE_UCHAR", ";", "}", "else", "if", "(", "STR_ELEM", "(", "dna_type", ",", "\"", "\"", ")", ")", "{", "return", "SDNA_TYPE_SHORT", ";", "}", "else", "if", "(", "STR_ELEM", "(", "dna_type", ",", "\"", "\"", ",", "\"", "\"", ")", ")", "{", "return", "SDNA_TYPE_USHORT", ";", "}", "else", "if", "(", "STR_ELEM", "(", "dna_type", ",", "\"", "\"", ")", ")", "{", "return", "SDNA_TYPE_INT", ";", "}", "else", "if", "(", "STR_ELEM", "(", "dna_type", ",", "\"", "\"", ")", ")", "{", "return", "SDNA_TYPE_FLOAT", ";", "}", "else", "if", "(", "STR_ELEM", "(", "dna_type", ",", "\"", "\"", ")", ")", "{", "return", "SDNA_TYPE_DOUBLE", ";", "}", "else", "if", "(", "STR_ELEM", "(", "dna_type", ",", "\"", "\"", ")", ")", "{", "return", "SDNA_TYPE_INT64", ";", "}", "else", "if", "(", "STR_ELEM", "(", "dna_type", ",", "\"", "\"", ")", ")", "{", "return", "SDNA_TYPE_UINT64", ";", "}", "else", "{", "return", "-1", ";", "}", "}" ]
Converts the name of a primitive type to its enumeration code.
[ "Converts", "the", "name", "of", "a", "primitive", "type", "to", "its", "enumeration", "code", "." ]
[ "/* invalid! */" ]
[ { "param": "dna_type", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "dna_type", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b3095c792565b23ef59a119852de3a03d64cff7
DemonRem/blender
source/blender/makesdna/intern/dna_genfile.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
cast_elem
void
static void cast_elem( const char *ctype, const char *otype, int name_array_len, char *curdata, const char *olddata) { double val = 0.0; int curlen = 1, oldlen = 1; eSDNA_Type ctypenr, otypenr; if ((otypenr = sdna_type_nr(otype)) == -1 || (ctypenr = sdna_type_nr(ctype)) == -1) { return; } /* define lengths */ oldlen = DNA_elem_type_size(otypenr); curlen = DNA_elem_type_size(ctypenr); while (name_array_len > 0) { switch (otypenr) { case SDNA_TYPE_CHAR: val = *olddata; break; case SDNA_TYPE_UCHAR: val = *((unsigned char *)olddata); break; case SDNA_TYPE_SHORT: val = *((short *)olddata); break; case SDNA_TYPE_USHORT: val = *((unsigned short *)olddata); break; case SDNA_TYPE_INT: val = *((int *)olddata); break; case SDNA_TYPE_FLOAT: val = *((float *)olddata); break; case SDNA_TYPE_DOUBLE: val = *((double *)olddata); break; case SDNA_TYPE_INT64: val = *((int64_t *)olddata); break; case SDNA_TYPE_UINT64: val = *((uint64_t *)olddata); break; } switch (ctypenr) { case SDNA_TYPE_CHAR: *curdata = val; break; case SDNA_TYPE_UCHAR: *((unsigned char *)curdata) = val; break; case SDNA_TYPE_SHORT: *((short *)curdata) = val; break; case SDNA_TYPE_USHORT: *((unsigned short *)curdata) = val; break; case SDNA_TYPE_INT: *((int *)curdata) = val; break; case SDNA_TYPE_FLOAT: if (otypenr < 2) { val /= 255; } *((float *)curdata) = val; break; case SDNA_TYPE_DOUBLE: if (otypenr < 2) { val /= 255; } *((double *)curdata) = val; break; case SDNA_TYPE_INT64: *((int64_t *)curdata) = val; break; case SDNA_TYPE_UINT64: *((uint64_t *)curdata) = val; break; } olddata += oldlen; curdata += curlen; name_array_len--; } }
/** * Converts a value of one primitive type to another. * Note there is no optimization for the case where otype and ctype are the same: * assumption is that caller will handle this case. * * \param ctype: Name of type to convert to * \param otype: Name of type to convert from * \param name_array_len: Result of #DNA_elem_array_size for this element. * \param curdata: Where to put converted data * \param olddata: Data of type otype to convert */
Converts a value of one primitive type to another. Note there is no optimization for the case where otype and ctype are the same: assumption is that caller will handle this case. \param ctype: Name of type to convert to \param otype: Name of type to convert from \param name_array_len: Result of #DNA_elem_array_size for this element. \param curdata: Where to put converted data \param olddata: Data of type otype to convert
[ "Converts", "a", "value", "of", "one", "primitive", "type", "to", "another", ".", "Note", "there", "is", "no", "optimization", "for", "the", "case", "where", "otype", "and", "ctype", "are", "the", "same", ":", "assumption", "is", "that", "caller", "will", "handle", "this", "case", ".", "\\", "param", "ctype", ":", "Name", "of", "type", "to", "convert", "to", "\\", "param", "otype", ":", "Name", "of", "type", "to", "convert", "from", "\\", "param", "name_array_len", ":", "Result", "of", "#DNA_elem_array_size", "for", "this", "element", ".", "\\", "param", "curdata", ":", "Where", "to", "put", "converted", "data", "\\", "param", "olddata", ":", "Data", "of", "type", "otype", "to", "convert" ]
static void cast_elem( const char *ctype, const char *otype, int name_array_len, char *curdata, const char *olddata) { double val = 0.0; int curlen = 1, oldlen = 1; eSDNA_Type ctypenr, otypenr; if ((otypenr = sdna_type_nr(otype)) == -1 || (ctypenr = sdna_type_nr(ctype)) == -1) { return; } oldlen = DNA_elem_type_size(otypenr); curlen = DNA_elem_type_size(ctypenr); while (name_array_len > 0) { switch (otypenr) { case SDNA_TYPE_CHAR: val = *olddata; break; case SDNA_TYPE_UCHAR: val = *((unsigned char *)olddata); break; case SDNA_TYPE_SHORT: val = *((short *)olddata); break; case SDNA_TYPE_USHORT: val = *((unsigned short *)olddata); break; case SDNA_TYPE_INT: val = *((int *)olddata); break; case SDNA_TYPE_FLOAT: val = *((float *)olddata); break; case SDNA_TYPE_DOUBLE: val = *((double *)olddata); break; case SDNA_TYPE_INT64: val = *((int64_t *)olddata); break; case SDNA_TYPE_UINT64: val = *((uint64_t *)olddata); break; } switch (ctypenr) { case SDNA_TYPE_CHAR: *curdata = val; break; case SDNA_TYPE_UCHAR: *((unsigned char *)curdata) = val; break; case SDNA_TYPE_SHORT: *((short *)curdata) = val; break; case SDNA_TYPE_USHORT: *((unsigned short *)curdata) = val; break; case SDNA_TYPE_INT: *((int *)curdata) = val; break; case SDNA_TYPE_FLOAT: if (otypenr < 2) { val /= 255; } *((float *)curdata) = val; break; case SDNA_TYPE_DOUBLE: if (otypenr < 2) { val /= 255; } *((double *)curdata) = val; break; case SDNA_TYPE_INT64: *((int64_t *)curdata) = val; break; case SDNA_TYPE_UINT64: *((uint64_t *)curdata) = val; break; } olddata += oldlen; curdata += curlen; name_array_len--; } }
[ "static", "void", "cast_elem", "(", "const", "char", "*", "ctype", ",", "const", "char", "*", "otype", ",", "int", "name_array_len", ",", "char", "*", "curdata", ",", "const", "char", "*", "olddata", ")", "{", "double", "val", "=", "0.0", ";", "int", "curlen", "=", "1", ",", "oldlen", "=", "1", ";", "eSDNA_Type", "ctypenr", ",", "otypenr", ";", "if", "(", "(", "otypenr", "=", "sdna_type_nr", "(", "otype", ")", ")", "==", "-1", "||", "(", "ctypenr", "=", "sdna_type_nr", "(", "ctype", ")", ")", "==", "-1", ")", "{", "return", ";", "}", "oldlen", "=", "DNA_elem_type_size", "(", "otypenr", ")", ";", "curlen", "=", "DNA_elem_type_size", "(", "ctypenr", ")", ";", "while", "(", "name_array_len", ">", "0", ")", "{", "switch", "(", "otypenr", ")", "{", "case", "SDNA_TYPE_CHAR", ":", "val", "=", "*", "olddata", ";", "break", ";", "case", "SDNA_TYPE_UCHAR", ":", "val", "=", "*", "(", "(", "unsigned", "char", "*", ")", "olddata", ")", ";", "break", ";", "case", "SDNA_TYPE_SHORT", ":", "val", "=", "*", "(", "(", "short", "*", ")", "olddata", ")", ";", "break", ";", "case", "SDNA_TYPE_USHORT", ":", "val", "=", "*", "(", "(", "unsigned", "short", "*", ")", "olddata", ")", ";", "break", ";", "case", "SDNA_TYPE_INT", ":", "val", "=", "*", "(", "(", "int", "*", ")", "olddata", ")", ";", "break", ";", "case", "SDNA_TYPE_FLOAT", ":", "val", "=", "*", "(", "(", "float", "*", ")", "olddata", ")", ";", "break", ";", "case", "SDNA_TYPE_DOUBLE", ":", "val", "=", "*", "(", "(", "double", "*", ")", "olddata", ")", ";", "break", ";", "case", "SDNA_TYPE_INT64", ":", "val", "=", "*", "(", "(", "int64_t", "*", ")", "olddata", ")", ";", "break", ";", "case", "SDNA_TYPE_UINT64", ":", "val", "=", "*", "(", "(", "uint64_t", "*", ")", "olddata", ")", ";", "break", ";", "}", "switch", "(", "ctypenr", ")", "{", "case", "SDNA_TYPE_CHAR", ":", "*", "curdata", "=", "val", ";", "break", ";", "case", "SDNA_TYPE_UCHAR", ":", "*", "(", "(", "unsigned", "char", "*", ")", "curdata", ")", "=", "val", ";", "break", ";", "case", "SDNA_TYPE_SHORT", ":", "*", "(", "(", "short", "*", ")", "curdata", ")", "=", "val", ";", "break", ";", "case", "SDNA_TYPE_USHORT", ":", "*", "(", "(", "unsigned", "short", "*", ")", "curdata", ")", "=", "val", ";", "break", ";", "case", "SDNA_TYPE_INT", ":", "*", "(", "(", "int", "*", ")", "curdata", ")", "=", "val", ";", "break", ";", "case", "SDNA_TYPE_FLOAT", ":", "if", "(", "otypenr", "<", "2", ")", "{", "val", "/=", "255", ";", "}", "*", "(", "(", "float", "*", ")", "curdata", ")", "=", "val", ";", "break", ";", "case", "SDNA_TYPE_DOUBLE", ":", "if", "(", "otypenr", "<", "2", ")", "{", "val", "/=", "255", ";", "}", "*", "(", "(", "double", "*", ")", "curdata", ")", "=", "val", ";", "break", ";", "case", "SDNA_TYPE_INT64", ":", "*", "(", "(", "int64_t", "*", ")", "curdata", ")", "=", "val", ";", "break", ";", "case", "SDNA_TYPE_UINT64", ":", "*", "(", "(", "uint64_t", "*", ")", "curdata", ")", "=", "val", ";", "break", ";", "}", "olddata", "+=", "oldlen", ";", "curdata", "+=", "curlen", ";", "name_array_len", "--", ";", "}", "}" ]
Converts a value of one primitive type to another.
[ "Converts", "a", "value", "of", "one", "primitive", "type", "to", "another", "." ]
[ "/* define lengths */" ]
[ { "param": "ctype", "type": "char" }, { "param": "otype", "type": "char" }, { "param": "name_array_len", "type": "int" }, { "param": "curdata", "type": "char" }, { "param": "olddata", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ctype", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "otype", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "name_array_len", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "curdata", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "olddata", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b3095c792565b23ef59a119852de3a03d64cff7
DemonRem/blender
source/blender/makesdna/intern/dna_genfile.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
cast_pointer
void
static void cast_pointer( int curlen, int oldlen, int name_array_len, char *curdata, const char *olddata) { int64_t lval; while (name_array_len > 0) { if (curlen == oldlen) { memcpy(curdata, olddata, curlen); } else if (curlen == 4 && oldlen == 8) { lval = *((int64_t *)olddata); /* WARNING: 32-bit Blender trying to load file saved by 64-bit Blender, * pointers may lose uniqueness on truncation! (Hopefully this wont * happen unless/until we ever get to multi-gigabyte .blend files...) */ *((int *)curdata) = lval >> 3; } else if (curlen == 8 && oldlen == 4) { *((int64_t *)curdata) = *((int *)olddata); } else { /* for debug */ printf("errpr: illegal pointersize!\n"); } olddata += oldlen; curdata += curlen; name_array_len--; } }
/** * Converts pointer values between different sizes. These are only used * as lookup keys to identify data blocks in the saved .blend file, not * as actual in-memory pointers. * * \param curlen: Pointer length to convert to * \param oldlen: Length of pointers in olddata * \param name_array_len: Result of #DNA_elem_array_size for this element. * \param curdata: Where to put converted data * \param olddata: Data to convert */
Converts pointer values between different sizes. These are only used as lookup keys to identify data blocks in the saved .blend file, not as actual in-memory pointers. \param curlen: Pointer length to convert to \param oldlen: Length of pointers in olddata \param name_array_len: Result of #DNA_elem_array_size for this element. \param curdata: Where to put converted data \param olddata: Data to convert
[ "Converts", "pointer", "values", "between", "different", "sizes", ".", "These", "are", "only", "used", "as", "lookup", "keys", "to", "identify", "data", "blocks", "in", "the", "saved", ".", "blend", "file", "not", "as", "actual", "in", "-", "memory", "pointers", ".", "\\", "param", "curlen", ":", "Pointer", "length", "to", "convert", "to", "\\", "param", "oldlen", ":", "Length", "of", "pointers", "in", "olddata", "\\", "param", "name_array_len", ":", "Result", "of", "#DNA_elem_array_size", "for", "this", "element", ".", "\\", "param", "curdata", ":", "Where", "to", "put", "converted", "data", "\\", "param", "olddata", ":", "Data", "to", "convert" ]
static void cast_pointer( int curlen, int oldlen, int name_array_len, char *curdata, const char *olddata) { int64_t lval; while (name_array_len > 0) { if (curlen == oldlen) { memcpy(curdata, olddata, curlen); } else if (curlen == 4 && oldlen == 8) { lval = *((int64_t *)olddata); *((int *)curdata) = lval >> 3; } else if (curlen == 8 && oldlen == 4) { *((int64_t *)curdata) = *((int *)olddata); } else { printf("errpr: illegal pointersize!\n"); } olddata += oldlen; curdata += curlen; name_array_len--; } }
[ "static", "void", "cast_pointer", "(", "int", "curlen", ",", "int", "oldlen", ",", "int", "name_array_len", ",", "char", "*", "curdata", ",", "const", "char", "*", "olddata", ")", "{", "int64_t", "lval", ";", "while", "(", "name_array_len", ">", "0", ")", "{", "if", "(", "curlen", "==", "oldlen", ")", "{", "memcpy", "(", "curdata", ",", "olddata", ",", "curlen", ")", ";", "}", "else", "if", "(", "curlen", "==", "4", "&&", "oldlen", "==", "8", ")", "{", "lval", "=", "*", "(", "(", "int64_t", "*", ")", "olddata", ")", ";", "*", "(", "(", "int", "*", ")", "curdata", ")", "=", "lval", ">>", "3", ";", "}", "else", "if", "(", "curlen", "==", "8", "&&", "oldlen", "==", "4", ")", "{", "*", "(", "(", "int64_t", "*", ")", "curdata", ")", "=", "*", "(", "(", "int", "*", ")", "olddata", ")", ";", "}", "else", "{", "printf", "(", "\"", "\\n", "\"", ")", ";", "}", "olddata", "+=", "oldlen", ";", "curdata", "+=", "curlen", ";", "name_array_len", "--", ";", "}", "}" ]
Converts pointer values between different sizes.
[ "Converts", "pointer", "values", "between", "different", "sizes", "." ]
[ "/* WARNING: 32-bit Blender trying to load file saved by 64-bit Blender,\n * pointers may lose uniqueness on truncation! (Hopefully this wont\n * happen unless/until we ever get to multi-gigabyte .blend files...) */", "/* for debug */" ]
[ { "param": "curlen", "type": "int" }, { "param": "oldlen", "type": "int" }, { "param": "name_array_len", "type": "int" }, { "param": "curdata", "type": "char" }, { "param": "olddata", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "curlen", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "oldlen", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "name_array_len", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "curdata", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "olddata", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b3095c792565b23ef59a119852de3a03d64cff7
DemonRem/blender
source/blender/makesdna/intern/dna_genfile.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
elem_strcmp
int
static int elem_strcmp(const char *name, const char *oname) { int a = 0; while (1) { if (name[a] != oname[a]) { return 1; } if (name[a] == '[' || oname[a] == '[') { break; } if (name[a] == 0 || oname[a] == 0) { break; } a++; } return 0; }
/** * Equality test on name and oname excluding any array-size suffix. */
Equality test on name and oname excluding any array-size suffix.
[ "Equality", "test", "on", "name", "and", "oname", "excluding", "any", "array", "-", "size", "suffix", "." ]
static int elem_strcmp(const char *name, const char *oname) { int a = 0; while (1) { if (name[a] != oname[a]) { return 1; } if (name[a] == '[' || oname[a] == '[') { break; } if (name[a] == 0 || oname[a] == 0) { break; } a++; } return 0; }
[ "static", "int", "elem_strcmp", "(", "const", "char", "*", "name", ",", "const", "char", "*", "oname", ")", "{", "int", "a", "=", "0", ";", "while", "(", "1", ")", "{", "if", "(", "name", "[", "a", "]", "!=", "oname", "[", "a", "]", ")", "{", "return", "1", ";", "}", "if", "(", "name", "[", "a", "]", "==", "'", "'", "||", "oname", "[", "a", "]", "==", "'", "'", ")", "{", "break", ";", "}", "if", "(", "name", "[", "a", "]", "==", "0", "||", "oname", "[", "a", "]", "==", "0", ")", "{", "break", ";", "}", "a", "++", ";", "}", "return", "0", ";", "}" ]
Equality test on name and oname excluding any array-size suffix.
[ "Equality", "test", "on", "name", "and", "oname", "excluding", "any", "array", "-", "size", "suffix", "." ]
[]
[ { "param": "name", "type": "char" }, { "param": "oname", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "name", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "oname", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b3095c792565b23ef59a119852de3a03d64cff7
DemonRem/blender
source/blender/makesdna/intern/dna_genfile.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
elem_exists_impl
bool
static bool elem_exists_impl( /* Expand SDNA. */ const char **types, const char **names, /* Regular args. */ const char *type, const char *name, const short *old) { int a, elemcount; const char *otype, *oname; /* in old is the old struct */ elemcount = old[1]; old += 2; for (a = 0; a < elemcount; a++, old += 2) { otype = types[old[0]]; oname = names[old[1]]; if (elem_strcmp(name, oname) == 0) { /* name equal */ return strcmp(type, otype) == 0; /* type equal */ } } return false; }
/** * Returns whether the specified field exists according to the struct format * pointed to by old. * * \param sdna: Old SDNA * \param type: Current field type name * \param name: Current field name * \param old: Pointer to struct information in sdna * \return true when existing, false otherwise. */
Returns whether the specified field exists according to the struct format pointed to by old.
[ "Returns", "whether", "the", "specified", "field", "exists", "according", "to", "the", "struct", "format", "pointed", "to", "by", "old", "." ]
static bool elem_exists_impl( const char **types, const char **names, const char *type, const char *name, const short *old) { int a, elemcount; const char *otype, *oname; elemcount = old[1]; old += 2; for (a = 0; a < elemcount; a++, old += 2) { otype = types[old[0]]; oname = names[old[1]]; if (elem_strcmp(name, oname) == 0) { return strcmp(type, otype) == 0; } } return false; }
[ "static", "bool", "elem_exists_impl", "(", "const", "char", "*", "*", "types", ",", "const", "char", "*", "*", "names", ",", "const", "char", "*", "type", ",", "const", "char", "*", "name", ",", "const", "short", "*", "old", ")", "{", "int", "a", ",", "elemcount", ";", "const", "char", "*", "otype", ",", "*", "oname", ";", "elemcount", "=", "old", "[", "1", "]", ";", "old", "+=", "2", ";", "for", "(", "a", "=", "0", ";", "a", "<", "elemcount", ";", "a", "++", ",", "old", "+=", "2", ")", "{", "otype", "=", "types", "[", "old", "[", "0", "]", "]", ";", "oname", "=", "names", "[", "old", "[", "1", "]", "]", ";", "if", "(", "elem_strcmp", "(", "name", ",", "oname", ")", "==", "0", ")", "{", "return", "strcmp", "(", "type", ",", "otype", ")", "==", "0", ";", "}", "}", "return", "false", ";", "}" ]
Returns whether the specified field exists according to the struct format pointed to by old.
[ "Returns", "whether", "the", "specified", "field", "exists", "according", "to", "the", "struct", "format", "pointed", "to", "by", "old", "." ]
[ "/* Expand SDNA. */", "/* Regular args. */", "/* in old is the old struct */", "/* name equal */", "/* type equal */" ]
[ { "param": "types", "type": "char" }, { "param": "names", "type": "char" }, { "param": "type", "type": "char" }, { "param": "name", "type": "char" }, { "param": "old", "type": "short" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "types", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "names", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "type", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "name", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "old", "type": "short", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b3095c792565b23ef59a119852de3a03d64cff7
DemonRem/blender
source/blender/makesdna/intern/dna_genfile.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
find_elem
char
static const char *find_elem(const SDNA *sdna, const char *type, const char *name, const short *old, const char *olddata, const short **sppo) { int a, elemcount, len; const char *otype, *oname; /* without arraypart, so names can differ: return old namenr and type */ /* in old is the old struct */ elemcount = old[1]; old += 2; for (a = 0; a < elemcount; a++, old += 2) { otype = sdna->types[old[0]]; oname = sdna->names[old[1]]; len = DNA_elem_size_nr(sdna, old[0], old[1]); if (elem_strcmp(name, oname) == 0) { /* name equal */ if (strcmp(type, otype) == 0) { /* type equal */ if (sppo) { *sppo = old; } return olddata; } return NULL; } olddata += len; } return NULL; }
/** * Returns the address of the data for the specified field within olddata * according to the struct format pointed to by old, or NULL if no such * field can be found. * * Passing olddata=NULL doesn't work reliably for existence checks; it will * return NULL both when the field is found at offset 0 and when it is not * found at all. For field existence checks, use #elem_exists() instead. * * \param sdna: Old SDNA * \param type: Current field type name * \param name: Current field name * \param old: Pointer to struct information in sdna * \param olddata: Struct data * \param sppo: Optional place to return pointer to field info in sdna * \return Data address. */
Returns the address of the data for the specified field within olddata according to the struct format pointed to by old, or NULL if no such field can be found. Passing olddata=NULL doesn't work reliably for existence checks; it will return NULL both when the field is found at offset 0 and when it is not found at all. For field existence checks, use #elem_exists() instead.
[ "Returns", "the", "address", "of", "the", "data", "for", "the", "specified", "field", "within", "olddata", "according", "to", "the", "struct", "format", "pointed", "to", "by", "old", "or", "NULL", "if", "no", "such", "field", "can", "be", "found", ".", "Passing", "olddata", "=", "NULL", "doesn", "'", "t", "work", "reliably", "for", "existence", "checks", ";", "it", "will", "return", "NULL", "both", "when", "the", "field", "is", "found", "at", "offset", "0", "and", "when", "it", "is", "not", "found", "at", "all", ".", "For", "field", "existence", "checks", "use", "#elem_exists", "()", "instead", "." ]
static const char *find_elem(const SDNA *sdna, const char *type, const char *name, const short *old, const char *olddata, const short **sppo) { int a, elemcount, len; const char *otype, *oname; elemcount = old[1]; old += 2; for (a = 0; a < elemcount; a++, old += 2) { otype = sdna->types[old[0]]; oname = sdna->names[old[1]]; len = DNA_elem_size_nr(sdna, old[0], old[1]); if (elem_strcmp(name, oname) == 0) { if (strcmp(type, otype) == 0) { if (sppo) { *sppo = old; } return olddata; } return NULL; } olddata += len; } return NULL; }
[ "static", "const", "char", "*", "find_elem", "(", "const", "SDNA", "*", "sdna", ",", "const", "char", "*", "type", ",", "const", "char", "*", "name", ",", "const", "short", "*", "old", ",", "const", "char", "*", "olddata", ",", "const", "short", "*", "*", "sppo", ")", "{", "int", "a", ",", "elemcount", ",", "len", ";", "const", "char", "*", "otype", ",", "*", "oname", ";", "elemcount", "=", "old", "[", "1", "]", ";", "old", "+=", "2", ";", "for", "(", "a", "=", "0", ";", "a", "<", "elemcount", ";", "a", "++", ",", "old", "+=", "2", ")", "{", "otype", "=", "sdna", "->", "types", "[", "old", "[", "0", "]", "]", ";", "oname", "=", "sdna", "->", "names", "[", "old", "[", "1", "]", "]", ";", "len", "=", "DNA_elem_size_nr", "(", "sdna", ",", "old", "[", "0", "]", ",", "old", "[", "1", "]", ")", ";", "if", "(", "elem_strcmp", "(", "name", ",", "oname", ")", "==", "0", ")", "{", "if", "(", "strcmp", "(", "type", ",", "otype", ")", "==", "0", ")", "{", "if", "(", "sppo", ")", "{", "*", "sppo", "=", "old", ";", "}", "return", "olddata", ";", "}", "return", "NULL", ";", "}", "olddata", "+=", "len", ";", "}", "return", "NULL", ";", "}" ]
Returns the address of the data for the specified field within olddata according to the struct format pointed to by old, or NULL if no such field can be found.
[ "Returns", "the", "address", "of", "the", "data", "for", "the", "specified", "field", "within", "olddata", "according", "to", "the", "struct", "format", "pointed", "to", "by", "old", "or", "NULL", "if", "no", "such", "field", "can", "be", "found", "." ]
[ "/* without arraypart, so names can differ: return old namenr and type */", "/* in old is the old struct */", "/* name equal */", "/* type equal */" ]
[ { "param": "sdna", "type": "SDNA" }, { "param": "type", "type": "char" }, { "param": "name", "type": "char" }, { "param": "old", "type": "short" }, { "param": "olddata", "type": "char" }, { "param": "sppo", "type": "short" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "sdna", "type": "SDNA", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "type", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "name", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "old", "type": "short", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "olddata", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "sppo", "type": "short", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b3095c792565b23ef59a119852de3a03d64cff7
DemonRem/blender
source/blender/makesdna/intern/dna_genfile.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
reconstruct_elem
void
static void reconstruct_elem(const SDNA *newsdna, const SDNA *oldsdna, const char *type, const int new_name_nr, char *curdata, const short *old, const char *olddata) { /* rules: test for NAME: * - name equal: * - cast type * - name partially equal (array differs) * - type equal: memcpy * - type cast (per element). * (nzc 2-4-2001 I want the 'unsigned' bit to be parsed as well. Where * can I force this?) */ int a, elemcount, len, countpos, mul; const char *otype, *oname, *cp; /* is 'name' an array? */ const char *name = newsdna->names[new_name_nr]; cp = name; countpos = 0; while (*cp && *cp != '[') { cp++; countpos++; } if (*cp != '[') { countpos = 0; } /* in old is the old struct */ elemcount = old[1]; old += 2; for (a = 0; a < elemcount; a++, old += 2) { const int old_name_nr = old[1]; otype = oldsdna->types[old[0]]; oname = oldsdna->names[old[1]]; len = DNA_elem_size_nr(oldsdna, old[0], old[1]); if (strcmp(name, oname) == 0) { /* name equal */ if (ispointer(name)) { /* pointer of functionpointer afhandelen */ cast_pointer(newsdna->pointer_size, oldsdna->pointer_size, newsdna->names_array_len[new_name_nr], curdata, olddata); } else if (strcmp(type, otype) == 0) { /* type equal */ memcpy(curdata, olddata, len); } else { cast_elem(type, otype, newsdna->names_array_len[new_name_nr], curdata, olddata); } return; } else if (countpos != 0) { /* name is an array */ if (oname[countpos] == '[' && strncmp(name, oname, countpos) == 0) { /* basis equal */ const int new_name_array_len = newsdna->names_array_len[new_name_nr]; const int old_name_array_len = oldsdna->names_array_len[old_name_nr]; const int min_name_array_len = MIN2(new_name_array_len, old_name_array_len); if (ispointer(name)) { /* handle pointer or functionpointer */ cast_pointer( newsdna->pointer_size, oldsdna->pointer_size, min_name_array_len, curdata, olddata); } else if (strcmp(type, otype) == 0) { /* type equal */ /* size of single old array element */ mul = len / old_name_array_len; /* smaller of sizes of old and new arrays */ mul *= min_name_array_len; memcpy(curdata, olddata, mul); if (old_name_array_len > new_name_array_len && strcmp(type, "char") == 0) { /* string had to be truncated, ensure it's still null-terminated */ curdata[mul - 1] = '\0'; } } else { cast_elem(type, otype, min_name_array_len, curdata, olddata); } return; } } olddata += len; } }
/** * Converts the contents of a single field of a struct, of a non-struct type, * from oldsdna to newsdna format. * * \param newsdna: SDNA of current Blender * \param oldsdna: SDNA of Blender that saved file * \param type: current field type name * \param new_name_nr: current field name number. * \param curdata: put field data converted to newsdna here * \param old: pointer to struct info in oldsdna * \param olddata: struct contents laid out according to oldsdna */
Converts the contents of a single field of a struct, of a non-struct type, from oldsdna to newsdna format. \param newsdna: SDNA of current Blender \param oldsdna: SDNA of Blender that saved file \param type: current field type name \param new_name_nr: current field name number. \param curdata: put field data converted to newsdna here \param old: pointer to struct info in oldsdna \param olddata: struct contents laid out according to oldsdna
[ "Converts", "the", "contents", "of", "a", "single", "field", "of", "a", "struct", "of", "a", "non", "-", "struct", "type", "from", "oldsdna", "to", "newsdna", "format", ".", "\\", "param", "newsdna", ":", "SDNA", "of", "current", "Blender", "\\", "param", "oldsdna", ":", "SDNA", "of", "Blender", "that", "saved", "file", "\\", "param", "type", ":", "current", "field", "type", "name", "\\", "param", "new_name_nr", ":", "current", "field", "name", "number", ".", "\\", "param", "curdata", ":", "put", "field", "data", "converted", "to", "newsdna", "here", "\\", "param", "old", ":", "pointer", "to", "struct", "info", "in", "oldsdna", "\\", "param", "olddata", ":", "struct", "contents", "laid", "out", "according", "to", "oldsdna" ]
static void reconstruct_elem(const SDNA *newsdna, const SDNA *oldsdna, const char *type, const int new_name_nr, char *curdata, const short *old, const char *olddata) { int a, elemcount, len, countpos, mul; const char *otype, *oname, *cp; const char *name = newsdna->names[new_name_nr]; cp = name; countpos = 0; while (*cp && *cp != '[') { cp++; countpos++; } if (*cp != '[') { countpos = 0; } elemcount = old[1]; old += 2; for (a = 0; a < elemcount; a++, old += 2) { const int old_name_nr = old[1]; otype = oldsdna->types[old[0]]; oname = oldsdna->names[old[1]]; len = DNA_elem_size_nr(oldsdna, old[0], old[1]); if (strcmp(name, oname) == 0) { if (ispointer(name)) { cast_pointer(newsdna->pointer_size, oldsdna->pointer_size, newsdna->names_array_len[new_name_nr], curdata, olddata); } else if (strcmp(type, otype) == 0) { memcpy(curdata, olddata, len); } else { cast_elem(type, otype, newsdna->names_array_len[new_name_nr], curdata, olddata); } return; } else if (countpos != 0) { if (oname[countpos] == '[' && strncmp(name, oname, countpos) == 0) { const int new_name_array_len = newsdna->names_array_len[new_name_nr]; const int old_name_array_len = oldsdna->names_array_len[old_name_nr]; const int min_name_array_len = MIN2(new_name_array_len, old_name_array_len); if (ispointer(name)) { cast_pointer( newsdna->pointer_size, oldsdna->pointer_size, min_name_array_len, curdata, olddata); } else if (strcmp(type, otype) == 0) { mul = len / old_name_array_len; mul *= min_name_array_len; memcpy(curdata, olddata, mul); if (old_name_array_len > new_name_array_len && strcmp(type, "char") == 0) { curdata[mul - 1] = '\0'; } } else { cast_elem(type, otype, min_name_array_len, curdata, olddata); } return; } } olddata += len; } }
[ "static", "void", "reconstruct_elem", "(", "const", "SDNA", "*", "newsdna", ",", "const", "SDNA", "*", "oldsdna", ",", "const", "char", "*", "type", ",", "const", "int", "new_name_nr", ",", "char", "*", "curdata", ",", "const", "short", "*", "old", ",", "const", "char", "*", "olddata", ")", "{", "int", "a", ",", "elemcount", ",", "len", ",", "countpos", ",", "mul", ";", "const", "char", "*", "otype", ",", "*", "oname", ",", "*", "cp", ";", "const", "char", "*", "name", "=", "newsdna", "->", "names", "[", "new_name_nr", "]", ";", "cp", "=", "name", ";", "countpos", "=", "0", ";", "while", "(", "*", "cp", "&&", "*", "cp", "!=", "'", "'", ")", "{", "cp", "++", ";", "countpos", "++", ";", "}", "if", "(", "*", "cp", "!=", "'", "'", ")", "{", "countpos", "=", "0", ";", "}", "elemcount", "=", "old", "[", "1", "]", ";", "old", "+=", "2", ";", "for", "(", "a", "=", "0", ";", "a", "<", "elemcount", ";", "a", "++", ",", "old", "+=", "2", ")", "{", "const", "int", "old_name_nr", "=", "old", "[", "1", "]", ";", "otype", "=", "oldsdna", "->", "types", "[", "old", "[", "0", "]", "]", ";", "oname", "=", "oldsdna", "->", "names", "[", "old", "[", "1", "]", "]", ";", "len", "=", "DNA_elem_size_nr", "(", "oldsdna", ",", "old", "[", "0", "]", ",", "old", "[", "1", "]", ")", ";", "if", "(", "strcmp", "(", "name", ",", "oname", ")", "==", "0", ")", "{", "if", "(", "ispointer", "(", "name", ")", ")", "{", "cast_pointer", "(", "newsdna", "->", "pointer_size", ",", "oldsdna", "->", "pointer_size", ",", "newsdna", "->", "names_array_len", "[", "new_name_nr", "]", ",", "curdata", ",", "olddata", ")", ";", "}", "else", "if", "(", "strcmp", "(", "type", ",", "otype", ")", "==", "0", ")", "{", "memcpy", "(", "curdata", ",", "olddata", ",", "len", ")", ";", "}", "else", "{", "cast_elem", "(", "type", ",", "otype", ",", "newsdna", "->", "names_array_len", "[", "new_name_nr", "]", ",", "curdata", ",", "olddata", ")", ";", "}", "return", ";", "}", "else", "if", "(", "countpos", "!=", "0", ")", "{", "if", "(", "oname", "[", "countpos", "]", "==", "'", "'", "&&", "strncmp", "(", "name", ",", "oname", ",", "countpos", ")", "==", "0", ")", "{", "const", "int", "new_name_array_len", "=", "newsdna", "->", "names_array_len", "[", "new_name_nr", "]", ";", "const", "int", "old_name_array_len", "=", "oldsdna", "->", "names_array_len", "[", "old_name_nr", "]", ";", "const", "int", "min_name_array_len", "=", "MIN2", "(", "new_name_array_len", ",", "old_name_array_len", ")", ";", "if", "(", "ispointer", "(", "name", ")", ")", "{", "cast_pointer", "(", "newsdna", "->", "pointer_size", ",", "oldsdna", "->", "pointer_size", ",", "min_name_array_len", ",", "curdata", ",", "olddata", ")", ";", "}", "else", "if", "(", "strcmp", "(", "type", ",", "otype", ")", "==", "0", ")", "{", "mul", "=", "len", "/", "old_name_array_len", ";", "mul", "*=", "min_name_array_len", ";", "memcpy", "(", "curdata", ",", "olddata", ",", "mul", ")", ";", "if", "(", "old_name_array_len", ">", "new_name_array_len", "&&", "strcmp", "(", "type", ",", "\"", "\"", ")", "==", "0", ")", "{", "curdata", "[", "mul", "-", "1", "]", "=", "'", "\\0", "'", ";", "}", "}", "else", "{", "cast_elem", "(", "type", ",", "otype", ",", "min_name_array_len", ",", "curdata", ",", "olddata", ")", ";", "}", "return", ";", "}", "}", "olddata", "+=", "len", ";", "}", "}" ]
Converts the contents of a single field of a struct, of a non-struct type, from oldsdna to newsdna format.
[ "Converts", "the", "contents", "of", "a", "single", "field", "of", "a", "struct", "of", "a", "non", "-", "struct", "type", "from", "oldsdna", "to", "newsdna", "format", "." ]
[ "/* rules: test for NAME:\n * - name equal:\n * - cast type\n * - name partially equal (array differs)\n * - type equal: memcpy\n * - type cast (per element).\n * (nzc 2-4-2001 I want the 'unsigned' bit to be parsed as well. Where\n * can I force this?)\n */", "/* is 'name' an array? */", "/* in old is the old struct */", "/* name equal */", "/* pointer of functionpointer afhandelen */", "/* type equal */", "/* name is an array */", "/* basis equal */", "/* handle pointer or functionpointer */", "/* type equal */", "/* size of single old array element */", "/* smaller of sizes of old and new arrays */", "/* string had to be truncated, ensure it's still null-terminated */" ]
[ { "param": "newsdna", "type": "SDNA" }, { "param": "oldsdna", "type": "SDNA" }, { "param": "type", "type": "char" }, { "param": "new_name_nr", "type": "int" }, { "param": "curdata", "type": "char" }, { "param": "old", "type": "short" }, { "param": "olddata", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "newsdna", "type": "SDNA", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "oldsdna", "type": "SDNA", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "type", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "new_name_nr", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "curdata", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "old", "type": "short", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "olddata", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b3095c792565b23ef59a119852de3a03d64cff7
DemonRem/blender
source/blender/makesdna/intern/dna_genfile.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
reconstruct_struct
void
static void reconstruct_struct(const SDNA *newsdna, const SDNA *oldsdna, const char *compflags, int oldSDNAnr, const char *data, int curSDNAnr, char *cur) { /* Recursive! * Per element from cur_struct, read data from old_struct. * If element is a struct, call recursive. */ int a, elemcount, elen, eleno, mul, mulo, firststructtypenr; const short *spo, *spc, *sppo; const char *type; const char *cpo; char *cpc; const char *name; unsigned int oldsdna_index_last = UINT_MAX; unsigned int cursdna_index_last = UINT_MAX; if (oldSDNAnr == -1) { return; } if (curSDNAnr == -1) { return; } if (compflags[oldSDNAnr] == SDNA_CMP_EQUAL) { /* if recursive: test for equal */ spo = oldsdna->structs[oldSDNAnr]; elen = oldsdna->types_size[spo[0]]; memcpy(cur, data, elen); return; } firststructtypenr = *(newsdna->structs[0]); spo = oldsdna->structs[oldSDNAnr]; spc = newsdna->structs[curSDNAnr]; elemcount = spc[1]; spc += 2; cpc = cur; for (a = 0; a < elemcount; a++, spc += 2) { /* convert each field */ type = newsdna->types[spc[0]]; name = newsdna->names[spc[1]]; elen = DNA_elem_size_nr(newsdna, spc[0], spc[1]); /* Skip pad bytes which must start with '_pad', see makesdna.c 'is_name_legal'. * for exact rules. Note that if we fail to skip a pad byte it's harmless, * this just avoids unnecessary reconstruction. */ if (name[0] == '_' || (name[0] == '*' && name[1] == '_')) { cpc += elen; } else if (spc[0] >= firststructtypenr && !ispointer(name)) { /* struct field type */ /* where does the old struct data start (and is there an old one?) */ cpo = (char *)find_elem(oldsdna, type, name, spo, data, &sppo); if (cpo) { oldSDNAnr = DNA_struct_find_nr_ex(oldsdna, type, &oldsdna_index_last); curSDNAnr = DNA_struct_find_nr_ex(newsdna, type, &cursdna_index_last); /* array! */ mul = newsdna->names_array_len[spc[1]]; mulo = oldsdna->names_array_len[sppo[1]]; eleno = DNA_elem_size_nr(oldsdna, sppo[0], sppo[1]); elen /= mul; eleno /= mulo; while (mul--) { reconstruct_struct(newsdna, oldsdna, compflags, oldSDNAnr, cpo, curSDNAnr, cpc); cpo += eleno; cpc += elen; /* new struct array larger than old */ mulo--; if (mulo <= 0) { break; } } } else { cpc += elen; /* skip field no longer present */ } } else { /* non-struct field type */ reconstruct_elem(newsdna, oldsdna, type, spc[1], cpc, spo, data); cpc += elen; } } }
/** * Converts the contents of an entire struct from oldsdna to newsdna format. * * \param newsdna: SDNA of current Blender * \param oldsdna: SDNA of Blender that saved file * \param compflags: * * Result from DNA_struct_get_compareflags to avoid needless conversions. * \param oldSDNAnr: Index of old struct definition in oldsdna * \param data: Struct contents laid out according to oldsdna * \param curSDNAnr: Index of current struct definition in newsdna * \param cur: Where to put converted struct contents */
Converts the contents of an entire struct from oldsdna to newsdna format. \param newsdna: SDNA of current Blender \param oldsdna: SDNA of Blender that saved file \param compflags. Result from DNA_struct_get_compareflags to avoid needless conversions. \param oldSDNAnr: Index of old struct definition in oldsdna \param data: Struct contents laid out according to oldsdna \param curSDNAnr: Index of current struct definition in newsdna \param cur: Where to put converted struct contents
[ "Converts", "the", "contents", "of", "an", "entire", "struct", "from", "oldsdna", "to", "newsdna", "format", ".", "\\", "param", "newsdna", ":", "SDNA", "of", "current", "Blender", "\\", "param", "oldsdna", ":", "SDNA", "of", "Blender", "that", "saved", "file", "\\", "param", "compflags", ".", "Result", "from", "DNA_struct_get_compareflags", "to", "avoid", "needless", "conversions", ".", "\\", "param", "oldSDNAnr", ":", "Index", "of", "old", "struct", "definition", "in", "oldsdna", "\\", "param", "data", ":", "Struct", "contents", "laid", "out", "according", "to", "oldsdna", "\\", "param", "curSDNAnr", ":", "Index", "of", "current", "struct", "definition", "in", "newsdna", "\\", "param", "cur", ":", "Where", "to", "put", "converted", "struct", "contents" ]
static void reconstruct_struct(const SDNA *newsdna, const SDNA *oldsdna, const char *compflags, int oldSDNAnr, const char *data, int curSDNAnr, char *cur) { int a, elemcount, elen, eleno, mul, mulo, firststructtypenr; const short *spo, *spc, *sppo; const char *type; const char *cpo; char *cpc; const char *name; unsigned int oldsdna_index_last = UINT_MAX; unsigned int cursdna_index_last = UINT_MAX; if (oldSDNAnr == -1) { return; } if (curSDNAnr == -1) { return; } if (compflags[oldSDNAnr] == SDNA_CMP_EQUAL) { spo = oldsdna->structs[oldSDNAnr]; elen = oldsdna->types_size[spo[0]]; memcpy(cur, data, elen); return; } firststructtypenr = *(newsdna->structs[0]); spo = oldsdna->structs[oldSDNAnr]; spc = newsdna->structs[curSDNAnr]; elemcount = spc[1]; spc += 2; cpc = cur; for (a = 0; a < elemcount; a++, spc += 2) { type = newsdna->types[spc[0]]; name = newsdna->names[spc[1]]; elen = DNA_elem_size_nr(newsdna, spc[0], spc[1]); if (name[0] == '_' || (name[0] == '*' && name[1] == '_')) { cpc += elen; } else if (spc[0] >= firststructtypenr && !ispointer(name)) { cpo = (char *)find_elem(oldsdna, type, name, spo, data, &sppo); if (cpo) { oldSDNAnr = DNA_struct_find_nr_ex(oldsdna, type, &oldsdna_index_last); curSDNAnr = DNA_struct_find_nr_ex(newsdna, type, &cursdna_index_last); mul = newsdna->names_array_len[spc[1]]; mulo = oldsdna->names_array_len[sppo[1]]; eleno = DNA_elem_size_nr(oldsdna, sppo[0], sppo[1]); elen /= mul; eleno /= mulo; while (mul--) { reconstruct_struct(newsdna, oldsdna, compflags, oldSDNAnr, cpo, curSDNAnr, cpc); cpo += eleno; cpc += elen; mulo--; if (mulo <= 0) { break; } } } else { cpc += elen; } } else { reconstruct_elem(newsdna, oldsdna, type, spc[1], cpc, spo, data); cpc += elen; } } }
[ "static", "void", "reconstruct_struct", "(", "const", "SDNA", "*", "newsdna", ",", "const", "SDNA", "*", "oldsdna", ",", "const", "char", "*", "compflags", ",", "int", "oldSDNAnr", ",", "const", "char", "*", "data", ",", "int", "curSDNAnr", ",", "char", "*", "cur", ")", "{", "int", "a", ",", "elemcount", ",", "elen", ",", "eleno", ",", "mul", ",", "mulo", ",", "firststructtypenr", ";", "const", "short", "*", "spo", ",", "*", "spc", ",", "*", "sppo", ";", "const", "char", "*", "type", ";", "const", "char", "*", "cpo", ";", "char", "*", "cpc", ";", "const", "char", "*", "name", ";", "unsigned", "int", "oldsdna_index_last", "=", "UINT_MAX", ";", "unsigned", "int", "cursdna_index_last", "=", "UINT_MAX", ";", "if", "(", "oldSDNAnr", "==", "-1", ")", "{", "return", ";", "}", "if", "(", "curSDNAnr", "==", "-1", ")", "{", "return", ";", "}", "if", "(", "compflags", "[", "oldSDNAnr", "]", "==", "SDNA_CMP_EQUAL", ")", "{", "spo", "=", "oldsdna", "->", "structs", "[", "oldSDNAnr", "]", ";", "elen", "=", "oldsdna", "->", "types_size", "[", "spo", "[", "0", "]", "]", ";", "memcpy", "(", "cur", ",", "data", ",", "elen", ")", ";", "return", ";", "}", "firststructtypenr", "=", "*", "(", "newsdna", "->", "structs", "[", "0", "]", ")", ";", "spo", "=", "oldsdna", "->", "structs", "[", "oldSDNAnr", "]", ";", "spc", "=", "newsdna", "->", "structs", "[", "curSDNAnr", "]", ";", "elemcount", "=", "spc", "[", "1", "]", ";", "spc", "+=", "2", ";", "cpc", "=", "cur", ";", "for", "(", "a", "=", "0", ";", "a", "<", "elemcount", ";", "a", "++", ",", "spc", "+=", "2", ")", "{", "type", "=", "newsdna", "->", "types", "[", "spc", "[", "0", "]", "]", ";", "name", "=", "newsdna", "->", "names", "[", "spc", "[", "1", "]", "]", ";", "elen", "=", "DNA_elem_size_nr", "(", "newsdna", ",", "spc", "[", "0", "]", ",", "spc", "[", "1", "]", ")", ";", "if", "(", "name", "[", "0", "]", "==", "'", "'", "||", "(", "name", "[", "0", "]", "==", "'", "'", "&&", "name", "[", "1", "]", "==", "'", "'", ")", ")", "{", "cpc", "+=", "elen", ";", "}", "else", "if", "(", "spc", "[", "0", "]", ">=", "firststructtypenr", "&&", "!", "ispointer", "(", "name", ")", ")", "{", "cpo", "=", "(", "char", "*", ")", "find_elem", "(", "oldsdna", ",", "type", ",", "name", ",", "spo", ",", "data", ",", "&", "sppo", ")", ";", "if", "(", "cpo", ")", "{", "oldSDNAnr", "=", "DNA_struct_find_nr_ex", "(", "oldsdna", ",", "type", ",", "&", "oldsdna_index_last", ")", ";", "curSDNAnr", "=", "DNA_struct_find_nr_ex", "(", "newsdna", ",", "type", ",", "&", "cursdna_index_last", ")", ";", "mul", "=", "newsdna", "->", "names_array_len", "[", "spc", "[", "1", "]", "]", ";", "mulo", "=", "oldsdna", "->", "names_array_len", "[", "sppo", "[", "1", "]", "]", ";", "eleno", "=", "DNA_elem_size_nr", "(", "oldsdna", ",", "sppo", "[", "0", "]", ",", "sppo", "[", "1", "]", ")", ";", "elen", "/=", "mul", ";", "eleno", "/=", "mulo", ";", "while", "(", "mul", "--", ")", "{", "reconstruct_struct", "(", "newsdna", ",", "oldsdna", ",", "compflags", ",", "oldSDNAnr", ",", "cpo", ",", "curSDNAnr", ",", "cpc", ")", ";", "cpo", "+=", "eleno", ";", "cpc", "+=", "elen", ";", "mulo", "--", ";", "if", "(", "mulo", "<=", "0", ")", "{", "break", ";", "}", "}", "}", "else", "{", "cpc", "+=", "elen", ";", "}", "}", "else", "{", "reconstruct_elem", "(", "newsdna", ",", "oldsdna", ",", "type", ",", "spc", "[", "1", "]", ",", "cpc", ",", "spo", ",", "data", ")", ";", "cpc", "+=", "elen", ";", "}", "}", "}" ]
Converts the contents of an entire struct from oldsdna to newsdna format.
[ "Converts", "the", "contents", "of", "an", "entire", "struct", "from", "oldsdna", "to", "newsdna", "format", "." ]
[ "/* Recursive!\n * Per element from cur_struct, read data from old_struct.\n * If element is a struct, call recursive.\n */", "/* if recursive: test for equal */", "/* convert each field */", "/* Skip pad bytes which must start with '_pad', see makesdna.c 'is_name_legal'.\n * for exact rules. Note that if we fail to skip a pad byte it's harmless,\n * this just avoids unnecessary reconstruction. */", "/* struct field type */", "/* where does the old struct data start (and is there an old one?) */", "/* array! */", "/* new struct array larger than old */", "/* skip field no longer present */", "/* non-struct field type */" ]
[ { "param": "newsdna", "type": "SDNA" }, { "param": "oldsdna", "type": "SDNA" }, { "param": "compflags", "type": "char" }, { "param": "oldSDNAnr", "type": "int" }, { "param": "data", "type": "char" }, { "param": "curSDNAnr", "type": "int" }, { "param": "cur", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "newsdna", "type": "SDNA", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "oldsdna", "type": "SDNA", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "compflags", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "oldSDNAnr", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "curSDNAnr", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "cur", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b3095c792565b23ef59a119852de3a03d64cff7
DemonRem/blender
source/blender/makesdna/intern/dna_genfile.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
DNA_struct_switch_endian
void
void DNA_struct_switch_endian(const SDNA *oldsdna, int oldSDNAnr, char *data) { /* Recursive! * If element is a struct, call recursive. */ int a, mul, elemcount, elen, elena, firststructtypenr; const short *spo, *spc; char *cur; const char *type, *name; unsigned int oldsdna_index_last = UINT_MAX; if (oldSDNAnr == -1) { return; } firststructtypenr = *(oldsdna->structs[0]); spo = spc = oldsdna->structs[oldSDNAnr]; elemcount = spo[1]; spc += 2; cur = data; for (a = 0; a < elemcount; a++, spc += 2) { type = oldsdna->types[spc[0]]; name = oldsdna->names[spc[1]]; const int old_name_array_len = oldsdna->names_array_len[spc[1]]; /* DNA_elem_size_nr = including arraysize */ elen = DNA_elem_size_nr(oldsdna, spc[0], spc[1]); /* test: is type a struct? */ if (spc[0] >= firststructtypenr && !ispointer(name)) { /* struct field type */ /* where does the old data start (is there one?) */ char *cpo = (char *)find_elem(oldsdna, type, name, spo, data, NULL); if (cpo) { oldSDNAnr = DNA_struct_find_nr_ex(oldsdna, type, &oldsdna_index_last); mul = old_name_array_len; elena = elen / mul; while (mul--) { DNA_struct_switch_endian(oldsdna, oldSDNAnr, cpo); cpo += elena; } } } else { /* non-struct field type */ if (ispointer(name)) { if (oldsdna->pointer_size == 8) { BLI_endian_switch_int64_array((int64_t *)cur, old_name_array_len); } } else { if (ELEM(spc[0], SDNA_TYPE_SHORT, SDNA_TYPE_USHORT)) { /* exception: variable called blocktype: derived from ID_ */ bool skip = false; if (name[0] == 'b' && name[1] == 'l') { if (strcmp(name, "blocktype") == 0) { skip = true; } } if (skip == false) { BLI_endian_switch_int16_array((int16_t *)cur, old_name_array_len); } } else if (ELEM(spc[0], SDNA_TYPE_INT, SDNA_TYPE_FLOAT)) { /* note, intentionally ignore long/ulong here these could be 4 or 8 bits, * but turns out we only used for runtime vars and * only once for a struct type that's no longer used. */ BLI_endian_switch_int32_array((int32_t *)cur, old_name_array_len); } else if (ELEM(spc[0], SDNA_TYPE_INT64, SDNA_TYPE_UINT64, SDNA_TYPE_DOUBLE)) { BLI_endian_switch_int64_array((int64_t *)cur, old_name_array_len); } } } cur += elen; } }
/** * Does endian swapping on the fields of a struct value. * * \param oldsdna: SDNA of Blender that saved file * \param oldSDNAnr: Index of struct info within oldsdna * \param data: Struct data */
Does endian swapping on the fields of a struct value. \param oldsdna: SDNA of Blender that saved file \param oldSDNAnr: Index of struct info within oldsdna \param data: Struct data
[ "Does", "endian", "swapping", "on", "the", "fields", "of", "a", "struct", "value", ".", "\\", "param", "oldsdna", ":", "SDNA", "of", "Blender", "that", "saved", "file", "\\", "param", "oldSDNAnr", ":", "Index", "of", "struct", "info", "within", "oldsdna", "\\", "param", "data", ":", "Struct", "data" ]
void DNA_struct_switch_endian(const SDNA *oldsdna, int oldSDNAnr, char *data) { int a, mul, elemcount, elen, elena, firststructtypenr; const short *spo, *spc; char *cur; const char *type, *name; unsigned int oldsdna_index_last = UINT_MAX; if (oldSDNAnr == -1) { return; } firststructtypenr = *(oldsdna->structs[0]); spo = spc = oldsdna->structs[oldSDNAnr]; elemcount = spo[1]; spc += 2; cur = data; for (a = 0; a < elemcount; a++, spc += 2) { type = oldsdna->types[spc[0]]; name = oldsdna->names[spc[1]]; const int old_name_array_len = oldsdna->names_array_len[spc[1]]; elen = DNA_elem_size_nr(oldsdna, spc[0], spc[1]); if (spc[0] >= firststructtypenr && !ispointer(name)) { char *cpo = (char *)find_elem(oldsdna, type, name, spo, data, NULL); if (cpo) { oldSDNAnr = DNA_struct_find_nr_ex(oldsdna, type, &oldsdna_index_last); mul = old_name_array_len; elena = elen / mul; while (mul--) { DNA_struct_switch_endian(oldsdna, oldSDNAnr, cpo); cpo += elena; } } } else { if (ispointer(name)) { if (oldsdna->pointer_size == 8) { BLI_endian_switch_int64_array((int64_t *)cur, old_name_array_len); } } else { if (ELEM(spc[0], SDNA_TYPE_SHORT, SDNA_TYPE_USHORT)) { bool skip = false; if (name[0] == 'b' && name[1] == 'l') { if (strcmp(name, "blocktype") == 0) { skip = true; } } if (skip == false) { BLI_endian_switch_int16_array((int16_t *)cur, old_name_array_len); } } else if (ELEM(spc[0], SDNA_TYPE_INT, SDNA_TYPE_FLOAT)) { BLI_endian_switch_int32_array((int32_t *)cur, old_name_array_len); } else if (ELEM(spc[0], SDNA_TYPE_INT64, SDNA_TYPE_UINT64, SDNA_TYPE_DOUBLE)) { BLI_endian_switch_int64_array((int64_t *)cur, old_name_array_len); } } } cur += elen; } }
[ "void", "DNA_struct_switch_endian", "(", "const", "SDNA", "*", "oldsdna", ",", "int", "oldSDNAnr", ",", "char", "*", "data", ")", "{", "int", "a", ",", "mul", ",", "elemcount", ",", "elen", ",", "elena", ",", "firststructtypenr", ";", "const", "short", "*", "spo", ",", "*", "spc", ";", "char", "*", "cur", ";", "const", "char", "*", "type", ",", "*", "name", ";", "unsigned", "int", "oldsdna_index_last", "=", "UINT_MAX", ";", "if", "(", "oldSDNAnr", "==", "-1", ")", "{", "return", ";", "}", "firststructtypenr", "=", "*", "(", "oldsdna", "->", "structs", "[", "0", "]", ")", ";", "spo", "=", "spc", "=", "oldsdna", "->", "structs", "[", "oldSDNAnr", "]", ";", "elemcount", "=", "spo", "[", "1", "]", ";", "spc", "+=", "2", ";", "cur", "=", "data", ";", "for", "(", "a", "=", "0", ";", "a", "<", "elemcount", ";", "a", "++", ",", "spc", "+=", "2", ")", "{", "type", "=", "oldsdna", "->", "types", "[", "spc", "[", "0", "]", "]", ";", "name", "=", "oldsdna", "->", "names", "[", "spc", "[", "1", "]", "]", ";", "const", "int", "old_name_array_len", "=", "oldsdna", "->", "names_array_len", "[", "spc", "[", "1", "]", "]", ";", "elen", "=", "DNA_elem_size_nr", "(", "oldsdna", ",", "spc", "[", "0", "]", ",", "spc", "[", "1", "]", ")", ";", "if", "(", "spc", "[", "0", "]", ">=", "firststructtypenr", "&&", "!", "ispointer", "(", "name", ")", ")", "{", "char", "*", "cpo", "=", "(", "char", "*", ")", "find_elem", "(", "oldsdna", ",", "type", ",", "name", ",", "spo", ",", "data", ",", "NULL", ")", ";", "if", "(", "cpo", ")", "{", "oldSDNAnr", "=", "DNA_struct_find_nr_ex", "(", "oldsdna", ",", "type", ",", "&", "oldsdna_index_last", ")", ";", "mul", "=", "old_name_array_len", ";", "elena", "=", "elen", "/", "mul", ";", "while", "(", "mul", "--", ")", "{", "DNA_struct_switch_endian", "(", "oldsdna", ",", "oldSDNAnr", ",", "cpo", ")", ";", "cpo", "+=", "elena", ";", "}", "}", "}", "else", "{", "if", "(", "ispointer", "(", "name", ")", ")", "{", "if", "(", "oldsdna", "->", "pointer_size", "==", "8", ")", "{", "BLI_endian_switch_int64_array", "(", "(", "int64_t", "*", ")", "cur", ",", "old_name_array_len", ")", ";", "}", "}", "else", "{", "if", "(", "ELEM", "(", "spc", "[", "0", "]", ",", "SDNA_TYPE_SHORT", ",", "SDNA_TYPE_USHORT", ")", ")", "{", "bool", "skip", "=", "false", ";", "if", "(", "name", "[", "0", "]", "==", "'", "'", "&&", "name", "[", "1", "]", "==", "'", "'", ")", "{", "if", "(", "strcmp", "(", "name", ",", "\"", "\"", ")", "==", "0", ")", "{", "skip", "=", "true", ";", "}", "}", "if", "(", "skip", "==", "false", ")", "{", "BLI_endian_switch_int16_array", "(", "(", "int16_t", "*", ")", "cur", ",", "old_name_array_len", ")", ";", "}", "}", "else", "if", "(", "ELEM", "(", "spc", "[", "0", "]", ",", "SDNA_TYPE_INT", ",", "SDNA_TYPE_FLOAT", ")", ")", "{", "BLI_endian_switch_int32_array", "(", "(", "int32_t", "*", ")", "cur", ",", "old_name_array_len", ")", ";", "}", "else", "if", "(", "ELEM", "(", "spc", "[", "0", "]", ",", "SDNA_TYPE_INT64", ",", "SDNA_TYPE_UINT64", ",", "SDNA_TYPE_DOUBLE", ")", ")", "{", "BLI_endian_switch_int64_array", "(", "(", "int64_t", "*", ")", "cur", ",", "old_name_array_len", ")", ";", "}", "}", "}", "cur", "+=", "elen", ";", "}", "}" ]
Does endian swapping on the fields of a struct value.
[ "Does", "endian", "swapping", "on", "the", "fields", "of", "a", "struct", "value", "." ]
[ "/* Recursive!\n * If element is a struct, call recursive.\n */", "/* DNA_elem_size_nr = including arraysize */", "/* test: is type a struct? */", "/* struct field type */", "/* where does the old data start (is there one?) */", "/* non-struct field type */", "/* exception: variable called blocktype: derived from ID_ */", "/* note, intentionally ignore long/ulong here these could be 4 or 8 bits,\n * but turns out we only used for runtime vars and\n * only once for a struct type that's no longer used. */" ]
[ { "param": "oldsdna", "type": "SDNA" }, { "param": "oldSDNAnr", "type": "int" }, { "param": "data", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "oldsdna", "type": "SDNA", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "oldSDNAnr", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b3095c792565b23ef59a119852de3a03d64cff7
DemonRem/blender
source/blender/makesdna/intern/dna_genfile.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
DNA_struct_reconstruct
void
void *DNA_struct_reconstruct(const SDNA *newsdna, const SDNA *oldsdna, const char *compflags, int oldSDNAnr, int blocks, const void *data) { int a, curSDNAnr, curlen = 0, oldlen; const short *spo, *spc; char *cur, *cpc; const char *cpo; const char *type; /* oldSDNAnr == structnr, we're looking for the corresponding 'cur' number */ spo = oldsdna->structs[oldSDNAnr]; type = oldsdna->types[spo[0]]; oldlen = oldsdna->types_size[spo[0]]; curSDNAnr = DNA_struct_find_nr(newsdna, type); /* init data and alloc */ if (curSDNAnr != -1) { spc = newsdna->structs[curSDNAnr]; curlen = newsdna->types_size[spc[0]]; } if (curlen == 0) { return NULL; } cur = MEM_callocN(blocks * curlen, "reconstruct"); cpc = cur; cpo = data; for (a = 0; a < blocks; a++) { reconstruct_struct(newsdna, oldsdna, compflags, oldSDNAnr, cpo, curSDNAnr, cpc); cpc += curlen; cpo += oldlen; } return cur; }
/** * \param newsdna: SDNA of current Blender * \param oldsdna: SDNA of Blender that saved file * \param compflags: * * Result from DNA_struct_get_compareflags to avoid needless conversions * \param oldSDNAnr: Index of struct info within oldsdna * \param blocks: The number of array elements * \param data: Array of struct data * \return An allocated reconstructed struct */
\param newsdna: SDNA of current Blender \param oldsdna: SDNA of Blender that saved file \param compflags. Result from DNA_struct_get_compareflags to avoid needless conversions \param oldSDNAnr: Index of struct info within oldsdna \param blocks: The number of array elements \param data: Array of struct data \return An allocated reconstructed struct
[ "\\", "param", "newsdna", ":", "SDNA", "of", "current", "Blender", "\\", "param", "oldsdna", ":", "SDNA", "of", "Blender", "that", "saved", "file", "\\", "param", "compflags", ".", "Result", "from", "DNA_struct_get_compareflags", "to", "avoid", "needless", "conversions", "\\", "param", "oldSDNAnr", ":", "Index", "of", "struct", "info", "within", "oldsdna", "\\", "param", "blocks", ":", "The", "number", "of", "array", "elements", "\\", "param", "data", ":", "Array", "of", "struct", "data", "\\", "return", "An", "allocated", "reconstructed", "struct" ]
void *DNA_struct_reconstruct(const SDNA *newsdna, const SDNA *oldsdna, const char *compflags, int oldSDNAnr, int blocks, const void *data) { int a, curSDNAnr, curlen = 0, oldlen; const short *spo, *spc; char *cur, *cpc; const char *cpo; const char *type; spo = oldsdna->structs[oldSDNAnr]; type = oldsdna->types[spo[0]]; oldlen = oldsdna->types_size[spo[0]]; curSDNAnr = DNA_struct_find_nr(newsdna, type); if (curSDNAnr != -1) { spc = newsdna->structs[curSDNAnr]; curlen = newsdna->types_size[spc[0]]; } if (curlen == 0) { return NULL; } cur = MEM_callocN(blocks * curlen, "reconstruct"); cpc = cur; cpo = data; for (a = 0; a < blocks; a++) { reconstruct_struct(newsdna, oldsdna, compflags, oldSDNAnr, cpo, curSDNAnr, cpc); cpc += curlen; cpo += oldlen; } return cur; }
[ "void", "*", "DNA_struct_reconstruct", "(", "const", "SDNA", "*", "newsdna", ",", "const", "SDNA", "*", "oldsdna", ",", "const", "char", "*", "compflags", ",", "int", "oldSDNAnr", ",", "int", "blocks", ",", "const", "void", "*", "data", ")", "{", "int", "a", ",", "curSDNAnr", ",", "curlen", "=", "0", ",", "oldlen", ";", "const", "short", "*", "spo", ",", "*", "spc", ";", "char", "*", "cur", ",", "*", "cpc", ";", "const", "char", "*", "cpo", ";", "const", "char", "*", "type", ";", "spo", "=", "oldsdna", "->", "structs", "[", "oldSDNAnr", "]", ";", "type", "=", "oldsdna", "->", "types", "[", "spo", "[", "0", "]", "]", ";", "oldlen", "=", "oldsdna", "->", "types_size", "[", "spo", "[", "0", "]", "]", ";", "curSDNAnr", "=", "DNA_struct_find_nr", "(", "newsdna", ",", "type", ")", ";", "if", "(", "curSDNAnr", "!=", "-1", ")", "{", "spc", "=", "newsdna", "->", "structs", "[", "curSDNAnr", "]", ";", "curlen", "=", "newsdna", "->", "types_size", "[", "spc", "[", "0", "]", "]", ";", "}", "if", "(", "curlen", "==", "0", ")", "{", "return", "NULL", ";", "}", "cur", "=", "MEM_callocN", "(", "blocks", "*", "curlen", ",", "\"", "\"", ")", ";", "cpc", "=", "cur", ";", "cpo", "=", "data", ";", "for", "(", "a", "=", "0", ";", "a", "<", "blocks", ";", "a", "++", ")", "{", "reconstruct_struct", "(", "newsdna", ",", "oldsdna", ",", "compflags", ",", "oldSDNAnr", ",", "cpo", ",", "curSDNAnr", ",", "cpc", ")", ";", "cpc", "+=", "curlen", ";", "cpo", "+=", "oldlen", ";", "}", "return", "cur", ";", "}" ]
\param newsdna: SDNA of current Blender \param oldsdna: SDNA of Blender that saved file \param compflags:
[ "\\", "param", "newsdna", ":", "SDNA", "of", "current", "Blender", "\\", "param", "oldsdna", ":", "SDNA", "of", "Blender", "that", "saved", "file", "\\", "param", "compflags", ":" ]
[ "/* oldSDNAnr == structnr, we're looking for the corresponding 'cur' number */", "/* init data and alloc */" ]
[ { "param": "newsdna", "type": "SDNA" }, { "param": "oldsdna", "type": "SDNA" }, { "param": "compflags", "type": "char" }, { "param": "oldSDNAnr", "type": "int" }, { "param": "blocks", "type": "int" }, { "param": "data", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "newsdna", "type": "SDNA", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "oldsdna", "type": "SDNA", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "compflags", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "oldSDNAnr", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "blocks", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b3095c792565b23ef59a119852de3a03d64cff7
DemonRem/blender
source/blender/makesdna/intern/dna_genfile.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
DNA_elem_offset
int
int DNA_elem_offset(SDNA *sdna, const char *stype, const char *vartype, const char *name) { const int SDNAnr = DNA_struct_find_nr(sdna, stype); const short *const spo = sdna->structs[SDNAnr]; const char *const cp = find_elem(sdna, vartype, name, spo, NULL, NULL); BLI_assert(SDNAnr != -1); return (int)((intptr_t)cp); }
/** * Returns the offset of the field with the specified name and type within the specified * struct type in sdna. */
Returns the offset of the field with the specified name and type within the specified struct type in sdna.
[ "Returns", "the", "offset", "of", "the", "field", "with", "the", "specified", "name", "and", "type", "within", "the", "specified", "struct", "type", "in", "sdna", "." ]
int DNA_elem_offset(SDNA *sdna, const char *stype, const char *vartype, const char *name) { const int SDNAnr = DNA_struct_find_nr(sdna, stype); const short *const spo = sdna->structs[SDNAnr]; const char *const cp = find_elem(sdna, vartype, name, spo, NULL, NULL); BLI_assert(SDNAnr != -1); return (int)((intptr_t)cp); }
[ "int", "DNA_elem_offset", "(", "SDNA", "*", "sdna", ",", "const", "char", "*", "stype", ",", "const", "char", "*", "vartype", ",", "const", "char", "*", "name", ")", "{", "const", "int", "SDNAnr", "=", "DNA_struct_find_nr", "(", "sdna", ",", "stype", ")", ";", "const", "short", "*", "const", "spo", "=", "sdna", "->", "structs", "[", "SDNAnr", "]", ";", "const", "char", "*", "const", "cp", "=", "find_elem", "(", "sdna", ",", "vartype", ",", "name", ",", "spo", ",", "NULL", ",", "NULL", ")", ";", "BLI_assert", "(", "SDNAnr", "!=", "-1", ")", ";", "return", "(", "int", ")", "(", "(", "intptr_t", ")", "cp", ")", ";", "}" ]
Returns the offset of the field with the specified name and type within the specified struct type in sdna.
[ "Returns", "the", "offset", "of", "the", "field", "with", "the", "specified", "name", "and", "type", "within", "the", "specified", "struct", "type", "in", "sdna", "." ]
[]
[ { "param": "sdna", "type": "SDNA" }, { "param": "stype", "type": "char" }, { "param": "vartype", "type": "char" }, { "param": "name", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "sdna", "type": "SDNA", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "stype", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "vartype", "type": "char", "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": [] }
6b3095c792565b23ef59a119852de3a03d64cff7
DemonRem/blender
source/blender/makesdna/intern/dna_genfile.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
DNA_elem_type_size
int
int DNA_elem_type_size(const eSDNA_Type elem_nr) { /* should contain all enum types */ switch (elem_nr) { case SDNA_TYPE_CHAR: case SDNA_TYPE_UCHAR: return 1; case SDNA_TYPE_SHORT: case SDNA_TYPE_USHORT: return 2; case SDNA_TYPE_INT: case SDNA_TYPE_FLOAT: return 4; case SDNA_TYPE_DOUBLE: case SDNA_TYPE_INT64: case SDNA_TYPE_UINT64: return 8; } /* weak */ return 8; }
/** * Returns the size in bytes of a primitive type. */
Returns the size in bytes of a primitive type.
[ "Returns", "the", "size", "in", "bytes", "of", "a", "primitive", "type", "." ]
int DNA_elem_type_size(const eSDNA_Type elem_nr) { switch (elem_nr) { case SDNA_TYPE_CHAR: case SDNA_TYPE_UCHAR: return 1; case SDNA_TYPE_SHORT: case SDNA_TYPE_USHORT: return 2; case SDNA_TYPE_INT: case SDNA_TYPE_FLOAT: return 4; case SDNA_TYPE_DOUBLE: case SDNA_TYPE_INT64: case SDNA_TYPE_UINT64: return 8; } return 8; }
[ "int", "DNA_elem_type_size", "(", "const", "eSDNA_Type", "elem_nr", ")", "{", "switch", "(", "elem_nr", ")", "{", "case", "SDNA_TYPE_CHAR", ":", "case", "SDNA_TYPE_UCHAR", ":", "return", "1", ";", "case", "SDNA_TYPE_SHORT", ":", "case", "SDNA_TYPE_USHORT", ":", "return", "2", ";", "case", "SDNA_TYPE_INT", ":", "case", "SDNA_TYPE_FLOAT", ":", "return", "4", ";", "case", "SDNA_TYPE_DOUBLE", ":", "case", "SDNA_TYPE_INT64", ":", "case", "SDNA_TYPE_UINT64", ":", "return", "8", ";", "}", "return", "8", ";", "}" ]
Returns the size in bytes of a primitive type.
[ "Returns", "the", "size", "in", "bytes", "of", "a", "primitive", "type", "." ]
[ "/* should contain all enum types */", "/* weak */" ]
[ { "param": "elem_nr", "type": "eSDNA_Type" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "elem_nr", "type": "eSDNA_Type", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b3095c792565b23ef59a119852de3a03d64cff7
DemonRem/blender
source/blender/makesdna/intern/dna_genfile.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
DNA_sdna_patch_struct_member_nr
bool
static bool DNA_sdna_patch_struct_member_nr(SDNA *sdna, const int struct_name_nr, const char *elem_old, const char *elem_new) { /* These names aren't handled here (it's not used). * Ensure they are never used or we get out of sync arrays. */ BLI_assert(sdna->alias.names == NULL); const int elem_old_len = strlen(elem_old); const int elem_new_len = strlen(elem_new); BLI_assert(elem_new != NULL); short *sp = sdna->structs[struct_name_nr]; for (int elem_index = sp[1]; elem_index > 0; elem_index--, sp += 2) { const char *elem_old_full = sdna->names[sp[1]]; /* Start & end offsets in 'elem_old_full'. */ uint elem_old_full_offset_start; if (DNA_elem_id_match(elem_old, elem_old_len, elem_old_full, &elem_old_full_offset_start)) { if (sdna->mem_arena == NULL) { sdna->mem_arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__); } const char *elem_new_full = DNA_elem_id_rename(sdna->mem_arena, elem_old, elem_old_len, elem_new, elem_new_len, elem_old_full, strlen(elem_old_full), elem_old_full_offset_start); if (sdna->names_len == sdna->names_len_alloc) { sdna->names_len_alloc += 64; sdna->names = MEM_recallocN((void *)sdna->names, sizeof(*sdna->names) * sdna->names_len_alloc); sdna->names_array_len = MEM_recallocN( (void *)sdna->names_array_len, sizeof(*sdna->names_array_len) * sdna->names_len_alloc); } const short name_nr_prev = sp[1]; sp[1] = sdna->names_len++; sdna->names[sp[1]] = elem_new_full; sdna->names_array_len[sp[1]] = sdna->names_array_len[name_nr_prev]; return true; } } return false; }
/* Make public if called often with same struct (avoid duplicate look-ups). */
Make public if called often with same struct (avoid duplicate look-ups).
[ "Make", "public", "if", "called", "often", "with", "same", "struct", "(", "avoid", "duplicate", "look", "-", "ups", ")", "." ]
static bool DNA_sdna_patch_struct_member_nr(SDNA *sdna, const int struct_name_nr, const char *elem_old, const char *elem_new) { BLI_assert(sdna->alias.names == NULL); const int elem_old_len = strlen(elem_old); const int elem_new_len = strlen(elem_new); BLI_assert(elem_new != NULL); short *sp = sdna->structs[struct_name_nr]; for (int elem_index = sp[1]; elem_index > 0; elem_index--, sp += 2) { const char *elem_old_full = sdna->names[sp[1]]; uint elem_old_full_offset_start; if (DNA_elem_id_match(elem_old, elem_old_len, elem_old_full, &elem_old_full_offset_start)) { if (sdna->mem_arena == NULL) { sdna->mem_arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__); } const char *elem_new_full = DNA_elem_id_rename(sdna->mem_arena, elem_old, elem_old_len, elem_new, elem_new_len, elem_old_full, strlen(elem_old_full), elem_old_full_offset_start); if (sdna->names_len == sdna->names_len_alloc) { sdna->names_len_alloc += 64; sdna->names = MEM_recallocN((void *)sdna->names, sizeof(*sdna->names) * sdna->names_len_alloc); sdna->names_array_len = MEM_recallocN( (void *)sdna->names_array_len, sizeof(*sdna->names_array_len) * sdna->names_len_alloc); } const short name_nr_prev = sp[1]; sp[1] = sdna->names_len++; sdna->names[sp[1]] = elem_new_full; sdna->names_array_len[sp[1]] = sdna->names_array_len[name_nr_prev]; return true; } } return false; }
[ "static", "bool", "DNA_sdna_patch_struct_member_nr", "(", "SDNA", "*", "sdna", ",", "const", "int", "struct_name_nr", ",", "const", "char", "*", "elem_old", ",", "const", "char", "*", "elem_new", ")", "{", "BLI_assert", "(", "sdna", "->", "alias", ".", "names", "==", "NULL", ")", ";", "const", "int", "elem_old_len", "=", "strlen", "(", "elem_old", ")", ";", "const", "int", "elem_new_len", "=", "strlen", "(", "elem_new", ")", ";", "BLI_assert", "(", "elem_new", "!=", "NULL", ")", ";", "short", "*", "sp", "=", "sdna", "->", "structs", "[", "struct_name_nr", "]", ";", "for", "(", "int", "elem_index", "=", "sp", "[", "1", "]", ";", "elem_index", ">", "0", ";", "elem_index", "--", ",", "sp", "+=", "2", ")", "{", "const", "char", "*", "elem_old_full", "=", "sdna", "->", "names", "[", "sp", "[", "1", "]", "]", ";", "uint", "elem_old_full_offset_start", ";", "if", "(", "DNA_elem_id_match", "(", "elem_old", ",", "elem_old_len", ",", "elem_old_full", ",", "&", "elem_old_full_offset_start", ")", ")", "{", "if", "(", "sdna", "->", "mem_arena", "==", "NULL", ")", "{", "sdna", "->", "mem_arena", "=", "BLI_memarena_new", "(", "BLI_MEMARENA_STD_BUFSIZE", ",", "__func__", ")", ";", "}", "const", "char", "*", "elem_new_full", "=", "DNA_elem_id_rename", "(", "sdna", "->", "mem_arena", ",", "elem_old", ",", "elem_old_len", ",", "elem_new", ",", "elem_new_len", ",", "elem_old_full", ",", "strlen", "(", "elem_old_full", ")", ",", "elem_old_full_offset_start", ")", ";", "if", "(", "sdna", "->", "names_len", "==", "sdna", "->", "names_len_alloc", ")", "{", "sdna", "->", "names_len_alloc", "+=", "64", ";", "sdna", "->", "names", "=", "MEM_recallocN", "(", "(", "void", "*", ")", "sdna", "->", "names", ",", "sizeof", "(", "*", "sdna", "->", "names", ")", "*", "sdna", "->", "names_len_alloc", ")", ";", "sdna", "->", "names_array_len", "=", "MEM_recallocN", "(", "(", "void", "*", ")", "sdna", "->", "names_array_len", ",", "sizeof", "(", "*", "sdna", "->", "names_array_len", ")", "*", "sdna", "->", "names_len_alloc", ")", ";", "}", "const", "short", "name_nr_prev", "=", "sp", "[", "1", "]", ";", "sp", "[", "1", "]", "=", "sdna", "->", "names_len", "++", ";", "sdna", "->", "names", "[", "sp", "[", "1", "]", "]", "=", "elem_new_full", ";", "sdna", "->", "names_array_len", "[", "sp", "[", "1", "]", "]", "=", "sdna", "->", "names_array_len", "[", "name_nr_prev", "]", ";", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Make public if called often with same struct (avoid duplicate look-ups).
[ "Make", "public", "if", "called", "often", "with", "same", "struct", "(", "avoid", "duplicate", "look", "-", "ups", ")", "." ]
[ "/* These names aren't handled here (it's not used).\n * Ensure they are never used or we get out of sync arrays. */", "/* Start & end offsets in 'elem_old_full'. */" ]
[ { "param": "sdna", "type": "SDNA" }, { "param": "struct_name_nr", "type": "int" }, { "param": "elem_old", "type": "char" }, { "param": "elem_new", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "sdna", "type": "SDNA", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "struct_name_nr", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "elem_old", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "elem_new", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b3095c792565b23ef59a119852de3a03d64cff7
DemonRem/blender
source/blender/makesdna/intern/dna_genfile.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
DNA_sdna_patch_struct_member
bool
bool DNA_sdna_patch_struct_member(SDNA *sdna, const char *struct_name, const char *elem_old, const char *elem_new) { const int struct_name_nr = DNA_struct_find_nr(sdna, struct_name); if (struct_name_nr != -1) { return DNA_sdna_patch_struct_member_nr(sdna, struct_name_nr, elem_old, elem_new); } return false; }
/** * Replace \a elem_old with \a elem_new for struct \a struct_name * handles search & replace, maintaining surrounding non-identifier characters * such as pointer & array size. */
Replace \a elem_old with \a elem_new for struct \a struct_name handles search & replace, maintaining surrounding non-identifier characters such as pointer & array size.
[ "Replace", "\\", "a", "elem_old", "with", "\\", "a", "elem_new", "for", "struct", "\\", "a", "struct_name", "handles", "search", "&", "replace", "maintaining", "surrounding", "non", "-", "identifier", "characters", "such", "as", "pointer", "&", "array", "size", "." ]
bool DNA_sdna_patch_struct_member(SDNA *sdna, const char *struct_name, const char *elem_old, const char *elem_new) { const int struct_name_nr = DNA_struct_find_nr(sdna, struct_name); if (struct_name_nr != -1) { return DNA_sdna_patch_struct_member_nr(sdna, struct_name_nr, elem_old, elem_new); } return false; }
[ "bool", "DNA_sdna_patch_struct_member", "(", "SDNA", "*", "sdna", ",", "const", "char", "*", "struct_name", ",", "const", "char", "*", "elem_old", ",", "const", "char", "*", "elem_new", ")", "{", "const", "int", "struct_name_nr", "=", "DNA_struct_find_nr", "(", "sdna", ",", "struct_name", ")", ";", "if", "(", "struct_name_nr", "!=", "-1", ")", "{", "return", "DNA_sdna_patch_struct_member_nr", "(", "sdna", ",", "struct_name_nr", ",", "elem_old", ",", "elem_new", ")", ";", "}", "return", "false", ";", "}" ]
Replace \a elem_old with \a elem_new for struct \a struct_name handles search & replace, maintaining surrounding non-identifier characters such as pointer & array size.
[ "Replace", "\\", "a", "elem_old", "with", "\\", "a", "elem_new", "for", "struct", "\\", "a", "struct_name", "handles", "search", "&", "replace", "maintaining", "surrounding", "non", "-", "identifier", "characters", "such", "as", "pointer", "&", "array", "size", "." ]
[]
[ { "param": "sdna", "type": "SDNA" }, { "param": "struct_name", "type": "char" }, { "param": "elem_old", "type": "char" }, { "param": "elem_new", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "sdna", "type": "SDNA", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "struct_name", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "elem_old", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "elem_new", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b3095c792565b23ef59a119852de3a03d64cff7
DemonRem/blender
source/blender/makesdna/intern/dna_genfile.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
sdna_expand_names
void
static void sdna_expand_names(SDNA *sdna) { int names_expand_len = 0; for (int struct_nr = 0; struct_nr < sdna->structs_len; struct_nr++) { const short *sp = sdna->structs[struct_nr]; names_expand_len += sp[1]; } const char **names_expand = MEM_mallocN(sizeof(*names_expand) * names_expand_len, __func__); short *names_array_len_expand = MEM_mallocN(sizeof(*names_array_len_expand) * names_expand_len, __func__); int names_expand_index = 0; for (int struct_nr = 0; struct_nr < sdna->structs_len; struct_nr++) { /* We can't edit this memory 'sdna->structs' points to (readonly datatoc file). */ const short *sp = sdna->structs[struct_nr]; short *sp_expand = BLI_memarena_alloc(sdna->mem_arena, sizeof(short[2]) * (1 + sp[1])); memcpy(sp_expand, sp, sizeof(short[2]) * (1 + sp[1])); sdna->structs[struct_nr] = sp_expand; const int names_len = sp[1]; sp += 2; sp_expand += 2; for (int i = 0; i < names_len; i++, sp += 2, sp_expand += 2) { names_expand[names_expand_index] = sdna->names[sp[1]]; names_array_len_expand[names_expand_index] = sdna->names_array_len[sp[1]]; BLI_assert(names_expand_index < SHRT_MAX); sp_expand[1] = names_expand_index; names_expand_index++; } } MEM_freeN((void *)sdna->names); sdna->names = names_expand; MEM_freeN((void *)sdna->names_array_len); sdna->names_array_len = names_array_len_expand; sdna->names_len = names_expand_len; }
/** * Names are shared between structs which causes problems renaming. * Make sure every struct member gets it's own name so renaming only ever impacts a single struct. * * The resulting SDNA is never written to disk. */
Names are shared between structs which causes problems renaming. Make sure every struct member gets it's own name so renaming only ever impacts a single struct. The resulting SDNA is never written to disk.
[ "Names", "are", "shared", "between", "structs", "which", "causes", "problems", "renaming", ".", "Make", "sure", "every", "struct", "member", "gets", "it", "'", "s", "own", "name", "so", "renaming", "only", "ever", "impacts", "a", "single", "struct", ".", "The", "resulting", "SDNA", "is", "never", "written", "to", "disk", "." ]
static void sdna_expand_names(SDNA *sdna) { int names_expand_len = 0; for (int struct_nr = 0; struct_nr < sdna->structs_len; struct_nr++) { const short *sp = sdna->structs[struct_nr]; names_expand_len += sp[1]; } const char **names_expand = MEM_mallocN(sizeof(*names_expand) * names_expand_len, __func__); short *names_array_len_expand = MEM_mallocN(sizeof(*names_array_len_expand) * names_expand_len, __func__); int names_expand_index = 0; for (int struct_nr = 0; struct_nr < sdna->structs_len; struct_nr++) { const short *sp = sdna->structs[struct_nr]; short *sp_expand = BLI_memarena_alloc(sdna->mem_arena, sizeof(short[2]) * (1 + sp[1])); memcpy(sp_expand, sp, sizeof(short[2]) * (1 + sp[1])); sdna->structs[struct_nr] = sp_expand; const int names_len = sp[1]; sp += 2; sp_expand += 2; for (int i = 0; i < names_len; i++, sp += 2, sp_expand += 2) { names_expand[names_expand_index] = sdna->names[sp[1]]; names_array_len_expand[names_expand_index] = sdna->names_array_len[sp[1]]; BLI_assert(names_expand_index < SHRT_MAX); sp_expand[1] = names_expand_index; names_expand_index++; } } MEM_freeN((void *)sdna->names); sdna->names = names_expand; MEM_freeN((void *)sdna->names_array_len); sdna->names_array_len = names_array_len_expand; sdna->names_len = names_expand_len; }
[ "static", "void", "sdna_expand_names", "(", "SDNA", "*", "sdna", ")", "{", "int", "names_expand_len", "=", "0", ";", "for", "(", "int", "struct_nr", "=", "0", ";", "struct_nr", "<", "sdna", "->", "structs_len", ";", "struct_nr", "++", ")", "{", "const", "short", "*", "sp", "=", "sdna", "->", "structs", "[", "struct_nr", "]", ";", "names_expand_len", "+=", "sp", "[", "1", "]", ";", "}", "const", "char", "*", "*", "names_expand", "=", "MEM_mallocN", "(", "sizeof", "(", "*", "names_expand", ")", "*", "names_expand_len", ",", "__func__", ")", ";", "short", "*", "names_array_len_expand", "=", "MEM_mallocN", "(", "sizeof", "(", "*", "names_array_len_expand", ")", "*", "names_expand_len", ",", "__func__", ")", ";", "int", "names_expand_index", "=", "0", ";", "for", "(", "int", "struct_nr", "=", "0", ";", "struct_nr", "<", "sdna", "->", "structs_len", ";", "struct_nr", "++", ")", "{", "const", "short", "*", "sp", "=", "sdna", "->", "structs", "[", "struct_nr", "]", ";", "short", "*", "sp_expand", "=", "BLI_memarena_alloc", "(", "sdna", "->", "mem_arena", ",", "sizeof", "(", "short", "[", "2", "]", ")", "*", "(", "1", "+", "sp", "[", "1", "]", ")", ")", ";", "memcpy", "(", "sp_expand", ",", "sp", ",", "sizeof", "(", "short", "[", "2", "]", ")", "*", "(", "1", "+", "sp", "[", "1", "]", ")", ")", ";", "sdna", "->", "structs", "[", "struct_nr", "]", "=", "sp_expand", ";", "const", "int", "names_len", "=", "sp", "[", "1", "]", ";", "sp", "+=", "2", ";", "sp_expand", "+=", "2", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "names_len", ";", "i", "++", ",", "sp", "+=", "2", ",", "sp_expand", "+=", "2", ")", "{", "names_expand", "[", "names_expand_index", "]", "=", "sdna", "->", "names", "[", "sp", "[", "1", "]", "]", ";", "names_array_len_expand", "[", "names_expand_index", "]", "=", "sdna", "->", "names_array_len", "[", "sp", "[", "1", "]", "]", ";", "BLI_assert", "(", "names_expand_index", "<", "SHRT_MAX", ")", ";", "sp_expand", "[", "1", "]", "=", "names_expand_index", ";", "names_expand_index", "++", ";", "}", "}", "MEM_freeN", "(", "(", "void", "*", ")", "sdna", "->", "names", ")", ";", "sdna", "->", "names", "=", "names_expand", ";", "MEM_freeN", "(", "(", "void", "*", ")", "sdna", "->", "names_array_len", ")", ";", "sdna", "->", "names_array_len", "=", "names_array_len_expand", ";", "sdna", "->", "names_len", "=", "names_expand_len", ";", "}" ]
Names are shared between structs which causes problems renaming.
[ "Names", "are", "shared", "between", "structs", "which", "causes", "problems", "renaming", "." ]
[ "/* We can't edit this memory 'sdna->structs' points to (readonly datatoc file). */" ]
[ { "param": "sdna", "type": "SDNA" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "sdna", "type": "SDNA", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
9138e65dd2fe86433282e89e224fbc5a1122f206
DemonRem/blender
source/blender/editors/object/object_gpencil_modifier.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
gpencil_edit_modifier_poll_generic
int
static int gpencil_edit_modifier_poll_generic(bContext *C, StructRNA *rna_type, int obtype_flag) { PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", rna_type); Object *ob = (ptr.owner_id) ? (Object *)ptr.owner_id : ED_object_active_context(C); if (!ob || ID_IS_LINKED(ob)) { return 0; } if (obtype_flag && ((1 << ob->type) & obtype_flag) == 0) { return 0; } if (ptr.owner_id && ID_IS_LINKED(ptr.owner_id)) { return 0; } if (ID_IS_OVERRIDE_LIBRARY(ob)) { CTX_wm_operator_poll_msg_set(C, "Cannot edit modifiers coming from library override"); return (((GpencilModifierData *)ptr.data)->flag & eGpencilModifierFlag_OverrideLibrary_Local) != 0; } return 1; }
/********** generic functions for operators using mod names and data context *********************/
generic functions for operators using mod names and data context
[ "generic", "functions", "for", "operators", "using", "mod", "names", "and", "data", "context" ]
static int gpencil_edit_modifier_poll_generic(bContext *C, StructRNA *rna_type, int obtype_flag) { PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", rna_type); Object *ob = (ptr.owner_id) ? (Object *)ptr.owner_id : ED_object_active_context(C); if (!ob || ID_IS_LINKED(ob)) { return 0; } if (obtype_flag && ((1 << ob->type) & obtype_flag) == 0) { return 0; } if (ptr.owner_id && ID_IS_LINKED(ptr.owner_id)) { return 0; } if (ID_IS_OVERRIDE_LIBRARY(ob)) { CTX_wm_operator_poll_msg_set(C, "Cannot edit modifiers coming from library override"); return (((GpencilModifierData *)ptr.data)->flag & eGpencilModifierFlag_OverrideLibrary_Local) != 0; } return 1; }
[ "static", "int", "gpencil_edit_modifier_poll_generic", "(", "bContext", "*", "C", ",", "StructRNA", "*", "rna_type", ",", "int", "obtype_flag", ")", "{", "PointerRNA", "ptr", "=", "CTX_data_pointer_get_type", "(", "C", ",", "\"", "\"", ",", "rna_type", ")", ";", "Object", "*", "ob", "=", "(", "ptr", ".", "owner_id", ")", "?", "(", "Object", "*", ")", "ptr", ".", "owner_id", ":", "ED_object_active_context", "(", "C", ")", ";", "if", "(", "!", "ob", "||", "ID_IS_LINKED", "(", "ob", ")", ")", "{", "return", "0", ";", "}", "if", "(", "obtype_flag", "&&", "(", "(", "1", "<<", "ob", "->", "type", ")", "&", "obtype_flag", ")", "==", "0", ")", "{", "return", "0", ";", "}", "if", "(", "ptr", ".", "owner_id", "&&", "ID_IS_LINKED", "(", "ptr", ".", "owner_id", ")", ")", "{", "return", "0", ";", "}", "if", "(", "ID_IS_OVERRIDE_LIBRARY", "(", "ob", ")", ")", "{", "CTX_wm_operator_poll_msg_set", "(", "C", ",", "\"", "\"", ")", ";", "return", "(", "(", "(", "GpencilModifierData", "*", ")", "ptr", ".", "data", ")", "->", "flag", "&", "eGpencilModifierFlag_OverrideLibrary_Local", ")", "!=", "0", ";", "}", "return", "1", ";", "}" ]
generic functions for operators using mod names and data context
[ "generic", "functions", "for", "operators", "using", "mod", "names", "and", "data", "context" ]
[]
[ { "param": "C", "type": "bContext" }, { "param": "rna_type", "type": "StructRNA" }, { "param": "obtype_flag", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "C", "type": "bContext", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rna_type", "type": "StructRNA", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "obtype_flag", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6454fc71e56f20391b076bc3666a23fee8980ff8
DemonRem/blender
source/blender/draw/intern/draw_select_buffer.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
DRW_select_buffer_read
uint
uint *DRW_select_buffer_read(struct Depsgraph *depsgraph, struct ARegion *ar, struct View3D *v3d, const rcti *rect, uint *r_buf_len) { uint *r_buf = NULL; uint buf_len = 0; /* Clamp rect. */ rcti r = { .xmin = 0, .xmax = ar->winx, .ymin = 0, .ymax = ar->winy, }; /* Make sure that the rect is within the bounds of the viewport. * Some GPUs have problems reading pixels off limits. */ rcti rect_clamp = *rect; if (BLI_rcti_isect(&r, &rect_clamp, &rect_clamp)) { struct SELECTID_Context *select_ctx = DRW_select_engine_context_get(); DRW_opengl_context_enable(); /* Update the drawing. */ DRW_draw_select_id(depsgraph, ar, v3d, rect); if (select_ctx->index_drawn_len > 1) { BLI_assert(ar->winx == GPU_texture_width(DRW_engine_select_texture_get()) && ar->winy == GPU_texture_height(DRW_engine_select_texture_get())); /* Read the UI32 pixels. */ buf_len = BLI_rcti_size_x(rect) * BLI_rcti_size_y(rect); r_buf = MEM_mallocN(buf_len * sizeof(*r_buf), __func__); GPUFrameBuffer *select_id_fb = DRW_engine_select_framebuffer_get(); GPU_framebuffer_bind(select_id_fb); glReadBuffer(GL_COLOR_ATTACHMENT0); glReadPixels(rect_clamp.xmin, rect_clamp.ymin, BLI_rcti_size_x(&rect_clamp), BLI_rcti_size_y(&rect_clamp), GL_RED_INTEGER, GL_UNSIGNED_INT, r_buf); if (!BLI_rcti_compare(rect, &rect_clamp)) { /* The rect has been clamped so you need to realign the buffer and fill in the blanks */ GPU_select_buffer_stride_realign(rect, &rect_clamp, r_buf); } } GPU_framebuffer_restore(); DRW_opengl_context_disable(); } if (r_buf_len) { *r_buf_len = buf_len; } return r_buf; }
/* Main function to read a block of pixels from the select frame buffer. */
Main function to read a block of pixels from the select frame buffer.
[ "Main", "function", "to", "read", "a", "block", "of", "pixels", "from", "the", "select", "frame", "buffer", "." ]
uint *DRW_select_buffer_read(struct Depsgraph *depsgraph, struct ARegion *ar, struct View3D *v3d, const rcti *rect, uint *r_buf_len) { uint *r_buf = NULL; uint buf_len = 0; rcti r = { .xmin = 0, .xmax = ar->winx, .ymin = 0, .ymax = ar->winy, }; rcti rect_clamp = *rect; if (BLI_rcti_isect(&r, &rect_clamp, &rect_clamp)) { struct SELECTID_Context *select_ctx = DRW_select_engine_context_get(); DRW_opengl_context_enable(); DRW_draw_select_id(depsgraph, ar, v3d, rect); if (select_ctx->index_drawn_len > 1) { BLI_assert(ar->winx == GPU_texture_width(DRW_engine_select_texture_get()) && ar->winy == GPU_texture_height(DRW_engine_select_texture_get())); buf_len = BLI_rcti_size_x(rect) * BLI_rcti_size_y(rect); r_buf = MEM_mallocN(buf_len * sizeof(*r_buf), __func__); GPUFrameBuffer *select_id_fb = DRW_engine_select_framebuffer_get(); GPU_framebuffer_bind(select_id_fb); glReadBuffer(GL_COLOR_ATTACHMENT0); glReadPixels(rect_clamp.xmin, rect_clamp.ymin, BLI_rcti_size_x(&rect_clamp), BLI_rcti_size_y(&rect_clamp), GL_RED_INTEGER, GL_UNSIGNED_INT, r_buf); if (!BLI_rcti_compare(rect, &rect_clamp)) { GPU_select_buffer_stride_realign(rect, &rect_clamp, r_buf); } } GPU_framebuffer_restore(); DRW_opengl_context_disable(); } if (r_buf_len) { *r_buf_len = buf_len; } return r_buf; }
[ "uint", "*", "DRW_select_buffer_read", "(", "struct", "Depsgraph", "*", "depsgraph", ",", "struct", "ARegion", "*", "ar", ",", "struct", "View3D", "*", "v3d", ",", "const", "rcti", "*", "rect", ",", "uint", "*", "r_buf_len", ")", "{", "uint", "*", "r_buf", "=", "NULL", ";", "uint", "buf_len", "=", "0", ";", "rcti", "r", "=", "{", ".", "xmin", "=", "0", ",", ".", "xmax", "=", "ar", "->", "winx", ",", ".", "ymin", "=", "0", ",", ".", "ymax", "=", "ar", "->", "winy", ",", "}", ";", "rcti", "rect_clamp", "=", "*", "rect", ";", "if", "(", "BLI_rcti_isect", "(", "&", "r", ",", "&", "rect_clamp", ",", "&", "rect_clamp", ")", ")", "{", "struct", "SELECTID_Context", "*", "select_ctx", "=", "DRW_select_engine_context_get", "(", ")", ";", "DRW_opengl_context_enable", "(", ")", ";", "DRW_draw_select_id", "(", "depsgraph", ",", "ar", ",", "v3d", ",", "rect", ")", ";", "if", "(", "select_ctx", "->", "index_drawn_len", ">", "1", ")", "{", "BLI_assert", "(", "ar", "->", "winx", "==", "GPU_texture_width", "(", "DRW_engine_select_texture_get", "(", ")", ")", "&&", "ar", "->", "winy", "==", "GPU_texture_height", "(", "DRW_engine_select_texture_get", "(", ")", ")", ")", ";", "buf_len", "=", "BLI_rcti_size_x", "(", "rect", ")", "*", "BLI_rcti_size_y", "(", "rect", ")", ";", "r_buf", "=", "MEM_mallocN", "(", "buf_len", "*", "sizeof", "(", "*", "r_buf", ")", ",", "__func__", ")", ";", "GPUFrameBuffer", "*", "select_id_fb", "=", "DRW_engine_select_framebuffer_get", "(", ")", ";", "GPU_framebuffer_bind", "(", "select_id_fb", ")", ";", "glReadBuffer", "(", "GL_COLOR_ATTACHMENT0", ")", ";", "glReadPixels", "(", "rect_clamp", ".", "xmin", ",", "rect_clamp", ".", "ymin", ",", "BLI_rcti_size_x", "(", "&", "rect_clamp", ")", ",", "BLI_rcti_size_y", "(", "&", "rect_clamp", ")", ",", "GL_RED_INTEGER", ",", "GL_UNSIGNED_INT", ",", "r_buf", ")", ";", "if", "(", "!", "BLI_rcti_compare", "(", "rect", ",", "&", "rect_clamp", ")", ")", "{", "GPU_select_buffer_stride_realign", "(", "rect", ",", "&", "rect_clamp", ",", "r_buf", ")", ";", "}", "}", "GPU_framebuffer_restore", "(", ")", ";", "DRW_opengl_context_disable", "(", ")", ";", "}", "if", "(", "r_buf_len", ")", "{", "*", "r_buf_len", "=", "buf_len", ";", "}", "return", "r_buf", ";", "}" ]
Main function to read a block of pixels from the select frame buffer.
[ "Main", "function", "to", "read", "a", "block", "of", "pixels", "from", "the", "select", "frame", "buffer", "." ]
[ "/* Clamp rect. */", "/* Make sure that the rect is within the bounds of the viewport.\n * Some GPUs have problems reading pixels off limits. */", "/* Update the drawing. */", "/* Read the UI32 pixels. */", "/* The rect has been clamped so you need to realign the buffer and fill in the blanks */" ]
[ { "param": "depsgraph", "type": "struct Depsgraph" }, { "param": "ar", "type": "struct ARegion" }, { "param": "v3d", "type": "struct View3D" }, { "param": "rect", "type": "rcti" }, { "param": "r_buf_len", "type": "uint" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "depsgraph", "type": "struct Depsgraph", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ar", "type": "struct ARegion", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "v3d", "type": "struct View3D", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rect", "type": "rcti", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "r_buf_len", "type": "uint", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6454fc71e56f20391b076bc3666a23fee8980ff8
DemonRem/blender
source/blender/draw/intern/draw_select_buffer.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
DRW_select_buffer_find_nearest_to_point
uint
uint DRW_select_buffer_find_nearest_to_point(struct Depsgraph *depsgraph, struct ARegion *ar, struct View3D *v3d, const int center[2], const uint id_min, const uint id_max, uint *dist) { /* Smart function to sample a rect spiraling outside, nice for selection ID. */ /* Create region around center (typically the mouse cursor). * This must be square and have an odd width, * the spiraling algorithm does not work with arbitrary rectangles. */ uint index = 0; rcti rect; BLI_rcti_init_pt_radius(&rect, center, *dist); rect.xmax += 1; rect.ymax += 1; int width = BLI_rcti_size_x(&rect); int height = width; BLI_assert(width == height); /* Read from selection framebuffer. */ uint buf_len; const uint *buf = DRW_select_buffer_read(depsgraph, ar, v3d, &rect, &buf_len); if (buf == NULL) { return index; } BLI_assert(width * height == buf_len); /* Spiral, starting from center of buffer. */ int spiral_offset = height * (int)(width / 2) + (height / 2); int spiral_direction = 0; for (int nr = 1; nr <= height; nr++) { for (int a = 0; a < 2; a++) { for (int b = 0; b < nr; b++) { /* Find hit within the specified range. */ uint hit_id = buf[spiral_offset]; if (hit_id && hit_id >= id_min && hit_id < id_max) { /* Get x/y from spiral offset. */ int hit_x = spiral_offset % width; int hit_y = spiral_offset / width; int center_x = width / 2; int center_y = height / 2; /* Manhatten distance in keeping with other screen-based selection. */ *dist = (uint)(abs(hit_x - center_x) + abs(hit_y - center_y)); /* Indices start at 1 here. */ index = (hit_id - id_min) + 1; goto exit; } /* Next spiral step. */ if (spiral_direction == 0) { spiral_offset += 1; /* right */ } else if (spiral_direction == 1) { spiral_offset -= width; /* down */ } else if (spiral_direction == 2) { spiral_offset -= 1; /* left */ } else { spiral_offset += width; /* up */ } /* Stop if we are outside the buffer. */ if (spiral_offset < 0 || spiral_offset >= buf_len) { goto exit; } } spiral_direction = (spiral_direction + 1) % 4; } } exit: MEM_freeN((void *)buf); return index; }
/** * Find the selection id closest to \a center. * \param dist[in,out]: Use to initialize the distance, * when found, this value is set to the distance of the selection that's returned. */
Find the selection id closest to \a center. \param dist[in,out]: Use to initialize the distance, when found, this value is set to the distance of the selection that's returned.
[ "Find", "the", "selection", "id", "closest", "to", "\\", "a", "center", ".", "\\", "param", "dist", "[", "in", "out", "]", ":", "Use", "to", "initialize", "the", "distance", "when", "found", "this", "value", "is", "set", "to", "the", "distance", "of", "the", "selection", "that", "'", "s", "returned", "." ]
uint DRW_select_buffer_find_nearest_to_point(struct Depsgraph *depsgraph, struct ARegion *ar, struct View3D *v3d, const int center[2], const uint id_min, const uint id_max, uint *dist) { uint index = 0; rcti rect; BLI_rcti_init_pt_radius(&rect, center, *dist); rect.xmax += 1; rect.ymax += 1; int width = BLI_rcti_size_x(&rect); int height = width; BLI_assert(width == height); uint buf_len; const uint *buf = DRW_select_buffer_read(depsgraph, ar, v3d, &rect, &buf_len); if (buf == NULL) { return index; } BLI_assert(width * height == buf_len); int spiral_offset = height * (int)(width / 2) + (height / 2); int spiral_direction = 0; for (int nr = 1; nr <= height; nr++) { for (int a = 0; a < 2; a++) { for (int b = 0; b < nr; b++) { uint hit_id = buf[spiral_offset]; if (hit_id && hit_id >= id_min && hit_id < id_max) { int hit_x = spiral_offset % width; int hit_y = spiral_offset / width; int center_x = width / 2; int center_y = height / 2; *dist = (uint)(abs(hit_x - center_x) + abs(hit_y - center_y)); index = (hit_id - id_min) + 1; goto exit; } if (spiral_direction == 0) { spiral_offset += 1; } else if (spiral_direction == 1) { spiral_offset -= width; } else if (spiral_direction == 2) { spiral_offset -= 1; } else { spiral_offset += width; } if (spiral_offset < 0 || spiral_offset >= buf_len) { goto exit; } } spiral_direction = (spiral_direction + 1) % 4; } } exit: MEM_freeN((void *)buf); return index; }
[ "uint", "DRW_select_buffer_find_nearest_to_point", "(", "struct", "Depsgraph", "*", "depsgraph", ",", "struct", "ARegion", "*", "ar", ",", "struct", "View3D", "*", "v3d", ",", "const", "int", "center", "[", "2", "]", ",", "const", "uint", "id_min", ",", "const", "uint", "id_max", ",", "uint", "*", "dist", ")", "{", "uint", "index", "=", "0", ";", "rcti", "rect", ";", "BLI_rcti_init_pt_radius", "(", "&", "rect", ",", "center", ",", "*", "dist", ")", ";", "rect", ".", "xmax", "+=", "1", ";", "rect", ".", "ymax", "+=", "1", ";", "int", "width", "=", "BLI_rcti_size_x", "(", "&", "rect", ")", ";", "int", "height", "=", "width", ";", "BLI_assert", "(", "width", "==", "height", ")", ";", "uint", "buf_len", ";", "const", "uint", "*", "buf", "=", "DRW_select_buffer_read", "(", "depsgraph", ",", "ar", ",", "v3d", ",", "&", "rect", ",", "&", "buf_len", ")", ";", "if", "(", "buf", "==", "NULL", ")", "{", "return", "index", ";", "}", "BLI_assert", "(", "width", "*", "height", "==", "buf_len", ")", ";", "int", "spiral_offset", "=", "height", "*", "(", "int", ")", "(", "width", "/", "2", ")", "+", "(", "height", "/", "2", ")", ";", "int", "spiral_direction", "=", "0", ";", "for", "(", "int", "nr", "=", "1", ";", "nr", "<=", "height", ";", "nr", "++", ")", "{", "for", "(", "int", "a", "=", "0", ";", "a", "<", "2", ";", "a", "++", ")", "{", "for", "(", "int", "b", "=", "0", ";", "b", "<", "nr", ";", "b", "++", ")", "{", "uint", "hit_id", "=", "buf", "[", "spiral_offset", "]", ";", "if", "(", "hit_id", "&&", "hit_id", ">=", "id_min", "&&", "hit_id", "<", "id_max", ")", "{", "int", "hit_x", "=", "spiral_offset", "%", "width", ";", "int", "hit_y", "=", "spiral_offset", "/", "width", ";", "int", "center_x", "=", "width", "/", "2", ";", "int", "center_y", "=", "height", "/", "2", ";", "*", "dist", "=", "(", "uint", ")", "(", "abs", "(", "hit_x", "-", "center_x", ")", "+", "abs", "(", "hit_y", "-", "center_y", ")", ")", ";", "index", "=", "(", "hit_id", "-", "id_min", ")", "+", "1", ";", "goto", "exit", ";", "}", "if", "(", "spiral_direction", "==", "0", ")", "{", "spiral_offset", "+=", "1", ";", "}", "else", "if", "(", "spiral_direction", "==", "1", ")", "{", "spiral_offset", "-=", "width", ";", "}", "else", "if", "(", "spiral_direction", "==", "2", ")", "{", "spiral_offset", "-=", "1", ";", "}", "else", "{", "spiral_offset", "+=", "width", ";", "}", "if", "(", "spiral_offset", "<", "0", "||", "spiral_offset", ">=", "buf_len", ")", "{", "goto", "exit", ";", "}", "}", "spiral_direction", "=", "(", "spiral_direction", "+", "1", ")", "%", "4", ";", "}", "}", "exit", ":", "MEM_freeN", "(", "(", "void", "*", ")", "buf", ")", ";", "return", "index", ";", "}" ]
Find the selection id closest to \a center.
[ "Find", "the", "selection", "id", "closest", "to", "\\", "a", "center", "." ]
[ "/* Smart function to sample a rect spiraling outside, nice for selection ID. */", "/* Create region around center (typically the mouse cursor).\n * This must be square and have an odd width,\n * the spiraling algorithm does not work with arbitrary rectangles. */", "/* Read from selection framebuffer. */", "/* Spiral, starting from center of buffer. */", "/* Find hit within the specified range. */", "/* Get x/y from spiral offset. */", "/* Manhatten distance in keeping with other screen-based selection. */", "/* Indices start at 1 here. */", "/* Next spiral step. */", "/* right */", "/* down */", "/* left */", "/* up */", "/* Stop if we are outside the buffer. */" ]
[ { "param": "depsgraph", "type": "struct Depsgraph" }, { "param": "ar", "type": "struct ARegion" }, { "param": "v3d", "type": "struct View3D" }, { "param": "center", "type": "int" }, { "param": "id_min", "type": "uint" }, { "param": "id_max", "type": "uint" }, { "param": "dist", "type": "uint" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "depsgraph", "type": "struct Depsgraph", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ar", "type": "struct ARegion", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "v3d", "type": "struct View3D", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "center", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "id_min", "type": "uint", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "id_max", "type": "uint", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dist", "type": "uint", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
36cef3ccdc016bd2d8223da7d81662087de6e131
DemonRem/blender
source/blender/editors/gpencil/gpencil_merge.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
gpencil_insert_to_array
int
static int gpencil_insert_to_array(tGPencilPointCache *src_array, tGPencilPointCache *dst_array, int totpoints, bGPDstroke *gps_filter, bool reverse, int last) { tGPencilPointCache *src_elem = NULL; tGPencilPointCache *dst_elem = NULL; int idx = 0; for (int i = 0; i < totpoints; i++) { if (!reverse) { idx = i; } else { idx = totpoints - i - 1; } src_elem = &src_array[idx]; /* check if all points or only a stroke */ if ((gps_filter != NULL) && (gps_filter != src_elem->gps)) { continue; } dst_elem = &dst_array[last]; last++; copy_v3_v3(&dst_elem->x, &src_elem->x); dst_elem->gps = src_elem->gps; dst_elem->pressure = src_elem->pressure; dst_elem->strength = src_elem->strength; dst_elem->factor = src_elem->factor; } return last; }
/* insert a group of points in destination array */
insert a group of points in destination array
[ "insert", "a", "group", "of", "points", "in", "destination", "array" ]
static int gpencil_insert_to_array(tGPencilPointCache *src_array, tGPencilPointCache *dst_array, int totpoints, bGPDstroke *gps_filter, bool reverse, int last) { tGPencilPointCache *src_elem = NULL; tGPencilPointCache *dst_elem = NULL; int idx = 0; for (int i = 0; i < totpoints; i++) { if (!reverse) { idx = i; } else { idx = totpoints - i - 1; } src_elem = &src_array[idx]; if ((gps_filter != NULL) && (gps_filter != src_elem->gps)) { continue; } dst_elem = &dst_array[last]; last++; copy_v3_v3(&dst_elem->x, &src_elem->x); dst_elem->gps = src_elem->gps; dst_elem->pressure = src_elem->pressure; dst_elem->strength = src_elem->strength; dst_elem->factor = src_elem->factor; } return last; }
[ "static", "int", "gpencil_insert_to_array", "(", "tGPencilPointCache", "*", "src_array", ",", "tGPencilPointCache", "*", "dst_array", ",", "int", "totpoints", ",", "bGPDstroke", "*", "gps_filter", ",", "bool", "reverse", ",", "int", "last", ")", "{", "tGPencilPointCache", "*", "src_elem", "=", "NULL", ";", "tGPencilPointCache", "*", "dst_elem", "=", "NULL", ";", "int", "idx", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "totpoints", ";", "i", "++", ")", "{", "if", "(", "!", "reverse", ")", "{", "idx", "=", "i", ";", "}", "else", "{", "idx", "=", "totpoints", "-", "i", "-", "1", ";", "}", "src_elem", "=", "&", "src_array", "[", "idx", "]", ";", "if", "(", "(", "gps_filter", "!=", "NULL", ")", "&&", "(", "gps_filter", "!=", "src_elem", "->", "gps", ")", ")", "{", "continue", ";", "}", "dst_elem", "=", "&", "dst_array", "[", "last", "]", ";", "last", "++", ";", "copy_v3_v3", "(", "&", "dst_elem", "->", "x", ",", "&", "src_elem", "->", "x", ")", ";", "dst_elem", "->", "gps", "=", "src_elem", "->", "gps", ";", "dst_elem", "->", "pressure", "=", "src_elem", "->", "pressure", ";", "dst_elem", "->", "strength", "=", "src_elem", "->", "strength", ";", "dst_elem", "->", "factor", "=", "src_elem", "->", "factor", ";", "}", "return", "last", ";", "}" ]
insert a group of points in destination array
[ "insert", "a", "group", "of", "points", "in", "destination", "array" ]
[ "/* check if all points or only a stroke */" ]
[ { "param": "src_array", "type": "tGPencilPointCache" }, { "param": "dst_array", "type": "tGPencilPointCache" }, { "param": "totpoints", "type": "int" }, { "param": "gps_filter", "type": "bGPDstroke" }, { "param": "reverse", "type": "bool" }, { "param": "last", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "src_array", "type": "tGPencilPointCache", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dst_array", "type": "tGPencilPointCache", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "totpoints", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "gps_filter", "type": "bGPDstroke", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "reverse", "type": "bool", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "last", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
36cef3ccdc016bd2d8223da7d81662087de6e131
DemonRem/blender
source/blender/editors/gpencil/gpencil_merge.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
gpencil_get_extremes
void
static void gpencil_get_extremes( tGPencilPointCache *src_array, int totpoints, bGPDstroke *gps_filter, float *start, float *end) { tGPencilPointCache *array_pt = NULL; int i; /* find first point */ for (i = 0; i < totpoints; i++) { array_pt = &src_array[i]; if (gps_filter == array_pt->gps) { copy_v3_v3(start, &array_pt->x); break; } } /* find last point */ for (i = totpoints - 1; i >= 0; i--) { array_pt = &src_array[i]; if (gps_filter == array_pt->gps) { copy_v3_v3(end, &array_pt->x); break; } } }
/* get first and last point location */
get first and last point location
[ "get", "first", "and", "last", "point", "location" ]
static void gpencil_get_extremes( tGPencilPointCache *src_array, int totpoints, bGPDstroke *gps_filter, float *start, float *end) { tGPencilPointCache *array_pt = NULL; int i; for (i = 0; i < totpoints; i++) { array_pt = &src_array[i]; if (gps_filter == array_pt->gps) { copy_v3_v3(start, &array_pt->x); break; } } for (i = totpoints - 1; i >= 0; i--) { array_pt = &src_array[i]; if (gps_filter == array_pt->gps) { copy_v3_v3(end, &array_pt->x); break; } } }
[ "static", "void", "gpencil_get_extremes", "(", "tGPencilPointCache", "*", "src_array", ",", "int", "totpoints", ",", "bGPDstroke", "*", "gps_filter", ",", "float", "*", "start", ",", "float", "*", "end", ")", "{", "tGPencilPointCache", "*", "array_pt", "=", "NULL", ";", "int", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "totpoints", ";", "i", "++", ")", "{", "array_pt", "=", "&", "src_array", "[", "i", "]", ";", "if", "(", "gps_filter", "==", "array_pt", "->", "gps", ")", "{", "copy_v3_v3", "(", "start", ",", "&", "array_pt", "->", "x", ")", ";", "break", ";", "}", "}", "for", "(", "i", "=", "totpoints", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "array_pt", "=", "&", "src_array", "[", "i", "]", ";", "if", "(", "gps_filter", "==", "array_pt", "->", "gps", ")", "{", "copy_v3_v3", "(", "end", ",", "&", "array_pt", "->", "x", ")", ";", "break", ";", "}", "}", "}" ]
get first and last point location
[ "get", "first", "and", "last", "point", "location" ]
[ "/* find first point */", "/* find last point */" ]
[ { "param": "src_array", "type": "tGPencilPointCache" }, { "param": "totpoints", "type": "int" }, { "param": "gps_filter", "type": "bGPDstroke" }, { "param": "start", "type": "float" }, { "param": "end", "type": "float" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "src_array", "type": "tGPencilPointCache", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "totpoints", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "gps_filter", "type": "bGPDstroke", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "start", "type": "float", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "end", "type": "float", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
ba139c654d327578ee2639fdc93c2ba49f011731
DemonRem/blender
source/blender/blenkernel/intern/mesh.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BKE_mesh_cmp
char
const char *BKE_mesh_cmp(Mesh *me1, Mesh *me2, float thresh) { int c; if (!me1 || !me2) { return "Requires two input meshes"; } if (me1->totvert != me2->totvert) { return "Number of verts don't match"; } if (me1->totedge != me2->totedge) { return "Number of edges don't match"; } if (me1->totpoly != me2->totpoly) { return "Number of faces don't match"; } if (me1->totloop != me2->totloop) { return "Number of loops don't match"; } if ((c = customdata_compare(&me1->vdata, &me2->vdata, me1, me2, thresh))) { return cmpcode_to_str(c); } if ((c = customdata_compare(&me1->edata, &me2->edata, me1, me2, thresh))) { return cmpcode_to_str(c); } if ((c = customdata_compare(&me1->ldata, &me2->ldata, me1, me2, thresh))) { return cmpcode_to_str(c); } if ((c = customdata_compare(&me1->pdata, &me2->pdata, me1, me2, thresh))) { return cmpcode_to_str(c); } return NULL; }
/** * Used for unit testing; compares two meshes, checking only * differences we care about. should be usable with leaf's * testing framework I get RNA work done, will use hackish * testing code for now. */
Used for unit testing; compares two meshes, checking only differences we care about. should be usable with leaf's testing framework I get RNA work done, will use hackish testing code for now.
[ "Used", "for", "unit", "testing", ";", "compares", "two", "meshes", "checking", "only", "differences", "we", "care", "about", ".", "should", "be", "usable", "with", "leaf", "'", "s", "testing", "framework", "I", "get", "RNA", "work", "done", "will", "use", "hackish", "testing", "code", "for", "now", "." ]
const char *BKE_mesh_cmp(Mesh *me1, Mesh *me2, float thresh) { int c; if (!me1 || !me2) { return "Requires two input meshes"; } if (me1->totvert != me2->totvert) { return "Number of verts don't match"; } if (me1->totedge != me2->totedge) { return "Number of edges don't match"; } if (me1->totpoly != me2->totpoly) { return "Number of faces don't match"; } if (me1->totloop != me2->totloop) { return "Number of loops don't match"; } if ((c = customdata_compare(&me1->vdata, &me2->vdata, me1, me2, thresh))) { return cmpcode_to_str(c); } if ((c = customdata_compare(&me1->edata, &me2->edata, me1, me2, thresh))) { return cmpcode_to_str(c); } if ((c = customdata_compare(&me1->ldata, &me2->ldata, me1, me2, thresh))) { return cmpcode_to_str(c); } if ((c = customdata_compare(&me1->pdata, &me2->pdata, me1, me2, thresh))) { return cmpcode_to_str(c); } return NULL; }
[ "const", "char", "*", "BKE_mesh_cmp", "(", "Mesh", "*", "me1", ",", "Mesh", "*", "me2", ",", "float", "thresh", ")", "{", "int", "c", ";", "if", "(", "!", "me1", "||", "!", "me2", ")", "{", "return", "\"", "\"", ";", "}", "if", "(", "me1", "->", "totvert", "!=", "me2", "->", "totvert", ")", "{", "return", "\"", "\"", ";", "}", "if", "(", "me1", "->", "totedge", "!=", "me2", "->", "totedge", ")", "{", "return", "\"", "\"", ";", "}", "if", "(", "me1", "->", "totpoly", "!=", "me2", "->", "totpoly", ")", "{", "return", "\"", "\"", ";", "}", "if", "(", "me1", "->", "totloop", "!=", "me2", "->", "totloop", ")", "{", "return", "\"", "\"", ";", "}", "if", "(", "(", "c", "=", "customdata_compare", "(", "&", "me1", "->", "vdata", ",", "&", "me2", "->", "vdata", ",", "me1", ",", "me2", ",", "thresh", ")", ")", ")", "{", "return", "cmpcode_to_str", "(", "c", ")", ";", "}", "if", "(", "(", "c", "=", "customdata_compare", "(", "&", "me1", "->", "edata", ",", "&", "me2", "->", "edata", ",", "me1", ",", "me2", ",", "thresh", ")", ")", ")", "{", "return", "cmpcode_to_str", "(", "c", ")", ";", "}", "if", "(", "(", "c", "=", "customdata_compare", "(", "&", "me1", "->", "ldata", ",", "&", "me2", "->", "ldata", ",", "me1", ",", "me2", ",", "thresh", ")", ")", ")", "{", "return", "cmpcode_to_str", "(", "c", ")", ";", "}", "if", "(", "(", "c", "=", "customdata_compare", "(", "&", "me1", "->", "pdata", ",", "&", "me2", "->", "pdata", ",", "me1", ",", "me2", ",", "thresh", ")", ")", ")", "{", "return", "cmpcode_to_str", "(", "c", ")", ";", "}", "return", "NULL", ";", "}" ]
Used for unit testing; compares two meshes, checking only differences we care about.
[ "Used", "for", "unit", "testing", ";", "compares", "two", "meshes", "checking", "only", "differences", "we", "care", "about", "." ]
[]
[ { "param": "me1", "type": "Mesh" }, { "param": "me2", "type": "Mesh" }, { "param": "thresh", "type": "float" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "me1", "type": "Mesh", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "me2", "type": "Mesh", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "thresh", "type": "float", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
ba139c654d327578ee2639fdc93c2ba49f011731
DemonRem/blender
source/blender/blenkernel/intern/mesh.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
mesh_update_linked_customdata
void
static void mesh_update_linked_customdata(Mesh *me, const bool do_ensure_tess_cd) { if (do_ensure_tess_cd) { mesh_ensure_tessellation_customdata(me); } CustomData_bmesh_update_active_layers(&me->fdata, &me->ldata); }
/* this ensures grouped customdata (e.g. mtexpoly and mloopuv and mtface, or * mloopcol and mcol) have the same relative active/render/clone/mask indices. * * note that for undo mesh data we want to skip 'ensure_tess_cd' call since * we don't want to store memory for tessface when its only used for older * versions of the mesh. - campbell*/
this ensures grouped customdata have the same relative active/render/clone/mask indices. note that for undo mesh data we want to skip 'ensure_tess_cd' call since we don't want to store memory for tessface when its only used for older versions of the mesh. - campbell
[ "this", "ensures", "grouped", "customdata", "have", "the", "same", "relative", "active", "/", "render", "/", "clone", "/", "mask", "indices", ".", "note", "that", "for", "undo", "mesh", "data", "we", "want", "to", "skip", "'", "ensure_tess_cd", "'", "call", "since", "we", "don", "'", "t", "want", "to", "store", "memory", "for", "tessface", "when", "its", "only", "used", "for", "older", "versions", "of", "the", "mesh", ".", "-", "campbell" ]
static void mesh_update_linked_customdata(Mesh *me, const bool do_ensure_tess_cd) { if (do_ensure_tess_cd) { mesh_ensure_tessellation_customdata(me); } CustomData_bmesh_update_active_layers(&me->fdata, &me->ldata); }
[ "static", "void", "mesh_update_linked_customdata", "(", "Mesh", "*", "me", ",", "const", "bool", "do_ensure_tess_cd", ")", "{", "if", "(", "do_ensure_tess_cd", ")", "{", "mesh_ensure_tessellation_customdata", "(", "me", ")", ";", "}", "CustomData_bmesh_update_active_layers", "(", "&", "me", "->", "fdata", ",", "&", "me", "->", "ldata", ")", ";", "}" ]
this ensures grouped customdata (e.g.
[ "this", "ensures", "grouped", "customdata", "(", "e", ".", "g", "." ]
[]
[ { "param": "me", "type": "Mesh" }, { "param": "do_ensure_tess_cd", "type": "bool" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "me", "type": "Mesh", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "do_ensure_tess_cd", "type": "bool", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
ba139c654d327578ee2639fdc93c2ba49f011731
DemonRem/blender
source/blender/blenkernel/intern/mesh.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BKE_mesh_free
void
void BKE_mesh_free(Mesh *me) { BKE_mesh_clear_geometry(me); MEM_SAFE_FREE(me->mat); }
/** Free (or release) any data used by this mesh (does not free the mesh itself). */
Free (or release) any data used by this mesh (does not free the mesh itself).
[ "Free", "(", "or", "release", ")", "any", "data", "used", "by", "this", "mesh", "(", "does", "not", "free", "the", "mesh", "itself", ")", "." ]
void BKE_mesh_free(Mesh *me) { BKE_mesh_clear_geometry(me); MEM_SAFE_FREE(me->mat); }
[ "void", "BKE_mesh_free", "(", "Mesh", "*", "me", ")", "{", "BKE_mesh_clear_geometry", "(", "me", ")", ";", "MEM_SAFE_FREE", "(", "me", "->", "mat", ")", ";", "}" ]
Free (or release) any data used by this mesh (does not free the mesh itself).
[ "Free", "(", "or", "release", ")", "any", "data", "used", "by", "this", "mesh", "(", "does", "not", "free", "the", "mesh", "itself", ")", "." ]
[]
[ { "param": "me", "type": "Mesh" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "me", "type": "Mesh", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
ba139c654d327578ee2639fdc93c2ba49f011731
DemonRem/blender
source/blender/blenkernel/intern/mesh.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BKE_mesh_copy_data
void
void BKE_mesh_copy_data(Main *bmain, Mesh *me_dst, const Mesh *me_src, const int flag) { BKE_mesh_runtime_reset_on_copy(me_dst, flag); if ((me_src->id.tag & LIB_TAG_NO_MAIN) == 0) { /* This is a direct copy of a main mesh, so for now it has the same topology. */ me_dst->runtime.deformed_only = true; } /* XXX WHAT? Why? Comment, please! And pretty sure this is not valid for regular Mesh copying? */ me_dst->runtime.is_original = false; /* Only do tessface if we have no polys. */ const bool do_tessface = ((me_src->totface != 0) && (me_src->totpoly == 0)); CustomData_MeshMasks mask = CD_MASK_MESH; if (me_src->id.tag & LIB_TAG_NO_MAIN) { /* For copies in depsgraph, keep data like origindex and orco. */ CustomData_MeshMasks_update(&mask, &CD_MASK_DERIVEDMESH); } me_dst->mat = MEM_dupallocN(me_src->mat); const eCDAllocType alloc_type = (flag & LIB_ID_COPY_CD_REFERENCE) ? CD_REFERENCE : CD_DUPLICATE; CustomData_copy(&me_src->vdata, &me_dst->vdata, mask.vmask, alloc_type, me_dst->totvert); CustomData_copy(&me_src->edata, &me_dst->edata, mask.emask, alloc_type, me_dst->totedge); CustomData_copy(&me_src->ldata, &me_dst->ldata, mask.lmask, alloc_type, me_dst->totloop); CustomData_copy(&me_src->pdata, &me_dst->pdata, mask.pmask, alloc_type, me_dst->totpoly); if (do_tessface) { CustomData_copy(&me_src->fdata, &me_dst->fdata, mask.fmask, alloc_type, me_dst->totface); } else { mesh_tessface_clear_intern(me_dst, false); } BKE_mesh_update_customdata_pointers(me_dst, do_tessface); me_dst->edit_mesh = NULL; me_dst->mselect = MEM_dupallocN(me_dst->mselect); /* TODO Do we want to add flag to prevent this? */ if (me_src->key && (flag & LIB_ID_COPY_SHAPEKEY)) { BKE_id_copy_ex(bmain, &me_src->key->id, (ID **)&me_dst->key, flag); } }
/** * Only copy internal data of Mesh ID from source * to already allocated/initialized destination. * You probably never want to use that directly, * use #BKE_id_copy or #BKE_id_copy_ex for typical needs. * * WARNING! This function will not handle ID user count! * * \param flag: Copying options (see BKE_library.h's LIB_ID_COPY_... flags for more). */
Only copy internal data of Mesh ID from source to already allocated/initialized destination. You probably never want to use that directly, use #BKE_id_copy or #BKE_id_copy_ex for typical needs. WARNING. This function will not handle ID user count! \param flag: Copying options .
[ "Only", "copy", "internal", "data", "of", "Mesh", "ID", "from", "source", "to", "already", "allocated", "/", "initialized", "destination", ".", "You", "probably", "never", "want", "to", "use", "that", "directly", "use", "#BKE_id_copy", "or", "#BKE_id_copy_ex", "for", "typical", "needs", ".", "WARNING", ".", "This", "function", "will", "not", "handle", "ID", "user", "count!", "\\", "param", "flag", ":", "Copying", "options", "." ]
void BKE_mesh_copy_data(Main *bmain, Mesh *me_dst, const Mesh *me_src, const int flag) { BKE_mesh_runtime_reset_on_copy(me_dst, flag); if ((me_src->id.tag & LIB_TAG_NO_MAIN) == 0) { me_dst->runtime.deformed_only = true; } me_dst->runtime.is_original = false; const bool do_tessface = ((me_src->totface != 0) && (me_src->totpoly == 0)); CustomData_MeshMasks mask = CD_MASK_MESH; if (me_src->id.tag & LIB_TAG_NO_MAIN) { CustomData_MeshMasks_update(&mask, &CD_MASK_DERIVEDMESH); } me_dst->mat = MEM_dupallocN(me_src->mat); const eCDAllocType alloc_type = (flag & LIB_ID_COPY_CD_REFERENCE) ? CD_REFERENCE : CD_DUPLICATE; CustomData_copy(&me_src->vdata, &me_dst->vdata, mask.vmask, alloc_type, me_dst->totvert); CustomData_copy(&me_src->edata, &me_dst->edata, mask.emask, alloc_type, me_dst->totedge); CustomData_copy(&me_src->ldata, &me_dst->ldata, mask.lmask, alloc_type, me_dst->totloop); CustomData_copy(&me_src->pdata, &me_dst->pdata, mask.pmask, alloc_type, me_dst->totpoly); if (do_tessface) { CustomData_copy(&me_src->fdata, &me_dst->fdata, mask.fmask, alloc_type, me_dst->totface); } else { mesh_tessface_clear_intern(me_dst, false); } BKE_mesh_update_customdata_pointers(me_dst, do_tessface); me_dst->edit_mesh = NULL; me_dst->mselect = MEM_dupallocN(me_dst->mselect); if (me_src->key && (flag & LIB_ID_COPY_SHAPEKEY)) { BKE_id_copy_ex(bmain, &me_src->key->id, (ID **)&me_dst->key, flag); } }
[ "void", "BKE_mesh_copy_data", "(", "Main", "*", "bmain", ",", "Mesh", "*", "me_dst", ",", "const", "Mesh", "*", "me_src", ",", "const", "int", "flag", ")", "{", "BKE_mesh_runtime_reset_on_copy", "(", "me_dst", ",", "flag", ")", ";", "if", "(", "(", "me_src", "->", "id", ".", "tag", "&", "LIB_TAG_NO_MAIN", ")", "==", "0", ")", "{", "me_dst", "->", "runtime", ".", "deformed_only", "=", "true", ";", "}", "me_dst", "->", "runtime", ".", "is_original", "=", "false", ";", "const", "bool", "do_tessface", "=", "(", "(", "me_src", "->", "totface", "!=", "0", ")", "&&", "(", "me_src", "->", "totpoly", "==", "0", ")", ")", ";", "CustomData_MeshMasks", "mask", "=", "CD_MASK_MESH", ";", "if", "(", "me_src", "->", "id", ".", "tag", "&", "LIB_TAG_NO_MAIN", ")", "{", "CustomData_MeshMasks_update", "(", "&", "mask", ",", "&", "CD_MASK_DERIVEDMESH", ")", ";", "}", "me_dst", "->", "mat", "=", "MEM_dupallocN", "(", "me_src", "->", "mat", ")", ";", "const", "eCDAllocType", "alloc_type", "=", "(", "flag", "&", "LIB_ID_COPY_CD_REFERENCE", ")", "?", "CD_REFERENCE", ":", "CD_DUPLICATE", ";", "CustomData_copy", "(", "&", "me_src", "->", "vdata", ",", "&", "me_dst", "->", "vdata", ",", "mask", ".", "vmask", ",", "alloc_type", ",", "me_dst", "->", "totvert", ")", ";", "CustomData_copy", "(", "&", "me_src", "->", "edata", ",", "&", "me_dst", "->", "edata", ",", "mask", ".", "emask", ",", "alloc_type", ",", "me_dst", "->", "totedge", ")", ";", "CustomData_copy", "(", "&", "me_src", "->", "ldata", ",", "&", "me_dst", "->", "ldata", ",", "mask", ".", "lmask", ",", "alloc_type", ",", "me_dst", "->", "totloop", ")", ";", "CustomData_copy", "(", "&", "me_src", "->", "pdata", ",", "&", "me_dst", "->", "pdata", ",", "mask", ".", "pmask", ",", "alloc_type", ",", "me_dst", "->", "totpoly", ")", ";", "if", "(", "do_tessface", ")", "{", "CustomData_copy", "(", "&", "me_src", "->", "fdata", ",", "&", "me_dst", "->", "fdata", ",", "mask", ".", "fmask", ",", "alloc_type", ",", "me_dst", "->", "totface", ")", ";", "}", "else", "{", "mesh_tessface_clear_intern", "(", "me_dst", ",", "false", ")", ";", "}", "BKE_mesh_update_customdata_pointers", "(", "me_dst", ",", "do_tessface", ")", ";", "me_dst", "->", "edit_mesh", "=", "NULL", ";", "me_dst", "->", "mselect", "=", "MEM_dupallocN", "(", "me_dst", "->", "mselect", ")", ";", "if", "(", "me_src", "->", "key", "&&", "(", "flag", "&", "LIB_ID_COPY_SHAPEKEY", ")", ")", "{", "BKE_id_copy_ex", "(", "bmain", ",", "&", "me_src", "->", "key", "->", "id", ",", "(", "ID", "*", "*", ")", "&", "me_dst", "->", "key", ",", "flag", ")", ";", "}", "}" ]
Only copy internal data of Mesh ID from source to already allocated/initialized destination.
[ "Only", "copy", "internal", "data", "of", "Mesh", "ID", "from", "source", "to", "already", "allocated", "/", "initialized", "destination", "." ]
[ "/* This is a direct copy of a main mesh, so for now it has the same topology. */", "/* XXX WHAT? Why? Comment, please! And pretty sure this is not valid for regular Mesh copying? */", "/* Only do tessface if we have no polys. */", "/* For copies in depsgraph, keep data like origindex and orco. */", "/* TODO Do we want to add flag to prevent this? */" ]
[ { "param": "bmain", "type": "Main" }, { "param": "me_dst", "type": "Mesh" }, { "param": "me_src", "type": "Mesh" }, { "param": "flag", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "bmain", "type": "Main", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "me_dst", "type": "Mesh", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "me_src", "type": "Mesh", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "flag", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
ba139c654d327578ee2639fdc93c2ba49f011731
DemonRem/blender
source/blender/blenkernel/intern/mesh.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
mesh_ensure_cdlayers_primary
void
static void mesh_ensure_cdlayers_primary(Mesh *mesh, bool do_tessface) { if (!CustomData_get_layer(&mesh->vdata, CD_MVERT)) { CustomData_add_layer(&mesh->vdata, CD_MVERT, CD_CALLOC, NULL, mesh->totvert); } if (!CustomData_get_layer(&mesh->edata, CD_MEDGE)) { CustomData_add_layer(&mesh->edata, CD_MEDGE, CD_CALLOC, NULL, mesh->totedge); } if (!CustomData_get_layer(&mesh->ldata, CD_MLOOP)) { CustomData_add_layer(&mesh->ldata, CD_MLOOP, CD_CALLOC, NULL, mesh->totloop); } if (!CustomData_get_layer(&mesh->pdata, CD_MPOLY)) { CustomData_add_layer(&mesh->pdata, CD_MPOLY, CD_CALLOC, NULL, mesh->totpoly); } if (do_tessface && !CustomData_get_layer(&mesh->fdata, CD_MFACE)) { CustomData_add_layer(&mesh->fdata, CD_MFACE, CD_CALLOC, NULL, mesh->totface); } }
/* Custom data layer functions; those assume that totXXX are set correctly. */
Custom data layer functions; those assume that totXXX are set correctly.
[ "Custom", "data", "layer", "functions", ";", "those", "assume", "that", "totXXX", "are", "set", "correctly", "." ]
static void mesh_ensure_cdlayers_primary(Mesh *mesh, bool do_tessface) { if (!CustomData_get_layer(&mesh->vdata, CD_MVERT)) { CustomData_add_layer(&mesh->vdata, CD_MVERT, CD_CALLOC, NULL, mesh->totvert); } if (!CustomData_get_layer(&mesh->edata, CD_MEDGE)) { CustomData_add_layer(&mesh->edata, CD_MEDGE, CD_CALLOC, NULL, mesh->totedge); } if (!CustomData_get_layer(&mesh->ldata, CD_MLOOP)) { CustomData_add_layer(&mesh->ldata, CD_MLOOP, CD_CALLOC, NULL, mesh->totloop); } if (!CustomData_get_layer(&mesh->pdata, CD_MPOLY)) { CustomData_add_layer(&mesh->pdata, CD_MPOLY, CD_CALLOC, NULL, mesh->totpoly); } if (do_tessface && !CustomData_get_layer(&mesh->fdata, CD_MFACE)) { CustomData_add_layer(&mesh->fdata, CD_MFACE, CD_CALLOC, NULL, mesh->totface); } }
[ "static", "void", "mesh_ensure_cdlayers_primary", "(", "Mesh", "*", "mesh", ",", "bool", "do_tessface", ")", "{", "if", "(", "!", "CustomData_get_layer", "(", "&", "mesh", "->", "vdata", ",", "CD_MVERT", ")", ")", "{", "CustomData_add_layer", "(", "&", "mesh", "->", "vdata", ",", "CD_MVERT", ",", "CD_CALLOC", ",", "NULL", ",", "mesh", "->", "totvert", ")", ";", "}", "if", "(", "!", "CustomData_get_layer", "(", "&", "mesh", "->", "edata", ",", "CD_MEDGE", ")", ")", "{", "CustomData_add_layer", "(", "&", "mesh", "->", "edata", ",", "CD_MEDGE", ",", "CD_CALLOC", ",", "NULL", ",", "mesh", "->", "totedge", ")", ";", "}", "if", "(", "!", "CustomData_get_layer", "(", "&", "mesh", "->", "ldata", ",", "CD_MLOOP", ")", ")", "{", "CustomData_add_layer", "(", "&", "mesh", "->", "ldata", ",", "CD_MLOOP", ",", "CD_CALLOC", ",", "NULL", ",", "mesh", "->", "totloop", ")", ";", "}", "if", "(", "!", "CustomData_get_layer", "(", "&", "mesh", "->", "pdata", ",", "CD_MPOLY", ")", ")", "{", "CustomData_add_layer", "(", "&", "mesh", "->", "pdata", ",", "CD_MPOLY", ",", "CD_CALLOC", ",", "NULL", ",", "mesh", "->", "totpoly", ")", ";", "}", "if", "(", "do_tessface", "&&", "!", "CustomData_get_layer", "(", "&", "mesh", "->", "fdata", ",", "CD_MFACE", ")", ")", "{", "CustomData_add_layer", "(", "&", "mesh", "->", "fdata", ",", "CD_MFACE", ",", "CD_CALLOC", ",", "NULL", ",", "mesh", "->", "totface", ")", ";", "}", "}" ]
Custom data layer functions; those assume that totXXX are set correctly.
[ "Custom", "data", "layer", "functions", ";", "those", "assume", "that", "totXXX", "are", "set", "correctly", "." ]
[]
[ { "param": "mesh", "type": "Mesh" }, { "param": "do_tessface", "type": "bool" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "mesh", "type": "Mesh", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "do_tessface", "type": "bool", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
ba139c654d327578ee2639fdc93c2ba49f011731
DemonRem/blender
source/blender/blenkernel/intern/mesh.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BKE_mesh_copy_settings
void
void BKE_mesh_copy_settings(Mesh *me_dst, const Mesh *me_src) { /* Copy general settings. */ me_dst->editflag = me_src->editflag; me_dst->flag = me_src->flag; me_dst->smoothresh = me_src->smoothresh; me_dst->remesh_voxel_size = me_src->remesh_voxel_size; me_dst->remesh_voxel_adaptivity = me_src->remesh_voxel_adaptivity; me_dst->remesh_mode = me_src->remesh_mode; /* Copy texture space. */ me_dst->texflag = me_src->texflag; copy_v3_v3(me_dst->loc, me_src->loc); copy_v3_v3(me_dst->size, me_src->size); /* Copy materials. */ if (me_dst->mat != NULL) { MEM_freeN(me_dst->mat); } me_dst->mat = MEM_dupallocN(me_src->mat); me_dst->totcol = me_src->totcol; }
/* Copy user editable settings that we want to preserve through the modifier stack * or operations where a mesh with new topology is created based on another mesh. */
Copy user editable settings that we want to preserve through the modifier stack or operations where a mesh with new topology is created based on another mesh.
[ "Copy", "user", "editable", "settings", "that", "we", "want", "to", "preserve", "through", "the", "modifier", "stack", "or", "operations", "where", "a", "mesh", "with", "new", "topology", "is", "created", "based", "on", "another", "mesh", "." ]
void BKE_mesh_copy_settings(Mesh *me_dst, const Mesh *me_src) { me_dst->editflag = me_src->editflag; me_dst->flag = me_src->flag; me_dst->smoothresh = me_src->smoothresh; me_dst->remesh_voxel_size = me_src->remesh_voxel_size; me_dst->remesh_voxel_adaptivity = me_src->remesh_voxel_adaptivity; me_dst->remesh_mode = me_src->remesh_mode; me_dst->texflag = me_src->texflag; copy_v3_v3(me_dst->loc, me_src->loc); copy_v3_v3(me_dst->size, me_src->size); if (me_dst->mat != NULL) { MEM_freeN(me_dst->mat); } me_dst->mat = MEM_dupallocN(me_src->mat); me_dst->totcol = me_src->totcol; }
[ "void", "BKE_mesh_copy_settings", "(", "Mesh", "*", "me_dst", ",", "const", "Mesh", "*", "me_src", ")", "{", "me_dst", "->", "editflag", "=", "me_src", "->", "editflag", ";", "me_dst", "->", "flag", "=", "me_src", "->", "flag", ";", "me_dst", "->", "smoothresh", "=", "me_src", "->", "smoothresh", ";", "me_dst", "->", "remesh_voxel_size", "=", "me_src", "->", "remesh_voxel_size", ";", "me_dst", "->", "remesh_voxel_adaptivity", "=", "me_src", "->", "remesh_voxel_adaptivity", ";", "me_dst", "->", "remesh_mode", "=", "me_src", "->", "remesh_mode", ";", "me_dst", "->", "texflag", "=", "me_src", "->", "texflag", ";", "copy_v3_v3", "(", "me_dst", "->", "loc", ",", "me_src", "->", "loc", ")", ";", "copy_v3_v3", "(", "me_dst", "->", "size", ",", "me_src", "->", "size", ")", ";", "if", "(", "me_dst", "->", "mat", "!=", "NULL", ")", "{", "MEM_freeN", "(", "me_dst", "->", "mat", ")", ";", "}", "me_dst", "->", "mat", "=", "MEM_dupallocN", "(", "me_src", "->", "mat", ")", ";", "me_dst", "->", "totcol", "=", "me_src", "->", "totcol", ";", "}" ]
Copy user editable settings that we want to preserve through the modifier stack or operations where a mesh with new topology is created based on another mesh.
[ "Copy", "user", "editable", "settings", "that", "we", "want", "to", "preserve", "through", "the", "modifier", "stack", "or", "operations", "where", "a", "mesh", "with", "new", "topology", "is", "created", "based", "on", "another", "mesh", "." ]
[ "/* Copy general settings. */", "/* Copy texture space. */", "/* Copy materials. */" ]
[ { "param": "me_dst", "type": "Mesh" }, { "param": "me_src", "type": "Mesh" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "me_dst", "type": "Mesh", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "me_src", "type": "Mesh", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
ba139c654d327578ee2639fdc93c2ba49f011731
DemonRem/blender
source/blender/blenkernel/intern/mesh.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BKE_mesh_from_editmesh_with_coords_thin_wrap
Mesh
Mesh *BKE_mesh_from_editmesh_with_coords_thin_wrap(BMEditMesh *em, const CustomData_MeshMasks *data_mask, float (*vertexCos)[3], const Mesh *me_settings) { Mesh *me = BKE_mesh_from_bmesh_for_eval_nomain(em->bm, data_mask, me_settings); /* Use editmesh directly where possible. */ me->runtime.is_original = true; if (vertexCos) { /* We will own this array in the future. */ BKE_mesh_vert_coords_apply(me, vertexCos); MEM_freeN(vertexCos); me->runtime.is_original = false; } return me; }
/** * TODO(campbell): support mesh with only an edit-mesh which is lazy initialized. */
support mesh with only an edit-mesh which is lazy initialized.
[ "support", "mesh", "with", "only", "an", "edit", "-", "mesh", "which", "is", "lazy", "initialized", "." ]
Mesh *BKE_mesh_from_editmesh_with_coords_thin_wrap(BMEditMesh *em, const CustomData_MeshMasks *data_mask, float (*vertexCos)[3], const Mesh *me_settings) { Mesh *me = BKE_mesh_from_bmesh_for_eval_nomain(em->bm, data_mask, me_settings); me->runtime.is_original = true; if (vertexCos) { BKE_mesh_vert_coords_apply(me, vertexCos); MEM_freeN(vertexCos); me->runtime.is_original = false; } return me; }
[ "Mesh", "*", "BKE_mesh_from_editmesh_with_coords_thin_wrap", "(", "BMEditMesh", "*", "em", ",", "const", "CustomData_MeshMasks", "*", "data_mask", ",", "float", "(", "*", "vertexCos", ")", "[", "3", "]", ",", "const", "Mesh", "*", "me_settings", ")", "{", "Mesh", "*", "me", "=", "BKE_mesh_from_bmesh_for_eval_nomain", "(", "em", "->", "bm", ",", "data_mask", ",", "me_settings", ")", ";", "me", "->", "runtime", ".", "is_original", "=", "true", ";", "if", "(", "vertexCos", ")", "{", "BKE_mesh_vert_coords_apply", "(", "me", ",", "vertexCos", ")", ";", "MEM_freeN", "(", "vertexCos", ")", ";", "me", "->", "runtime", ".", "is_original", "=", "false", ";", "}", "return", "me", ";", "}" ]
TODO(campbell): support mesh with only an edit-mesh which is lazy initialized.
[ "TODO", "(", "campbell", ")", ":", "support", "mesh", "with", "only", "an", "edit", "-", "mesh", "which", "is", "lazy", "initialized", "." ]
[ "/* Use editmesh directly where possible. */", "/* We will own this array in the future. */" ]
[ { "param": "em", "type": "BMEditMesh" }, { "param": "data_mask", "type": "CustomData_MeshMasks" }, { "param": "vertexCos", "type": "float" }, { "param": "me_settings", "type": "Mesh" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "em", "type": "BMEditMesh", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data_mask", "type": "CustomData_MeshMasks", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "vertexCos", "type": "float", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "me_settings", "type": "Mesh", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
ba139c654d327578ee2639fdc93c2ba49f011731
DemonRem/blender
source/blender/blenkernel/intern/mesh.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
poly_find_loop_from_vert
int
int poly_find_loop_from_vert(const MPoly *poly, const MLoop *loopstart, unsigned vert) { int j; for (j = 0; j < poly->totloop; j++, loopstart++) { if (loopstart->v == vert) { return j; } } return -1; }
/** * Find the index of the loop in 'poly' which references vertex, * returns -1 if not found */
Find the index of the loop in 'poly' which references vertex, returns -1 if not found
[ "Find", "the", "index", "of", "the", "loop", "in", "'", "poly", "'", "which", "references", "vertex", "returns", "-", "1", "if", "not", "found" ]
int poly_find_loop_from_vert(const MPoly *poly, const MLoop *loopstart, unsigned vert) { int j; for (j = 0; j < poly->totloop; j++, loopstart++) { if (loopstart->v == vert) { return j; } } return -1; }
[ "int", "poly_find_loop_from_vert", "(", "const", "MPoly", "*", "poly", ",", "const", "MLoop", "*", "loopstart", ",", "unsigned", "vert", ")", "{", "int", "j", ";", "for", "(", "j", "=", "0", ";", "j", "<", "poly", "->", "totloop", ";", "j", "++", ",", "loopstart", "++", ")", "{", "if", "(", "loopstart", "->", "v", "==", "vert", ")", "{", "return", "j", ";", "}", "}", "return", "-1", ";", "}" ]
Find the index of the loop in 'poly' which references vertex, returns -1 if not found
[ "Find", "the", "index", "of", "the", "loop", "in", "'", "poly", "'", "which", "references", "vertex", "returns", "-", "1", "if", "not", "found" ]
[]
[ { "param": "poly", "type": "MPoly" }, { "param": "loopstart", "type": "MLoop" }, { "param": "vert", "type": "unsigned" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "poly", "type": "MPoly", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "loopstart", "type": "MLoop", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "vert", "type": "unsigned", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
ba139c654d327578ee2639fdc93c2ba49f011731
DemonRem/blender
source/blender/blenkernel/intern/mesh.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
poly_get_adj_loops_from_vert
int
int poly_get_adj_loops_from_vert(const MPoly *poly, const MLoop *mloop, unsigned int vert, unsigned int r_adj[2]) { int corner = poly_find_loop_from_vert(poly, &mloop[poly->loopstart], vert); if (corner != -1) { /* vertex was found */ r_adj[0] = ME_POLY_LOOP_PREV(mloop, poly, corner)->v; r_adj[1] = ME_POLY_LOOP_NEXT(mloop, poly, corner)->v; } return corner; }
/** * Fill \a r_adj with the loop indices in \a poly adjacent to the * vertex. Returns the index of the loop matching vertex, or -1 if the * vertex is not in \a poly */
Fill \a r_adj with the loop indices in \a poly adjacent to the vertex. Returns the index of the loop matching vertex, or -1 if the vertex is not in \a poly
[ "Fill", "\\", "a", "r_adj", "with", "the", "loop", "indices", "in", "\\", "a", "poly", "adjacent", "to", "the", "vertex", ".", "Returns", "the", "index", "of", "the", "loop", "matching", "vertex", "or", "-", "1", "if", "the", "vertex", "is", "not", "in", "\\", "a", "poly" ]
int poly_get_adj_loops_from_vert(const MPoly *poly, const MLoop *mloop, unsigned int vert, unsigned int r_adj[2]) { int corner = poly_find_loop_from_vert(poly, &mloop[poly->loopstart], vert); if (corner != -1) { r_adj[0] = ME_POLY_LOOP_PREV(mloop, poly, corner)->v; r_adj[1] = ME_POLY_LOOP_NEXT(mloop, poly, corner)->v; } return corner; }
[ "int", "poly_get_adj_loops_from_vert", "(", "const", "MPoly", "*", "poly", ",", "const", "MLoop", "*", "mloop", ",", "unsigned", "int", "vert", ",", "unsigned", "int", "r_adj", "[", "2", "]", ")", "{", "int", "corner", "=", "poly_find_loop_from_vert", "(", "poly", ",", "&", "mloop", "[", "poly", "->", "loopstart", "]", ",", "vert", ")", ";", "if", "(", "corner", "!=", "-1", ")", "{", "r_adj", "[", "0", "]", "=", "ME_POLY_LOOP_PREV", "(", "mloop", ",", "poly", ",", "corner", ")", "->", "v", ";", "r_adj", "[", "1", "]", "=", "ME_POLY_LOOP_NEXT", "(", "mloop", ",", "poly", ",", "corner", ")", "->", "v", ";", "}", "return", "corner", ";", "}" ]
Fill \a r_adj with the loop indices in \a poly adjacent to the vertex.
[ "Fill", "\\", "a", "r_adj", "with", "the", "loop", "indices", "in", "\\", "a", "poly", "adjacent", "to", "the", "vertex", "." ]
[ "/* vertex was found */" ]
[ { "param": "poly", "type": "MPoly" }, { "param": "mloop", "type": "MLoop" }, { "param": "vert", "type": "unsigned int" }, { "param": "r_adj", "type": "unsigned int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "poly", "type": "MPoly", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "mloop", "type": "MLoop", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "vert", "type": "unsigned int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "r_adj", "type": "unsigned int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
ba139c654d327578ee2639fdc93c2ba49f011731
DemonRem/blender
source/blender/blenkernel/intern/mesh.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BKE_mesh_edge_other_vert
int
int BKE_mesh_edge_other_vert(const MEdge *e, int v) { if (e->v1 == v) { return e->v2; } else if (e->v2 == v) { return e->v1; } else { return -1; } }
/** * Return the index of the edge vert that is not equal to \a v. If * neither edge vertex is equal to \a v, returns -1. */
Return the index of the edge vert that is not equal to \a v. If neither edge vertex is equal to \a v, returns -1.
[ "Return", "the", "index", "of", "the", "edge", "vert", "that", "is", "not", "equal", "to", "\\", "a", "v", ".", "If", "neither", "edge", "vertex", "is", "equal", "to", "\\", "a", "v", "returns", "-", "1", "." ]
int BKE_mesh_edge_other_vert(const MEdge *e, int v) { if (e->v1 == v) { return e->v2; } else if (e->v2 == v) { return e->v1; } else { return -1; } }
[ "int", "BKE_mesh_edge_other_vert", "(", "const", "MEdge", "*", "e", ",", "int", "v", ")", "{", "if", "(", "e", "->", "v1", "==", "v", ")", "{", "return", "e", "->", "v2", ";", "}", "else", "if", "(", "e", "->", "v2", "==", "v", ")", "{", "return", "e", "->", "v1", ";", "}", "else", "{", "return", "-1", ";", "}", "}" ]
Return the index of the edge vert that is not equal to \a v. If neither edge vertex is equal to \a v, returns -1.
[ "Return", "the", "index", "of", "the", "edge", "vert", "that", "is", "not", "equal", "to", "\\", "a", "v", ".", "If", "neither", "edge", "vertex", "is", "equal", "to", "\\", "a", "v", "returns", "-", "1", "." ]
[]
[ { "param": "e", "type": "MEdge" }, { "param": "v", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "e", "type": "MEdge", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "v", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
ba139c654d327578ee2639fdc93c2ba49f011731
DemonRem/blender
source/blender/blenkernel/intern/mesh.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BKE_mesh_looptri_get_real_edges
void
void BKE_mesh_looptri_get_real_edges(const Mesh *mesh, const MLoopTri *looptri, int r_edges[3]) { for (int i = 2, i_next = 0; i_next < 3; i = i_next++) { const MLoop *l1 = &mesh->mloop[looptri->tri[i]], *l2 = &mesh->mloop[looptri->tri[i_next]]; const MEdge *e = &mesh->medge[l1->e]; bool is_real = (l1->v == e->v1 && l2->v == e->v2) || (l1->v == e->v2 && l2->v == e->v1); r_edges[i] = is_real ? l1->e : -1; } }
/** * Sets each output array element to the edge index if it is a real edge, or -1. */
Sets each output array element to the edge index if it is a real edge, or -1.
[ "Sets", "each", "output", "array", "element", "to", "the", "edge", "index", "if", "it", "is", "a", "real", "edge", "or", "-", "1", "." ]
void BKE_mesh_looptri_get_real_edges(const Mesh *mesh, const MLoopTri *looptri, int r_edges[3]) { for (int i = 2, i_next = 0; i_next < 3; i = i_next++) { const MLoop *l1 = &mesh->mloop[looptri->tri[i]], *l2 = &mesh->mloop[looptri->tri[i_next]]; const MEdge *e = &mesh->medge[l1->e]; bool is_real = (l1->v == e->v1 && l2->v == e->v2) || (l1->v == e->v2 && l2->v == e->v1); r_edges[i] = is_real ? l1->e : -1; } }
[ "void", "BKE_mesh_looptri_get_real_edges", "(", "const", "Mesh", "*", "mesh", ",", "const", "MLoopTri", "*", "looptri", ",", "int", "r_edges", "[", "3", "]", ")", "{", "for", "(", "int", "i", "=", "2", ",", "i_next", "=", "0", ";", "i_next", "<", "3", ";", "i", "=", "i_next", "++", ")", "{", "const", "MLoop", "*", "l1", "=", "&", "mesh", "->", "mloop", "[", "looptri", "->", "tri", "[", "i", "]", "]", ",", "*", "l2", "=", "&", "mesh", "->", "mloop", "[", "looptri", "->", "tri", "[", "i_next", "]", "]", ";", "const", "MEdge", "*", "e", "=", "&", "mesh", "->", "medge", "[", "l1", "->", "e", "]", ";", "bool", "is_real", "=", "(", "l1", "->", "v", "==", "e", "->", "v1", "&&", "l2", "->", "v", "==", "e", "->", "v2", ")", "||", "(", "l1", "->", "v", "==", "e", "->", "v2", "&&", "l2", "->", "v", "==", "e", "->", "v1", ")", ";", "r_edges", "[", "i", "]", "=", "is_real", "?", "l1", "->", "e", ":", "-1", ";", "}", "}" ]
Sets each output array element to the edge index if it is a real edge, or -1.
[ "Sets", "each", "output", "array", "element", "to", "the", "edge", "index", "if", "it", "is", "a", "real", "edge", "or", "-", "1", "." ]
[]
[ { "param": "mesh", "type": "Mesh" }, { "param": "looptri", "type": "MLoopTri" }, { "param": "r_edges", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "mesh", "type": "Mesh", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "looptri", "type": "MLoopTri", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "r_edges", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
ba139c654d327578ee2639fdc93c2ba49f011731
DemonRem/blender
source/blender/blenkernel/intern/mesh.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BKE_mesh_mselect_clear
void
void BKE_mesh_mselect_clear(Mesh *me) { if (me->mselect) { MEM_freeN(me->mselect); me->mselect = NULL; } me->totselect = 0; }
/* -------------------------------------------------------------------- */ /* MSelect functions (currently used in weight paint mode) */
MSelect functions (currently used in weight paint mode)
[ "MSelect", "functions", "(", "currently", "used", "in", "weight", "paint", "mode", ")" ]
void BKE_mesh_mselect_clear(Mesh *me) { if (me->mselect) { MEM_freeN(me->mselect); me->mselect = NULL; } me->totselect = 0; }
[ "void", "BKE_mesh_mselect_clear", "(", "Mesh", "*", "me", ")", "{", "if", "(", "me", "->", "mselect", ")", "{", "MEM_freeN", "(", "me", "->", "mselect", ")", ";", "me", "->", "mselect", "=", "NULL", ";", "}", "me", "->", "totselect", "=", "0", ";", "}" ]
MSelect functions (currently used in weight paint mode)
[ "MSelect", "functions", "(", "currently", "used", "in", "weight", "paint", "mode", ")" ]
[]
[ { "param": "me", "type": "Mesh" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "me", "type": "Mesh", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
ba139c654d327578ee2639fdc93c2ba49f011731
DemonRem/blender
source/blender/blenkernel/intern/mesh.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BKE_mesh_mselect_active_get
int
int BKE_mesh_mselect_active_get(Mesh *me, int type) { BLI_assert(ELEM(type, ME_VSEL, ME_ESEL, ME_FSEL)); if (me->totselect) { if (me->mselect[me->totselect - 1].type == type) { return me->mselect[me->totselect - 1].index; } } return -1; }
/** * Return The index of the active element. */
Return The index of the active element.
[ "Return", "The", "index", "of", "the", "active", "element", "." ]
int BKE_mesh_mselect_active_get(Mesh *me, int type) { BLI_assert(ELEM(type, ME_VSEL, ME_ESEL, ME_FSEL)); if (me->totselect) { if (me->mselect[me->totselect - 1].type == type) { return me->mselect[me->totselect - 1].index; } } return -1; }
[ "int", "BKE_mesh_mselect_active_get", "(", "Mesh", "*", "me", ",", "int", "type", ")", "{", "BLI_assert", "(", "ELEM", "(", "type", ",", "ME_VSEL", ",", "ME_ESEL", ",", "ME_FSEL", ")", ")", ";", "if", "(", "me", "->", "totselect", ")", "{", "if", "(", "me", "->", "mselect", "[", "me", "->", "totselect", "-", "1", "]", ".", "type", "==", "type", ")", "{", "return", "me", "->", "mselect", "[", "me", "->", "totselect", "-", "1", "]", ".", "index", ";", "}", "}", "return", "-1", ";", "}" ]
Return The index of the active element.
[ "Return", "The", "index", "of", "the", "active", "element", "." ]
[]
[ { "param": "me", "type": "Mesh" }, { "param": "type", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "me", "type": "Mesh", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "type", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
ba139c654d327578ee2639fdc93c2ba49f011731
DemonRem/blender
source/blender/blenkernel/intern/mesh.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
split_faces_prepare_new_verts
int
static int split_faces_prepare_new_verts(const Mesh *mesh, MLoopNorSpaceArray *lnors_spacearr, SplitFaceNewVert **new_verts, MemArena *memarena) { /* This is now mandatory, trying to do the job in simple way without that data is doomed to fail, * even when only dealing with smooth/flat faces one can find cases that no simple algorithm * can handle properly. */ BLI_assert(lnors_spacearr != NULL); const int loops_len = mesh->totloop; int verts_len = mesh->totvert; MVert *mvert = mesh->mvert; MLoop *mloop = mesh->mloop; BLI_bitmap *verts_used = BLI_BITMAP_NEW(verts_len, __func__); BLI_bitmap *done_loops = BLI_BITMAP_NEW(loops_len, __func__); MLoop *ml = mloop; MLoopNorSpace **lnor_space = lnors_spacearr->lspacearr; BLI_assert(lnors_spacearr->data_type == MLNOR_SPACEARR_LOOP_INDEX); for (int loop_idx = 0; loop_idx < loops_len; loop_idx++, ml++, lnor_space++) { if (!BLI_BITMAP_TEST(done_loops, loop_idx)) { const int vert_idx = ml->v; const bool vert_used = BLI_BITMAP_TEST_BOOL(verts_used, vert_idx); /* If vert is already used by another smooth fan, we need a new vert for this one. */ const int new_vert_idx = vert_used ? verts_len++ : vert_idx; BLI_assert(*lnor_space); if ((*lnor_space)->flags & MLNOR_SPACE_IS_SINGLE) { /* Single loop in this fan... */ BLI_assert(POINTER_AS_INT((*lnor_space)->loops) == loop_idx); BLI_BITMAP_ENABLE(done_loops, loop_idx); if (vert_used) { ml->v = new_vert_idx; } } else { for (LinkNode *lnode = (*lnor_space)->loops; lnode; lnode = lnode->next) { const int ml_fan_idx = POINTER_AS_INT(lnode->link); BLI_BITMAP_ENABLE(done_loops, ml_fan_idx); if (vert_used) { mloop[ml_fan_idx].v = new_vert_idx; } } } if (!vert_used) { BLI_BITMAP_ENABLE(verts_used, vert_idx); /* We need to update that vertex's normal here, we won't go over it again. */ /* This is important! *DO NOT* set vnor to final computed lnor, * vnor should always be defined to 'automatic normal' value computed from its polys, * not some custom normal. * Fortunately, that's the loop normal space's 'lnor' reference vector. ;) */ normal_float_to_short_v3(mvert[vert_idx].no, (*lnor_space)->vec_lnor); } else { /* Add new vert to list. */ SplitFaceNewVert *new_vert = BLI_memarena_alloc(memarena, sizeof(*new_vert)); new_vert->orig_index = vert_idx; new_vert->new_index = new_vert_idx; new_vert->vnor = (*lnor_space)->vec_lnor; /* See note above. */ new_vert->next = *new_verts; *new_verts = new_vert; } } } MEM_freeN(done_loops); MEM_freeN(verts_used); return verts_len - mesh->totvert; }
/* Detect needed new vertices, and update accordingly loops' vertex indices. * WARNING! Leaves mesh in invalid state. */
Detect needed new vertices, and update accordingly loops' vertex indices. WARNING. Leaves mesh in invalid state.
[ "Detect", "needed", "new", "vertices", "and", "update", "accordingly", "loops", "'", "vertex", "indices", ".", "WARNING", ".", "Leaves", "mesh", "in", "invalid", "state", "." ]
static int split_faces_prepare_new_verts(const Mesh *mesh, MLoopNorSpaceArray *lnors_spacearr, SplitFaceNewVert **new_verts, MemArena *memarena) { BLI_assert(lnors_spacearr != NULL); const int loops_len = mesh->totloop; int verts_len = mesh->totvert; MVert *mvert = mesh->mvert; MLoop *mloop = mesh->mloop; BLI_bitmap *verts_used = BLI_BITMAP_NEW(verts_len, __func__); BLI_bitmap *done_loops = BLI_BITMAP_NEW(loops_len, __func__); MLoop *ml = mloop; MLoopNorSpace **lnor_space = lnors_spacearr->lspacearr; BLI_assert(lnors_spacearr->data_type == MLNOR_SPACEARR_LOOP_INDEX); for (int loop_idx = 0; loop_idx < loops_len; loop_idx++, ml++, lnor_space++) { if (!BLI_BITMAP_TEST(done_loops, loop_idx)) { const int vert_idx = ml->v; const bool vert_used = BLI_BITMAP_TEST_BOOL(verts_used, vert_idx); const int new_vert_idx = vert_used ? verts_len++ : vert_idx; BLI_assert(*lnor_space); if ((*lnor_space)->flags & MLNOR_SPACE_IS_SINGLE) { BLI_assert(POINTER_AS_INT((*lnor_space)->loops) == loop_idx); BLI_BITMAP_ENABLE(done_loops, loop_idx); if (vert_used) { ml->v = new_vert_idx; } } else { for (LinkNode *lnode = (*lnor_space)->loops; lnode; lnode = lnode->next) { const int ml_fan_idx = POINTER_AS_INT(lnode->link); BLI_BITMAP_ENABLE(done_loops, ml_fan_idx); if (vert_used) { mloop[ml_fan_idx].v = new_vert_idx; } } } if (!vert_used) { BLI_BITMAP_ENABLE(verts_used, vert_idx); normal_float_to_short_v3(mvert[vert_idx].no, (*lnor_space)->vec_lnor); } else { SplitFaceNewVert *new_vert = BLI_memarena_alloc(memarena, sizeof(*new_vert)); new_vert->orig_index = vert_idx; new_vert->new_index = new_vert_idx; new_vert->vnor = (*lnor_space)->vec_lnor; new_vert->next = *new_verts; *new_verts = new_vert; } } } MEM_freeN(done_loops); MEM_freeN(verts_used); return verts_len - mesh->totvert; }
[ "static", "int", "split_faces_prepare_new_verts", "(", "const", "Mesh", "*", "mesh", ",", "MLoopNorSpaceArray", "*", "lnors_spacearr", ",", "SplitFaceNewVert", "*", "*", "new_verts", ",", "MemArena", "*", "memarena", ")", "{", "BLI_assert", "(", "lnors_spacearr", "!=", "NULL", ")", ";", "const", "int", "loops_len", "=", "mesh", "->", "totloop", ";", "int", "verts_len", "=", "mesh", "->", "totvert", ";", "MVert", "*", "mvert", "=", "mesh", "->", "mvert", ";", "MLoop", "*", "mloop", "=", "mesh", "->", "mloop", ";", "BLI_bitmap", "*", "verts_used", "=", "BLI_BITMAP_NEW", "(", "verts_len", ",", "__func__", ")", ";", "BLI_bitmap", "*", "done_loops", "=", "BLI_BITMAP_NEW", "(", "loops_len", ",", "__func__", ")", ";", "MLoop", "*", "ml", "=", "mloop", ";", "MLoopNorSpace", "*", "*", "lnor_space", "=", "lnors_spacearr", "->", "lspacearr", ";", "BLI_assert", "(", "lnors_spacearr", "->", "data_type", "==", "MLNOR_SPACEARR_LOOP_INDEX", ")", ";", "for", "(", "int", "loop_idx", "=", "0", ";", "loop_idx", "<", "loops_len", ";", "loop_idx", "++", ",", "ml", "++", ",", "lnor_space", "++", ")", "{", "if", "(", "!", "BLI_BITMAP_TEST", "(", "done_loops", ",", "loop_idx", ")", ")", "{", "const", "int", "vert_idx", "=", "ml", "->", "v", ";", "const", "bool", "vert_used", "=", "BLI_BITMAP_TEST_BOOL", "(", "verts_used", ",", "vert_idx", ")", ";", "const", "int", "new_vert_idx", "=", "vert_used", "?", "verts_len", "++", ":", "vert_idx", ";", "BLI_assert", "(", "*", "lnor_space", ")", ";", "if", "(", "(", "*", "lnor_space", ")", "->", "flags", "&", "MLNOR_SPACE_IS_SINGLE", ")", "{", "BLI_assert", "(", "POINTER_AS_INT", "(", "(", "*", "lnor_space", ")", "->", "loops", ")", "==", "loop_idx", ")", ";", "BLI_BITMAP_ENABLE", "(", "done_loops", ",", "loop_idx", ")", ";", "if", "(", "vert_used", ")", "{", "ml", "->", "v", "=", "new_vert_idx", ";", "}", "}", "else", "{", "for", "(", "LinkNode", "*", "lnode", "=", "(", "*", "lnor_space", ")", "->", "loops", ";", "lnode", ";", "lnode", "=", "lnode", "->", "next", ")", "{", "const", "int", "ml_fan_idx", "=", "POINTER_AS_INT", "(", "lnode", "->", "link", ")", ";", "BLI_BITMAP_ENABLE", "(", "done_loops", ",", "ml_fan_idx", ")", ";", "if", "(", "vert_used", ")", "{", "mloop", "[", "ml_fan_idx", "]", ".", "v", "=", "new_vert_idx", ";", "}", "}", "}", "if", "(", "!", "vert_used", ")", "{", "BLI_BITMAP_ENABLE", "(", "verts_used", ",", "vert_idx", ")", ";", "normal_float_to_short_v3", "(", "mvert", "[", "vert_idx", "]", ".", "no", ",", "(", "*", "lnor_space", ")", "->", "vec_lnor", ")", ";", "}", "else", "{", "SplitFaceNewVert", "*", "new_vert", "=", "BLI_memarena_alloc", "(", "memarena", ",", "sizeof", "(", "*", "new_vert", ")", ")", ";", "new_vert", "->", "orig_index", "=", "vert_idx", ";", "new_vert", "->", "new_index", "=", "new_vert_idx", ";", "new_vert", "->", "vnor", "=", "(", "*", "lnor_space", ")", "->", "vec_lnor", ";", "new_vert", "->", "next", "=", "*", "new_verts", ";", "*", "new_verts", "=", "new_vert", ";", "}", "}", "}", "MEM_freeN", "(", "done_loops", ")", ";", "MEM_freeN", "(", "verts_used", ")", ";", "return", "verts_len", "-", "mesh", "->", "totvert", ";", "}" ]
Detect needed new vertices, and update accordingly loops' vertex indices.
[ "Detect", "needed", "new", "vertices", "and", "update", "accordingly", "loops", "'", "vertex", "indices", "." ]
[ "/* This is now mandatory, trying to do the job in simple way without that data is doomed to fail,\n * even when only dealing with smooth/flat faces one can find cases that no simple algorithm\n * can handle properly. */", "/* If vert is already used by another smooth fan, we need a new vert for this one. */", "/* Single loop in this fan... */", "/* We need to update that vertex's normal here, we won't go over it again. */", "/* This is important! *DO NOT* set vnor to final computed lnor,\n * vnor should always be defined to 'automatic normal' value computed from its polys,\n * not some custom normal.\n * Fortunately, that's the loop normal space's 'lnor' reference vector. ;) */", "/* Add new vert to list. */", "/* See note above. */" ]
[ { "param": "mesh", "type": "Mesh" }, { "param": "lnors_spacearr", "type": "MLoopNorSpaceArray" }, { "param": "new_verts", "type": "SplitFaceNewVert" }, { "param": "memarena", "type": "MemArena" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "mesh", "type": "Mesh", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lnors_spacearr", "type": "MLoopNorSpaceArray", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "new_verts", "type": "SplitFaceNewVert", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "memarena", "type": "MemArena", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
ba139c654d327578ee2639fdc93c2ba49f011731
DemonRem/blender
source/blender/blenkernel/intern/mesh.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
split_faces_prepare_new_edges
int
static int split_faces_prepare_new_edges(const Mesh *mesh, SplitFaceNewEdge **new_edges, MemArena *memarena) { const int num_polys = mesh->totpoly; int num_edges = mesh->totedge; MEdge *medge = mesh->medge; MLoop *mloop = mesh->mloop; const MPoly *mpoly = mesh->mpoly; BLI_bitmap *edges_used = BLI_BITMAP_NEW(num_edges, __func__); EdgeHash *edges_hash = BLI_edgehash_new_ex(__func__, num_edges); const MPoly *mp = mpoly; for (int poly_idx = 0; poly_idx < num_polys; poly_idx++, mp++) { MLoop *ml_prev = &mloop[mp->loopstart + mp->totloop - 1]; MLoop *ml = &mloop[mp->loopstart]; for (int loop_idx = 0; loop_idx < mp->totloop; loop_idx++, ml++) { void **eval; if (!BLI_edgehash_ensure_p(edges_hash, ml_prev->v, ml->v, &eval)) { const int edge_idx = ml_prev->e; /* That edge has not been encountered yet, define it. */ if (BLI_BITMAP_TEST(edges_used, edge_idx)) { /* Original edge has already been used, we need to define a new one. */ const int new_edge_idx = num_edges++; *eval = POINTER_FROM_INT(new_edge_idx); ml_prev->e = new_edge_idx; SplitFaceNewEdge *new_edge = BLI_memarena_alloc(memarena, sizeof(*new_edge)); new_edge->orig_index = edge_idx; new_edge->new_index = new_edge_idx; new_edge->v1 = ml_prev->v; new_edge->v2 = ml->v; new_edge->next = *new_edges; *new_edges = new_edge; } else { /* We can re-use original edge. */ medge[edge_idx].v1 = ml_prev->v; medge[edge_idx].v2 = ml->v; *eval = POINTER_FROM_INT(edge_idx); BLI_BITMAP_ENABLE(edges_used, edge_idx); } } else { /* Edge already known, just update loop's edge index. */ ml_prev->e = POINTER_AS_INT(*eval); } ml_prev = ml; } } MEM_freeN(edges_used); BLI_edgehash_free(edges_hash, NULL); return num_edges - mesh->totedge; }
/* Detect needed new edges, and update accordingly loops' edge indices. * WARNING! Leaves mesh in invalid state. */
Detect needed new edges, and update accordingly loops' edge indices. WARNING. Leaves mesh in invalid state.
[ "Detect", "needed", "new", "edges", "and", "update", "accordingly", "loops", "'", "edge", "indices", ".", "WARNING", ".", "Leaves", "mesh", "in", "invalid", "state", "." ]
static int split_faces_prepare_new_edges(const Mesh *mesh, SplitFaceNewEdge **new_edges, MemArena *memarena) { const int num_polys = mesh->totpoly; int num_edges = mesh->totedge; MEdge *medge = mesh->medge; MLoop *mloop = mesh->mloop; const MPoly *mpoly = mesh->mpoly; BLI_bitmap *edges_used = BLI_BITMAP_NEW(num_edges, __func__); EdgeHash *edges_hash = BLI_edgehash_new_ex(__func__, num_edges); const MPoly *mp = mpoly; for (int poly_idx = 0; poly_idx < num_polys; poly_idx++, mp++) { MLoop *ml_prev = &mloop[mp->loopstart + mp->totloop - 1]; MLoop *ml = &mloop[mp->loopstart]; for (int loop_idx = 0; loop_idx < mp->totloop; loop_idx++, ml++) { void **eval; if (!BLI_edgehash_ensure_p(edges_hash, ml_prev->v, ml->v, &eval)) { const int edge_idx = ml_prev->e; if (BLI_BITMAP_TEST(edges_used, edge_idx)) { const int new_edge_idx = num_edges++; *eval = POINTER_FROM_INT(new_edge_idx); ml_prev->e = new_edge_idx; SplitFaceNewEdge *new_edge = BLI_memarena_alloc(memarena, sizeof(*new_edge)); new_edge->orig_index = edge_idx; new_edge->new_index = new_edge_idx; new_edge->v1 = ml_prev->v; new_edge->v2 = ml->v; new_edge->next = *new_edges; *new_edges = new_edge; } else { medge[edge_idx].v1 = ml_prev->v; medge[edge_idx].v2 = ml->v; *eval = POINTER_FROM_INT(edge_idx); BLI_BITMAP_ENABLE(edges_used, edge_idx); } } else { ml_prev->e = POINTER_AS_INT(*eval); } ml_prev = ml; } } MEM_freeN(edges_used); BLI_edgehash_free(edges_hash, NULL); return num_edges - mesh->totedge; }
[ "static", "int", "split_faces_prepare_new_edges", "(", "const", "Mesh", "*", "mesh", ",", "SplitFaceNewEdge", "*", "*", "new_edges", ",", "MemArena", "*", "memarena", ")", "{", "const", "int", "num_polys", "=", "mesh", "->", "totpoly", ";", "int", "num_edges", "=", "mesh", "->", "totedge", ";", "MEdge", "*", "medge", "=", "mesh", "->", "medge", ";", "MLoop", "*", "mloop", "=", "mesh", "->", "mloop", ";", "const", "MPoly", "*", "mpoly", "=", "mesh", "->", "mpoly", ";", "BLI_bitmap", "*", "edges_used", "=", "BLI_BITMAP_NEW", "(", "num_edges", ",", "__func__", ")", ";", "EdgeHash", "*", "edges_hash", "=", "BLI_edgehash_new_ex", "(", "__func__", ",", "num_edges", ")", ";", "const", "MPoly", "*", "mp", "=", "mpoly", ";", "for", "(", "int", "poly_idx", "=", "0", ";", "poly_idx", "<", "num_polys", ";", "poly_idx", "++", ",", "mp", "++", ")", "{", "MLoop", "*", "ml_prev", "=", "&", "mloop", "[", "mp", "->", "loopstart", "+", "mp", "->", "totloop", "-", "1", "]", ";", "MLoop", "*", "ml", "=", "&", "mloop", "[", "mp", "->", "loopstart", "]", ";", "for", "(", "int", "loop_idx", "=", "0", ";", "loop_idx", "<", "mp", "->", "totloop", ";", "loop_idx", "++", ",", "ml", "++", ")", "{", "void", "*", "*", "eval", ";", "if", "(", "!", "BLI_edgehash_ensure_p", "(", "edges_hash", ",", "ml_prev", "->", "v", ",", "ml", "->", "v", ",", "&", "eval", ")", ")", "{", "const", "int", "edge_idx", "=", "ml_prev", "->", "e", ";", "if", "(", "BLI_BITMAP_TEST", "(", "edges_used", ",", "edge_idx", ")", ")", "{", "const", "int", "new_edge_idx", "=", "num_edges", "++", ";", "*", "eval", "=", "POINTER_FROM_INT", "(", "new_edge_idx", ")", ";", "ml_prev", "->", "e", "=", "new_edge_idx", ";", "SplitFaceNewEdge", "*", "new_edge", "=", "BLI_memarena_alloc", "(", "memarena", ",", "sizeof", "(", "*", "new_edge", ")", ")", ";", "new_edge", "->", "orig_index", "=", "edge_idx", ";", "new_edge", "->", "new_index", "=", "new_edge_idx", ";", "new_edge", "->", "v1", "=", "ml_prev", "->", "v", ";", "new_edge", "->", "v2", "=", "ml", "->", "v", ";", "new_edge", "->", "next", "=", "*", "new_edges", ";", "*", "new_edges", "=", "new_edge", ";", "}", "else", "{", "medge", "[", "edge_idx", "]", ".", "v1", "=", "ml_prev", "->", "v", ";", "medge", "[", "edge_idx", "]", ".", "v2", "=", "ml", "->", "v", ";", "*", "eval", "=", "POINTER_FROM_INT", "(", "edge_idx", ")", ";", "BLI_BITMAP_ENABLE", "(", "edges_used", ",", "edge_idx", ")", ";", "}", "}", "else", "{", "ml_prev", "->", "e", "=", "POINTER_AS_INT", "(", "*", "eval", ")", ";", "}", "ml_prev", "=", "ml", ";", "}", "}", "MEM_freeN", "(", "edges_used", ")", ";", "BLI_edgehash_free", "(", "edges_hash", ",", "NULL", ")", ";", "return", "num_edges", "-", "mesh", "->", "totedge", ";", "}" ]
Detect needed new edges, and update accordingly loops' edge indices.
[ "Detect", "needed", "new", "edges", "and", "update", "accordingly", "loops", "'", "edge", "indices", "." ]
[ "/* That edge has not been encountered yet, define it. */", "/* Original edge has already been used, we need to define a new one. */", "/* We can re-use original edge. */", "/* Edge already known, just update loop's edge index. */" ]
[ { "param": "mesh", "type": "Mesh" }, { "param": "new_edges", "type": "SplitFaceNewEdge" }, { "param": "memarena", "type": "MemArena" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "mesh", "type": "Mesh", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "new_edges", "type": "SplitFaceNewEdge", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "memarena", "type": "MemArena", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
ba139c654d327578ee2639fdc93c2ba49f011731
DemonRem/blender
source/blender/blenkernel/intern/mesh.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
split_faces_split_new_verts
void
static void split_faces_split_new_verts(Mesh *mesh, SplitFaceNewVert *new_verts, const int num_new_verts) { const int verts_len = mesh->totvert - num_new_verts; MVert *mvert = mesh->mvert; /* Remember new_verts is a single linklist, so its items are in reversed order... */ MVert *new_mv = &mvert[mesh->totvert - 1]; for (int i = mesh->totvert - 1; i >= verts_len; i--, new_mv--, new_verts = new_verts->next) { BLI_assert(new_verts->new_index == i); BLI_assert(new_verts->new_index != new_verts->orig_index); CustomData_copy_data(&mesh->vdata, &mesh->vdata, new_verts->orig_index, i, 1); if (new_verts->vnor) { normal_float_to_short_v3(new_mv->no, new_verts->vnor); } } }
/* Perform actual split of vertices. */
Perform actual split of vertices.
[ "Perform", "actual", "split", "of", "vertices", "." ]
static void split_faces_split_new_verts(Mesh *mesh, SplitFaceNewVert *new_verts, const int num_new_verts) { const int verts_len = mesh->totvert - num_new_verts; MVert *mvert = mesh->mvert; MVert *new_mv = &mvert[mesh->totvert - 1]; for (int i = mesh->totvert - 1; i >= verts_len; i--, new_mv--, new_verts = new_verts->next) { BLI_assert(new_verts->new_index == i); BLI_assert(new_verts->new_index != new_verts->orig_index); CustomData_copy_data(&mesh->vdata, &mesh->vdata, new_verts->orig_index, i, 1); if (new_verts->vnor) { normal_float_to_short_v3(new_mv->no, new_verts->vnor); } } }
[ "static", "void", "split_faces_split_new_verts", "(", "Mesh", "*", "mesh", ",", "SplitFaceNewVert", "*", "new_verts", ",", "const", "int", "num_new_verts", ")", "{", "const", "int", "verts_len", "=", "mesh", "->", "totvert", "-", "num_new_verts", ";", "MVert", "*", "mvert", "=", "mesh", "->", "mvert", ";", "MVert", "*", "new_mv", "=", "&", "mvert", "[", "mesh", "->", "totvert", "-", "1", "]", ";", "for", "(", "int", "i", "=", "mesh", "->", "totvert", "-", "1", ";", "i", ">=", "verts_len", ";", "i", "--", ",", "new_mv", "--", ",", "new_verts", "=", "new_verts", "->", "next", ")", "{", "BLI_assert", "(", "new_verts", "->", "new_index", "==", "i", ")", ";", "BLI_assert", "(", "new_verts", "->", "new_index", "!=", "new_verts", "->", "orig_index", ")", ";", "CustomData_copy_data", "(", "&", "mesh", "->", "vdata", ",", "&", "mesh", "->", "vdata", ",", "new_verts", "->", "orig_index", ",", "i", ",", "1", ")", ";", "if", "(", "new_verts", "->", "vnor", ")", "{", "normal_float_to_short_v3", "(", "new_mv", "->", "no", ",", "new_verts", "->", "vnor", ")", ";", "}", "}", "}" ]
Perform actual split of vertices.
[ "Perform", "actual", "split", "of", "vertices", "." ]
[ "/* Remember new_verts is a single linklist, so its items are in reversed order... */" ]
[ { "param": "mesh", "type": "Mesh" }, { "param": "new_verts", "type": "SplitFaceNewVert" }, { "param": "num_new_verts", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "mesh", "type": "Mesh", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "new_verts", "type": "SplitFaceNewVert", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "num_new_verts", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
ba139c654d327578ee2639fdc93c2ba49f011731
DemonRem/blender
source/blender/blenkernel/intern/mesh.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
split_faces_split_new_edges
void
static void split_faces_split_new_edges(Mesh *mesh, SplitFaceNewEdge *new_edges, const int num_new_edges) { const int num_edges = mesh->totedge - num_new_edges; MEdge *medge = mesh->medge; /* Remember new_edges is a single linklist, so its items are in reversed order... */ MEdge *new_med = &medge[mesh->totedge - 1]; for (int i = mesh->totedge - 1; i >= num_edges; i--, new_med--, new_edges = new_edges->next) { BLI_assert(new_edges->new_index == i); BLI_assert(new_edges->new_index != new_edges->orig_index); CustomData_copy_data(&mesh->edata, &mesh->edata, new_edges->orig_index, i, 1); new_med->v1 = new_edges->v1; new_med->v2 = new_edges->v2; } }
/* Perform actual split of edges. */
Perform actual split of edges.
[ "Perform", "actual", "split", "of", "edges", "." ]
static void split_faces_split_new_edges(Mesh *mesh, SplitFaceNewEdge *new_edges, const int num_new_edges) { const int num_edges = mesh->totedge - num_new_edges; MEdge *medge = mesh->medge; MEdge *new_med = &medge[mesh->totedge - 1]; for (int i = mesh->totedge - 1; i >= num_edges; i--, new_med--, new_edges = new_edges->next) { BLI_assert(new_edges->new_index == i); BLI_assert(new_edges->new_index != new_edges->orig_index); CustomData_copy_data(&mesh->edata, &mesh->edata, new_edges->orig_index, i, 1); new_med->v1 = new_edges->v1; new_med->v2 = new_edges->v2; } }
[ "static", "void", "split_faces_split_new_edges", "(", "Mesh", "*", "mesh", ",", "SplitFaceNewEdge", "*", "new_edges", ",", "const", "int", "num_new_edges", ")", "{", "const", "int", "num_edges", "=", "mesh", "->", "totedge", "-", "num_new_edges", ";", "MEdge", "*", "medge", "=", "mesh", "->", "medge", ";", "MEdge", "*", "new_med", "=", "&", "medge", "[", "mesh", "->", "totedge", "-", "1", "]", ";", "for", "(", "int", "i", "=", "mesh", "->", "totedge", "-", "1", ";", "i", ">=", "num_edges", ";", "i", "--", ",", "new_med", "--", ",", "new_edges", "=", "new_edges", "->", "next", ")", "{", "BLI_assert", "(", "new_edges", "->", "new_index", "==", "i", ")", ";", "BLI_assert", "(", "new_edges", "->", "new_index", "!=", "new_edges", "->", "orig_index", ")", ";", "CustomData_copy_data", "(", "&", "mesh", "->", "edata", ",", "&", "mesh", "->", "edata", ",", "new_edges", "->", "orig_index", ",", "i", ",", "1", ")", ";", "new_med", "->", "v1", "=", "new_edges", "->", "v1", ";", "new_med", "->", "v2", "=", "new_edges", "->", "v2", ";", "}", "}" ]
Perform actual split of edges.
[ "Perform", "actual", "split", "of", "edges", "." ]
[ "/* Remember new_edges is a single linklist, so its items are in reversed order... */" ]
[ { "param": "mesh", "type": "Mesh" }, { "param": "new_edges", "type": "SplitFaceNewEdge" }, { "param": "num_new_edges", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "mesh", "type": "Mesh", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "new_edges", "type": "SplitFaceNewEdge", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "num_new_edges", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
ba139c654d327578ee2639fdc93c2ba49f011731
DemonRem/blender
source/blender/blenkernel/intern/mesh.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BKE_mesh_split_faces
void
void BKE_mesh_split_faces(Mesh *mesh, bool free_loop_normals) { const int num_polys = mesh->totpoly; if (num_polys == 0) { return; } BKE_mesh_tessface_clear(mesh); MLoopNorSpaceArray lnors_spacearr = {NULL}; /* Compute loop normals and loop normal spaces (a.k.a. smooth fans of faces around vertices). */ BKE_mesh_calc_normals_split_ex(mesh, &lnors_spacearr); /* Stealing memarena from loop normals space array. */ MemArena *memarena = lnors_spacearr.mem; SplitFaceNewVert *new_verts = NULL; SplitFaceNewEdge *new_edges = NULL; /* Detect loop normal spaces (a.k.a. smooth fans) that will need a new vert. */ const int num_new_verts = split_faces_prepare_new_verts( mesh, &lnors_spacearr, &new_verts, memarena); if (num_new_verts > 0) { /* Reminder: beyond this point, there is no way out, mesh is in invalid state * (due to early-reassignment of loops' vertex and edge indices to new, * to-be-created split ones). */ const int num_new_edges = split_faces_prepare_new_edges(mesh, &new_edges, memarena); /* We can have to split a vertex without having to add a single new edge... */ const bool do_edges = (num_new_edges > 0); /* Reallocate all vert and edge related data. */ mesh->totvert += num_new_verts; CustomData_realloc(&mesh->vdata, mesh->totvert); if (do_edges) { mesh->totedge += num_new_edges; CustomData_realloc(&mesh->edata, mesh->totedge); } /* Update pointers to a newly allocated memory. */ BKE_mesh_update_customdata_pointers(mesh, false); /* Perform actual split of vertices and edges. */ split_faces_split_new_verts(mesh, new_verts, num_new_verts); if (do_edges) { split_faces_split_new_edges(mesh, new_edges, num_new_edges); } } /* Note: after this point mesh is expected to be valid again. */ /* CD_NORMAL is expected to be temporary only. */ if (free_loop_normals) { CustomData_free_layers(&mesh->ldata, CD_NORMAL, mesh->totloop); } /* Also frees new_verts/edges temp data, since we used its memarena to allocate them. */ BKE_lnor_spacearr_free(&lnors_spacearr); #ifdef VALIDATE_MESH BKE_mesh_validate(mesh, true, true); #endif }
/* Split faces based on the edge angle and loop normals. * Matches behavior of face splitting in render engines. * * NOTE: Will leave CD_NORMAL loop data layer which is * used by render engines to set shading up. */
Split faces based on the edge angle and loop normals. Matches behavior of face splitting in render engines. Will leave CD_NORMAL loop data layer which is used by render engines to set shading up.
[ "Split", "faces", "based", "on", "the", "edge", "angle", "and", "loop", "normals", ".", "Matches", "behavior", "of", "face", "splitting", "in", "render", "engines", ".", "Will", "leave", "CD_NORMAL", "loop", "data", "layer", "which", "is", "used", "by", "render", "engines", "to", "set", "shading", "up", "." ]
void BKE_mesh_split_faces(Mesh *mesh, bool free_loop_normals) { const int num_polys = mesh->totpoly; if (num_polys == 0) { return; } BKE_mesh_tessface_clear(mesh); MLoopNorSpaceArray lnors_spacearr = {NULL}; BKE_mesh_calc_normals_split_ex(mesh, &lnors_spacearr); MemArena *memarena = lnors_spacearr.mem; SplitFaceNewVert *new_verts = NULL; SplitFaceNewEdge *new_edges = NULL; const int num_new_verts = split_faces_prepare_new_verts( mesh, &lnors_spacearr, &new_verts, memarena); if (num_new_verts > 0) { const int num_new_edges = split_faces_prepare_new_edges(mesh, &new_edges, memarena); const bool do_edges = (num_new_edges > 0); mesh->totvert += num_new_verts; CustomData_realloc(&mesh->vdata, mesh->totvert); if (do_edges) { mesh->totedge += num_new_edges; CustomData_realloc(&mesh->edata, mesh->totedge); } BKE_mesh_update_customdata_pointers(mesh, false); split_faces_split_new_verts(mesh, new_verts, num_new_verts); if (do_edges) { split_faces_split_new_edges(mesh, new_edges, num_new_edges); } } if (free_loop_normals) { CustomData_free_layers(&mesh->ldata, CD_NORMAL, mesh->totloop); } BKE_lnor_spacearr_free(&lnors_spacearr); #ifdef VALIDATE_MESH BKE_mesh_validate(mesh, true, true); #endif }
[ "void", "BKE_mesh_split_faces", "(", "Mesh", "*", "mesh", ",", "bool", "free_loop_normals", ")", "{", "const", "int", "num_polys", "=", "mesh", "->", "totpoly", ";", "if", "(", "num_polys", "==", "0", ")", "{", "return", ";", "}", "BKE_mesh_tessface_clear", "(", "mesh", ")", ";", "MLoopNorSpaceArray", "lnors_spacearr", "=", "{", "NULL", "}", ";", "BKE_mesh_calc_normals_split_ex", "(", "mesh", ",", "&", "lnors_spacearr", ")", ";", "MemArena", "*", "memarena", "=", "lnors_spacearr", ".", "mem", ";", "SplitFaceNewVert", "*", "new_verts", "=", "NULL", ";", "SplitFaceNewEdge", "*", "new_edges", "=", "NULL", ";", "const", "int", "num_new_verts", "=", "split_faces_prepare_new_verts", "(", "mesh", ",", "&", "lnors_spacearr", ",", "&", "new_verts", ",", "memarena", ")", ";", "if", "(", "num_new_verts", ">", "0", ")", "{", "const", "int", "num_new_edges", "=", "split_faces_prepare_new_edges", "(", "mesh", ",", "&", "new_edges", ",", "memarena", ")", ";", "const", "bool", "do_edges", "=", "(", "num_new_edges", ">", "0", ")", ";", "mesh", "->", "totvert", "+=", "num_new_verts", ";", "CustomData_realloc", "(", "&", "mesh", "->", "vdata", ",", "mesh", "->", "totvert", ")", ";", "if", "(", "do_edges", ")", "{", "mesh", "->", "totedge", "+=", "num_new_edges", ";", "CustomData_realloc", "(", "&", "mesh", "->", "edata", ",", "mesh", "->", "totedge", ")", ";", "}", "BKE_mesh_update_customdata_pointers", "(", "mesh", ",", "false", ")", ";", "split_faces_split_new_verts", "(", "mesh", ",", "new_verts", ",", "num_new_verts", ")", ";", "if", "(", "do_edges", ")", "{", "split_faces_split_new_edges", "(", "mesh", ",", "new_edges", ",", "num_new_edges", ")", ";", "}", "}", "if", "(", "free_loop_normals", ")", "{", "CustomData_free_layers", "(", "&", "mesh", "->", "ldata", ",", "CD_NORMAL", ",", "mesh", "->", "totloop", ")", ";", "}", "BKE_lnor_spacearr_free", "(", "&", "lnors_spacearr", ")", ";", "#ifdef", "VALIDATE_MESH", "BKE_mesh_validate", "(", "mesh", ",", "true", ",", "true", ")", ";", "#endif", "}" ]
Split faces based on the edge angle and loop normals.
[ "Split", "faces", "based", "on", "the", "edge", "angle", "and", "loop", "normals", "." ]
[ "/* Compute loop normals and loop normal spaces (a.k.a. smooth fans of faces around vertices). */", "/* Stealing memarena from loop normals space array. */", "/* Detect loop normal spaces (a.k.a. smooth fans) that will need a new vert. */", "/* Reminder: beyond this point, there is no way out, mesh is in invalid state\n * (due to early-reassignment of loops' vertex and edge indices to new,\n * to-be-created split ones). */", "/* We can have to split a vertex without having to add a single new edge... */", "/* Reallocate all vert and edge related data. */", "/* Update pointers to a newly allocated memory. */", "/* Perform actual split of vertices and edges. */", "/* Note: after this point mesh is expected to be valid again. */", "/* CD_NORMAL is expected to be temporary only. */", "/* Also frees new_verts/edges temp data, since we used its memarena to allocate them. */" ]
[ { "param": "mesh", "type": "Mesh" }, { "param": "free_loop_normals", "type": "bool" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "mesh", "type": "Mesh", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "free_loop_normals", "type": "bool", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f70c5bb99d6622ca57e5b0c40b12cbb6af9ba997
DemonRem/blender
source/blender/blenkernel/intern/camera.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BKE_camera_copy_data
void
void BKE_camera_copy_data(Main *UNUSED(bmain), Camera *cam_dst, const Camera *cam_src, const int UNUSED(flag)) { BLI_duplicatelist(&cam_dst->bg_images, &cam_src->bg_images); }
/** * Only copy internal data of Camera ID from source * to already allocated/initialized destination. * You probably never want to use that directly, * use #BKE_id_copy or #BKE_id_copy_ex for typical needs. * * WARNING! This function will not handle ID user count! * * \param flag: Copying options (see BKE_library.h's LIB_ID_COPY_... flags for more). */
Only copy internal data of Camera ID from source to already allocated/initialized destination. You probably never want to use that directly, use #BKE_id_copy or #BKE_id_copy_ex for typical needs. WARNING. This function will not handle ID user count! \param flag: Copying options .
[ "Only", "copy", "internal", "data", "of", "Camera", "ID", "from", "source", "to", "already", "allocated", "/", "initialized", "destination", ".", "You", "probably", "never", "want", "to", "use", "that", "directly", "use", "#BKE_id_copy", "or", "#BKE_id_copy_ex", "for", "typical", "needs", ".", "WARNING", ".", "This", "function", "will", "not", "handle", "ID", "user", "count!", "\\", "param", "flag", ":", "Copying", "options", "." ]
void BKE_camera_copy_data(Main *UNUSED(bmain), Camera *cam_dst, const Camera *cam_src, const int UNUSED(flag)) { BLI_duplicatelist(&cam_dst->bg_images, &cam_src->bg_images); }
[ "void", "BKE_camera_copy_data", "(", "Main", "*", "UNUSED", "(", "bmain", ")", ",", "Camera", "*", "cam_dst", ",", "const", "Camera", "*", "cam_src", ",", "const", "int", "UNUSED", "(", "flag", ")", ")", "{", "BLI_duplicatelist", "(", "&", "cam_dst", "->", "bg_images", ",", "&", "cam_src", "->", "bg_images", ")", ";", "}" ]
Only copy internal data of Camera ID from source to already allocated/initialized destination.
[ "Only", "copy", "internal", "data", "of", "Camera", "ID", "from", "source", "to", "already", "allocated", "/", "initialized", "destination", "." ]
[]
[ { "param": "UNUSED", "type": "int" }, { "param": "cam_dst", "type": "Camera" }, { "param": "cam_src", "type": "Camera" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "UNUSED", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "cam_dst", "type": "Camera", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "cam_src", "type": "Camera", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f70c5bb99d6622ca57e5b0c40b12cbb6af9ba997
DemonRem/blender
source/blender/blenkernel/intern/camera.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BKE_camera_free
void
void BKE_camera_free(Camera *ca) { BLI_freelistN(&ca->bg_images); BKE_animdata_free((ID *)ca, false); }
/** Free (or release) any data used by this camera (does not free the camera itself). */
Free (or release) any data used by this camera (does not free the camera itself).
[ "Free", "(", "or", "release", ")", "any", "data", "used", "by", "this", "camera", "(", "does", "not", "free", "the", "camera", "itself", ")", "." ]
void BKE_camera_free(Camera *ca) { BLI_freelistN(&ca->bg_images); BKE_animdata_free((ID *)ca, false); }
[ "void", "BKE_camera_free", "(", "Camera", "*", "ca", ")", "{", "BLI_freelistN", "(", "&", "ca", "->", "bg_images", ")", ";", "BKE_animdata_free", "(", "(", "ID", "*", ")", "ca", ",", "false", ")", ";", "}" ]
Free (or release) any data used by this camera (does not free the camera itself).
[ "Free", "(", "or", "release", ")", "any", "data", "used", "by", "this", "camera", "(", "does", "not", "free", "the", "camera", "itself", ")", "." ]
[]
[ { "param": "ca", "type": "Camera" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ca", "type": "Camera", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f70c5bb99d6622ca57e5b0c40b12cbb6af9ba997
DemonRem/blender
source/blender/blenkernel/intern/camera.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BKE_camera_view_frame_fit_to_scene
bool
bool BKE_camera_view_frame_fit_to_scene( Depsgraph *depsgraph, Scene *scene, Object *camera_ob, float r_co[3], float *r_scale) { CameraParams params; CameraViewFrameData data_cb; /* just in case */ *r_scale = 1.0f; camera_frame_fit_data_init(scene, camera_ob, &params, &data_cb); /* run callback on all visible points */ BKE_scene_foreach_display_point(depsgraph, camera_to_frame_view_cb, &data_cb); return camera_frame_fit_calc_from_data(&params, &data_cb, r_co, r_scale); }
/* don't move the camera, just yield the fit location */ /* r_scale only valid/useful for ortho cameras */
don't move the camera, just yield the fit location r_scale only valid/useful for ortho cameras
[ "don", "'", "t", "move", "the", "camera", "just", "yield", "the", "fit", "location", "r_scale", "only", "valid", "/", "useful", "for", "ortho", "cameras" ]
bool BKE_camera_view_frame_fit_to_scene( Depsgraph *depsgraph, Scene *scene, Object *camera_ob, float r_co[3], float *r_scale) { CameraParams params; CameraViewFrameData data_cb; *r_scale = 1.0f; camera_frame_fit_data_init(scene, camera_ob, &params, &data_cb); BKE_scene_foreach_display_point(depsgraph, camera_to_frame_view_cb, &data_cb); return camera_frame_fit_calc_from_data(&params, &data_cb, r_co, r_scale); }
[ "bool", "BKE_camera_view_frame_fit_to_scene", "(", "Depsgraph", "*", "depsgraph", ",", "Scene", "*", "scene", ",", "Object", "*", "camera_ob", ",", "float", "r_co", "[", "3", "]", ",", "float", "*", "r_scale", ")", "{", "CameraParams", "params", ";", "CameraViewFrameData", "data_cb", ";", "*", "r_scale", "=", "1.0f", ";", "camera_frame_fit_data_init", "(", "scene", ",", "camera_ob", ",", "&", "params", ",", "&", "data_cb", ")", ";", "BKE_scene_foreach_display_point", "(", "depsgraph", ",", "camera_to_frame_view_cb", ",", "&", "data_cb", ")", ";", "return", "camera_frame_fit_calc_from_data", "(", "&", "params", ",", "&", "data_cb", ",", "r_co", ",", "r_scale", ")", ";", "}" ]
don't move the camera, just yield the fit location r_scale only valid/useful for ortho cameras
[ "don", "'", "t", "move", "the", "camera", "just", "yield", "the", "fit", "location", "r_scale", "only", "valid", "/", "useful", "for", "ortho", "cameras" ]
[ "/* just in case */", "/* run callback on all visible points */" ]
[ { "param": "depsgraph", "type": "Depsgraph" }, { "param": "scene", "type": "Scene" }, { "param": "camera_ob", "type": "Object" }, { "param": "r_co", "type": "float" }, { "param": "r_scale", "type": "float" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "depsgraph", "type": "Depsgraph", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "scene", "type": "Scene", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "camera_ob", "type": "Object", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "r_co", "type": "float", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "r_scale", "type": "float", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f70c5bb99d6622ca57e5b0c40b12cbb6af9ba997
DemonRem/blender
source/blender/blenkernel/intern/camera.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BKE_camera_multiview_view_matrix
void
void BKE_camera_multiview_view_matrix(RenderData *rd, const Object *camera, const bool is_left, float r_viewmat[4][4]) { BKE_camera_multiview_model_matrix( rd, camera, is_left ? STEREO_LEFT_NAME : STEREO_RIGHT_NAME, r_viewmat); invert_m4(r_viewmat); }
/* the view matrix is used by the viewport drawing, it is basically the inverted model matrix */
the view matrix is used by the viewport drawing, it is basically the inverted model matrix
[ "the", "view", "matrix", "is", "used", "by", "the", "viewport", "drawing", "it", "is", "basically", "the", "inverted", "model", "matrix" ]
void BKE_camera_multiview_view_matrix(RenderData *rd, const Object *camera, const bool is_left, float r_viewmat[4][4]) { BKE_camera_multiview_model_matrix( rd, camera, is_left ? STEREO_LEFT_NAME : STEREO_RIGHT_NAME, r_viewmat); invert_m4(r_viewmat); }
[ "void", "BKE_camera_multiview_view_matrix", "(", "RenderData", "*", "rd", ",", "const", "Object", "*", "camera", ",", "const", "bool", "is_left", ",", "float", "r_viewmat", "[", "4", "]", "[", "4", "]", ")", "{", "BKE_camera_multiview_model_matrix", "(", "rd", ",", "camera", ",", "is_left", "?", "STEREO_LEFT_NAME", ":", "STEREO_RIGHT_NAME", ",", "r_viewmat", ")", ";", "invert_m4", "(", "r_viewmat", ")", ";", "}" ]
the view matrix is used by the viewport drawing, it is basically the inverted model matrix
[ "the", "view", "matrix", "is", "used", "by", "the", "viewport", "drawing", "it", "is", "basically", "the", "inverted", "model", "matrix" ]
[]
[ { "param": "rd", "type": "RenderData" }, { "param": "camera", "type": "Object" }, { "param": "is_left", "type": "bool" }, { "param": "r_viewmat", "type": "float" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "rd", "type": "RenderData", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "camera", "type": "Object", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "is_left", "type": "bool", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "r_viewmat", "type": "float", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f70c5bb99d6622ca57e5b0c40b12cbb6af9ba997
DemonRem/blender
source/blender/blenkernel/intern/camera.c
[ "Naumen", "Condor-1.1", "MS-PL" ]
C
BKE_camera_multiview_render
Object
Object *BKE_camera_multiview_render(Scene *scene, Object *camera, const char *viewname) { const bool is_multiview = (camera != NULL) && (scene->r.scemode & R_MULTIVIEW) != 0; if (!is_multiview) { return camera; } else if (scene->r.views_format == SCE_VIEWS_FORMAT_STEREO_3D) { return camera; } else { /* SCE_VIEWS_FORMAT_MULTIVIEW */ const char *suffix = BKE_scene_multiview_view_suffix_get(&scene->r, viewname); return camera_multiview_advanced(scene, camera, suffix); } }
/* returns the camera to be used for render */
returns the camera to be used for render
[ "returns", "the", "camera", "to", "be", "used", "for", "render" ]
Object *BKE_camera_multiview_render(Scene *scene, Object *camera, const char *viewname) { const bool is_multiview = (camera != NULL) && (scene->r.scemode & R_MULTIVIEW) != 0; if (!is_multiview) { return camera; } else if (scene->r.views_format == SCE_VIEWS_FORMAT_STEREO_3D) { return camera; } else { const char *suffix = BKE_scene_multiview_view_suffix_get(&scene->r, viewname); return camera_multiview_advanced(scene, camera, suffix); } }
[ "Object", "*", "BKE_camera_multiview_render", "(", "Scene", "*", "scene", ",", "Object", "*", "camera", ",", "const", "char", "*", "viewname", ")", "{", "const", "bool", "is_multiview", "=", "(", "camera", "!=", "NULL", ")", "&&", "(", "scene", "->", "r", ".", "scemode", "&", "R_MULTIVIEW", ")", "!=", "0", ";", "if", "(", "!", "is_multiview", ")", "{", "return", "camera", ";", "}", "else", "if", "(", "scene", "->", "r", ".", "views_format", "==", "SCE_VIEWS_FORMAT_STEREO_3D", ")", "{", "return", "camera", ";", "}", "else", "{", "const", "char", "*", "suffix", "=", "BKE_scene_multiview_view_suffix_get", "(", "&", "scene", "->", "r", ",", "viewname", ")", ";", "return", "camera_multiview_advanced", "(", "scene", ",", "camera", ",", "suffix", ")", ";", "}", "}" ]
returns the camera to be used for render
[ "returns", "the", "camera", "to", "be", "used", "for", "render" ]
[ "/* SCE_VIEWS_FORMAT_MULTIVIEW */" ]
[ { "param": "scene", "type": "Scene" }, { "param": "camera", "type": "Object" }, { "param": "viewname", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "scene", "type": "Scene", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "camera", "type": "Object", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "viewname", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }