/* XXX uses initfunc_api callback, regular initfunc does not support context yet */
static void init_output_file(const bContext *C, PointerRNA *ptr)
{
	Scene *scene = CTX_data_scene(C);
	bNodeTree *ntree = ptr->id.data;
	bNode *node = ptr->data;
	NodeImageMultiFile *nimf = MEM_callocN(sizeof(NodeImageMultiFile), "node image multi file");
	ImageFormatData *format = NULL;
	node->storage = nimf;
	
	node->id = &scene->id;
	
	if (scene) {
		RenderData *rd = &scene->r;

		BLI_strncpy(nimf->base_path, rd->pic, sizeof(nimf->base_path));
		nimf->format = rd->im_format;
		if (BKE_imtype_is_movie(nimf->format.imtype)) {
			nimf->format.imtype = R_IMF_IMTYPE_OPENEXR;
		}
		
		format = &nimf->format;
	}
	else
		BKE_imformat_defaults(&nimf->format);
	
	/* add one socket by default */
	ntreeCompositOutputFileAddSocket(ntree, node, "Image", format);
}
Example #2
0
static void init_output_file(bNodeTree *ntree, bNode* node, bNodeTemplate *ntemp)
{
	NodeImageMultiFile *nimf= MEM_callocN(sizeof(NodeImageMultiFile), "node image multi file");
	ImageFormatData *format = NULL;
	node->storage= nimf;

	if (ntemp->scene) {
		RenderData *rd = &ntemp->scene->r;
		BLI_strncpy(nimf->base_path, rd->pic, sizeof(nimf->base_path));
		nimf->format = rd->im_format;
		
		format = &rd->im_format;
	}
	
	/* add one socket by default */
	ntreeCompositOutputFileAddSocket(ntree, node, "Image", format);
}
static void init_output_file(bNodeTree *ntree, bNode* node, bNodeTemplate *ntemp)
{
	NodeImageMultiFile *nimf= MEM_callocN(sizeof(NodeImageMultiFile), "node image multi file");
	ImageFormatData *format = NULL;
	node->storage= nimf;

	if (ntemp->scene) {
		RenderData *rd = &ntemp->scene->r;
		BLI_strncpy(nimf->base_path, rd->pic, sizeof(nimf->base_path));
		nimf->format = rd->im_format;
		if (BKE_imtype_is_movie(nimf->format.imtype)) {
			nimf->format.imtype= R_IMF_IMTYPE_OPENEXR;
		}
		
		format = &nimf->format;
	}
	else
		BKE_imformat_defaults(&nimf->format);
	
	/* add one socket by default */
	ntreeCompositOutputFileAddSocket(ntree, node, "Image", format);
}