-added a check for setget while running the game , closes #1009
-fixed issues in tilemap editor (swap arrows not showing/hiding properly)
This commit is contained in:
parent
fa7a3ac0d3
commit
60afd79a6e
3 changed files with 58 additions and 4 deletions
|
@ -45,8 +45,13 @@ void GDCompiler::_set_error(const String& p_error,const GDParser::Node *p_node)
|
|||
return;
|
||||
|
||||
error=p_error;
|
||||
err_line=p_node->line;
|
||||
err_column=p_node->column;
|
||||
if (p_node) {
|
||||
err_line=p_node->line;
|
||||
err_column=p_node->column;
|
||||
} else {
|
||||
err_line=0;
|
||||
err_column=0;
|
||||
}
|
||||
}
|
||||
|
||||
bool GDCompiler::_create_unary_operator(CodeGen& codegen,const GDParser::OperatorNode *on,Variant::Operator op, int p_stack_level) {
|
||||
|
@ -1522,7 +1527,7 @@ Error GDCompiler::_parse_class(GDScript *p_script,GDScript *p_owner,const GDPars
|
|||
GDScript::MemberInfo minfo;
|
||||
minfo.index = p_script->member_indices.size();
|
||||
minfo.setter = p_class->variables[i].setter;
|
||||
minfo.getter = p_class->variables[i].getter;
|
||||
minfo.getter = p_class->variables[i].getter;
|
||||
p_script->member_indices[name]=minfo;
|
||||
p_script->members.insert(name);
|
||||
|
||||
|
@ -1586,6 +1591,48 @@ Error GDCompiler::_parse_class(GDScript *p_script,GDScript *p_owner,const GDPars
|
|||
return err;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
//validate setters/getters if debug is enabled
|
||||
for(int i=0;i<p_class->variables.size();i++) {
|
||||
|
||||
if (p_class->variables[i].setter) {
|
||||
const Map<StringName,GDFunction>::Element *E=p_script->get_member_functions().find(p_class->variables[i].setter);
|
||||
if (!E) {
|
||||
_set_error("Setter function '"+String(p_class->variables[i].setter)+"' not found in class.",NULL);
|
||||
err_line=p_class->variables[i].line;
|
||||
err_column=0;
|
||||
return ERR_PARSE_ERROR;
|
||||
}
|
||||
|
||||
if (E->get().is_static()) {
|
||||
|
||||
_set_error("Setter function '"+String(p_class->variables[i].setter)+"' is static.",NULL);
|
||||
err_line=p_class->variables[i].line;
|
||||
err_column=0;
|
||||
return ERR_PARSE_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
if (p_class->variables[i].getter) {
|
||||
const Map<StringName,GDFunction>::Element *E=p_script->get_member_functions().find(p_class->variables[i].getter);
|
||||
if (!E) {
|
||||
_set_error("Getter function '"+String(p_class->variables[i].getter)+"' not found in class.",NULL);
|
||||
err_line=p_class->variables[i].line;
|
||||
err_column=0;
|
||||
return ERR_PARSE_ERROR;
|
||||
}
|
||||
|
||||
if (E->get().is_static()) {
|
||||
|
||||
_set_error("Getter function '"+String(p_class->variables[i].getter)+"' is static.",NULL);
|
||||
err_line=p_class->variables[i].line;
|
||||
err_column=0;
|
||||
return ERR_PARSE_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -728,7 +728,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
|
|||
add_child(palette);
|
||||
|
||||
// Add menu items
|
||||
HBoxContainer *canvas_item_editor_hb = memnew( HBoxContainer );
|
||||
canvas_item_editor_hb = memnew( HBoxContainer );
|
||||
CanvasItemEditor::get_singleton()->add_control_to_menu_panel(canvas_item_editor_hb);
|
||||
canvas_item_editor_hb->add_child( memnew( VSeparator ));
|
||||
mirror_x = memnew( ToolButton );
|
||||
|
@ -741,6 +741,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
|
|||
mirror_y->set_tooltip("Mirror Y (S)");
|
||||
mirror_y->set_focus_mode(FOCUS_NONE);
|
||||
canvas_item_editor_hb->add_child(mirror_y);
|
||||
canvas_item_editor_hb->hide();
|
||||
|
||||
tool=TOOL_NONE;
|
||||
selection_active=false;
|
||||
|
@ -762,10 +763,12 @@ void TileMapEditorPlugin::make_visible(bool p_visible) {
|
|||
|
||||
if (p_visible) {
|
||||
tile_map_editor->show();
|
||||
tile_map_editor->get_canvas_item_editor_hb()->show();
|
||||
|
||||
} else {
|
||||
|
||||
tile_map_editor->hide();
|
||||
tile_map_editor->get_canvas_item_editor_hb()->hide();
|
||||
tile_map_editor->edit(NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -73,6 +73,8 @@ class TileMapEditor : public VBoxContainer {
|
|||
ToolButton *mirror_x;
|
||||
ToolButton *mirror_y;
|
||||
|
||||
HBoxContainer *canvas_item_editor_hb;
|
||||
|
||||
|
||||
struct CellOp {
|
||||
int idx;
|
||||
|
@ -102,6 +104,7 @@ protected:
|
|||
static void _bind_methods();
|
||||
public:
|
||||
|
||||
HBoxContainer *get_canvas_item_editor_hb() const { return canvas_item_editor_hb; }
|
||||
Vector2 snap_point(const Vector2& p_point) const;
|
||||
bool forward_input_event(const InputEvent& p_event);
|
||||
void edit(Node *p_tile_map);
|
||||
|
@ -115,6 +118,7 @@ class TileMapEditorPlugin : public EditorPlugin {
|
|||
TileMapEditor *tile_map_editor;
|
||||
EditorNode *editor;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
virtual bool forward_input_event(const InputEvent& p_event) { return tile_map_editor->forward_input_event(p_event); }
|
||||
|
|
Loading…
Reference in a new issue