本文整理汇总了C++中BLI_findstring函数的典型用法代码示例。如果您正苦于以下问题:C++ BLI_findstring函数的具体用法?C++ BLI_findstring怎么用?C++ BLI_findstring使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BLI_findstring函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: screen_render_scene_layer_set
static void screen_render_scene_layer_set(wmOperator *op, Main *mainp, Scene **scene, SceneRenderLayer **srl)
{
/* single layer re-render */
if (RNA_struct_property_is_set(op->ptr, "scene")) {
Scene *scn;
char scene_name[MAX_ID_NAME - 2];
RNA_string_get(op->ptr, "scene", scene_name);
scn = (Scene *)BLI_findstring(&mainp->scene, scene_name, offsetof(ID, name) + 2);
if (scn) {
/* camera switch wont have updated */
scn->r.cfra = (*scene)->r.cfra;
BKE_scene_camera_switch_update(scn);
*scene = scn;
}
}
if (RNA_struct_property_is_set(op->ptr, "layer")) {
SceneRenderLayer *rl;
char rl_name[RE_MAXNAME];
RNA_string_get(op->ptr, "layer", rl_name);
rl = (SceneRenderLayer *)BLI_findstring(&(*scene)->r.layers, rl_name, offsetof(SceneRenderLayer, name));
if (rl)
*srl = rl;
}
}
开发者ID:JasonWilkins,项目名称:blender-wayland,代码行数:30,代码来源:render_internal.c
示例2: workspace_add_menu
static void workspace_add_menu(bContext *C, uiLayout *layout, void *template_v)
{
Main *bmain = CTX_data_main(C);
const char *app_template = template_v;
bool has_startup_items = false;
wmOperatorType *ot_append = WM_operatortype_find("WORKSPACE_OT_append_activate", true);
WorkspaceConfigFileData *startup_config = workspace_config_file_read(app_template);
WorkspaceConfigFileData *builtin_config = workspace_system_file_read(app_template);
if (startup_config) {
for (WorkSpace *workspace = startup_config->workspaces.first; workspace;
workspace = workspace->id.next) {
uiLayout *row = uiLayoutRow(layout, false);
if (BLI_findstring(&bmain->workspaces, workspace->id.name, offsetof(ID, name))) {
uiLayoutSetActive(row, false);
}
workspace_append_button(row, ot_append, workspace, startup_config->main);
has_startup_items = true;
}
}
if (builtin_config) {
bool has_title = false;
for (WorkSpace *workspace = builtin_config->workspaces.first; workspace;
workspace = workspace->id.next) {
if (startup_config &&
BLI_findstring(&startup_config->workspaces, workspace->id.name, offsetof(ID, name))) {
continue;
}
if (!has_title) {
if (has_startup_items) {
uiItemS(layout);
}
has_title = true;
}
uiLayout *row = uiLayoutRow(layout, false);
if (BLI_findstring(&bmain->workspaces, workspace->id.name, offsetof(ID, name))) {
uiLayoutSetActive(row, false);
}
workspace_append_button(row, ot_append, workspace, builtin_config->main);
}
}
if (startup_config) {
BKE_blendfile_workspace_config_data_free(startup_config);
}
if (builtin_config) {
BKE_blendfile_workspace_config_data_free(builtin_config);
}
}
开发者ID:dfelinto,项目名称:blender,代码行数:56,代码来源:workspace_edit.c
示例3: RE_RenderResult_is_stereo
bool RE_RenderResult_is_stereo(RenderResult *res)
{
if (! BLI_findstring(&res->views, STEREO_LEFT_NAME, offsetof(RenderView, name)))
return false;
if (! BLI_findstring(&res->views, STEREO_RIGHT_NAME, offsetof(RenderView, name)))
return false;
return true;
}
开发者ID:sntulix,项目名称:blender-api-javascript,代码行数:10,代码来源:render_result.c
示例4: workspace_append_activate_exec
static int workspace_append_activate_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
char idname[MAX_ID_NAME - 2], filepath[FILE_MAX];
if (!RNA_struct_property_is_set(op->ptr, "idname") ||
!RNA_struct_property_is_set(op->ptr, "filepath")) {
return OPERATOR_CANCELLED;
}
RNA_string_get(op->ptr, "idname", idname);
RNA_string_get(op->ptr, "filepath", filepath);
if (workspace_append(C, filepath, idname) != OPERATOR_CANCELLED) {
WorkSpace *appended_workspace = BLI_findstring(
&bmain->workspaces, idname, offsetof(ID, name) + 2);
BLI_assert(appended_workspace != NULL);
if (appended_workspace) {
/* Reorder to last position. */
BKE_id_reorder(&bmain->workspaces, &appended_workspace->id, NULL, true);
/* Changing workspace changes context. Do delayed! */
WM_event_add_notifier(C, NC_SCREEN | ND_WORKSPACE_SET, appended_workspace);
return OPERATOR_FINISHED;
}
}
return OPERATOR_CANCELLED;
}
开发者ID:dfelinto,项目名称:blender,代码行数:30,代码来源:workspace_edit.c
示例5: wm_file_read_report
void wm_file_read_report(bContext *C)
{
ReportList *reports = NULL;
Scene *sce;
for (sce = G.main->scene.first; sce; sce = sce->id.next) {
if (sce->r.engine[0] &&
BLI_findstring(&R_engines, sce->r.engine, offsetof(RenderEngineType, idname)) == NULL)
{
if (reports == NULL) {
reports = CTX_wm_reports(C);
}
BKE_reportf(reports, RPT_ERROR,
"Engine '%s' not available for scene '%s' "
"(an addon may need to be installed or enabled)",
sce->r.engine, sce->id.name + 2);
}
}
if (reports) {
if (!G.background) {
WM_report_banner_show();
}
}
}
开发者ID:ChunHungLiu,项目名称:blender,代码行数:26,代码来源:wm_files.c
示例6: set_engine
static int set_engine(int argc, const char **argv, void *data)
{
bContext *C = data;
if (argc >= 2) {
if (!strcmp(argv[1], "help")) {
RenderEngineType *type = NULL;
printf("Blender Engine Listing:\n");
for (type = R_engines.first; type; type = type->next) {
printf("\t%s\n", type->idname);
}
exit(0);
}
else {
Scene *scene = CTX_data_scene(C);
if (scene) {
RenderData *rd = &scene->r;
if (BLI_findstring(&R_engines, argv[1], offsetof(RenderEngineType, idname))) {
BLI_strncpy_utf8(rd->engine, argv[1], sizeof(rd->engine));
}
}
else {
printf("\nError: no blend loaded. order the arguments so '-E / --engine ' is after a blend is loaded.\n");
}
}
return 1;
}
else {
printf("\nEngine not specified, give 'help' for a list of available engines.\n");
return 0;
}
}
开发者ID:JasonWilkins,项目名称:blender-wayland,代码行数:33,代码来源:creator.c
示例7: MEM_callocN
static void *ml_addview_cb(void *base, const char *str)
{
RenderResult *rr = base;
RenderView *rv;
rv = MEM_callocN(sizeof(RenderView), "new render view");
BLI_strncpy(rv->name, str, EXR_VIEW_MAXNAME);
/* For stereo drawing we need to ensure:
* STEREO_LEFT_NAME == STEREO_LEFT_ID and
* STEREO_RIGHT_NAME == STEREO_RIGHT_ID */
if (STREQ(str, STEREO_LEFT_NAME)) {
BLI_addhead(&rr->views, rv);
}
else if (STREQ(str, STEREO_RIGHT_NAME)) {
RenderView *left_rv = BLI_findstring(&rr->views, STEREO_LEFT_NAME, offsetof(RenderView, name));
if (left_rv == NULL) {
BLI_addhead(&rr->views, rv);
}
else {
BLI_insertlinkafter(&rr->views, left_rv, rv);
}
}
else {
BLI_addtail(&rr->views, rv);
}
return rv;
}
开发者ID:sntulix,项目名称:blender-api-javascript,代码行数:31,代码来源:render_result.c
示例8: BLI_findstring
/* Find a group with the given name */
bActionGroup *BKE_action_group_find_name(bAction *act, const char name[])
{
/* sanity checks */
if (ELEM(NULL, act, act->groups.first, name) || (name[0] == 0))
return NULL;
/* do string comparisons */
return BLI_findstring(&act->groups, name, offsetof(bActionGroup, name));
}
开发者ID:UPBGE,项目名称:blender,代码行数:10,代码来源:action.c
示例9: BLI_findstring
/* Find KeyingSet type info given a name */
KeyingSetInfo *ANIM_keyingset_info_find_name(const char name[])
{
/* sanity checks */
if ((name == NULL) || (name[0] == 0))
return NULL;
/* search by comparing names */
return BLI_findstring(&keyingset_type_infos, name, offsetof(KeyingSetInfo, idname));
}
开发者ID:castlelore,项目名称:blender-git,代码行数:10,代码来源:keyingsets.c
示例10: BLI_findstring
RenderEngineType *RE_engines_find(const char *idname)
{
RenderEngineType *type;
type = BLI_findstring(&R_engines, idname, offsetof(RenderEngineType, idname));
if (!type)
type = &internal_render_type;
return type;
}
开发者ID:akonneker,项目名称:blensor,代码行数:10,代码来源:external_engine.c
示例11:
Scene *KX_BlenderSceneConverter::GetBlenderSceneForName(const STR_String &name)
{
Scene *sce;
/**
* Find the specified scene by name, or NULL if nothing matches.
*/
if ((sce = (Scene *)BLI_findstring(&m_maggie->scene, name.ReadPtr(), offsetof(ID, name) + 2)))
return sce;
for (vector<Main *>::iterator it=m_DynamicMaggie.begin(); !(it == m_DynamicMaggie.end()); it++) {
Main *main = *it;
if ((sce= (Scene *)BLI_findstring(&main->scene, name.ReadPtr(), offsetof(ID, name) + 2)))
return sce;
}
return NULL;
}
开发者ID:sadmansk,项目名称:blender,代码行数:19,代码来源:KX_BlenderSceneConverter.cpp
示例12: BLI_ghash_lookup
/**
* Return a pointer to the pose channel of the given name
* from this pose.
*/
bPoseChannel *BKE_pose_channel_find_name(const bPose *pose, const char *name)
{
if (ELEM(NULL, pose, name) || (name[0] == '\0'))
return NULL;
if (pose->chanhash)
return BLI_ghash_lookup(pose->chanhash, (const void *)name);
return BLI_findstring(&((const bPose *)pose)->chanbase, name, offsetof(bPoseChannel, name));
}
开发者ID:UPBGE,项目名称:blender,代码行数:14,代码来源:action.c
示例13: view3d_ruler_to_gpencil
static bool view3d_ruler_to_gpencil(bContext *C, RulerInfo *ruler_info)
{
Scene *scene = CTX_data_scene(C);
bGPDlayer *gpl;
bGPDframe *gpf;
bGPDstroke *gps;
RulerItem *ruler_item;
const char *ruler_name = RULER_ID;
bool changed = false;
if (scene->gpd == NULL) {
scene->gpd = gpencil_data_addnew("GPencil");
}
gpl = BLI_findstring(&scene->gpd->layers, ruler_name, offsetof(bGPDlayer, info));
if (gpl == NULL) {
gpl = gpencil_layer_addnew(scene->gpd, ruler_name, false);
gpl->thickness = 1;
gpl->flag |= GP_LAYER_HIDE;
}
gpf = gpencil_layer_getframe(gpl, CFRA, true);
free_gpencil_strokes(gpf);
for (ruler_item = ruler_info->items.first; ruler_item; ruler_item = ruler_item->next) {
bGPDspoint *pt;
int j;
/* allocate memory for a new stroke */
gps = MEM_callocN(sizeof(bGPDstroke), "gp_stroke");
if (ruler_item->flag & RULERITEM_USE_ANGLE) {
gps->totpoints = 3;
pt = gps->points = MEM_callocN(sizeof(bGPDspoint) * gps->totpoints, "gp_stroke_points");
for (j = 0; j < 3; j++) {
copy_v3_v3(&pt->x, ruler_item->co[j]);
pt->pressure = 1.0f;
pt++;
}
}
else {
gps->totpoints = 2;
pt = gps->points = MEM_callocN(sizeof(bGPDspoint) * gps->totpoints, "gp_stroke_points");
for (j = 0; j < 3; j += 2) {
copy_v3_v3(&pt->x, ruler_item->co[j]);
pt->pressure = 1.0f;
pt++;
}
}
gps->flag = GP_STROKE_3DSPACE;
BLI_addtail(&gpf->strokes, gps);
changed = true;
}
return changed;
}
开发者ID:SuriyaaKudoIsc,项目名称:blender-git,代码行数:55,代码来源:view3d_ruler.c
示例14: printf
PyObject *bpy_text_reimport(PyObject *module, int *found)
{
Text *text;
const char *name;
char *filepath;
char *buf = NULL;
//XXX Main *maggie = bpy_import_main ? bpy_import_main:G.main;
Main *maggie = bpy_import_main;
if (!maggie) {
printf("ERROR: bpy_import_main_set() was not called before running python. this is a bug.\n");
return NULL;
}
*found = 0;
/* get name, filename from the module itself */
if ((name = PyModule_GetName(module)) == NULL)
return NULL;
if ((filepath = (char *)PyModule_GetFilename(module)) == NULL)
return NULL;
/* look up the text object */
text = BLI_findstring(&maggie->text, BLI_path_basename(filepath), offsetof(ID, name) + 2);
/* uh-oh.... didn't find it */
if (!text)
return NULL;
else
*found = 1;
/* if previously compiled, free the object */
/* (can't see how could be NULL, but check just in case) */
if (text->compiled) {
Py_DECREF((PyObject *)text->compiled);
}
/* compile the buffer */
buf = txt_to_buf(text);
text->compiled = Py_CompileString(buf, text->id.name + 2, Py_file_input);
MEM_freeN(buf);
/* if compile failed.... return this error */
if (PyErr_Occurred()) {
PyErr_Print();
PyErr_Clear();
PySys_SetObject("last_traceback", NULL);
free_compiled_text(text);
return NULL;
}
/* make into a module */
return PyImport_ExecCodeModule((char *)name, text->compiled);
}
开发者ID:244xiao,项目名称:blender,代码行数:55,代码来源:bpy_internal_import.c
示例15: BLI_findstring
/* XXX: read a style configure */
uiStyle *UI_style_get(void)
{
#if 0
uiStyle *style = NULL;
/* offset is two struct uiStyle pointers */
style = BLI_findstring(&U.uistyles, "Unifont Style", sizeof(style) * 2);
return (style != NULL) ? style : U.uistyles.first;
#else
return U.uistyles.first;
#endif
}
开发者ID:flair2005,项目名称:mechanical-blender,代码行数:12,代码来源:interface_style.c
示例16: RNA_string_get
static bActuator *edit_actuator_property_get(bContext *C, wmOperator *op, Object **ob)
{
char actuator_name[MAX_NAME];
bActuator *act;
RNA_string_get(op->ptr, "actuator", actuator_name);
*ob = edit_object_property_get(C, op);
if (!*ob) return NULL;
act = BLI_findstring(&((*ob)->actuators), actuator_name, offsetof(bActuator, name));
return act;
}
开发者ID:244xiao,项目名称:blender,代码行数:13,代码来源:logic_ops.c
示例17: BKE_copybuffer_paste
/* return success (1) */
int BKE_copybuffer_paste(bContext *C, const char *libname, const short flag, ReportList *reports)
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
View3D *v3d = CTX_wm_view3d(C);
Main *mainl = NULL;
Library *lib;
BlendHandle *bh;
bh = BLO_blendhandle_from_file(libname, reports);
if (bh == NULL) {
/* error reports will have been made by BLO_blendhandle_from_file() */
return 0;
}
BKE_scene_base_deselect_all(scene);
/* tag everything, all untagged data can be made local
* its also generally useful to know what is new
*
* take extra care BKE_main_id_flag_all(bmain, LIB_TAG_PRE_EXISTING, false) is called after! */
BKE_main_id_flag_all(bmain, LIB_TAG_PRE_EXISTING, true);
/* here appending/linking starts */
mainl = BLO_library_link_begin(bmain, &bh, libname);
BLO_library_link_all(mainl, bh, flag, scene, v3d);
BLO_library_link_end(mainl, &bh, flag, scene, v3d);
/* mark all library linked objects to be updated */
BKE_main_lib_objects_recalc_all(bmain);
IMB_colormanagement_check_file_config(bmain);
/* append, rather than linking */
lib = BLI_findstring(&bmain->library, libname, offsetof(Library, filepath));
BKE_library_make_local(bmain, lib, true, false);
/* important we unset, otherwise these object wont
* link into other scenes from this blend file */
BKE_main_id_flag_all(bmain, LIB_TAG_PRE_EXISTING, false);
/* recreate dependency graph to include new objects */
DAG_relations_tag_update(bmain);
BLO_blendhandle_close(bh);
/* remove library... */
return 1;
}
开发者ID:Brachi,项目名称:blender,代码行数:52,代码来源:blender.c
示例18: data_dir_add
static void data_dir_add(ListBase *lb, const char *member)
{
LinkData *link;
if(strcmp(member, "scene") == 0) /* exception */
return;
if(BLI_findstring(lb, member, offsetof(LinkData, data)))
return;
link= MEM_callocN(sizeof(LinkData), "LinkData");
link->data= (void*)member;
BLI_addtail(lb, link);
}
开发者ID:BHCLL,项目名称:blendocv,代码行数:14,代码来源:context.c
示例19: unpackImage
int unpackImage(ReportList *reports, Image *ima, int how)
{
int ret_value = RET_ERROR;
if (ima != NULL) {
while (ima->packedfiles.last) {
char localname[FILE_MAX], absname[FILE_MAX];
char *newname;
ImagePackedFile *imapf = ima->packedfiles.last;
unpack_generate_paths(imapf->filepath, (ID *)ima, absname, localname, sizeof(absname), sizeof(localname));
newname = unpackFile(reports, absname, localname, imapf->packedfile, how);
if (newname != NULL) {
ImageView *iv;
ret_value = ret_value == RET_ERROR ? RET_ERROR : RET_OK;
freePackedFile(imapf->packedfile);
imapf->packedfile = NULL;
/* update the new corresponding view filepath */
iv = BLI_findstring(&ima->views, imapf->filepath, offsetof(ImageView, filepath));
if (iv) {
BLI_strncpy(iv->filepath, newname, sizeof(imapf->filepath));
}
/* keep the new name in the image for non-pack specific reasons */
if (how != PF_REMOVE) {
BLI_strncpy(ima->name, newname, sizeof(imapf->filepath));
}
MEM_freeN(newname);
}
else {
ret_value = RET_ERROR;
}
BLI_remlink(&ima->packedfiles, imapf);
MEM_freeN(imapf);
}
}
if (ret_value == RET_OK) {
BKE_image_signal(ima, NULL, IMA_SIGNAL_RELOAD);
}
return(ret_value);
}
开发者ID:Bforartists,项目名称:Bforartists,代码行数:47,代码来源:packedFile.c
示例20: printf
PyObject *bpy_text_reimport(PyObject *module, int *found)
{
Text *text;
const char *name;
const char *filepath;
//XXX Main *maggie = bpy_import_main ? bpy_import_main:G.main;
Main *maggie = bpy_import_main;
if (!maggie) {
printf("ERROR: bpy_import_main_set() was not called before running python. this is a bug.\n");
return NULL;
}
*found = 0;
/* get name, filename from the module itself */
if ((name = PyModule_GetName(module)) == NULL)
return NULL;
{
PyObject *module_file = PyModule_GetFilenameObject(module);
if (module_file == NULL) {
return NULL;
}
filepath = _PyUnicode_AsString(module_file);
Py_DECREF(module_file);
if (filepath == NULL) {
return NULL;
}
}
/* look up the text object */
text = BLI_findstring(&maggie->text, BLI_path_basename(filepath), offsetof(ID, name) + 2);
/* uh-oh.... didn't find it */
if (!text)
return NULL;
else
*found = 1;
if (bpy_text_compile(text) == false) {
return NULL;
}
/* make into a module */
return PyImport_ExecCodeModule(name, text->compiled);
}
开发者ID:mgschwan,项目名称:blensor,代码行数:47,代码来源:bpy_internal_import.c
注:本文中的BLI_findstring函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论