Merge branch 'master' of https://github.com/okamstudio/godot
# Solved Conflicts: # scene/gui/spin_box.cpp # scene/gui/tree.cpp
This commit is contained in:
commit
553edf1f25
|
@ -998,6 +998,44 @@ static bool _guess_identifier_type_in_block(GDCompletionContext& context,int p_l
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
static bool _guess_identifier_from_assignment_in_function(GDCompletionContext& context,const StringName& p_identifier, const StringName& p_function,GDCompletionIdentifier &r_type) {
|
||||
|
||||
const GDParser::FunctionNode* func=NULL;
|
||||
for(int i=0;i<context._class->functions.size();i++) {
|
||||
if (context._class->functions[i]->name==p_function) {
|
||||
func=context._class->functions[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!func)
|
||||
return false;
|
||||
|
||||
for(int i=0;i<func->body->statements.size();i++) {
|
||||
|
||||
|
||||
|
||||
if (func->body->statements[i]->type==GDParser::BlockNode::TYPE_OPERATOR) {
|
||||
const GDParser::OperatorNode *op = static_cast<const GDParser::OperatorNode *>(func->body->statements[i]);
|
||||
if (op->op==GDParser::OperatorNode::OP_ASSIGN) {
|
||||
|
||||
if (op->arguments.size() && op->arguments[0]->type==GDParser::Node::TYPE_IDENTIFIER) {
|
||||
|
||||
const GDParser::IdentifierNode *id = static_cast<const GDParser::IdentifierNode *>(op->arguments[0]);
|
||||
|
||||
if (id->name==p_identifier) {
|
||||
|
||||
return _guess_expression_type(context,op->arguments[1],func->body->statements[i]->line,r_type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool _guess_identifier_type(GDCompletionContext& context,int p_line,const StringName& p_identifier,GDCompletionIdentifier &r_type) {
|
||||
|
||||
//go to block first
|
||||
|
@ -1089,8 +1127,22 @@ static bool _guess_identifier_type(GDCompletionContext& context,int p_line,const
|
|||
r_type=_get_type_from_pinfo(context._class->variables[i]._export);
|
||||
return true;
|
||||
} else if (context._class->variables[i].expression) {
|
||||
return _guess_expression_type(context,context._class->variables[i].expression,context._class->variables[i].line,r_type);
|
||||
|
||||
bool rtype = _guess_expression_type(context,context._class->variables[i].expression,context._class->variables[i].line,r_type);
|
||||
if (rtype && r_type.type!=Variant::NIL)
|
||||
return true;
|
||||
//return _guess_expression_type(context,context._class->variables[i].expression,context._class->variables[i].line,r_type);
|
||||
}
|
||||
|
||||
//try to guess from assignment in construtor or _ready
|
||||
if (_guess_identifier_from_assignment_in_function(context,p_identifier,"_ready",r_type))
|
||||
return true;
|
||||
if (_guess_identifier_from_assignment_in_function(context,p_identifier,"_enter_tree",r_type))
|
||||
return true;
|
||||
if (_guess_identifier_from_assignment_in_function(context,p_identifier,"_init",r_type))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -170,6 +170,7 @@ void GDParser::_make_completable_call(int p_arg) {
|
|||
completion_line=tokenizer->get_token_line();
|
||||
completion_argument=p_arg;
|
||||
completion_block=current_block;
|
||||
completion_found=true;
|
||||
tokenizer->advance();
|
||||
|
||||
}
|
||||
|
@ -190,6 +191,7 @@ bool GDParser::_get_completable_identifier(CompletionType p_type,StringName& ide
|
|||
completion_function=current_function;
|
||||
completion_line=tokenizer->get_token_line();
|
||||
completion_block=current_block;
|
||||
completion_found=true;
|
||||
tokenizer->advance();
|
||||
|
||||
if (tokenizer->get_token()==GDTokenizer::TK_IDENTIFIER) {
|
||||
|
@ -1414,6 +1416,20 @@ GDParser::Node* GDParser::_parse_and_reduce_expression(Node *p_parent,bool p_sta
|
|||
return expr;
|
||||
}
|
||||
|
||||
bool GDParser::_recover_from_completion() {
|
||||
|
||||
if (!completion_found) {
|
||||
return false; //can't recover if no completion
|
||||
}
|
||||
//skip stuff until newline
|
||||
while(tokenizer->get_token()!=GDTokenizer::TK_NEWLINE && tokenizer->get_token()!=GDTokenizer::TK_EOF) {
|
||||
tokenizer->advance();
|
||||
}
|
||||
completion_found=false;
|
||||
error_set=false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void GDParser::_parse_block(BlockNode *p_block,bool p_static) {
|
||||
|
||||
int indent_level = tab_level.back()->get();
|
||||
|
@ -1511,8 +1527,14 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) {
|
|||
Node *subexpr=NULL;
|
||||
|
||||
subexpr = _parse_and_reduce_expression(p_block,p_static);
|
||||
if (!subexpr)
|
||||
if (!subexpr) {
|
||||
if (_recover_from_completion()) {
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
lv->assign=subexpr;
|
||||
assigned=subexpr;
|
||||
|
@ -1543,8 +1565,12 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) {
|
|||
|
||||
tokenizer->advance();
|
||||
Node *condition = _parse_and_reduce_expression(p_block,p_static);
|
||||
if (!condition)
|
||||
if (!condition) {
|
||||
if (_recover_from_completion()) {
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
ControlFlowNode *cf_if = alloc_node<ControlFlowNode>();
|
||||
|
||||
|
@ -1598,8 +1624,12 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) {
|
|||
|
||||
//condition
|
||||
Node *condition = _parse_and_reduce_expression(p_block,p_static);
|
||||
if (!condition)
|
||||
if (!condition) {
|
||||
if (_recover_from_completion()) {
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
cf_else->arguments.push_back(condition);
|
||||
cf_else->cf_type=ControlFlowNode::CF_IF;
|
||||
|
||||
|
@ -1660,8 +1690,12 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) {
|
|||
|
||||
tokenizer->advance();
|
||||
Node *condition = _parse_and_reduce_expression(p_block,p_static);
|
||||
if (!condition)
|
||||
if (!condition) {
|
||||
if (_recover_from_completion()) {
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
ControlFlowNode *cf_while = alloc_node<ControlFlowNode>();
|
||||
|
||||
|
@ -1706,8 +1740,12 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) {
|
|||
tokenizer->advance();
|
||||
|
||||
Node *container = _parse_and_reduce_expression(p_block,p_static);
|
||||
if (!container)
|
||||
if (!container) {
|
||||
if (_recover_from_completion()) {
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
ControlFlowNode *cf_for = alloc_node<ControlFlowNode>();
|
||||
|
||||
|
@ -1771,8 +1809,12 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) {
|
|||
} else {
|
||||
//expect expression
|
||||
Node *retexpr = _parse_and_reduce_expression(p_block,p_static);
|
||||
if (!retexpr)
|
||||
if (!retexpr) {
|
||||
if (_recover_from_completion()) {
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
cf_return->arguments.push_back(retexpr);
|
||||
p_block->statements.push_back(cf_return);
|
||||
if (!_end_statement()) {
|
||||
|
@ -1787,8 +1829,12 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) {
|
|||
|
||||
tokenizer->advance();
|
||||
Node *condition = _parse_and_reduce_expression(p_block,p_static);
|
||||
if (!condition)
|
||||
if (!condition) {
|
||||
if (_recover_from_completion()) {
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
AssertNode *an = alloc_node<AssertNode>();
|
||||
an->condition=condition;
|
||||
p_block->statements.push_back(an);
|
||||
|
@ -1801,8 +1847,12 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) {
|
|||
default: {
|
||||
|
||||
Node *expression = _parse_and_reduce_expression(p_block,p_static,false,true);
|
||||
if (!expression)
|
||||
if (!expression) {
|
||||
if (_recover_from_completion()) {
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
p_block->statements.push_back(expression);
|
||||
if (!_end_statement()) {
|
||||
_set_error("Expected end of statement after expression.");
|
||||
|
@ -2626,8 +2676,12 @@ void GDParser::_parse_class(ClassNode *p_class) {
|
|||
Node *subexpr=NULL;
|
||||
|
||||
subexpr = _parse_and_reduce_expression(p_class,false,autoexport);
|
||||
if (!subexpr)
|
||||
if (!subexpr) {
|
||||
if (_recover_from_completion()) {
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
member.expression=subexpr;
|
||||
|
||||
|
@ -2756,8 +2810,12 @@ void GDParser::_parse_class(ClassNode *p_class) {
|
|||
Node *subexpr=NULL;
|
||||
|
||||
subexpr = _parse_and_reduce_expression(p_class,true,true);
|
||||
if (!subexpr)
|
||||
if (!subexpr) {
|
||||
if (_recover_from_completion()) {
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (subexpr->type!=Node::TYPE_CONSTANT) {
|
||||
_set_error("Expected constant expression");
|
||||
|
@ -2852,6 +2910,7 @@ Error GDParser::parse_bytecode(const Vector<uint8_t> &p_bytecode,const String& p
|
|||
completion_class=NULL;
|
||||
completion_function=NULL;
|
||||
completion_block=NULL;
|
||||
completion_found=false;
|
||||
current_block=NULL;
|
||||
current_class=NULL;
|
||||
current_function=NULL;
|
||||
|
@ -2874,6 +2933,7 @@ Error GDParser::parse(const String& p_code, const String& p_base_path, bool p_ju
|
|||
completion_class=NULL;
|
||||
completion_function=NULL;
|
||||
completion_block=NULL;
|
||||
completion_found=false;
|
||||
current_block=NULL;
|
||||
current_class=NULL;
|
||||
|
||||
|
@ -2917,6 +2977,8 @@ void GDParser::clear() {
|
|||
current_block=NULL;
|
||||
current_class=NULL;
|
||||
|
||||
completion_found=false;
|
||||
|
||||
current_function=NULL;
|
||||
|
||||
validating=false;
|
||||
|
|
|
@ -419,10 +419,12 @@ private:
|
|||
BlockNode *completion_block;
|
||||
int completion_line;
|
||||
int completion_argument;
|
||||
bool completion_found;
|
||||
|
||||
PropertyInfo current_export;
|
||||
|
||||
void _set_error(const String& p_error, int p_line=-1, int p_column=-1);
|
||||
bool _recover_from_completion();
|
||||
|
||||
|
||||
bool _parse_arguments(Node* p_parent, Vector<Node*>& p_args, bool p_static, bool p_can_codecomplete=false);
|
||||
|
|
|
@ -83,15 +83,25 @@ real_t Area::get_gravity() const{
|
|||
|
||||
return gravity;
|
||||
}
|
||||
void Area::set_linear_damp(real_t p_linear_damp){
|
||||
|
||||
void Area::set_density(real_t p_density){
|
||||
|
||||
density=p_density;
|
||||
PhysicsServer::get_singleton()->area_set_param(get_rid(),PhysicsServer::AREA_PARAM_DENSITY,p_density);
|
||||
linear_damp=p_linear_damp;
|
||||
PhysicsServer::get_singleton()->area_set_param(get_rid(),PhysicsServer::AREA_PARAM_LINEAR_DAMP,p_linear_damp);
|
||||
}
|
||||
real_t Area::get_density() const{
|
||||
real_t Area::get_linear_damp() const{
|
||||
|
||||
return density;
|
||||
return linear_damp;
|
||||
}
|
||||
|
||||
void Area::set_angular_damp(real_t p_angular_damp){
|
||||
|
||||
angular_damp=p_angular_damp;
|
||||
PhysicsServer::get_singleton()->area_set_param(get_rid(),PhysicsServer::AREA_PARAM_ANGULAR_DAMP,p_angular_damp);
|
||||
}
|
||||
|
||||
real_t Area::get_angular_damp() const{
|
||||
|
||||
return angular_damp;
|
||||
}
|
||||
|
||||
void Area::set_priority(real_t p_priority){
|
||||
|
@ -533,8 +543,11 @@ void Area::_bind_methods() {
|
|||
ObjectTypeDB::bind_method(_MD("set_gravity","gravity"),&Area::set_gravity);
|
||||
ObjectTypeDB::bind_method(_MD("get_gravity"),&Area::get_gravity);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_density","density"),&Area::set_density);
|
||||
ObjectTypeDB::bind_method(_MD("get_density"),&Area::get_density);
|
||||
ObjectTypeDB::bind_method(_MD("set_angular_damp","angular_damp"),&Area::set_angular_damp);
|
||||
ObjectTypeDB::bind_method(_MD("get_angular_damp"),&Area::get_angular_damp);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_linear_damp","linear_damp"),&Area::set_linear_damp);
|
||||
ObjectTypeDB::bind_method(_MD("get_linear_damp"),&Area::get_linear_damp);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_priority","priority"),&Area::set_priority);
|
||||
ObjectTypeDB::bind_method(_MD("get_priority"),&Area::get_priority);
|
||||
|
@ -571,7 +584,8 @@ void Area::_bind_methods() {
|
|||
ADD_PROPERTY( PropertyInfo(Variant::REAL,"gravity_distance_scale", PROPERTY_HINT_RANGE,"0,1024,0.001"),_SCS("set_gravity_distance_scale"),_SCS("get_gravity_distance_scale"));
|
||||
ADD_PROPERTY( PropertyInfo(Variant::VECTOR3,"gravity_vec"),_SCS("set_gravity_vector"),_SCS("get_gravity_vector"));
|
||||
ADD_PROPERTY( PropertyInfo(Variant::REAL,"gravity",PROPERTY_HINT_RANGE,"-1024,1024,0.01"),_SCS("set_gravity"),_SCS("get_gravity"));
|
||||
ADD_PROPERTY( PropertyInfo(Variant::REAL,"density",PROPERTY_HINT_RANGE,"0,1024,0.001"),_SCS("set_density"),_SCS("get_density"));
|
||||
ADD_PROPERTY( PropertyInfo(Variant::REAL,"linear_damp",PROPERTY_HINT_RANGE,"0,1024,0.001"),_SCS("set_linear_damp"),_SCS("get_linear_damp"));
|
||||
ADD_PROPERTY( PropertyInfo(Variant::REAL,"angular_damp",PROPERTY_HINT_RANGE,"0,1024,0.001"),_SCS("set_angular_damp"),_SCS("get_angular_damp"));
|
||||
ADD_PROPERTY( PropertyInfo(Variant::INT,"priority",PROPERTY_HINT_RANGE,"0,128,1"),_SCS("set_priority"),_SCS("get_priority"));
|
||||
ADD_PROPERTY( PropertyInfo(Variant::BOOL,"monitoring"),_SCS("set_enable_monitoring"),_SCS("is_monitoring_enabled"));
|
||||
ADD_PROPERTY( PropertyInfo(Variant::BOOL,"monitorable"),_SCS("set_monitorable"),_SCS("is_monitorable"));
|
||||
|
@ -586,7 +600,8 @@ Area::Area() : CollisionObject(PhysicsServer::get_singleton()->area_create(),tru
|
|||
set_gravity_vector(Vector3(0,-1,0));
|
||||
gravity_is_point=false;
|
||||
gravity_distance_scale=0;
|
||||
density=0.1;
|
||||
linear_damp=0.1;
|
||||
angular_damp=1;
|
||||
priority=0;
|
||||
monitoring=false;
|
||||
set_ray_pickable(false);
|
||||
|
|
|
@ -50,7 +50,8 @@ private:
|
|||
real_t gravity;
|
||||
bool gravity_is_point;
|
||||
real_t gravity_distance_scale;
|
||||
real_t density;
|
||||
real_t angular_damp;
|
||||
real_t linear_damp;
|
||||
int priority;
|
||||
bool monitoring;
|
||||
bool monitorable;
|
||||
|
@ -139,8 +140,11 @@ public:
|
|||
void set_gravity(real_t p_gravity);
|
||||
real_t get_gravity() const;
|
||||
|
||||
void set_density(real_t p_density);
|
||||
real_t get_density() const;
|
||||
void set_angular_damp(real_t p_angular_damp);
|
||||
real_t get_angular_damp() const;
|
||||
|
||||
void set_linear_damp(real_t p_linear_damp);
|
||||
real_t get_linear_damp() const;
|
||||
|
||||
void set_priority(real_t p_priority);
|
||||
real_t get_priority() const;
|
||||
|
|
|
@ -133,6 +133,8 @@ real_t StaticBody::get_bounce() const{
|
|||
return bounce;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void StaticBody::set_constant_linear_velocity(const Vector3& p_vel) {
|
||||
|
||||
constant_linear_velocity=p_vel;
|
||||
|
@ -494,6 +496,42 @@ real_t RigidBody::get_bounce() const{
|
|||
return bounce;
|
||||
}
|
||||
|
||||
|
||||
void RigidBody::set_gravity_scale(real_t p_gravity_scale){
|
||||
|
||||
gravity_scale=p_gravity_scale;
|
||||
PhysicsServer::get_singleton()->body_set_param(get_rid(),PhysicsServer::BODY_PARAM_GRAVITY_SCALE,gravity_scale);
|
||||
|
||||
}
|
||||
real_t RigidBody::get_gravity_scale() const{
|
||||
|
||||
return gravity_scale;
|
||||
}
|
||||
|
||||
void RigidBody::set_linear_damp(real_t p_linear_damp){
|
||||
|
||||
ERR_FAIL_COND(p_linear_damp<-1);
|
||||
linear_damp=p_linear_damp;
|
||||
PhysicsServer::get_singleton()->body_set_param(get_rid(),PhysicsServer::BODY_PARAM_LINEAR_DAMP,linear_damp);
|
||||
|
||||
}
|
||||
real_t RigidBody::get_linear_damp() const{
|
||||
|
||||
return linear_damp;
|
||||
}
|
||||
|
||||
void RigidBody::set_angular_damp(real_t p_angular_damp){
|
||||
|
||||
ERR_FAIL_COND(p_angular_damp<-1);
|
||||
angular_damp=p_angular_damp;
|
||||
PhysicsServer::get_singleton()->body_set_param(get_rid(),PhysicsServer::BODY_PARAM_ANGULAR_DAMP,angular_damp);
|
||||
|
||||
}
|
||||
real_t RigidBody::get_angular_damp() const{
|
||||
|
||||
return angular_damp;
|
||||
}
|
||||
|
||||
void RigidBody::set_axis_velocity(const Vector3& p_axis) {
|
||||
|
||||
Vector3 v = state? state->get_linear_velocity() : linear_velocity;
|
||||
|
@ -685,6 +723,16 @@ void RigidBody::_bind_methods() {
|
|||
ObjectTypeDB::bind_method(_MD("set_angular_velocity","angular_velocity"),&RigidBody::set_angular_velocity);
|
||||
ObjectTypeDB::bind_method(_MD("get_angular_velocity"),&RigidBody::get_angular_velocity);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_gravity_scale","gravity_scale"),&RigidBody::set_gravity_scale);
|
||||
ObjectTypeDB::bind_method(_MD("get_gravity_scale"),&RigidBody::get_gravity_scale);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_linear_damp","linear_damp"),&RigidBody::set_linear_damp);
|
||||
ObjectTypeDB::bind_method(_MD("get_linear_damp"),&RigidBody::get_linear_damp);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_angular_damp","angular_damp"),&RigidBody::set_angular_damp);
|
||||
ObjectTypeDB::bind_method(_MD("get_angular_damp"),&RigidBody::get_angular_damp);
|
||||
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_max_contacts_reported","amount"),&RigidBody::set_max_contacts_reported);
|
||||
ObjectTypeDB::bind_method(_MD("get_max_contacts_reported"),&RigidBody::get_max_contacts_reported);
|
||||
|
||||
|
@ -722,6 +770,7 @@ void RigidBody::_bind_methods() {
|
|||
ADD_PROPERTY( PropertyInfo(Variant::REAL,"weight",PROPERTY_HINT_EXP_RANGE,"0.01,65535,0.01",PROPERTY_USAGE_EDITOR),_SCS("set_weight"),_SCS("get_weight"));
|
||||
ADD_PROPERTY( PropertyInfo(Variant::REAL,"friction",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_friction"),_SCS("get_friction"));
|
||||
ADD_PROPERTY( PropertyInfo(Variant::REAL,"bounce",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_bounce"),_SCS("get_bounce"));
|
||||
ADD_PROPERTY( PropertyInfo(Variant::REAL,"gravity_scale",PROPERTY_HINT_RANGE,"-128,128,0.01"),_SCS("set_gravity_scale"),_SCS("get_gravity_scale"));
|
||||
ADD_PROPERTY( PropertyInfo(Variant::BOOL,"custom_integrator"),_SCS("set_use_custom_integrator"),_SCS("is_using_custom_integrator"));
|
||||
ADD_PROPERTY( PropertyInfo(Variant::BOOL,"continuous_cd"),_SCS("set_use_continuous_collision_detection"),_SCS("is_using_continuous_collision_detection"));
|
||||
ADD_PROPERTY( PropertyInfo(Variant::INT,"contacts_reported"),_SCS("set_max_contacts_reported"),_SCS("get_max_contacts_reported"));
|
||||
|
@ -731,6 +780,8 @@ void RigidBody::_bind_methods() {
|
|||
ADD_PROPERTY( PropertyInfo(Variant::INT,"axis_lock",PROPERTY_HINT_ENUM,"Disabled,Lock X,Lock Y,Lock Z"),_SCS("set_axis_lock"),_SCS("get_axis_lock"));
|
||||
ADD_PROPERTY( PropertyInfo(Variant::VECTOR3,"velocity/linear"),_SCS("set_linear_velocity"),_SCS("get_linear_velocity"));
|
||||
ADD_PROPERTY( PropertyInfo(Variant::VECTOR3,"velocity/angular"),_SCS("set_angular_velocity"),_SCS("get_angular_velocity"));
|
||||
ADD_PROPERTY( PropertyInfo(Variant::REAL,"damp_override/linear",PROPERTY_HINT_RANGE,"-1,128,0.01"),_SCS("set_linear_damp"),_SCS("get_linear_damp"));
|
||||
ADD_PROPERTY( PropertyInfo(Variant::REAL,"damp_override/angular",PROPERTY_HINT_RANGE,"-1,128,0.01"),_SCS("set_angular_damp"),_SCS("get_angular_damp"));
|
||||
|
||||
ADD_SIGNAL( MethodInfo("body_enter_shape",PropertyInfo(Variant::INT,"body_id"),PropertyInfo(Variant::OBJECT,"body"),PropertyInfo(Variant::INT,"body_shape"),PropertyInfo(Variant::INT,"local_shape")));
|
||||
ADD_SIGNAL( MethodInfo("body_exit_shape",PropertyInfo(Variant::INT,"body_id"),PropertyInfo(Variant::OBJECT,"body"),PropertyInfo(Variant::INT,"body_shape"),PropertyInfo(Variant::INT,"local_shape")));
|
||||
|
@ -753,6 +804,10 @@ RigidBody::RigidBody() : PhysicsBody(PhysicsServer::BODY_MODE_RIGID) {
|
|||
max_contacts_reported=0;
|
||||
state=NULL;
|
||||
|
||||
gravity_scale=1;
|
||||
linear_damp=-1;
|
||||
angular_damp=-1;
|
||||
|
||||
//angular_velocity=0;
|
||||
sleeping=false;
|
||||
ccd=false;
|
||||
|
|
|
@ -129,6 +129,10 @@ private:
|
|||
|
||||
Vector3 linear_velocity;
|
||||
Vector3 angular_velocity;
|
||||
real_t gravity_scale;
|
||||
real_t linear_damp;
|
||||
real_t angular_damp;
|
||||
|
||||
bool sleeping;
|
||||
bool ccd;
|
||||
|
||||
|
@ -217,6 +221,16 @@ public:
|
|||
void set_angular_velocity(const Vector3&p_velocity);
|
||||
Vector3 get_angular_velocity() const;
|
||||
|
||||
void set_gravity_scale(real_t p_gravity_scale);
|
||||
real_t get_gravity_scale() const;
|
||||
|
||||
void set_linear_damp(real_t p_linear_damp);
|
||||
real_t get_linear_damp() const;
|
||||
|
||||
void set_angular_damp(real_t p_angular_damp);
|
||||
real_t get_angular_damp() const;
|
||||
|
||||
|
||||
void set_use_custom_integrator(bool p_enable);
|
||||
bool is_using_custom_integrator();
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ void SpinBox::_input_event(const InputEvent& p_event) {
|
|||
if (drag.enabled) {
|
||||
|
||||
float diff_y = drag.mouse_pos.y - cpos.y;
|
||||
diff_y=pow((float)ABS(diff_y),(float)1.8)*SGN(diff_y);
|
||||
diff_y=Math::pow(ABS(diff_y),1.8)*SGN(diff_y);
|
||||
diff_y*=0.1;
|
||||
|
||||
drag.mouse_pos=cpos;
|
||||
|
|
|
@ -2070,7 +2070,7 @@ void Tree::_input_event(InputEvent p_event) {
|
|||
|
||||
TreeItem::Cell &c=popup_edited_item->cells[popup_edited_item_col];
|
||||
float diff_y = -b.relative_y;
|
||||
diff_y=pow((float)ABS(diff_y),(float)1.8)*SGN(diff_y);
|
||||
diff_y=Math::pow(ABS(diff_y),1.8)*SGN(diff_y);
|
||||
diff_y*=0.1;
|
||||
range_drag_base=CLAMP(range_drag_base + c.step * diff_y, c.min, c.max);
|
||||
|
||||
|
|
|
@ -123,7 +123,8 @@ void AreaSW::set_param(PhysicsServer::AreaParameter p_param, const Variant& p_va
|
|||
case PhysicsServer::AREA_PARAM_GRAVITY_IS_POINT: gravity_is_point=p_value; ; break;
|
||||
case PhysicsServer::AREA_PARAM_GRAVITY_DISTANCE_SCALE: gravity_distance_scale=p_value; ; break;
|
||||
case PhysicsServer::AREA_PARAM_GRAVITY_POINT_ATTENUATION: point_attenuation=p_value; ; break;
|
||||
case PhysicsServer::AREA_PARAM_DENSITY: density=p_value; ; break;
|
||||
case PhysicsServer::AREA_PARAM_LINEAR_DAMP: linear_damp=p_value; ; break;
|
||||
case PhysicsServer::AREA_PARAM_ANGULAR_DAMP: angular_damp=p_value; ; break;
|
||||
case PhysicsServer::AREA_PARAM_PRIORITY: priority=p_value; ; break;
|
||||
}
|
||||
|
||||
|
@ -139,7 +140,8 @@ Variant AreaSW::get_param(PhysicsServer::AreaParameter p_param) const {
|
|||
case PhysicsServer::AREA_PARAM_GRAVITY_IS_POINT: return gravity_is_point;
|
||||
case PhysicsServer::AREA_PARAM_GRAVITY_DISTANCE_SCALE: return gravity_distance_scale;
|
||||
case PhysicsServer::AREA_PARAM_GRAVITY_POINT_ATTENUATION: return point_attenuation;
|
||||
case PhysicsServer::AREA_PARAM_DENSITY: return density;
|
||||
case PhysicsServer::AREA_PARAM_LINEAR_DAMP: return linear_damp;
|
||||
case PhysicsServer::AREA_PARAM_ANGULAR_DAMP: return angular_damp;
|
||||
case PhysicsServer::AREA_PARAM_PRIORITY: return priority;
|
||||
}
|
||||
|
||||
|
@ -248,7 +250,8 @@ AreaSW::AreaSW() : CollisionObjectSW(TYPE_AREA), monitor_query_list(this), move
|
|||
gravity_is_point=false;
|
||||
gravity_distance_scale=0;
|
||||
point_attenuation=1;
|
||||
density=0.1;
|
||||
angular_damp=1.0;
|
||||
linear_damp=0.1;
|
||||
priority=0;
|
||||
set_ray_pickable(false);
|
||||
monitor_callback_id=0;
|
||||
|
|
|
@ -47,7 +47,8 @@ class AreaSW : public CollisionObjectSW{
|
|||
bool gravity_is_point;
|
||||
float gravity_distance_scale;
|
||||
float point_attenuation;
|
||||
float density;
|
||||
float linear_damp;
|
||||
float angular_damp;
|
||||
int priority;
|
||||
bool monitorable;
|
||||
|
||||
|
@ -145,8 +146,11 @@ public:
|
|||
_FORCE_INLINE_ void set_point_attenuation(float p_point_attenuation) { point_attenuation=p_point_attenuation; }
|
||||
_FORCE_INLINE_ float get_point_attenuation() const { return point_attenuation; }
|
||||
|
||||
_FORCE_INLINE_ void set_density(float p_density) { density=p_density; }
|
||||
_FORCE_INLINE_ float get_density() const { return density; }
|
||||
_FORCE_INLINE_ void set_linear_damp(float p_linear_damp) { linear_damp=p_linear_damp; }
|
||||
_FORCE_INLINE_ float get_linear_damp() const { return linear_damp; }
|
||||
|
||||
_FORCE_INLINE_ void set_angular_damp(float p_angular_damp) { angular_damp=p_angular_damp; }
|
||||
_FORCE_INLINE_ float get_angular_damp() const { return angular_damp; }
|
||||
|
||||
_FORCE_INLINE_ void set_priority(int p_priority) { priority=p_priority; }
|
||||
_FORCE_INLINE_ int get_priority() const { return priority; }
|
||||
|
|
|
@ -159,6 +159,17 @@ void BodySW::set_param(PhysicsServer::BodyParameter p_param, float p_value) {
|
|||
_update_inertia();
|
||||
|
||||
} break;
|
||||
case PhysicsServer::BODY_PARAM_GRAVITY_SCALE: {
|
||||
gravity_scale=p_value;
|
||||
} break;
|
||||
case PhysicsServer::BODY_PARAM_LINEAR_DAMP: {
|
||||
|
||||
linear_damp=p_value;
|
||||
} break;
|
||||
case PhysicsServer::BODY_PARAM_ANGULAR_DAMP: {
|
||||
|
||||
angular_damp=p_value;
|
||||
} break;
|
||||
default:{}
|
||||
}
|
||||
}
|
||||
|
@ -177,6 +188,18 @@ float BodySW::get_param(PhysicsServer::BodyParameter p_param) const {
|
|||
case PhysicsServer::BODY_PARAM_MASS: {
|
||||
return mass;
|
||||
} break;
|
||||
case PhysicsServer::BODY_PARAM_GRAVITY_SCALE: {
|
||||
return gravity_scale;
|
||||
} break;
|
||||
case PhysicsServer::BODY_PARAM_LINEAR_DAMP: {
|
||||
|
||||
return linear_damp;
|
||||
} break;
|
||||
case PhysicsServer::BODY_PARAM_ANGULAR_DAMP: {
|
||||
|
||||
return angular_damp;
|
||||
} break;
|
||||
|
||||
default:{}
|
||||
}
|
||||
|
||||
|
@ -380,6 +403,8 @@ void BodySW::integrate_forces(real_t p_step) {
|
|||
return;
|
||||
|
||||
AreaSW *def_area = get_space()->get_default_area();
|
||||
AreaSW *damp_area = def_area;
|
||||
|
||||
ERR_FAIL_COND(!def_area);
|
||||
|
||||
int ac = areas.size();
|
||||
|
@ -388,7 +413,7 @@ void BodySW::integrate_forces(real_t p_step) {
|
|||
if (ac) {
|
||||
areas.sort();
|
||||
const AreaCMP *aa = &areas[0];
|
||||
density = aa[ac-1].area->get_density();
|
||||
damp_area = aa[ac-1].area;
|
||||
for(int i=ac-1;i>=0;i--) {
|
||||
_compute_area_gravity(aa[i].area);
|
||||
if (aa[i].area->get_space_override_mode() == PhysicsServer::AREA_SPACE_OVERRIDE_REPLACE) {
|
||||
|
@ -396,13 +421,25 @@ void BodySW::integrate_forces(real_t p_step) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
density=def_area->get_density();
|
||||
}
|
||||
|
||||
if( !replace ) {
|
||||
_compute_area_gravity(def_area);
|
||||
}
|
||||
|
||||
gravity*=gravity_scale;
|
||||
|
||||
if (angular_damp>=0)
|
||||
area_angular_damp=angular_damp;
|
||||
else
|
||||
area_angular_damp=damp_area->get_angular_damp();
|
||||
|
||||
if (linear_damp>=0)
|
||||
area_linear_damp=linear_damp;
|
||||
else
|
||||
area_linear_damp=damp_area->get_linear_damp();
|
||||
|
||||
|
||||
Vector3 motion;
|
||||
bool do_motion=false;
|
||||
|
||||
|
@ -431,12 +468,12 @@ void BodySW::integrate_forces(real_t p_step) {
|
|||
force+=applied_force;
|
||||
Vector3 torque=applied_torque;
|
||||
|
||||
real_t damp = 1.0 - p_step * density;
|
||||
real_t damp = 1.0 - p_step * area_linear_damp;
|
||||
|
||||
if (damp<0) // reached zero in the given time
|
||||
damp=0;
|
||||
|
||||
real_t angular_damp = 1.0 - p_step * density * get_space()->get_body_angular_velocity_damp_ratio();
|
||||
real_t angular_damp = 1.0 - p_step * area_angular_damp;
|
||||
|
||||
if (angular_damp<0) // reached zero in the given time
|
||||
angular_damp=0;
|
||||
|
@ -695,8 +732,12 @@ BodySW::BodySW() : CollisionObjectSW(TYPE_BODY), active_list(this), inertia_upda
|
|||
island_list_next=NULL;
|
||||
first_time_kinematic=false;
|
||||
_set_static(false);
|
||||
density=0;
|
||||
|
||||
contact_count=0;
|
||||
gravity_scale=1.0;
|
||||
|
||||
area_angular_damp=0;
|
||||
area_linear_damp=0;
|
||||
|
||||
still_time=0;
|
||||
continuous_cd=false;
|
||||
|
|
|
@ -50,6 +50,10 @@ class BodySW : public CollisionObjectSW {
|
|||
real_t bounce;
|
||||
real_t friction;
|
||||
|
||||
real_t linear_damp;
|
||||
real_t angular_damp;
|
||||
real_t gravity_scale;
|
||||
|
||||
PhysicsServer::BodyAxisLock axis_lock;
|
||||
|
||||
real_t _inv_mass;
|
||||
|
@ -57,13 +61,16 @@ class BodySW : public CollisionObjectSW {
|
|||
Matrix3 _inv_inertia_tensor;
|
||||
|
||||
Vector3 gravity;
|
||||
real_t density;
|
||||
|
||||
real_t still_time;
|
||||
|
||||
Vector3 applied_force;
|
||||
Vector3 applied_torque;
|
||||
|
||||
float area_angular_damp;
|
||||
float area_linear_damp;
|
||||
|
||||
|
||||
SelfList<BodySW> active_list;
|
||||
SelfList<BodySW> inertia_update_list;
|
||||
SelfList<BodySW> direct_state_query_list;
|
||||
|
@ -233,7 +240,6 @@ public:
|
|||
_FORCE_INLINE_ Matrix3 get_inv_inertia_tensor() const { return _inv_inertia_tensor; }
|
||||
_FORCE_INLINE_ real_t get_friction() const { return friction; }
|
||||
_FORCE_INLINE_ Vector3 get_gravity() const { return gravity; }
|
||||
_FORCE_INLINE_ real_t get_density() const { return density; }
|
||||
_FORCE_INLINE_ real_t get_bounce() const { return bounce; }
|
||||
|
||||
_FORCE_INLINE_ void set_axis_lock(PhysicsServer::BodyAxisLock p_lock) { axis_lock=p_lock; }
|
||||
|
@ -335,8 +341,9 @@ public:
|
|||
BodySW *body;
|
||||
real_t step;
|
||||
|
||||
virtual Vector3 get_total_gravity() const { return body->get_gravity(); } // get gravity vector working on this body space/area
|
||||
virtual float get_total_density() const { return body->get_density(); } // get density of this body space/area
|
||||
virtual Vector3 get_total_gravity() const { return body->gravity; } // get gravity vector working on this body space/area
|
||||
virtual float get_total_angular_damp() const { return body->area_angular_damp; } // get density of this body space/area
|
||||
virtual float get_total_linear_damp() const { return body->area_linear_damp; } // get density of this body space/area
|
||||
|
||||
virtual float get_inverse_mass() const { return body->get_inv_mass(); } // get the mass
|
||||
virtual Vector3 get_inverse_inertia() const { return body->get_inv_inertia(); } // get density of this body space
|
||||
|
|
|
@ -337,9 +337,9 @@ public:
|
|||
Body2DSW *body;
|
||||
real_t step;
|
||||
|
||||
virtual Vector2 get_total_gravity() const { return body->get_gravity(); } // get gravity vector working on this body space/area
|
||||
virtual float get_total_angular_damp() const { return body->get_angular_damp(); } // get density of this body space/area
|
||||
virtual float get_total_linear_damp() const { return body->get_linear_damp(); } // get density of this body space/area
|
||||
virtual Vector2 get_total_gravity() const { return body->gravity; } // get gravity vector working on this body space/area
|
||||
virtual float get_total_angular_damp() const { return body->area_angular_damp; } // get density of this body space/area
|
||||
virtual float get_total_linear_damp() const { return body->area_linear_damp; } // get density of this body space/area
|
||||
|
||||
virtual float get_inverse_mass() const { return body->get_inv_mass(); } // get the mass
|
||||
virtual real_t get_inverse_inertia() const { return body->get_inv_inertia(); } // get density of this body space
|
||||
|
|
|
@ -39,13 +39,18 @@ void PhysicsDirectBodyState::integrate_forces() {
|
|||
|
||||
Vector3 av = get_angular_velocity();
|
||||
|
||||
float damp = 1.0 - step * get_total_density();
|
||||
float linear_damp = 1.0 - step * get_total_linear_damp();
|
||||
|
||||
if (damp<0) // reached zero in the given time
|
||||
damp=0;
|
||||
if (linear_damp<0) // reached zero in the given time
|
||||
linear_damp=0;
|
||||
|
||||
lv*=damp;
|
||||
av*=damp;
|
||||
float angular_damp = 1.0 - step * get_total_angular_damp();
|
||||
|
||||
if (angular_damp<0) // reached zero in the given time
|
||||
angular_damp=0;
|
||||
|
||||
lv*=linear_damp;
|
||||
av*=angular_damp;
|
||||
|
||||
set_linear_velocity(lv);
|
||||
set_angular_velocity(av);
|
||||
|
@ -70,7 +75,8 @@ PhysicsServer * PhysicsServer::get_singleton() {
|
|||
void PhysicsDirectBodyState::_bind_methods() {
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("get_total_gravity"),&PhysicsDirectBodyState::get_total_gravity);
|
||||
ObjectTypeDB::bind_method(_MD("get_total_density"),&PhysicsDirectBodyState::get_total_density);
|
||||
ObjectTypeDB::bind_method(_MD("get_total_linear_damp"),&PhysicsDirectBodyState::get_total_linear_damp);
|
||||
ObjectTypeDB::bind_method(_MD("get_total_angular_damp"),&PhysicsDirectBodyState::get_total_angular_damp);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("get_inverse_mass"),&PhysicsDirectBodyState::get_inverse_mass);
|
||||
ObjectTypeDB::bind_method(_MD("get_inverse_inertia"),&PhysicsDirectBodyState::get_inverse_inertia);
|
||||
|
@ -683,7 +689,8 @@ void PhysicsServer::_bind_methods() {
|
|||
BIND_CONSTANT( AREA_PARAM_GRAVITY_IS_POINT );
|
||||
BIND_CONSTANT( AREA_PARAM_GRAVITY_DISTANCE_SCALE );
|
||||
BIND_CONSTANT( AREA_PARAM_GRAVITY_POINT_ATTENUATION );
|
||||
BIND_CONSTANT( AREA_PARAM_DENSITY );
|
||||
BIND_CONSTANT( AREA_PARAM_LINEAR_DAMP );
|
||||
BIND_CONSTANT( AREA_PARAM_ANGULAR_DAMP );
|
||||
BIND_CONSTANT( AREA_PARAM_PRIORITY );
|
||||
|
||||
BIND_CONSTANT( AREA_SPACE_OVERRIDE_COMBINE );
|
||||
|
@ -698,6 +705,9 @@ void PhysicsServer::_bind_methods() {
|
|||
BIND_CONSTANT( BODY_PARAM_BOUNCE );
|
||||
BIND_CONSTANT( BODY_PARAM_FRICTION );
|
||||
BIND_CONSTANT( BODY_PARAM_MASS );
|
||||
BIND_CONSTANT( BODY_PARAM_GRAVITY_SCALE );
|
||||
BIND_CONSTANT( BODY_PARAM_ANGULAR_DAMP );
|
||||
BIND_CONSTANT( BODY_PARAM_LINEAR_DAMP );
|
||||
BIND_CONSTANT( BODY_PARAM_MAX );
|
||||
|
||||
BIND_CONSTANT( BODY_STATE_TRANSFORM );
|
||||
|
|
|
@ -41,8 +41,9 @@ protected:
|
|||
static void _bind_methods();
|
||||
public:
|
||||
|
||||
virtual Vector3 get_total_gravity() const=0; // get gravity vector working on this body space/area
|
||||
virtual float get_total_density() const=0; // get density of this body space/area
|
||||
virtual Vector3 get_total_gravity() const=0;
|
||||
virtual float get_total_angular_damp() const=0;
|
||||
virtual float get_total_linear_damp() const=0;
|
||||
|
||||
virtual float get_inverse_mass() const=0; // get the mass
|
||||
virtual Vector3 get_inverse_inertia() const=0; // get density of this body space
|
||||
|
@ -300,7 +301,8 @@ public:
|
|||
AREA_PARAM_GRAVITY_IS_POINT,
|
||||
AREA_PARAM_GRAVITY_DISTANCE_SCALE,
|
||||
AREA_PARAM_GRAVITY_POINT_ATTENUATION,
|
||||
AREA_PARAM_DENSITY,
|
||||
AREA_PARAM_LINEAR_DAMP,
|
||||
AREA_PARAM_ANGULAR_DAMP,
|
||||
AREA_PARAM_PRIORITY
|
||||
};
|
||||
|
||||
|
@ -398,6 +400,9 @@ public:
|
|||
BODY_PARAM_BOUNCE,
|
||||
BODY_PARAM_FRICTION,
|
||||
BODY_PARAM_MASS, ///< unused for static, always infinite
|
||||
BODY_PARAM_GRAVITY_SCALE,
|
||||
BODY_PARAM_LINEAR_DAMP,
|
||||
BODY_PARAM_ANGULAR_DAMP,
|
||||
BODY_PARAM_MAX,
|
||||
};
|
||||
|
||||
|
@ -411,7 +416,7 @@ public:
|
|||
BODY_STATE_LINEAR_VELOCITY,
|
||||
BODY_STATE_ANGULAR_VELOCITY,
|
||||
BODY_STATE_SLEEPING,
|
||||
BODY_STATE_CAN_SLEEP
|
||||
BODY_STATE_CAN_SLEEP
|
||||
};
|
||||
|
||||
virtual void body_set_state(RID p_body, BodyState p_state, const Variant& p_variant)=0;
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "io/resource_saver.h"
|
||||
#include "pair.h"
|
||||
#include "scene/gui/separator.h"
|
||||
#include "editor_node.h"
|
||||
/* Missing to fix:
|
||||
|
||||
*Set
|
||||
|
@ -634,9 +635,14 @@ void AnimationKeyEditor::_menu_track(int p_type) {
|
|||
last_menu_track_opt=p_type;
|
||||
switch(p_type) {
|
||||
|
||||
case TRACK_MENU_ADD_VALUE_TRACK:
|
||||
case TRACK_MENU_ADD_TRANSFORM_TRACK:
|
||||
case TRACK_MENU_ADD_CALL_TRACK: {
|
||||
if (root) {
|
||||
call_select->popup_centered_ratio();
|
||||
break;
|
||||
}
|
||||
} break;
|
||||
case TRACK_MENU_ADD_VALUE_TRACK:
|
||||
case TRACK_MENU_ADD_TRANSFORM_TRACK: {
|
||||
|
||||
undo_redo->create_action("Anim Add Track");
|
||||
undo_redo->add_do_method(animation.ptr(),"add_track",p_type);
|
||||
|
@ -2735,6 +2741,7 @@ void AnimationKeyEditor::_notification(int p_what) {
|
|||
|
||||
|
||||
}
|
||||
call_select->connect("selected",this,"_add_call_track");
|
||||
// rename_anim->set_icon( get_icon("Rename","EditorIcons") );
|
||||
/*
|
||||
edit_anim->set_icon( get_icon("Edit","EditorIcons") );
|
||||
|
@ -3456,6 +3463,26 @@ void AnimationKeyEditor::_scale() {
|
|||
}
|
||||
|
||||
|
||||
void AnimationKeyEditor::_add_call_track(const NodePath& p_base) {
|
||||
|
||||
print_line("BASE IS "+String(p_base));
|
||||
Node* base = EditorNode::get_singleton()->get_edited_scene();
|
||||
if (!base)
|
||||
return;
|
||||
Node* from=base->get_node(p_base);
|
||||
if (!from || !root)
|
||||
return;
|
||||
|
||||
NodePath path = root->get_path_to(from);
|
||||
|
||||
undo_redo->create_action("Anim Add Call Track");
|
||||
undo_redo->add_do_method(animation.ptr(),"add_track",Animation::TYPE_METHOD);
|
||||
undo_redo->add_do_method(animation.ptr(),"track_set_path",animation->get_track_count(),path);
|
||||
undo_redo->add_undo_method(animation.ptr(),"remove_track",animation->get_track_count());
|
||||
undo_redo->commit_action();
|
||||
|
||||
}
|
||||
|
||||
void AnimationKeyEditor::cleanup() {
|
||||
|
||||
set_animation(Ref<Animation>());
|
||||
|
@ -3503,6 +3530,7 @@ void AnimationKeyEditor::_bind_methods() {
|
|||
ObjectTypeDB::bind_method(_MD("_animation_optimize"),&AnimationKeyEditor::_animation_optimize);
|
||||
ObjectTypeDB::bind_method(_MD("_curve_transition_changed"),&AnimationKeyEditor::_curve_transition_changed);
|
||||
ObjectTypeDB::bind_method(_MD("_toggle_edit_curves"),&AnimationKeyEditor::_toggle_edit_curves);
|
||||
ObjectTypeDB::bind_method(_MD("_add_call_track"),&AnimationKeyEditor::_add_call_track);
|
||||
|
||||
|
||||
ADD_SIGNAL( MethodInfo("resource_selected", PropertyInfo( Variant::OBJECT, "res"),PropertyInfo( Variant::STRING, "prop") ) );
|
||||
|
@ -3815,7 +3843,9 @@ AnimationKeyEditor::AnimationKeyEditor(UndoRedo *p_undo_redo, EditorHistory *p_h
|
|||
scale_dialog->connect("confirmed",this,"_scale");
|
||||
add_child(scale_dialog);
|
||||
|
||||
|
||||
call_select = memnew( SceneTreeDialog );
|
||||
add_child(call_select);
|
||||
call_select->set_title("Call Functions in Which Node?");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include "scene_tree_editor.h"
|
||||
#include "editor_data.h"
|
||||
#include "property_editor.h"
|
||||
|
||||
#include "scene_tree_editor.h"
|
||||
|
||||
class AnimationKeyEdit;
|
||||
class AnimationCurveEdit;
|
||||
|
@ -206,6 +206,8 @@ class AnimationKeyEditor : public VBoxContainer {
|
|||
|
||||
PropertyEditor *key_editor;
|
||||
|
||||
SceneTreeDialog *call_select;
|
||||
|
||||
Ref<Animation> animation;
|
||||
void _update_paths();
|
||||
|
||||
|
@ -299,6 +301,8 @@ class AnimationKeyEditor : public VBoxContainer {
|
|||
void _toggle_edit_curves();
|
||||
void _animation_len_update();
|
||||
|
||||
void _add_call_track(const NodePath& p_base);
|
||||
|
||||
void _root_removed();
|
||||
protected:
|
||||
|
||||
|
|
|
@ -771,18 +771,47 @@ void ProjectSettings::_autoload_add() {
|
|||
|
||||
void ProjectSettings::_autoload_delete(Object *p_item,int p_column, int p_button) {
|
||||
|
||||
|
||||
TreeItem *ti=p_item->cast_to<TreeItem>();
|
||||
String name = "autoload/"+ti->get_text(0);
|
||||
|
||||
undo_redo->create_action("Remove Autoload");
|
||||
undo_redo->add_do_property(Globals::get_singleton(),name,Variant());
|
||||
undo_redo->add_undo_property(Globals::get_singleton(),name,Globals::get_singleton()->get(name));
|
||||
undo_redo->add_undo_method(Globals::get_singleton(),"set_persisting",name,true);
|
||||
undo_redo->add_do_method(this,"_update_autoload");
|
||||
undo_redo->add_undo_method(this,"_update_autoload");
|
||||
undo_redo->add_do_method(this,"_settings_changed");
|
||||
undo_redo->add_undo_method(this,"_settings_changed");
|
||||
undo_redo->commit_action();
|
||||
if (p_button==0) {
|
||||
//delete
|
||||
undo_redo->create_action("Remove Autoload");
|
||||
undo_redo->add_do_property(Globals::get_singleton(),name,Variant());
|
||||
undo_redo->add_undo_property(Globals::get_singleton(),name,Globals::get_singleton()->get(name));
|
||||
undo_redo->add_undo_method(Globals::get_singleton(),"set_persisting",name,true);
|
||||
undo_redo->add_do_method(this,"_update_autoload");
|
||||
undo_redo->add_undo_method(this,"_update_autoload");
|
||||
undo_redo->add_do_method(this,"_settings_changed");
|
||||
undo_redo->add_undo_method(this,"_settings_changed");
|
||||
undo_redo->commit_action();
|
||||
} else {
|
||||
|
||||
TreeItem *swap;
|
||||
|
||||
if (p_button==1) {
|
||||
swap=ti->get_prev();
|
||||
} else if (p_button==2) {
|
||||
swap=ti->get_next();
|
||||
}
|
||||
if (!swap)
|
||||
return;
|
||||
|
||||
String swap_name= "autoload/"+swap->get_text(0);
|
||||
|
||||
undo_redo->create_action("Move Autoload");
|
||||
undo_redo->add_do_method(Globals::get_singleton(),"set_order",swap_name,Globals::get_singleton()->get_order(name));
|
||||
undo_redo->add_do_method(Globals::get_singleton(),"set_order",name,Globals::get_singleton()->get_order(swap_name));
|
||||
undo_redo->add_undo_method(Globals::get_singleton(),"set_order",swap_name,Globals::get_singleton()->get_order(swap_name));
|
||||
undo_redo->add_undo_method(Globals::get_singleton(),"set_order",name,Globals::get_singleton()->get_order(name));
|
||||
undo_redo->add_do_method(this,"_update_autoload");
|
||||
undo_redo->add_undo_method(this,"_update_autoload");
|
||||
undo_redo->add_do_method(this,"_settings_changed");
|
||||
undo_redo->add_undo_method(this,"_settings_changed");
|
||||
undo_redo->commit_action();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -1134,6 +1163,8 @@ void ProjectSettings::_update_autoload() {
|
|||
TreeItem *t = autoload_list->create_item(root);
|
||||
t->set_text(0,name);
|
||||
t->set_text(1,Globals::get_singleton()->get(pi.name));
|
||||
t->add_button(1,get_icon("MoveUp","EditorIcons"),1);
|
||||
t->add_button(1,get_icon("MoveDown","EditorIcons"),2);
|
||||
t->add_button(1,get_icon("Del","EditorIcons"),0);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue