Alfonso Crawford, the Slackerjack

  • Random
  • Archive
  • RSS
  • Ask
  • Submit

Should I write up what I’ve learned of Blender-modding, when I’m done with this add-on I’m making?

I’d gladly share what I’ve learned, if anyone’s interested.

    • #blender
    • #programming
    • #code
    • #game development
    • #open source
    • #linux
    • #python
    • #c
    • #c++
  • 1 month ago
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+
Computers v. Developers
View Separately

Computers v. Developers

    • #code
    • #programming
    • #lol
    • #puppies
    • #animals
    • #pugs
    • #humor
    • #pictures
    • #java
    • #python
    • #c++
    • #c
    • #javascript
    • #linux
    • #open source
    • #windows
    • #cute
    • #seizure warning
  • 1 month ago
  • 13
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

I have no idea what I’m doing.

#ifdef __cplusplus

#include <map>
#include <vector>

struct BL_FramePropertyPair {
CValue* property;
} BL_FramePropertyPair;

class BL_ActionGameLogic {
public:
BL_ActionGameLogic();
void wilma(int);
void apply_properties(int frame, KX_GameObject* go);
private:
std::map<int, std::vector<BL_FramePropertyPair>> frame;
};
#else
typedef
struct BL_ActionGameLogic
Fred;
#endif

#ifdef __cplusplus
extern "C" {
#endif

#if defined(__STDC__) || defined(__cplusplus)
extern void c_function(BL_ActionGameLogic*); /* ANSI C prototypes */
extern Fred* cplusplus_callback_function(BL_ActionGameLogic*);

extern void add_property(BL_ActionGameLogic* agl);
extern void remove_property(BL_ActionGameLogic* agl);
#else
extern void c_function(); /* K&R style */
extern Fred* cplusplus_callback_function();
#endif

#ifdef __cplusplus
}
#endif

    • #code
    • #programming
    • #c++
    • #blender
    • #open source
    • #foss
    • #data management
    • #linux
    • #game development
  • 2 months ago
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

I’m looking at bAction, and it appears to be the object I want:

/* Action - reusable F-Curve 'bag'  (act) 
 *
 * This contains F-Curves that may affect settings from more than one ID blocktype and/or 
 * datablock (i.e. sub-data linked/used directly to the ID block that the animation data is linked to), 
 * but with the restriction that the other unrelated data (i.e. data that is not directly used or linked to
 * by the source ID block).
 *
 * It serves as a 'unit' of reusable animation information (i.e. keyframes/motion data), that 
 * affects a group of related settings (as defined by the user). 
 */
typedef struct bAction {
    ID id;              /* ID-serialisation for relinking */
    
    ListBase curves;    /* function-curves (FCurve) */
    ListBase chanbase;  /* legacy data - Action Channels (bActionChannel) in pre-2.5 animation system */
    ListBase groups;    /* groups of function-curves (bActionGroup) */
    ListBase markers;   /* markers local to the Action (used to provide Pose-Libraries) */
    
    int flag;           /* settings for this action */
    int active_marker;  /* index of the active marker */
    
    int idroot;         /* type of ID-blocks that action can be assigned to (if 0, will be set to whatever ID first evaluates it) */
    int pad;
} bAction;

Unlike every other animation-object I’ve found, it doesn’t reference anything complex. ListBase is just an abstraction for vectors and such, since bAction is just C, as far as I can tell.

What’s intriguing is that Action Actuators hold a pointer to a bAction object, and that referenced object is used as a defining component of the actuator’s update-method. Now look at the following snippet of the Action Actuator’s method, Update():

// Handle a frame property if it's defined
if ((m_flag & ACT_FLAG_ACTIVE) && m_framepropname[0] != 0)
{
    CValue* oldprop = obj->GetProperty(m_framepropname);
    CValue* newval = new CFloatValue(obj->GetActionFrame(m_layer));
    if (oldprop)
        oldprop->SetValue(newval);
    else
        obj->SetProperty(m_framepropname, newval);

    newval->Release();
}

What this shows is that the actuator can pretty easily modify a property in the object to which it is attached. Combining everything so far, there’s a very simple I shouldn’t watch videos while typing articles. Data stored within an action meant solely for game logic can reasonably be accessed and applied as a keyframe is reached without causing any interference to the established system of animation.

That’s what I was getting at.

There are still a few questions, however:

  1. How will this new data be set?
  2. How will it be saved?
  3. How will it be loaded?

It’s not a mountain of inquiries by any stretch, but hey. Anyway, I’m gonna lie down for a while. I think I caught another cold.

    • #code
    • #animation
    • #blender
    • #c++
    • #data management
    • #programming
    • #open source
    • #foss
    • #linux
    • #game development
  • 2 months ago
  • 2
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+
Pop-up View Separately
Pop-up View Separately
Pop-up View Separately
Pop-up View Separately
Pop-up View Separately
PreviousNext

Attached is a little comic outlining what I’m trying to do with my Blender-project.

    • #animation
    • #data management
    • #game development
    • #code
    • #blender
    • #game design
    • #pictures
    • #open source
    • #foss
    • #linux
  • 2 months ago
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

I’ve got a lead in the form of a header-file: BKE_animsys. Locating it now.

    • #c++
    • #animation
    • #blender
    • #code
    • #open source
    • #game development
    • #data management
    • #foss
    • #linux
  • 2 months ago
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

BL_Action seems to have the code I’m looking for, but there’s some polymorphism or something goin on, so I can’t say with certainty what objects are being manipulated.

    • #c++
    • #blender
    • #code
    • #programming
    • #game development
    • #open source
    • #foss
    • #linux
    • #game design
    • #data management
    • #animation
  • 2 months ago
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

Okay, I found a header/source-file called “BL_Action”. I am very hopeful.

    • #blender
    • #game development
    • #open source
    • #animation
    • #data management
    • #code
    • #programming
    • #linux
  • 2 months ago
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

Q:Just curious... What language do you use? It looks like you use C++?

Anonymous

I personally stick to higher-level languages, as, after 10 years of it, I’m pretty sick of programming and computers in general. At this point, all I’m really trying to do is save the next generation some time.

image

….

In this new project, however, I’m using C++; if not C outright. It’s just a matter of using the same tools Blender is built upon. ☺

    • #anonymous
    • #programming
    • #code
    • #c++
    • #c
    • #game development
    • #game design
    • #correspondence
    • #open source
    • #foss
    • #blender
    • #linux
  • 2 months ago
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

The following code is integral to my next major coding-project (aside from #OneGameAMonth), which is to add a new layer of functionality to Blender’s animation-system: this new ability will to alter the value of game properties, making fighting-games an incredible lot easier than they are currently.

bool SCA_PropertyActuator::Update()
{
    bool result = false;

    bool bNegativeEvent = IsNegativeEvent();
    RemoveAllEvents();


    if (bNegativeEvent)
        return false; // do nothing on negative events


    CValue* propowner = GetParent();
    CParser parser;
    parser.SetContext( propowner->AddRef());
    
    CExpression* userexpr= NULL;
    
    if (m_type==KX_ACT_PROP_TOGGLE)
    {
        /* don't use */
        CValue* newval;
        CValue* oldprop = propowner->GetProperty(m_propname);
        if (oldprop)
        {
            newval = new CBoolValue((oldprop->GetNumber()==0.0) ? true:false);
            oldprop->SetValue(newval);
        } else
        {    /* as not been assigned, evaluate as false, so assign true */
            newval = new CBoolValue(true);
            propowner->SetProperty(m_propname,newval);
        }
        newval->Release();
    }
    else if ((userexpr = parser.ProcessText(m_exprtxt))) {
        switch (m_type)
        {

        case KX_ACT_PROP_ASSIGN:
            {
                
                CValue* newval = userexpr->Calculate();
                CValue* oldprop = propowner->GetProperty(m_propname);
                if (oldprop)
                {
                    oldprop->SetValue(newval);
                } else
                {
                    propowner->SetProperty(m_propname,newval);
                }
                newval->Release();
                break;
            }
        case KX_ACT_PROP_ADD:
            {
                CValue* oldprop = propowner->GetProperty(m_propname);
                if (oldprop)
                {
                    // int waarde = (int)oldprop->GetNumber();  /*unused*/
                    CExpression* expr = new COperator2Expr(VALUE_ADD_OPERATOR,new CConstExpr(oldprop->AddRef()),
                                                            userexpr->AddRef());

                    CValue* newprop = expr->Calculate();
                    oldprop->SetValue(newprop);
                    newprop->Release();
                    expr->Release();

                }

                break;
            }
        case KX_ACT_PROP_COPY:
            {
                if (m_sourceObj)
                {
                    CValue* copyprop = m_sourceObj->GetProperty(m_exprtxt);
                    if (copyprop)
                    {
                        CValue *val = copyprop->GetReplica();
                        GetParent()->SetProperty(
                             m_propname,
                             val);
                        val->Release();

                    }
                }
                break;
            }
        /* case KX_ACT_PROP_TOGGLE: */ /* accounted for above, no need for userexpr */
        default:
            {

            }
        }

        userexpr->Release();
    }
    
    return result;
}

Read More

    • #blender
    • #code
    • #programming
    • #open source
    • #animation
    • #linux
    • #data management
    • #foss
    • #game development
    • #game design
  • 2 months ago
  • 1
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+
Page 1 of 12
← Newer • Older →

About

Avatar

Need help making games? websites? mafia hits? I'll help you do it more simply. There's a lot of nonsense out there in development, and I've got as little patience for it as you. My focus is, right now:

  • Blender / Python
  • HTML5 / JavaScript
  • PHP / Ancient Necromancy

On this site, you'll find a mix of detailed tutorials and quick tips to keep from losing nights to stupid hiccups. Along the way, I will spam fanart and digressions regarding modern survivalism, personal projects, and tales of my antagonizing the animal kingdom.

This blog is LGBT Friendly

WARNING: the author of this blog has an unhealthy interest in women, and it is periodically reflected in the content shared. Most of the sick displays will be safe for work.

Pages

  • An Important Sidenote
  • Fluffernutter Peanut-butter with a Slice of Cheese

Me, Elsewhere

  • @MadamLaunch on Twitter
  • My Skype Info
  • Linkedin Profile

Twitter

loading tweets…

  • RSS
  • Random
  • Archive
  • Ask
  • Submit
  • Mobile
Effector Theme by Pixel Union