forked from bartvdbraak/blender
replace strncpy with BLI_strncpy, in some cases strncpy was being misused since it doesnt ensure \0 termination.
also dont call CTX_data_scene() twice when checking for function arguments.
This commit is contained in:
parent
e897c8e83e
commit
58587a3881
@ -158,7 +158,7 @@ void BLF_lang_set(const char *str)
|
||||
char *s;
|
||||
|
||||
/* store defaul locale */
|
||||
strncpy(default_locale, env_language, sizeof(default_locale));
|
||||
BLI_strncpy(default_locale, env_language, sizeof(default_locale));
|
||||
|
||||
/* use first language as default */
|
||||
s= strchr(default_locale, ':');
|
||||
|
@ -270,7 +270,7 @@ bActionGroup *action_groups_add_new (bAction *act, const char name[])
|
||||
|
||||
/* make it selected, with default name */
|
||||
agrp->flag = AGRP_SELECTED;
|
||||
strncpy(agrp->name, name[0] ? name : "Group", sizeof(agrp->name));
|
||||
BLI_strncpy(agrp->name, name[0] ? name : "Group", sizeof(agrp->name));
|
||||
|
||||
/* add to action, and validate */
|
||||
BLI_addtail(&act->groups, agrp);
|
||||
|
@ -518,7 +518,7 @@ void BKE_write_undo(bContext *C, const char *name)
|
||||
|
||||
/* make new */
|
||||
curundo= uel= MEM_callocN(sizeof(UndoElem), "undo file");
|
||||
strncpy(uel->name, name, MAXUNDONAME-1);
|
||||
BLI_strncpy(uel->name, name, sizeof(uel->name));
|
||||
BLI_addtail(&undobase, uel);
|
||||
|
||||
/* and limit amount to the maximum */
|
||||
|
@ -1103,7 +1103,7 @@ static void fcurve_add_to_list (ListBase *groups, ListBase *list, FCurve *fcu, c
|
||||
agrp->flag = AGRP_SELECTED;
|
||||
if (muteipo) agrp->flag |= AGRP_MUTED;
|
||||
|
||||
strncpy(agrp->name, grpname, sizeof(agrp->name));
|
||||
BLI_strncpy(agrp->name, grpname, sizeof(agrp->name));
|
||||
|
||||
BLI_addtail(&tmp_act.groups, agrp);
|
||||
BLI_uniquename(&tmp_act.groups, agrp, "Group", '.', offsetof(bActionGroup, name), sizeof(agrp->name));
|
||||
|
@ -1445,10 +1445,10 @@ KeyBlock *add_keyblock(Key *key, const char *name)
|
||||
|
||||
tot= BLI_countlist(&key->block);
|
||||
if(name) {
|
||||
strncpy(kb->name, name, sizeof(kb->name));
|
||||
BLI_strncpy(kb->name, name, sizeof(kb->name));
|
||||
} else {
|
||||
if(tot==1) strcpy(kb->name, "Basis");
|
||||
else sprintf(kb->name, "Key %d", tot-1);
|
||||
if(tot==1) BLI_strncpy(kb->name, "Basis", sizeof(kb->name));
|
||||
else BLI_snprintf(kb->name, sizeof(kb->name), "Key %d", tot-1);
|
||||
}
|
||||
|
||||
BLI_uniquename(&key->block, kb, "Key", '.', offsetof(KeyBlock, name), sizeof(kb->name));
|
||||
|
@ -1682,7 +1682,7 @@ void node_type_size(struct bNodeType *ntype, int width, int minwidth, int maxwid
|
||||
void node_type_storage(bNodeType *ntype, const char *storagename, void (*freestoragefunc)(struct bNode *), void (*copystoragefunc)(struct bNode *, struct bNode *))
|
||||
{
|
||||
if (storagename)
|
||||
strncpy(ntype->storagename, storagename, sizeof(ntype->storagename));
|
||||
BLI_strncpy(ntype->storagename, storagename, sizeof(ntype->storagename));
|
||||
else
|
||||
ntype->storagename[0] = '\0';
|
||||
ntype->copystoragefunc = copystoragefunc;
|
||||
|
@ -41,6 +41,7 @@
|
||||
|
||||
#include "BLI_math.h" /* windows needs for M_PI */
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_sequence_types.h"
|
||||
@ -177,7 +178,7 @@ static void open_plugin_seq(PluginSeq *pis, const char *seqname)
|
||||
MEM_freeN(info);
|
||||
|
||||
cp= BLI_dynlib_find_symbol(pis->handle, "seqname");
|
||||
if(cp) strncpy(cp, seqname, 21);
|
||||
if(cp) BLI_strncpy(cp, seqname, 21);
|
||||
} else {
|
||||
printf ("Plugin returned unrecognized version number\n");
|
||||
return;
|
||||
@ -203,7 +204,7 @@ static PluginSeq *add_plugin_seq(const char *str, const char *seqname)
|
||||
|
||||
pis= MEM_callocN(sizeof(PluginSeq), "PluginSeq");
|
||||
|
||||
strncpy(pis->name, str, FILE_MAXDIR+FILE_MAXFILE);
|
||||
BLI_strncpy(pis->name, str, FILE_MAX);
|
||||
open_plugin_seq(pis, seqname);
|
||||
|
||||
if(pis->doit==NULL) {
|
||||
|
@ -3653,7 +3653,7 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
|
||||
calc_sequence_disp(scene, seq);
|
||||
|
||||
/* last active name */
|
||||
strncpy(ed->act_sounddir, strip->dir, FILE_MAXDIR-1);
|
||||
BLI_strncpy(ed->act_sounddir, strip->dir, FILE_MAXDIR);
|
||||
|
||||
seq_load_apply(scene, seq, seq_load);
|
||||
|
||||
|
@ -516,7 +516,7 @@ static Main *blo_find_main(FileData *fd, ListBase *mainlist, const char *filepat
|
||||
BLI_addtail(mainlist, m);
|
||||
|
||||
lib= alloc_libblock(&m->library, ID_LI, "lib");
|
||||
strncpy(lib->name, filepath, sizeof(lib->name)-1);
|
||||
BLI_strncpy(lib->name, filepath, sizeof(lib->name));
|
||||
BLI_strncpy(lib->filepath, name1, sizeof(lib->filepath));
|
||||
|
||||
m->curlib= lib;
|
||||
@ -5614,7 +5614,7 @@ static void fix_relpaths_library(const char *basepath, Main *main)
|
||||
* link into an unsaved blend file. See [#27405].
|
||||
* The remap relative option will make it relative again on save - campbell */
|
||||
if (strncmp(lib->name, "//", 2)==0) {
|
||||
strncpy(lib->name, lib->filepath, sizeof(lib->name));
|
||||
BLI_strncpy(lib->name, lib->filepath, sizeof(lib->name));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5623,7 +5623,7 @@ static void fix_relpaths_library(const char *basepath, Main *main)
|
||||
/* Libraries store both relative and abs paths, recreate relative paths,
|
||||
* relative to the blend file since indirectly linked libs will be relative to their direct linked library */
|
||||
if (strncmp(lib->name, "//", 2)==0) { /* if this is relative to begin with? */
|
||||
strncpy(lib->name, lib->filepath, sizeof(lib->name));
|
||||
BLI_strncpy(lib->name, lib->filepath, sizeof(lib->name));
|
||||
BLI_path_rel(lib->name, basepath);
|
||||
}
|
||||
}
|
||||
@ -12240,7 +12240,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
|
||||
bfd->main->versionfile= fd->fileversion;
|
||||
|
||||
bfd->type= BLENFILETYPE_BLEND;
|
||||
strncpy(bfd->main->name, filepath, sizeof(bfd->main->name)-1);
|
||||
BLI_strncpy(bfd->main->name, filepath, sizeof(bfd->main->name));
|
||||
|
||||
while(bhead) {
|
||||
switch(bhead->code) {
|
||||
|
@ -993,7 +993,7 @@ static void poselib_preview_apply (bContext *C, wmOperator *op)
|
||||
memcpy(&tempstr[index+1], &pld->searchstr[index], 64-index);
|
||||
}
|
||||
else {
|
||||
strncpy(tempstr, pld->searchstr, 64);
|
||||
BLI_strncpy(tempstr, pld->searchstr, sizeof(tempstr));
|
||||
}
|
||||
|
||||
/* get marker name */
|
||||
|
@ -3918,7 +3918,7 @@ void PE_undo_push(Scene *scene, const char *str)
|
||||
|
||||
/* make new */
|
||||
edit->curundo= undo= MEM_callocN(sizeof(PTCacheUndo), "particle undo file");
|
||||
strncpy(undo->name, str, 64-1);
|
||||
BLI_strncpy(undo->name, str, sizeof(undo->name));
|
||||
BLI_addtail(&edit->undo, undo);
|
||||
|
||||
/* and limit amount to the maximum */
|
||||
|
@ -34,6 +34,7 @@
|
||||
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "DNA_userdef_types.h"
|
||||
|
||||
@ -106,7 +107,7 @@ static void undo_stack_push_begin(UndoStack *stack, const char *name, UndoRestor
|
||||
BLI_addtail(&stack->elems, uel);
|
||||
|
||||
/* name can be a dynamic string */
|
||||
strncpy(uel->name, name, MAXUNDONAME-1);
|
||||
BLI_strncpy(uel->name, name, sizeof(uel->name));
|
||||
|
||||
/* limit amount to the maximum amount*/
|
||||
nr= 0;
|
||||
|
@ -169,11 +169,11 @@ static void UNUSED_FUNCTION(select_single_seq)(Scene *scene, Sequence *seq, int
|
||||
|
||||
if((seq->type==SEQ_IMAGE) || (seq->type==SEQ_MOVIE)) {
|
||||
if(seq->strip)
|
||||
strncpy(ed->act_imagedir, seq->strip->dir, FILE_MAXDIR-1);
|
||||
BLI_strncpy(ed->act_imagedir, seq->strip->dir, FILE_MAXDIR);
|
||||
}
|
||||
else if(seq->type==SEQ_SOUND) {
|
||||
if(seq->strip)
|
||||
strncpy(ed->act_sounddir, seq->strip->dir, FILE_MAXDIR-1);
|
||||
BLI_strncpy(ed->act_sounddir, seq->strip->dir, FILE_MAXDIR);
|
||||
}
|
||||
seq->flag|= SELECT;
|
||||
recurs_sel_seq(seq);
|
||||
@ -389,12 +389,12 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
|
||||
if ((seq->type == SEQ_IMAGE) || (seq->type == SEQ_MOVIE)) {
|
||||
if(seq->strip) {
|
||||
strncpy(ed->act_imagedir, seq->strip->dir, FILE_MAXDIR-1);
|
||||
BLI_strncpy(ed->act_imagedir, seq->strip->dir, FILE_MAXDIR);
|
||||
}
|
||||
} else
|
||||
if (seq->type == SEQ_SOUND) {
|
||||
if(seq->strip) {
|
||||
strncpy(ed->act_sounddir, seq->strip->dir, FILE_MAXDIR-1);
|
||||
BLI_strncpy(ed->act_sounddir, seq->strip->dir, FILE_MAXDIR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1421,8 +1421,7 @@ static void draw_suggestion_list(SpaceText *st, ARegion *ar)
|
||||
|
||||
y -= st->lheight;
|
||||
|
||||
strncpy(str, item->name, SUGG_LIST_WIDTH);
|
||||
str[SUGG_LIST_WIDTH] = '\0';
|
||||
BLI_strncpy(str, item->name, SUGG_LIST_WIDTH);
|
||||
|
||||
w = text_font_width(st, str);
|
||||
|
||||
|
@ -142,7 +142,7 @@ void undo_editmode_push(bContext *C, const char *name,
|
||||
|
||||
/* make new */
|
||||
curundo= uel= MEM_callocN(sizeof(UndoElem), "undo editmode");
|
||||
strncpy(uel->name, name, MAXUNDONAME-1);
|
||||
BLI_strncpy(uel->name, name, sizeof(uel->name));
|
||||
BLI_addtail(&undobase, uel);
|
||||
|
||||
uel->getdata= getdata;
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "DNA_mesh_types.h"
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
|
||||
#include "BKE_cdderivedmesh.h"
|
||||
@ -70,7 +71,7 @@ static void copyData(ModifierData *md, ModifierData *target)
|
||||
tamd->object = amd->object;
|
||||
tamd->deformflag = amd->deformflag;
|
||||
tamd->multi = amd->multi;
|
||||
strncpy(tamd->defgrp_name, amd->defgrp_name, 32);
|
||||
BLI_strncpy(tamd->defgrp_name, amd->defgrp_name, 32);
|
||||
}
|
||||
|
||||
static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md))
|
||||
|
@ -72,7 +72,7 @@ static void copyData(ModifierData *md, ModifierData *target)
|
||||
tbmd->lim_flags = bmd->lim_flags;
|
||||
tbmd->e_flags = bmd->e_flags;
|
||||
tbmd->bevel_angle = bmd->bevel_angle;
|
||||
strncpy(tbmd->defgrp_name, bmd->defgrp_name, 32);
|
||||
BLI_strncpy(tbmd->defgrp_name, bmd->defgrp_name, 32);
|
||||
}
|
||||
|
||||
static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
|
||||
|
@ -40,6 +40,7 @@
|
||||
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
|
||||
#include "BKE_deform.h"
|
||||
@ -77,7 +78,7 @@ static void copyData(ModifierData *md, ModifierData *target)
|
||||
tcmd->flag = cmd->flag;
|
||||
tcmd->type = cmd->type;
|
||||
tcmd->object = cmd->object;
|
||||
strncpy(tcmd->defgrp_name, cmd->defgrp_name, 32);
|
||||
BLI_strncpy(tcmd->defgrp_name, cmd->defgrp_name, 32);
|
||||
}
|
||||
|
||||
static int isDisabled(ModifierData *md, int UNUSED(useRenderParams))
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "DNA_object_types.h"
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
|
||||
#include "BKE_cdderivedmesh.h"
|
||||
@ -65,7 +66,7 @@ static void copyData(ModifierData *md, ModifierData *target)
|
||||
|
||||
tcmd->defaxis = cmd->defaxis;
|
||||
tcmd->object = cmd->object;
|
||||
strncpy(tcmd->name, cmd->name, 32);
|
||||
BLI_strncpy(tcmd->name, cmd->name, 32);
|
||||
}
|
||||
|
||||
static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
|
||||
|
@ -40,6 +40,7 @@
|
||||
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
|
||||
#include "BKE_cdderivedmesh.h"
|
||||
@ -75,11 +76,11 @@ static void copyData(ModifierData *md, ModifierData *target)
|
||||
tdmd->texture = dmd->texture;
|
||||
tdmd->strength = dmd->strength;
|
||||
tdmd->direction = dmd->direction;
|
||||
strncpy(tdmd->defgrp_name, dmd->defgrp_name, 32);
|
||||
BLI_strncpy(tdmd->defgrp_name, dmd->defgrp_name, 32);
|
||||
tdmd->midlevel = dmd->midlevel;
|
||||
tdmd->texmapping = dmd->texmapping;
|
||||
tdmd->map_object = dmd->map_object;
|
||||
strncpy(tdmd->uvlayer_name, dmd->uvlayer_name, 32);
|
||||
BLI_strncpy(tdmd->uvlayer_name, dmd->uvlayer_name, 32);
|
||||
}
|
||||
|
||||
static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
|
||||
|
@ -41,6 +41,7 @@
|
||||
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "BKE_action.h"
|
||||
#include "BKE_cdderivedmesh.h"
|
||||
@ -72,8 +73,8 @@ static void copyData(ModifierData *md, ModifierData *target)
|
||||
thmd->totindex = hmd->totindex;
|
||||
thmd->indexar = MEM_dupallocN(hmd->indexar);
|
||||
memcpy(thmd->parentinv, hmd->parentinv, sizeof(hmd->parentinv));
|
||||
strncpy(thmd->name, hmd->name, 32);
|
||||
strncpy(thmd->subtarget, hmd->subtarget, 32);
|
||||
BLI_strncpy(thmd->name, hmd->name, 32);
|
||||
BLI_strncpy(thmd->subtarget, hmd->subtarget, 32);
|
||||
}
|
||||
|
||||
static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "DNA_object_types.h"
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
|
||||
#include "BKE_cdderivedmesh.h"
|
||||
@ -57,7 +58,7 @@ static void copyData(ModifierData *md, ModifierData *target)
|
||||
LatticeModifierData *tlmd = (LatticeModifierData*) target;
|
||||
|
||||
tlmd->object = lmd->object;
|
||||
strncpy(tlmd->name, lmd->name, 32);
|
||||
BLI_strncpy(tlmd->name, lmd->name, 32);
|
||||
}
|
||||
|
||||
static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
|
||||
|
@ -39,6 +39,7 @@
|
||||
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "BKE_cdderivedmesh.h"
|
||||
#include "BKE_particle.h"
|
||||
@ -69,7 +70,7 @@ static void copyData(ModifierData *md, ModifierData *target)
|
||||
tsmd->fac = smd->fac;
|
||||
tsmd->repeat = smd->repeat;
|
||||
tsmd->flag = smd->flag;
|
||||
strncpy(tsmd->defgrp_name, smd->defgrp_name, 32);
|
||||
BLI_strncpy(tsmd->defgrp_name, smd->defgrp_name, 32);
|
||||
}
|
||||
|
||||
static int isDisabled(ModifierData *md, int UNUSED(useRenderParams))
|
||||
|
@ -33,6 +33,7 @@
|
||||
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "BKE_cdderivedmesh.h"
|
||||
#include "BKE_modifier.h"
|
||||
@ -73,13 +74,13 @@ static void copyData(ModifierData *md, ModifierData *target)
|
||||
twmd->strength = wmd->strength;
|
||||
twmd->falloff_radius = wmd->falloff_radius;
|
||||
twmd->falloff_type = wmd->falloff_type;
|
||||
strncpy(twmd->defgrp_name, wmd->defgrp_name, sizeof(twmd->defgrp_name));
|
||||
BLI_strncpy(twmd->defgrp_name, wmd->defgrp_name, sizeof(twmd->defgrp_name));
|
||||
twmd->curfalloff = curvemapping_copy(wmd->curfalloff);
|
||||
|
||||
/* map info */
|
||||
twmd->texture = wmd->texture;
|
||||
twmd->map_object = wmd->map_object;
|
||||
strncpy(twmd->uvlayer_name, wmd->uvlayer_name, sizeof(twmd->uvlayer_name));
|
||||
BLI_strncpy(twmd->uvlayer_name, wmd->uvlayer_name, sizeof(twmd->uvlayer_name));
|
||||
twmd->texmapping= wmd->texmapping;
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "DNA_object_types.h"
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
|
||||
#include "BKE_DerivedMesh.h"
|
||||
@ -98,7 +99,7 @@ static void copyData(ModifierData *md, ModifierData *target)
|
||||
twmd->texture = wmd->texture;
|
||||
twmd->map_object = wmd->map_object;
|
||||
twmd->texmapping = wmd->texmapping;
|
||||
strncpy(twmd->defgrp_name, wmd->defgrp_name, 32);
|
||||
BLI_strncpy(twmd->defgrp_name, wmd->defgrp_name, 32);
|
||||
}
|
||||
|
||||
static int dependsOnTime(ModifierData *UNUSED(md))
|
||||
|
@ -567,7 +567,7 @@ bNodeSocket *node_group_add_socket(bNodeTree *ngroup, const char *name, int type
|
||||
bNodeSocketType *stype = ntreeGetSocketType(type);
|
||||
bNodeSocket *gsock = MEM_callocN(sizeof(bNodeSocket), "bNodeSocket");
|
||||
|
||||
strncpy(gsock->name, name, sizeof(gsock->name));
|
||||
BLI_strncpy(gsock->name, name, sizeof(gsock->name));
|
||||
gsock->type = type;
|
||||
/* group sockets are dynamically added */
|
||||
gsock->flag |= SOCK_DYNAMIC;
|
||||
|
@ -120,7 +120,7 @@ PyObject *bpy_text_import(Text *text)
|
||||
}
|
||||
|
||||
len= strlen(text->id.name+2);
|
||||
strncpy(modulename, text->id.name+2, len);
|
||||
BLI_strncpy(modulename, text->id.name+2, len);
|
||||
modulename[len - 3]= '\0'; /* remove .py */
|
||||
return PyImport_ExecCodeModule(modulename, text->compiled);
|
||||
}
|
||||
|
@ -5026,7 +5026,7 @@ void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int l
|
||||
/* per second, per object, stats print this */
|
||||
re->i.infostr= "Preparing Scene data";
|
||||
re->i.cfra= scene->r.cfra;
|
||||
strncpy(re->i.scenename, scene->id.name+2, 20);
|
||||
BLI_strncpy(re->i.scenename, scene->id.name+2, sizeof(re->i.scenename));
|
||||
|
||||
/* XXX add test if dbase was filled already? */
|
||||
|
||||
|
@ -1198,7 +1198,7 @@ Render *RE_NewRender(const char *name)
|
||||
/* new render data struct */
|
||||
re= MEM_callocN(sizeof(Render), "new render");
|
||||
BLI_addtail(&RenderGlobal.renderlist, re);
|
||||
strncpy(re->name, name, RE_MAXNAME);
|
||||
BLI_strncpy(re->name, name, RE_MAXNAME);
|
||||
BLI_rw_mutex_init(&re->resultmutex);
|
||||
}
|
||||
|
||||
|
@ -520,8 +520,8 @@ static int set_output(int argc, const char **argv, void *data)
|
||||
{
|
||||
bContext *C = data;
|
||||
if (argc >= 1){
|
||||
if (CTX_data_scene(C)) {
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
if (scene) {
|
||||
BLI_strncpy(scene->r.pic, argv[1], sizeof(scene->r.pic));
|
||||
} else {
|
||||
printf("\nError: no blend loaded. cannot use '-o / --render-output'.\n");
|
||||
@ -546,17 +546,17 @@ static int set_engine(int argc, const char **argv, void *data)
|
||||
exit(0);
|
||||
}
|
||||
else {
|
||||
if (CTX_data_scene(C)==NULL) {
|
||||
printf("\nError: no blend loaded. order the arguments so '-E / --engine ' is after a blend is loaded.\n");
|
||||
}
|
||||
else {
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
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;
|
||||
@ -573,10 +573,8 @@ static int set_image_type(int argc, const char **argv, void *data)
|
||||
bContext *C = data;
|
||||
if (argc >= 1){
|
||||
const char *imtype = argv[1];
|
||||
if (CTX_data_scene(C)==NULL) {
|
||||
printf("\nError: no blend loaded. order the arguments so '-F / --render-format' is after the blend is loaded.\n");
|
||||
} else {
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
if (scene) {
|
||||
if (!strcmp(imtype,"TGA")) scene->r.imtype = R_TARGA;
|
||||
else if (!strcmp(imtype,"IRIS")) scene->r.imtype = R_IRIS;
|
||||
#ifdef WITH_DDS
|
||||
@ -612,6 +610,9 @@ static int set_image_type(int argc, const char **argv, void *data)
|
||||
#endif
|
||||
else printf("\nError: Format from '-F / --render-format' not known or not compiled in this release.\n");
|
||||
}
|
||||
else {
|
||||
printf("\nError: no blend loaded. order the arguments so '-F / --render-format' is after the blend is loaded.\n");
|
||||
}
|
||||
return 1;
|
||||
} else {
|
||||
printf("\nError: you must specify a format after '-F / --render-foramt'.\n");
|
||||
@ -638,8 +639,8 @@ static int set_extension(int argc, const char **argv, void *data)
|
||||
{
|
||||
bContext *C = data;
|
||||
if (argc >= 1) {
|
||||
if (CTX_data_scene(C)) {
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
if (scene) {
|
||||
if (argv[1][0] == '0') {
|
||||
scene->r.scemode &= ~R_EXTENSION;
|
||||
} else if (argv[1][0] == '1') {
|
||||
@ -721,9 +722,9 @@ example:
|
||||
static int render_frame(int argc, const char **argv, void *data)
|
||||
{
|
||||
bContext *C = data;
|
||||
if (CTX_data_scene(C)) {
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
if (scene) {
|
||||
Main *bmain= CTX_data_main(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
|
||||
if (argc > 1) {
|
||||
Render *re = RE_NewRender(scene->id.name);
|
||||
@ -763,9 +764,9 @@ static int render_frame(int argc, const char **argv, void *data)
|
||||
static int render_animation(int UNUSED(argc), const char **UNUSED(argv), void *data)
|
||||
{
|
||||
bContext *C = data;
|
||||
if (CTX_data_scene(C)) {
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
if (scene) {
|
||||
Main *bmain= CTX_data_main(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Render *re= RE_NewRender(scene->id.name);
|
||||
ReportList reports;
|
||||
BKE_reports_init(&reports, RPT_PRINT);
|
||||
@ -782,9 +783,9 @@ static int set_scene(int argc, const char **argv, void *data)
|
||||
{
|
||||
if(argc > 1) {
|
||||
bContext *C= data;
|
||||
Scene *sce= set_scene_name(CTX_data_main(C), argv[1]);
|
||||
if(sce) {
|
||||
CTX_data_scene_set(C, sce);
|
||||
Scene *scene= set_scene_name(CTX_data_main(C), argv[1]);
|
||||
if(scene) {
|
||||
CTX_data_scene_set(C, scene);
|
||||
}
|
||||
return 1;
|
||||
} else {
|
||||
@ -796,8 +797,8 @@ static int set_scene(int argc, const char **argv, void *data)
|
||||
static int set_start_frame(int argc, const char **argv, void *data)
|
||||
{
|
||||
bContext *C = data;
|
||||
if (CTX_data_scene(C)) {
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
if (scene) {
|
||||
if (argc > 1) {
|
||||
int frame = atoi(argv[1]);
|
||||
(scene->r.sfra) = CLAMPIS(frame, MINFRAME, MAXFRAME);
|
||||
@ -815,8 +816,8 @@ static int set_start_frame(int argc, const char **argv, void *data)
|
||||
static int set_end_frame(int argc, const char **argv, void *data)
|
||||
{
|
||||
bContext *C = data;
|
||||
if (CTX_data_scene(C)) {
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
if (scene) {
|
||||
if (argc > 1) {
|
||||
int frame = atoi(argv[1]);
|
||||
(scene->r.efra) = CLAMPIS(frame, MINFRAME, MAXFRAME);
|
||||
@ -834,8 +835,8 @@ static int set_end_frame(int argc, const char **argv, void *data)
|
||||
static int set_skip_frame(int argc, const char **argv, void *data)
|
||||
{
|
||||
bContext *C = data;
|
||||
if (CTX_data_scene(C)) {
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
if (scene) {
|
||||
if (argc > 1) {
|
||||
int frame = atoi(argv[1]);
|
||||
(scene->r.frame_step) = CLAMPIS(frame, 1, MAXFRAME);
|
||||
|
Loading…
Reference in New Issue
Block a user