forked from bartvdbraak/blender
style cleanup
This commit is contained in:
parent
809e37bf15
commit
942ad6d9cd
@ -325,7 +325,9 @@ static short addedgetoscanvert(ScanFillVertLink *sc, ScanFillEdge *eed)
|
||||
fac1 = 1.0e10f * (eed->v2->xy[0] - x);
|
||||
|
||||
}
|
||||
else fac1 = (x - eed->v2->xy[0]) / fac1;
|
||||
else {
|
||||
fac1 = (x - eed->v2->xy[0]) / fac1;
|
||||
}
|
||||
|
||||
for (ed = sc->edge_first; ed; ed = ed->next) {
|
||||
|
||||
@ -649,7 +651,9 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag)
|
||||
if (ed1->v1->h > 1) ed1->v1->h--;
|
||||
if (ed1->v2->h > 1) ed1->v2->h--;
|
||||
}
|
||||
else ed1->v2->f = SF_VERT_UNKNOWN;
|
||||
else {
|
||||
ed1->v2->f = SF_VERT_UNKNOWN;
|
||||
}
|
||||
|
||||
ed1 = nexted;
|
||||
}
|
||||
@ -682,7 +686,6 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag)
|
||||
if (v1 == v2 || v2 == v3) break;
|
||||
/* printf("test verts %x %x %x\n", v1, v2, v3); */
|
||||
miny = min_ff(v1->xy[1], v3->xy[1]);
|
||||
/* miny = min_ff(v1->xy[1], v3->xy[1]); */
|
||||
sc1 = sc + 1;
|
||||
test = 0;
|
||||
|
||||
|
@ -161,9 +161,9 @@ void AnimationExporter::export_morph_animation(Object *ob)
|
||||
FCurve *fcu;
|
||||
char *transformName;
|
||||
Key *key = BKE_key_from_object(ob);
|
||||
if(!key) return;
|
||||
if (!key) return;
|
||||
|
||||
if(key->adt && key->adt->action){
|
||||
if (key->adt && key->adt->action) {
|
||||
fcu = (FCurve *)key->adt->action->curves.first;
|
||||
|
||||
while (fcu) {
|
||||
@ -177,17 +177,17 @@ void AnimationExporter::export_morph_animation(Object *ob)
|
||||
|
||||
}
|
||||
|
||||
void AnimationExporter::make_anim_frames_from_targets(Object *ob, std::vector<float> &frames ){
|
||||
|
||||
void AnimationExporter::make_anim_frames_from_targets(Object *ob, std::vector<float> &frames )
|
||||
{
|
||||
ListBase *conlist = get_active_constraints(ob);
|
||||
if(conlist == NULL) return;
|
||||
if (conlist == NULL) return;
|
||||
bConstraint *con;
|
||||
for (con = (bConstraint*)conlist->first; con; con = con->next) {
|
||||
ListBase targets = {NULL, NULL};
|
||||
|
||||
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con);
|
||||
|
||||
if(!validateConstraints(con)) continue;
|
||||
if (!validateConstraints(con)) continue;
|
||||
|
||||
if (cti && cti->get_constraint_targets) {
|
||||
bConstraintTarget *ct;
|
||||
@ -197,8 +197,8 @@ void AnimationExporter::make_anim_frames_from_targets(Object *ob, std::vector<fl
|
||||
* - ct->matrix members have not yet been calculated here!
|
||||
*/
|
||||
cti->get_constraint_targets(con, &targets);
|
||||
if(cti){
|
||||
for (ct = (bConstraintTarget*)targets.first; ct; ct = ct->next){
|
||||
if (cti) {
|
||||
for (ct = (bConstraintTarget*)targets.first; ct; ct = ct->next) {
|
||||
obtar = ct->tar;
|
||||
find_frames(obtar, frames);
|
||||
}
|
||||
@ -901,7 +901,7 @@ std::string AnimationExporter::create_4x4_source(std::vector<float> &frames, Obj
|
||||
bPoseChannel *parchan = NULL;
|
||||
bPoseChannel *pchan = NULL;
|
||||
|
||||
if (ob->type == OB_ARMATURE ){
|
||||
if (ob->type == OB_ARMATURE ) {
|
||||
bPose *pose = ob->pose;
|
||||
pchan = BKE_pose_channel_find_name(pose, bone->name);
|
||||
if (!pchan)
|
||||
@ -922,15 +922,15 @@ std::string AnimationExporter::create_4x4_source(std::vector<float> &frames, Obj
|
||||
//BKE_scene_update_for_newframe(G.main,scene,scene->lay);
|
||||
BKE_animsys_evaluate_animdata(scene, &ob->id, ob->adt, ctime, ADT_RECALC_ALL);
|
||||
|
||||
if (bone){
|
||||
if( pchan->flag & POSE_CHAIN)
|
||||
{
|
||||
if (bone) {
|
||||
if (pchan->flag & POSE_CHAIN) {
|
||||
enable_fcurves(ob->adt->action, NULL);
|
||||
BKE_animsys_evaluate_animdata(scene, &ob->id, ob->adt, ctime, ADT_RECALC_ALL);
|
||||
BKE_pose_where_is(scene, ob);
|
||||
}
|
||||
else
|
||||
BKE_pose_where_is_bone(scene, ob, pchan, ctime, 1);
|
||||
else {
|
||||
BKE_pose_where_is_bone(scene, ob, pchan, ctime, 1);
|
||||
}
|
||||
|
||||
// compute bone local mat
|
||||
if (bone->parent) {
|
||||
@ -1324,9 +1324,9 @@ bool AnimationExporter::hasAnimations(Scene *sce)
|
||||
}
|
||||
|
||||
//check shape key animation
|
||||
if(!fcu){
|
||||
if (!fcu) {
|
||||
Key *key = BKE_key_from_object(ob);
|
||||
if(key && key->adt && key->adt->action)
|
||||
if (key && key->adt && key->adt->action)
|
||||
fcu = (FCurve *)key->adt->action->curves.first;
|
||||
}
|
||||
if (fcu)
|
||||
@ -1497,8 +1497,8 @@ void AnimationExporter::sample_animation(float *v, std::vector<float> &frames, i
|
||||
enable_fcurves(ob_arm->adt->action, NULL);
|
||||
}
|
||||
|
||||
bool AnimationExporter::validateConstraints(bConstraint *con){
|
||||
|
||||
bool AnimationExporter::validateConstraints(bConstraint *con)
|
||||
{
|
||||
bool valid = true;
|
||||
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con);
|
||||
/* these we can skip completely (invalid constraints...) */
|
||||
@ -1512,7 +1512,8 @@ bool AnimationExporter::validateConstraints(bConstraint *con){
|
||||
return valid;
|
||||
}
|
||||
|
||||
void AnimationExporter::calc_ob_mat_at_time(Object *ob, float ctime , float mat[][4]){
|
||||
void AnimationExporter::calc_ob_mat_at_time(Object *ob, float ctime , float mat[][4])
|
||||
{
|
||||
ListBase *conlist = get_active_constraints(ob);
|
||||
bConstraint *con;
|
||||
for (con = (bConstraint*)conlist->first; con; con = con->next) {
|
||||
@ -1524,7 +1525,7 @@ void AnimationExporter::calc_ob_mat_at_time(Object *ob, float ctime , float mat[
|
||||
bConstraintTarget *ct;
|
||||
Object *obtar;
|
||||
cti->get_constraint_targets(con, &targets);
|
||||
for (ct = (bConstraintTarget*)targets.first; ct; ct = ct->next){
|
||||
for (ct = (bConstraintTarget*)targets.first; ct; ct = ct->next) {
|
||||
obtar = ct->tar;
|
||||
BKE_animsys_evaluate_animdata(scene, &obtar->id, obtar->adt, ctime, ADT_RECALC_ANIM);
|
||||
BKE_object_where_is_calc_time(scene, obtar, ctime);
|
||||
|
@ -273,7 +273,7 @@ void ArmatureExporter::add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW:
|
||||
}
|
||||
|
||||
// SECOND_LIFE_COMPATIBILITY
|
||||
if (export_settings->second_life) {
|
||||
if (export_settings->second_life) {
|
||||
// Remove rotations vs armature from transform
|
||||
// parent_rest_rot * mat * irest_rot
|
||||
float temp[4][4];
|
||||
|
@ -106,13 +106,14 @@ void ArmatureImporter::create_bone(SkinInfo* skin, COLLADAFW::Node *node, EditBo
|
||||
else {
|
||||
// bone-space
|
||||
get_node_mat(obmat, node, NULL, NULL);
|
||||
|
||||
|
||||
// get world-space
|
||||
if (parent){
|
||||
if (parent) {
|
||||
mult_m4_m4m4(mat, parent_mat, obmat);
|
||||
}
|
||||
else
|
||||
else {
|
||||
copy_m4_m4(mat, obmat);
|
||||
}
|
||||
}
|
||||
|
||||
if (parent) bone->parent = parent;
|
||||
@ -645,7 +646,8 @@ bool ArmatureImporter::write_controller(const COLLADAFW::Controller *controller)
|
||||
return true;
|
||||
}
|
||||
|
||||
void ArmatureImporter::make_shape_keys(){
|
||||
void ArmatureImporter::make_shape_keys()
|
||||
{
|
||||
std::vector<COLLADAFW::MorphController *>::iterator mc;
|
||||
float weight;
|
||||
|
||||
@ -668,12 +670,12 @@ void ArmatureImporter::make_shape_keys(){
|
||||
BKE_key_convert_from_mesh(source_me, kb);
|
||||
|
||||
//insert other shape keys
|
||||
for ( int i = 0 ; i < morphTargetIds.getCount() ; i++ ){
|
||||
for (int i = 0 ; i < morphTargetIds.getCount() ; i++ ) {
|
||||
//better to have a seperate map of morph objects,
|
||||
//This'll do for now since only mesh morphing is imported
|
||||
Mesh *me = this->mesh_importer->get_mesh_by_geom_uid(morphTargetIds[i]);
|
||||
|
||||
if(me){
|
||||
if (me) {
|
||||
me->key = key;
|
||||
kb = BKE_keyblock_add_ctime(key, me->id.name, FALSE);
|
||||
BKE_key_convert_from_mesh(me, kb);
|
||||
@ -682,8 +684,9 @@ void ArmatureImporter::make_shape_keys(){
|
||||
weight = morphWeights.getFloatValues()->getData()[i];
|
||||
kb->curval = weight;
|
||||
}
|
||||
else
|
||||
else {
|
||||
fprintf(stderr, "Morph target geometry not found.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -120,9 +120,10 @@ void ControllerExporter::operator()(Object *ob)
|
||||
Object *ob_arm = bc_get_assigned_armature(ob);
|
||||
Key *key = BKE_key_from_object(ob);
|
||||
|
||||
if (ob_arm)
|
||||
if (ob_arm) {
|
||||
export_skin_controller(ob, ob_arm);
|
||||
if(key){
|
||||
}
|
||||
if (key) {
|
||||
export_morph_controller(ob, key);
|
||||
}
|
||||
}
|
||||
@ -388,7 +389,8 @@ std::string ControllerExporter::add_morph_weights(Key *key, Object *ob)
|
||||
}
|
||||
|
||||
//Added to implemente support for animations.
|
||||
void ControllerExporter::add_weight_extras(Key *key){
|
||||
void ControllerExporter::add_weight_extras(Key *key)
|
||||
{
|
||||
// can also try the base element and param alternative
|
||||
COLLADASW::BaseExtraTechnique extra;
|
||||
|
||||
|
@ -100,7 +100,7 @@ extern "C" {
|
||||
// #define ARMATURE_TEST
|
||||
|
||||
DocumentImporter::DocumentImporter(bContext *C, const ImportSettings *import_settings) :
|
||||
import_settings(import_settings),
|
||||
import_settings(import_settings),
|
||||
mImportStage(General),
|
||||
mContext(C),
|
||||
armature_importer(&unit_converter, &mesh_importer, &anim_importer, CTX_data_scene(C)),
|
||||
@ -432,8 +432,9 @@ Object *DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::Nod
|
||||
|
||||
// to create constraints off node <extra> tags. Assumes only constraint data in
|
||||
// current <extra> with blender profile.
|
||||
void DocumentImporter::create_constraints(ExtraTags *et, Object *ob){
|
||||
if ( et && et->isProfile("blender")){
|
||||
void DocumentImporter::create_constraints(ExtraTags *et, Object *ob)
|
||||
{
|
||||
if (et && et->isProfile("blender")) {
|
||||
std::string name;
|
||||
short* type = 0;
|
||||
et->setData("type", type);
|
||||
@ -536,9 +537,12 @@ void DocumentImporter::write_node(COLLADAFW::Node *node, COLLADAFW::Node *parent
|
||||
// XXX empty node may not mean it is empty object, not sure about this
|
||||
if ( (geom_done + camera_done + lamp_done + controller_done + inst_done) < 1) {
|
||||
//Check if Object is armature, by checking if immediate child is a JOINT node.
|
||||
if(is_armature(node))
|
||||
if (is_armature(node)) {
|
||||
ob = bc_add_object(sce, OB_ARMATURE, NULL);
|
||||
else ob = bc_add_object(sce, OB_EMPTY, NULL);
|
||||
}
|
||||
else {
|
||||
ob = bc_add_object(sce, OB_EMPTY, NULL);
|
||||
}
|
||||
|
||||
objects_done->push_back(ob);
|
||||
}
|
||||
@ -1238,15 +1242,18 @@ bool DocumentImporter::addExtraTags(const COLLADAFW::UniqueId &uid, ExtraTags *e
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DocumentImporter::is_armature(COLLADAFW::Node *node){
|
||||
bool DocumentImporter::is_armature(COLLADAFW::Node *node)
|
||||
{
|
||||
COLLADAFW::NodePointerArray &child_nodes = node->getChildNodes();
|
||||
for (unsigned int i = 0; i < child_nodes.getCount(); i++) {
|
||||
if(child_nodes[i]->getType() == COLLADAFW::Node::JOINT) return true;
|
||||
else continue;
|
||||
for (unsigned int i = 0; i < child_nodes.getCount(); i++) {
|
||||
if (child_nodes[i]->getType() == COLLADAFW::Node::JOINT) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//no child is JOINT
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,8 @@ extern "C" {
|
||||
#include "collada_utils.h"
|
||||
|
||||
// TODO: optimize UV sets by making indexed list with duplicates removed
|
||||
GeometryExporter::GeometryExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) : COLLADASW::LibraryGeometries(sw), export_settings(export_settings) {
|
||||
GeometryExporter::GeometryExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) : COLLADASW::LibraryGeometries(sw), export_settings(export_settings)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -160,7 +161,7 @@ void GeometryExporter::operator()(Object *ob)
|
||||
|
||||
if (this->export_settings->include_shapekeys) {
|
||||
Key * key = BKE_key_from_object(ob);
|
||||
if(key) {
|
||||
if (key) {
|
||||
KeyBlock * kb = (KeyBlock*)key->block.first;
|
||||
//skip the basis
|
||||
kb = kb->next;
|
||||
@ -175,7 +176,8 @@ void GeometryExporter::operator()(Object *ob)
|
||||
#endif
|
||||
}
|
||||
|
||||
void GeometryExporter::export_key_mesh(Object *ob, Mesh *me, KeyBlock *kb){
|
||||
void GeometryExporter::export_key_mesh(Object *ob, Mesh *me, KeyBlock *kb)
|
||||
{
|
||||
std::string geom_id = get_geometry_id(ob, false) + "_morph_" + translate_id(kb->name);
|
||||
std::vector<Normal> nor;
|
||||
std::vector<Face> norind;
|
||||
|
@ -133,7 +133,7 @@ private:
|
||||
|
||||
CustomData create_edge_custom_data(EdgeHash *eh);
|
||||
|
||||
void allocate_face_data(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris);
|
||||
void allocate_face_data(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris);
|
||||
|
||||
// TODO: import uv set names
|
||||
void read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris);
|
||||
|
@ -182,7 +182,7 @@ void SceneExporter::writeNodes(Object *ob, Scene *sce)
|
||||
colladaNode.end();
|
||||
}
|
||||
|
||||
if (ob->constraints.first != NULL ){
|
||||
if (ob->constraints.first != NULL ) {
|
||||
bConstraint *con = (bConstraint*) ob->constraints.first;
|
||||
while (con) {
|
||||
std::string con_name(id_name(con));
|
||||
@ -208,8 +208,8 @@ void SceneExporter::writeNodes(Object *ob, Scene *sce)
|
||||
Object *obtar;
|
||||
|
||||
cti->get_constraint_targets(con, &targets);
|
||||
if(cti){
|
||||
for (ct = (bConstraintTarget*)targets.first; ct; ct = ct->next){
|
||||
if (cti) {
|
||||
for (ct = (bConstraintTarget*)targets.first; ct; ct = ct->next) {
|
||||
obtar = ct->tar;
|
||||
std::string tar_id(id_name(obtar));
|
||||
colladaNode.addExtraTechniqueChildParameter("blender",con_tag,"target_id",tar_id);
|
||||
|
@ -46,7 +46,7 @@ void TransformReader::get_node_mat(float mat[4][4], COLLADAFW::Node *node, std::
|
||||
COLLADAFW::Transformation *tm = node->getTransformations()[i];
|
||||
COLLADAFW::Transformation::TransformationType type = tm->getTransformationType();
|
||||
|
||||
if (type == COLLADAFW::Transformation::MATRIX){
|
||||
if (type == COLLADAFW::Transformation::MATRIX) {
|
||||
// XXX why does this return and discard all following transformations?
|
||||
dae_matrix_to_mat4(tm, mat);
|
||||
return;
|
||||
|
@ -295,11 +295,11 @@ std::string bc_url_encode(std::string data) {
|
||||
}
|
||||
|
||||
std::string bc_replace_string(std::string data, const std::string& pattern,
|
||||
const std::string& replacement) {
|
||||
size_t pos = 0;
|
||||
while((pos = data.find(pattern, pos)) != std::string::npos) {
|
||||
data.replace(pos, pattern.length(), replacement);
|
||||
pos += replacement.length();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
const std::string& replacement) {
|
||||
size_t pos = 0;
|
||||
while ((pos = data.find(pattern, pos)) != std::string::npos) {
|
||||
data.replace(pos, pattern.length(), replacement);
|
||||
pos += replacement.length();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
@ -319,14 +319,13 @@ static int wm_collada_import_exec(bContext *C, wmOperator *op)
|
||||
import_units = RNA_boolean_get(op->ptr, "import_units");
|
||||
|
||||
RNA_string_get(op->ptr, "filepath", filename);
|
||||
if (collada_import( C,
|
||||
filename,
|
||||
import_units)) {
|
||||
return OPERATOR_FINISHED;
|
||||
if (collada_import(C, filename, import_units)) {
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else {
|
||||
BKE_report(op->reports, RPT_ERROR, "Errors found during parsing COLLADA document (see console for details)");
|
||||
return OPERATOR_CANCELLED;
|
||||
BKE_report(op->reports, RPT_ERROR,
|
||||
"Errors found during parsing COLLADA document (see console for details)");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ void sculpt_pbvh_clear(Object *ob);
|
||||
void sculpt_update_after_dynamic_topology_toggle(bContext *C);
|
||||
void sculpt_dynamic_topology_enable(struct bContext *C);
|
||||
void sculpt_dynamic_topology_disable(struct bContext *C,
|
||||
struct SculptUndoNode *unode);
|
||||
struct SculptUndoNode *unode);
|
||||
|
||||
/* Undo */
|
||||
|
||||
|
@ -83,6 +83,9 @@
|
||||
|
||||
#include "view3d_intern.h" /* own include */
|
||||
|
||||
/* for ndof prints */
|
||||
// #define DEBUG_NDOF_MOTION
|
||||
|
||||
/* ********************** view3d_edit: view manipulations ********************* */
|
||||
|
||||
int ED_view3d_camera_lock_check(View3D *v3d, RegionView3D *rv3d)
|
||||
@ -1043,11 +1046,10 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
float view_inv[4];
|
||||
invert_qt_qt(view_inv, rv3d->viewquat);
|
||||
|
||||
/* #define DEBUG_NDOF_MOTION */
|
||||
#ifdef DEBUG_NDOF_MOTION
|
||||
#ifdef DEBUG_NDOF_MOTION
|
||||
printf("ndof: T=(%.2f,%.2f,%.2f) R=(%.2f,%.2f,%.2f) dt=%.3f delivered to 3D view\n",
|
||||
ndof->tx, ndof->ty, ndof->tz, ndof->rx, ndof->ry, ndof->rz, ndof->dt);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (rv3d->viewlock == RV3D_LOCKED) {
|
||||
/* rotation not allowed -- explore panning options instead */
|
||||
@ -1204,11 +1206,10 @@ static int ndof_orbit_zoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
float view_inv[4];
|
||||
invert_qt_qt(view_inv, rv3d->viewquat);
|
||||
|
||||
/* #define DEBUG_NDOF_MOTION */
|
||||
#ifdef DEBUG_NDOF_MOTION
|
||||
#ifdef DEBUG_NDOF_MOTION
|
||||
printf("ndof: T=(%.2f,%.2f,%.2f) R=(%.2f,%.2f,%.2f) dt=%.3f delivered to 3D view\n",
|
||||
ndof->tx, ndof->ty, ndof->tz, ndof->rx, ndof->ry, ndof->rz, ndof->dt);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (ndof->tz) {
|
||||
/* Zoom!
|
||||
|
@ -2478,7 +2478,7 @@ void IMB_partial_display_buffer_update(ImBuf *ibuf, const float *linear_buffer,
|
||||
cm_processor = IMB_colormanagement_display_processor_new(view_settings, display_settings);
|
||||
|
||||
partial_buffer_update_rect(ibuf, display_buffer, linear_buffer, byte_buffer, buffer_width, stride,
|
||||
offset_x, offset_y, cm_processor, xmin, ymin, xmax, ymax);
|
||||
offset_x, offset_y, cm_processor, xmin, ymin, xmax, ymax);
|
||||
|
||||
if (cm_processor)
|
||||
IMB_colormanagement_processor_free(cm_processor);
|
||||
|
Loading…
Reference in New Issue
Block a user