NEW BLENDER ANIMATION FEATURE

Compiling, libraries, modules, coding guidelines and porting

Moderators: jesterKing, stiv

Post Reply
ace1
Posts: 0
Joined: Mon Feb 19, 2007 4:21 am
Location: Miami,Florida
Contact:

NEW BLENDER ANIMATION FEATURE

Post by ace1 »

I'm presently coding a new feature to be able to use empties in posemode for rigging purposes. Also I'm implementing circle, square,rectangle and diamond shape empties. I need help understanding this function.
I'm modifying the custom bone draw function to do this.
I've already commented in the code what I've come to understand about this section of code.I need someone to finish or help me to understand parts I haven't put comments on. Specifically I need to know where where the value for the variable "id" comes from as well as "boneflag".
In which header file, or struct and where?

Thanks in advance!


//IN DRAW_ARMATURE.C


static void draw_custom_bone(Object *ob, int dt, int armflag, int boneflag, unsigned int id, float length)
{

// variable dt= drawtype wire or solid
// Object*ob= #define OB_MESH in dna_object_types.h or not
// int boneflag=#define BONE_SELECTED OR BONE ACTIVE

if(ob==NULL || ob->type!=OB_MESH) return;

glScalef(length, length, length);

/* colors for posemode */
if (armflag & ARM_POSEMODE) {
if (boneflag & BONE_ACTIVE) BIF_ThemeColorShade(TH_BONE_POSE, 40);


// IF boneflag= in ? and BONE ACTIVE in DNA_armature_types.h
then PUT BLENDER IN POSEMODE

else if (boneflag & BONE_SELECTED) BIF_ThemeColor(TH_BONE_POSE);
//COLOR THE BONE BLUE

else BIF_ThemeColor(TH_WIRE);
}

// which header file or struct does the value of id come from?

if (id != -1) {
glLoadName ((GLuint) id|BONESEL_BONE);
}

draw_object_instance(ob, dt, armflag & ARM_POSEMODE);
}
DIGIMATOR

aligorith
Posts: 0
Joined: Sun Dec 05, 2004 3:40 am
Location: Chch, NZ

Post by aligorith »

Hi,

It's nice that you're working on some new features for the armature system. What's the specific problem that you're trying to solve, that requires that empties are part of armatures (i.e. what can empties do that bones can't)?

Now, on to your question. A simple search for where this function is called in drawarmature.c will quickly reveal where various values are coming from. In short:
* draw_pose_channels is where this function gets called from
* bone_flag a copy of the int where the flags of the pose-channel currently being drawn, are accessed via bitmapping. In draw_pose_channels, this is the variable 'flag', which is basically a copy of pchan->bone->flag
* id is a value used for gl selection buffer stuff, so that the bone can be selected by clicking on it. In draw_pose_channels, this is the variable 'index', which is basically a copy of base->selcol.

I'm not that sure why you're choosing to modify this function to get this feature working. Reasons?

Also, in case you haven't found out yet, the way to code a new empty draw type is as follows:
  • * blender/source/blender/makesdna/DNA_object_types.h ---> line 334 /* empty_drawtype: no flags */
    add a new define for each drawtype you wish to add, in the style of the other ones, at the bottom of the list. Do NOT change the values of any existing ones. Use the next available number.
    * blender/source/blender/src/draw_object.c ---> function 'drawaxes'
    for each drawtype you wish to add, add a new case block + all the OGL drawing commands to reproduce this shape
    * blender/source/blender/src/buttons_editing.c ---> function 'editing_panel_links', where it says /* empty display handling, note it returns! */
    here you add the names of the new drawtypes and their codes as illustrated by the other drawtypes already there. This is where the combo-box/menu where users can select the empty drawtype occurs.
I hope that helps :)

Regards,
Aligorith

ace1
Posts: 0
Joined: Mon Feb 19, 2007 4:21 am
Location: Miami,Florida
Contact:

NEW ANIMATION FEATURE

Post by ace1 »

The reason that I'm implementing empties that can be used in pose mode is that for pro rigs, it's quicker and more asthetically pleasing to use modifiable curves or or shaped empties to make custom rig controls instead of modeling custom bones even though that feature is in my opinion very useful. In the pro enviroment, remember everything is workflow,workflow,workflow.How can we do it faster and more efficiently so as to produce the final product.The more efficient an animator and technical director can work, the more work they can produce.Blender is awesome and I am a great fan of your work as well.Thanks for the help as well.I just want to help Blender "rise to the occassion" in the pro industry.

After this I'm going to code a "parent in place" constraint in order to have more control over the placement of custom rig controls.
DIGIMATOR

ace1
Posts: 0
Joined: Mon Feb 19, 2007 4:21 am
Location: Miami,Florida
Contact:

Post by ace1 »

Thanks Aligorith!
The new code is almost finished and the New empty shapes are up and running!
Now to get them to react as children and parents in posemode! :D :D
DIGIMATOR

Post Reply