Godot 4 源码分析 - 获取属性信息

news2024/10/6 7:50:29

在管道通信基础上,可进行宿主程序与Godot的双向通信。

先拿属性信息试试手。

DrGraph端

static UnicodeString command = "Book.position";
if (InputQuery("输入窗口", "请输入待获取的属性信息", command)) {
	TDrStream_Get drGet(THelper::String::GetStringAt(command, L".", 0).Trim(),
						THelper::String::GetStringAt(command, L".", 1).Trim());
	TDllStream ds;
	ds << drGet;
	PipeStreamServer->WritePipe(ds, 1000);
}

Godot端(源码完善)

List<PropertyInfo> *p_list = new List<PropertyInfo>;
bool p_reversed = true;
destObject->get_property_list(p_list, p_reversed);
cofs << "OK";
for (List<PropertyInfo>::Iterator it = p_list->begin(); it != p_list->end(); ++it) {
	String content = it->name.ptr();
	if (it->class_name.operator String().is_empty() == false)
		content += str_format(U"[%s]", it->class_name.operator String().utf8().get_data());
	Variant value = destObject->get(it->name);
	content += str_format(U" = %s", value.operator String().utf8().get_data());
	cofs << content;
}
delete p_list;

运行结果

132. 13:20:29:829 > 【主线程】 > [Pipe.发送] > 发送数据中内容[DrGraph.28: Request - wait 1000 ms]: 
	[int]类型 > 值 = 2
	[UnicodeString]类型 > 值 = root
	[UnicodeString]类型 > 值 = propertyNames
133. 13:20:30:015 > 【主线程】 > [Pipe.Read] > 发送数据[DrGraph.28: Request - wait 1000 ms]成功返回 1837 字节... > PIPE响应中内容[godot -> DrGraph.28: Response - no return]: 
	[int]类型 > 值 = 3
	[UnicodeString]类型 > 值 = OK
	[UnicodeString]类型 > 值 = book.gd = <null>
	[UnicodeString]类型 > 值 = singlePage = false
	[UnicodeString]类型 > 值 = middleBarWidth = 0
	[UnicodeString]类型 > 值 = shader_rect[ColorRect] = ShaderRect:<ColorRect#26944209673>
	[UnicodeString]类型 > 值 = currentPageMode = false
	[UnicodeString]类型 > 值 = currentAreaType = -2
	[UnicodeString]类型 > 值 = triggleAreaMoment = 484887
	[UnicodeString]类型 > 值 = currentPageIndex = 30
	[UnicodeString]类型 > 值 = pageCount = 100
	[UnicodeString]类型 > 值 = pageImgPath = res://Pages/
	[UnicodeString]类型 > 值 = leftMouseDownMoment = 0
	[UnicodeString]类型 > 值 = underAutoTurnPage = false
	[UnicodeString]类型 > 值 = leftMouseDownPos = (0, 0)
	[UnicodeString]类型 > 值 = dllStream[DllStream] = <DllStream#67024979098>
	[UnicodeString]类型 > 值 = AutoTurnObject = <RefCounted#-9223372009692462322>
	[UnicodeString]类型 > 值 = Node2D = <null>
	[UnicodeString]类型 > 值 = Transform = <null>
	[UnicodeString]类型 > 值 = position = (0, 0)
	[UnicodeString]类型 > 值 = rotation = 0
	[UnicodeString]类型 > 值 = rotation_degrees = 0
	[UnicodeString]类型 > 值 = scale = (1, 1)
	[UnicodeString]类型 > 值 = skew = 0
	[UnicodeString]类型 > 值 = transform = [X: (1, 0), Y: (0, 1), O: (0, 0)]
	[UnicodeString]类型 > 值 = global_position = (0, 0)
	[UnicodeString]类型 > 值 = global_rotation = 0
	[UnicodeString]类型 > 值 = global_rotation_degrees = 0
	[UnicodeString]类型 > 值 = global_scale = (1, 1)
	[UnicodeString]类型 > 值 = global_skew = 0
	[UnicodeString]类型 > 值 = global_transform = [X: (1, 0), Y: (0, 1), O: (0, 0)]
	[UnicodeString]类型 > 值 = CanvasItem = <null>
	[UnicodeString]类型 > 值 = Visibility = <null>
	[UnicodeString]类型 > 值 = visible = true
	[UnicodeString]类型 > 值 = modulate = (1, 1, 1, 1)
	[UnicodeString]类型 > 值 = self_modulate = (1, 1, 1, 1)
	[UnicodeString]类型 > 值 = show_behind_parent = false
	[UnicodeString]类型 > 值 = top_level = false
	[UnicodeString]类型 > 值 = clip_children = 0
	[UnicodeString]类型 > 值 = light_mask = 1
	[UnicodeString]类型 > 值 = visibility_layer = 1
	[UnicodeString]类型 > 值 = Ordering = <null>
	[UnicodeString]类型 > 值 = z_index = 0
	[UnicodeString]类型 > 值 = z_as_relative = true
	[UnicodeString]类型 > 值 = y_sort_enabled = false
	[UnicodeString]类型 > 值 = Texture = <null>
	[UnicodeString]类型 > 值 = texture_filter = 0
	[UnicodeString]类型 > 值 = texture_repeat = 0
	[UnicodeString]类型 > 值 = Material = <null>
	[UnicodeString]类型 > 值 = material[CanvasItemMaterial,ShaderMaterial] = <Object#null>
	[UnicodeString]类型 > 值 = use_parent_material = false
	[UnicodeString]类型 > 值 = Node = <null>
	[UnicodeString]类型 > 值 = _import_path = 
	[UnicodeString]类型 > 值 = name = Book
	[UnicodeString]类型 > 值 = unique_name_in_owner = false
	[UnicodeString]类型 > 值 = scene_file_path = res://book.tscn
	[UnicodeString]类型 > 值 = owner[Node] = <Object#null>
	[UnicodeString]类型 > 值 = multiplayer[MultiplayerAPI] = <SceneMultiplayer#-9223372011168857310>
	[UnicodeString]类型 > 值 = Process = <null>
	[UnicodeString]类型 > 值 = process_mode = 0
	[UnicodeString]类型 > 值 = process_priority = 0
	[UnicodeString]类型 > 值 = Editor Description = <null>
	[UnicodeString]类型 > 值 = editor_description = 
	[UnicodeString]类型 > 值 = script[Script] = <GDScript#-9223372010984307965>

 这已具备RTTI的雏形。 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/786750.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

5.10 Bootstrap 按钮(Button)插件

文章目录 Bootstrap 按钮&#xff08;Button&#xff09;插件加载状态单个切换复选框&#xff08;Checkbox&#xff09;单选按钮&#xff08;Radio&#xff09;用法选项方法 Bootstrap 按钮&#xff08;Button&#xff09;插件 按钮&#xff08;Button&#xff09;在 Bootstrap…

forEach遍历访问set造成的无限循环问题

抛出问题 先给出一段代码&#xff0c;我们创建了一个集合set&#xff0c;它里面有一个元素数字1和2&#xff0c;接着我们调用forEach方法来遍历该集合。在遍历函数中&#xff0c;首先调用delete方法删除数字1&#xff0c;再执行了某些业务操作后紧接着调用add方法将数字1加回&…

Linux系统root用户切换及密码修改

天行健&#xff0c;君子以自强不息&#xff1b;地势坤&#xff0c;君子以厚德载物。 每个人都有惰性&#xff0c;但不断学习是好好生活的根本&#xff0c;共勉&#xff01; 文章均为学习整理笔记&#xff0c;分享记录为主&#xff0c;如有错误请指正&#xff0c;共同学习进步。…

2023 年第二届钉钉杯大学生大数据挑战赛 初赛 B:美国纽约公共自行车使用量预测分析 问题二Python代码分析

2023 年第二届钉钉杯大学生大数据挑战赛 初赛 B&#xff1a;美国纽约公共自行车使用量预测分析 问题二 相关链接 【2023 年第二届钉钉杯大学生大数据挑战赛】 初赛 B&#xff1a;美国纽约公共自行车使用量预测分析 问题一Python代码分析 【2023 年第二届钉钉杯大学生大数据挑…

面试—Redis相关

文章目录 一、概述二、缓存1、缓存穿透2、缓存击穿3、缓存雪崩4、双写一致性5、持久化6、数据过期策略7、数据淘汰策略 三、分布式锁四、其它面试题1、主从复制2、哨兵3、分片集群结构4、I/O多路复用 一、概述 使用场景&#xff1a; Redis的数据持久化策略有哪些什么是缓存穿透…

[PyTorch][chapter 44][RNN]

简介 循环神经网络&#xff08;Recurrent Neural Network, RNN&#xff09;是一类以序列&#xff08;sequence&#xff09;数据为输入&#xff0c;在序列的演进方向进行递归&#xff08;recursion&#xff09;且所有节点&#xff08;循环单元&#xff09;按链式连接的递归神经网…

leetcode 面试题 判定是否互为字符重排

⭐️ 题目描述 &#x1f31f; leetcode链接&#xff1a;判定是否互为字符重排 思路&#xff1a; 两个字符串的每个字母和数量都相等。那么 s2 一定可以排成 s1 字符串。 代码&#xff1a; bool CheckPermutation(char* s1, char* s2){char hash1[26] {0};char hash2[26] {…

Python深度学习“四大名著”之一【赠书活动|第二期《Python机器学习:基于PyTorch和Scikit-Learn》】

近年来&#xff0c;机器学习方法凭借其理解海量数据和自主决策的能力&#xff0c;已在医疗保健、 机器人、生物学、物理学、大众消费和互联网服务等行业得到了广泛的应用。自从AlexNet模型在2012年ImageNet大赛被提出以来&#xff0c;机器学习和深度学习迅猛发展&#xff0c;取…

不知道零基础小白拥有一个黑客梦有没有机会能够实现

01.简单了解一下网络安全 说白了&#xff0c;网络安全就是指网络系统中的数据受到保护不被破坏。而我们从事网络信息安全工作的安全工程师&#xff0c;主要工作当然是设计程序来维护网络安全了。 网络安全工程师是一个统称&#xff0c;还包含很多职位&#xff0c;像安全产品工…

【代码随想录day19】从前序与中序遍历序列构造二叉树

题目 思路 使用递归建树&#xff0c;流程如下&#xff1a; 取出后序节点创建新树的节点 找到新树的节点在中序中的索引 分割中序序列 分割后序序列 继续递归建立整颗新树 # Definition for a binary tree node. # class TreeNode: # def __init__(self, val0, leftN…

spring-cloud-alibaba——nacos-server搭建

前言&#xff1a;组件版本关系&#xff0c;官方:组件版本关系 1,nacos-server搭建&#xff08;windows环境&#xff09;&#xff0c;下载地址nacos 选择对应的版本&#xff0c;这里以目前最新版2.2.3为例子,下载后解压 单机模式 修改\nacos-server-2.2.3\nacos\bin\startup.c…

【ribbon】Ribbon的使用与原理

负载均衡介绍 负载均衡&#xff08;Load Balance&#xff09;&#xff0c;其含义就是指将负载&#xff08;工作任务&#xff09;进行平衡、分摊到多个操作单元上进行运行&#xff0c;例如FTP服务器、Web服务器、企业核心应用服务器和其它主要任务服务器等&#xff0c;从而协同…

【全方位解析】如何获取客户端/服务端真实 IP

一、应用场景 1.比如在投票系统开发中&#xff0c;为了防止刷票&#xff0c;我们需要限制每个 IP 地址只能投票一次 2.当网站受到诸如 DDoS&#xff08;Distributed Denial of Service&#xff0c;分布式拒绝服务攻击&#xff09;等攻击时&#xff0c;我们需要快速定位攻击者…

星火汇聚丨高效行动,决胜2023!

7月6日至10日&#xff0c;数字韧性领域标杆企业同创永益营销体系大会在长沙召开&#xff0c;闪耀在全国各地的销售之星集结汇聚。本次大会历时四天&#xff0c;包含营销全员大会、各行业业委会专场会议、销售大比武等业务实践议程&#xff0c;以及飞盘竞技、走进毛泽东故居韶山…

【收藏】用Vue.js来构建你的Web3应用,就像开发 Web2 一样熟悉

作为一名涉足去中心化网络的前端 JavaScript 开发人员&#xff0c;您可能遇到过许多 Web3 开发解决方案。但是&#xff0c;这些解决方案通常侧重于钱包集成和交易执行&#xff0c;这就造成了学习曲线&#xff0c;偏离了熟悉的 Web2 开发体验。 但不用担心&#xff01;有一种解…

ip、域名、DNS、CDN概念

1、概念 ip地址 在网络世界里, 一台服务器或者说一台网络设备对应着一个ip地址, 如果我们需要访问指定的网络设备的资源, 那么我们就需要知道这个ip地址, 然后才能去访问它. 这就好像, 我想去朋友家里, 我必须先知道他家的住址, 才能去拜访它. 在互联网世界中, 所有的通信都是…

Docker数据管理与Dockerfile

目录 Docker 的数据管理 1&#xff0e;数据卷 2&#xff0e;数据卷容器 端口映射 容器互联&#xff08;使用centos镜像&#xff09; Docker 镜像的创建 1&#xff0e;基于现有镜像创建 2&#xff0e;基于本地模板创建 3&#xff0e;基于Dockerfile 创建 联合文件系统…

亚马逊会员日过后站内站外怎么做?

在亚马逊的会员日活动中&#xff0c;众多品牌商家都参与了进来&#xff0c;通过优惠力度和活动策划提高了销售额。但是&#xff0c;会员日过后&#xff0c;如何保持销售增长和用户粘性&#xff0c;需要品牌商家在站内和站外进行策略优化。 一、站内优化 1、提高产品质量的同时…

【Nodejs】Express模板使用

1.Express脚手架的安装 安装Express脚手架有两种方式&#xff1a; 使用express-generator安装 使用命令行进入项目目录&#xff0c;依次执行&#xff1a; cnpm i -g express-generator可通过express -h查看命令行的指令含义 express -hUsage: express [options] [dir] Optio…

28.JavaWeb-Elasticsearch

1.Elasticsearch概述 Elasticsearch 是一个分布式的全文检索引擎。采用Java语言开发&#xff0c;基于Apache协议的开源项目&#xff0c;具有实时搜索&#xff0c;稳定&#xff0c;可靠&#xff0c;快速的特点。 1.1 全文检索引擎 分为通用搜索引擎&#xff08;百度、谷歌&…