• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ NodePath函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中NodePath函数的典型用法代码示例。如果您正苦于以下问题:C++ NodePath函数的具体用法?C++ NodePath怎么用?C++ NodePath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了NodePath函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: NodePath

int EditorData::add_edited_scene(int p_at_pos) {

	if (p_at_pos < 0)
		p_at_pos = edited_scene.size();
	EditedScene es;
	es.root = NULL;
	es.history_current = -1;
	es.version = 0;
	es.live_edit_root = NodePath(String("/root"));

	if (p_at_pos == edited_scene.size())
		edited_scene.push_back(es);
	else
		edited_scene.insert(p_at_pos, es);

	if (current_edited_scene < 0)
		current_edited_scene = 0;
	return p_at_pos;
}
开发者ID:KellyThomas,项目名称:godot,代码行数:19,代码来源:editor_data.cpp


示例2: switch

void AnimationTreePlayer::_notification(int p_what) {

	switch(p_what) {

		case NOTIFICATION_ENTER_TREE: {

			if (!processing) {
				//make sure that a previous process state was not saved
				//only process if "processing" is set
				set_fixed_process(false);
				set_process(false);
			}
		} break;
		case NOTIFICATION_READY: {
			dirty_caches=true;
			if (master!=NodePath()) {
				_update_sources();
			}
		} break;
		case NOTIFICATION_PROCESS: {
			if (animation_process_mode==ANIMATION_PROCESS_FIXED)
				break;

			if (processing)
				_process_animation( get_process_delta_time() );
		} break;
		case NOTIFICATION_FIXED_PROCESS: {

			if (animation_process_mode==ANIMATION_PROCESS_IDLE)
				break;

			if (processing)
				_process_animation(get_fixed_process_delta_time());
		} break;
	}

}
开发者ID:RYG81,项目名称:godot,代码行数:37,代码来源:animation_tree_player.cpp


示例3: m_interface

LevelInterface::LevelInterface(WindowFramework* window):
m_interface(NodePath("LevelInterface")),
m_lifes(new TextNode("lifes"))
{
	m_interface.reparent_to(window->get_render_2d());
	hide();
	//
	PT(Texture) tex;
	tex = TexturePool::load_texture( "resources/gui/lifes.png"); 
	CardMaker cm("cardMaker");
	cm.set_frame_fullscreen_quad();
	PT(PandaNode) readyCard = cm.generate(); 
	NodePath lifes(readyCard);
	lifes.set_texture( tex ); 
	lifes.reparent_to(m_interface);
	lifes.set_scale(0.1, 0.1, 0.05);
	lifes.set_pos(0.9, 0.8, 0.9);
	//
	m_lifes->set_text_color(0.f, 0.f, 1.f, 1.f);
	m_lifes->set_text("0");
	NodePath lifeText = m_interface.attach_new_node(m_lifes);
	lifeText.set_scale(0.1);
	lifeText.set_pos(0.91, 0.9, 0.875);
}
开发者ID:darkpotpot,项目名称:Pandaman,代码行数:24,代码来源:level_interface.cpp


示例4: from

void SceneTreeDock::_fill_path_renames(Vector<StringName> base_path,Vector<StringName> new_base_path,Node * p_node, List<Pair<NodePath,NodePath> > *p_renames) {

	base_path.push_back(p_node->get_name());
	if (new_base_path.size())
		new_base_path.push_back(p_node->get_name());

	NodePath from( base_path,true );
	NodePath to;
	if (new_base_path.size())
		to=NodePath( new_base_path,true );

	Pair<NodePath,NodePath> npp;
	npp.first=from;
	npp.second=to;

	p_renames->push_back(npp);

	for(int i=0;i<p_node->get_child_count();i++) {

		_fill_path_renames(base_path,new_base_path,p_node->get_child(i),p_renames);
	}


}
开发者ID:ErosOlmi,项目名称:godot,代码行数:24,代码来源:scene_tree_dock.cpp


示例5: godot_node_path_new

void GDAPI godot_node_path_new(godot_node_path *r_dest, const godot_string *p_from) {
	NodePath *dest = (NodePath *)r_dest;
	const String *from = (const String *)p_from;
	memnew_placement(dest, NodePath(*from));
}
开发者ID:SaracenOne,项目名称:godot,代码行数:5,代码来源:node_path.cpp


示例6: get_token


//.........这里部分代码省略.........
			if (buffer.size()!=len) {
				r_err_str="Couldn't allocate image buffer of size: "+itos(len);
			}

			{
				DVector<uint8_t>::Write w=buffer.write();

				for(int i=0;i<len;i++) {
					get_token(p_stream,token,line,r_err_str);
					if (token.type!=TK_COMMA) {
						r_err_str="Expected ','";
						return ERR_PARSE_ERROR;
					}

					get_token(p_stream,token,line,r_err_str);
					if (token.type!=TK_NUMBER) {
						r_err_str="Expected number";
						return ERR_PARSE_ERROR;
					}

					w[i]=int(token.value);

				}
			}


			Image img(width,height,mipmaps,format,buffer);

			value=img;

			return OK;


		} else if (id=="NodePath") {



			get_token(p_stream,token,line,r_err_str);
			if (token.type!=TK_PARENTHESIS_OPEN) {
				r_err_str="Expected '('";
				return ERR_PARSE_ERROR;
			}

			get_token(p_stream,token,line,r_err_str);
			if (token.type!=TK_STRING) {
				r_err_str="Expected string as argument for NodePath()";
				return ERR_PARSE_ERROR;
			}

			value=NodePath(String(token.value));

			get_token(p_stream,token,line,r_err_str);
			if (token.type!=TK_PARENTHESIS_CLOSE) {
				r_err_str="Expected ')'";
				return ERR_PARSE_ERROR;
			}

		} else if (id=="RID") {



			get_token(p_stream,token,line,r_err_str);
			if (token.type!=TK_PARENTHESIS_OPEN) {
				r_err_str="Expected '('";
				return ERR_PARSE_ERROR;
			}
开发者ID:Griefchief,项目名称:godot,代码行数:67,代码来源:variant_parser.cpp


示例7: godot_node_path_new

void GDAPI godot_node_path_new(godot_node_path *p_np, const godot_string *p_from) {
	NodePath *np = (NodePath *)p_np;
	String *from = (String *)p_from;
	memnew_placement_custom(np, NodePath, NodePath(*from));
}
开发者ID:Alex-doc,项目名称:godot,代码行数:5,代码来源:godot_node_path.cpp


示例8: CLerpNodePathInterval

void World6::rotate_planets()
   {
   m_dayPeriodSun = new CLerpNodePathInterval("dayPeriodSunInterval",
                                              20,
                                              CLerpInterval::BT_no_blend,
                                              true,
                                              false,
                                              m_sun,
                                              NodePath());
   m_dayPeriodSun->set_start_hpr(LVecBase3f(  0, 0, 0));
   m_dayPeriodSun->set_end_hpr  (LVecBase3f(360, 0, 0));

   m_orbitPeriodMercury =
      new CLerpNodePathInterval("orbitPeriodMercuryInterval",
                                0.241 * m_yearscale,
                                CLerpInterval::BT_no_blend,
                                true,
                                false,
                                m_orbitRootMercury,
                                NodePath());
   m_orbitPeriodMercury->set_start_hpr(LVecBase3f(  0, 0, 0));
   m_orbitPeriodMercury->set_end_hpr  (LVecBase3f(360, 0, 0));

   m_dayPeriodMercury = new CLerpNodePathInterval("dayPeriodMercuryInterval",
                                                  59 * m_dayscale,
                                                  CLerpInterval::BT_no_blend,
                                                  true,
                                                  false,
                                                  m_mercury,
                                                  NodePath());
   m_dayPeriodMercury->set_start_hpr(LVecBase3f(  0, 0, 0));
   m_dayPeriodMercury->set_end_hpr  (LVecBase3f(360, 0, 0));

   m_orbitPeriodVenus = new CLerpNodePathInterval("orbitPeriodVenusInterval",
                                                  0.615 * m_yearscale,
                                                  CLerpInterval::BT_no_blend,
                                                  true,
                                                  false,
                                                  m_orbitRootVenus,
                                                  NodePath());
   m_orbitPeriodVenus->set_start_hpr(LVecBase3f(  0, 0, 0));
   m_orbitPeriodVenus->set_end_hpr  (LVecBase3f(360, 0, 0));

   m_dayPeriodVenus = new CLerpNodePathInterval("dayPeriodVenusInterval",
                                                  243 * m_dayscale,
                                                  CLerpInterval::BT_no_blend,
                                                  true,
                                                  false,
                                                  m_venus,
                                                  NodePath());
   m_dayPeriodVenus->set_start_hpr(LVecBase3f(  0, 0, 0));
   m_dayPeriodVenus->set_end_hpr  (LVecBase3f(360, 0, 0));

   // Here the earth interval has been changed to rotate like the rest of the
   // planets and send a message before it starts turning again. To send a
   // message, the call is simply messenger.send("message"). The "newYear"
   // message is picked up by the accept("newYear"...) statement earlier, and
   // calls the incYear function as a result
   m_orbitPeriodEarth = new CLerpNodePathInterval("orbitPeriodEarthInterval",
                                                  m_yearscale,
                                                  CLerpInterval::BT_no_blend,
                                                  true,
                                                  false,
                                                  m_orbitRootEarth,
                                                  NodePath());
   m_orbitPeriodEarth->set_start_hpr(LVecBase3f(  0, 0, 0));
   m_orbitPeriodEarth->set_end_hpr  (LVecBase3f(360, 0, 0));
   m_orbitPeriodEarth->set_done_event("newYear");

   m_dayPeriodEarth = new CLerpNodePathInterval("dayPeriodEarthInterval",
                                                  m_dayscale,
                                                  CLerpInterval::BT_no_blend,
                                                  true,
                                                  false,
                                                  m_earth,
                                                  NodePath());
   m_dayPeriodEarth->set_start_hpr(LVecBase3f(  0, 0, 0));
   m_dayPeriodEarth->set_end_hpr  (LVecBase3f(360, 0, 0));

   m_orbitPeriodMoon = new CLerpNodePathInterval("orbitPeriodMoonInterval",
                                                  0.0749 * m_yearscale,
                                                  CLerpInterval::BT_no_blend,
                                                  true,
                                                  false,
                                                  m_orbitRootMoon,
                                                  NodePath());
   m_orbitPeriodMoon->set_start_hpr(LVecBase3f(  0, 0, 0));
   m_orbitPeriodMoon->set_end_hpr  (LVecBase3f(360, 0, 0));

   m_dayPeriodMoon = new CLerpNodePathInterval("dayPeriodMoonInterval",
                                                  0.0749 * m_dayscale,
                                                  CLerpInterval::BT_no_blend,
                                                  true,
                                                  false,
                                                  m_moon,
                                                  NodePath());
   m_dayPeriodMoon->set_start_hpr(LVecBase3f(  0, 0, 0));
   m_dayPeriodMoon->set_end_hpr  (LVecBase3f(360, 0, 0));

   m_orbitPeriodMars = new CLerpNodePathInterval("orbitPeriodMarsInterval",
//.........这里部分代码省略.........
开发者ID:memberii,项目名称:drunken-octo-robot,代码行数:101,代码来源:world6.cpp


示例9: ERR_FAIL_INDEX_V

NodePath Polygon2D::get_bone_path(int p_index) const {
	ERR_FAIL_INDEX_V(p_index, bone_weights.size(), NodePath());
	return bone_weights[p_index].path;
}
开发者ID:timoschwarzer,项目名称:godot,代码行数:4,代码来源:polygon_2d.cpp


示例10: global_leg_ik_enabled_changed

void LegIKController::_ready() {
	global_leg_ik_enabled_changed();
	global_leg_ik_feet_reposition_rate_changed();
	global_leg_ik_body_reposition_rate_changed();

	//Ignore player collision hull
	ray_exclusion_array = Set<RID>();

	CollisionObject *collision_object = static_cast<CollisionObject *>(get_node(NodePath("..")));
	if (collision_object)
		ray_exclusion_array.insert(collision_object->get_rid());

	skeleton = static_cast<Skeleton *>(get_node(skeleton_path));

	if (skeleton != NULL) {
		root_bone = skeleton->find_bone(root_bone_name);
		pelvis = skeleton->find_bone(pelvis_name);

		left_leg = skeleton->find_bone(left_leg_name);
		left_knee = skeleton->find_bone(left_knee_name);
		left_ankle = skeleton->find_bone(left_ankle_name);
		left_toe = skeleton->find_bone(left_toe_name);

		right_leg = skeleton->find_bone(right_leg_name);
		right_knee = skeleton->find_bone(right_knee_name);
		right_ankle = skeleton->find_bone(right_ankle_name);
		right_toe = skeleton->find_bone(right_toe_name);

		if (root_bone != -1 && pelvis != -1 &&
			left_leg != -1 && left_knee != -1 && left_ankle != -1 &&
			right_leg != -1 && right_knee != -1 && right_ankle != -1 &&
			left_toe != -1 && right_toe != -1) {

			left_thigh_length = skeleton->get_bone_global_pose(left_leg).origin.distance_to(skeleton->get_bone_global_pose(left_knee).origin);
			left_calf_length = skeleton->get_bone_global_pose(left_knee).origin.distance_to(skeleton->get_bone_global_pose(left_ankle).origin);
			left_leg_full_length = left_thigh_length + left_calf_length;

			right_thigh_length = skeleton->get_bone_global_pose(right_leg).origin.distance_to(skeleton->get_bone_global_pose(right_knee).origin);
			right_calf_length = skeleton->get_bone_global_pose(right_knee).origin.distance_to(skeleton->get_bone_global_pose(right_ankle).origin);
			right_leg_full_length = right_thigh_length + right_calf_length;

			prev_target_height = skeleton->get_bone_global_pose(root_bone).origin.y;

			Transform left_foot_local_transform = skeleton->get_bone_global_pose(left_ankle);
			Transform right_foot_local_transform = skeleton->get_bone_global_pose(right_ankle);

			Transform left_foot_transform = skeleton->get_global_transform() * left_foot_local_transform;
			Transform right_foot_transform = skeleton->get_global_transform() * right_foot_local_transform;

			targeted_left_ground = left_foot_transform.origin;
			targeted_right_ground = right_foot_transform.origin;

			prev_left_ground = left_foot_local_transform.origin;
			prev_right_ground = right_foot_local_transform.origin;

			ik_valid = true;
		}
		else {
			ik_valid = false;
		}
	}
}
开发者ID:SaracenOne,项目名称:leg_ik,代码行数:62,代码来源:leg_ik_controller.cpp


示例11: NodePath

LegIKController::LegIKController() {
	skeleton_path = NodePath();

	bool ik_on = false;
	bool ik_valid = false;

	root_global_transform = Transform();
	ray_exclusion_array = Set<RID>();

	root_bone_name = "root";
	pelvis_name = "lower_body";

	left_leg_name = "leg.L";
	left_knee_name = "knee.L";
	left_ankle_name = "ankle.L";
	left_toe_name = "toe.L";

	right_leg_name = "leg.R";
	right_knee_name = "knee.R";
	right_ankle_name = "ankle.R";
	right_toe_name = "toe.R";

	root_bone = -1;
	pelvis = -1;

	left_leg = -1;
	left_knee = -1;
	left_ankle = -1;
	left_toe = -1;

	right_leg = -1;
	right_knee = -1;
	right_ankle = -1;
	right_toe = -1;

	left_thigh_length = 0.0f;
	right_thigh_length = 0.0f;
	left_calf_length = 0.0f;
	right_calf_length = 0.0f;
	left_leg_full_length = 0.0f;
	right_leg_full_length = 0.0f;

	animation_offset = 0.01f;
	ankle_height_L = 0.0f;
	ankle_height_R = 0.0f;
	root_offset = 0.0f;

	target_height = 0.0f;
	prev_target_height = 0.0f;
	target_height_velocity = 0.0f;
		
	left_foot_down = false;
	right_foot_down = false;

	root = NULL;
	skeleton = NULL;
	dss = NULL;

	targeted_left_ground = Vector3();
	targeted_right_ground = Vector3();

	ik_feet_reposition_rate = 15.0f;
	ik_body_reposition_rate = 1.0f;

	prev_left_ground = Vector3();
	prev_right_ground = Vector3();
}
开发者ID:SaracenOne,项目名称:leg_ik,代码行数:67,代码来源:leg_ik_controller.cpp


示例12: get_stylebox

void AnimationTreeEditor::_popup_edit_dialog() {

	updating_edit=true;

	for(int i=0;i<2;i++)
		edit_scroll[i]->hide();

	for(int i=0;i<4;i++) {

		edit_line[i]->hide();
		edit_label[i]->hide();
	}

	edit_option->hide();
	edit_button->hide();;
	filter_button->hide();
	edit_check->hide();;

	Point2 pos = anim_tree->node_get_pos(edited_node)-Point2(h_scroll->get_val(),v_scroll->get_val());
	Ref<StyleBox> style = get_stylebox("panel","PopupMenu");
	Size2 size = get_node_size(edited_node);
	Point2 popup_pos( pos.x+style->get_margin(MARGIN_LEFT), pos.y+size.y-style->get_margin(MARGIN_BOTTOM));
	popup_pos+=get_global_pos();

	if (renaming_edit) {

		edit_label[0]->set_text("New name:");
		edit_label[0]->set_pos(Point2(5,5));
		edit_label[0]->show();
		edit_line[0]->set_begin(Point2(15,25));
		edit_line[0]->set_text(edited_node);
		edit_line[0]->show();
		edit_dialog->set_size(Size2(150,50));

	} else {

		AnimationTreePlayer::NodeType type=anim_tree->node_get_type(edited_node);


		switch(type) {

			case AnimationTreePlayer::NODE_ANIMATION:

				if (anim_tree->get_master_player()!=NodePath() && anim_tree->has_node(anim_tree->get_master_player())  && anim_tree->get_node(anim_tree->get_master_player())->cast_to<AnimationPlayer>()) {

					AnimationPlayer *ap = anim_tree->get_node(anim_tree->get_master_player())->cast_to<AnimationPlayer>();
					master_anim_popup->clear();
					List<StringName> sn;
					ap->get_animation_list(&sn);
					sn.sort_custom<StringName::AlphCompare>();
					for (List<StringName>::Element *E=sn.front();E;E=E->next()) {
						master_anim_popup->add_item(E->get());
					}

					master_anim_popup->set_pos(popup_pos);
					master_anim_popup->popup();
				} else {
					property_editor->edit(this,"",Variant::OBJECT,anim_tree->animation_node_get_animation(edited_node),PROPERTY_HINT_RESOURCE_TYPE,"Animation");
					property_editor->set_pos(popup_pos);
					property_editor->popup();
					updating_edit=false;
				}
				return;
			 case AnimationTreePlayer::NODE_TIMESCALE:
				edit_label[0]->set_text("Scale:");
				edit_label[0]->set_pos(Point2(5,5));
				edit_label[0]->show();
				edit_line[0]->set_begin(Point2(15,25));
				edit_line[0]->set_text(rtos(anim_tree->timescale_node_get_scale(edited_node)));
				edit_line[0]->show();
				edit_dialog->set_size(Size2(150,50));
				break;
			 case AnimationTreePlayer::NODE_ONESHOT:
				edit_label[0]->set_text("Fade In (s):");
				edit_label[0]->set_pos(Point2(5,5));
				edit_label[0]->show();
				edit_line[0]->set_begin(Point2(15,25));
				edit_line[0]->set_text(rtos(anim_tree->oneshot_node_get_fadein_time(edited_node)));
				edit_line[0]->show();
				edit_label[1]->set_text("Fade Out (s):");
				edit_label[1]->set_pos(Point2(5,55));
				edit_label[1]->show();
				edit_line[1]->set_begin(Point2(15,75));
				edit_line[1]->set_text(rtos(anim_tree->oneshot_node_get_fadeout_time(edited_node)));
				edit_line[1]->show();

				edit_option->clear();
				edit_option->add_item("Blend",0);
				edit_option->add_item("Mix",1);
				edit_option->set_begin(Point2(15,105));

				edit_option->select( anim_tree->oneshot_node_get_mix_mode(edited_node));
				edit_option->show();

				edit_check->set_text("Auto Restart:");
				edit_check->set_begin(Point2(15,125));
				edit_check->set_pressed(anim_tree->oneshot_node_has_autorestart(edited_node));
				edit_check->show();

				edit_label[2]->set_text("Restart (s):");
//.........这里部分代码省略.........
开发者ID:Scrik,项目名称:godot,代码行数:101,代码来源:animation_tree_editor_plugin.cpp


示例13: switch


//.........这里部分代码省略.........
			if (array_type->eklass == CACHED_CLASS_RAW(uint8_t))
				return (MonoObject *)PoolByteArray_to_mono_array(p_var->operator PoolByteArray());

			if (array_type->eklass == CACHED_CLASS_RAW(int32_t))
				return (MonoObject *)PoolIntArray_to_mono_array(p_var->operator PoolIntArray());

			if (array_type->eklass == REAL_T_MONOCLASS)
				return (MonoObject *)PoolRealArray_to_mono_array(p_var->operator PoolRealArray());

			if (array_type->eklass == CACHED_CLASS_RAW(String))
				return (MonoObject *)PoolStringArray_to_mono_array(p_var->operator PoolStringArray());

			if (array_type->eklass == CACHED_CLASS_RAW(Vector2))
				return (MonoObject *)PoolVector2Array_to_mono_array(p_var->operator PoolVector2Array());

			if (array_type->eklass == CACHED_CLASS_RAW(Vector3))
				return (MonoObject *)PoolVector3Array_to_mono_array(p_var->operator PoolVector3Array());

			if (array_type->eklass == CACHED_CLASS_RAW(Color))
				return (MonoObject *)PoolColorArray_to_mono_array(p_var->operator PoolColorArray());

			ERR_EXPLAIN(String() + "Attempted to convert Variant to a managed array of unmarshallable element type.");
			ERR_FAIL_V(NULL);
		} break;

		case MONO_TYPE_CLASS: {
			GDMonoClass *type_class = p_type.type_class;

			// GodotObject
			if (CACHED_CLASS(GodotObject)->is_assignable_from(type_class)) {
				return GDMonoUtils::unmanaged_get_managed(p_var->operator Object *());
			}

			if (CACHED_CLASS(NodePath) == type_class) {
				return GDMonoUtils::create_managed_from(p_var->operator NodePath());
			}

			if (CACHED_CLASS(RID) == type_class) {
				return GDMonoUtils::create_managed_from(p_var->operator RID());
			}
		} break;
		case MONO_TYPE_OBJECT: {
			// Variant
			switch (p_var->get_type()) {
				case Variant::BOOL: {
					MonoBoolean val = p_var->operator bool();
					return BOX_BOOLEAN(val);
				}
				case Variant::INT: {
					int val = p_var->operator signed int();
					return BOX_INT32(val);
				}
				case Variant::REAL: {
#ifdef REAL_T_IS_DOUBLE
					double val = p_var->operator double();
					return BOX_DOUBLE(val);
#else
					float val = p_var->operator float();
					return BOX_FLOAT(val);
#endif
				}
				case Variant::STRING:
					return (MonoObject *)mono_string_from_godot(p_var->operator String());
				case Variant::VECTOR2:
					RETURN_BOXED_STRUCT(Vector2, p_var);
				case Variant::RECT2:
开发者ID:arcanis,项目名称:godot,代码行数:67,代码来源:gd_mono_marshal.cpp


示例14: ERR_FAIL_COND_V


//.........这里部分代码省略.........
				continue;

			if (PE->get().usage&PROPERTY_USAGE_STORAGE || (bundle_resources && PE->get().usage&PROPERTY_USAGE_BUNDLE)) {

				String name = PE->get().name;
				Variant value = res->get(name);


				if ((PE->get().usage&PROPERTY_USAGE_STORE_IF_NONZERO && value.is_zero())||(PE->get().usage&PROPERTY_USAGE_STORE_IF_NONONE && value.is_one()) )
					continue;

				if (PE->get().type==Variant::OBJECT && value.is_zero() && !(PE->get().usage&PROPERTY_USAGE_STORE_IF_NULL))
					continue;

				String vars;
				VariantWriter::write_to_string(value,vars,_write_resources,this);
				f->store_string(_valprop(name)+" = "+vars+"\n");
			}


		}

		f->store_string("\n");

	}

	if (packed_scene.is_valid()) {
		//if this is a scene, save nodes and connections!
		Ref<SceneState> state = packed_scene->get_state();
		for(int i=0;i<state->get_node_count();i++) {

			StringName type = state->get_node_type(i);
			StringName name = state->get_node_name(i);
			NodePath path = state->get_node_path(i,true);
			NodePath owner = state->get_node_owner_path(i);
			Ref<PackedScene> instance = state->get_node_instance(i);
			String instance_placeholder = state->get_node_instance_placeholder(i);
			Vector<StringName> groups = state->get_node_groups(i);



			String header="[node";
			header+=" name=\""+String(name)+"\"";
			if (type!=StringName()) {
				header+=" type=\""+String(type)+"\"";
			}
			if (path!=NodePath()) {
				header+=" parent=\""+String(path.simplified())+"\"";
			}
			if (owner!=NodePath() && owner!=NodePath(".")) {
				header+=" owner=\""+String(owner.simplified())+"\"";
			}

			if (groups.size()) {
				String sgroups=" groups=[ ";
				for(int j=0;j<groups.size();j++) {
					if (j>0)
						sgroups+=", ";
					sgroups+="\""+groups[j].operator String().c_escape()+"\"";
				}
				sgroups+=" ]";
				header+=sgroups;
			}

			f->store_string(header);
开发者ID:03050903,项目名称:godot,代码行数:66,代码来源:scene_format_text.cpp


示例15: _find_paths_for_filter

void AnimationTreeEditor::_edit_filters() {

	filter_dialog->popup_centered_ratio();
	filter->clear();

	Set<String> npb;
	_find_paths_for_filter(edited_node,npb);

	TreeItem *root = filter->create_item();
	filter->set_hide_root(true);
	Map<String,TreeItem*> pm;

	Node *base = anim_tree->get_node( anim_tree->get_base_path() );

	for(Set<String>::Element *E=npb.front();E;E=E->next()) {

		TreeItem *parent=root;
		String descr=E->get();
		if (base) {
			NodePath np = E->get();

			if (np.get_property()!=StringName()) {
				Node *n = base->get_node(np);
				Skeleton *s = n->cast_to<Skeleton>();
				if (s) {

					String skelbase = E->get().substr(0,E->get().find(":"));


					int bidx = s->find_bone(np.get_property());

					if (bidx!=-1) {
						int bparent = s->get_bone_parent(bidx);
						//
						if (bparent!=-1) {


							String bpn = skelbase+":"+s->get_bone_name(bparent);
							if (pm.has(bpn)) {
								parent=pm[bpn];
								descr=np.get_property();
							}
						} else {

							if (pm.has(skelbase)) {
								parent=pm[skelbase];

							}
						}
					}
				}
			}
		}

		TreeItem *it = filter->create_item(parent);
		it->set_cell_mode(0,TreeItem::CELL_MODE_CHECK);
		it->set_text(0,descr);
		it->set_metadata(0,NodePath(E->get()));
		it->set_editable(0,true);
		if (anim_tree->node_get_type(edited_node)==AnimationTreePlayer::NODE_ONESHOT) {
			it->set_checked(0, anim_tree->oneshot_node_is_path_filtered(edited_node,E->get()));
		} else if (anim_tree->node_get_type(edited_node)==AnimationTreePlayer::NODE_BLEND2) {
			it->set_checked(0, anim_tree->blend2_node_is_path_filtered(edited_node,E->get()));
		}
		pm[E->get()]=it;
	}


}
开发者ID:Scrik,项目名称:godot,代码行数:69,代码来源:animation_tree_editor_plugin.cpp


示例16: SET_FROM_STRUCT


//.........这里部分代码省略.........
				SET_FROM_ARRAY(PoolStringArray);
				break;
			}

			if (array_type->eklass == CACHED_CLASS_RAW(Vector2)) {
				SET_FROM_ARRAY(PoolVector2Array);
				break;
			}

			if (array_type->eklass == CACHED_CLASS_RAW(Vector3)) {
				SET_FROM_ARRAY(PoolVector3Array);
				break;
			}

			if (array_type->eklass == CACHED_CLASS_RAW(Color)) {
				SET_FROM_ARRAY(PoolColorArray);
				break;
			}

			ERR_EXPLAIN(String() + "Attempted to convert Variant to a managed array of unmarshallable element type.");
			ERR_FAIL();
		} break;

		case MONO_TYPE_CLASS: {
			GDMonoClass *type_class = type.type_class;

			// GodotObject
			if (CACHED_CLASS(GodotObject)->is_assignable_from(type_class)) {
				MonoObject *managed = GDMonoUtils::unmanaged_get_managed(p_value.operator Object *());
				mono_field_set_value(p_object, mono_field, managed);
				break;
			}

			if (CACHED_CLASS(NodePath) == type_class) {
				MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator NodePath());
				mono_field_set_value(p_object, mono_field, managed);
				break;
			}

			if (CACHED_CLASS(RID) == type_class) {
				MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator RID());
				mono_field_set_value(p_object, mono_field, managed);
				break;
			}

			if (CACHED_CLASS(Dictionary) == type_class) {
				MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator Dictionary(), CACHED_CLASS(Dictionary));
				mono_field_set_value(p_object, mono_field, managed);
				break;
			}

			if (CACHED_CLASS(Array) == type_class) {
				MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator Array(), CACHED_CLASS(Array));
				mono_field_set_value(p_object, mono_field, managed);
				break;
			}

			ERR_EXPLAIN(String() + "Attempted to set the value of a field of unmarshallable type: " + type_class->get_name());
			ERR_FAIL();
		} break;

		case MONO_TYPE_OBJECT: {
			// Variant
			switch (p_value.get_type()) {
				case Variant::BOOL: {
					MonoBoolean val = p_value.operator bool();
开发者ID:SaracenOne,项目名称:godot,代码行数:67,代码来源:gd_mono_field.cpp


示例17: emit_signal

void EditorPropertyRootMotion::_node_clear() {

	emit_signal("property_changed", get_edited_property(), NodePath());
	update_property();
}
开发者ID:KellyThomas,项目名称:godot,代码行数:5,代码来源:root_motion_editor_plugin.cpp


示例18: ERR_FAIL_INDEX_V

NodePath BakedLightmapData::get_user_path(int p_user) const {

	ERR_FAIL_INDEX_V(p_user, users.size(), NodePath());
	return users[p_user].path;
}
开发者ID:DSeanLaw,项目名称:godot,代码行数:5,代码来源:baked_lightmap.cpp


示例19: godot_node_path_new_copy

void GDAPI godot_node_path_new_copy(godot_node_path *r_dest, const godot_node_path *p_src) {
	NodePath *dest = (NodePath *)r_dest;
	const NodePath *src = (const NodePath *)p_src;
	memnew_placement(dest, NodePath(*src));
}
开发者ID:SaracenOne,项目名称:godot,代码行数:5,代码来源:node_path.cpp


示例20: m_windowFramework

World::World(WindowFramework* windowFramework)
    : m_windowFramework(windowFramework),
      m_title(),
      m_inst1(),
      m_inst2(),
      m_inst3(),
      m_inst4(),
      m_altCam(),
      m_teapot(),
      m_teapotInterval(),
      m_bufferViewer(NULL)
      // m_tvMen
{
    // Note: set background color here
    m_windowFramework->get_graphics_output()->get_active_display_region(0)->
    set_clear_color(Colorf(0, 0, 0, 1));

    // Post the instructions.
    m_title = add_title("Panda3D: Tutorial - Using Render-to-Texture");
    m_inst1 = add_instructions(0.95,"ESC: Quit");
    m_inst2 = add_instructions(0.90,"Up/Down: Zoom in/out on the Teapot");
    m_inst3 = add_instructions(0.85,"Left/Right: Move teapot left/right");
    m_inst4 = add_instructions(0.80,"V: View the render-to-texture results");

    //we get a handle to the default window
    PT(GraphicsOutput) mainWindow = m_windowFramework->get_graphics_output();

    // we now get buffer thats going to hold the texture of our new scene
    PT(GraphicsOutput) altBuffer = mainWindow->make_texture_buffer(
                                       "hello", 256, 256);

    // now we have to setup a new scene graph to make this scene
    NodePath altRender("new render");

    // this takes care of setting up the camera properly
    m_altCam = m_windowFramework->make_camera();
    // Note: set the size and shape of the "film" within the lens equal to the
    //       buffer of our new scene
    DCAST(Camera, m_altCam.node())->get_lens()->set_film_size(
        altBuffer->get_x_size(), altBuffer->get_y_size());
    // Note: make a DisplayRegion for the camera
    PT(DisplayRegion) dr = altBuffer->make_display_region(0, 1, 0, 1);
    dr->set_sort(0);
    dr->set_camera(m_altCam);
    m_altCam.reparent_to(altRender);
    m_altCam.set_pos(0, -10, 0);

    // get the teapot and rotates it for a simple animation
    const NodePath& models =
        m_windowFramework->get_panda_framework()->get_models();
    m_teapot = m_windowFramework->load_model(models, "../models/teapot");
    m_teapot.reparent_to(altRender);
    m_teapot.set_pos(0, 0, -1);

    const bool bakeInStart = true;
    const bool fluid = false;
    m_teapotInterval = new CLerpNodePathInterval("teapotInterval", 1.5,
            CLerpInterval::BT_no_blend, bakeInStart, fluid, m_teapot, NodePath());
    m_teapotInterval->set_start_hpr(m_teapot.get_hpr());
    m_teapotInterval->set_end_hpr(LVecBase3f(m_teapot.get_h()+360,
                                  m_teapot.get_p()+360,
                                  m_teapot.get_r()+360));
    m_teapotInterval->loop();

    // put some lighting on the teapot
    PT(DirectionalLight) dlight = new DirectionalLight("dlight");
    PT(AmbientLight) alight = new AmbientLight("alight");
    NodePath dlnp = altRender.attach_new_node(dlight);
    NodePath alnp = altRender.attach_new_node(alight);
    dlight->set_color(Colorf(0.8, 0.8, 0.5, 1));
    alight->set_color(Colorf(0.2, 0.2, 0.2, 1));
    dlnp.set_hpr(0, -60, 0);
    altRender.set_light(dlnp);
    altRender.set_light(alnp);

    // Panda contains a built-in viewer that lets you view the results of
    // your render-to-texture operations.  This code configures the viewer.

    WORLD_DEFINE_KEY("v", "toggleBufferViewer", toggle_buffer_viewer);
    m_bufferViewer = new CBufferViewer(m_windowFramework);
    m_bufferViewer->set_position(CBufferViewer::CP_llcorner);
    m_bufferViewer->set_card_size(1.0, 0.0);

    // Create the tv-men. Each TV-man will display the
    // offscreen-texture on his TV screen.
    make_tv_man(-5, 30,  1, altBuffer->get_texture(), 0.9);
    make_tv_man( 5, 30,  1, altBuffer->get_texture(), 1.4);
    make_tv_man( 0, 23, -3, altBuffer->get_texture(), 2.0);
    make_tv_man(-5, 20, -6, altBuffer->get_texture(), 1.1);
    make_tv_man( 5, 18, -5, altBuffer->get_texture(), 1.7);

    WORLD_DEFINE_KEY("escape", "exit", quit);
    WORLD_DEFINE_KEY("arrow_up", "zoomIn", zoom_in);
    WORLD_DEFINE_KEY("arrow_down", "zoomOut", zoom_out);
    WORLD_DEFINE_KEY("arrow_left", "moveLeft", move_left);
    WORLD_DEFINE_KEY("arrow_right", "moveRight", move_right);

    WORLD_ADD_TASK("worldAsyncTask", async_task);
}
开发者ID:memberii,项目名称:drunken-octo-robot,代码行数:99,代码来源:world.cpp



注:本文中的NodePath函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Noise函数代码示例发布时间:2022-05-30
下一篇:
C++ Node函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap