| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357 |
- diff --git a/source/blender/collada/EffectExporter.cpp b/source/blender/collada/EffectExporter.cpp
- index 76b5114..11ea02e 100644
- --- a/source/blender/collada/EffectExporter.cpp
- +++ b/source/blender/collada/EffectExporter.cpp
- @@ -47,7 +47,9 @@ extern "C" {
- #include "BKE_customdata.h"
- #include "BKE_mesh.h"
- #include "BKE_material.h"
- + #include "BKE_idprop.h"
- }
- +#include <sstream>
-
- // OB_MESH is assumed
- static std::string getActiveUVLayerName(Object *ob)
- @@ -170,6 +172,26 @@ void EffectsExporter::writeTextures(COLLADASW::EffectProfile &ep,
- texture.setChildElementName("bump");
- ep.addExtraTechniqueColorOrTexture(COLLADASW::ColorOrTexture(texture));
- }
- + // AnKi: Add some textures
- + if (t->mapto & MAP_HAR) {
- + COLLADASW::Texture texture(key);
- + texture.setTexcoord(uvname);
- + texture.setSampler(*sampler);
- + texture.setProfileName("blender");
- + texture.setChildElementName("roughness");
- + ep.addExtraTechniqueColorOrTexture(COLLADASW::ColorOrTexture(texture));
- + }
- + if (t->mapto & MAP_DISPLACE) {
- + COLLADASW::Texture texture(key);
- + texture.setTexcoord(uvname);
- + texture.setSampler(*sampler);
- + texture.setProfileName("blender");
- + texture.setChildElementName("height");
- + ep.addExtraTechniqueColorOrTexture(COLLADASW::ColorOrTexture(texture));
- + }
- + if ((t->mapto & MAP_COLMIR) || (t->mapto & MAP_RAYMIRR)) {
- + ep.setReflective(createTexture(ima, uvname, sampler));
- + }
- }
-
- void EffectsExporter::operator()(Material *ma, Object *ob)
- @@ -398,6 +420,68 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
- }
- }
-
- + // AnKi: Export extra properties
- + static const char *property_names[] = {
- + "diffuse_texture_detail",
- + "normal_texture_detail",
- + "material_override",
- + "metallic",
- + "roughness",
- + "subsurface",
- + NULL};
- + IDProperty *rprop = ma->id.properties;
- + while (rprop) {
- + if (rprop->type == IDP_GROUP) {
- + // Search properties
- + const char **iter = property_names;
- + while (*iter != NULL) {
- + const char *prop_name = *iter;
- + IDProperty *prop = IDP_GetPropertyFromGroup(rprop, prop_name);
- +
- + if (prop) {
- + const char *value = NULL;
- + float valuef = 0.0;
- + bool ok = true;
- +
- + if(prop->type == IDP_STRING) {
- + value = IDP_String(prop);
- + }
- + else if (prop->type == IDP_FLOAT) {
- + valuef = IDP_Float(prop);
- + }
- + else if (prop->type == IDP_DOUBLE) {
- + valuef = IDP_Double(prop);
- + }
- + else if (prop->type == IDP_INT) {
- + valuef = IDP_Int(prop);
- + }
- + else {
- + printf("Property value type cannot be handled\n");
- + ok = false;
- + }
- +
- + if (ok)
- + {
- + if (value) {
- + printf("Found %s property \"%s\"\n", prop_name, value);
- + ep.addExtraTechniqueParameter("blender", prop_name, COLLADASW::String(value));
- + }
- + else {
- + printf("Found %s property %f\n", prop_name, valuef);
- + std::stringstream ss;
- + ss << valuef;
- + ep.addExtraTechniqueParameter("blender", prop_name, COLLADASW::String(ss.str()));
- + }
- + }
- + } // end found
- +
- + ++iter;
- + } // end iterate property_names
- + } // end group
- +
- + rprop = rprop->next;
- + }
- +
- // performs the actual writing
- ep.addProfileElements();
- bool twoSided = false;
- diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp
- index 7c7c57f..b02ba47 100644
- --- a/source/blender/collada/GeometryExporter.cpp
- +++ b/source/blender/collada/GeometryExporter.cpp
- @@ -47,6 +47,7 @@ extern "C" {
- #include "BKE_customdata.h"
- #include "BKE_material.h"
- #include "BKE_mesh.h"
- + #include "BKE_idprop.h"
- }
-
- #include "collada_internal.h"
- @@ -143,13 +144,133 @@ void GeometryExporter::operator()(Object *ob)
- createPolylist(0, has_uvs, has_color, ob, me, geom_id, norind);
- }
- }
- -
- +
- + // AnKi: Export mesh properties
- + {
- + static const char *property_names[] = {
- + "particles",
- + "collision",
- + "sector",
- + "portal",
- + "lod1",
- + "skip",
- + "reflection_probe",
- + "reflection_proxy",
- + "occluder",
- + "collision_mesh",
- + "decal_diffuse_atlas",
- + "decal_diffuse_sub_texture",
- + "decal_diffuse_factor",
- + "decal_normal_roughness_atlas",
- + "decal_normal_roughness_sub_texture",
- + "decal_normal_roughness_factor",
- + NULL};
- +
- + ID *mesh_id = (ID*)ob->data;
- + IDProperty *rprop = mesh_id->properties;
- + while (rprop) {
- + if (rprop->type == IDP_GROUP) {
- + const char **iter = property_names;
- + while (*iter != NULL) {
- + const char *prop_name = *iter;
- + IDProperty *prop = IDP_GetPropertyFromGroup(rprop, prop_name);
- +
- + if (prop) {
- + const char *value = NULL;
- + float valuef = 0.0;
- + bool ok = true;
- +
- + if(prop->type == IDP_STRING) {
- + value = IDP_String(prop);
- + }
- + else if (prop->type == IDP_FLOAT) {
- + valuef = IDP_Float(prop);
- + }
- + else if (prop->type == IDP_DOUBLE) {
- + valuef = IDP_Double(prop);
- + }
- + else if (prop->type == IDP_INT) {
- + valuef = IDP_Int(prop);
- + }
- + else {
- + printf("Property value type cannot be handled\n");
- + ok = false;
- + }
- +
- + if (ok) {
- + if (value) {
- + printf("Found %s property \"%s\"\n", prop_name, value);
- +
- + std::string str = std::string("<") + prop_name + ">" + value + "</" + prop_name + ">";
- + mSW->appendTextBlock(str.c_str());
- + }
- + else {
- + printf("Found %s property \"%f\"\n", prop_name, valuef);
- +
- + std::stringstream ss;
- + ss << "<" << prop_name << ">" << valuef << "</" << prop_name << ">";
- + mSW->appendTextBlock(ss.str().c_str());
- + }
- + }
- + } // end found
- +
- + ++iter;
- + } // end iterate property_names
- + } // end group
- +
- + rprop = rprop->next;
- + }
- + }
- +
- closeMesh();
-
- if (me->flag & ME_TWOSIDED) {
- mSW->appendTextBlock("<extra><technique profile=\"MAYA\"><double_sided>1</double_sided></technique></extra>");
- }
-
- + // AnKi: Export object properties
- + {
- + static const char *property_names[] = {
- + "add some",
- + NULL};
- + IDProperty *rprop = ob->id.properties;
- + while (rprop) {
- + if (rprop->type == IDP_GROUP) {
- + // Search properties
- + const char **iter = property_names;
- + while (*iter != NULL) {
- + const char *prop_name = *iter;
- + IDProperty *prop = IDP_GetPropertyFromGroup(rprop, prop_name);
- +
- + if (prop) {
- + const char *value = NULL;
- +
- + if(prop->type == IDP_STRING) {
- + value = IDP_String(prop);
- + }
- + else {
- + printf("Property's value is not string\n");
- + }
- +
- + if (value) {
- + printf("Found %s property \"%s\"\n", prop_name, value);
- +
- + std::string str = std::string("<") + prop_name + ">" + value + "</" + prop_name + ">";
- + mSW->appendTextBlock(str.c_str());
- + }
- + else {
- + printf("Value error in %s property\n", prop_name);
- + }
- + } // end found
- +
- + ++iter;
- + } // end iterate property_names
- + } // end group
- +
- + rprop = rprop->next;
- + }
- + }
- +
- closeGeometry();
-
- if (this->export_settings->include_shapekeys) {
- diff --git a/source/blender/collada/LightExporter.cpp b/source/blender/collada/LightExporter.cpp
- index ff50abf..205f687 100644
- --- a/source/blender/collada/LightExporter.cpp
- +++ b/source/blender/collada/LightExporter.cpp
- @@ -31,6 +31,9 @@
- #include "COLLADASWLight.h"
-
- #include "BLI_math.h"
- +extern "C" {
- +#include "BKE_idprop.h"
- +}
-
- #include "LightExporter.h"
- #include "collada_internal.h"
- @@ -107,6 +110,7 @@ void LightsExporter::operator()(Object *ob)
- cla.setLinearAttenuation(linatt);
- cla.setQuadraticAttenuation(quadatt);
- exportBlenderProfile(cla, la);
- + cla.addExtraTechniqueParameter("FCOLLADA", "outer_cone", RAD2DEGF(la->spotsize)); // AnKi: Add cone angle
- addLight(cla);
- }
- // lamp
- @@ -190,6 +194,49 @@ bool LightsExporter::exportBlenderProfile(COLLADASW::Light &cla, Lamp *la)
- cla.addExtraTechniqueParameter("blender", "skyblendfac", la->skyblendfac);
- cla.addExtraTechniqueParameter("blender", "sky_exposure", la->sky_exposure);
- cla.addExtraTechniqueParameter("blender", "sky_colorspace", la->sky_colorspace);
- -
- +
- + // AnKi: Export properties
- + static const char *property_names[] = {
- + "lens_flare",
- + "lens_flare_first_sprite_size",
- + "lens_flare_color",
- + "specular_color",
- + "shadow",
- + "light_event_intensity",
- + "light_event_frequency",
- + NULL};
- + IDProperty *rprop = la->id.properties;
- + while (rprop) {
- + if (rprop->type == IDP_GROUP) {
- + // Search properties
- + const char **iter = property_names;
- + while (*iter != NULL) {
- + const char *prop_name = *iter;
- + IDProperty *prop = IDP_GetPropertyFromGroup(rprop, prop_name);
- +
- + if (prop) {
- + const char *value = NULL;
- +
- + if(prop->type == IDP_STRING) {
- + value = IDP_String(prop);
- + }
- +
- + if (value) {
- + printf("Found %s property \"%s\"\n", prop_name, value);
- +
- + cla.addExtraTechniqueParameter("blender", prop_name, COLLADASW::String(value));
- + }
- + else {
- + printf("Value error in %s property\n", prop_name);
- + }
- + } // end found
- +
- + ++iter;
- + } // end iterate property_names
- + } // end group
- +
- + rprop = rprop->next;
- + }
- +
- return true;
- }
- diff --git a/source/blender/collada/SceneExporter.cpp b/source/blender/collada/SceneExporter.cpp
- index 30cd6dd..17563dd 100644
- --- a/source/blender/collada/SceneExporter.cpp
- +++ b/source/blender/collada/SceneExporter.cpp
- @@ -28,6 +28,7 @@ extern "C" {
- #include "BLI_utildefines.h"
- #include "BKE_object.h"
- #include "BLI_listbase.h"
- + #include "BKE_group.h"
- }
-
- #include "SceneExporter.h"
- @@ -234,6 +235,14 @@ void SceneExporter::writeNodes(Object *ob, Scene *sce)
- }
- }
-
- + // AnKi: Export group
- + Group *group = BKE_group_object_find(NULL, ob);
- + if (group) {
- + colladaNode.addExtraTechniqueParameter("blender", "group", COLLADASW::String(group->id.name));
- + } else {
- + colladaNode.addExtraTechniqueParameter("blender", "group", COLLADASW::String("none"));
- + }
- +
- for (std::list<Object *>::iterator i = child_objects.begin(); i != child_objects.end(); ++i) {
- if (bc_is_marked(*i)) {
- bc_remove_mark(*i);
|