[Bf-committers] change in Text Editor (regarding tabs as spaces)

2011-11-17 Thread Dalai Felinto
Hello all,

I'm not sure this is worth documenting, but since it may come as a
surprise to some people I think I should write at least here.

Now in the Text Editor if you use Tab as Spaces the navigation
(left, right) will consider group of spaces as one solid block.
The only time spaces are still treated as individual spaces is for
backspacing (or when 'tab as spaces' is disabled).

This should help a lot people (like me) that can't stand pep8 space
over tabs policy ;)

Regards,
Dalai
___
Bf-committers mailing list
Bf-committers@blender.org
http://lists.blender.org/mailman/listinfo/bf-committers


Re: [Bf-committers] FBX camera

2011-11-17 Thread François T .
last bit of your timecode is not second but frames
I agree Blender shouldn't substract. but keep in sync with the actual frame
number (if its there)

2011/11/17 Ejner Fergo ejner...@gmail.com

 On Thu, Nov 17, 2011 at 12:55 AM, François T.
 francoistarl...@gmail.com wrote: Maya is not locked to 1, if you
 set a background sequence, it will sync up to the frame number (if
 started at zero Maya will start there as well)
 The version of Maya I have access to (2011) does not change frame
 range to 0 when importing a Blender FBX (this is the point of this
 discussion, right?). Neither does Nuke or Houdini. I have to manually
 change start frame to 0. Exporting FBX from Maya uses/sets the correct
 start frame (frame 1) in other  apps. It does not subtract 1 frame. I
 would expect the Blender exporter to do the same.

  If you use AE, now you have an option to start at 1 but still default is
 0.
  But rather than Apps on something even more general Timecode start at 0
 :)

 What I learned, and working with other companies, is that best
 practices is that start frame = 1. This is important when working on a
 sequence starting from, lets say, 4789 - 4823. Pretty confusing when
 Blender subtracts 1 frame in the export ;)
 That video-editing starts with a Timecode of 0 (seconds) makes sense,
 but for CG/VFX shots it is not normal.
 ___
 Bf-committers mailing list
 Bf-committers@blender.org
 http://lists.blender.org/mailman/listinfo/bf-committers




-- 

François Tarlier
www.francois-tarlier.com
www.linkedin.com/in/francoistarlier
___
Bf-committers mailing list
Bf-committers@blender.org
http://lists.blender.org/mailman/listinfo/bf-committers


Re: [Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41943] trunk/blender/source: pydrivers: ' frame' is now in the driver namespace,

2011-11-17 Thread Campbell Barton
Yep, new drivers have no properties now (previously had a scene
current frame prop)

On Thu, Nov 17, 2011 at 6:10 PM, Daniel Salazar - 3Developer.com
zan...@gmail.com wrote:
 ohh! so good :D are new drivers like #frame not creating a property now then?

 cheers!

 Daniel Salazar
 3Developer.com



 On Thu, Nov 17, 2011 at 1:08 AM, Campbell Barton ideasma...@gmail.com wrote:
 Revision: 41943
          
 http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=41943
 Author:   campbellbarton
 Date:     2011-11-17 07:08:09 + (Thu, 17 Nov 2011)
 Log Message:
 ---
 pydrivers: 'frame' is now in the driver namespace,

 - no need to link to scenes when using a frame from the pydriver, this made 
 linking rigs for eg, quite messy.
 - advantage that we get subframe values (where scenes from was fixed to a 
 whole number).

 Modified Paths:
 --
    trunk/blender/source/blender/blenkernel/intern/fcurve.c
    trunk/blender/source/blender/editors/interface/interface_anim.c
    trunk/blender/source/blender/python/BPY_extern.h
    trunk/blender/source/blender/python/intern/bpy_driver.c
    trunk/blender/source/blender/python/intern/bpy_driver.h
    trunk/blender/source/blenderplayer/bad_level_call_stubs/stubs.c

 Modified: trunk/blender/source/blender/blenkernel/intern/fcurve.c
 ===
 --- trunk/blender/source/blender/blenkernel/intern/fcurve.c     2011-11-17 
 06:08:58 UTC (rev 41942)
 +++ trunk/blender/source/blender/blenkernel/intern/fcurve.c     2011-11-17 
 07:08:09 UTC (rev 41943)
 @@ -1576,7 +1576,7 @@
  *     - evaltime is the frame at which F-Curve is being evaluated
  *     - has to return a float value
  */
 -static float evaluate_driver (ChannelDriver *driver, float UNUSED(evaltime))
 +static float evaluate_driver (ChannelDriver *driver, const float evaltime)
  {
        DriverVar *dvar;

 @@ -1663,8 +1663,10 @@
                                /* this evaluates the expression using 
 Python,and returns its result:
                                 *      - on errors it reports, then returns 
 0.0f
                                 */
 -                               driver-curval= BPY_driver_exec(driver);
 +                               driver-curval= BPY_driver_exec(driver, 
 evaltime);
                        }
 +#else /* WITH_PYTHON*/
 +               (void)evaltime;
  #endif /* WITH_PYTHON*/
                }
                        break;
 @@ -2087,7 +2089,7 @@
  /* Evaluate and return the value of the given F-Curve at the specified 
 frame (evaltime)
  * Note: this is also used for drivers
  */
 -float evaluate_fcurve (FCurve *fcu, float evaltime)
 +float evaluate_fcurve (FCurve *fcu, float evaltime)
  {
        float cvalue= 0.0f;
        float devaltime;

 Modified: trunk/blender/source/blender/editors/interface/interface_anim.c
 ===
 --- trunk/blender/source/blender/editors/interface/interface_anim.c     
 2011-11-17 06:08:58 UTC (rev 41942)
 +++ trunk/blender/source/blender/editors/interface/interface_anim.c     
 2011-11-17 07:08:09 UTC (rev 41943)
 @@ -164,24 +164,7 @@
                        /* set the expression */
                        // TODO: need some way of identifying variables used
                        BLI_strncpy_utf8(driver-expression, str, 
 sizeof(driver-expression));
 -
 -                       /* FIXME: for now, assume that
 -                        *      - for expressions, users are likely to be 
 using frame - current frame as a variable
 -                        *      - driver_add_new_variable() adds a 
 single-prop variable by default
 -                        */
 -                       {
 -                               DriverVar *dvar;
 -                               DriverTarget *dtar;
 -
 -                               dvar = driver_add_new_variable(driver);
 -                               BLI_strncpy(dvar-name, frame, 
 sizeof(dvar-name));
 -
 -                               dtar = dvar-targets[0];
 -                               dtar-id = (ID *)CTX_data_scene(C); // XXX: 
 should we check that C is valid first?
 -                               dtar-idtype= ID_SCE;
 -                               dtar-rna_path = 
 BLI_sprintfN(frame_current);
 -                       }
 -
 +
                        /* updates */
                        driver-flag |= DRIVER_FLAG_RECOMPILE;
                        WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME, 
 NULL);

 Modified: trunk/blender/source/blender/python/BPY_extern.h
 ===
 --- trunk/blender/source/blender/python/BPY_extern.h    2011-11-17 06:08:58 
 UTC (rev 41942)
 +++ trunk/blender/source/blender/python/BPY_extern.h    2011-11-17 07:08:09 
 UTC (rev 41943)
 @@ -74,7 +74,7 @@
  void   BPY_app_handlers_reset(const short do_all);

  void   BPY_driver_reset(void);
 -float  

Re: [Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41945] trunk/blender/source/blender/ python/intern/bpy_rna.c: pyapi feature from 2.4x

2011-11-17 Thread Dalai Felinto
Hi Campbell,

Before this commit one was able to access library elements (and change
them \o/) by directly referring to their name (and hope for no
namespace conflict).

Is the library field mandatory now? or it's more like an option to
solve namespace conflicts?
(so if I have a 'Cube' only in the library can I still do
bpy.objects['Cube', None])?

Also, would be possible to have the None field completely optional? So
when working with local data blocks (90% of the time) one can do
bpy.data['data block'] without the need of ['data block', None'] ?

Thanks,
Dalai

2011/11/17 Campbell Barton ideasma...@gmail.com:
 Revision: 41945
          
 http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=41945
 Author:   campbellbarton
 Date:     2011-11-17 08:47:34 + (Thu, 17 Nov 2011)
 Log Message:
 ---
 pyapi feature from 2.4x

 allow collection subscript to contain the library or None.

 eg:

  bpy.data.objects[Mesh, /subsurf_test.blend]

  bpy.data.scenes[Scene, None]

  # also works with get()
  bpy.data.armatures.get((some_armature, //some_lib.blend), None)

 Modified Paths:
 --
    trunk/blender/source/blender/python/intern/bpy_rna.c

 Modified: trunk/blender/source/blender/python/intern/bpy_rna.c
 ===
 --- trunk/blender/source/blender/python/intern/bpy_rna.c        2011-11-17 
 08:02:36 UTC (rev 41944)
 +++ trunk/blender/source/blender/python/intern/bpy_rna.c        2011-11-17 
 08:47:34 UTC (rev 41945)
 @@ -64,6 +64,7 @@

  #include MEM_guardedalloc.h

 +#include BKE_main.h
  #include BKE_idcode.h
  #include BKE_context.h
  #include BKE_global.h /* evil G.* */
 @@ -2096,6 +2097,84 @@
  }
  /* static PyObject *pyrna_prop_array_subscript_str(BPy_PropertyRNA *self, 
 char *keyname) */

 +/* special case: bpy.data.objects[some_id_name, //some_lib_name.blend]
 + * also for:     bpy.data.objects.get((some_id_name, 
 //some_lib_name.blend), fallback)  */
 +static PyObject 
 *pyrna_prop_collection_subscript_str_lib_pair(BPy_PropertyRNA *self, PyObject 
 *key, const char *err_prefix, const short err_not_found)
 +{
 +       char *keyname;
 +
 +       /* first validate the args, all we know is that they are a tuple */
 +       if (PyTuple_GET_SIZE(key) != 2) {
 +               PyErr_Format(PyExc_KeyError,
 +                            %s: tuple key must be a pair, not size %d,
 +                            err_prefix, PyTuple_GET_SIZE(key));
 +               return NULL;
 +       }
 +       else if (self-ptr.type != RNA_BlendData) {
 +               PyErr_Format(PyExc_KeyError,
 +                            %s: is only valid for bpy.data collections, not 
 %.200s,
 +                            err_prefix, 
 RNA_struct_identifier(self-ptr.type));
 +               return NULL;
 +       }
 +       else if ((keyname= _PyUnicode_AsString(PyTuple_GET_ITEM(key, 0))) == 
 NULL) {
 +               PyErr_Format(PyExc_KeyError,
 +                            %s: id must be a string, not %.200s,
 +                            err_prefix, Py_TYPE(PyTuple_GET_ITEM(key, 
 0))-tp_name);
 +               return NULL;
 +       }
 +       else {
 +               PyObject *keylib= PyTuple_GET_ITEM(key, 1);
 +               Library *lib;
 +               PyObject *ret= NULL;
 +
 +               if (keylib == Py_None) {
 +                       lib= NULL;
 +               }
 +               else if (PyUnicode_Check(keylib)) {
 +                       Main *bmain= self-ptr.data;
 +                       const char *keylib_str= _PyUnicode_AsString(keylib);
 +                       lib= BLI_findstring(bmain-library, keylib_str, 
 offsetof(Library, name));
 +                       if (lib == NULL) {
 +                               if (err_not_found) {
 +                                       PyErr_Format(PyExc_KeyError,
 +                                                                %s: lib 
 name '%.240s' 
 +                                                                does not 
 reference a valid library,
 +                                                                err_prefix, 
 keylib_str);
 +                               }
 +
 +                               return NULL;
 +                       }
 +               }
 +               else {
 +                       PyErr_Format(PyExc_KeyError,
 +                                    %s: lib must be a sting or None, not 
 %.200s,
 +                                    err_prefix, Py_TYPE(keylib)-tp_name);
 +                       return NULL;
 +               }
 +
 +               /* lib is either a valid poniter or NULL,
 +                * either way can do direct comparison with id.lib */
 +
 +               RNA_PROP_BEGIN(self-ptr, itemptr, self-prop) {
 +                       ID *id= itemptr.data; /* always an ID */
 +                       if (id-lib == lib  (strncmp(keyname, id-name+2, 
 sizeof(id-name)-2) == 0)) {
 +                               ret= 

Re: [Bf-committers] Blender tangent space calculation

2011-11-17 Thread Eugene Minov

 The proper way to get the tangent layer can be seen in:
 
 
https://svn.blender.org/svnroot/bf-blender/trunk/blender/source/blender/editors/object/object_bake.c


Okay, I've found a 'multiresbake_get_normal' function for correct normals
calculation.
I also looked into 'DM_add_tangent_layer' function in:
https://svn.blender.org/svnroot/bf-blender/trunk/blender/source/blender/blenkernel/intern/DerivedMesh.c
According to it, the tangent layer is filling by tangents when created. So
I do
need only to access and welding them and normals?
That's good if so.

Today I had time to try understand how RNA's works.
And I almost create and test python interface with collections for faces and
indexed vertices with normals and tangents in it.
Hopefully soon I'll start welding.


 If you need a free ultra simple welder there's one here --
 http://jbit.net/~sparky/academic/welder/
 You specify how many floats you have per vertex and it will weld for you.


Okay, good one, I think I'll use it :)

Thanks!

On Wed, Nov 16, 2011 at 8:43 PM, Morten Mikkelsen mikkels...@gmail.comwrote:

 Sorry for confusing you here but I think I found a better reference for you
 since
 you'll be needing the tangents too and you are not supposed to be building
 them yourself.

 The proper way to get the tangent layer can be seen in:


 https://svn.blender.org/svnroot/bf-blender/trunk/blender/source/blender/editors/object/object_bake.c

 do_multires_bake()

 These are being fetched after the line:

 float *pvtangent= NULL;


 These are then read in the function flush_pixel() including the normal
 which is fetched from there using multiresbake_get_normal()
 which as you can see looks a lot like the GetNormal() function
 I pointed you to in DerivedMesh.c.
 Anyway, definitely use this file as your reference. I should have shown you
 this one from the beginning.

 If you need a free ultra simple welder there's one here --
 http://jbit.net/~sparky/academic/welder/
 You specify how many floats you have per vertex and it will weld for you.



 On Wed, Nov 16, 2011 at 5:32 AM, Eugene Minov minov@gmail.com wrote:

  
   If you can get hold of the dm
   (DerivedMesh)
   on the c side of things then I can show you how to get the correct
  normals
   and tangents
   and even help you get them welded should you want this.
  
 
  Ok! Sounds good to me :)
 
  So right now I in progress of checkout latest svn sources and compile
  blender. (had problems with net)
  Then first of I'll try to create test version of python/C interface. I've
  not decided yet what names I'll use for it.
  And finally will be trying to implement it looking in DerivedMesh.c,
  I think that it's realy are a good example.
 
  If or when I have a problem, I'll be glad to use your help :)
  Many thanks for your kind cooperation!
 
 
 
  On Tue, Nov 15, 2011 at 10:41 PM, Morten Mikkelsen mikkels...@gmail.com
  wrote:
 
   I don't know anything about Python but if you can get hold of the dm
   (DerivedMesh)
   on the c side of things then I can show you how to get the correct
  normals
   and tangents
   and even help you get them welded should you want this.
  
  
  
  
   On Tue, Nov 15, 2011 at 10:43 AM, Eugene Minov minov@gmail.com
   wrote:
  
Yes, I absolutely agree, hard faces obviously must be exported in the
   same
way how they seen in render.
I think they can welds along with tangents.
   
On Tue, Nov 15, 2011 at 9:01 PM, Morten Mikkelsen 
  mikkels...@gmail.com
wrote:
   
 There is no point in doing this unless you export the correct
  tangents
and
 normals. That is the ones
 that were used to bake the normal map.

 I realize it blows that there is no API function to get the render
normal.
 So what you have to do is produce it yourself
 like is done in
 DerivedMesh.c

   
  
 
 https://svn.blender.org/svnroot/bf-blender/trunk/blender/source/blender/blenkernel/intern/DerivedMesh.c
 
 and
 many other places as well.
 An example in this file is the static function GetNormal() which is
   used
as
  a call-back function by mikktspace.c
 and you can see how it uses the averaged normal if the face is set
 to
 smooth and it uses
 the face normal which it calculates itself if the face is set to
  flat.

 If you are going to make an api to export tangents I for one cannot
 emphasize enough
 that I prefer an all or nothing solution. Either do it right or
 don't
   do
it
 at all.
 The last thing we need is to introduce a new tangent space standard
within
 blender.
 Either export the correct basis that was used for baking (this
  includes
the
 normal)
 or don't try to do it at all.
 ___
 Bf-committers mailing list
 Bf-committers@blender.org
 http://lists.blender.org/mailman/listinfo/bf-committers

___
Bf-committers 

[Bf-committers] Simplified muscle simulator paper

2011-11-17 Thread Juan Pablo Bouza

I thought this would be interesting...

http://cg.skeelogy.com/research/simplified-muscle-dynamics.php
  
___
Bf-committers mailing list
Bf-committers@blender.org
http://lists.blender.org/mailman/listinfo/bf-committers


Re: [Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41945] trunk/blender/source/blender/ python/intern/bpy_rna.c: pyapi feature from 2.4x

2011-11-17 Thread Campbell Barton
Hey Dalai, I should have been more clear, current behavior is unchanged.

The way it works is if 2 args are given it does library/local checks -
depending if a library path or None is passed, otherwise it will get
either.

On Fri, Nov 18, 2011 at 2:44 AM, Dalai Felinto dfeli...@gmail.com wrote:
 Hi Campbell,

 Before this commit one was able to access library elements (and change
 them \o/) by directly referring to their name (and hope for no
 namespace conflict).

 Is the library field mandatory now? or it's more like an option to
 solve namespace conflicts?
 (so if I have a 'Cube' only in the library can I still do
 bpy.objects['Cube', None])?

 Also, would be possible to have the None field completely optional? So
 when working with local data blocks (90% of the time) one can do
 bpy.data['data block'] without the need of ['data block', None'] ?

 Thanks,
 Dalai

 2011/11/17 Campbell Barton ideasma...@gmail.com:
 Revision: 41945
          
 http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=41945
 Author:   campbellbarton
 Date:     2011-11-17 08:47:34 + (Thu, 17 Nov 2011)
 Log Message:
 ---
 pyapi feature from 2.4x

 allow collection subscript to contain the library or None.

 eg:

  bpy.data.objects[Mesh, /subsurf_test.blend]

  bpy.data.scenes[Scene, None]

  # also works with get()
  bpy.data.armatures.get((some_armature, //some_lib.blend), None)

 Modified Paths:
 --
    trunk/blender/source/blender/python/intern/bpy_rna.c

 Modified: trunk/blender/source/blender/python/intern/bpy_rna.c
 ===
 --- trunk/blender/source/blender/python/intern/bpy_rna.c        2011-11-17 
 08:02:36 UTC (rev 41944)
 +++ trunk/blender/source/blender/python/intern/bpy_rna.c        2011-11-17 
 08:47:34 UTC (rev 41945)
 @@ -64,6 +64,7 @@

  #include MEM_guardedalloc.h

 +#include BKE_main.h
  #include BKE_idcode.h
  #include BKE_context.h
  #include BKE_global.h /* evil G.* */
 @@ -2096,6 +2097,84 @@
  }
  /* static PyObject *pyrna_prop_array_subscript_str(BPy_PropertyRNA *self, 
 char *keyname) */

 +/* special case: bpy.data.objects[some_id_name, //some_lib_name.blend]
 + * also for:     bpy.data.objects.get((some_id_name, 
 //some_lib_name.blend), fallback)  */
 +static PyObject 
 *pyrna_prop_collection_subscript_str_lib_pair(BPy_PropertyRNA *self, 
 PyObject *key, const char *err_prefix, const short err_not_found)
 +{
 +       char *keyname;
 +
 +       /* first validate the args, all we know is that they are a tuple */
 +       if (PyTuple_GET_SIZE(key) != 2) {
 +               PyErr_Format(PyExc_KeyError,
 +                            %s: tuple key must be a pair, not size %d,
 +                            err_prefix, PyTuple_GET_SIZE(key));
 +               return NULL;
 +       }
 +       else if (self-ptr.type != RNA_BlendData) {
 +               PyErr_Format(PyExc_KeyError,
 +                            %s: is only valid for bpy.data collections, 
 not %.200s,
 +                            err_prefix, 
 RNA_struct_identifier(self-ptr.type));
 +               return NULL;
 +       }
 +       else if ((keyname= _PyUnicode_AsString(PyTuple_GET_ITEM(key, 0))) == 
 NULL) {
 +               PyErr_Format(PyExc_KeyError,
 +                            %s: id must be a string, not %.200s,
 +                            err_prefix, Py_TYPE(PyTuple_GET_ITEM(key, 
 0))-tp_name);
 +               return NULL;
 +       }
 +       else {
 +               PyObject *keylib= PyTuple_GET_ITEM(key, 1);
 +               Library *lib;
 +               PyObject *ret= NULL;
 +
 +               if (keylib == Py_None) {
 +                       lib= NULL;
 +               }
 +               else if (PyUnicode_Check(keylib)) {
 +                       Main *bmain= self-ptr.data;
 +                       const char *keylib_str= _PyUnicode_AsString(keylib);
 +                       lib= BLI_findstring(bmain-library, keylib_str, 
 offsetof(Library, name));
 +                       if (lib == NULL) {
 +                               if (err_not_found) {
 +                                       PyErr_Format(PyExc_KeyError,
 +                                                                %s: lib 
 name '%.240s' 
 +                                                                does not 
 reference a valid library,
 +                                                                err_prefix, 
 keylib_str);
 +                               }
 +
 +                               return NULL;
 +                       }
 +               }
 +               else {
 +                       PyErr_Format(PyExc_KeyError,
 +                                    %s: lib must be a sting or None, not 
 %.200s,
 +                                    err_prefix, Py_TYPE(keylib)-tp_name);
 +                       return NULL;
 +               }
 +
 +               /* lib is either a valid poniter or NULL,
 +                * either way can do direct 

Re: [Bf-committers] Blender tangent space calculation

2011-11-17 Thread Morten Mikkelsen
Don't forget to look in do_multires_bake() in object_bake.c
It shows you how to add the tangent layer:

float *pvtangent= NULL;

// create tangent vectors if not already created
if(CustomData_get_layer_index(dm-faceData, CD_TANGENT) == -1)
DM_add_tangent_layer(dm);

// get pointer to the already generated tangents
pvtangent= DM_get_face_data_layer(dm, CD_TANGENT);





On Thu, Nov 17, 2011 at 8:49 AM, Eugene Minov minov@gmail.com wrote:

 
  The proper way to get the tangent layer can be seen in:
  
  

 https://svn.blender.org/svnroot/bf-blender/trunk/blender/source/blender/editors/object/object_bake.c
 

 Okay, I've found a 'multiresbake_get_normal' function for correct normals
 calculation.
 I also looked into 'DM_add_tangent_layer' function in:

 https://svn.blender.org/svnroot/bf-blender/trunk/blender/source/blender/blenkernel/intern/DerivedMesh.c
 According to it, the tangent layer is filling by tangents when created. So
 I do
 need only to access and welding them and normals?
 That's good if so.

 Today I had time to try understand how RNA's works.
 And I almost create and test python interface with collections for faces
 and
 indexed vertices with normals and tangents in it.
 Hopefully soon I'll start welding.

 
  If you need a free ultra simple welder there's one here --
  http://jbit.net/~sparky/academic/welder/
  You specify how many floats you have per vertex and it will weld for
 you.
 

 Okay, good one, I think I'll use it :)

 Thanks!

 On Wed, Nov 16, 2011 at 8:43 PM, Morten Mikkelsen mikkels...@gmail.com
 wrote:

  Sorry for confusing you here but I think I found a better reference for
 you
  since
  you'll be needing the tangents too and you are not supposed to be
 building
  them yourself.
 
  The proper way to get the tangent layer can be seen in:
 
 
 
 https://svn.blender.org/svnroot/bf-blender/trunk/blender/source/blender/editors/object/object_bake.c
 
  do_multires_bake()
 
  These are being fetched after the line:
 
  float *pvtangent= NULL;
 
 
  These are then read in the function flush_pixel() including the normal
  which is fetched from there using multiresbake_get_normal()
  which as you can see looks a lot like the GetNormal() function
  I pointed you to in DerivedMesh.c.
  Anyway, definitely use this file as your reference. I should have shown
 you
  this one from the beginning.
 
  If you need a free ultra simple welder there's one here --
  http://jbit.net/~sparky/academic/welder/
  You specify how many floats you have per vertex and it will weld for you.
 
 
 
  On Wed, Nov 16, 2011 at 5:32 AM, Eugene Minov minov@gmail.com
 wrote:
 
   
If you can get hold of the dm
(DerivedMesh)
on the c side of things then I can show you how to get the correct
   normals
and tangents
and even help you get them welded should you want this.
   
  
   Ok! Sounds good to me :)
  
   So right now I in progress of checkout latest svn sources and compile
   blender. (had problems with net)
   Then first of I'll try to create test version of python/C interface.
 I've
   not decided yet what names I'll use for it.
   And finally will be trying to implement it looking in DerivedMesh.c,
   I think that it's realy are a good example.
  
   If or when I have a problem, I'll be glad to use your help :)
   Many thanks for your kind cooperation!
  
  
  
   On Tue, Nov 15, 2011 at 10:41 PM, Morten Mikkelsen 
 mikkels...@gmail.com
   wrote:
  
I don't know anything about Python but if you can get hold of the dm
(DerivedMesh)
on the c side of things then I can show you how to get the correct
   normals
and tangents
and even help you get them welded should you want this.
   
   
   
   
On Tue, Nov 15, 2011 at 10:43 AM, Eugene Minov minov@gmail.com
wrote:
   
 Yes, I absolutely agree, hard faces obviously must be exported in
 the
same
 way how they seen in render.
 I think they can welds along with tangents.

 On Tue, Nov 15, 2011 at 9:01 PM, Morten Mikkelsen 
   mikkels...@gmail.com
 wrote:

  There is no point in doing this unless you export the correct
   tangents
 and
  normals. That is the ones
  that were used to bake the normal map.
 
  I realize it blows that there is no API function to get the
 render
 normal.
  So what you have to do is produce it yourself
  like is done in
  DerivedMesh.c
 

   
  
 
 https://svn.blender.org/svnroot/bf-blender/trunk/blender/source/blender/blenkernel/intern/DerivedMesh.c
  
  and
  many other places as well.
  An example in this file is the static function GetNormal() which
 is
used
 as
   a call-back function by mikktspace.c
  and you can see how it uses the averaged normal if the face is
 set
  to
  smooth and it uses
  the face normal which it calculates itself if the face is set to
   flat.
 
  If you are going to make an api to export tangents I for one
 cannot
  

Re: [Bf-committers] Blender tangent space calculation

2011-11-17 Thread Morten Mikkelsen
And flush_pixel() shows you how to traverse the buffer.
Essentially the way it works in blender is there's always 4 of them
per face whether it's a triangle or a quad.





On Thu, Nov 17, 2011 at 9:31 AM, Morten Mikkelsen mikkels...@gmail.comwrote:

 Don't forget to look in do_multires_bake() in object_bake.c
 It shows you how to add the tangent layer:

 float *pvtangent= NULL;

 // create tangent vectors if not already created
 if(CustomData_get_layer_index(dm-faceData, CD_TANGENT) == -1)
   DM_add_tangent_layer(dm);

 // get pointer to the already generated tangents
 pvtangent= DM_get_face_data_layer(dm, CD_TANGENT);





 On Thu, Nov 17, 2011 at 8:49 AM, Eugene Minov minov@gmail.com wrote:

 
  The proper way to get the tangent layer can be seen in:
  
  

 https://svn.blender.org/svnroot/bf-blender/trunk/blender/source/blender/editors/object/object_bake.c
 

 Okay, I've found a 'multiresbake_get_normal' function for correct normals
 calculation.
 I also looked into 'DM_add_tangent_layer' function in:

 https://svn.blender.org/svnroot/bf-blender/trunk/blender/source/blender/blenkernel/intern/DerivedMesh.c
 According to it, the tangent layer is filling by tangents when created. So
 I do
 need only to access and welding them and normals?
 That's good if so.

 Today I had time to try understand how RNA's works.
 And I almost create and test python interface with collections for faces
 and
 indexed vertices with normals and tangents in it.
 Hopefully soon I'll start welding.

 
  If you need a free ultra simple welder there's one here --
  http://jbit.net/~sparky/academic/welder/
  You specify how many floats you have per vertex and it will weld for
 you.
 

 Okay, good one, I think I'll use it :)

 Thanks!

 On Wed, Nov 16, 2011 at 8:43 PM, Morten Mikkelsen mikkels...@gmail.com
 wrote:

  Sorry for confusing you here but I think I found a better reference for
 you
  since
  you'll be needing the tangents too and you are not supposed to be
 building
  them yourself.
 
  The proper way to get the tangent layer can be seen in:
 
 
 
 https://svn.blender.org/svnroot/bf-blender/trunk/blender/source/blender/editors/object/object_bake.c
 
  do_multires_bake()
 
  These are being fetched after the line:
 
  float *pvtangent= NULL;
 
 
  These are then read in the function flush_pixel() including the normal
  which is fetched from there using multiresbake_get_normal()
  which as you can see looks a lot like the GetNormal() function
  I pointed you to in DerivedMesh.c.
  Anyway, definitely use this file as your reference. I should have shown
 you
  this one from the beginning.
 
  If you need a free ultra simple welder there's one here --
  http://jbit.net/~sparky/academic/welder/
  You specify how many floats you have per vertex and it will weld for
 you.
 
 
 
  On Wed, Nov 16, 2011 at 5:32 AM, Eugene Minov minov@gmail.com
 wrote:
 
   
If you can get hold of the dm
(DerivedMesh)
on the c side of things then I can show you how to get the correct
   normals
and tangents
and even help you get them welded should you want this.
   
  
   Ok! Sounds good to me :)
  
   So right now I in progress of checkout latest svn sources and compile
   blender. (had problems with net)
   Then first of I'll try to create test version of python/C interface.
 I've
   not decided yet what names I'll use for it.
   And finally will be trying to implement it looking in DerivedMesh.c,
   I think that it's realy are a good example.
  
   If or when I have a problem, I'll be glad to use your help :)
   Many thanks for your kind cooperation!
  
  
  
   On Tue, Nov 15, 2011 at 10:41 PM, Morten Mikkelsen 
 mikkels...@gmail.com
   wrote:
  
I don't know anything about Python but if you can get hold of the dm
(DerivedMesh)
on the c side of things then I can show you how to get the correct
   normals
and tangents
and even help you get them welded should you want this.
   
   
   
   
On Tue, Nov 15, 2011 at 10:43 AM, Eugene Minov minov@gmail.com
 
wrote:
   
 Yes, I absolutely agree, hard faces obviously must be exported in
 the
same
 way how they seen in render.
 I think they can welds along with tangents.

 On Tue, Nov 15, 2011 at 9:01 PM, Morten Mikkelsen 
   mikkels...@gmail.com
 wrote:

  There is no point in doing this unless you export the correct
   tangents
 and
  normals. That is the ones
  that were used to bake the normal map.
 
  I realize it blows that there is no API function to get the
 render
 normal.
  So what you have to do is produce it yourself
  like is done in
  DerivedMesh.c
 

   
  
 
 https://svn.blender.org/svnroot/bf-blender/trunk/blender/source/blender/blenkernel/intern/DerivedMesh.c
  
  and
  many other places as well.
  An example in this file is the static function GetNormal()
 which is
used
 as
   a call-back function by mikktspace.c
  

Re: [Bf-committers] Please help me debugging

2011-11-17 Thread Rainer Hohne
Sorry Campbell, it's not quite there yet, but at least the error message
has changed (r41945):

Traceback (most recent call last):
  File ../blender/build_files/cmake/cmake_qtcreator_project.py, line 145,
in module
main()
  File ../blender/build_files/cmake/cmake_qtcreator_project.py, line 140,
in main
create_qtc_project_main()
  File ../blender/build_files/cmake/cmake_qtcreator_project.py, line 86,
in create_qtc_project_main
PROJECT_NAME = project_name_get(SOURCE_DIR)
  File
/home/rainer/Programme/blender-svn/blender/build_files/cmake/project_info.py,
line 229, in project_name_get
info = info.decode(encoding=utf-8, errors=ignore)
TypeError: decode() takes no keyword arguments

To make sure that I am doing everything right, I tried both CMakeGUI with
custom settings and make with Automatic CMake Setup - in every case I got
the above error.

Rainer
___
Bf-committers mailing list
Bf-committers@blender.org
http://lists.blender.org/mailman/listinfo/bf-committers


Re: [Bf-committers] Please help me debugging

2011-11-17 Thread Campbell Barton
What version of python are you running the script with?

Can you try this with python3.2?

--- in my console,

python3
Python 3.2.2 (default, Sep  5 2011, 04:52:19)
[GCC 4.6.1 20110819 (prerelease)] on linux2
Type help, copyright, credits or license for more information.
 b.decode(encoding=utf-8, errors=ignore)
''


---

When running the script with python2.7 I get this error (different from yours).

  File 
/dsk/data/src/blender/blender/build_files/cmake/cmake_qtcreator_project.py,
line 145, in module
main()
  File 
/dsk/data/src/blender/blender/build_files/cmake/cmake_qtcreator_project.py,
line 140, in main
create_qtc_project_main()
  File 
/dsk/data/src/blender/blender/build_files/cmake/cmake_qtcreator_project.py,
line 92, in create_qtc_project_main
f = open(os.path.join(PROJECT_DIR, %s.includes % FILE_NAME),
'w', encoding='utf-8')
TypeError: 'encoding' is an invalid keyword argument for this function


On Fri, Nov 18, 2011 at 5:10 AM, Rainer Hohne raho...@googlemail.com wrote:
 Sorry Campbell, it's not quite there yet, but at least the error message
 has changed (r41945):

 Traceback (most recent call last):
  File ../blender/build_files/cmake/cmake_qtcreator_project.py, line 145,
 in module
    main()
  File ../blender/build_files/cmake/cmake_qtcreator_project.py, line 140,
 in main
    create_qtc_project_main()
  File ../blender/build_files/cmake/cmake_qtcreator_project.py, line 86,
 in create_qtc_project_main
    PROJECT_NAME = project_name_get(SOURCE_DIR)
  File
 /home/rainer/Programme/blender-svn/blender/build_files/cmake/project_info.py,
 line 229, in project_name_get
    info = info.decode(encoding=utf-8, errors=ignore)
 TypeError: decode() takes no keyword arguments

 To make sure that I am doing everything right, I tried both CMakeGUI with
 custom settings and make with Automatic CMake Setup - in every case I got
 the above error.

 Rainer
 ___
 Bf-committers mailing list
 Bf-committers@blender.org
 http://lists.blender.org/mailman/listinfo/bf-committers




-- 
- Campbell
___
Bf-committers mailing list
Bf-committers@blender.org
http://lists.blender.org/mailman/listinfo/bf-committers