Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
91290f0d
Commit
91290f0d
authored
Jan 14, 2019
by
Juan Linietsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a flag to specify an exported node path must be supplied from scene root, fixes #24412
parent
6f884cc8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
10 deletions
+17
-10
object.h
core/object.h
+1
-0
editor_properties.cpp
editor/editor_properties.cpp
+13
-8
editor_properties.h
editor/editor_properties.h
+2
-1
viewport.cpp
scene/main/viewport.cpp
+1
-1
No files found.
core/object.h
View file @
91290f0d
...
...
@@ -118,6 +118,7 @@ enum PropertyUsageFlags {
PROPERTY_USAGE_INTERNAL
=
1
<<
20
,
PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE
=
1
<<
21
,
// If the object is duplicated also this property will be duplicated
PROPERTY_USAGE_HIGH_END_GFX
=
1
<<
22
,
PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT
=
1
<<
23
,
PROPERTY_USAGE_DEFAULT
=
PROPERTY_USAGE_STORAGE
|
PROPERTY_USAGE_EDITOR
|
PROPERTY_USAGE_NETWORK
,
PROPERTY_USAGE_DEFAULT_INTL
=
PROPERTY_USAGE_STORAGE
|
PROPERTY_USAGE_EDITOR
|
PROPERTY_USAGE_NETWORK
|
PROPERTY_USAGE_INTERNATIONALIZED
,
...
...
editor/editor_properties.cpp
View file @
91290f0d
...
...
@@ -1828,11 +1828,14 @@ void EditorPropertyNodePath::_node_selected(const NodePath &p_path) {
NodePath
path
=
p_path
;
Node
*
base_node
=
Object
::
cast_to
<
Node
>
(
get_edited_object
());
if
(
!
base_node
)
{
//try a base node within history
if
(
EditorNode
::
get_singleton
()
->
get_editor_history
()
->
get_path_size
()
>
0
)
{
Object
*
base
=
ObjectDB
::
get_instance
(
EditorNode
::
get_singleton
()
->
get_editor_history
()
->
get_path_object
(
0
));
if
(
base
)
{
base_node
=
Object
::
cast_to
<
Node
>
(
base
);
if
(
guess_path_from_editor_history
)
{
//try a base node within history
if
(
EditorNode
::
get_singleton
()
->
get_editor_history
()
->
get_path_size
()
>
0
)
{
Object
*
base
=
ObjectDB
::
get_instance
(
EditorNode
::
get_singleton
()
->
get_editor_history
()
->
get_path_object
(
0
));
if
(
base
)
{
base_node
=
Object
::
cast_to
<
Node
>
(
base
);
}
}
}
}
...
...
@@ -1912,10 +1915,11 @@ void EditorPropertyNodePath::update_property() {
assign
->
set_icon
(
EditorNode
::
get_singleton
()
->
get_object_icon
(
target_node
,
"Node"
));
}
void
EditorPropertyNodePath
::
setup
(
const
NodePath
&
p_base_hint
,
Vector
<
StringName
>
p_valid_types
)
{
void
EditorPropertyNodePath
::
setup
(
const
NodePath
&
p_base_hint
,
Vector
<
StringName
>
p_valid_types
,
bool
p_guess_path_from_editor_history
)
{
base_hint
=
p_base_hint
;
valid_types
=
p_valid_types
;
guess_path_from_editor_history
=
guess_path_from_editor_history
;
}
void
EditorPropertyNodePath
::
_notification
(
int
p_what
)
{
...
...
@@ -1948,6 +1952,7 @@ EditorPropertyNodePath::EditorPropertyNodePath() {
clear
->
set_flat
(
true
);
clear
->
connect
(
"pressed"
,
this
,
"_node_clear"
);
hbc
->
add_child
(
clear
);
guess_path_from_editor_history
=
false
;
scene_tree
=
NULL
;
//do not allocate unnecessarily
}
...
...
@@ -3124,12 +3129,12 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
EditorPropertyNodePath
*
editor
=
memnew
(
EditorPropertyNodePath
);
if
(
p_hint
==
PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE
&&
p_hint_text
!=
String
())
{
editor
->
setup
(
p_hint_text
,
Vector
<
StringName
>
());
editor
->
setup
(
p_hint_text
,
Vector
<
StringName
>
()
,
!
(
p_usage
&
PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT
)
);
}
if
(
p_hint
==
PROPERTY_HINT_NODE_PATH_VALID_TYPES
&&
p_hint_text
!=
String
())
{
Vector
<
String
>
types
=
p_hint_text
.
split
(
","
,
false
);
Vector
<
StringName
>
sn
=
Variant
(
types
);
//convert via variant
editor
->
setup
(
NodePath
(),
sn
);
editor
->
setup
(
NodePath
(),
sn
,
!
(
p_usage
&
PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT
)
);
}
add_property_editor
(
p_path
,
editor
);
...
...
editor/editor_properties.h
View file @
91290f0d
...
...
@@ -499,6 +499,7 @@ class EditorPropertyNodePath : public EditorProperty {
Button
*
clear
;
SceneTreeDialog
*
scene_tree
;
NodePath
base_hint
;
bool
guess_path_from_editor_history
;
Vector
<
StringName
>
valid_types
;
void
_node_selected
(
const
NodePath
&
p_path
);
...
...
@@ -511,7 +512,7 @@ protected:
public
:
virtual
void
update_property
();
void
setup
(
const
NodePath
&
p_base_hint
,
Vector
<
StringName
>
p_valid_types
);
void
setup
(
const
NodePath
&
p_base_hint
,
Vector
<
StringName
>
p_valid_types
,
bool
p_guess_path_from_editor_history
=
true
);
EditorPropertyNodePath
();
};
...
...
scene/main/viewport.cpp
View file @
91290f0d
...
...
@@ -148,7 +148,7 @@ void ViewportTexture::_bind_methods() {
ClassDB
::
bind_method
(
D_METHOD
(
"set_viewport_path_in_scene"
,
"path"
),
&
ViewportTexture
::
set_viewport_path_in_scene
);
ClassDB
::
bind_method
(
D_METHOD
(
"get_viewport_path_in_scene"
),
&
ViewportTexture
::
get_viewport_path_in_scene
);
ADD_PROPERTY
(
PropertyInfo
(
Variant
::
NODE_PATH
,
"viewport_path"
,
PROPERTY_HINT_NODE_PATH_VALID_TYPES
,
"Viewport"
),
"set_viewport_path_in_scene"
,
"get_viewport_path_in_scene"
);
ADD_PROPERTY
(
PropertyInfo
(
Variant
::
NODE_PATH
,
"viewport_path"
,
PROPERTY_HINT_NODE_PATH_VALID_TYPES
,
"Viewport"
,
PROPERTY_USAGE_DEFAULT
|
PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT
),
"set_viewport_path_in_scene"
,
"get_viewport_path_in_scene"
);
}
ViewportTexture
::
ViewportTexture
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment