diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gdscript/gd_parser.cpp | 23 | ||||
-rw-r--r-- | modules/gridmap/grid_map.cpp | 2 | ||||
-rw-r--r-- | modules/gridmap/grid_map_editor_plugin.cpp | 14 |
3 files changed, 30 insertions, 9 deletions
diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp index dc6b0ff962..de2b5219a9 100644 --- a/modules/gdscript/gd_parser.cpp +++ b/modules/gdscript/gd_parser.cpp @@ -1158,7 +1158,7 @@ GDParser::Node* GDParser::_reduce_expression(Node *p_node,bool p_to_const) { cn->value=v; return cn; - } else if (op->arguments[0]->type==Node::TYPE_CONSTANT && op->arguments[1]->type==Node::TYPE_IDENTIFIER) { + } /*else if (op->arguments[0]->type==Node::TYPE_CONSTANT && op->arguments[1]->type==Node::TYPE_IDENTIFIER) { ConstantNode *ca = static_cast<ConstantNode*>(op->arguments[0]); IdentifierNode *ib = static_cast<IdentifierNode*>(op->arguments[1]); @@ -1173,10 +1173,31 @@ GDParser::Node* GDParser::_reduce_expression(Node *p_node,bool p_to_const) { ConstantNode *cn = alloc_node<ConstantNode>(); cn->value=v; return cn; + }*/ + return op; + + } else if (op->op==OperatorNode::OP_INDEX_NAMED) { + + if (op->arguments[0]->type==Node::TYPE_CONSTANT && op->arguments[1]->type==Node::TYPE_IDENTIFIER) { + + ConstantNode *ca = static_cast<ConstantNode*>(op->arguments[0]); + IdentifierNode *ib = static_cast<IdentifierNode*>(op->arguments[1]); + + bool valid; + Variant v = ca->value.get_named(ib->name,&valid); + if (!valid) { + _set_error("invalid index '"+String(ib->name)+"' in constant expression"); + return op; + } + + ConstantNode *cn = alloc_node<ConstantNode>(); + cn->value=v; + return cn; } return op; + } //validate assignment (don't assign to cosntant expression diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index 7c10c474c3..7c344e1e90 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -677,7 +677,7 @@ void GridMap::_octant_clear_baked(const OctantKey &p_key) { g.bake_instance=RID(); g.baked=Ref<Mesh>(); - if (is_inside_scene()) + if (is_inside_tree()) _octant_enter_world(p_key); g.dirty=true; _queue_dirty_map(); diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp index 09e279305c..140718a91a 100644 --- a/modules/gridmap/grid_map_editor_plugin.cpp +++ b/modules/gridmap/grid_map_editor_plugin.cpp @@ -974,7 +974,7 @@ void GridMapEditor::update_grid() { void GridMapEditor::_notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { theme_pallete->connect("cell_selected", this,"_item_selected_cbk"); edit_mode->connect("item_selected", this,"_edit_mode_changed"); @@ -983,16 +983,16 @@ void GridMapEditor::_notification(int p_what) { for(int i=0;i<3;i++) { grid[i]=VS::get_singleton()->mesh_create(); - grid_instance[i]=VS::get_singleton()->instance_create2(grid[i],get_scene()->get_root()->get_world()->get_scenario()); + grid_instance[i]=VS::get_singleton()->instance_create2(grid[i],get_tree()->get_root()->get_world()->get_scenario()); } - selection_instance = VisualServer::get_singleton()->instance_create2(selection_mesh,get_scene()->get_root()->get_world()->get_scenario()); - duplicate_instance = VisualServer::get_singleton()->instance_create2(duplicate_mesh,get_scene()->get_root()->get_world()->get_scenario()); + selection_instance = VisualServer::get_singleton()->instance_create2(selection_mesh,get_tree()->get_root()->get_world()->get_scenario()); + duplicate_instance = VisualServer::get_singleton()->instance_create2(duplicate_mesh,get_tree()->get_root()->get_world()->get_scenario()); _update_selection_transform(); _update_duplicate_indicator(); - } else if (p_what==NOTIFICATION_EXIT_SCENE) { + } else if (p_what==NOTIFICATION_EXIT_TREE) { for(int i=0;i<3;i++) { @@ -1025,7 +1025,7 @@ void GridMapEditor::_notification(int p_what) { if (lock_view) { - EditorNode*editor = get_scene()->get_root()->get_child(0)->cast_to<EditorNode>(); + EditorNode*editor = get_tree()->get_root()->get_child(0)->cast_to<EditorNode>(); Plane p; p.normal[edit_axis]=1.0; @@ -1055,7 +1055,7 @@ void GridMapEditor::_update_cursor_instance() { Ref<Mesh> mesh = node->get_theme()->get_item_mesh(selected_pallete); if (!mesh.is_null() && mesh->get_rid().is_valid()) { - cursor_instance=VisualServer::get_singleton()->instance_create2(mesh->get_rid(),get_scene()->get_root()->get_world()->get_scenario()); + cursor_instance=VisualServer::get_singleton()->instance_create2(mesh->get_rid(),get_tree()->get_root()->get_world()->get_scenario()); VisualServer::get_singleton()->instance_set_transform(cursor_instance,cursor_transform); } } |