summaryrefslogtreecommitdiff
path: root/scene/main
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2016-03-09 00:14:08 +0100
committerRémi Verschelde <remi@verschelde.fr>2016-03-09 00:14:08 +0100
commite46e43d2aaa6339a1675eb989f41885e745bf5c3 (patch)
treecf91f2869ff8f058c6682569fb31e22e5ee736ad /scene/main
parent1dad6eca812e5c2e313b54265114de8a1d73d999 (diff)
parent4a4f2479146aa33e235ed57cde311efda68d3c8f (diff)
Merge pull request #3928 from Marqin/whitespace
remove trailing whitespace - sorry for the broken PRs, please rebase :)
Diffstat (limited to 'scene/main')
-rw-r--r--scene/main/misc.h2
-rw-r--r--scene/main/node.cpp326
-rw-r--r--scene/main/node.h74
-rw-r--r--scene/main/scene_main_loop.cpp4
-rw-r--r--scene/main/scene_main_loop.h2
-rw-r--r--scene/main/timer.cpp4
-rw-r--r--scene/main/viewport.cpp24
-rw-r--r--scene/main/viewport.h6
8 files changed, 221 insertions, 221 deletions
diff --git a/scene/main/misc.h b/scene/main/misc.h
index 1c5bc7208e..d5db8c3247 100644
--- a/scene/main/misc.h
+++ b/scene/main/misc.h
@@ -37,7 +37,7 @@ class Misc : public Node {
OBJ_TYPE( Misc, Node );
public:
- Misc();
+ Misc();
~Misc();
};
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 450578a241..b90edb38b2 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -41,7 +41,7 @@ VARIANT_ENUM_CAST(Node::PauseMode);
void Node::_notification(int p_notification) {
-
+
switch(p_notification) {
case NOTIFICATION_PROCESS: {
@@ -114,21 +114,21 @@ void Node::_notification(int p_notification) {
case NOTIFICATION_PREDELETE: {
set_owner(NULL);
-
+
while ( data.owned.size() ) {
-
- data.owned.front()->get()->set_owner(NULL);
+
+ data.owned.front()->get()->set_owner(NULL);
}
if (data.parent) {
-
+
data.parent->remove_child(this);
}
// kill children as cleanly as possible
while( data.children.size() ) {
-
- Node *child = data.children[0];
+
+ Node *child = data.children[0];
remove_child(child);
memdelete( child );
}
@@ -161,7 +161,7 @@ void Node::_propagate_enter_tree() {
data.depth=1;
}
-
+
data.viewport = cast_to<Viewport>();
if (!data.viewport)
data.viewport = data.parent->data.viewport;
@@ -191,10 +191,10 @@ void Node::_propagate_enter_tree() {
//block while adding children
for (int i=0;i<data.children.size();i++) {
-
+
if (!data.children[i]->is_inside_tree()) // could have been added in enter_tree
data.children[i]->_propagate_enter_tree();
- }
+ }
data.blocked--;
@@ -279,15 +279,15 @@ void Node::_propagate_exit_tree() {
-void Node::move_child(Node *p_child,int p_pos) {
-
+void Node::move_child(Node *p_child,int p_pos) {
+
ERR_FAIL_NULL(p_child);
ERR_EXPLAIN("Invalid new child position: "+itos(p_pos));
ERR_FAIL_INDEX( p_pos, data.children.size()+1 );
ERR_EXPLAIN("child is not a child of this node.");
ERR_FAIL_COND(p_child->data.parent!=this);
ERR_FAIL_COND(data.blocked>0);
-
+
data.children.remove( p_child->data.pos );
data.children.insert( p_pos, p_child );
@@ -298,7 +298,7 @@ void Node::move_child(Node *p_child,int p_pos) {
data.blocked++;
//new pos first
for (int i=0;i<data.children.size();i++) {
-
+
data.children[i]->data.pos=i;
}
// notification second
@@ -313,17 +313,17 @@ void Node::move_child(Node *p_child,int p_pos) {
}
void Node::raise() {
-
+
if (!data.parent)
return;
-
+
data.parent->move_child(this,data.parent->data.children.size()-1);
}
void Node::add_child_notify(Node *p_child) {
-
- // to be used when not wanted
+
+ // to be used when not wanted
}
/*
@@ -340,26 +340,26 @@ void Node::remove_and_delete_child(Node *p_child) {
void Node::remove_child_notify(Node *p_child) {
- // to be used when not wanted
+ // to be used when not wanted
}
void Node::move_child_notify(Node *p_child) {
- // to be used when not wanted
+ // to be used when not wanted
}
void Node::set_fixed_process(bool p_process) {
-
+
if (data.fixed_process==p_process)
return;
data.fixed_process=p_process;
-
+
if (data.fixed_process)
add_to_group("fixed_process",false);
else
remove_from_group("fixed_process");
-
+
data.fixed_process=p_process;
_change_notify("fixed_process");
}
@@ -437,7 +437,7 @@ bool Node::can_process() const {
float Node::get_fixed_process_delta_time() const {
-
+
if (data.tree)
return data.tree->get_fixed_process_time();
else
@@ -469,7 +469,7 @@ float Node::get_process_delta_time() const {
}
bool Node::is_fixed_processing() const {
-
+
return data.fixed_process;
}
@@ -541,7 +541,7 @@ bool Node::is_processing_unhandled_key_input() const {
StringName Node::get_name() const {
-
+
return data.name;
}
@@ -552,14 +552,14 @@ void Node::_set_name_nocheck(const StringName& p_name) {
}
void Node::set_name(const String& p_name) {
-
+
String name=p_name.replace(":","").replace("/","").replace("@","");
ERR_FAIL_COND(name=="");
data.name=name;
-
+
if (data.parent) {
-
+
data.parent->_validate_child_name(this);
}
@@ -741,12 +741,12 @@ void Node::add_child(Node *p_child, bool p_legible_unique_name) {
ERR_FAIL_COND( p_child->data.parent );
ERR_EXPLAIN("Can't add child while a notification is happening");
ERR_FAIL_COND( data.blocked > 0 );
-
+
/* Validate name */
_validate_child_name(p_child,p_legible_unique_name);
_add_child_nocheck(p_child,p_child->data.name);
-
+
}
@@ -791,36 +791,36 @@ void Node::remove_child(Node *p_child) {
ERR_FAIL_NULL(p_child);
ERR_FAIL_COND( data.blocked > 0 );
-
+
int idx=-1;
for (int i=0;i<data.children.size();i++) {
-
+
if (data.children[i]==p_child) {
-
+
idx=i;
break;
}
}
-
+
ERR_FAIL_COND( idx==-1 );
//ERR_FAIL_COND( p_child->data.blocked > 0 );
-
+
//if (data.scene) { does not matter
-
+
p_child->_set_tree(NULL);
//}
-
- remove_child_notify(p_child);
+
+ remove_child_notify(p_child);
p_child->notification(NOTIFICATION_UNPARENTED);
-
+
data.children.remove(idx);
-
+
for (int i=idx;i<data.children.size();i++) {
-
+
data.children[i]->data.pos=i;
}
-
+
p_child->data.parent=NULL;
p_child->data.pos=-1;
@@ -828,17 +828,17 @@ void Node::remove_child(Node *p_child) {
// validate owner
p_child->_propagate_validate_owner();
-
+
}
int Node::get_child_count() const {
-
- return data.children.size();
+
+ return data.children.size();
}
Node *Node::get_child(int p_index) const {
-
+
ERR_FAIL_INDEX_V( p_index, data.children.size(), NULL );
-
+
return data.children[p_index];
}
@@ -862,10 +862,10 @@ Node *Node::_get_node(const NodePath& p_path) const {
ERR_EXPLAIN("Can't use get_node() with absolute paths from outside the active scene tree.");
ERR_FAIL_V(NULL);
}
-
- Node *current=NULL;
+
+ Node *current=NULL;
Node *root=NULL;
-
+
if (!p_path.is_absolute()) {
current=const_cast<Node*>(this); //start from this
} else {
@@ -874,42 +874,42 @@ Node *Node::_get_node(const NodePath& p_path) const {
while (root->data.parent)
root=root->data.parent; //start from root
}
-
+
for(int i=0;i<p_path.get_name_count();i++) {
-
-
- StringName name = p_path.get_name(i);
+
+
+ StringName name = p_path.get_name(i);
Node *next = NULL;
-
+
if (name==SceneStringNames::get_singleton()->dot) { // .
-
+
next=current;
-
+
} else if (name==SceneStringNames::get_singleton()->doubledot) { // ..
-
+
if (current==NULL || !current->data.parent)
return NULL;
-
+
next=current->data.parent;
} else if (current==NULL) {
-
+
if (name==root->get_name())
next=root;
-
+
} else {
-
+
next=NULL;
-
+
for(int j=0;j<current->data.children.size();j++) {
-
+
Node *child = current->data.children[j];
if ( child->data.name == name ) {
-
+
next = child;
break;
- }
+ }
}
if (next == NULL) {
return NULL;
@@ -917,7 +917,7 @@ Node *Node::_get_node(const NodePath& p_path) const {
}
current=next;
}
-
+
return current;
}
@@ -969,12 +969,12 @@ bool Node::is_a_parent_of(const Node *p_node) const {
ERR_FAIL_NULL_V(p_node,false);
Node *p=p_node->data.parent;
while(p) {
-
+
if (p==this)
return true;
p=p->data.parent;
}
-
+
return false;
}
@@ -983,25 +983,25 @@ bool Node::is_greater_than(const Node *p_node) const {
ERR_FAIL_NULL_V(p_node,false);
ERR_FAIL_COND_V( !data.inside_tree, false );
ERR_FAIL_COND_V( !p_node->data.inside_tree, false );
-
+
ERR_FAIL_COND_V( data.depth<0, false);
ERR_FAIL_COND_V( p_node->data.depth<0, false);
#ifdef NO_ALLOCA
-
+
Vector<int> this_stack;
Vector<int> that_stack;
this_stack.resize(data.depth);
that_stack.resize(p_node->data.depth);
#else
-
+
int *this_stack=(int*)alloca(sizeof(int)*data.depth);
int *that_stack=(int*)alloca(sizeof(int)*p_node->data.depth);
-
+
#endif
-
+
const Node *n = this;
-
+
int idx=data.depth-1;
while(n) {
ERR_FAIL_INDEX_V(idx, data.depth,false);
@@ -1014,15 +1014,15 @@ bool Node::is_greater_than(const Node *p_node) const {
while(n) {
ERR_FAIL_INDEX_V(idx, p_node->data.depth,false);
that_stack[idx--]=n->data.pos;
-
+
n=n->data.parent;
}
ERR_FAIL_COND_V(idx!=-1,false);
idx=0;
-
+
bool res;
while(true) {
-
+
// using -2 since out-of-tree or nonroot nodes have -1
int this_idx = (idx >= data.depth)? -2 : this_stack[idx];
int that_idx = (idx >= p_node->data.depth)? -2 : that_stack[idx];
@@ -1039,7 +1039,7 @@ bool Node::is_greater_than(const Node *p_node) const {
}
idx++;
}
-
+
return res;
}
@@ -1063,39 +1063,39 @@ void Node::_set_owner_nocheck(Node* p_owner) {
}
void Node::set_owner(Node *p_owner) {
-
+
if (data.owner) {
-
+
data.owner->data.owned.erase( data.OW );
data.OW=NULL;
data.owner=NULL;
}
-
+
ERR_FAIL_COND(p_owner==this);
-
+
if (!p_owner)
return;
-
+
Node *check=this->get_parent();
bool owner_valid=false;
-
+
while(check) {
-
+
if (check==p_owner) {
owner_valid=true;
break;
}
-
+
check=check->data.parent;
}
-
+
ERR_FAIL_COND(!owner_valid);
_set_owner_nocheck(p_owner);
}
Node *Node::get_owner() const {
-
- return data.owner;
+
+ return data.owner;
}
NodePath Node::get_path_to(const Node *p_node) const {
@@ -1104,68 +1104,68 @@ NodePath Node::get_path_to(const Node *p_node) const {
if (this==p_node)
return NodePath(".");
-
+
Set<const Node*> visited;
-
+
const Node *n=this;
-
+
while(n) {
-
+
visited.insert(n);
n=n->data.parent;
}
const Node *common_parent=p_node;
-
+
while(common_parent) {
-
+
if (visited.has(common_parent))
break;
common_parent=common_parent->data.parent;
}
-
+
ERR_FAIL_COND_V(!common_parent,NodePath()); //nodes not in the same tree
-
+
visited.clear();
-
+
Vector<StringName> path;
-
+
n=p_node;
-
+
while(n!=common_parent) {
-
+
path.push_back( n->get_name() );
n=n->data.parent;
}
-
+
n=this;
- StringName up=String("..");
-
+ StringName up=String("..");
+
while(n!=common_parent) {
-
+
path.push_back( up );
n=n->data.parent;
}
-
+
path.invert();
-
- return NodePath(path,false);
+
+ return NodePath(path,false);
}
NodePath Node::get_path() const {
-
+
ERR_FAIL_COND_V(!is_inside_tree(),NodePath());
const Node *n = this;
-
+
Vector<StringName> path;
-
+
while(n) {
path.push_back(n->get_name());
n=n->data.parent;
- }
-
+ }
+
path.invert();
-
+
return NodePath( path, true );
}
@@ -1175,36 +1175,36 @@ bool Node::is_in_group(const StringName& p_identifier) const {
}
void Node::add_to_group(const StringName& p_identifier,bool p_persistent) {
-
+
ERR_FAIL_COND(!p_identifier.operator String().length());
-
+
if (data.grouped.has(p_identifier))
return;
-
+
GroupData gd;
-
+
if (data.tree)
data.tree->add_to_group(p_identifier,this);
- gd.persistent=p_persistent;
-
+ gd.persistent=p_persistent;
+
data.grouped[p_identifier]=gd;
}
void Node::remove_from_group(const StringName& p_identifier) {
-
+
ERR_FAIL_COND(!data.grouped.has(p_identifier) );
-
+
GroupData *g=data.grouped.getptr(p_identifier);
-
+
ERR_FAIL_COND(!g);
-
+
if (data.tree)
data.tree->remove_from_group(p_identifier,this);
- data.grouped.erase(p_identifier);
+ data.grouped.erase(p_identifier);
}
@@ -1223,15 +1223,15 @@ Array Node::_get_groups() const {
void Node::get_groups(List<GroupInfo> *p_groups) const {
const StringName *K=NULL;
-
+
while ((K=data.grouped.next(K))) {
-
+
GroupInfo gi;
gi.name=*K;
gi.persistent=data.grouped[*K].persistent;
p_groups->push_back(gi);
}
-
+
}
@@ -1249,13 +1249,13 @@ void Node::print_tree() {
void Node::_propagate_reverse_notification(int p_notification) {
-
- data.blocked++;
+
+ data.blocked++;
for (int i=data.children.size()-1;i>=0;i--) {
-
- data.children[i]->_propagate_reverse_notification(p_notification);
+
+ data.children[i]->_propagate_reverse_notification(p_notification);
}
-
+
notification(p_notification,true);
data.blocked--;
}
@@ -1281,75 +1281,75 @@ void Node::_propagate_deferred_notification(int p_notification, bool p_reverse)
}
void Node::propagate_notification(int p_notification) {
-
- data.blocked++;
+
+ data.blocked++;
notification(p_notification);
-
+
for (int i=0;i<data.children.size();i++) {
-
- data.children[i]->propagate_notification(p_notification);
+
+ data.children[i]->propagate_notification(p_notification);
}
- data.blocked--;
+ data.blocked--;
}
-void Node::_propagate_replace_owner(Node *p_owner,Node* p_by_owner) {
+void Node::_propagate_replace_owner(Node *p_owner,Node* p_by_owner) {
if (get_owner()==p_owner)
set_owner(p_by_owner);
-
+
data.blocked++;
- for (int i=0;i<data.children.size();i++)
+ for (int i=0;i<data.children.size();i++)
data.children[i]->_propagate_replace_owner(p_owner,p_by_owner);
- data.blocked--;
+ data.blocked--;
}
int Node::get_index() const {
-
+
return data.pos;
}
void Node::remove_and_skip() {
-
+
ERR_FAIL_COND(!data.parent);
-
+
Node *new_owner=get_owner();
-
+
List<Node*> children;
-
+
while(true) {
-
+
bool clear=true;
for (int i=0;i<data.children.size();i++) {
if (!data.children[i]->get_owner())
continue;
-
+
remove_child(data.children[i]);
data.children[i]->_propagate_replace_owner(this,NULL);
- children.push_back(data.children[i]);
+ children.push_back(data.children[i]);
clear=false;
break;
}
-
+
if (clear)
break;
}
-
+
while(!children.empty()) {
-
+
Node *c=children.front()->get();
data.parent->add_child(c);
- c->_propagate_replace_owner(NULL,new_owner);
+ c->_propagate_replace_owner(NULL,new_owner);
children.pop_front();
}
-
+
data.parent->remove_child(this);
}
void Node::set_filename(const String& p_filename) {
-
+
data.filename=p_filename;
}
String Node::get_filename() const {
-
+
return data.filename;
}
@@ -2117,7 +2117,7 @@ void Node::_bind_methods() {
Node::Node() {
-
+
data.pos=-1;
data.depth=-1;
data.blocked=0;
@@ -2141,12 +2141,12 @@ Node::Node() {
}
Node::~Node() {
-
+
data.grouped.clear();
data.owned.clear();
data.children.clear();
-
+
ERR_FAIL_COND(data.parent);
ERR_FAIL_COND(data.children.size());
diff --git a/scene/main/node.h b/scene/main/node.h
index 4d05dd381c..5c6147d644 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -43,7 +43,7 @@ class Node : public Object {
OBJ_TYPE( Node, Object );
OBJ_CATEGORY("Nodes");
-
+
public:
enum PauseMode {
@@ -59,16 +59,16 @@ public:
bool operator()(const Node* p_a, const Node* p_b) const { return p_b->is_greater_than(p_a); }
};
-private:
-
+private:
+
struct GroupData {
-
- bool persistent;
+
+ bool persistent;
GroupData() { persistent=false; }
};
-
+
struct Data {
-
+
String filename;
Ref<SceneState> instance_state;
Ref<SceneState> inherited_state;
@@ -90,11 +90,11 @@ private:
Viewport *viewport;
-
+
HashMap< StringName, GroupData,StringNameHasher> grouped;
List<Node*>::Element *OW; // owned element
List<Node*> owned;
-
+
PauseMode pause_mode;
Node *pause_owner;
// variables used to properly sort the node when processing, ignored otherwise
@@ -112,10 +112,10 @@ private:
} data;
-
- void _print_tree(const Node *p_node);
-
+
+ void _print_tree(const Node *p_node);
+
virtual bool _use_builtin_script() const { return true; }
Node *_get_node(const NodePath& p_path) const;
Node *_get_child_by_name(const StringName& p_name) const;
@@ -124,7 +124,7 @@ private:
void _validate_child_name(Node *p_name, bool p_force_human_readable=false);
- void _propagate_reverse_notification(int p_notification);
+ void _propagate_reverse_notification(int p_notification);
void _propagate_deferred_notification(int p_notification, bool p_reverse);
void _propagate_enter_tree();
void _propagate_ready();
@@ -147,15 +147,15 @@ protected:
void _block() { data.blocked++; }
void _unblock() { data.blocked--; }
- void _notification(int p_notification);
-
+ void _notification(int p_notification);
+
virtual void add_child_notify(Node *p_child);
virtual void remove_child_notify(Node *p_child);
virtual void move_child_notify(Node *p_child);
//void remove_and_delete_child(Node *p_child);
-
- void _propagate_replace_owner(Node *p_owner,Node* p_by_owner);
-
+
+ void _propagate_replace_owner(Node *p_owner,Node* p_by_owner);
+
static void _bind_methods();
friend class SceneState;
@@ -181,15 +181,15 @@ public:
NOTIFICATION_UNPARENTED=19,
NOTIFICATION_INSTANCED=20,
};
-
- /* NODE/TREE */
-
+
+ /* NODE/TREE */
+
StringName get_name() const;
void set_name(const String& p_name);
-
+
void add_child(Node *p_child,bool p_legible_unique_name=false);
void remove_child(Node *p_child);
-
+
int get_child_count() const;
Node *get_child(int p_index) const;
bool has_node(const NodePath& p_path) const;
@@ -197,43 +197,43 @@ public:
Node* find_node(const String& p_mask,bool p_recursive=true,bool p_owned=true) const;
bool has_node_and_resource(const NodePath& p_path) const;
Node *get_node_and_resource(const NodePath& p_path,RES& r_res) const;
-
+
Node *get_parent() const;
_FORCE_INLINE_ SceneTree *get_tree() const { ERR_FAIL_COND_V( !data.tree, NULL ); return data.tree; }
_FORCE_INLINE_ bool is_inside_tree() const { return data.inside_tree; }
-
+
bool is_a_parent_of(const Node *p_node) const;
bool is_greater_than(const Node *p_node) const;
-
+
NodePath get_path() const;
NodePath get_path_to(const Node *p_node) const;
-
+
void add_to_group(const StringName& p_identifier,bool p_persistent=false);
void remove_from_group(const StringName& p_identifier);
bool is_in_group(const StringName& p_identifier) const;
-
+
struct GroupInfo {
-
+
StringName name;
bool persistent;
};
-
+
void get_groups(List<GroupInfo> *p_groups) const;
-
+
void move_child(Node *p_child,int p_pos);
void raise();
-
+
void set_owner(Node *p_owner);
Node *get_owner() const;
void get_owned_by(Node *p_by,List<Node*> *p_owned);
-
+
void remove_and_skip();
int get_index() const;
-
+
void print_tree();
-
+
void set_filename(const String& p_filename);
String get_filename() const;
@@ -242,9 +242,9 @@ public:
/* NOTIFICATIONS */
-
+
void propagate_notification(int p_notification);
-
+
/* PROCESSING */
void set_fixed_process(bool p_process);
float get_fixed_process_delta_time() const;
diff --git a/scene/main/scene_main_loop.cpp b/scene/main/scene_main_loop.cpp
index 8e2d6aa669..cc103b5115 100644
--- a/scene/main/scene_main_loop.cpp
+++ b/scene/main/scene_main_loop.cpp
@@ -211,7 +211,7 @@ void SceneTree::call_group(uint32_t p_call_flags,const StringName& p_group,const
else
nodes[i]->call(p_function,VARIANT_ARG_PASS);
} else
- MessageQueue::get_singleton()->push_call(nodes[i],p_function,VARIANT_ARG_PASS);
+ MessageQueue::get_singleton()->push_call(nodes[i],p_function,VARIANT_ARG_PASS);
}
}
@@ -433,7 +433,7 @@ void SceneTree::input_event( const InputEvent& p_event ) {
ScriptDebugger::get_singleton()->request_quit();
}
- _flush_ugc();
+ _flush_ugc();
root_lock--;
MessageQueue::get_singleton()->flush(); //small little hack
diff --git a/scene/main/scene_main_loop.h b/scene/main/scene_main_loop.h
index c6fc124345..b6a015c9ed 100644
--- a/scene/main/scene_main_loop.h
+++ b/scene/main/scene_main_loop.h
@@ -76,7 +76,7 @@ private:
struct Group {
Vector<Node*> nodes;
- uint64_t last_tree_version;
+ uint64_t last_tree_version;
Group() { last_tree_version=0; };
};
diff --git a/scene/main/timer.cpp b/scene/main/timer.cpp
index a118bc9782..73458e03c0 100644
--- a/scene/main/timer.cpp
+++ b/scene/main/timer.cpp
@@ -111,7 +111,7 @@ bool Timer::has_autostart() const {
}
void Timer::start() {
- time_left=wait_time;
+ time_left=wait_time;
_set_process(true);
}
@@ -154,7 +154,7 @@ Timer::TimerProcessMode Timer::get_timer_process_mode() const{
}
-void Timer::_set_process(bool p_process, bool p_force)
+void Timer::_set_process(bool p_process, bool p_force)
{
switch (timer_process_mode) {
case TIMER_PROCESS_FIXED: set_fixed_process(p_process); break;
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 550bae6306..2c94d2e093 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -318,10 +318,10 @@ void Viewport::_test_new_mouseover(ObjectID new_collider) {
}
void Viewport::_notification(int p_what) {
-
+
switch( p_what ) {
-
+
case NOTIFICATION_ENTER_TREE: {
if (get_parent()) {
@@ -696,8 +696,8 @@ void Viewport::_notification(int p_what) {
}
RID Viewport::get_viewport() const {
-
- return viewport;
+
+ return viewport;
}
void Viewport::set_rect(const Rect2& p_rect) {
@@ -715,12 +715,12 @@ Rect2 Viewport::get_visible_rect() const {
Rect2 r;
-
+
if (rect.pos==Vector2() && rect.size==Size2()) {
-
+
r=Rect2( Point2(), Size2( OS::get_singleton()->get_video_mode().width, OS::get_singleton()->get_video_mode().height ) );
} else {
-
+
r=Rect2( rect.pos , rect.size );
}
@@ -733,7 +733,7 @@ Rect2 Viewport::get_visible_rect() const {
}
Rect2 Viewport::get_rect() const {
-
+
return rect;
}
@@ -1335,7 +1335,7 @@ void Viewport::_vp_input(const InputEvent& p_ev) {
//they are converted to viewport coordinates
- InputEvent ev = p_ev;
+ InputEvent ev = p_ev;
_make_input_local(ev);
input(ev);
@@ -2240,7 +2240,7 @@ void Viewport::input(const InputEvent& p_event) {
ERR_FAIL_COND(!is_inside_tree());
- get_tree()->_call_input_pause(input_group,"_input",p_event);
+ get_tree()->_call_input_pause(input_group,"_input",p_event);
_gui_input_event(p_event);
//get_tree()->call_group(SceneTree::GROUP_CALL_REVERSE|SceneTree::GROUP_CALL_REALTIME|SceneTree::GROUP_CALL_MULIILEVEL,gui_input_group,"_gui_input",p_event); //special one for GUI, as controls use their own process check
}
@@ -2409,10 +2409,10 @@ void Viewport::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_render_target_vflip","enable"), &Viewport::set_render_target_vflip);
ObjectTypeDB::bind_method(_MD("get_render_target_vflip"), &Viewport::get_render_target_vflip);
-
+
ObjectTypeDB::bind_method(_MD("set_render_target_clear_on_new_frame","enable"), &Viewport::set_render_target_clear_on_new_frame);
ObjectTypeDB::bind_method(_MD("get_render_target_clear_on_new_frame"), &Viewport::get_render_target_clear_on_new_frame);
-
+
ObjectTypeDB::bind_method(_MD("render_target_clear"), &Viewport::render_target_clear);
ObjectTypeDB::bind_method(_MD("set_render_target_filter","enable"), &Viewport::set_render_target_filter);
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index 5bf7418ee9..afabd499a9 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -270,7 +270,7 @@ friend class Camera;
void _camera_make_next_current(Camera* p_exclude);
-protected:
+protected:
void _notification(int p_what);
static void _bind_methods();
public:
@@ -284,7 +284,7 @@ public:
void set_as_audio_listener_2d(bool p_enable);
bool is_audio_listener_2d() const;
- void set_rect(const Rect2& p_rect);
+ void set_rect(const Rect2& p_rect);
Rect2 get_rect() const;
Rect2 get_visible_rect() const;
RID get_viewport() const;
@@ -362,7 +362,7 @@ public:
bool gui_has_modal_stack() const;
- Viewport();
+ Viewport();
~Viewport();
};