當前位置: 首頁>>代碼示例>>C++>>正文


C++ BKE_libblock_alloc函數代碼示例

本文整理匯總了C++中BKE_libblock_alloc函數的典型用法代碼示例。如果您正苦於以下問題:C++ BKE_libblock_alloc函數的具體用法?C++ BKE_libblock_alloc怎麽用?C++ BKE_libblock_alloc使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了BKE_libblock_alloc函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: BKE_libblock_alloc

World *add_world(Main *bmain, const char *name)
{
	World *wrld;

	wrld = BKE_libblock_alloc(&bmain->world, ID_WO, name);
	
	wrld->horr = 0.05f;
	wrld->horg = 0.05f;
	wrld->horb = 0.05f;
	wrld->zenr = 0.01f;
	wrld->zeng = 0.01f;
	wrld->zenb = 0.01f;
	wrld->skytype = 0;
	wrld->stardist = 15.0f;
	wrld->starsize = 2.0f;

	wrld->exp = 0.0f;
	wrld->exposure = wrld->range = 1.0f;

	wrld->aodist = 10.0f;
	wrld->aosamp = 5;
	wrld->aoenergy = 1.0f;
	wrld->ao_env_energy = 1.0f;
	wrld->ao_indirect_energy = 1.0f;
	wrld->ao_indirect_bounces = 1;
	wrld->aobias = 0.05f;
	wrld->ao_samp_method = WO_AOSAMP_HAMMERSLEY;
	wrld->ao_approx_error = 0.25f;
	
	wrld->preview = NULL;
	wrld->miststa = 5.0f;
	wrld->mistdist = 25.0f;

	return wrld;
}
開發者ID:244xiao,項目名稱:blender,代碼行數:35,代碼來源:world.c

示例2: which_libbase

/* used everywhere in blenkernel */
void *BKE_libblock_copy(ID *id)
{
    ID *idn;
    ListBase *lb;
    size_t idn_len;

    lb = which_libbase(G.main, GS(id->name));
    idn = BKE_libblock_alloc(lb, GS(id->name), id->name + 2);

    assert(idn != NULL);

    idn_len = MEM_allocN_len(idn);
    if ((int)idn_len - (int)sizeof(ID) > 0) { /* signed to allow neg result */
        const char *cp = (const char *)id;
        char *cpn = (char *)idn;

        memcpy(cpn + sizeof(ID), cp + sizeof(ID), idn_len - sizeof(ID));
    }

    id->newid = idn;
    idn->flag |= LIB_NEW;

    BKE_libblock_copy_data(idn, id, FALSE);

    return idn;
}
開發者ID:nttputus,項目名稱:blensor,代碼行數:27,代碼來源:library.c

示例3: BLI_strncpy

bSound *sound_new_file(struct Main *bmain, const char *filename)
{
	bSound *sound = NULL;

	char str[FILE_MAX];
	char *path;

	size_t len;

	BLI_strncpy(str, filename, sizeof(str));

	path = /*bmain ? bmain->name :*/ G.main->name;

	BLI_path_abs(str, path);

	len = strlen(filename);
	while (len > 0 && filename[len - 1] != '/' && filename[len - 1] != '\\')
		len--;

	sound = BKE_libblock_alloc(bmain, ID_SO, filename + len);
	BLI_strncpy(sound->name, filename, FILE_MAX);
	/* sound->type = SOUND_TYPE_FILE; */ /* XXX unused currently */

	sound_load(bmain, sound);

	if (!sound->playback_handle) {
		BKE_libblock_free(bmain, sound);
		sound = NULL;
	}

	return sound;
}
開發者ID:Walid-Shouman,項目名稱:Blender,代碼行數:32,代碼來源:sound.c

示例4: strcpy

bSound *sound_new_limiter(struct Main *bmain, bSound *source, float start, float end)
{
	bSound *sound = NULL;

	char name[MAX_ID_NAME + 5];
	strcpy(name, "lim_");
	strcpy(name + 4, source->id.name);

	sound = BKE_libblock_alloc(bmain, ID_SO, name);

	sound->child_sound = source;
	sound->start = start;
	sound->end = end;
	sound->type = SOUND_TYPE_LIMITER;

	sound_load(bmain, sound);

	if (!sound->playback_handle)
	{
		BKE_libblock_free(bmain, sound);
		sound = NULL;
	}

	return sound;
}
開發者ID:Walid-Shouman,項目名稱:Blender,代碼行數:25,代碼來源:sound.c

示例5: STRNCPY

/* Add new collection, without view layer syncing. */
static Collection *collection_add(Main *bmain,
                                  Collection *collection_parent,
                                  const char *name_custom)
{
  /* Determine new collection name. */
  char name[MAX_NAME];

  if (name_custom) {
    STRNCPY(name, name_custom);
  }
  else {
    BKE_collection_new_name_get(collection_parent, name);
  }

  /* Create new collection. */
  Collection *collection = BKE_libblock_alloc(bmain, ID_GR, name, 0);

  /* We increase collection user count when linking to Collections. */
  id_us_min(&collection->id);

  /* Optionally add to parent collection. */
  if (collection_parent) {
    collection_child_add(collection_parent, collection, 0, true);
  }

  return collection;
}
開發者ID:wangyxuan,項目名稱:blender,代碼行數:28,代碼來源:collection.c

示例6: BKE_libblock_alloc

bAction *add_empty_action(Main *bmain, const char name[])
{
	bAction *act;
	
	act = BKE_libblock_alloc(bmain, ID_AC, name);
	
	return act;
}	
開發者ID:UPBGE,項目名稱:blender,代碼行數:8,代碼來源:action.c

示例7: BKE_libblock_alloc

void *BKE_cachefile_add(Main *bmain, const char *name)
{
	CacheFile *cache_file = BKE_libblock_alloc(bmain, ID_CF, name, 0);

	BKE_cachefile_init(cache_file);

	return cache_file;
}
開發者ID:mgschwan,項目名稱:blensor,代碼行數:8,代碼來源:cachefile.c

示例8:

FreestyleLineStyle *BKE_linestyle_new(struct Main *bmain, const char *name)
{
	FreestyleLineStyle *linestyle;

	linestyle = (FreestyleLineStyle *)BKE_libblock_alloc(bmain, ID_LS, name);

	BKE_linestyle_init(linestyle);

	return linestyle;
}
開發者ID:rav66,項目名稱:blender,代碼行數:10,代碼來源:linestyle.c

示例9: BKE_libblock_alloc

Lattice *BKE_lattice_add(Main *bmain, const char *name)
{
  Lattice *lt;

  lt = BKE_libblock_alloc(bmain, ID_LT, name, 0);

  BKE_lattice_init(lt);

  return lt;
}
開發者ID:dfelinto,項目名稱:blender,代碼行數:10,代碼來源:lattice.c

示例10: BKE_libblock_alloc

Lamp *BKE_lamp_add(Main *bmain, const char *name)
{
	Lamp *la;

	la =  BKE_libblock_alloc(bmain, ID_LA, name);

	BKE_lamp_init(la);

	return la;
}
開發者ID:DrangPo,項目名稱:blender,代碼行數:10,代碼來源:lamp.c

示例11: BKE_libblock_alloc

Tex *BKE_texture_add(Main *bmain, const char *name)
{
	Tex *tex;

	tex = BKE_libblock_alloc(bmain, ID_TE, name, 0);
	
	BKE_texture_default(tex);
	
	return tex;
}
開發者ID:mgschwan,項目名稱:blensor,代碼行數:10,代碼來源:texture.c

示例12: BKE_libblock_alloc

MetaBall *BKE_mball_add(Main *bmain, const char *name)
{
	MetaBall *mb;

	mb = BKE_libblock_alloc(bmain, ID_MB, name);

	BKE_mball_init(mb);

	return mb;
}
開發者ID:flair2005,項目名稱:mechanical-blender,代碼行數:10,代碼來源:mball.c

示例13: BKE_libblock_alloc

Light *BKE_light_add(Main *bmain, const char *name)
{
  Light *la;

  la = BKE_libblock_alloc(bmain, ID_LA, name, 0);

  BKE_light_init(la);

  return la;
}
開發者ID:wangyxuan,項目名稱:blender,代碼行數:10,代碼來源:light.c

示例14: BKE_libblock_alloc

void *BKE_speaker_add(Main *bmain, const char *name)
{
  Speaker *spk;

  spk = BKE_libblock_alloc(bmain, ID_SPK, name, 0);

  BKE_speaker_init(spk);

  return spk;
}
開發者ID:dfelinto,項目名稱:blender,代碼行數:10,代碼來源:speaker.c

示例15: BKE_libblock_alloc

void *BKE_camera_add(Main *bmain, const char *name)
{
	Camera *cam;

	cam =  BKE_libblock_alloc(bmain, ID_CA, name, 0);

	BKE_camera_init(cam);

	return cam;
}
開發者ID:Ichthyostega,項目名稱:blender,代碼行數:10,代碼來源:camera.c


注:本文中的BKE_libblock_alloc函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。