Merging r48196 through r48223 from trunk into soc-2011-tomato

This commit is contained in:
Sergey Sharybin
2012-06-23 18:08:56 +00:00
36 changed files with 646 additions and 191 deletions

View File

@@ -160,7 +160,7 @@ unset(PLATFORM_DEFAULT)
if(UNIX AND NOT APPLE)
option(WITH_X11_XINPUT "Enable X11 Xinput (tablet support and unicode input)" ON)
option(WITH_X11_XF86VMODE "Enable X11 video mode switching" ON)
option(WITH_BUILTIN_GLEW "Use GLEW OpenGL wrapper library bundled with blender" ON)
option(WITH_SYSTEM_GLEW "Use GLEW OpenGL wrapper library provided by the operating system" ON)
# freebsd doesn't seems to support XDND
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
@@ -168,9 +168,20 @@ if(UNIX AND NOT APPLE)
endif()
else()
# not an option for other OS's
set(WITH_BUILTIN_GLEW ON)
set(WITH_SYSTEM_GLEW OFF)
endif()
# (unix defaults to System OpenJPEG On)
if(UNIX AND NOT APPLE)
set(PLATFORM_DEFAULT ON)
else()
set(PLATFORM_DEFAULT OFF)
endif()
option(WITH_SYSTEM_OPENJPEG "Use the operating systems OpenJPEG library" ${PLATFORM_DEFAULT})
unset(PLATFORM_DEFAULT)
# Modifiers
option(WITH_MOD_FLUID "Enable Elbeem Modifier (Fluid Simulation)" ON)
option(WITH_MOD_SMOKE "Enable Smoke Modifier (Smoke Simulation)" ON)
@@ -1528,7 +1539,7 @@ endif()
if(WITH_IMAGE_OPENJPEG)
if(UNIX AND NOT APPLE)
if(WITH_SYSTEM_OPENJPEG)
# dealt with above
else()
set(OPENJPEG_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/extern/libopenjpeg")
@@ -1583,20 +1594,20 @@ endif()
#-----------------------------------------------------------------------------
# Configure GLEW
if(WITH_BUILTIN_GLEW)
# set(GLEW_LIBRARY "") # unused
set(GLEW_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/extern/glew/include")
else()
if(WITH_SYSTEM_GLEW)
find_package(GLEW)
if(NOT GLEW_FOUND)
message(FATAL_ERROR "GLEW is required to build blender, install it or use WITH_BUILTIN_GLEW")
message(FATAL_ERROR "GLEW is required to build blender, install it or disable WITH_SYSTEM_GLEW")
endif()
mark_as_advanced(
GLEW_LIBRARY
GLEW_INCLUDE_PATH
)
else()
# set(GLEW_LIBRARY "") # unused
set(GLEW_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/extern/glew/include")
endif()
#-----------------------------------------------------------------------------
@@ -1834,8 +1845,9 @@ if(FIRST_RUN)
info_cfg_option(WITH_INSTALL_PORTABLE)
info_cfg_option(WITH_X11_XF86VMODE)
info_cfg_option(WITH_X11_XINPUT)
info_cfg_option(WITH_BUILTIN_GLEW)
info_cfg_option(WITH_MEM_JEMALLOC)
info_cfg_option(WITH_SYSTEM_GLEW)
info_cfg_option(WITH_SYSTEM_OPENJPEG)
info_cfg_text("Image Formats:")
info_cfg_option(WITH_IMAGE_CINEON)

View File

@@ -6,9 +6,9 @@
#
set(WITH_INSTALL_PORTABLE ON CACHE FORCE BOOL)
set(WITH_SYSTEM_GLEW ON CACHE FORCE BOOL)
set(WITH_BUILDINFO OFF CACHE FORCE BOOL)
set(WITH_BUILTIN_GLEW OFF CACHE FORCE BOOL)
set(WITH_BULLET OFF CACHE FORCE BOOL)
set(WITH_CODEC_FFMPEG OFF CACHE FORCE BOOL)
set(WITH_CODEC_SNDFILE OFF CACHE FORCE BOOL)

View File

@@ -196,7 +196,7 @@ macro(SETUP_LIBDIRS)
if(WITH_OPENCOLORIO)
link_directories(${OPENCOLORIO_LIBPATH})
endif()
if(WITH_IMAGE_OPENJPEG AND UNIX AND NOT APPLE)
if(WITH_IMAGE_OPENJPEG AND WITH_SYSTEM_OPENJPEG)
link_directories(${OPENJPEG_LIBPATH})
endif()
if(WITH_CODEC_QUICKTIME)
@@ -256,7 +256,7 @@ macro(setup_liblinks
endif()
endif()
if(NOT WITH_BUILTIN_GLEW)
if(WITH_SYSTEM_GLEW)
target_link_libraries(${target} ${GLEW_LIBRARY})
endif()
@@ -309,7 +309,7 @@ macro(setup_liblinks
target_link_libraries(${target} ${OPENEXR_LIBRARIES})
endif()
endif()
if(WITH_IMAGE_OPENJPEG AND UNIX AND NOT APPLE)
if(WITH_IMAGE_OPENJPEG AND WITH_SYSTEM_OPENJPEG)
target_link_libraries(${target} ${OPENJPEG_LIBRARIES})
endif()
if(WITH_CODEC_FFMPEG)

View File

@@ -40,7 +40,7 @@ if(WITH_BINRELOC)
add_subdirectory(binreloc)
endif()
if(WITH_BUILTIN_GLEW)
if(NOT WITH_SYSTEM_GLEW)
add_subdirectory(glew)
endif()
@@ -48,7 +48,7 @@ if(WITH_GAMEENGINE)
add_subdirectory(recastnavigation)
endif()
if(WITH_IMAGE_OPENJPEG AND (NOT UNIX OR APPLE))
if(WITH_IMAGE_OPENJPEG AND (NOT WITH_SYSTEM_OPENJPEG))
add_subdirectory(libopenjpeg)
endif()

View File

@@ -86,4 +86,3 @@ void OPJ_CALLCONV opj_image_destroy(opj_image_t *image) {
opj_free(image);
}
}

View File

@@ -11,10 +11,10 @@ if(WITH_CYCLES_TEST)
include_directories(${GLUT_INCLUDE_DIR})
endif()
if(WITH_BUILTIN_GLEW)
set(CYCLES_GLEW_LIBRARY extern_glew)
else()
if(WITH_SYSTEM_GLEW)
set(CYCLES_GLEW_LIBRARY ${GLEW_LIBRARY})
else()
set(CYCLES_GLEW_LIBRARY extern_glew)
endif()
###########################################################################

View File

@@ -1,10 +1,16 @@
import bpy
op = bpy.context.active_operator
op.apply_modifiers = True
op.export_mesh_type = 0
op.export_mesh_type_selection = 'view'
op.selected = True
op.include_children = False
op.include_armatures = True
op.deform_bones_only = True
op.active_uv_only = True
op.include_uv_textures = True
op.use_texture_copies = True
op.use_object_instantiation = False
op.sort_by_name = True
op.second_life = True

View File

@@ -0,0 +1,16 @@
import bpy
op = bpy.context.active_operator
op.apply_modifiers = True
op.export_mesh_type = 0
op.export_mesh_type_selection = 'view'
op.selected = True
op.include_children = False
op.include_armatures = False
op.deform_bones_only = False
op.active_uv_only = True
op.include_uv_textures = True
op.use_texture_copies = True
op.use_object_instantiation = False
op.sort_by_name = True
op.second_life = False

View File

@@ -70,6 +70,7 @@ char BKE_imtype_valid_depths(const char imtype);
char BKE_imtype_from_arg(const char *arg);
void BKE_imformat_defaults(struct ImageFormatData *im_format);
void BKE_imbuf_to_image_format(struct ImageFormatData *im_format, const struct ImBuf *imbuf);
struct anim *openanim(const char *name, int flags, int streamindex);

View File

@@ -1208,6 +1208,106 @@ void BKE_imformat_defaults(ImageFormatData *im_format)
im_format->compress = 90;
}
void BKE_imbuf_to_image_format(struct ImageFormatData *im_format, const ImBuf *imbuf)
{
BKE_imformat_defaults(im_format);
// file type
if (imbuf->ftype == IMAGIC)
im_format->imtype = R_IMF_IMTYPE_IRIS;
#ifdef WITH_HDR
else if (imbuf->ftype == RADHDR)
im_format->imtype = R_IMF_IMTYPE_RADHDR;
#endif
else if (imbuf->ftype == PNG)
im_format->imtype = R_IMF_IMTYPE_PNG;
#ifdef WITH_DDS
else if (imbuf->ftype == DDS)
im_format->imtype = R_IMF_IMTYPE_DDS;
#endif
else if (imbuf->ftype == BMP)
im_format->imtype = R_IMF_IMTYPE_BMP;
#ifdef WITH_TIFF
else if (imbuf->ftype & TIF) {
im_format->imtype = R_IMF_IMTYPE_TIFF;
if (imbuf->ftype & TIF_16BIT)
im_format->depth = R_IMF_CHAN_DEPTH_16;
}
#endif
#ifdef WITH_OPENEXR
else if (imbuf->ftype & OPENEXR) {
im_format->imtype = R_IMF_IMTYPE_OPENEXR;
if (imbuf->ftype & OPENEXR_HALF)
im_format->depth = R_IMF_CHAN_DEPTH_16;
if (imbuf->ftype & OPENEXR_COMPRESS)
im_format->exr_codec = R_IMF_EXR_CODEC_ZIP; // Can't determine compression
if (imbuf->zbuf_float)
im_format->flag |= R_IMF_FLAG_ZBUF;
}
#endif
#ifdef WITH_CINEON
else if (imbuf->ftype == CINEON)
im_format->imtype = R_IMF_IMTYPE_CINEON;
else if (imbuf->ftype == DPX)
im_format->imtype = R_IMF_IMTYPE_DPX;
#endif
else if (imbuf->ftype == TGA) {
im_format->imtype = R_IMF_IMTYPE_TARGA;
}
else if (imbuf->ftype == RAWTGA) {
im_format->imtype = R_IMF_IMTYPE_RAWTGA;
}
#ifdef WITH_OPENJPEG
else if (imbuf->ftype & JP2) {
im_format->imtype = R_IMF_IMTYPE_JP2;
im_format->quality = imbuf->ftype & ~JPG_MSK;
if (imbuf->ftype & JP2_16BIT)
im_format->depth = R_IMF_CHAN_DEPTH_16;
else if (imbuf->ftype & JP2_12BIT)
im_format->depth = R_IMF_CHAN_DEPTH_12;
if(imbuf->ftype & JP2_YCC)
im_format->jp2_flag |= R_IMF_JP2_FLAG_YCC;
if(imbuf->ftype & JP2_CINE) {
im_format->jp2_flag |= R_IMF_JP2_FLAG_CINE_PRESET;
if (imbuf->ftype & JP2_CINE_48FPS)
im_format->jp2_flag |= R_IMF_JP2_FLAG_CINE_48;
}
}
#endif
else {
im_format->imtype = R_IMF_IMTYPE_JPEG90;
im_format->quality = imbuf->ftype & ~JPG_MSK;
}
// planes
switch (imbuf->channels) {
case 0:
case 4: im_format->planes = R_IMF_PLANES_RGBA;
break;
case 3: im_format->planes = R_IMF_PLANES_RGB;
break;
case 1: im_format->planes = R_IMF_PLANES_BW;
break;
default:im_format->planes = R_IMF_PLANES_RGB;
break;
}
}
/* could allow access externally - 512 is for long names, 64 is for id names */
typedef struct StampData {
char file[512];

View File

@@ -89,7 +89,16 @@ void BLI_split_dir_part(const char *string, char *dir, const size_t dirlen);
void BLI_split_file_part(const char *string, char *file, const size_t filelen);
void BLI_join_dirfile(char *string, const size_t maxlen, const char *dir, const char *file);
char *BLI_path_basename(char *path);
int BKE_rebase_path(char *abs, size_t abs_len, char *rel, size_t rel_len, const char *base_dir, const char *src_dir, const char *dest_dir);
typedef enum bli_rebase_state {
BLI_REBASE_NO_SRCDIR = 0,
BLI_REBASE_OK = 1,
BLI_REBASE_IDENTITY = 2
} bli_rebase_state;
int BLI_rebase_path(char *abs, size_t abs_len, char *rel, size_t rel_len, const char *base_dir, const char *src_dir, const char *dest_dir);
#define BKE_rebase_path BLI_rebase_path /* remove after a 2012 */
char *BLI_last_slash(const char *string);
int BLI_add_slash(char *string);
void BLI_del_slash(char *string);

View File

@@ -239,6 +239,7 @@ MINLINE unsigned char rgb_to_grayscale_byte(const unsigned char rgb[3])
return (76 * (unsigned short) rgb[0] + 148 * (unsigned short) rgb[1] + 31 * (unsigned short) rgb[2]) / 255;
}
/* luma from defined by 'YCC_JFIF', see #rgb_to_ycc */
MINLINE float rgb_to_luma(const float rgb[3])
{
return 0.299f * rgb[0] + 0.587f * rgb[1] + 0.114f * rgb[2];

View File

@@ -1547,31 +1547,40 @@ char *BLI_path_basename(char *path)
/**
* Produce image export path.
*
* Fails returning 0 if image filename is empty or if destination path
* matches image path (i.e. both are the same file).
*
* Trailing slash in dest_dir is optional.
*
* Returns:
* 0 if image filename is empty or if destination path
* matches image path (i.e. both are the same file).
* 2 if source is identical to destination.
* 1 if rebase was successfull
* -------------------------------------------------------------
* Hint: Trailing slash in dest_dir is optional.
*
* Logic:
*
* - if an image is "below" current .blend file directory, rebuild the
* same dir structure in dest_dir
* - if an image is "below" current .blend file directory:
* rebuild the same dir structure in dest_dir
*
* For example //textures/foo/bar.png becomes
* [dest_dir]/textures/foo/bar.png.
* Example:
* src : //textures/foo/bar.png
* dest: [dest_dir]/textures/foo/bar.png.
*
* - if an image is not "below" current .blend file directory,
* disregard it's path and copy it in the same directory where 3D file
* goes.
* disregard it's path and copy it into the destination
* directory.
*
* For example //../foo/bar.png becomes [dest_dir]/bar.png.
* Example:
* src : //../foo/bar.png becomes
* dest: [dest_dir]/bar.png.
*
* This logic will help ensure that all image paths are relative and
* This logic ensures that all image paths are relative and
* that a user gets his images in one place. It'll also provide
* consistent behavior across exporters.
* IMPORTANT NOTE: If base_dir contains an empty string, then
* this function returns wrong results!
* XXX: test on empty base_dir and return an error ?
*/
int BKE_rebase_path(char *abs, size_t abs_len, char *rel, size_t rel_len, const char *base_dir, const char *src_dir, const char *dest_dir)
int BLI_rebase_path(char *abs, size_t abs_len, char *rel, size_t rel_len, const char *base_dir, const char *src_dir, const char *dest_dir)
{
char path[FILE_MAX];
char dir[FILE_MAX];
@@ -1590,7 +1599,7 @@ int BKE_rebase_path(char *abs, size_t abs_len, char *rel, size_t rel_len, const
BLI_split_dir_part(base_dir, blend_dir, sizeof(blend_dir));
if (src_dir[0] == '\0')
return 0;
return BLI_REBASE_NO_SRCDIR;
BLI_strncpy(path, src_dir, sizeof(path));
@@ -1637,10 +1646,10 @@ int BKE_rebase_path(char *abs, size_t abs_len, char *rel, size_t rel_len, const
/* return 2 if src=dest */
if (BLI_path_cmp(path, dest_path) == 0) {
// if (G.debug & G_DEBUG) printf("%s and %s are the same file\n", path, dest_path);
return 2;
return BLI_REBASE_IDENTITY;
}
return 1;
return BLI_REBASE_OK;
}
char *BLI_first_slash(char *string)

View File

@@ -111,7 +111,7 @@ bool ArmatureExporter::add_instance_controller(Object *ob)
write_bone_URLs(ins, ob_arm, bone);
}
InstanceWriter::add_material_bindings(ins.getBindMaterial(), ob);
InstanceWriter::add_material_bindings(ins.getBindMaterial(), ob, this->export_settings->active_uv_only);
ins.add();
return true;

View File

@@ -34,6 +34,7 @@ set(INC
../makesdna
../makesrna
../windowmanager
../imbuf
../../../intern/guardedalloc
)

View File

@@ -27,6 +27,7 @@
#include <map>
#include <set>
#include "COLLADASWEffectProfile.h"
@@ -39,6 +40,8 @@
#include "DNA_world_types.h"
#include "BKE_customdata.h"
#include "BKE_mesh.h"
#include "BKE_material.h"
#include "collada_internal.h"
#include "collada_utils.h"
@@ -118,6 +121,54 @@ void EffectsExporter::writePhong(COLLADASW::EffectProfile &ep, Material *ma)
ep.setSpecular(cot, false, "specular");
}
void EffectsExporter::writeTextures(COLLADASW::EffectProfile &ep,
std::string &key,
COLLADASW::Sampler *sampler,
MTex *t, Image *ima,
std::string &uvname ) {
// Image not set for texture
if (!ima) return;
// color
if (t->mapto & (MAP_COL | MAP_COLSPEC)) {
ep.setDiffuse(createTexture(ima, uvname, sampler), false, "diffuse");
}
// ambient
if (t->mapto & MAP_AMB) {
ep.setAmbient(createTexture(ima, uvname, sampler), false, "ambient");
}
// specular
if (t->mapto & MAP_SPEC) {
ep.setSpecular(createTexture(ima, uvname, sampler), false, "specular");
}
// emission
if (t->mapto & MAP_EMIT) {
ep.setEmission(createTexture(ima, uvname, sampler), false, "emission");
}
// reflective
if (t->mapto & MAP_REF) {
ep.setReflective(createTexture(ima, uvname, sampler));
}
// alpha
if (t->mapto & MAP_ALPHA) {
ep.setTransparent(createTexture(ima, uvname, sampler));
}
// extension:
// Normal map --> Must be stored with <extra> tag as different technique,
// since COLLADA doesn't support normal maps, even in current COLLADA 1.5.
if (t->mapto & MAP_NORM) {
COLLADASW::Texture texture(key);
texture.setTexcoord(uvname);
texture.setSampler(*sampler);
// technique FCOLLADA, with the <bump> tag, is most likely the best understood,
// most widespread de-facto standard.
texture.setProfileName("FCOLLADA");
texture.setChildElementName("bump");
ep.addExtraTechniqueColorOrTexture(COLLADASW::ColorOrTexture(texture));
}
}
void EffectsExporter::operator()(Material *ma, Object *ob)
{
// create a list of indices to textures of type TEX_IMAGE
@@ -256,6 +307,52 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
}
}
std::set<Image *> uv_textures;
if (ob->type == OB_MESH && ob->totcol) {
Mesh *me = (Mesh *) ob->data;
BKE_mesh_tessface_ensure(me);
for (int i = 0; i < me->pdata.totlayer; i++) {
if (me->pdata.layers[i].type == CD_MTEXPOLY) {
MTexPoly *txface = (MTexPoly *)me->pdata.layers[i].data;
MFace *mface = me->mface;
for (int j = 0; j < me->totpoly; j++, mface++, txface++) {
Material *mat = give_current_material(ob, mface->mat_nr + 1);
if (mat != ma)
continue;
Image *ima = txface->tpage;
if (ima == NULL)
continue;
bool not_in_list = uv_textures.find(ima)==uv_textures.end();
if (not_in_list) {
std::string name = id_name(ima);
std::string key(name);
key = translate_id(key);
// create only one <sampler>/<surface> pair for each unique image
if (im_samp_map.find(key) == im_samp_map.end()) {
//<newparam> <sampler> <source>
COLLADASW::Sampler sampler(COLLADASW::Sampler::SAMPLER_TYPE_2D,
key + COLLADASW::Sampler::SAMPLER_SID_SUFFIX,
key + COLLADASW::Sampler::SURFACE_SID_SUFFIX);
sampler.setImageId(key);
samplers[a] = sampler;
samp_surf[b][0] = &samplers[a];
im_samp_map[key] = b;
b++;
a++;
uv_textures.insert(ima);
}
}
}
}
}
}
// used as fallback when MTex->uvname is "" (this is pretty common)
// it is indeed the correct value to use in that case
std::string active_uv(getActiveUVLayerName(ob));
@@ -265,58 +362,25 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
for (a = 0; a < tex_indices.size(); a++) {
MTex *t = ma->mtex[tex_indices[a]];
Image *ima = t->tex->ima;
// Image not set for texture
if (!ima) continue;
// we assume map input is always TEXCO_UV
std::string key(id_name(ima));
key = translate_id(key);
int i = im_samp_map[key];
COLLADASW::Sampler *sampler = (COLLADASW::Sampler *)samp_surf[i][0];
//COLLADASW::Surface *surface = (COLLADASW::Surface*)samp_surf[i][1];
std::string uvname = strlen(t->uvname) ? t->uvname : active_uv;
// color
if (t->mapto & (MAP_COL | MAP_COLSPEC)) {
ep.setDiffuse(createTexture(ima, uvname, sampler), false, "diffuse");
}
// ambient
if (t->mapto & MAP_AMB) {
ep.setAmbient(createTexture(ima, uvname, sampler), false, "ambient");
}
// specular
if (t->mapto & MAP_SPEC) {
ep.setSpecular(createTexture(ima, uvname, sampler), false, "specular");
}
// emission
if (t->mapto & MAP_EMIT) {
ep.setEmission(createTexture(ima, uvname, sampler), false, "emission");
}
// reflective
if (t->mapto & MAP_REF) {
ep.setReflective(createTexture(ima, uvname, sampler));
}
// alpha
if (t->mapto & MAP_ALPHA) {
ep.setTransparent(createTexture(ima, uvname, sampler));
}
// extension:
// Normal map --> Must be stored with <extra> tag as different technique,
// since COLLADA doesn't support normal maps, even in current COLLADA 1.5.
if (t->mapto & MAP_NORM) {
COLLADASW::Texture texture(key);
texture.setTexcoord(uvname);
texture.setSampler(*sampler);
// technique FCOLLADA, with the <bump> tag, is most likely the best understood,
// most widespread de-facto standard.
texture.setProfileName("FCOLLADA");
texture.setChildElementName("bump");
ep.addExtraTechniqueColorOrTexture(COLLADASW::ColorOrTexture(texture));
}
COLLADASW::Sampler *sampler = (COLLADASW::Sampler *)samp_surf[i][0];
writeTextures(ep, key, sampler, t, ima, uvname);
}
std::set<Image *>::iterator uv_t_iter;
for(uv_t_iter = uv_textures.begin(); uv_t_iter != uv_textures.end(); uv_t_iter++ ) {
Image *ima = *uv_t_iter;
std::string key(id_name(ima));
key = translate_id(key);
int i = im_samp_map[key];
COLLADASW::Sampler *sampler = (COLLADASW::Sampler *)samp_surf[i][0];
ep.setDiffuse(createTexture(ima, active_uv, sampler), false, "diffuse");
}
// performs the actual writing
ep.addProfileElements();
bool twoSided = false;

View File

@@ -64,7 +64,12 @@ private:
void writeBlinn(COLLADASW::EffectProfile &ep, Material *ma);
void writeLambert(COLLADASW::EffectProfile &ep, Material *ma);
void writePhong(COLLADASW::EffectProfile &ep, Material *ma);
void EffectsExporter::writeTextures(COLLADASW::EffectProfile &ep,
std::string &key,
COLLADASW::Sampler *sampler,
MTex *t, Image *ima,
std::string &uvname );
bool hasEffects(Scene *sce);
const ExportSettings *export_settings;

View File

@@ -33,13 +33,20 @@ struct ExportSettings {
public:
bool apply_modifiers;
BC_export_mesh_type export_mesh_type;
bool selected;
bool include_children;
bool include_armatures;
bool deform_bones_only;
bool active_uv_only;
bool include_uv_textures;
bool use_texture_copies;
bool use_object_instantiation;
bool sort_by_name;
bool second_life;
char *filepath;
LinkNode *export_set;
};

View File

@@ -261,8 +261,9 @@ void GeometryExporter::createPolylist(short material_index,
// sets material name
if (ma) {
std::string material_id = get_material_id(ma);
std::ostringstream ostr;
ostr << translate_id(id_name(ma));
ostr << translate_id(material_id);
polylist.setMaterial(ostr.str());
}
@@ -436,33 +437,38 @@ void GeometryExporter::createTexcoordsSource(std::string geom_id, Mesh *me)
// write <source> for each layer
// each <source> will get id like meshName + "map-channel-1"
int map_index = 0;
int active_uv_index = CustomData_get_active_layer_index(&me->fdata, CD_MTFACE)-1;
for (int a = 0; a < num_layers; a++) {
MTFace *tface = (MTFace *)CustomData_get_layer_n(&me->fdata, CD_MTFACE, a);
// char *name = CustomData_get_layer_name(&me->fdata, CD_MTFACE, a);
COLLADASW::FloatSourceF source(mSW);
std::string layer_id = makeTexcoordSourceId(geom_id, a);
source.setId(layer_id);
source.setArrayId(layer_id + ARRAY_ID_SUFFIX);
source.setAccessorCount(totuv);
source.setAccessorStride(2);
COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
param.push_back("S");
param.push_back("T");
source.prepareToAppendValues();
for (i = 0; i < totfaces; i++) {
MFace *f = &mfaces[i];
if (!this->export_settings->active_uv_only || a == active_uv_index) {
MTFace *tface = (MTFace *)CustomData_get_layer_n(&me->fdata, CD_MTFACE, a);
// char *name = CustomData_get_layer_name(&me->fdata, CD_MTFACE, a);
for (int j = 0; j < (f->v4 == 0 ? 3 : 4); j++) {
source.appendValues(tface[i].uv[j][0],
tface[i].uv[j][1]);
COLLADASW::FloatSourceF source(mSW);
std::string layer_id = makeTexcoordSourceId(geom_id, map_index++);
source.setId(layer_id);
source.setArrayId(layer_id + ARRAY_ID_SUFFIX);
source.setAccessorCount(totuv);
source.setAccessorStride(2);
COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
param.push_back("S");
param.push_back("T");
source.prepareToAppendValues();
for (i = 0; i < totfaces; i++) {
MFace *f = &mfaces[i];
for (int j = 0; j < (f->v4 == 0 ? 3 : 4); j++) {
source.appendValues(tface[i].uv[j][0],
tface[i].uv[j][1]);
}
}
source.finish();
}
source.finish();
}
}

View File

@@ -29,22 +29,150 @@
#include "COLLADABUURI.h"
#include "COLLADASWImage.h"
#include "ImageExporter.h"
#include "MaterialExporter.h"
extern "C" {
#include "DNA_texture_types.h"
#include "DNA_image_types.h"
#include "DNA_meshdata_types.h"
#include "BKE_customdata.h"
#include "BKE_global.h"
#include "BKE_image.h"
#include "BKE_main.h"
#include "BKE_mesh.h"
#include "BKE_utildefines.h"
#include "BLI_fileops.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
#include "IMB_imbuf_types.h"
}
#include "ImageExporter.h"
#include "MaterialExporter.h"
ImagesExporter::ImagesExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) : COLLADASW::LibraryImages(sw), export_settings(export_settings)
{
}
void ImagesExporter::export_UV_Image(Image *image, bool use_copies)
{
std::string name(id_name(image));
std::string translated_name(translate_id(name));
bool not_yet_exported = find(mImages.begin(), mImages.end(), translated_name) == mImages.end();
if (not_yet_exported) {
ImBuf *imbuf = BKE_image_get_ibuf(image, NULL);
bool is_dirty = imbuf->userflags & IB_BITMAPDIRTY;
ImageFormatData imageFormat;
BKE_imbuf_to_image_format(&imageFormat, imbuf);
short image_source = image->source;
bool is_generated = image_source == IMA_SRC_GENERATED;
char export_path[FILE_MAX];
char source_path[FILE_MAX];
char export_dir[FILE_MAX];
char export_file[FILE_MAX];
// Destination folder for exported assets
BLI_split_dir_part(this->export_settings->filepath, export_dir, sizeof(export_dir));
if (is_generated || is_dirty || use_copies) {
// make absolute destination path
BLI_strncpy(export_file, name.c_str(), sizeof(export_file));
BKE_add_image_extension(export_file, imageFormat.imtype);
BLI_join_dirfile(export_path, sizeof(export_path), export_dir, export_file);
// make dest directory if it doesn't exist
BLI_make_existing_file(export_path);
}
if (is_generated || is_dirty) {
// This image in its current state only exists in Blender memory.
// So we have to export it. The export will keep the image state intact,
// so the exported file will not be associated with the image.
if (BKE_imbuf_write_as(imbuf, export_path, &imageFormat, true) != 0) {
fprintf(stderr, "Collada export: Cannot export image to:\n%s\n", export_path);
}
BLI_strncpy(export_path, export_file, sizeof(export_path));
}
else {
// make absolute source path
BLI_strncpy(source_path, image->name, sizeof(source_path));
BLI_path_abs(source_path, G.main->name);
BLI_cleanup_path(NULL, source_path);
if (use_copies) {
// This image is already located on the file system.
// But we want to create copies here.
// To avoid overwroting images with same file name but
// differenet source locations
if (BLI_copy(source_path, export_path) != 0) {
fprintf(stderr, "Collada export: Cannot copy image:\n source:%s\ndest :%s\n", source_path, export_path);
}
BLI_strncpy(export_path, export_file, sizeof(export_path));
}
else {
// Do not make any vopies, but use the source path directly as reference
// to the original image
BLI_strncpy(export_path, source_path, sizeof(export_path));
}
}
COLLADASW::Image img(COLLADABU::URI(COLLADABU::URI::nativePathToUri(export_path)), translated_name, translated_name); /* set name also to mNameNC. This helps other viewers import files exported from Blender better */
img.add(mSW);
fprintf(stdout, "Collada export: Added image: %s\n",export_file);
mImages.push_back(translated_name);
}
}
void ImagesExporter::export_UV_Images()
{
std::set<Image *> uv_textures;
LinkNode *node;
bool use_copies = this->export_settings->use_texture_copies;
for (node=this->export_settings->export_set; node; node=node->next) {
Object *ob = (Object *)node->link;
if (ob->type == OB_MESH && ob->totcol) {
Mesh *me = (Mesh *) ob->data;
BKE_mesh_tessface_ensure(me);
for (int i = 0; i < me->pdata.totlayer; i++) {
if (me->pdata.layers[i].type == CD_MTEXPOLY) {
MTexPoly *txface = (MTexPoly *)me->pdata.layers[i].data;
MFace *mface = me->mface;
for (int j = 0; j < me->totpoly; j++, mface++, txface++) {
Image *ima = txface->tpage;
if (ima == NULL)
continue;
bool not_in_list = uv_textures.find(ima)==uv_textures.end();
if (not_in_list) {
uv_textures.insert(ima);
export_UV_Image(ima, use_copies);
}
}
}
}
}
}
}
bool ImagesExporter::hasImages(Scene *sce)
{
LinkNode *node;
@@ -64,60 +192,49 @@ bool ImagesExporter::hasImages(Scene *sce)
}
}
if (ob->type == OB_MESH) {
Mesh *me = (Mesh *) ob->data;
BKE_mesh_tessface_ensure(me);
bool has_uvs = (bool)CustomData_has_layer(&me->fdata, CD_MTFACE);
if (has_uvs) {
int num_layers = CustomData_number_of_layers(&me->fdata, CD_MTFACE);
for (int a = 0; a < num_layers; a++) {
MTFace *tface = (MTFace *)CustomData_get_layer_n(&me->fdata, CD_MTFACE, a);
Image *img = tface->tpage;
if(img) return true;
}
}
}
}
return false;
}
void ImagesExporter::exportImages(Scene *sce)
{
if (hasImages(sce)) {
openLibrary();
MaterialFunctor mf;
mf.forEachMaterialInExportSet<ImagesExporter>(sce, *this, this->export_settings->export_set);
openLibrary();
closeLibrary();
MaterialFunctor mf;
mf.forEachMaterialInExportSet<ImagesExporter>(sce, *this, this->export_settings->export_set);
if (this->export_settings->include_uv_textures) {
export_UV_Images();
}
closeLibrary();
}
void ImagesExporter::operator()(Material *ma, Object *ob)
{
int a;
bool use_texture_copies = this->export_settings->use_texture_copies;
for (a = 0; a < MAX_MTEX; a++) {
MTex *mtex = ma->mtex[a];
if (mtex && mtex->tex && mtex->tex->ima) {
Image *image = mtex->tex->ima;
std::string name(id_name(image));
name = translate_id(name);
char rel[FILE_MAX];
char abs[FILE_MAX];
char src[FILE_MAX];
char dir[FILE_MAX];
BLI_split_dir_part(this->export_settings->filepath, dir, sizeof(dir));
BKE_rebase_path(abs, sizeof(abs), rel, sizeof(rel), G.main->name, image->name, dir);
if (abs[0] != '\0') {
// make absolute source path
BLI_strncpy(src, image->name, sizeof(src));
BLI_path_abs(src, G.main->name);
// make dest directory if it doesn't exist
BLI_make_existing_file(abs);
if (BLI_copy(src, abs) != 0) {
fprintf(stderr, "Cannot copy image to file's directory.\n");
}
}
if (find(mImages.begin(), mImages.end(), name) == mImages.end()) {
COLLADASW::Image img(COLLADABU::URI(COLLADABU::URI::nativePathToUri(rel)), name, name); /* set name also to mNameNC. This helps other viewers import files exported from Blender better */
img.add(mSW);
mImages.push_back(name);
}
export_UV_Image(image, use_texture_copies);
}
}
}

View File

@@ -35,6 +35,7 @@
#include "COLLADASWLibraryImages.h"
#include "DNA_material_types.h"
#include "DNA_image_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
@@ -49,6 +50,9 @@ public:
void operator()(Material *ma, Object *ob);
private:
std::vector<std::string> mImages; // contains list of written images, to avoid duplicates
void ImagesExporter::export_UV_Images();
void ImagesExporter::export_UV_Image(Image *image, bool use_texture_copies);
bool hasImages(Scene *sce);
const ExportSettings *export_settings;
};

View File

@@ -41,7 +41,7 @@
#include "collada_internal.h"
#include "collada_utils.h"
void InstanceWriter::add_material_bindings(COLLADASW::BindMaterial& bind_material, Object *ob)
void InstanceWriter::add_material_bindings(COLLADASW::BindMaterial& bind_material, Object *ob, bool active_uv_only)
{
for (int a = 0; a < ob->totcol; a++) {
Material *ma = give_current_material(ob, a + 1);
@@ -52,16 +52,20 @@ void InstanceWriter::add_material_bindings(COLLADASW::BindMaterial& bind_materia
std::string matid(get_material_id(ma));
matid = translate_id(matid);
std::ostringstream ostr;
ostr << translate_id(id_name(ma));
ostr << matid;
COLLADASW::InstanceMaterial im(ostr.str(), COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, matid));
// create <bind_vertex_input> for each uv map
Mesh *me = (Mesh *)ob->data;
int totlayer = CustomData_number_of_layers(&me->fdata, CD_MTFACE);
int map_index = 0;
int active_uv_index = CustomData_get_active_layer_index(&me->fdata, CD_MTFACE) -1;
for (int b = 0; b < totlayer; b++) {
char *name = bc_CustomData_get_layer_name(&me->fdata, CD_MTFACE, b);
im.push_back(COLLADASW::BindVertexInput(name, "TEXCOORD", b));
if (!active_uv_only || b == active_uv_index) {
char *name = bc_CustomData_get_layer_name(&me->fdata, CD_MTFACE, map_index);
im.push_back(COLLADASW::BindVertexInput(name, "TEXCOORD", map_index++));
}
}
iml.push_back(im);

View File

@@ -35,7 +35,7 @@
class InstanceWriter
{
protected:
void add_material_bindings(COLLADASW::BindMaterial& bind_material, Object *ob);
void add_material_bindings(COLLADASW::BindMaterial& bind_material, Object *ob, bool active_uv_only);
};
#endif

View File

@@ -32,9 +32,9 @@ defs = []
# TODO sanitize inc path building
# relative paths to include dirs, space-separated, string
if env['OURPLATFORM']=='darwin':
incs = '../blenlib ../blenkernel ../windowmanager ../blenloader ../makesdna ../makesrna ../editors/include ../../../intern/guardedalloc [OPENCOLLADA]/COLLADAStreamWriter [OPENCOLLADA]/COLLADABaseUtils [OPENCOLLADA]/COLLADAFramework [OPENCOLLADA]/COLLADASaxFrameworkLoader [OPENCOLLADA]/GeneratedSaxParser '.replace('[OPENCOLLADA]', env['BF_OPENCOLLADA_INC'])
incs = '../blenlib ../blenkernel ../windowmanager ../blenloader ../makesdna ../makesrna ../editors/include ../imbuf ../../../intern/guardedalloc [OPENCOLLADA]/COLLADAStreamWriter [OPENCOLLADA]/COLLADABaseUtils [OPENCOLLADA]/COLLADAFramework [OPENCOLLADA]/COLLADASaxFrameworkLoader [OPENCOLLADA]/GeneratedSaxParser '.replace('[OPENCOLLADA]', env['BF_OPENCOLLADA_INC'])
else:
incs = '../blenlib ../blenkernel ../windowmanager ../makesdna ../blenloader ../makesrna ../editors/include ../../../intern/guardedalloc [OPENCOLLADA]/COLLADAStreamWriter/include [OPENCOLLADA]/COLLADABaseUtils/include [OPENCOLLADA]/COLLADAFramework/include [OPENCOLLADA]/COLLADASaxFrameworkLoader/include [OPENCOLLADA]/GeneratedSaxParser/include '.replace('[OPENCOLLADA]', env['BF_OPENCOLLADA_INC'])
incs = '../blenlib ../blenkernel ../windowmanager ../makesdna ../blenloader ../makesrna ../editors/include ../imbuf ../../../intern/guardedalloc [OPENCOLLADA]/COLLADAStreamWriter/include [OPENCOLLADA]/COLLADABaseUtils/include [OPENCOLLADA]/COLLADAFramework/include [OPENCOLLADA]/COLLADASaxFrameworkLoader/include [OPENCOLLADA]/GeneratedSaxParser/include '.replace('[OPENCOLLADA]', env['BF_OPENCOLLADA_INC'])
if env['BF_BUILDINFO']:
defs.append('WITH_BUILDINFO')

View File

@@ -141,7 +141,7 @@ void SceneExporter::writeNodes(Object *ob, Scene *sce)
COLLADASW::InstanceGeometry instGeom(mSW);
instGeom.setUrl(COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, get_geometry_id(ob, this->export_settings->use_object_instantiation)));
InstanceWriter::add_material_bindings(instGeom.getBindMaterial(), ob);
InstanceWriter::add_material_bindings(instGeom.getBindMaterial(), ob, this->export_settings->active_uv_only);
instGeom.add();
}

View File

@@ -61,6 +61,10 @@ int collada_export(Scene *sce,
int include_armatures,
int deform_bones_only,
int active_uv_only,
int include_uv_textures,
int use_texture_copies,
int use_object_instantiation,
int sort_by_name,
int second_life)
@@ -79,12 +83,16 @@ int collada_export(Scene *sce,
export_settings.filepath = (char *)filepath;
export_settings.apply_modifiers = apply_modifiers != 0;
export_settings.export_mesh_type = export_mesh_type;
export_settings.export_mesh_type = export_mesh_type;
export_settings.selected = selected != 0;
export_settings.include_children = include_children != 0;
export_settings.include_armatures = include_armatures != 0;
export_settings.deform_bones_only = deform_bones_only != 0;
export_settings.active_uv_only = active_uv_only != 0;
export_settings.include_uv_textures = include_uv_textures;
export_settings.use_texture_copies = use_texture_copies;
export_settings.use_object_instantiation = use_object_instantiation != 0;
export_settings.sort_by_name = sort_by_name != 0;
export_settings.second_life = second_life != 0;

View File

@@ -57,6 +57,10 @@ int collada_export(Scene *sce,
int include_armatures,
int deform_bones_only,
int active_uv,
int include_textures,
int use_texture_copies,
int use_object_instantiation,
int sort_by_name,
int second_life);

View File

@@ -275,3 +275,9 @@ bool bc_is_root_bone(Bone *aBone, bool deform_bones_only)
else
return !(aBone->parent);
}
int bc_get_active_UVLayer(Object *ob)
{
Mesh *me = (Mesh *)ob->data;
return CustomData_get_active_layer_index(&me->fdata, CD_MTFACE);
}

View File

@@ -73,5 +73,6 @@ extern char *bc_CustomData_get_active_layer_name(const CustomData *data, int typ
extern void bc_bubble_sort_by_Object_name(LinkNode *export_set);
extern bool bc_is_root_bone(Bone *aBone, bool deform_bones_only);
extern int bc_get_active_UVLayer(Object *ob);
#endif

View File

@@ -98,23 +98,42 @@ void KeyingOperation::executePixel(float *color, float x, float y, PixelSampler
int primary_channel = get_pixel_primary_channel(screenColor);
float saturation = get_pixel_saturation(pixelColor, this->screenBalance, primary_channel);
float screen_saturation = get_pixel_saturation(screenColor, this->screenBalance, primary_channel);
if (saturation < 0) {
if (pixelColor[primary_channel] > 1.0f) {
/* overexposure doesn't happen on screen itself and usually happens
* on light sources in the shot, this need to be checked separately
* because saturation and falloff calculation is based on the fact
* that pixels are not overexposured
*/
color[0] = 1.0f;
}
else if (saturation >= screen_saturation) {
color[0] = 0.0f;
}
else {
float distance = 1.0f - saturation / screen_saturation;
float saturation = get_pixel_saturation(pixelColor, this->screenBalance, primary_channel);
float screen_saturation = get_pixel_saturation(screenColor, this->screenBalance, primary_channel);
color[0] = distance;
if (saturation < 0) {
/* means main channel of pixel is different from screen,
* assume this is completely a foreground
*/
color[0] = 1.0f;
}
else if (saturation >= screen_saturation) {
/* matched main channels and higher saturation on pixel
* is treated as completely background
*/
color[0] = 0.0f;
}
else {
/* nice alpha falloff on edges */
float distance = 1.0f - saturation / screen_saturation;
color[0] = distance;
}
}
color[0] *= (1.0f - garbageValue[0]);
/* apply garbage matte */
color[0] = MIN2(color[0], 1.0f - garbageValue[0]);
/* apply core matte */
color[0] = MAX2(color[0], coreValue[0]);
}

View File

@@ -83,6 +83,11 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
int include_children;
int include_armatures;
int deform_bones_only;
int include_uv_textures;
int use_texture_copies;
int active_uv_only;
int use_object_instantiation;
int sort_by_name;
int second_life;
@@ -97,11 +102,16 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
/* Options panel */
apply_modifiers = RNA_boolean_get(op->ptr, "apply_modifiers");
export_mesh_type = RNA_enum_get(op->ptr, "export_mesh_type_selection");
export_mesh_type = RNA_enum_get(op->ptr, "export_mesh_type_selection");
selected = RNA_boolean_get(op->ptr, "selected");
include_children = RNA_boolean_get(op->ptr, "include_children");
include_armatures = RNA_boolean_get(op->ptr, "include_armatures");
deform_bones_only = RNA_boolean_get(op->ptr, "deform_bones_only");
include_uv_textures = RNA_boolean_get(op->ptr, "include_uv_textures");
use_texture_copies = RNA_boolean_get(op->ptr, "use_texture_copies");
active_uv_only = RNA_boolean_get(op->ptr, "active_uv_only");
use_object_instantiation = RNA_boolean_get(op->ptr, "use_object_instantiation");
sort_by_name = RNA_boolean_get(op->ptr, "sort_by_name");
second_life = RNA_boolean_get(op->ptr, "second_life");
@@ -118,6 +128,11 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
include_children,
include_armatures,
deform_bones_only,
include_uv_textures,
active_uv_only,
use_texture_copies,
use_object_instantiation,
sort_by_name,
second_life)) {
@@ -130,7 +145,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
{
uiLayout *box, *row, *col, *sub, *split;
uiLayout *box, *row, *col, *split;
/* Export Options: */
box = uiLayoutBox(layout);
@@ -138,30 +153,38 @@ void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
uiItemL(row, IFACE_("Export Data Options:"), ICON_MESH_DATA);
row = uiLayoutRow(box, 0);
col = uiLayoutColumn(row, 0);
split = uiLayoutSplit(col, 0.5f, 0);
uiItemR(split, imfptr, "apply_modifiers", 0, NULL, ICON_NONE);
sub = uiLayoutRow(split, 0);
uiItemR(sub, imfptr, "export_mesh_type_selection", UI_ITEM_R_EXPAND, IFACE_("Color"), ICON_NONE);
uiLayoutSetEnabled(sub, RNA_boolean_get(imfptr, "apply_modifiers"));
split = uiLayoutSplit(row, 0.6f, UI_LAYOUT_ALIGN_RIGHT);
col = uiLayoutColumn(split,0);
uiItemR(col, imfptr, "apply_modifiers", 0, NULL, ICON_NONE);
col = uiLayoutColumn(split,0);
uiItemR(col, imfptr, "export_mesh_type_selection", 0, "", ICON_NONE);
uiLayoutSetEnabled(col, RNA_boolean_get(imfptr, "apply_modifiers"));
row = uiLayoutRow(box, 0);
uiItemR(row, imfptr, "selected", 0, NULL, ICON_NONE);
row = uiLayoutRow(box, 0);
col = uiLayoutColumn(row, 0);
split = uiLayoutSplit(col, 0.1f, 0);
sub = uiLayoutRow(split, 0);
uiItemR(split, imfptr, "include_children", 0, NULL, ICON_NONE);
uiItemR(row, imfptr, "include_children", 0, NULL, ICON_NONE);
uiLayoutSetEnabled(row, RNA_boolean_get(imfptr, "selected"));
row = uiLayoutRow(box, 0);
col = uiLayoutColumn(row, 0);
split = uiLayoutSplit(col, 0.1f, 0);
sub = uiLayoutRow(split, 0);
uiItemR(split, imfptr, "include_armatures", 0, NULL, ICON_NONE);
uiItemR(row, imfptr, "include_armatures", 0, NULL, ICON_NONE);
uiLayoutSetEnabled(row, RNA_boolean_get(imfptr, "selected"));
// Texture options
box = uiLayoutBox(layout);
row = uiLayoutRow(box, 0);
uiItemL(row, IFACE_("Texture Options:"), ICON_TEXTURE_DATA);
row = uiLayoutRow(box, 0);
uiItemR(row, imfptr, "active_uv_only", 0, NULL, ICON_NONE);
row = uiLayoutRow(box, 0);
uiItemR(row, imfptr, "include_uv_textures", 0, NULL, ICON_NONE);
row = uiLayoutRow(box, 0);
uiItemR(row, imfptr, "use_texture_copies", 1, NULL, ICON_NONE);
// Armature options
box = uiLayoutBox(layout);
@@ -215,8 +238,9 @@ void WM_OT_collada_export(wmOperatorType *ot)
WM_operator_properties_filesel(ot, FOLDERFILE | COLLADAFILE, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
RNA_def_boolean(ot->srna, "apply_modifiers", 0, "Apply Modifiers",
"Apply modifiers");
RNA_def_boolean(ot->srna,
"apply_modifiers", 0, "Apply Modifiers",
"Apply modifiers to exported mesh (non destructive))");
RNA_def_int(ot->srna, "export_mesh_type", 0, INT_MIN, INT_MAX,
"Resolution", "Modifier resolution for export", INT_MIN, INT_MAX);
@@ -237,6 +261,16 @@ void WM_OT_collada_export(wmOperatorType *ot)
"Only export deforming bones with armatures");
RNA_def_boolean(ot->srna, "active_uv_only", 0, "Only Active UV layer",
"Export textures assigned to the object UV maps");
RNA_def_boolean(ot->srna, "include_uv_textures", 0, "Include UV Textures",
"Export textures assigned to the object UV maps");
RNA_def_boolean(ot->srna, "use_texture_copies", 1, "copy",
"Copy textures to same folder where the .dae file is exported");
RNA_def_boolean(ot->srna, "use_object_instantiation", 1, "Use Object Instances",
"Instantiate multiple Objects from same Data");

View File

@@ -3611,7 +3611,7 @@ static void def_cmp_keying(StructRNA *srna)
prop = RNA_def_property(srna, "edge_kernel_radius", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "edge_kernel_radius");
RNA_def_property_range(prop, -100, 100);
RNA_def_property_range(prop, 0, 100);
RNA_def_property_ui_text(prop, "Edge Kernel Radius", "Radius of kernel used to detect whether pixel belongs to edge");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");

View File

@@ -91,16 +91,23 @@ static void rna_Scene_collada_export(
const char *filepath,
int apply_modifiers,
int export_mesh_type,
int selected,
int selected,
int include_children,
int include_armatures,
int deform_bones_only,
int active_uv_only,
int include_textures,
int use_texture_copies,
int use_object_instantiation,
int sort_by_name,
int second_life)
{
collada_export(scene, filepath, apply_modifiers, export_mesh_type, selected,
include_children, include_armatures, deform_bones_only,
include_children, include_armatures, deform_bones_only,
active_uv_only, include_textures, use_texture_copies,
use_object_instantiation, sort_by_name, second_life);
}
@@ -136,6 +143,11 @@ void RNA_api_scene(StructRNA *srna)
parm = RNA_def_boolean(func, "include_children", 0, "Include Children", "Export all children of selected objects (even if not selected)");
parm = RNA_def_boolean(func, "include_armatures", 0, "Include Armatures", "Export related armatures (even if not selected)");
parm = RNA_def_boolean(func, "deform_bones_only", 0, "Deform Bones only", "Only export deforming bones with armatures");
parm = RNA_def_boolean(func, "active_uv_only", 0, "Active UV Layer only", "Export only the active UV Layer");
parm = RNA_def_boolean(func, "include_textures", 0, "Include Textures", "Export related textures");
parm = RNA_def_boolean(func, "use_texture_copies", 0, "copy", "Copy textures to same folder where the .dae file is exported");
parm = RNA_def_boolean(func, "use_object_instantiation", 1, "Use Object Instances", "Instantiate multiple Objects from same Data");
parm = RNA_def_boolean(func, "sort_by_name", 0, "Sort by Object name", "Sort exported data by Object name");
parm = RNA_def_boolean(func, "second_life", 0, "Export for Second Life", "Compatibility mode for Second Life");

View File

@@ -154,7 +154,7 @@ endif()
list(APPEND BLENDER_SORTED_LIBS extern_eltopo)
endif()
if(WITH_BUILTIN_GLEW)
if(NOT WITH_SYSTEM_GLEW)
list(APPEND BLENDER_SORTED_LIBS extern_glew)
endif()

View File

@@ -927,7 +927,7 @@ endif()
list(APPEND BLENDER_SORTED_LIBS extern_eltopo)
endif()
if(WITH_BUILTIN_GLEW)
if(NOT WITH_SYSTEM_GLEW)
list(APPEND BLENDER_SORTED_LIBS extern_glew)
endif()

View File

@@ -141,6 +141,16 @@ bool BL_Action::Play(const char* name,
return false;
}
// If we have the same settings, don't play again
// This is to resolve potential issues with pulses on sensors such as the ones
// reported in bug #29412. The fix is here so it works for both logic bricks and Python.
// However, this may eventually lead to issues where a user wants to override an already
// playing action with the same action and settings. If this becomes an issue,
// then this fix may have to be re-evaluated.
if (!IsDone() && m_action == prev_action && m_startframe == start && m_endframe == end
&& m_priority == priority && m_speed == playback_speed)
return false;
if (prev_action != m_action)
{
// First get rid of any old controllers