Hi,
I want to execute script python with somme buttons on the scene blender but i don’t know how can i do that.
This is an image of my .blend file:
Gray squares are my buttons.
Can you help me to do this please?
Hi,
I want to execute script python with somme buttons on the scene blender but i don’t know how can i do that.
This is an image of my .blend file:
On the button
mouse over ---> AND ---> Message Actuator "<operation> requested"
mouse button
On the object to perform the operation:
Message sensor "<operation> requested" ----> whatever
Can you explain more please?
I am new with blender
User input to request an operation
How to measure that a button was clicked?
A mouse over sensor measures when the mouse cursor is over the according mesh (there can be only one at the time).
A mouse button sensor measures when the user clicked a mouse button.
When both sensors measure you know the user clicked on the button (AND controller).
Now you interpret this button as a user request. For example you have two buttons one “When clicking this button, the player character should go left” and the other “When clicking the game should exit”.
So you send an according message with the request. “The user requests to let the character go left” and the other button “The user requests the game to exit”
The buttons doe not know anything who, or how to perform the operations. They just know … when the user clicked me I request this operation (by sending a message).
Performing requested operations
Typically this is done by objects which know how to do that. This can be any object in your active scenes.
The object is listening to a specific request message and acts accordingly.
Back to the example:
Character object (usually an armature or even multiple objects that form the character):
An message sensor measures on subject “The user requests to let the character go left”. When this happens the object can move left and play a side-step animation.
Game managing object (usually an empty):
An message sensor measures on subject “The user requests the game to exit”. When this happens the object activates a game actuator to exit the game.
I hope this helps