1
1
## ############################################################################
2
- # Copyright (C) 2021 Daylily-Zeleen daylily-zeleen@foxmail.com.
3
- #
2
+ # Copyright (C) 2021 Daylily-Zeleen daylily-zeleen@foxmail.com.
3
+ #
4
4
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
5
5
#
6
- # Hirerarchical Finite State Machine(HFSM - Full Version).
6
+ # Hirerarchical Finite State Machine - Trial Version (HFSM - Trial Version)
7
7
#
8
8
#
9
- # This file is part of HFSM - Full Version.
10
- # *
11
- # HFSM - Full Version is a Godot Plugin that can be used freely except in any
12
- # form of dissemination, but the premise is to donate to plugin developers.
13
- # Please refer to LISENCES.md for more information.
14
- #
15
- # HFSM - Full Version是一个除了以任何形式传播之外可以自由使用的Godot插件,前提是向插件开
16
- # 发者进行捐赠,具体许可信息请见 LISENCES.md.
9
+ # This file is part of HFSM - Trial Version.
10
+ #
11
+ # HFSM -Triabl Version is free Godot Plugin: you can redistribute it and/or
12
+ # modify it under the terms of the GNU Lesser General Public License as published
13
+ # by the Free Software Foundation, either version 3 of the License, or
14
+ # (at your option) any later version.
15
+ #
16
+ # HFSM -Triabl Version is distributed in the hope that it will be useful,
17
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+ # GNU Lesser General Public License for more details.
20
+ #
21
+ # You should have received a copy of the GNU Lesser General Public License
22
+ # along with HFSM -Triabl Version. If not, see <http://www.gnu.org/licenses/>. *
17
23
#
18
- # This is HFSM‘s full version ,But there are only a few more unnecessary features
19
- # than the trial version(please read the READEME.md to learn difference.).If this
20
- # plugin is useful for you,please consider to support me by getting the full version.
21
- # If you do not want to donate,please consider to use the trial version.
24
+ # HFSM -Triabl Version是一个自由Godot插件,您可以自由分发、修改其中的源
25
+ # 代码或者重新发布它,新的任何修改后的重新发布版必须同样在遵守LGPL3或更后续的
26
+ # 版本协议下发布.关于LGPL协议的细则请参考COPYING、COPYING.LESSER文件,
27
+ # 您可以在HFSM -Triabl Version的相关目录中获得LGPL协议的副本,
28
+ # 如果没有找到,请连接到 http://www.gnu.org/licenses/ 查看。
22
29
#
23
- # 虽然称为HFSM的完整版本,但仅比试用版本多了少许非必要的功能(请阅读README.md了解他们的差异)。
24
- # 如果这个插件对您有帮助,请考虑通过获取完整版本来支持插件开发者,如果您不想进行捐赠,请考虑使
25
- # 用试用版本。
26
30
#
27
- # Trail version link :
28
- # https://gitee.com/y3y3y3y33/HierarchicalFiniteStateMachine
29
- # https://github.com/Daylily-Zeleen/HierarchicalFiniteStateMachine
30
- # Sponsor link :
31
+ # This is HFSM‘s triable version ,but it contain almost features of the full version
32
+ # (please read the READEME.md to learn difference.).If this plugin is useful for you,
33
+ # please consider to support me by getting the full version.
34
+ #
35
+ # 虽然这是HFSM的试用版本,但是几乎包含了完整版本的所有功能(请阅读README.md了解他们的差异)。如果这个
36
+ # 插件对您有帮助,请考虑通过获取完整版本来支持我。
37
+ #
38
+ # Sponsor link (赞助链接):
31
39
# https://afdian.net/@Daylily-Zeleen
32
- # https://godotmarketplace.com/?post_type=product&p=37138
40
+ # https://godotmarketplace.com/?post_type=product&p=37138
41
+ #
33
42
#
34
- # @author Daylily-Zeleen
35
- # @email daylily-zeleen@foxmail.com
36
- # @version 0.8 (版本号)
37
- # @license Custom License(Read LISENCES.TXT for more details)
43
+ # @author Daylily-Zeleen
44
+ # @email daylily-zeleen@foxmail.com. @qq.com
45
+ # @version 0.9 (版本号)
46
+ # @license GNU Lesser General Public License v3.0 (LGPL-3.0)
38
47
#
39
48
# ----------------------------------------------------------------------------
40
49
# Remark :
43
52
# <Date> | <Version> | <Author> | <Description>
44
53
# ----------------------------------------------------------------------------
45
54
# 2021/04/14 | 0.1 | Daylily-Zeleen | Create file
46
- # 2021/07/2 | 0.8 | Daylily-Zeleen | Support script transition
55
+ # 2021/07/2 | 0.8 | Daylily-Zeleen | Support script transition(full version)
56
+ # 2021/09/18 | 0.9 | Daylily-Zeleen | fix trail version bug: can't change transition type.
47
57
# ----------------------------------------------------------------------------
48
58
#
49
59
## ############################################################################
@@ -153,13 +163,6 @@ func _set_variable_expression_res_list(res_list:Array) :
153
163
func _get_variable_expression_res_list ():
154
164
return inspector_res .variable_condition_res .variable_expression_res_list
155
165
156
- # ----------------------script condition properties---------------------------------
157
- var script_condition_res :NestedFsmRes .TransitionRes .ScriptConditionRes setget _set_script_condition_res , _get_script_condition_res
158
- func _set_script_condition_res (v ):
159
- inspector_res .script_condition_res = v
160
- _uptate_transition_comment ()
161
- func _get_script_condition_res ():
162
- return inspector_res .script_condition_res
163
166
164
167
165
168
onready var auto_mode_button :OptionButton = get_node ("Editor/AutoEditor/Panel/VBoxContainer/Title/AutoModeButton" )
@@ -198,19 +201,13 @@ func delete_variable_expression_and_res(variable_expression_res :VariableExpress
198
201
(c as VariableExpressionEditor ).delete_self ()
199
202
200
203
201
- func init (_inspector_res :TransitflowInspectorRes , script_picker :EditorScriptPicker ):
202
- get_node ("Editor/ScriptEditior/VBoxContainer/HBoxContainer" ).add_child (script_picker )
203
- script_picker .size_flags_horizontal = SIZE_EXPAND_FILL
204
- # script_picker.script_owner = self
205
- script_picker .connect ("resource_changed" ,self ,"_on_condition_script_changed" )
206
-
204
+ func init (_inspector_res :TransitflowInspectorRes ):
207
205
self .inspector_res = _inspector_res
208
206
undo_redo = inspector_res .transit_flow .undo_redo
209
207
message = inspector_res .transit_flow .message
210
208
if not is_inside_tree () :
211
209
yield (self ,"ready" )
212
210
# type
213
- get_node ("Editor/ScriptEditior" ).visible = true if inspector_res .transition_type == HfsmConstant .TRANSITION_TYPE_SCRIPT else false
214
211
get_node ("Editor/ExpressionEditior" ).visible = true if inspector_res .transition_type == HfsmConstant .TRANSITION_TYPE_EXPRESSION else false
215
212
216
213
get_node ("Editor/VariableEditor" ).visible = true if inspector_res .transition_type == HfsmConstant .TRANSITION_TYPE_VARIABLE else false
@@ -219,8 +216,6 @@ func init(_inspector_res :TransitflowInspectorRes, script_picker:EditorScriptPic
219
216
get_node ("Editor/AutoEditor" ).visible = true if inspector_res .transition_type == HfsmConstant .TRANSITION_TYPE_AUTO else false
220
217
get_node ("Editor/AutoEditor/Panel/VBoxContainer/TipLabel" ).text = _get_tip_text (inspector_res .transition_type )
221
218
222
- # script
223
- script_picker .edited_resource = inspector_res .script_condition_res .condition_script
224
219
# get_node()
225
220
transition_type_button .select (inspector_res .transition_type )
226
221
# auto
@@ -328,8 +323,9 @@ func action_set_transition_type(old_type , new_type):
328
323
undo_redo .create_action ("Set transition_type" )
329
324
330
325
undo_redo .add_do_method (message ,"set_redo_history" ,Message .History .SET_TRANSITION_TYPE )
331
- undo_redo .add_do_property (inspector_res , "transition_type" , new_type )
332
- undo_redo .add_do_property (get_node ("Editor/ScriptEditior" ) , "visible" ,true if new_type == HfsmConstant .TRANSITION_TYPE_SCRIPT else false )
326
+ undo_redo .add_do_property (inspector_res , "transition_type" , new_type )
327
+ if get_node_or_null ("Editor/ScriptEditior" ):
328
+ undo_redo .add_do_property (get_node ("Editor/ScriptEditior" ) , "visible" ,true if new_type == HfsmConstant .TRANSITION_TYPE_SCRIPT else false )
333
329
undo_redo .add_do_property (get_node ("Editor/ExpressionEditior" ) , "visible" ,true if new_type == HfsmConstant .TRANSITION_TYPE_EXPRESSION else false )
334
330
undo_redo .add_do_property (get_node ("Editor/VariableEditor" ) , "visible" ,true if new_type == HfsmConstant .TRANSITION_TYPE_VARIABLE else false )
335
331
undo_redo .add_do_property (get_node ("Editor/AutoEditor" ) , "visible" ,true if new_type == HfsmConstant .TRANSITION_TYPE_AUTO else false )
@@ -341,7 +337,8 @@ func action_set_transition_type(old_type , new_type):
341
337
342
338
undo_redo .add_undo_method (message ,"set_undo_history" ,Message .History .SET_TRANSITION_TYPE )
343
339
undo_redo .add_undo_property (inspector_res , "transition_type" , old_type )
344
- undo_redo .add_undo_property (get_node ("Editor/ScriptEditior" ) , "visible" ,true if old_type == HfsmConstant .TRANSITION_TYPE_SCRIPT else false )
340
+ if get_node_or_null ("Editor/ScriptEditior" ):
341
+ undo_redo .add_undo_property (get_node ("Editor/ScriptEditior" ) , "visible" ,true if old_type == HfsmConstant .TRANSITION_TYPE_SCRIPT else false )
345
342
undo_redo .add_undo_property (get_node ("Editor/ExpressionEditior" ) , "visible" ,true if old_type == HfsmConstant .TRANSITION_TYPE_EXPRESSION else false )
346
343
undo_redo .add_undo_property (get_node ("Editor/VariableEditor" ) , "visible" ,true if old_type == HfsmConstant .TRANSITION_TYPE_VARIABLE else false )
347
344
undo_redo .add_undo_property (get_node ("Editor/AutoEditor" ) , "visible" ,true if old_type == HfsmConstant .TRANSITION_TYPE_AUTO else false )
@@ -441,16 +438,7 @@ func action_set_variable_condition_operate_mode(old_mode , new_mode):
441
438
undo_redo .commit_action ()
442
439
message .set_history (Message .History .SET_VARIABLE_CONDITION_OPERATION_MODE )
443
440
444
- func action_set_condition_script (old_script , new_script ):
445
- undo_redo .create_action ("Set condition_script" )
446
- undo_redo .add_do_method (message ,"set_redo_history" ,Message .History .SET_CONDITION_SCRIPT )
447
- undo_redo .add_do_property (inspector_res .script_condition_res , "condition_script" , new_script )
448
- undo_redo .add_do_method (inspector_res , "update_comment" )
449
- undo_redo .add_undo_method (message ,"set_undo_history" ,Message .History .SET_CONDITION_SCRIPT )
450
- undo_redo .add_undo_property (inspector_res .script_condition_res , "condition_script" , old_script )
451
- undo_redo .add_undo_method (inspector_res , "update_comment" )
452
- undo_redo .commit_action ()
453
- message .set_history (Message .History .SET_CONDITION_SCRIPT )
441
+
454
442
455
443
func _on_VariableExpressionEditorList_gui_input (event ):
456
444
if event is InputEventMouseButton :
@@ -465,7 +453,4 @@ func _on_FoldButton_toggled(button_pressed):
465
453
if c is VariableExpressionEditor :
466
454
c .is_fold = button_pressed
467
455
468
- func _on_condition_script_changed (script : Script )-> void :
469
- if not is_instance_valid (script ) or script is GDScript or script .get_class () == "CSharpScript" :
470
- action_set_condition_script (_get_script_condition_res ().condition_script , script )
471
456
0 commit comments