-Work in progress visual shader editor *DOES NOT WORK YET*
This commit is contained in:
parent
eb1f978b1c
commit
fbdd925d9b
|
@ -178,6 +178,7 @@ public:
|
|||
#ifdef DEBUG_METHODS_ENABLED
|
||||
|
||||
_FORCE_INLINE_ void set_return_type(const StringName& p_type) { ret_type=p_type; }
|
||||
_FORCE_INLINE_ StringName get_return_type() const { return ret_type; }
|
||||
|
||||
_FORCE_INLINE_ Variant::Type get_argument_type(int p_argument) const {
|
||||
|
||||
|
|
|
@ -191,6 +191,7 @@ MethodDefinition _MD(const char* p_name,const char *p_arg1,const char *p_arg2,co
|
|||
|
||||
HashMap<StringName,ObjectTypeDB::TypeInfo,StringNameHasher> ObjectTypeDB::types;
|
||||
HashMap<StringName,StringName,StringNameHasher> ObjectTypeDB::resource_base_extensions;
|
||||
HashMap<StringName,StringName,StringNameHasher> ObjectTypeDB::compat_types;
|
||||
|
||||
ObjectTypeDB::TypeInfo::TypeInfo() {
|
||||
|
||||
|
@ -263,12 +264,22 @@ bool ObjectTypeDB::type_exists(const String &p_type) {
|
|||
return types.has(p_type);
|
||||
}
|
||||
|
||||
void ObjectTypeDB::add_compatibility_type(const StringName& p_type,const StringName& p_fallback) {
|
||||
|
||||
compat_types[p_type]=p_fallback;
|
||||
}
|
||||
|
||||
Object *ObjectTypeDB::instance(const String &p_type) {
|
||||
|
||||
TypeInfo *ti;
|
||||
{
|
||||
OBJTYPE_LOCK;
|
||||
ti=types.getptr(p_type);
|
||||
if (!ti || ti->disabled || !ti->creation_func) {
|
||||
if (compat_types.has(p_type)) {
|
||||
ti=types.getptr(compat_types[p_type]);
|
||||
}
|
||||
}
|
||||
ERR_FAIL_COND_V(!ti,NULL);
|
||||
ERR_FAIL_COND_V(ti->disabled,NULL);
|
||||
ERR_FAIL_COND_V(!ti->creation_func,NULL);
|
||||
|
@ -914,6 +925,7 @@ void ObjectTypeDB::cleanup() {
|
|||
}
|
||||
types.clear();
|
||||
resource_base_extensions.clear();
|
||||
compat_types.clear();
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -151,6 +151,7 @@ class ObjectTypeDB {
|
|||
static Mutex *lock;
|
||||
static HashMap<StringName,TypeInfo,StringNameHasher> types;
|
||||
static HashMap<StringName,StringName,StringNameHasher> resource_base_extensions;
|
||||
static HashMap<StringName,StringName,StringNameHasher> compat_types;
|
||||
|
||||
#ifdef DEBUG_METHODS_ENABLED
|
||||
static MethodBind* bind_methodfi(uint32_t p_flags, MethodBind *p_bind , const MethodDefinition &method_name, const Variant **p_defs, int p_defcount);
|
||||
|
@ -482,6 +483,7 @@ public:
|
|||
static void get_resource_base_extensions(List<String> *p_extensions);
|
||||
static void get_extensions_for_type(const StringName& p_type,List<String> *p_extensions);
|
||||
|
||||
static void add_compatibility_type(const StringName& p_type,const StringName& p_fallback);
|
||||
static void init();
|
||||
static void cleanup();
|
||||
};
|
||||
|
|
|
@ -53,12 +53,15 @@ var enemy
|
|||
|
||||
func _integrate_forces(s):
|
||||
|
||||
|
||||
|
||||
var lv = s.get_linear_velocity()
|
||||
var step = s.get_step()
|
||||
|
||||
var new_anim=anim
|
||||
var new_siding_left=siding_left
|
||||
|
||||
|
||||
# Get the controls
|
||||
var move_left = Input.is_action_pressed("move_left")
|
||||
var move_right = Input.is_action_pressed("move_right")
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<resource_file type="PackedScene" subresource_count="24" version="1.0" version_name="Godot Engine v1.0.3917-beta1">
|
||||
<resource_file type="PackedScene" subresource_count="24" version="1.0" version_name="Godot Engine v1.0.rc2.custom_build">
|
||||
<ext_resource path="res://osb_jump.png" type="Texture"></ext_resource>
|
||||
<ext_resource path="res://bullet.png" type="Texture"></ext_resource>
|
||||
<ext_resource path="res://osb_right.png" type="Texture"></ext_resource>
|
||||
<ext_resource path="res://sound_coin.wav" type="Sample"></ext_resource>
|
||||
<ext_resource path="res://sound_shoot.wav" type="Sample"></ext_resource>
|
||||
<ext_resource path="res://osb_fire.png" type="Texture"></ext_resource>
|
||||
<ext_resource path="res://robot_demo.png" type="Texture"></ext_resource>
|
||||
<ext_resource path="res://sound_shoot.wav" type="Sample"></ext_resource>
|
||||
<ext_resource path="res://osb_left.png" type="Texture"></ext_resource>
|
||||
<ext_resource path="res://robot_demo.png" type="Texture"></ext_resource>
|
||||
<ext_resource path="res://player.gd" type="Script"></ext_resource>
|
||||
<ext_resource path="res://sound_jump.wav" type="Sample"></ext_resource>
|
||||
<resource type="RayShape2D" path="local://1">
|
||||
|
@ -50,7 +50,52 @@
|
|||
|
||||
</resource>
|
||||
<resource type="Animation" path="local://4">
|
||||
<string name="resource/name"> "run" </string>
|
||||
<string name="resource/name"> "jumping" </string>
|
||||
<real name="length"> 0.5 </real>
|
||||
<bool name="loop"> True </bool>
|
||||
<real name="step"> 0.25 </real>
|
||||
<string name="tracks/0/type"> "value" </string>
|
||||
<node_path name="tracks/0/path"> "sprite:frame" </node_path>
|
||||
<int name="tracks/0/interp"> 1 </int>
|
||||
<dictionary name="tracks/0/keys" shared="false">
|
||||
<string> "cont" </string>
|
||||
<bool> False </bool>
|
||||
<string> "transitions" </string>
|
||||
<real_array len="3"> 1, 1, 1 </real_array>
|
||||
<string> "values" </string>
|
||||
<array len="3" shared="false">
|
||||
<int> 23 </int>
|
||||
<int> 24 </int>
|
||||
<int> 23 </int>
|
||||
</array>
|
||||
<string> "times" </string>
|
||||
<real_array len="3"> 0, 0.25, 0.5 </real_array>
|
||||
</dictionary>
|
||||
|
||||
</resource>
|
||||
<resource type="Animation" path="local://5">
|
||||
<string name="resource/name"> "idle_weapon" </string>
|
||||
<real name="length"> 0.5 </real>
|
||||
<bool name="loop"> True </bool>
|
||||
<real name="step"> 0.25 </real>
|
||||
<string name="tracks/0/type"> "value" </string>
|
||||
<node_path name="tracks/0/path"> "sprite:frame" </node_path>
|
||||
<int name="tracks/0/interp"> 1 </int>
|
||||
<dictionary name="tracks/0/keys" shared="false">
|
||||
<string> "cont" </string>
|
||||
<bool> False </bool>
|
||||
<string> "transitions" </string>
|
||||
<real_array len="1"> 1 </real_array>
|
||||
<string> "values" </string>
|
||||
<array len="1" shared="false">
|
||||
<int> 25 </int>
|
||||
</array>
|
||||
<string> "times" </string>
|
||||
<real_array len="1"> 0 </real_array>
|
||||
</dictionary>
|
||||
|
||||
</resource>
|
||||
<resource type="Animation" path="local://6">
|
||||
<real name="length"> 1.25 </real>
|
||||
<bool name="loop"> True </bool>
|
||||
<real name="step"> 0.25 </real>
|
||||
|
@ -75,55 +120,6 @@
|
|||
<real_array len="6"> 0, 0.25, 0.5, 0.75, 1, 1.25 </real_array>
|
||||
</dictionary>
|
||||
|
||||
</resource>
|
||||
<resource type="Animation" path="local://5">
|
||||
<string name="resource/name"> "run_gun_fire" </string>
|
||||
<real name="length"> 1.25 </real>
|
||||
<bool name="loop"> True </bool>
|
||||
<real name="step"> 0.25 </real>
|
||||
<string name="tracks/0/type"> "value" </string>
|
||||
<node_path name="tracks/0/path"> "sprite:frame" </node_path>
|
||||
<int name="tracks/0/interp"> 1 </int>
|
||||
<dictionary name="tracks/0/keys" shared="false">
|
||||
<string> "cont" </string>
|
||||
<bool> False </bool>
|
||||
<string> "transitions" </string>
|
||||
<real_array len="6"> 1, 1, 1, 1, 1, 1 </real_array>
|
||||
<string> "values" </string>
|
||||
<array len="6" shared="false">
|
||||
<int> 10 </int>
|
||||
<int> 11 </int>
|
||||
<int> 12 </int>
|
||||
<int> 13 </int>
|
||||
<int> 14 </int>
|
||||
<int> 5 </int>
|
||||
</array>
|
||||
<string> "times" </string>
|
||||
<real_array len="6"> 0, 0.25, 0.5, 0.75, 1, 1.25 </real_array>
|
||||
</dictionary>
|
||||
|
||||
</resource>
|
||||
<resource type="Animation" path="local://6">
|
||||
<string name="resource/name"> "jumping_weapon" </string>
|
||||
<real name="length"> 0.5 </real>
|
||||
<bool name="loop"> True </bool>
|
||||
<real name="step"> 0.25 </real>
|
||||
<string name="tracks/0/type"> "value" </string>
|
||||
<node_path name="tracks/0/path"> "sprite:frame" </node_path>
|
||||
<int name="tracks/0/interp"> 1 </int>
|
||||
<dictionary name="tracks/0/keys" shared="false">
|
||||
<string> "cont" </string>
|
||||
<bool> False </bool>
|
||||
<string> "transitions" </string>
|
||||
<real_array len="1"> 1 </real_array>
|
||||
<string> "values" </string>
|
||||
<array len="1" shared="false">
|
||||
<int> 26 </int>
|
||||
</array>
|
||||
<string> "times" </string>
|
||||
<real_array len="1"> 0 </real_array>
|
||||
</dictionary>
|
||||
|
||||
</resource>
|
||||
<resource type="Animation" path="local://7">
|
||||
<string name="resource/name"> "crouch" </string>
|
||||
|
@ -148,7 +144,55 @@
|
|||
|
||||
</resource>
|
||||
<resource type="Animation" path="local://8">
|
||||
<string name="resource/name"> "jumping" </string>
|
||||
<string name="resource/name"> "falling" </string>
|
||||
<real name="length"> 0.01 </real>
|
||||
<bool name="loop"> True </bool>
|
||||
<real name="step"> 0.25 </real>
|
||||
<string name="tracks/0/type"> "value" </string>
|
||||
<node_path name="tracks/0/path"> "sprite:frame" </node_path>
|
||||
<int name="tracks/0/interp"> 1 </int>
|
||||
<dictionary name="tracks/0/keys" shared="false">
|
||||
<string> "cont" </string>
|
||||
<bool> False </bool>
|
||||
<string> "transitions" </string>
|
||||
<real_array len="1"> 1 </real_array>
|
||||
<string> "values" </string>
|
||||
<array len="1" shared="false">
|
||||
<int> 21 </int>
|
||||
</array>
|
||||
<string> "times" </string>
|
||||
<real_array len="1"> 0 </real_array>
|
||||
</dictionary>
|
||||
|
||||
</resource>
|
||||
<resource type="Animation" path="local://9">
|
||||
<real name="length"> 1.25 </real>
|
||||
<bool name="loop"> True </bool>
|
||||
<real name="step"> 0.25 </real>
|
||||
<string name="tracks/0/type"> "value" </string>
|
||||
<node_path name="tracks/0/path"> "sprite:frame" </node_path>
|
||||
<int name="tracks/0/interp"> 1 </int>
|
||||
<dictionary name="tracks/0/keys" shared="false">
|
||||
<string> "cont" </string>
|
||||
<bool> False </bool>
|
||||
<string> "transitions" </string>
|
||||
<real_array len="6"> 1, 1, 1, 1, 1, 1 </real_array>
|
||||
<string> "values" </string>
|
||||
<array len="6" shared="false">
|
||||
<int> 10 </int>
|
||||
<int> 11 </int>
|
||||
<int> 12 </int>
|
||||
<int> 13 </int>
|
||||
<int> 14 </int>
|
||||
<int> 5 </int>
|
||||
</array>
|
||||
<string> "times" </string>
|
||||
<real_array len="6"> 0, 0.25, 0.5, 0.75, 1, 1.25 </real_array>
|
||||
</dictionary>
|
||||
|
||||
</resource>
|
||||
<resource type="Animation" path="local://10">
|
||||
<string name="resource/name"> "falling_weapon" </string>
|
||||
<real name="length"> 0.5 </real>
|
||||
<bool name="loop"> True </bool>
|
||||
<real name="step"> 0.25 </real>
|
||||
|
@ -159,20 +203,17 @@
|
|||
<string> "cont" </string>
|
||||
<bool> False </bool>
|
||||
<string> "transitions" </string>
|
||||
<real_array len="3"> 1, 1, 1 </real_array>
|
||||
<real_array len="1"> 1 </real_array>
|
||||
<string> "values" </string>
|
||||
<array len="3" shared="false">
|
||||
<int> 23 </int>
|
||||
<int> 24 </int>
|
||||
<int> 23 </int>
|
||||
<array len="1" shared="false">
|
||||
<int> 26 </int>
|
||||
</array>
|
||||
<string> "times" </string>
|
||||
<real_array len="3"> 0, 0.25, 0.5 </real_array>
|
||||
<real_array len="1"> 0 </real_array>
|
||||
</dictionary>
|
||||
|
||||
</resource>
|
||||
<resource type="Animation" path="local://9">
|
||||
<string name="resource/name"> "run_weapon" </string>
|
||||
<resource type="Animation" path="local://11">
|
||||
<real name="length"> 1.25 </real>
|
||||
<bool name="loop"> True </bool>
|
||||
<real name="step"> 0.25 </real>
|
||||
|
@ -198,30 +239,7 @@
|
|||
</dictionary>
|
||||
|
||||
</resource>
|
||||
<resource type="Animation" path="local://10">
|
||||
<string name="resource/name"> "idle_weapon" </string>
|
||||
<real name="length"> 0.5 </real>
|
||||
<bool name="loop"> True </bool>
|
||||
<real name="step"> 0.25 </real>
|
||||
<string name="tracks/0/type"> "value" </string>
|
||||
<node_path name="tracks/0/path"> "sprite:frame" </node_path>
|
||||
<int name="tracks/0/interp"> 1 </int>
|
||||
<dictionary name="tracks/0/keys" shared="false">
|
||||
<string> "cont" </string>
|
||||
<bool> False </bool>
|
||||
<string> "transitions" </string>
|
||||
<real_array len="1"> 1 </real_array>
|
||||
<string> "values" </string>
|
||||
<array len="1" shared="false">
|
||||
<int> 25 </int>
|
||||
</array>
|
||||
<string> "times" </string>
|
||||
<real_array len="1"> 0 </real_array>
|
||||
</dictionary>
|
||||
|
||||
</resource>
|
||||
<resource type="Animation" path="local://11">
|
||||
<string name="resource/name"> "falling_weapon" </string>
|
||||
<resource type="Animation" path="local://12">
|
||||
<real name="length"> 0.5 </real>
|
||||
<bool name="loop"> True </bool>
|
||||
<real name="step"> 0.25 </real>
|
||||
|
@ -241,28 +259,6 @@
|
|||
<real_array len="1"> 0 </real_array>
|
||||
</dictionary>
|
||||
|
||||
</resource>
|
||||
<resource type="Animation" path="local://12">
|
||||
<string name="resource/name"> "falling" </string>
|
||||
<real name="length"> 0.01 </real>
|
||||
<bool name="loop"> True </bool>
|
||||
<real name="step"> 0.25 </real>
|
||||
<string name="tracks/0/type"> "value" </string>
|
||||
<node_path name="tracks/0/path"> "sprite:frame" </node_path>
|
||||
<int name="tracks/0/interp"> 1 </int>
|
||||
<dictionary name="tracks/0/keys" shared="false">
|
||||
<string> "cont" </string>
|
||||
<bool> False </bool>
|
||||
<string> "transitions" </string>
|
||||
<real_array len="1"> 1 </real_array>
|
||||
<string> "values" </string>
|
||||
<array len="1" shared="false">
|
||||
<int> 21 </int>
|
||||
</array>
|
||||
<string> "times" </string>
|
||||
<real_array len="1"> 0 </real_array>
|
||||
</dictionary>
|
||||
|
||||
</resource>
|
||||
<resource type="SampleLibrary" path="local://13">
|
||||
<dictionary name="samples/jump" shared="false">
|
||||
|
@ -294,9 +290,10 @@
|
|||
<main_resource>
|
||||
<dictionary name="_bundled" shared="false">
|
||||
<string> "names" </string>
|
||||
<string_array len="170">
|
||||
<string_array len="180">
|
||||
<string> "player" </string>
|
||||
<string> "RigidBody2D" </string>
|
||||
<string> "_import_path" </string>
|
||||
<string> "visibility/visible" </string>
|
||||
<string> "visibility/opacity" </string>
|
||||
<string> "visibility/self_opacity" </string>
|
||||
|
@ -311,6 +308,7 @@
|
|||
<string> "shapes/1/shape" </string>
|
||||
<string> "shapes/1/transform" </string>
|
||||
<string> "shapes/1/trigger" </string>
|
||||
<string> "layers" </string>
|
||||
<string> "mode" </string>
|
||||
<string> "mass" </string>
|
||||
<string> "friction" </string>
|
||||
|
@ -319,7 +317,7 @@
|
|||
<string> "continuous_cd" </string>
|
||||
<string> "contacts_reported" </string>
|
||||
<string> "contact_monitor" </string>
|
||||
<string> "active" </string>
|
||||
<string> "sleeping" </string>
|
||||
<string> "can_sleep" </string>
|
||||
<string> "velocity/linear" </string>
|
||||
<string> "velocity/angular" </string>
|
||||
|
@ -354,6 +352,8 @@
|
|||
<string> "config/flip_h" </string>
|
||||
<string> "config/flip_v" </string>
|
||||
<string> "config/texture" </string>
|
||||
<string> "config/h_frames" </string>
|
||||
<string> "config/v_frames" </string>
|
||||
<string> "params/direction" </string>
|
||||
<string> "params/spread" </string>
|
||||
<string> "params/linear_velocity" </string>
|
||||
|
@ -364,9 +364,12 @@
|
|||
<string> "params/radial_accel" </string>
|
||||
<string> "params/tangential_accel" </string>
|
||||
<string> "params/damping" </string>
|
||||
<string> "params/initial_angle" </string>
|
||||
<string> "params/initial_size" </string>
|
||||
<string> "params/final_size" </string>
|
||||
<string> "params/hue_variation" </string>
|
||||
<string> "params/anim_speed_scale" </string>
|
||||
<string> "params/anim_initial_pos" </string>
|
||||
<string> "randomness/direction" </string>
|
||||
<string> "randomness/spread" </string>
|
||||
<string> "randomness/linear_velocity" </string>
|
||||
|
@ -377,9 +380,12 @@
|
|||
<string> "randomness/radial_accel" </string>
|
||||
<string> "randomness/tangential_accel" </string>
|
||||
<string> "randomness/damping" </string>
|
||||
<string> "randomness/initial_angle" </string>
|
||||
<string> "randomness/initial_size" </string>
|
||||
<string> "randomness/final_size" </string>
|
||||
<string> "randomness/hue_variation" </string>
|
||||
<string> "randomness/anim_speed_scale" </string>
|
||||
<string> "randomness/anim_initial_pos" </string>
|
||||
<string> "color_phases/count" </string>
|
||||
<string> "phase_0/pos" </string>
|
||||
<string> "phase_0/color" </string>
|
||||
|
@ -396,15 +402,15 @@
|
|||
<string> "playback/default_blend_time" </string>
|
||||
<string> "root/root" </string>
|
||||
<string> "anims/idle" </string>
|
||||
<string> "anims/run" </string>
|
||||
<string> "anims/standing_weapon_ready" </string>
|
||||
<string> "anims/jumping_weapon" </string>
|
||||
<string> "anims/crouch" </string>
|
||||
<string> "anims/jumping" </string>
|
||||
<string> "anims/run_weapon" </string>
|
||||
<string> "anims/idle_weapon" </string>
|
||||
<string> "anims/falling_weapon" </string>
|
||||
<string> "anims/run" </string>
|
||||
<string> "anims/crouch" </string>
|
||||
<string> "anims/falling" </string>
|
||||
<string> "anims/standing_weapon_ready" </string>
|
||||
<string> "anims/falling_weapon" </string>
|
||||
<string> "anims/run_weapon" </string>
|
||||
<string> "anims/jumping_weapon" </string>
|
||||
<string> "playback/active" </string>
|
||||
<string> "playback/speed" </string>
|
||||
<string> "blend_times" </string>
|
||||
|
@ -473,7 +479,8 @@
|
|||
<string> "node_count" </string>
|
||||
<int> 14 </int>
|
||||
<string> "variants" </string>
|
||||
<array len="71" shared="false">
|
||||
<array len="72" shared="false">
|
||||
<node_path> "" </node_path>
|
||||
<bool> True </bool>
|
||||
<real> 1 </real>
|
||||
<bool> False </bool>
|
||||
|
@ -485,6 +492,7 @@
|
|||
<matrix32> 1, -0, 0, 1.76469, 0.291992, -12.1587 </matrix32>
|
||||
<resource resource_type="Shape2D" path="local://2"> </resource>
|
||||
<matrix32> 1, -0, 0, 1, 0, 0 </matrix32>
|
||||
<int> 1 </int>
|
||||
<real> 3 </real>
|
||||
<int> 0 </int>
|
||||
<int> 3 </int>
|
||||
|
@ -507,11 +515,17 @@
|
|||
<bool> False </bool>
|
||||
<string> "zoom" </string>
|
||||
<real> 2.272073 </real>
|
||||
<string> "use_snap" </string>
|
||||
<bool> False </bool>
|
||||
<string> "ofs" </string>
|
||||
<vector2> -181.946, -86.2812 </vector2>
|
||||
<string> "snap" </string>
|
||||
<int> 10 </int>
|
||||
</dictionary>
|
||||
<string> "3D" </string>
|
||||
<dictionary shared="false">
|
||||
<string> "deflight_rot_y" </string>
|
||||
<real> 0.628319 </real>
|
||||
<string> "zfar" </string>
|
||||
<real> 500 </real>
|
||||
<string> "fov" </string>
|
||||
|
@ -525,10 +539,12 @@
|
|||
<real> 0 </real>
|
||||
<string> "y_rot" </string>
|
||||
<real> 0 </real>
|
||||
<string> "use_orthogonal" </string>
|
||||
<bool> False </bool>
|
||||
<string> "listener" </string>
|
||||
<bool> True </bool>
|
||||
<string> "use_environment" </string>
|
||||
<bool> False </bool>
|
||||
<string> "use_orthogonal" </string>
|
||||
<bool> False </bool>
|
||||
<string> "pos" </string>
|
||||
<vector3> 0, 0, 0 </vector3>
|
||||
</dictionary>
|
||||
|
@ -539,10 +555,12 @@
|
|||
<real> 0 </real>
|
||||
<string> "y_rot" </string>
|
||||
<real> 0 </real>
|
||||
<string> "use_orthogonal" </string>
|
||||
<string> "listener" </string>
|
||||
<bool> False </bool>
|
||||
<string> "use_environment" </string>
|
||||
<bool> False </bool>
|
||||
<string> "use_orthogonal" </string>
|
||||
<bool> False </bool>
|
||||
<string> "pos" </string>
|
||||
<vector3> 0, 0, 0 </vector3>
|
||||
</dictionary>
|
||||
|
@ -553,10 +571,12 @@
|
|||
<real> 0 </real>
|
||||
<string> "y_rot" </string>
|
||||
<real> 0 </real>
|
||||
<string> "use_orthogonal" </string>
|
||||
<string> "listener" </string>
|
||||
<bool> False </bool>
|
||||
<string> "use_environment" </string>
|
||||
<bool> False </bool>
|
||||
<string> "use_orthogonal" </string>
|
||||
<bool> False </bool>
|
||||
<string> "pos" </string>
|
||||
<vector3> 0, 0, 0 </vector3>
|
||||
</dictionary>
|
||||
|
@ -567,10 +587,12 @@
|
|||
<real> 0 </real>
|
||||
<string> "y_rot" </string>
|
||||
<real> 0 </real>
|
||||
<string> "use_orthogonal" </string>
|
||||
<string> "listener" </string>
|
||||
<bool> False </bool>
|
||||
<string> "use_environment" </string>
|
||||
<bool> False </bool>
|
||||
<string> "use_orthogonal" </string>
|
||||
<bool> False </bool>
|
||||
<string> "pos" </string>
|
||||
<vector3> 0, 0, 0 </vector3>
|
||||
</dictionary>
|
||||
|
@ -579,12 +601,18 @@
|
|||
<int> 1 </int>
|
||||
<string> "default_light" </string>
|
||||
<bool> True </bool>
|
||||
<string> "ambient_light_color" </string>
|
||||
<color> 0.15, 0.15, 0.15, 1 </color>
|
||||
<string> "show_grid" </string>
|
||||
<bool> True </bool>
|
||||
<string> "show_origin" </string>
|
||||
<bool> True </bool>
|
||||
<string> "znear" </string>
|
||||
<real> 0.1 </real>
|
||||
<string> "default_srgb" </string>
|
||||
<bool> False </bool>
|
||||
<string> "deflight_rot_x" </string>
|
||||
<real> 0.942478 </real>
|
||||
</dictionary>
|
||||
</dictionary>
|
||||
<string> "__editor_run_settings__" </string>
|
||||
|
@ -595,14 +623,13 @@
|
|||
<int> 0 </int>
|
||||
</dictionary>
|
||||
<string> "__editor_plugin_screen__" </string>
|
||||
<string> "3D" </string>
|
||||
<string> "Script" </string>
|
||||
</dictionary>
|
||||
<resource resource_type="Texture" path="res://robot_demo.png"> </resource>
|
||||
<int> 16 </int>
|
||||
<color> 1, 1, 1, 1 </color>
|
||||
<rect2> 0, 0, 0, 0 </rect2>
|
||||
<real> 0.363636 </real>
|
||||
<int> 1 </int>
|
||||
<vector2> 20.7312, 3.21187 </vector2>
|
||||
<real> 83.450417 </real>
|
||||
<int> 4 </int>
|
||||
|
@ -654,7 +681,7 @@
|
|||
<string> "shoot" </string>
|
||||
</array>
|
||||
<string> "nodes" </string>
|
||||
<int_array len="572"> -1, -1, 1, 0, -1, 28, 2, 0, 3, 1, 4, 1, 5, 2, 6, 3, 7, 4, 8, 5, 9, 6, 10, 7, 11, 8, 12, 2, 13, 9, 14, 10, 15, 2, 16, 6, 17, 11, 18, 4, 19, 4, 20, 0, 21, 12, 22, 13, 23, 2, 24, 0, 25, 0, 26, 3, 27, 4, 28, 14, 29, 15, 0, 0, 0, 31, 30, -1, 18, 2, 0, 3, 1, 4, 1, 5, 2, 6, 3, 7, 4, 8, 5, 32, 16, 33, 0, 34, 3, 35, 2, 36, 2, 37, 6, 38, 17, 39, 12, 40, 18, 41, 2, 42, 19, 0, 1, 0, 44, 43, -1, 57, 2, 0, 3, 1, 4, 20, 5, 2, 45, 21, 6, 22, 7, 23, 8, 5, 46, 24, 47, 25, 48, 1, 49, 4, 50, 25, 51, 2, 52, 3, 53, 3, 54, 2, 55, 26, 56, 2, 57, 2, 58, 27, 59, 4, 60, 28, 61, 29, 62, 1, 63, 4, 64, 4, 65, 30, 66, 4, 67, 4, 68, 4, 69, 31, 70, 31, 71, 4, 72, 4, 73, 4, 74, 4, 75, 31, 76, 4, 77, 4, 78, 4, 79, 4, 80, 4, 81, 4, 82, 4, 83, 4, 84, 4, 85, 6, 86, 4, 87, 18, 88, 1, 89, 32, 90, 1, 91, 33, 92, 1, 93, 34, 94, 35, 0, 0, 0, 96, 95, -1, 17, 97, 21, 98, 4, 99, 36, 100, 37, 101, 38, 102, 39, 103, 40, 104, 41, 105, 42, 106, 43, 107, 44, 108, 45, 109, 46, 110, 0, 111, 31, 112, 47, 113, 48, 0, 0, 0, 115, 114, -1, 22, 2, 0, 3, 1, 4, 1, 5, 2, 6, 3, 7, 4, 8, 5, 33, 0, 116, 2, 117, 0, 118, 4, 119, 5, 120, 12, 121, 12, 122, 49, 123, 49, 124, 0, 125, 0, 126, 50, 127, 50, 128, 50, 129, 50, 0, 0, 0, 131, 130, -1, 7, 2, 0, 3, 1, 4, 1, 5, 2, 6, 51, 7, 4, 8, 5, 0, 0, 0, 132, 132, -1, 9, 2, 0, 3, 1, 4, 1, 5, 2, 6, 52, 7, 4, 8, 53, 133, 7, 134, 2, 0, 0, 0, 136, 135, -1, 14, 137, 13, 138, 54, 139, 4, 140, 1, 141, 4, 142, 4, 143, 4, 144, 55, 145, 55, 146, 55, 147, 55, 148, 6, 149, 4, 150, 4, 0, 0, 0, 151, 151, -1, 9, 2, 0, 3, 1, 4, 1, 5, 2, 6, 3, 7, 4, 8, 5, 152, 12, 153, 56, 0, 0, 0, 155, 154, -1, 4, 156, 12, 34, 3, 157, 4, 158, 5, 0, 9, 0, 160, 159, -1, 13, 2, 0, 3, 1, 4, 1, 5, 2, 6, 57, 7, 4, 8, 58, 161, 59, 162, 60, 163, 60, 164, 0, 165, 61, 166, 21, 0, 9, 0, 160, 167, -1, 13, 2, 0, 3, 1, 4, 1, 5, 2, 6, 62, 7, 4, 8, 58, 161, 63, 162, 60, 163, 60, 164, 0, 165, 64, 166, 21, 0, 9, 0, 160, 168, -1, 13, 2, 0, 3, 1, 4, 1, 5, 2, 6, 65, 7, 4, 8, 58, 161, 66, 162, 60, 163, 60, 164, 2, 165, 67, 166, 21, 0, 9, 0, 160, 169, -1, 13, 2, 0, 3, 1, 4, 1, 5, 2, 6, 68, 7, 4, 8, 58, 161, 69, 162, 60, 163, 60, 164, 2, 165, 70, 166, 21, 0 </int_array>
|
||||
<int_array len="618"> -1, -1, 1, 0, -1, 30, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 7, 4, 8, 5, 9, 6, 10, 7, 11, 8, 12, 9, 13, 3, 14, 10, 15, 11, 16, 3, 17, 12, 18, 7, 19, 13, 20, 5, 21, 5, 22, 1, 23, 14, 24, 15, 25, 3, 26, 3, 27, 1, 28, 4, 29, 5, 30, 16, 31, 17, 0, 0, 0, 33, 32, -1, 19, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 7, 4, 8, 5, 9, 6, 34, 18, 35, 1, 36, 4, 37, 3, 38, 3, 39, 7, 40, 19, 41, 14, 42, 20, 43, 3, 44, 21, 0, 1, 0, 46, 45, -1, 66, 2, 0, 3, 1, 4, 2, 5, 22, 6, 3, 47, 12, 7, 23, 8, 24, 9, 6, 48, 25, 49, 26, 50, 2, 51, 5, 52, 26, 53, 3, 54, 4, 55, 4, 56, 3, 57, 27, 58, 3, 59, 3, 60, 28, 61, 12, 62, 12, 63, 5, 64, 29, 65, 30, 66, 2, 67, 5, 68, 5, 69, 31, 70, 5, 71, 5, 72, 5, 73, 5, 74, 32, 75, 32, 76, 5, 77, 2, 78, 5, 79, 5, 80, 5, 81, 5, 82, 32, 83, 5, 84, 5, 85, 5, 86, 5, 87, 5, 88, 5, 89, 5, 90, 5, 91, 5, 92, 5, 93, 5, 94, 5, 95, 7, 96, 5, 97, 20, 98, 2, 99, 33, 100, 2, 101, 34, 102, 2, 103, 35, 104, 36, 0, 0, 0, 106, 105, -1, 18, 2, 0, 107, 12, 108, 5, 109, 37, 110, 38, 111, 39, 112, 40, 113, 41, 114, 42, 115, 43, 116, 44, 117, 45, 118, 46, 119, 47, 120, 1, 121, 32, 122, 48, 123, 49, 0, 0, 0, 125, 124, -1, 23, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 7, 4, 8, 5, 9, 6, 35, 1, 126, 3, 127, 1, 128, 5, 129, 6, 130, 14, 131, 14, 132, 50, 133, 50, 134, 1, 135, 1, 136, 51, 137, 51, 138, 51, 139, 51, 0, 0, 0, 141, 140, -1, 8, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 7, 52, 8, 5, 9, 6, 0, 0, 0, 142, 142, -1, 10, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 7, 53, 8, 5, 9, 54, 143, 8, 144, 3, 0, 0, 0, 146, 145, -1, 15, 2, 0, 147, 15, 148, 55, 149, 5, 150, 2, 151, 5, 152, 5, 153, 5, 154, 56, 155, 56, 156, 56, 157, 56, 158, 7, 159, 5, 160, 5, 0, 0, 0, 161, 161, -1, 10, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 7, 4, 8, 5, 9, 6, 162, 14, 163, 57, 0, 0, 0, 165, 164, -1, 5, 2, 0, 166, 14, 36, 4, 167, 5, 168, 6, 0, 9, 0, 170, 169, -1, 14, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 7, 58, 8, 5, 9, 59, 171, 60, 172, 61, 173, 61, 174, 1, 175, 62, 176, 12, 0, 9, 0, 170, 177, -1, 14, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 7, 63, 8, 5, 9, 59, 171, 64, 172, 61, 173, 61, 174, 1, 175, 65, 176, 12, 0, 9, 0, 170, 178, -1, 14, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 7, 66, 8, 5, 9, 59, 171, 67, 172, 61, 173, 61, 174, 3, 175, 68, 176, 12, 0, 9, 0, 170, 179, -1, 14, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 7, 69, 8, 5, 9, 59, 171, 70, 172, 61, 173, 61, 174, 3, 175, 71, 176, 12, 0 </int_array>
|
||||
<string> "conns" </string>
|
||||
<int_array len="0"> </int_array>
|
||||
</dictionary>
|
||||
|
|
|
@ -105,9 +105,9 @@ typedef struct MD5state_st
|
|||
unsigned int num;
|
||||
} MD5_CTX;
|
||||
|
||||
#ifdef OPENSSL_FIPS
|
||||
//#ifdef OPENSSL_FIPS
|
||||
int private_MD5_Init(MD5_CTX *c);
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
//#define MD5_Init _SSL_MD5_Init
|
||||
#define MD5_Final _SSL_MD5_Final
|
||||
|
|
|
@ -969,7 +969,7 @@ void RasterizerGLES2::texture_set_data(RID p_texture,const Image& p_image,VS::Cu
|
|||
|
||||
|
||||
|
||||
if (img.detect_alpha()==Image::ALPHA_BLEND) {
|
||||
if ((!texture->flags&VS::TEXTURE_FLAG_VIDEO_SURFACE) && img.detect_alpha()==Image::ALPHA_BLEND) {
|
||||
texture->has_alpha=true;
|
||||
}
|
||||
|
||||
|
@ -4224,7 +4224,6 @@ void RasterizerGLES2::capture_viewport(Image* r_capture) {
|
|||
}
|
||||
|
||||
w=DVector<uint8_t>::Write();
|
||||
|
||||
r_capture->create(viewport.width,viewport.height,0,Image::FORMAT_RGBA,pixels);
|
||||
//r_capture->flip_y();
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ Error AudioStreamMPC::_open_file() {
|
|||
f=NULL;
|
||||
}
|
||||
Error err;
|
||||
//printf("mpc open file %ls\n", file.c_str());
|
||||
f=FileAccess::open(file,FileAccess::READ,&err);
|
||||
|
||||
if (err) {
|
||||
|
@ -16,9 +17,10 @@ Error AudioStreamMPC::_open_file() {
|
|||
return err;
|
||||
}
|
||||
|
||||
f->seek_end(0);
|
||||
streamlen=f->get_pos();
|
||||
f->seek(0);
|
||||
//printf("file size is %i\n", f->get_len());
|
||||
//f->seek_end(0);
|
||||
streamlen=f->get_len();
|
||||
//f->seek(0);
|
||||
if (streamlen<=0) {
|
||||
memdelete(f);
|
||||
f=NULL;
|
||||
|
|
|
@ -61,13 +61,17 @@ src/YUV/C/yuv420_rgb_c.c
|
|||
src/TheoraVideoFrame.cpp
|
||||
""")
|
||||
|
||||
env_theora = env.Clone()
|
||||
|
||||
if env["platform"] == "iphone":
|
||||
sources.append("src/AVFoundation/TheoraVideoClip_AVFoundation.mm")
|
||||
env.Append(LINKFLAGS=['-framework', 'CoreVideo', '-framework', 'CoreMedia', '-framework', 'AVFoundation'])
|
||||
if env["target"] == "release":
|
||||
env_theora.Append(CPPFLAGS=["-D_IOS", "-D__ARM_NEON__", "-fstrict-aliasing", "-fmessage-length=210", "-fdiagnostics-show-note-include-stack", "-fmacro-backtrace-limit=0", "-fcolor-diagnostics", "-Wno-trigraphs", "-fpascal-strings", "-fvisibility=hidden", "-fvisibility-inlines-hidden"])
|
||||
|
||||
env_theora = env.Clone()
|
||||
|
||||
env_theora.Append(CPPFLAGS=["-D_YUV_C", "-D_LIB", "-D__THEORA"])
|
||||
env_theora.Append(CPPFLAGS=["-D_LIB", "-D__THEORA"]) # removed -D_YUV_C
|
||||
env_theora.Append(CPPFLAGS=["-D_YUV_LIBYUV", "-DLIBYUV_NEON"])
|
||||
#env_theora.Append(CPPFLAGS=["-D_YUV_C"])
|
||||
|
||||
if env["platform"] == "iphone":
|
||||
env_theora.Append(CPPFLAGS=["-D__AVFOUNDATION"])
|
||||
|
|
|
@ -249,6 +249,7 @@ int TheoraVideoClip::discardOutdatedFrames(float absTime)
|
|||
|
||||
if (nPop > 0)
|
||||
{
|
||||
#define _DEBUG
|
||||
#ifdef _DEBUG
|
||||
std::string log = getName() + ": dropped frame ";
|
||||
|
||||
|
|
|
@ -215,7 +215,7 @@ public:
|
|||
channels = p_channels;
|
||||
freq = p_freq;
|
||||
total_wrote = 0;
|
||||
rb_power = 12;
|
||||
rb_power = 22;
|
||||
rb.resize(rb_power);
|
||||
};
|
||||
|
||||
|
@ -258,10 +258,12 @@ public:
|
|||
|
||||
void update(float time_increase)
|
||||
{
|
||||
float prev_time = mTime;
|
||||
//mTime = (float)(stream->get_total_wrote()) / freq;
|
||||
//mTime = MAX(0,mTime-AudioServer::get_singleton()->get_output_delay());
|
||||
//mTime = (float)sample_count / channels / freq;
|
||||
mTime += time_increase;
|
||||
if (mTime - prev_time > .02) printf("time increase %f secs\n", mTime - prev_time);
|
||||
//float duration=mClip->getDuration();
|
||||
//if (mTime > duration) mTime=duration;
|
||||
//printf("time at timer is %f, %f, samples %i\n", mTime, time_increase, sample_count);
|
||||
|
@ -386,7 +388,7 @@ void VideoStreamTheoraplayer::pop_frame(Ref<ImageTexture> p_tex) {
|
|||
{
|
||||
DVector<uint8_t>::Write wr = data.write();
|
||||
uint8_t* ptr = wr.ptr();
|
||||
copymem(ptr, f->getBuffer(), imgsize);
|
||||
memcpy(ptr, f->getBuffer(), imgsize);
|
||||
}
|
||||
/*
|
||||
for (int i=0; i<h; i++) {
|
||||
|
|
|
@ -40,10 +40,9 @@
|
|||
* so BE CAREFUL!
|
||||
*/
|
||||
|
||||
|
||||
void* MemoryPoolStaticMalloc::alloc(size_t p_bytes,const char *p_description) {
|
||||
|
||||
#if DFAULT_ALIGNMENT == 1
|
||||
#if DEFAULT_ALIGNMENT == 1
|
||||
|
||||
return _alloc(p_bytes, p_description);
|
||||
|
||||
|
@ -123,7 +122,7 @@ void* MemoryPoolStaticMalloc::_alloc(size_t p_bytes,const char *p_description) {
|
|||
|
||||
void* MemoryPoolStaticMalloc::realloc(void *p_memory,size_t p_bytes) {
|
||||
|
||||
#if DFAULT_ALIGNMENT == 1
|
||||
#if DEFAULT_ALIGNMENT == 1
|
||||
|
||||
return _realloc(p_memory,p_bytes);
|
||||
#else
|
||||
|
@ -172,7 +171,6 @@ void* MemoryPoolStaticMalloc::_realloc(void *p_memory,size_t p_bytes) {
|
|||
bool single_element = (ringptr->next == ringptr) && (ringptr->prev == ringptr);
|
||||
bool is_list = ( ringlist == ringptr );
|
||||
|
||||
|
||||
RingPtr *new_ringptr=(RingPtr*)::realloc(ringptr, p_bytes+sizeof(RingPtr));
|
||||
|
||||
ERR_FAIL_COND_V( new_ringptr == 0, NULL ); /// reallocation failed
|
||||
|
@ -213,7 +211,7 @@ void MemoryPoolStaticMalloc::free(void *p_ptr) {
|
|||
|
||||
ERR_FAIL_COND( !MemoryPoolStatic::get_singleton());
|
||||
|
||||
#if DFAULT_ALIGNMENT == 1
|
||||
#if DEFAULT_ALIGNMENT == 1
|
||||
|
||||
_free(p_ptr);
|
||||
#else
|
||||
|
|
|
@ -33,7 +33,7 @@ extern "C" {
|
|||
#define WEBP_ANDROID_NEON // Android targets that might support NEON
|
||||
#endif
|
||||
|
||||
#if (defined(__ARM_NEON__) || defined(WEBP_ANDROID_NEON)) && !defined(PSP2_ENABLED)
|
||||
#if ( (defined(__ARM_NEON__) && !defined(__aarch64__)) || defined(WEBP_ANDROID_NEON)) && !defined(PSP2_ENABLED)
|
||||
#define WEBP_USE_NEON
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
//
|
||||
// Copyright 2010 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// This code is licensed under the same terms as WebM:
|
||||
|
|
|
@ -1166,6 +1166,8 @@ MethodInfo GDFunctions::get_info(Function p_func) {
|
|||
|
||||
MethodInfo mi("weakref",PropertyInfo(Variant::OBJECT,"obj"));
|
||||
mi.return_val.type=Variant::OBJECT;
|
||||
mi.return_val.name="WeakRef";
|
||||
|
||||
return mi;
|
||||
|
||||
} break;
|
||||
|
@ -1173,6 +1175,7 @@ MethodInfo GDFunctions::get_info(Function p_func) {
|
|||
|
||||
MethodInfo mi("funcref",PropertyInfo(Variant::OBJECT,"instance"),PropertyInfo(Variant::STRING,"funcname"));
|
||||
mi.return_val.type=Variant::OBJECT;
|
||||
mi.return_val.name="FuncRef";
|
||||
return mi;
|
||||
|
||||
} break;
|
||||
|
@ -1231,6 +1234,7 @@ MethodInfo GDFunctions::get_info(Function p_func) {
|
|||
|
||||
MethodInfo mi("load",PropertyInfo(Variant::STRING,"path"));
|
||||
mi.return_val.type=Variant::OBJECT;
|
||||
mi.return_val.name="Resource";
|
||||
return mi;
|
||||
} break;
|
||||
case INST2DICT: {
|
||||
|
|
|
@ -54,20 +54,35 @@ def configure(env):
|
|||
env['AR'] = 'ar'
|
||||
|
||||
import string
|
||||
#env['CCFLAGS'] = string.split('-arch armv7 -Wall -fno-strict-aliasing -fno-common -D__IPHONE_OS_VERSION_MIN_REQUIRED=20000 -isysroot $IPHONESDK -fvisibility=hidden -mmacosx-version-min=10.5 -DCUSTOM_MATRIX_TRANSFORM_H=\\\"build/iphone/matrix4_iphone.h\\\" -DCUSTOM_VECTOR3_TRANSFORM_H=\\\"build/iphone/vector3_iphone.h\\\" -DNO_THUMB')
|
||||
env['CCFLAGS'] = string.split('-fno-objc-arc -arch armv7 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -gdwarf-2 -fvisibility=hidden -Wno-sign-conversion -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=4.3 -MMD -MT dependencies -isysroot $IPHONESDK')
|
||||
if (env["bits"]=="64"):
|
||||
#env['CCFLAGS'] = string.split('-arch arm64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -g -Wno-sign-conversion -miphoneos-version-min=5.1.1 -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -Wno-invalid-offsetof -ffast-math -m64 -DDEBUG -D_DEBUG -MMD -MT dependencies -isysroot $IPHONESDK')
|
||||
env['CCFLAGS'] = string.split('-fno-objc-arc -arch arm64 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -gdwarf-2 -fvisibility=hidden -Wno-sign-conversion -MMD -MT dependencies -miphoneos-version-min=5.1.1 -isysroot $IPHONESDK')
|
||||
env.Append(CPPFLAGS=['-DNEED_LONG_INT'])
|
||||
env.Append(CPPFLAGS=['-DLIBYUV_DISABLE_NEON'])
|
||||
else:
|
||||
env['CCFLAGS'] = string.split('-fno-objc-arc -arch armv7 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -gdwarf-2 -fvisibility=hidden -Wno-sign-conversion -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=4.3 -MMD -MT dependencies -isysroot $IPHONESDK')
|
||||
|
||||
|
||||
#/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang++ fno-objc-arc -arch armv7 -fmessage-length=0 -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -gdwarf-2 -fvisibility=hidden -Wno-sign-conversion -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=4.3 -MMD -MT dependencies -v -Os -ffast-math -DSTOREKIT_ENABLED -DIPHONE_ENABLED -DUNIX_ENABLED -DGLES2_ENABLED -DNO_THREADS -DMODULE_GRIDMAP_ENABLED -DMUSEPACK_ENABLED -DOLD_SCENE_FORMAT_ENABLED -DSQUIRREL_ENABLED -DVORBIS_ENABLED -DTHEORA_ENABLED -DPNG_ENABLED -DDDS_ENABLED -DPVR_ENABLED -DJPG_ENABLED -DSPEEX_ENABLED -DTOOLS_ENABLED -DGDSCRIPT_ENABLED -DMINIZIP_ENABLED -DXML_ENABLED -Icore -Icore/math -Itools -Idrivers -I. -Iplatform/iphone -Iplatform/iphone/include -Iplatform/iphone/scoreloop/SDKs -I/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/OpenGLES.framework/Headers -Iscript/squirrel/src -Iscript/vorbis script/gdscript/gd_script.cpp
|
||||
#/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang -x objective-c -arch armv7 -fmessage-length=0 -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -std=gnu99 -fobjc-arc -Wno-trigraphs -fpascal-strings -Os -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -gdwarf-2 -fvisibility=hidden -Wno-sign-conversion -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=4.3 -iquote /Users/red/test2/build/test2.build/Release-iphoneos/test2.build/test2-generated-files.hmap -I/Users/red/test2/build/test2.build/Release-iphoneos/test2.build/test2-own-target-headers.hmap -I/Users/red/test2/build/test2.build/Release-iphoneos/test2.build/test2-all-target-headers.hmap -iquote /Users/red/test2/build/test2.build/Release-iphoneos/test2.build/test2-project-headers.hmap -I/Users/red/test2/build/Release-iphoneos/include -I/Users/red/test2/build/test2.build/Release-iphoneos/test2.build/DerivedSources/armv7 -I/Users/red/test2/build/test2.build/Release-iphoneos/test2.build/DerivedSources -F/Users/red/test2/build/Release-iphoneos -DNS_BLOCK_ASSERTIONS=1 -include /var/folders/LX/LXYXHTeSHSqbkhuPJRIsuE+++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/test2-Prefix-dvdhnltoisfpmyalexovdrmfyeky/test2-Prefix.pch -MMD -MT dependencies -MF /Users/red/test2/build/test2.build/Release-iphoneos/test2.build/Objects-normal/armv7/main.d -c /Users/red/test2/test2/main.m -o /Users/red/test2/build/test2.build/Release-iphoneos/test2.build/Objects-normal/armv7/main.o
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
env.Append(LINKFLAGS=['-arch', 'armv7', '-Wl,-dead_strip', '-miphoneos-version-min=4.3',
|
||||
if (env["bits"]=="64"):
|
||||
env.Append(LINKFLAGS=['-arch', 'arm64', '-Wl,-dead_strip', '-miphoneos-version-min=5.1.1',
|
||||
'-isysroot', '$IPHONESDK',
|
||||
#'-stdlib=libc++',
|
||||
'-framework', 'Foundation',
|
||||
'-framework', 'UIKit',
|
||||
'-framework', 'CoreGraphics',
|
||||
'-framework', 'OpenGLES',
|
||||
'-framework', 'QuartzCore',
|
||||
'-framework', 'CoreAudio',
|
||||
'-framework', 'AudioToolbox',
|
||||
'-framework', 'SystemConfiguration',
|
||||
'-framework', 'Security',
|
||||
#'-framework', 'AdSupport',
|
||||
'-framework', 'MediaPlayer',
|
||||
'-framework', 'AVFoundation',
|
||||
'-framework', 'CoreMedia',
|
||||
])
|
||||
else:
|
||||
env.Append(LINKFLAGS=['-arch', 'armv7', '-Wl,-dead_strip', '-miphoneos-version-min=4.3',
|
||||
'-isysroot', '$IPHONESDK',
|
||||
#'-mmacosx-version-min=10.5',
|
||||
'-framework', 'Foundation',
|
||||
'-framework', 'UIKit',
|
||||
'-framework', 'CoreGraphics',
|
||||
|
@ -128,4 +143,4 @@ def configure(env):
|
|||
env.Append( BUILDERS = { 'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
|
||||
env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
|
||||
|
||||
# /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c-header -arch armv7s -fmessage-length=0 -std=gnu99 -fobjc-arc -Wno-trigraphs -fpascal-strings -Os -Wno-missing-field-initializers -Wno-missing-prototypes -Wreturn-type -Wno-implicit-atomic-properties -Wno-receiver-is-weak -Wduplicate-method-match -Wformat -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-shorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wno-undeclared-selector -Wno-deprecated-implementations -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk -Wprotocol -Wdeprecated-declarations -g -fvisibility=hidden -Wno-sign-conversion "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=4.3 -iquote /Users/lucasgondolo/test/build/test.build/Release-iphoneos/test.build/test-generated-files.hmap -I/Users/lucasgondolo/test/build/test.build/Release-iphoneos/test.build/test-own-target-headers.hmap -I/Users/lucasgondolo/test/build/test.build/Release-iphoneos/test.build/test-all-target-headers.hmap -iquote /Users/lucasgondolo/test/build/test.build/Release-iphoneos/test.build/test-project-headers.hmap -I/Users/lucasgondolo/test/build/Release-iphoneos/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/lucasgondolo/test/build/test.build/Release-iphoneos/test.build/DerivedSources/armv7s -I/Users/lucasgondolo/test/build/test.build/Release-iphoneos/test.build/DerivedSources -F/Users/lucasgondolo/test/build/Release-iphoneos -DNS_BLOCK_ASSERTIONS=1 --serialize-diagnostics /var/folders/9r/_65jj9457bgb4n4nxcsm0xl80000gn/C/com.apple.Xcode.501/SharedPrecompiledHeaders/test-Prefix-esrzoamhgruxcxbhemvvlrjmmvoh/test-Prefix.pch.dia -c /Users/lucasgondolo/test/test/test-Prefix.pch -o /var/folders/9r/_65jj9457bgb4n4nxcsm0xl80000gn/C/com.apple.Xcode.501/SharedPrecompiledHeaders/test-Prefix-esrzoamhgruxcxbhemvvlrjmmvoh/test-Prefix.pch.pth -MMD -MT dependencies -MF /var/folders/9r/_65jj9457bgb4n4nxcsm0xl80000gn/C/com.apple.Xcode.501/SharedPrecompiledHeaders/test-Prefix-esrzoamhgruxcxbhemvvlrjmmvoh/test-Prefix.pch.d
|
||||
|
||||
|
|
|
@ -30,3 +30,4 @@
|
|||
#define GLES2_INCLUDE_H <ES2/gl.h>
|
||||
#define GLES1_INCLUDE_H <ES1/gl.h>
|
||||
|
||||
#define PLATFORM_REFCOUNT
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
#include "safe_refcount.h"
|
||||
|
||||
#ifdef IPHONE_ENABLED
|
||||
|
||||
#define REFCOUNT_T int
|
||||
#define REFCOUNT_GET_T int const volatile&
|
||||
|
||||
#include <libkern/OSAtomic.h>
|
||||
|
||||
inline int atomic_conditional_increment(volatile int* v) {
|
||||
return (*v==0)? 0 : OSAtomicIncrement32(v);
|
||||
}
|
||||
|
||||
inline int atomic_decrement(volatile int* v) {
|
||||
return OSAtomicDecrement32(v);
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,37 @@
|
|||
//
|
||||
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
// angle_windowsstore.h:
|
||||
|
||||
#ifndef ANGLE_WINDOWSSTORE_H_
|
||||
#define ANGLE_WINDOWSSTORE_H_
|
||||
|
||||
// The following properties can be set on the CoreApplication to support additional
|
||||
// ANGLE configuration options.
|
||||
//
|
||||
// The Visual Studio sample templates provided with this version of ANGLE have examples
|
||||
// of how to set these property values.
|
||||
|
||||
//
|
||||
// Property: EGLNativeWindowTypeProperty
|
||||
// Type: IInspectable
|
||||
// Description: Set this property to specify the window type to use for creating a surface.
|
||||
// If this property is missing, surface creation will fail.
|
||||
//
|
||||
const wchar_t EGLNativeWindowTypeProperty[] = L"EGLNativeWindowTypeProperty";
|
||||
|
||||
//
|
||||
// Property: EGLRenderSurfaceSizeProperty
|
||||
// Type: Size
|
||||
// Description: Set this property to specify a preferred size in pixels of the render surface.
|
||||
// The render surface size width and height must be greater than 0.
|
||||
// If this property is set, then the render surface size is fixed.
|
||||
// If this property is missing, a default behavior will be provided.
|
||||
// The default behavior uses the window size if a CoreWindow is specified or
|
||||
// the size of the SwapChainPanel control if one is specified.
|
||||
//
|
||||
const wchar_t EGLRenderSurfaceSizeProperty[] = L"EGLRenderSurfaceSizeProperty";
|
||||
|
||||
#endif // ANGLE_WINDOWSSTORE_H_
|
|
@ -47,6 +47,11 @@ void CollisionObject::_notification(int p_what) {
|
|||
|
||||
case NOTIFICATION_ENTER_WORLD: {
|
||||
|
||||
if (area)
|
||||
PhysicsServer::get_singleton()->area_set_transform(rid,get_global_transform());
|
||||
else
|
||||
PhysicsServer::get_singleton()->body_set_state(rid,PhysicsServer::BODY_STATE_TRANSFORM,get_global_transform());
|
||||
|
||||
RID space = get_world()->get_space();
|
||||
if (area) {
|
||||
PhysicsServer::get_singleton()->area_set_space(rid,space);
|
||||
|
|
|
@ -95,18 +95,6 @@ void RayCast::_notification(int p_what) {
|
|||
|
||||
if (enabled && !get_tree()->is_editor_hint()) {
|
||||
set_fixed_process(true);
|
||||
Node *p = get_parent();
|
||||
while( p && p->cast_to<Spatial>() ) {
|
||||
|
||||
CollisionObject *co = p->cast_to<CollisionObject>();
|
||||
if (co) {
|
||||
|
||||
exception=co->get_rid();
|
||||
exceptions.insert(exception);
|
||||
}
|
||||
|
||||
p=p->get_parent();
|
||||
}
|
||||
} else
|
||||
set_fixed_process(false);
|
||||
|
||||
|
@ -119,7 +107,6 @@ void RayCast::_notification(int p_what) {
|
|||
set_fixed_process(false);
|
||||
}
|
||||
|
||||
exceptions.erase(exception);
|
||||
|
||||
} break;
|
||||
case NOTIFICATION_FIXED_PROCESS: {
|
||||
|
@ -143,7 +130,7 @@ void RayCast::_notification(int p_what) {
|
|||
|
||||
PhysicsDirectSpaceState::RayResult rr;
|
||||
|
||||
if (dss->intersect_ray(gt.get_origin(),gt.xform(to),rr,exceptions)) {
|
||||
if (dss->intersect_ray(gt.get_origin(),gt.xform(to),rr,exclude)) {
|
||||
|
||||
collided=true;
|
||||
against=rr.collider_id;
|
||||
|
@ -160,6 +147,41 @@ void RayCast::_notification(int p_what) {
|
|||
}
|
||||
}
|
||||
|
||||
void RayCast::add_exception_rid(const RID& p_rid) {
|
||||
|
||||
exclude.insert(p_rid);
|
||||
}
|
||||
|
||||
void RayCast::add_exception(const Object* p_object){
|
||||
|
||||
ERR_FAIL_NULL(p_object);
|
||||
CollisionObject *co=((Object*)p_object)->cast_to<CollisionObject>();
|
||||
if (!co)
|
||||
return;
|
||||
add_exception_rid(co->get_rid());
|
||||
}
|
||||
|
||||
void RayCast::remove_exception_rid(const RID& p_rid) {
|
||||
|
||||
exclude.erase(p_rid);
|
||||
}
|
||||
|
||||
void RayCast::remove_exception(const Object* p_object){
|
||||
|
||||
ERR_FAIL_NULL(p_object);
|
||||
CollisionObject *co=((Object*)p_object)->cast_to<CollisionObject>();
|
||||
if (!co)
|
||||
return;
|
||||
remove_exception_rid(co->get_rid());
|
||||
}
|
||||
|
||||
|
||||
void RayCast::clear_exceptions(){
|
||||
|
||||
exclude.clear();
|
||||
}
|
||||
|
||||
|
||||
void RayCast::_bind_methods() {
|
||||
|
||||
|
||||
|
@ -176,6 +198,14 @@ void RayCast::_bind_methods() {
|
|||
ObjectTypeDB::bind_method(_MD("get_collision_point"),&RayCast::get_collision_point);
|
||||
ObjectTypeDB::bind_method(_MD("get_collision_normal"),&RayCast::get_collision_normal);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("add_exception_rid","rid"),&RayCast::add_exception_rid);
|
||||
ObjectTypeDB::bind_method(_MD("add_exception","node"),&RayCast::add_exception);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("remove_exception_rid","rid"),&RayCast::remove_exception_rid);
|
||||
ObjectTypeDB::bind_method(_MD("remove_exception","node"),&RayCast::remove_exception);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("clear_exceptions"),&RayCast::clear_exceptions);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL,"enabled"),_SCS("set_enabled"),_SCS("is_enabled"));
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3,"cast_to"),_SCS("set_cast_to"),_SCS("get_cast_to"));
|
||||
}
|
||||
|
|
|
@ -45,8 +45,7 @@ class RayCast : public Spatial {
|
|||
|
||||
Vector3 cast_to;
|
||||
|
||||
RID exception;
|
||||
Set<RID> exceptions;
|
||||
Set<RID> exclude;
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -66,6 +65,12 @@ public:
|
|||
Vector3 get_collision_point() const;
|
||||
Vector3 get_collision_normal() const;
|
||||
|
||||
void add_exception_rid(const RID& p_rid);
|
||||
void add_exception(const Object* p_object);
|
||||
void remove_exception_rid(const RID& p_rid);
|
||||
void remove_exception(const Object* p_object);
|
||||
void clear_exceptions();
|
||||
|
||||
RayCast();
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,517 @@
|
|||
#include "graph_edit.h"
|
||||
|
||||
bool GraphEditFilter::has_point(const Point2& p_point) const {
|
||||
|
||||
return ge->_filter_input(p_point);
|
||||
}
|
||||
|
||||
|
||||
GraphEditFilter::GraphEditFilter(GraphEdit *p_edit) {
|
||||
|
||||
ge=p_edit;
|
||||
}
|
||||
|
||||
|
||||
Error GraphEdit::connect_node(const StringName& p_from, int p_from_port,const StringName& p_to,int p_to_port) {
|
||||
|
||||
if (is_node_connected(p_from,p_from_port,p_to,p_to_port))
|
||||
return OK;
|
||||
Connection c;
|
||||
c.from=p_from;
|
||||
c.from_port=p_from_port;
|
||||
c.to=p_to;
|
||||
c.to_port=p_to_port;
|
||||
connections.push_back(c);
|
||||
top_layer->update();
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
bool GraphEdit::is_node_connected(const StringName& p_from, int p_from_port,const StringName& p_to,int p_to_port) {
|
||||
|
||||
for(List<Connection>::Element *E=connections.front();E;E=E->next()) {
|
||||
|
||||
if (E->get().from==p_from && E->get().from_port==p_from_port && E->get().to==p_to && E->get().to_port==p_to_port)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
void GraphEdit::disconnect_node(const StringName& p_from, int p_from_port,const StringName& p_to,int p_to_port){
|
||||
|
||||
|
||||
for(List<Connection>::Element *E=connections.front();E;E=E->next()) {
|
||||
|
||||
if (E->get().from==p_from && E->get().from_port==p_from_port && E->get().to==p_to && E->get().to_port==p_to_port) {
|
||||
|
||||
connections.erase(E);
|
||||
top_layer->update();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GraphEdit::get_connection_list(List<Connection> *r_connections) {
|
||||
|
||||
*r_connections=connections;
|
||||
}
|
||||
|
||||
|
||||
void GraphEdit::_scroll_moved(double) {
|
||||
|
||||
|
||||
_update_scroll_offset();
|
||||
top_layer->update();
|
||||
}
|
||||
|
||||
void GraphEdit::_update_scroll_offset() {
|
||||
|
||||
for(int i=0;i<get_child_count();i++) {
|
||||
|
||||
GraphNode *gn=get_child(i)->cast_to<GraphNode>();
|
||||
if (!gn)
|
||||
continue;
|
||||
|
||||
Point2 pos=gn->get_offset();
|
||||
pos-=Point2(h_scroll->get_val(),v_scroll->get_val());
|
||||
gn->set_pos(pos);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void GraphEdit::_update_scroll() {
|
||||
|
||||
if (updating)
|
||||
return;
|
||||
|
||||
updating=true;
|
||||
Rect2 screen;
|
||||
screen.size=get_size();
|
||||
for(int i=0;i<get_child_count();i++) {
|
||||
|
||||
GraphNode *gn=get_child(i)->cast_to<GraphNode>();
|
||||
if (!gn)
|
||||
continue;
|
||||
|
||||
Rect2 r;
|
||||
r.pos=gn->get_offset();
|
||||
r.size=gn->get_size();
|
||||
screen = screen.merge(r);
|
||||
}
|
||||
|
||||
h_scroll->set_min(screen.pos.x);
|
||||
h_scroll->set_max(screen.pos.x+screen.size.x);
|
||||
h_scroll->set_page(get_size().x);
|
||||
if (h_scroll->get_max() - h_scroll->get_min() <= h_scroll->get_page())
|
||||
h_scroll->hide();
|
||||
else
|
||||
h_scroll->show();
|
||||
|
||||
v_scroll->set_min(screen.pos.y);
|
||||
v_scroll->set_max(screen.pos.y+screen.size.y);
|
||||
v_scroll->set_page(get_size().y);
|
||||
|
||||
if (v_scroll->get_max() - v_scroll->get_min() <= v_scroll->get_page())
|
||||
v_scroll->hide();
|
||||
else
|
||||
v_scroll->show();
|
||||
|
||||
_update_scroll_offset();
|
||||
updating=false;
|
||||
}
|
||||
|
||||
|
||||
void GraphEdit::_graph_node_raised(Node* p_gn) {
|
||||
|
||||
GraphNode *gn=p_gn->cast_to<GraphNode>();
|
||||
ERR_FAIL_COND(!gn);
|
||||
gn->raise();
|
||||
top_layer->raise();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void GraphEdit::_graph_node_moved(Node *p_gn) {
|
||||
|
||||
GraphNode *gn=p_gn->cast_to<GraphNode>();
|
||||
ERR_FAIL_COND(!gn);
|
||||
|
||||
//gn->set_pos(gn->get_offset()+scroll_offset);
|
||||
|
||||
top_layer->update();
|
||||
}
|
||||
|
||||
void GraphEdit::add_child_notify(Node *p_child) {
|
||||
|
||||
top_layer->call_deferred("raise"); //top layer always on top!
|
||||
GraphNode *gn = p_child->cast_to<GraphNode>();
|
||||
if (gn) {
|
||||
gn->connect("offset_changed",this,"_graph_node_moved",varray(gn));
|
||||
gn->connect("raise_request",this,"_graph_node_raised",varray(gn));
|
||||
_graph_node_moved(gn);
|
||||
gn->set_stop_mouse(false);
|
||||
}
|
||||
}
|
||||
|
||||
void GraphEdit::remove_child_notify(Node *p_child) {
|
||||
|
||||
top_layer->call_deferred("raise"); //top layer always on top!
|
||||
GraphNode *gn = p_child->cast_to<GraphNode>();
|
||||
if (gn) {
|
||||
gn->disconnect("offset_changed",this,"_graph_node_moved");
|
||||
gn->disconnect("raise_request",this,"_graph_node_raised");
|
||||
}
|
||||
}
|
||||
|
||||
void GraphEdit::_notification(int p_what) {
|
||||
|
||||
if (p_what==NOTIFICATION_READY) {
|
||||
Size2 size = top_layer->get_size();
|
||||
Size2 hmin = h_scroll->get_combined_minimum_size();
|
||||
Size2 vmin = v_scroll->get_combined_minimum_size();
|
||||
|
||||
v_scroll->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_END,vmin.width);
|
||||
v_scroll->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,0);
|
||||
v_scroll->set_anchor_and_margin(MARGIN_TOP,ANCHOR_BEGIN,0);
|
||||
v_scroll->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END,0);
|
||||
|
||||
h_scroll->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_BEGIN,0);
|
||||
h_scroll->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,0);
|
||||
h_scroll->set_anchor_and_margin(MARGIN_TOP,ANCHOR_END,hmin.height);
|
||||
h_scroll->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END,0);
|
||||
|
||||
}
|
||||
if (p_what==NOTIFICATION_DRAW) {
|
||||
VS::get_singleton()->canvas_item_set_clip(get_canvas_item(),true);
|
||||
|
||||
}
|
||||
|
||||
if (p_what==NOTIFICATION_RESIZED) {
|
||||
_update_scroll();
|
||||
top_layer->update();
|
||||
}
|
||||
}
|
||||
|
||||
bool GraphEdit::_filter_input(const Point2& p_point) {
|
||||
|
||||
Ref<Texture> port =get_icon("port","GraphNode");
|
||||
|
||||
float grab_r=port->get_width()*0.5;
|
||||
for(int i=get_child_count()-1;i>=0;i--) {
|
||||
|
||||
GraphNode *gn=get_child(i)->cast_to<GraphNode>();
|
||||
if (!gn)
|
||||
continue;
|
||||
|
||||
for(int j=0;j<gn->get_connection_output_count();j++) {
|
||||
|
||||
Vector2 pos = gn->get_connection_output_pos(j)+gn->get_pos();
|
||||
if (pos.distance_to(p_point)<grab_r)
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
for(int j=0;j<gn->get_connection_input_count();j++) {
|
||||
|
||||
Vector2 pos = gn->get_connection_input_pos(j)+gn->get_pos();
|
||||
if (pos.distance_to(p_point)<grab_r)
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void GraphEdit::_top_layer_input(const InputEvent& p_ev) {
|
||||
|
||||
if (p_ev.type==InputEvent::MOUSE_BUTTON && p_ev.mouse_button.button_index==BUTTON_LEFT && p_ev.mouse_button.pressed) {
|
||||
|
||||
Ref<Texture> port =get_icon("port","GraphNode");
|
||||
Vector2 mpos(p_ev.mouse_button.x,p_ev.mouse_button.y);
|
||||
float grab_r=port->get_width()*0.5;
|
||||
for(int i=get_child_count()-1;i>=0;i--) {
|
||||
|
||||
GraphNode *gn=get_child(i)->cast_to<GraphNode>();
|
||||
if (!gn)
|
||||
continue;
|
||||
|
||||
for(int j=0;j<gn->get_connection_output_count();j++) {
|
||||
|
||||
Vector2 pos = gn->get_connection_output_pos(j)+gn->get_pos();
|
||||
if (pos.distance_to(mpos)<grab_r) {
|
||||
|
||||
connecting=true;
|
||||
connecting_from=gn->get_name();
|
||||
connecting_index=j;
|
||||
connecting_out=true;
|
||||
connecting_type=gn->get_connection_output_type(j);
|
||||
connecting_color=gn->get_connection_output_color(j);
|
||||
connecting_target=false;
|
||||
connecting_to=pos;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
for(int j=0;j<gn->get_connection_input_count();j++) {
|
||||
|
||||
Vector2 pos = gn->get_connection_input_pos(j)+gn->get_pos();
|
||||
|
||||
if (pos.distance_to(mpos)<grab_r) {
|
||||
connecting=true;
|
||||
connecting_from=gn->get_name();
|
||||
connecting_index=j;
|
||||
connecting_out=false;
|
||||
connecting_type=gn->get_connection_input_type(j);
|
||||
connecting_color=gn->get_connection_input_color(j);
|
||||
connecting_target=false;
|
||||
connecting_to=pos;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (p_ev.type==InputEvent::MOUSE_MOTION && connecting) {
|
||||
|
||||
connecting_to=Vector2(p_ev.mouse_motion.x,p_ev.mouse_motion.y);
|
||||
connecting_target=false;
|
||||
top_layer->update();
|
||||
|
||||
Ref<Texture> port =get_icon("port","GraphNode");
|
||||
Vector2 mpos(p_ev.mouse_button.x,p_ev.mouse_button.y);
|
||||
float grab_r=port->get_width()*0.5;
|
||||
for(int i=get_child_count()-1;i>=0;i--) {
|
||||
|
||||
GraphNode *gn=get_child(i)->cast_to<GraphNode>();
|
||||
if (!gn)
|
||||
continue;
|
||||
|
||||
if (!connecting_out) {
|
||||
for(int j=0;j<gn->get_connection_output_count();j++) {
|
||||
|
||||
Vector2 pos = gn->get_connection_output_pos(j)+gn->get_pos();
|
||||
int type =gn->get_connection_output_type(j);
|
||||
if (type==connecting_type && pos.distance_to(mpos)<grab_r) {
|
||||
|
||||
connecting_target=true;
|
||||
connecting_to=pos;
|
||||
connecting_target_to=gn->get_name();
|
||||
connecting_target_index=j;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
for(int j=0;j<gn->get_connection_input_count();j++) {
|
||||
|
||||
Vector2 pos = gn->get_connection_input_pos(j)+gn->get_pos();
|
||||
int type =gn->get_connection_input_type(j);
|
||||
if (type==connecting_type && pos.distance_to(mpos)<grab_r) {
|
||||
connecting_target=true;
|
||||
connecting_to=pos;
|
||||
connecting_target_to=gn->get_name();
|
||||
connecting_target_index=j;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (p_ev.type==InputEvent::MOUSE_BUTTON && p_ev.mouse_button.button_index==BUTTON_LEFT && !p_ev.mouse_button.pressed) {
|
||||
|
||||
if (connecting && connecting_target) {
|
||||
|
||||
String from = connecting_from;
|
||||
int from_slot = connecting_index;
|
||||
String to =connecting_target_to;
|
||||
int to_slot = connecting_target_index;
|
||||
|
||||
if (!connecting_out) {
|
||||
SWAP(from,to);
|
||||
SWAP(from_slot,to_slot);
|
||||
}
|
||||
emit_signal("connection_request",from,from_slot,to,to_slot);
|
||||
|
||||
}
|
||||
connecting=false;
|
||||
top_layer->update();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void GraphEdit::_draw_cos_line(const Vector2& p_from, const Vector2& p_to,const Color& p_color) {
|
||||
|
||||
static const int steps = 20;
|
||||
|
||||
Rect2 r;
|
||||
r.pos=p_from;
|
||||
r.expand_to(p_to);
|
||||
Vector2 sign=Vector2((p_from.x < p_to.x) ? 1 : -1,(p_from.y < p_to.y) ? 1 : -1);
|
||||
bool flip = sign.x * sign.y < 0;
|
||||
|
||||
Vector2 prev;
|
||||
for(int i=0;i<=steps;i++) {
|
||||
|
||||
float d = i/float(steps);
|
||||
float c=-Math::cos(d*Math_PI) * 0.5+0.5;
|
||||
if (flip)
|
||||
c=1.0-c;
|
||||
Vector2 p = r.pos+Vector2(d*r.size.width,c*r.size.height);
|
||||
|
||||
if (i>0) {
|
||||
|
||||
top_layer->draw_line(prev,p,p_color,2);
|
||||
}
|
||||
|
||||
prev=p;
|
||||
}
|
||||
}
|
||||
|
||||
void GraphEdit::_top_layer_draw() {
|
||||
|
||||
_update_scroll();
|
||||
|
||||
if (connecting) {
|
||||
|
||||
Node *fromn = get_node(connecting_from);
|
||||
ERR_FAIL_COND(!fromn);
|
||||
GraphNode *from = fromn->cast_to<GraphNode>();
|
||||
ERR_FAIL_COND(!from);
|
||||
Vector2 pos;
|
||||
if (connecting_out)
|
||||
pos=from->get_connection_output_pos(connecting_index);
|
||||
else
|
||||
pos=from->get_connection_input_pos(connecting_index);
|
||||
pos+=from->get_pos();
|
||||
|
||||
Vector2 topos;
|
||||
topos=connecting_to;
|
||||
|
||||
Color col=connecting_color;
|
||||
|
||||
if (connecting_target) {
|
||||
col.r+=0.4;
|
||||
col.g+=0.4;
|
||||
col.b+=0.4;
|
||||
}
|
||||
_draw_cos_line(pos,topos,col);
|
||||
}
|
||||
|
||||
List<List<Connection>::Element* > to_erase;
|
||||
for(List<Connection>::Element *E=connections.front();E;E=E->next()) {
|
||||
|
||||
NodePath fromnp(E->get().from);
|
||||
|
||||
Node * from = get_node(fromnp);
|
||||
if (!from) {
|
||||
to_erase.push_back(E);
|
||||
continue;
|
||||
}
|
||||
|
||||
GraphNode *gfrom = from->cast_to<GraphNode>();
|
||||
|
||||
if (!gfrom) {
|
||||
to_erase.push_back(E);
|
||||
continue;
|
||||
}
|
||||
|
||||
NodePath tonp(E->get().to);
|
||||
Node * to = get_node(tonp);
|
||||
if (!to) {
|
||||
to_erase.push_back(E);
|
||||
continue;
|
||||
}
|
||||
|
||||
GraphNode *gto = to->cast_to<GraphNode>();
|
||||
|
||||
if (!gto) {
|
||||
to_erase.push_back(E);
|
||||
continue;
|
||||
}
|
||||
|
||||
Vector2 frompos=gfrom->get_connection_output_pos(E->get().from_port)+gfrom->get_pos();
|
||||
Color color = gfrom->get_connection_output_color(E->get().from_port);
|
||||
Vector2 topos=gto->get_connection_input_pos(E->get().to_port)+gto->get_pos();
|
||||
_draw_cos_line(frompos,topos,color);
|
||||
|
||||
}
|
||||
|
||||
while(to_erase.size()) {
|
||||
connections.erase(to_erase.front()->get());
|
||||
to_erase.pop_front();
|
||||
}
|
||||
//draw connections
|
||||
}
|
||||
|
||||
void GraphEdit::_input_event(const InputEvent& p_ev) {
|
||||
|
||||
if (p_ev.type==InputEvent::MOUSE_MOTION && p_ev.mouse_motion.button_mask&BUTTON_MASK_MIDDLE) {
|
||||
h_scroll->set_val( h_scroll->get_val() - p_ev.mouse_motion.relative_x );
|
||||
v_scroll->set_val( v_scroll->get_val() - p_ev.mouse_motion.relative_y );
|
||||
}
|
||||
}
|
||||
|
||||
void GraphEdit::clear_connections() {
|
||||
|
||||
connections.clear();
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
void GraphEdit::_bind_methods() {
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("connect_node:Error","from","from_port","to","to_port"),&GraphEdit::connect_node);
|
||||
ObjectTypeDB::bind_method(_MD("is_node_connected","from","from_port","to","to_port"),&GraphEdit::is_node_connected);
|
||||
ObjectTypeDB::bind_method(_MD("disconnect_node","from","from_port","to","to_port"),&GraphEdit::disconnect_node);
|
||||
ObjectTypeDB::bind_method(_MD("_graph_node_moved"),&GraphEdit::_graph_node_moved);
|
||||
ObjectTypeDB::bind_method(_MD("_graph_node_raised"),&GraphEdit::_graph_node_raised);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("_top_layer_input"),&GraphEdit::_top_layer_input);
|
||||
ObjectTypeDB::bind_method(_MD("_top_layer_draw"),&GraphEdit::_top_layer_draw);
|
||||
ObjectTypeDB::bind_method(_MD("_scroll_moved"),&GraphEdit::_scroll_moved);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("_input_event"),&GraphEdit::_input_event);
|
||||
|
||||
ADD_SIGNAL(MethodInfo("connection_request",PropertyInfo(Variant::STRING,"from"),PropertyInfo(Variant::INT,"from_slot"),PropertyInfo(Variant::STRING,"to"),PropertyInfo(Variant::INT,"to_slot")));
|
||||
|
||||
}
|
||||
|
||||
GraphEdit::GraphEdit() {
|
||||
top_layer=NULL;
|
||||
top_layer=memnew(GraphEditFilter(this));
|
||||
add_child(top_layer);
|
||||
top_layer->set_stop_mouse(false);
|
||||
top_layer->set_area_as_parent_rect();
|
||||
top_layer->connect("draw",this,"_top_layer_draw");
|
||||
top_layer->set_stop_mouse(false);
|
||||
top_layer->connect("input_event",this,"_top_layer_input");
|
||||
|
||||
h_scroll = memnew(HScrollBar);
|
||||
h_scroll->set_name("_h_scroll");
|
||||
top_layer->add_child(h_scroll);
|
||||
|
||||
v_scroll = memnew(VScrollBar);
|
||||
v_scroll->set_name("_v_scroll");
|
||||
top_layer->add_child(v_scroll);
|
||||
updating=false;
|
||||
connecting=false;
|
||||
|
||||
h_scroll->connect("value_changed", this,"_scroll_moved");
|
||||
v_scroll->connect("value_changed", this,"_scroll_moved");
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
#ifndef GRAPH_EDIT_H
|
||||
#define GRAPH_EDIT_H
|
||||
|
||||
#include "scene/gui/graph_node.h"
|
||||
#include "scene/gui/scroll_bar.h"
|
||||
|
||||
class GraphEdit;
|
||||
|
||||
class GraphEditFilter : public Control {
|
||||
|
||||
OBJ_TYPE(GraphEditFilter,Control);
|
||||
|
||||
friend class GraphEdit;
|
||||
GraphEdit *ge;
|
||||
virtual bool has_point(const Point2& p_point) const;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
GraphEditFilter(GraphEdit *p_edit);
|
||||
};
|
||||
|
||||
class GraphEdit : public Control {
|
||||
|
||||
OBJ_TYPE(GraphEdit,Control);
|
||||
public:
|
||||
|
||||
struct Connection {
|
||||
StringName from;
|
||||
StringName to;
|
||||
int from_port;
|
||||
int to_port;
|
||||
|
||||
};
|
||||
private:
|
||||
|
||||
HScrollBar* h_scroll;
|
||||
VScrollBar* v_scroll;
|
||||
|
||||
|
||||
bool connecting;
|
||||
String connecting_from;
|
||||
bool connecting_out;
|
||||
int connecting_index;
|
||||
int connecting_type;
|
||||
Color connecting_color;
|
||||
bool connecting_target;
|
||||
Vector2 connecting_to;
|
||||
String connecting_target_to;
|
||||
int connecting_target_index;
|
||||
|
||||
|
||||
|
||||
bool updating;
|
||||
List<Connection> connections;
|
||||
|
||||
void _draw_cos_line(const Vector2& p_from, const Vector2& p_to,const Color& p_color);
|
||||
|
||||
void _graph_node_raised(Node* p_gn);
|
||||
void _graph_node_moved(Node *p_gn);
|
||||
|
||||
void _update_scroll();
|
||||
void _scroll_moved(double);
|
||||
void _input_event(const InputEvent& p_ev);
|
||||
|
||||
GraphEditFilter *top_layer;
|
||||
void _top_layer_input(const InputEvent& p_ev);
|
||||
void _top_layer_draw();
|
||||
void _update_scroll_offset();
|
||||
|
||||
friend class GraphEditFilter;
|
||||
bool _filter_input(const Point2& p_point);
|
||||
protected:
|
||||
|
||||
static void _bind_methods();
|
||||
virtual void add_child_notify(Node *p_child);
|
||||
virtual void remove_child_notify(Node *p_child);
|
||||
void _notification(int p_what);
|
||||
|
||||
public:
|
||||
|
||||
Error connect_node(const StringName& p_from, int p_from_port,const StringName& p_to,int p_to_port);
|
||||
bool is_node_connected(const StringName& p_from, int p_from_port,const StringName& p_to,int p_to_port);
|
||||
void disconnect_node(const StringName& p_from, int p_from_port,const StringName& p_to,int p_to_port);
|
||||
void clear_connections();
|
||||
|
||||
void get_connection_list(List<Connection> *r_connections);
|
||||
|
||||
|
||||
GraphEdit();
|
||||
};
|
||||
|
||||
#endif // GRAPHEdit_H
|
|
@ -76,7 +76,7 @@ void GraphNode::_get_property_list( List<PropertyInfo> *p_list) const{
|
|||
int idx=0;
|
||||
for(int i=0;i<get_child_count();i++) {
|
||||
Control *c=get_child(i)->cast_to<Control>();
|
||||
if (!c || c->is_set_as_toplevel() || !c->get_owner())
|
||||
if (!c || c->is_set_as_toplevel() )
|
||||
continue;
|
||||
|
||||
String base="slot/"+itos(idx)+"/";
|
||||
|
@ -122,6 +122,7 @@ void GraphNode::_resort() {
|
|||
|
||||
}
|
||||
|
||||
|
||||
int vofs=0;
|
||||
int w = get_size().x - sb->get_minimum_size().x;
|
||||
|
||||
|
@ -131,7 +132,7 @@ void GraphNode::_resort() {
|
|||
Control *c=get_child(i)->cast_to<Control>();
|
||||
if (!c)
|
||||
continue;
|
||||
if (c->is_set_as_toplevel() || !c->get_owner())
|
||||
if (c->is_set_as_toplevel())
|
||||
continue;
|
||||
|
||||
Size2i size=c->get_combined_minimum_size();
|
||||
|
@ -150,6 +151,8 @@ void GraphNode::_resort() {
|
|||
|
||||
_change_notify();
|
||||
update();
|
||||
connpos_dirty=true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -160,14 +163,34 @@ void GraphNode::_notification(int p_what) {
|
|||
|
||||
Ref<StyleBox> sb=get_stylebox("frame");
|
||||
Ref<Texture> port =get_icon("port");
|
||||
Ref<Texture> close =get_icon("close");
|
||||
int close_offset = get_constant("close_offset");
|
||||
Ref<Font> title_font = get_font("title_font");
|
||||
int title_offset = get_constant("title_offset");
|
||||
Color title_color = get_color("title_color");
|
||||
Point2i icofs = -port->get_size()*0.5;
|
||||
int edgeofs=3;
|
||||
int edgeofs=get_constant("port_offset");
|
||||
icofs.y+=sb->get_margin(MARGIN_TOP);
|
||||
draw_style_box(sb,Rect2(Point2(),get_size()));
|
||||
|
||||
int w = get_size().width-sb->get_minimum_size().x;
|
||||
|
||||
if (show_close)
|
||||
w-=close->get_width();
|
||||
|
||||
draw_string(title_font,Point2(sb->get_margin(MARGIN_LEFT),-title_font->get_height()+title_font->get_ascent()+title_offset),title,title_color,w);
|
||||
if (show_close) {
|
||||
Vector2 cpos = Point2(w+sb->get_margin(MARGIN_LEFT),-close->get_height()+close_offset);
|
||||
draw_texture(close,cpos);
|
||||
close_rect.pos=cpos;
|
||||
close_rect.size=close->get_size();
|
||||
} else {
|
||||
close_rect=Rect2();
|
||||
}
|
||||
|
||||
for (Map<int,Slot>::Element *E=slot_info.front();E;E=E->next()) {
|
||||
|
||||
if (E->key()>cache_y.size())
|
||||
if (E->key() < 0 || E->key()>=cache_y.size())
|
||||
continue;
|
||||
if (!slot_info.has(E->key()))
|
||||
continue;
|
||||
|
@ -180,6 +203,7 @@ void GraphNode::_notification(int p_what) {
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
if (p_what==NOTIFICATION_SORT_CHILDREN) {
|
||||
|
||||
_resort();
|
||||
|
@ -187,16 +211,6 @@ void GraphNode::_notification(int p_what) {
|
|||
|
||||
}
|
||||
|
||||
void GraphNode::set_title(const String& p_title) {
|
||||
|
||||
title=p_title;
|
||||
update();
|
||||
}
|
||||
|
||||
String GraphNode::get_title() const {
|
||||
|
||||
return title;
|
||||
}
|
||||
|
||||
void GraphNode::set_slot(int p_idx,bool p_enable_left,int p_type_left,const Color& p_color_left, bool p_enable_right,int p_type_right,const Color& p_color_right) {
|
||||
|
||||
|
@ -216,17 +230,23 @@ void GraphNode::set_slot(int p_idx,bool p_enable_left,int p_type_left,const Colo
|
|||
s.color_right=p_color_right;
|
||||
slot_info[p_idx]=s;
|
||||
update();
|
||||
connpos_dirty=true;
|
||||
|
||||
}
|
||||
|
||||
void GraphNode::clear_slot(int p_idx){
|
||||
|
||||
slot_info.erase(p_idx);
|
||||
update();
|
||||
connpos_dirty=true;
|
||||
|
||||
}
|
||||
void GraphNode::clear_all_slots(){
|
||||
|
||||
slot_info.clear();
|
||||
update();
|
||||
connpos_dirty=true;
|
||||
|
||||
}
|
||||
bool GraphNode::is_slot_enabled_left(int p_idx) const{
|
||||
|
||||
|
@ -280,18 +300,26 @@ Color GraphNode::get_slot_color_right(int p_idx) const{
|
|||
|
||||
Size2 GraphNode::get_minimum_size() const {
|
||||
|
||||
Ref<Font> title_font = get_font("title_font");
|
||||
|
||||
int sep=get_constant("separation");
|
||||
Ref<StyleBox> sb=get_stylebox("frame");
|
||||
bool first=true;
|
||||
|
||||
Size2 minsize;
|
||||
minsize.x=title_font->get_string_size(title).x;
|
||||
if (show_close) {
|
||||
Ref<Texture> close =get_icon("close");
|
||||
minsize.x+=sep+close->get_width();
|
||||
}
|
||||
|
||||
|
||||
for(int i=0;i<get_child_count();i++) {
|
||||
|
||||
Control *c=get_child(i)->cast_to<Control>();
|
||||
if (!c)
|
||||
continue;
|
||||
if (c->is_set_as_toplevel() || !c->get_owner())
|
||||
if (c->is_set_as_toplevel())
|
||||
continue;
|
||||
|
||||
Size2i size=c->get_combined_minimum_size();
|
||||
|
@ -308,13 +336,225 @@ Size2 GraphNode::get_minimum_size() const {
|
|||
return minsize+sb->get_minimum_size();
|
||||
}
|
||||
|
||||
void GraphNode::set_title(const String& p_title) {
|
||||
|
||||
title=p_title;
|
||||
minimum_size_changed();
|
||||
update();
|
||||
|
||||
}
|
||||
|
||||
String GraphNode::get_title() const{
|
||||
|
||||
return title;
|
||||
}
|
||||
|
||||
void GraphNode::set_offset(const Vector2& p_offset) {
|
||||
|
||||
offset=p_offset;
|
||||
emit_signal("offset_changed");
|
||||
update();
|
||||
}
|
||||
|
||||
Vector2 GraphNode::get_offset() const {
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GraphNode::set_show_close_button(bool p_enable){
|
||||
|
||||
show_close=p_enable;
|
||||
update();
|
||||
}
|
||||
bool GraphNode::is_close_button_visible() const{
|
||||
|
||||
return show_close;
|
||||
}
|
||||
|
||||
void GraphNode::_connpos_update() {
|
||||
|
||||
|
||||
int edgeofs=get_constant("port_offset");
|
||||
int sep=get_constant("separation");
|
||||
|
||||
Ref<StyleBox> sb=get_stylebox("frame");
|
||||
Ref<Texture> port =get_icon("port");
|
||||
conn_input_cache.clear();
|
||||
conn_output_cache.clear();
|
||||
int vofs=0;
|
||||
|
||||
int idx=0;
|
||||
|
||||
for(int i=0;i<get_child_count();i++) {
|
||||
Control *c=get_child(i)->cast_to<Control>();
|
||||
if (!c)
|
||||
continue;
|
||||
if (c->is_set_as_toplevel())
|
||||
continue;
|
||||
|
||||
Size2i size=c->get_combined_minimum_size();
|
||||
|
||||
int y = sb->get_margin(MARGIN_TOP)+vofs;
|
||||
int h = size.y;
|
||||
|
||||
|
||||
if (slot_info.has(idx)) {
|
||||
|
||||
if (slot_info[idx].enable_left) {
|
||||
ConnCache cc;
|
||||
cc.pos=Point2i(edgeofs,y+h/2);
|
||||
cc.type=slot_info[idx].type_left;
|
||||
cc.color=slot_info[idx].color_left;
|
||||
conn_input_cache.push_back(cc);
|
||||
}
|
||||
if (slot_info[idx].enable_right) {
|
||||
ConnCache cc;
|
||||
cc.pos=Point2i(get_size().width-edgeofs,y+h/2);
|
||||
cc.type=slot_info[idx].type_right;
|
||||
cc.color=slot_info[idx].color_right;
|
||||
conn_output_cache.push_back(cc);
|
||||
}
|
||||
}
|
||||
|
||||
if (vofs>0)
|
||||
vofs+=sep;
|
||||
vofs+=size.y;
|
||||
idx++;
|
||||
|
||||
}
|
||||
|
||||
|
||||
connpos_dirty=false;
|
||||
}
|
||||
|
||||
int GraphNode::get_connection_input_count() {
|
||||
|
||||
if (connpos_dirty)
|
||||
_connpos_update();
|
||||
|
||||
return conn_input_cache.size();
|
||||
|
||||
}
|
||||
int GraphNode::get_connection_output_count() {
|
||||
|
||||
if (connpos_dirty)
|
||||
_connpos_update();
|
||||
|
||||
return conn_output_cache.size();
|
||||
|
||||
}
|
||||
|
||||
|
||||
Vector2 GraphNode::get_connection_input_pos(int p_idx) {
|
||||
|
||||
if (connpos_dirty)
|
||||
_connpos_update();
|
||||
|
||||
ERR_FAIL_INDEX_V(p_idx,conn_input_cache.size(),Vector2());
|
||||
return conn_input_cache[p_idx].pos;
|
||||
}
|
||||
|
||||
int GraphNode::get_connection_input_type(int p_idx) {
|
||||
|
||||
if (connpos_dirty)
|
||||
_connpos_update();
|
||||
|
||||
ERR_FAIL_INDEX_V(p_idx,conn_input_cache.size(),0);
|
||||
return conn_input_cache[p_idx].type;
|
||||
}
|
||||
|
||||
Color GraphNode::get_connection_input_color(int p_idx) {
|
||||
|
||||
if (connpos_dirty)
|
||||
_connpos_update();
|
||||
|
||||
ERR_FAIL_INDEX_V(p_idx,conn_input_cache.size(),Color());
|
||||
return conn_input_cache[p_idx].color;
|
||||
}
|
||||
|
||||
Vector2 GraphNode::get_connection_output_pos(int p_idx){
|
||||
|
||||
if (connpos_dirty)
|
||||
_connpos_update();
|
||||
|
||||
ERR_FAIL_INDEX_V(p_idx,conn_output_cache.size(),Vector2());
|
||||
return conn_output_cache[p_idx].pos;
|
||||
|
||||
}
|
||||
|
||||
int GraphNode::get_connection_output_type(int p_idx) {
|
||||
|
||||
if (connpos_dirty)
|
||||
_connpos_update();
|
||||
|
||||
ERR_FAIL_INDEX_V(p_idx,conn_output_cache.size(),0);
|
||||
return conn_output_cache[p_idx].type;
|
||||
}
|
||||
|
||||
Color GraphNode::get_connection_output_color(int p_idx) {
|
||||
|
||||
if (connpos_dirty)
|
||||
_connpos_update();
|
||||
|
||||
ERR_FAIL_INDEX_V(p_idx,conn_output_cache.size(),Color());
|
||||
return conn_output_cache[p_idx].color;
|
||||
}
|
||||
|
||||
void GraphNode::_input_event(const InputEvent& p_ev) {
|
||||
|
||||
if (p_ev.type==InputEvent::MOUSE_BUTTON && p_ev.mouse_button.pressed && p_ev.mouse_button.button_index==BUTTON_LEFT) {
|
||||
|
||||
Vector2 mpos = Vector2(p_ev.mouse_button.x,p_ev.mouse_button.y);
|
||||
if (close_rect.size!=Size2() && close_rect.has_point(mpos)) {
|
||||
emit_signal("close_request");
|
||||
return;
|
||||
}
|
||||
|
||||
drag_from=get_offset();
|
||||
drag_accum=Vector2();
|
||||
dragging=true;
|
||||
emit_signal("raise_request");
|
||||
|
||||
}
|
||||
|
||||
if (p_ev.type==InputEvent::MOUSE_BUTTON && !p_ev.mouse_button.pressed && p_ev.mouse_button.button_index==BUTTON_LEFT) {
|
||||
|
||||
dragging=false;
|
||||
emit_signal("dragged",drag_from,get_offset()); //useful for undo/redo
|
||||
}
|
||||
|
||||
if (p_ev.type==InputEvent::MOUSE_MOTION && dragging) {
|
||||
|
||||
drag_accum+=Vector2(p_ev.mouse_motion.relative_x,p_ev.mouse_motion.relative_y);
|
||||
set_offset(drag_from+drag_accum);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void GraphNode::_bind_methods() {
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_title","title"),&GraphNode::set_title);
|
||||
ObjectTypeDB::bind_method(_MD("get_title"),&GraphNode::get_title);
|
||||
ObjectTypeDB::bind_method(_MD("_input_event"),&GraphNode::_input_event);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_show_close_button","show"),&GraphNode::set_show_close_button);
|
||||
ObjectTypeDB::bind_method(_MD("is_close_button_visible"),&GraphNode::is_close_button_visible);
|
||||
|
||||
ADD_PROPERTY( PropertyInfo(Variant::STRING,"title"),_SCS("set_title"),_SCS("get_title"));
|
||||
ADD_PROPERTY( PropertyInfo(Variant::BOOL,"show_close"),_SCS("set_show_close_button"),_SCS("is_close_button_visible"));
|
||||
|
||||
ADD_SIGNAL(MethodInfo("offset_changed"));
|
||||
ADD_SIGNAL(MethodInfo("dragged",PropertyInfo(Variant::VECTOR2,"from"),PropertyInfo(Variant::VECTOR2,"to")));
|
||||
ADD_SIGNAL(MethodInfo("raise_request"));
|
||||
ADD_SIGNAL(MethodInfo("close_request"));
|
||||
}
|
||||
|
||||
GraphNode::GraphNode() {
|
||||
|
||||
|
||||
dragging=false;
|
||||
show_close=false;
|
||||
connpos_dirty=true;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ class GraphNode : public Container {
|
|||
OBJ_TYPE(GraphNode,Container);
|
||||
|
||||
|
||||
String title;
|
||||
|
||||
struct Slot {
|
||||
bool enable_left;
|
||||
int type_left;
|
||||
|
@ -21,13 +21,36 @@ class GraphNode : public Container {
|
|||
Slot() { enable_left=false; type_left=0; color_left=Color(1,1,1,1); enable_right=false; type_right=0; color_right=Color(1,1,1,1); };
|
||||
};
|
||||
|
||||
String title;
|
||||
bool show_close;
|
||||
Vector2 offset;
|
||||
|
||||
Rect2 close_rect;
|
||||
|
||||
Vector<int> cache_y;
|
||||
|
||||
struct ConnCache {
|
||||
Vector2 pos;
|
||||
int type;
|
||||
Color color;
|
||||
};
|
||||
|
||||
Vector<ConnCache> conn_input_cache;
|
||||
Vector<ConnCache> conn_output_cache;
|
||||
|
||||
Map<int,Slot> slot_info;
|
||||
|
||||
bool connpos_dirty;
|
||||
|
||||
void _connpos_update();
|
||||
void _resort();
|
||||
|
||||
Vector2 drag_from;
|
||||
Vector2 drag_accum;
|
||||
bool dragging;
|
||||
protected:
|
||||
|
||||
void _input_event(const InputEvent& p_ev);
|
||||
void _notification(int p_what);
|
||||
static void _bind_methods();
|
||||
|
||||
|
@ -39,8 +62,6 @@ public:
|
|||
|
||||
|
||||
|
||||
void set_title(const String& p_title);
|
||||
String get_title() const;
|
||||
|
||||
void set_slot(int p_idx,bool p_enable_left,int p_type_left,const Color& p_color_left, bool p_enable_right,int p_type_right,const Color& p_color_right);
|
||||
void clear_slot(int p_idx);
|
||||
|
@ -52,6 +73,25 @@ public:
|
|||
int get_slot_type_right(int p_idx) const;
|
||||
Color get_slot_color_right(int p_idx) const;
|
||||
|
||||
void set_title(const String& p_title);
|
||||
String get_title() const;
|
||||
|
||||
void set_offset(const Vector2& p_offset);
|
||||
Vector2 get_offset() const;
|
||||
|
||||
void set_show_close_button(bool p_enable);
|
||||
bool is_close_button_visible() const;
|
||||
|
||||
int get_connection_input_count() ;
|
||||
int get_connection_output_count() ;
|
||||
Vector2 get_connection_input_pos(int p_idx);
|
||||
int get_connection_input_type(int p_idx);
|
||||
Color get_connection_input_color(int p_idx);
|
||||
Vector2 get_connection_output_pos(int p_idx);
|
||||
int get_connection_output_type(int p_idx);
|
||||
Color get_connection_output_color(int p_idx);
|
||||
|
||||
|
||||
virtual Size2 get_minimum_size() const;
|
||||
|
||||
GraphNode();
|
||||
|
|
|
@ -84,6 +84,7 @@ void MenuButton::pressed() {
|
|||
popup->set_parent_rect( Rect2(Point2(gp-popup->get_global_pos()),get_size()));
|
||||
popup->popup();
|
||||
popup->call_deferred("grab_click_focus");
|
||||
popup->set_invalidate_click_until_motion();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "print_string.h"
|
||||
#include "os/keyboard.h"
|
||||
#include "translation.h"
|
||||
#include "os/input.h"
|
||||
|
||||
String PopupMenu::_get_accel_text(uint32_t p_accel) const {
|
||||
|
||||
|
@ -318,6 +319,10 @@ void PopupMenu::_input_event(const InputEvent &p_event) {
|
|||
|
||||
int over=_get_mouse_over(Point2(b.x,b.y));
|
||||
|
||||
if (invalidated_click) {
|
||||
invalidated_click=false;
|
||||
break;
|
||||
}
|
||||
if (over<0 || items[over].separator || items[over].disabled)
|
||||
break; //non-activable
|
||||
|
||||
|
@ -336,6 +341,13 @@ void PopupMenu::_input_event(const InputEvent &p_event) {
|
|||
case InputEvent::MOUSE_MOTION: {
|
||||
|
||||
|
||||
if (invalidated_click) {
|
||||
moved+=Vector2(p_event.mouse_motion.relative_x,p_event.mouse_motion.relative_y);
|
||||
if (moved.length()>4)
|
||||
invalidated_click=false;
|
||||
|
||||
}
|
||||
|
||||
const InputEventMouseMotion &m=p_event.mouse_motion;
|
||||
for(List<Rect2>::Element *E=autohide_areas.front();E;E=E->next()) {
|
||||
|
||||
|
@ -893,12 +905,17 @@ void PopupMenu::_bind_methods() {
|
|||
|
||||
}
|
||||
|
||||
|
||||
void PopupMenu::set_invalidate_click_until_motion() {
|
||||
moved=Vector2();
|
||||
invalidated_click=true;
|
||||
}
|
||||
|
||||
PopupMenu::PopupMenu() {
|
||||
|
||||
idcount=0;
|
||||
mouse_over=-1;
|
||||
|
||||
|
||||
set_focus_mode(FOCUS_ALL);
|
||||
set_as_toplevel(true);
|
||||
|
||||
|
|
|
@ -70,6 +70,8 @@ class PopupMenu : public Popup {
|
|||
void _activate_submenu(int over);
|
||||
void _submenu_timeout();
|
||||
|
||||
bool invalidated_click;
|
||||
Vector2 moved;
|
||||
|
||||
Array _get_items() const;
|
||||
void _set_items(const Array& p_items);
|
||||
|
@ -134,6 +136,8 @@ public:
|
|||
void add_autohide_area(const Rect2& p_area);
|
||||
void clear_autohide_areas();
|
||||
|
||||
void set_invalidate_click_until_motion();
|
||||
|
||||
PopupMenu();
|
||||
~PopupMenu();
|
||||
|
||||
|
|
|
@ -76,6 +76,7 @@
|
|||
#include "scene/gui/video_player.h"
|
||||
#include "scene/gui/reference_frame.h"
|
||||
#include "scene/gui/graph_node.h"
|
||||
#include "scene/gui/graph_edit.h"
|
||||
#include "scene/resources/video_stream.h"
|
||||
#include "scene/2d/particles_2d.h"
|
||||
#include "scene/2d/path_2d.h"
|
||||
|
@ -153,6 +154,8 @@
|
|||
#include "scene/resources/mesh.h"
|
||||
#include "scene/resources/room.h"
|
||||
|
||||
#include "scene/resources/shader_graph.h"
|
||||
|
||||
#include "scene/resources/world.h"
|
||||
#include "scene/resources/world_2d.h"
|
||||
#include "scene/resources/volume.h"
|
||||
|
@ -305,6 +308,7 @@ void register_scene_types() {
|
|||
ObjectTypeDB::register_type<HSplitContainer>();
|
||||
ObjectTypeDB::register_type<VSplitContainer>();
|
||||
ObjectTypeDB::register_type<GraphNode>();
|
||||
ObjectTypeDB::register_type<GraphEdit>();
|
||||
|
||||
OS::get_singleton()->yield(); //may take time to init
|
||||
|
||||
|
@ -496,11 +500,17 @@ void register_scene_types() {
|
|||
ObjectTypeDB::register_type<Mesh>();
|
||||
ObjectTypeDB::register_virtual_type<Material>();
|
||||
ObjectTypeDB::register_type<FixedMaterial>();
|
||||
ObjectTypeDB::register_type<ParticleSystemMaterial>();
|
||||
ObjectTypeDB::register_type<UnshadedMaterial>();
|
||||
//ObjectTypeDB::register_type<ParticleSystemMaterial>();
|
||||
//ObjectTypeDB::register_type<UnshadedMaterial>();
|
||||
ObjectTypeDB::register_type<ShaderMaterial>();
|
||||
ObjectTypeDB::register_type<RoomBounds>();
|
||||
ObjectTypeDB::register_type<Shader>();
|
||||
ObjectTypeDB::register_virtual_type<Shader>();
|
||||
ObjectTypeDB::register_virtual_type<ShaderGraph>();
|
||||
ObjectTypeDB::register_type<MaterialShaderGraph>();
|
||||
ObjectTypeDB::register_type<MaterialShader>();
|
||||
ObjectTypeDB::add_compatibility_type("Shader","MaterialShader");
|
||||
ObjectTypeDB::add_compatibility_type("ParticleSystemMaterial","FixedMaterial");
|
||||
ObjectTypeDB::add_compatibility_type("UnshadedMaterial","FixedMaterial");
|
||||
ObjectTypeDB::register_type<MultiMesh>();
|
||||
ObjectTypeDB::register_type<MeshLibrary>();
|
||||
|
||||
|
|
|
@ -417,12 +417,18 @@ void make_default_theme() {
|
|||
t->set_constant("hseparation","PopupMenu",2);
|
||||
t->set_constant("vseparation","PopupMenu",1);
|
||||
|
||||
Ref<StyleBoxTexture> graphsb = make_stylebox(graph_node_png,6,21,6,5,16,21,16,5);
|
||||
Ref<StyleBoxTexture> graphsb = make_stylebox(graph_node_png,6,24,6,5,16,24,16,5);
|
||||
//graphsb->set_expand_margin_size(MARGIN_LEFT,10);
|
||||
//graphsb->set_expand_margin_size(MARGIN_RIGHT,10);
|
||||
t->set_stylebox("frame","GraphNode", graphsb );
|
||||
t->set_constant("separation","GraphNode", 1 );
|
||||
t->set_icon("port","GraphNode", make_icon( graph_port_png ) );
|
||||
t->set_icon("close","GraphNode", make_icon( graph_node_close_png ) );
|
||||
t->set_font("title_font","GraphNode", default_font );
|
||||
t->set_color("title_color","GraphNode", Color(0,0,0,1));
|
||||
t->set_constant("title_offset","GraphNode", 18);
|
||||
t->set_constant("close_offset","GraphNode", 18);
|
||||
t->set_constant("port_offset","GraphNode", 3);
|
||||
|
||||
|
||||
t->set_stylebox("bg","Tree", make_stylebox( tree_bg_png,4,4,4,5,3,3,3,3) );
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 243 B |
|
@ -104,6 +104,11 @@ static const unsigned char graph_node_png[]={
|
|||
};
|
||||
|
||||
|
||||
static const unsigned char graph_node_close_png[]={
|
||||
0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0xc,0x0,0x0,0x0,0xc,0x8,0x6,0x0,0x0,0x0,0x56,0x75,0x5c,0xe7,0x0,0x0,0x0,0x6,0x62,0x4b,0x47,0x44,0x0,0xff,0x0,0xff,0x0,0xff,0xa0,0xbd,0xa7,0x93,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xde,0xc,0x15,0x14,0x15,0x39,0x35,0x48,0xf8,0xe3,0x0,0x0,0x0,0x80,0x49,0x44,0x41,0x54,0x28,0xcf,0xa5,0xd1,0xb1,0xa,0xc2,0x40,0x10,0x84,0xe1,0x4f,0xe5,0x30,0xad,0x9d,0xb5,0x60,0xeb,0x3,0x88,0x2f,0x6d,0xfa,0xb4,0x29,0x83,0xbd,0xb5,0xb5,0x9d,0x68,0x15,0x9b,0x3d,0xb9,0x4,0x11,0xe,0x7,0xb6,0xd9,0xfd,0x67,0xb9,0xb9,0xa5,0x52,0xab,0xa8,0x13,0xb6,0x78,0xe0,0x39,0x63,0x36,0x38,0x60,0x87,0x1b,0x34,0xb8,0x60,0xc4,0x19,0xa9,0x80,0x53,0xf4,0xc6,0x60,0x9a,0x72,0xd0,0xc6,0xa0,0x2b,0xc,0x5d,0xf4,0xda,0xd9,0xa2,0x8f,0x29,0x3,0x43,0x54,0x5e,0x90,0x7e,0xe5,0xca,0x60,0x36,0x4e,0xb4,0xf4,0x87,0xaa,0x9e,0x54,0x15,0xba,0xea,0x5b,0x17,0x71,0xb8,0x23,0x5e,0xb8,0xe2,0xfe,0xe5,0x70,0x7b,0xac,0xd1,0x57,0x7,0x7d,0x3,0x51,0x8f,0x29,0x6b,0x3c,0x49,0x28,0x81,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
|
||||
};
|
||||
|
||||
|
||||
static const unsigned char graph_port_png[]={
|
||||
0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0xa,0x0,0x0,0x0,0xa,0x8,0x6,0x0,0x0,0x0,0x8d,0x32,0xcf,0xbd,0x0,0x0,0x0,0x6,0x62,0x4b,0x47,0x44,0x0,0x0,0x0,0x0,0x0,0x0,0xf9,0x43,0xbb,0x7f,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xde,0xc,0x14,0x17,0x20,0x3,0xeb,0x8f,0x3a,0xdb,0x0,0x0,0x0,0x19,0x74,0x45,0x58,0x74,0x43,0x6f,0x6d,0x6d,0x65,0x6e,0x74,0x0,0x43,0x72,0x65,0x61,0x74,0x65,0x64,0x20,0x77,0x69,0x74,0x68,0x20,0x47,0x49,0x4d,0x50,0x57,0x81,0xe,0x17,0x0,0x0,0x1,0x65,0x49,0x44,0x41,0x54,0x18,0xd3,0x4d,0xd0,0x4f,0x6b,0xda,0x70,0x1c,0x7,0xe0,0xcf,0x37,0x7f,0x7e,0x49,0x66,0xd2,0x64,0x61,0x5,0x61,0x76,0x47,0xf1,0xa4,0x2d,0xdb,0x75,0x5,0x11,0x84,0xb0,0x5e,0xeb,0xd9,0xeb,0xf4,0x6d,0xec,0x2d,0xf8,0x26,0xb6,0x77,0xe0,0x45,0xba,0xa3,0x6c,0xa0,0x3b,0xad,0x39,0xb6,0x36,0x8,0x1b,0x4b,0x32,0xd2,0xc6,0x6c,0x9a,0x4f,0x4f,0x85,0x3e,0x2f,0xe1,0x11,0x0,0x20,0x29,0xd3,0xe9,0xd4,0xda,0x6e,0xb7,0x23,0xdf,0xf7,0xbb,0x0,0x90,0xe7,0xf9,0x8f,0x66,0xb3,0xf9,0x79,0x36,0x9b,0x55,0x22,0x42,0x83,0xa4,0x44,0x51,0xf4,0xea,0xe2,0xe2,0xc3,0xf7,0xf1,0x78,0xdc,0xa,0x82,0x40,0x8,0x20,0xcf,0x32,0x2e,0x97,0xcb,0x4f,0x51,0x14,0xbd,0x25,0xf9,0x5b,0x26,0x93,0x89,0xdd,0xe9,0x74,0xe2,0xf7,0xe7,0xe7,0x27,0x59,0xfa,0x87,0x65,0xb9,0x13,0x0,0xb0,0x1d,0x9b,0xe1,0xcb,0x50,0xbe,0x5e,0x5d,0xdd,0xfe,0xbc,0xbe,0x6e,0x6b,0x49,0x92,0x8c,0x4e,0x7b,0xa7,0xad,0xbf,0x79,0x4e,0xd3,0x54,0x12,0x86,0x21,0xc2,0x30,0x84,0x32,0x95,0xe4,0x79,0xc6,0xde,0xd9,0x59,0x2b,0x49,0xee,0x46,0x86,0xeb,0xba,0x5d,0xfb,0x85,0x23,0x87,0xfd,0x1e,0xb6,0xed,0x40,0xd7,0x35,0x0,0x40,0x7d,0x38,0xa0,0xdc,0xed,0x44,0x37,0x74,0xb8,0xae,0xd7,0x35,0x48,0x62,0xff,0xff,0x1f,0xfc,0x20,0x80,0xae,0xe9,0x78,0x42,0x0,0xca,0xb2,0x90,0x65,0x19,0x58,0xd7,0xd0,0x8a,0xa2,0x58,0xa7,0x69,0x56,0x6b,0xa2,0x51,0x29,0x5,0xcb,0x52,0xb0,0x94,0x5,0x4b,0x29,0x88,0x8,0xd3,0x34,0xad,0x8b,0xfb,0x62,0xad,0xf,0x6,0x83,0xb8,0xaa,0xaa,0xb1,0xe7,0x79,0xbe,0x77,0x74,0x44,0xb7,0xe1,0x89,0x69,0x1a,0x28,0xcb,0x92,0x9b,0xcd,0x46,0x56,0xab,0xd5,0x86,0xe4,0x47,0x21,0x29,0xc3,0xe1,0xf0,0xb8,0xdf,0xef,0x7f,0x6b,0xb7,0xdb,0xaf,0x1b,0x8d,0x86,0x46,0x10,0xf,0xf7,0xf,0x75,0x1c,0xc7,0x77,0x8b,0xc5,0xe2,0xdd,0x7c,0x3e,0xff,0x25,0xcf,0xc3,0x6f,0x6e,0x6f,0x2e,0x1d,0xdb,0xe9,0x9,0x80,0xb2,0x2a,0xd7,0x27,0xad,0x37,0x5f,0x9e,0xc2,0x1f,0x1,0x3a,0xe6,0xa5,0x7b,0xef,0xf2,0xf3,0xcd,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
|
||||
};
|
||||
|
|
|
@ -501,7 +501,7 @@ bool ShaderMaterial::_get(const StringName& p_name,Variant &r_ret) const {
|
|||
|
||||
void ShaderMaterial::_get_property_list( List<PropertyInfo> *p_list) const {
|
||||
|
||||
p_list->push_back( PropertyInfo( Variant::OBJECT, "shader/shader", PROPERTY_HINT_RESOURCE_TYPE,"Shader" ) );
|
||||
p_list->push_back( PropertyInfo( Variant::OBJECT, "shader/shader", PROPERTY_HINT_RESOURCE_TYPE,"MaterialShader,MaterialShaderGraph" ) );
|
||||
|
||||
if (!shader.is_null()) {
|
||||
|
||||
|
|
|
@ -33,12 +33,6 @@
|
|||
#include "scene/scene_string_names.h"
|
||||
|
||||
|
||||
void Shader::set_mode(Mode p_mode) {
|
||||
|
||||
ERR_FAIL_INDEX(p_mode,2);
|
||||
VisualServer::get_singleton()->shader_set_mode(shader,VisualServer::ShaderMode(p_mode));
|
||||
emit_signal(SceneStringNames::get_singleton()->changed);
|
||||
}
|
||||
|
||||
Shader::Mode Shader::get_mode() const {
|
||||
|
||||
|
@ -176,7 +170,6 @@ void Shader::get_default_texture_param_list(List<StringName>* r_textures) const{
|
|||
|
||||
void Shader::_bind_methods() {
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_mode","mode"),&Shader::set_mode);
|
||||
ObjectTypeDB::bind_method(_MD("get_mode"),&Shader::get_mode);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_code","vcode","fcode","lcode","fofs","lofs"),&Shader::set_code,DEFVAL(0),DEFVAL(0));
|
||||
|
@ -203,9 +196,9 @@ void Shader::_bind_methods() {
|
|||
|
||||
}
|
||||
|
||||
Shader::Shader() {
|
||||
Shader::Shader(Mode p_mode) {
|
||||
|
||||
shader = VisualServer::get_singleton()->shader_create();
|
||||
shader = VisualServer::get_singleton()->shader_create(VS::ShaderMode(p_mode));
|
||||
params_cache_dirty=true;
|
||||
}
|
||||
|
||||
|
@ -237,7 +230,7 @@ RES ResourceFormatLoaderShader::load(const String &p_path,const String& p_origin
|
|||
String base_path = p_path.get_base_dir();
|
||||
|
||||
|
||||
Ref<Shader> shader( memnew( Shader ) );
|
||||
Ref<Shader> shader;//( memnew( Shader ) );
|
||||
|
||||
int line=0;
|
||||
|
||||
|
|
|
@ -50,6 +50,8 @@ class Shader : public Resource {
|
|||
mutable Map<StringName,StringName> params_cache; //map a shader param to a material param..
|
||||
Map<StringName,Ref<Texture> > default_textures;
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
@ -59,10 +61,11 @@ public:
|
|||
|
||||
MODE_MATERIAL,
|
||||
MODE_CANVAS_ITEM,
|
||||
MODE_POST_PROCESS
|
||||
MODE_POST_PROCESS,
|
||||
MODE_MAX
|
||||
};
|
||||
|
||||
void set_mode(Mode p_mode);
|
||||
//void set_mode(Mode p_mode);
|
||||
Mode get_mode() const;
|
||||
|
||||
void set_code( const String& p_vertex, const String& p_fragment, const String& p_light,int p_fragment_ofs=0,int p_light_ofs=0);
|
||||
|
@ -79,13 +82,22 @@ public:
|
|||
|
||||
virtual RID get_rid() const;
|
||||
|
||||
Shader();
|
||||
Shader(Mode p_mode);
|
||||
~Shader();
|
||||
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST( Shader::Mode );
|
||||
|
||||
class MaterialShader : public Shader {
|
||||
|
||||
OBJ_TYPE(MaterialShader,Shader);
|
||||
|
||||
public:
|
||||
|
||||
MaterialShader() : Shader(MODE_MATERIAL) {};
|
||||
};
|
||||
|
||||
|
||||
|
||||
class ResourceFormatLoaderShader : public ResourceFormatLoader {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -29,87 +29,54 @@
|
|||
#ifndef SHADER_GRAPH_H
|
||||
#define SHADER_GRAPH_H
|
||||
|
||||
#if 0
|
||||
|
||||
|
||||
#include "map.h"
|
||||
#include "scene/resources/shader.h"
|
||||
|
||||
class ShaderGraph : public Resource {
|
||||
class ShaderGraph : public Shader {
|
||||
|
||||
OBJ_TYPE( ShaderGraph, Resource );
|
||||
OBJ_TYPE( ShaderGraph, Shader );
|
||||
RES_BASE_EXTENSION("sgp");
|
||||
|
||||
public:
|
||||
|
||||
enum NodeType {
|
||||
NODE_IN, ///< param 0: name
|
||||
NODE_OUT, ///< param 0: name
|
||||
NODE_CONSTANT, ///< param 0: value
|
||||
NODE_PARAMETER, ///< param 0: name
|
||||
NODE_ADD,
|
||||
NODE_SUB,
|
||||
NODE_MUL,
|
||||
NODE_DIV,
|
||||
NODE_MOD,
|
||||
NODE_SIN,
|
||||
NODE_COS,
|
||||
NODE_TAN,
|
||||
NODE_ARCSIN,
|
||||
NODE_ARCCOS,
|
||||
NODE_ARCTAN,
|
||||
NODE_POW,
|
||||
NODE_LOG,
|
||||
NODE_MAX,
|
||||
NODE_MIN,
|
||||
NODE_COMPARE,
|
||||
NODE_TEXTURE, ///< param 0: texture
|
||||
NODE_TIME, ///< param 0: interval length
|
||||
NODE_NOISE,
|
||||
NODE_PASS,
|
||||
NODE_VEC_IN, ///< param 0: name
|
||||
NODE_VEC_OUT, ///< param 0: name
|
||||
NODE_VEC_CONSTANT, ///< param 0: value
|
||||
NODE_VEC_PARAMETER, ///< param 0: name
|
||||
NODE_VEC_ADD,
|
||||
NODE_VEC_SUB,
|
||||
NODE_VEC_MUL,
|
||||
NODE_VEC_DIV,
|
||||
NODE_VEC_MOD,
|
||||
NODE_VEC_CROSS,
|
||||
NODE_VEC_DOT,
|
||||
NODE_VEC_POW,
|
||||
NODE_VEC_NORMALIZE,
|
||||
NODE_VEC_INTERPOLATE,
|
||||
NODE_VEC_SCREEN_TO_UV,
|
||||
NODE_VEC_TRANSFORM3,
|
||||
NODE_VEC_TRANSFORM4,
|
||||
NODE_VEC_COMPARE,
|
||||
NODE_VEC_TEXTURE_2D,
|
||||
NODE_VEC_TEXTURE_CUBE,
|
||||
NODE_VEC_NOISE,
|
||||
NODE_VEC_0,
|
||||
NODE_VEC_1,
|
||||
NODE_VEC_2,
|
||||
NODE_VEC_BUILD,
|
||||
NODE_VEC_PASS,
|
||||
NODE_COLOR_CONSTANT,
|
||||
NODE_COLOR_PARAMETER,
|
||||
NODE_TEXTURE_PARAMETER,
|
||||
NODE_TEXTURE_2D_PARAMETER,
|
||||
NODE_TEXTURE_CUBE_PARAMETER,
|
||||
NODE_TRANSFORM_CONSTANT,
|
||||
NODE_TRANSFORM_PARAMETER,
|
||||
NODE_LABEL,
|
||||
NODE_INPUT, // all inputs (shader type dependent)
|
||||
NODE_SCALAR_CONST, //scalar constant
|
||||
NODE_VEC_CONST, //vec3 constant
|
||||
NODE_RGB_CONST, //rgb constant (shows a color picker instead)
|
||||
NODE_XFORM_CONST, // 4x4 matrix constant
|
||||
NODE_TIME, // time in seconds
|
||||
NODE_SCREEN_TEX, // screen texture sampler (takes UV) (only usable in fragment shader)
|
||||
NODE_SCALAR_OP, // scalar vs scalar op (mul, add, div, etc)
|
||||
NODE_VEC_OP, // vec3 vs vec3 op (mul,ad,div,crossprod,etc)
|
||||
NODE_VEC_SCALAR_OP, // vec3 vs scalar op (mul, add, div, etc)
|
||||
NODE_RGB_OP, // vec3 vs vec3 rgb op (with scalar amount), like brighten, darken, burn, dodge, multiply, etc.
|
||||
NODE_XFORM_MULT, // mat4 x mat4
|
||||
NODE_XFORM_VEC_MULT, // mat4 x vec3 mult (with no-translation option)
|
||||
NODE_XFORM_VEC_INV_MULT, // mat4 x vec3 inverse mult (with no-translation option)
|
||||
NODE_SCALAR_FUNC, // scalar function (sin, cos, etc)
|
||||
NODE_VEC_FUNC, // vector function (normalize, negate, reciprocal, rgb2hsv, hsv2rgb, etc, etc)
|
||||
NODE_VEC_LEN, // vec3 length
|
||||
NODE_DOT_PROD, // vec3 . vec3 (dot product -> scalar output)
|
||||
NODE_VEC_TO_SCALAR, // 1 vec3 input, 3 scalar outputs
|
||||
NODE_SCALAR_TO_VEC, // 3 scalar input, 1 vec3 output
|
||||
NODE_XFORM_TO_VEC, // 3 vec input, 1 xform output
|
||||
NODE_VEC_TO_XFORM, // 3 vec input, 1 xform output
|
||||
NODE_SCALAR_INTERP, // scalar interpolation (with optional curve)
|
||||
NODE_VEC_INTERP, // vec3 interpolation (with optional curve)
|
||||
NODE_SCALAR_INPUT, // scalar uniform (assignable in material)
|
||||
NODE_VEC_INPUT, // vec3 uniform (assignable in material)
|
||||
NODE_RGB_INPUT, // color uniform (assignable in material)
|
||||
NODE_XFORM_INPUT, // mat4 uniform (assignable in material)
|
||||
NODE_TEXTURE_INPUT, // texture input (assignable in material)
|
||||
NODE_CUBEMAP_INPUT, // cubemap input (assignable in material)
|
||||
NODE_OUTPUT, // output (shader type dependent)
|
||||
NODE_COMMENT, // comment
|
||||
NODE_TYPE_MAX
|
||||
};
|
||||
|
||||
enum ShaderType {
|
||||
SHADER_VERTEX,
|
||||
SHADER_FRAGMENT,
|
||||
SHADER_LIGHT
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
struct Connection {
|
||||
|
||||
|
@ -119,70 +86,287 @@ private:
|
|||
int dst_slot;
|
||||
};
|
||||
|
||||
enum SlotType {
|
||||
|
||||
SLOT_TYPE_SCALAR,
|
||||
SLOT_TYPE_VEC,
|
||||
SLOT_TYPE_XFORM,
|
||||
SLOT_TYPE_TEXTURE,
|
||||
SLOT_MAX
|
||||
};
|
||||
|
||||
enum ShaderType {
|
||||
SHADER_TYPE_VERTEX,
|
||||
SHADER_TYPE_FRAGMENT,
|
||||
SHADER_TYPE_LIGHT,
|
||||
SHADER_TYPE_MAX
|
||||
};
|
||||
|
||||
enum SlotDir {
|
||||
SLOT_IN,
|
||||
SLOT_OUT
|
||||
};
|
||||
|
||||
enum GraphError {
|
||||
GRAPH_OK,
|
||||
GRAPH_ERROR_CYCLIC,
|
||||
GRAPH_ERROR_MISSING_CONNECTIONS
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
String _find_unique_name(ShaderType p_which, const String& p_base);
|
||||
|
||||
struct SourceSlot {
|
||||
|
||||
int id;
|
||||
int slot;
|
||||
bool operator==(const SourceSlot& p_slot) const {
|
||||
return id==p_slot.id && slot==p_slot.slot;
|
||||
}
|
||||
};
|
||||
|
||||
struct Node {
|
||||
|
||||
int16_t x,y;
|
||||
Vector2 pos;
|
||||
NodeType type;
|
||||
Variant param;
|
||||
Variant param1;
|
||||
Variant param2;
|
||||
int id;
|
||||
mutable int order; // used for sorting
|
||||
mutable bool out_valid;
|
||||
mutable bool in_valid;
|
||||
int sort_order;
|
||||
Map<int,SourceSlot> connections;
|
||||
|
||||
};
|
||||
|
||||
struct ShaderData {
|
||||
Map<int,Node> node_map;
|
||||
List<Connection> connections;
|
||||
GraphError error;
|
||||
} shader[3];
|
||||
uint64_t version;
|
||||
|
||||
|
||||
|
||||
struct InOutParamInfo {
|
||||
Mode shader_mode;
|
||||
ShaderType shader_type;
|
||||
const char *name;
|
||||
const char *variable;
|
||||
SlotType slot_type;
|
||||
SlotDir dir;
|
||||
};
|
||||
|
||||
static const InOutParamInfo inout_param_info[];
|
||||
|
||||
struct NodeSlotInfo {
|
||||
|
||||
enum { MAX_INS=3, MAX_OUTS=3 };
|
||||
NodeType type;
|
||||
const SlotType ins[MAX_INS];
|
||||
const SlotType outs[MAX_OUTS];
|
||||
};
|
||||
|
||||
static const NodeSlotInfo node_slot_info[];
|
||||
|
||||
bool _pending_update_shader;
|
||||
void _update_shader();
|
||||
void _request_update();
|
||||
|
||||
void _add_node_code(ShaderType p_type,Node *p_node,const Vector<String>& p_inputs,String& code);
|
||||
|
||||
Array _get_node_list(ShaderType p_type) const;
|
||||
Array _get_connections(ShaderType p_type) const;
|
||||
protected:
|
||||
|
||||
/* bool _set(const StringName& p_name, const Variant& p_value);
|
||||
bool _get(const StringName& p_name,Variant &r_ret) const;
|
||||
void _get_property_list( List<PropertyInfo> *p_list) const;*/
|
||||
|
||||
static void _bind_methods();
|
||||
|
||||
Array _get_connections_helper() const;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
void node_add(ShaderType p_which, NodeType p_type,int p_id);
|
||||
void node_add(ShaderType p_type, NodeType p_node_type, int p_id);
|
||||
void node_remove(ShaderType p_which,int p_id);
|
||||
void node_set_param(ShaderType p_which, int p_id, const Variant& p_value);
|
||||
void node_set_pos(ShaderType p_which,int p_id,const Point2& p_pos);
|
||||
void node_change_type(ShaderType p_which,int p_id, NodeType p_type);
|
||||
Point2 node_get_pos(ShaderType p_which,int p_id) const;
|
||||
|
||||
void get_node_list(ShaderType p_which,List<int> *p_node_list) const;
|
||||
NodeType node_get_type(ShaderType p_which,int p_id) const;
|
||||
Variant node_get_param(ShaderType p_which,int p_id) const;
|
||||
|
||||
Error connect(ShaderType p_which,int p_src_id,int p_src_slot, int p_dst_id,int p_dst_slot);
|
||||
bool is_connected(ShaderType p_which,int p_src_id,int p_src_slot, int p_dst_id,int p_dst_slot) const;
|
||||
void disconnect(ShaderType p_which,int p_src_id,int p_src_slot, int p_dst_id,int p_dst_slot);
|
||||
void scalar_const_node_set_value(ShaderType p_which,int p_id,float p_value);
|
||||
float scalar_const_node_get_value(ShaderType p_which,int p_id) const;
|
||||
|
||||
void get_connections(ShaderType p_which,List<Connection> *p_connections) const;
|
||||
void vec_const_node_set_value(ShaderType p_which,int p_id,const Vector3& p_value);
|
||||
Vector3 vec_const_node_get_value(ShaderType p_which,int p_id) const;
|
||||
|
||||
void clear();
|
||||
void rgb_const_node_set_value(ShaderType p_which,int p_id,const Color& p_value);
|
||||
Color rgb_const_node_get_value(ShaderType p_which,int p_id) const;
|
||||
|
||||
uint64_t get_version() const { return version; }
|
||||
void xform_const_node_set_value(ShaderType p_which,int p_id,const Transform& p_value);
|
||||
Transform xform_const_node_get_value(ShaderType p_which,int p_id) const;
|
||||
|
||||
static void get_default_input_nodes(Mode p_type,List<PropertyInfo> *p_inputs);
|
||||
static void get_default_output_nodes(Mode p_type,List<PropertyInfo> *p_outputs);
|
||||
void texture_node_set_filter_size(ShaderType p_which,int p_id,int p_size);
|
||||
int texture_node_get_filter_size(ShaderType p_which,int p_id) const;
|
||||
|
||||
static PropertyInfo node_get_type_info(NodeType p_type);
|
||||
static int get_input_count(NodeType p_type);
|
||||
static int get_output_count(NodeType p_type);
|
||||
static String get_input_name(NodeType p_type,int p_input);
|
||||
static String get_output_name(NodeType p_type,int p_output);
|
||||
static bool is_input_vector(NodeType p_type,int p_input);
|
||||
static bool is_output_vector(NodeType p_type,int p_input);
|
||||
void texture_node_set_filter_strength(ShaderType p_which,float p_id,float p_strength);
|
||||
float texture_node_get_filter_strength(ShaderType p_which,float p_id) const;
|
||||
|
||||
enum ScalarOp {
|
||||
SCALAR_OP_ADD,
|
||||
SCALAR_OP_SUB,
|
||||
SCALAR_OP_MUL,
|
||||
SCALAR_OP_DIV,
|
||||
SCALAR_OP_MOD,
|
||||
SCALAR_OP_POW,
|
||||
SCALAR_OP_MAX,
|
||||
SCALAR_OP_MIN,
|
||||
SCALAR_OP_ATAN2,
|
||||
SCALAR_MAX_OP
|
||||
};
|
||||
|
||||
void scalar_op_node_set_op(ShaderType p_which,float p_id,ScalarOp p_op);
|
||||
ScalarOp scalar_op_node_get_op(ShaderType p_which,float p_id) const;
|
||||
|
||||
enum VecOp {
|
||||
VEC_OP_ADD,
|
||||
VEC_OP_SUB,
|
||||
VEC_OP_MUL,
|
||||
VEC_OP_DIV,
|
||||
VEC_OP_MOD,
|
||||
VEC_OP_POW,
|
||||
VEC_OP_MAX,
|
||||
VEC_OP_MIN,
|
||||
VEC_OP_CROSS,
|
||||
VEC_MAX_OP
|
||||
};
|
||||
|
||||
void vec_op_node_set_op(ShaderType p_which,float p_id,VecOp p_op);
|
||||
VecOp vec_op_node_get_op(ShaderType p_which,float p_id) const;
|
||||
|
||||
enum VecScalarOp {
|
||||
VEC_SCALAR_OP_MUL,
|
||||
VEC_SCALAR_OP_DIV,
|
||||
VEC_SCALAR_OP_POW,
|
||||
VEC_SCALAR_MAX_OP
|
||||
};
|
||||
|
||||
void vec_scalar_op_node_set_op(ShaderType p_which,float p_id,VecScalarOp p_op);
|
||||
VecScalarOp vec_scalar_op_node_get_op(ShaderType p_which,float p_id) const;
|
||||
|
||||
enum RGBOp {
|
||||
RGB_OP_SCREEN,
|
||||
RGB_OP_DIFFERENCE,
|
||||
RGB_OP_DARKEN,
|
||||
RGB_OP_LIGHTEN,
|
||||
RGB_OP_OVERLAY,
|
||||
RGB_OP_DODGE,
|
||||
RGB_OP_BURN,
|
||||
RGB_OP_SOFT_LIGHT,
|
||||
RGB_OP_HARD_LIGHT,
|
||||
RGB_MAX_OP
|
||||
};
|
||||
|
||||
void rgb_op_node_set_op(ShaderType p_which,float p_id,RGBOp p_op,float p_c);
|
||||
RGBOp rgb_op_node_get_op(ShaderType p_which,float p_id) const;
|
||||
float rgb_op_node_get_c(ShaderType p_which,float p_id) const;
|
||||
|
||||
void xform_vec_mult_node_set_no_translation(ShaderType p_which,int p_id,bool p_no_translation);
|
||||
bool xform_vec_mult_node_get_no_translation(ShaderType p_which,int p_id) const;
|
||||
|
||||
enum ScalarFunc {
|
||||
SCALAR_FUNC_SIN,
|
||||
SCALAR_FUNC_COS,
|
||||
SCALAR_FUNC_TAN,
|
||||
SCALAR_FUNC_ASIN,
|
||||
SCALAR_FUNC_ACOS,
|
||||
SCALAR_FUNC_ATAN,
|
||||
SCALAR_FUNC_SINH,
|
||||
SCALAR_FUNC_COSH,
|
||||
SCALAR_FUNC_TANH,
|
||||
SCALAR_FUNC_LOG,
|
||||
SCALAR_FUNC_EXP,
|
||||
SCALAR_FUNC_SQRT,
|
||||
SCALAR_FUNC_ABS,
|
||||
SCALAR_FUNC_SIGN,
|
||||
SCALAR_FUNC_FLOOR,
|
||||
SCALAR_FUNC_ROUND,
|
||||
SCALAR_FUNC_CEIL,
|
||||
SCALAR_FUNC_FRAC,
|
||||
SCALAR_FUNC_SATURATE,
|
||||
SCALAR_FUNC_NEGATE,
|
||||
SCALAR_MAX_FUNC
|
||||
};
|
||||
|
||||
void scalar_func_node_set_function(ShaderType p_which,int p_id,ScalarFunc p_func);
|
||||
ScalarFunc scalar_func_node_get_function(ShaderType p_which,int p_id) const;
|
||||
|
||||
enum VecFunc {
|
||||
VEC_FUNC_NORMALIZE,
|
||||
VEC_FUNC_SATURATE,
|
||||
VEC_FUNC_NEGATE,
|
||||
VEC_FUNC_RECIPROCAL,
|
||||
VEC_FUNC_RGB2HSV,
|
||||
VEC_FUNC_HSV2RGB,
|
||||
VEC_MAX_FUNC
|
||||
};
|
||||
|
||||
void vec_func_node_set_function(ShaderType p_which,int p_id,VecFunc p_func);
|
||||
VecFunc vec_func_node_get_function(ShaderType p_which,int p_id) const;
|
||||
|
||||
void input_node_set_name(ShaderType p_which,int p_id,const String& p_name);
|
||||
String input_node_get_name(ShaderType p_which,int p_id);
|
||||
|
||||
void scalar_input_node_set_value(ShaderType p_which,int p_id,float p_value);
|
||||
float scalar_input_node_get_value(ShaderType p_which,int p_id) const;
|
||||
|
||||
void vec_input_node_set_value(ShaderType p_which,int p_id,const Vector3& p_value);
|
||||
Vector3 vec_input_node_get_value(ShaderType p_which,int p_id) const;
|
||||
|
||||
void rgb_input_node_set_value(ShaderType p_which,int p_id,const Color& p_value);
|
||||
Color rgb_input_node_get_value(ShaderType p_which,int p_id) const;
|
||||
|
||||
void xform_input_node_set_value(ShaderType p_which,int p_id,const Transform& p_value);
|
||||
Transform xform_input_node_get_value(ShaderType p_which,int p_id) const;
|
||||
|
||||
void texture_input_node_set_value(ShaderType p_which,int p_id,const Ref<Texture>& p_texture);
|
||||
Ref<Texture> texture_input_node_get_value(ShaderType p_which,int p_id) const;
|
||||
|
||||
void cubemap_input_node_set_value(ShaderType p_which,int p_id,const Ref<CubeMap>& p_cubemap);
|
||||
Ref<CubeMap> cubemap_input_node_get_value(ShaderType p_which,int p_id) const;
|
||||
|
||||
void comment_node_set_text(ShaderType p_which,int p_id,const String& p_comment);
|
||||
String comment_node_get_text(ShaderType p_which,int p_id) const;
|
||||
|
||||
Error connect_node(ShaderType p_which,int p_src_id,int p_src_slot, int p_dst_id,int p_dst_slot);
|
||||
bool is_node_connected(ShaderType p_which,int p_src_id,int p_src_slot, int p_dst_id,int p_dst_slot) const;
|
||||
void disconnect_node(ShaderType p_which,int p_src_id,int p_src_slot, int p_dst_id,int p_dst_slot);
|
||||
|
||||
void get_node_connections(ShaderType p_which,List<Connection> *p_connections) const;
|
||||
|
||||
void clear(ShaderType p_which);
|
||||
|
||||
Variant node_get_state(ShaderType p_type, int p_node) const;
|
||||
void node_set_state(ShaderType p_type, int p_id, const Variant& p_state);
|
||||
|
||||
static int get_type_input_count(NodeType p_type);
|
||||
static int get_type_output_count(NodeType p_type);
|
||||
static SlotType get_type_input_type(NodeType p_type,int p_idx);
|
||||
static SlotType get_type_output_type(NodeType p_type,int p_idx);
|
||||
static bool is_type_valid(Mode p_mode,ShaderType p_type);
|
||||
|
||||
|
||||
ShaderGraph();
|
||||
struct SlotInfo {
|
||||
String name;
|
||||
SlotType type;
|
||||
SlotDir dir;
|
||||
};
|
||||
|
||||
static void get_input_output_node_slot_info(Mode p_mode, ShaderType p_type, List<SlotInfo> *r_slots);
|
||||
|
||||
static int get_node_input_slot_count(Mode p_mode, ShaderType p_shader_type,NodeType p_type);
|
||||
static int get_node_output_slot_count(Mode p_mode, ShaderType p_shader_type,NodeType p_type);
|
||||
static SlotType get_node_input_slot_type(Mode p_mode, ShaderType p_shader_type,NodeType p_type,int p_idx);
|
||||
static SlotType get_node_output_slot_type(Mode p_mode, ShaderType p_shader_type,NodeType p_type,int p_idx);
|
||||
|
||||
|
||||
ShaderGraph(Mode p_mode);
|
||||
~ShaderGraph();
|
||||
};
|
||||
|
||||
|
@ -192,6 +376,27 @@ public:
|
|||
|
||||
|
||||
VARIANT_ENUM_CAST( ShaderGraph::NodeType );
|
||||
VARIANT_ENUM_CAST( ShaderGraph::ShaderType );
|
||||
VARIANT_ENUM_CAST( ShaderGraph::SlotType );
|
||||
VARIANT_ENUM_CAST( ShaderGraph::ScalarOp );
|
||||
VARIANT_ENUM_CAST( ShaderGraph::VecOp );
|
||||
VARIANT_ENUM_CAST( ShaderGraph::VecScalarOp );
|
||||
VARIANT_ENUM_CAST( ShaderGraph::RGBOp );
|
||||
VARIANT_ENUM_CAST( ShaderGraph::ScalarFunc );
|
||||
VARIANT_ENUM_CAST( ShaderGraph::VecFunc );
|
||||
|
||||
|
||||
class MaterialShaderGraph : public ShaderGraph {
|
||||
|
||||
OBJ_TYPE( MaterialShaderGraph, ShaderGraph );
|
||||
RES_BASE_EXTENSION("sgp");
|
||||
|
||||
public:
|
||||
|
||||
|
||||
MaterialShaderGraph() : ShaderGraph(MODE_MATERIAL) {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // SHADER_GRAPH_H
|
||||
|
|
|
@ -26,8 +26,6 @@
|
|||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef SHADER_GRAPH_H
|
||||
#define SHADER_GRAPH_H
|
||||
|
||||
#if 0
|
||||
|
||||
|
@ -109,4 +107,3 @@ public:
|
|||
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
|
17
tools/SCsub
17
tools/SCsub
|
@ -5,13 +5,16 @@ env.add_source_files(env.tool_sources,"*.cpp")
|
|||
|
||||
Export('env')
|
||||
|
||||
SConscript('editor/SCsub');
|
||||
#SConscript('scintilla/SCsub');
|
||||
SConscript('collada/SCsub');
|
||||
SConscript('docdump/SCsub');
|
||||
SConscript('freetype/SCsub');
|
||||
SConscript('doc/SCsub');
|
||||
SConscript('pck/SCsub');
|
||||
if (env["tools"]!="no"):
|
||||
SConscript('editor/SCsub');
|
||||
#SConscript('scintilla/SCsub');
|
||||
SConscript('collada/SCsub');
|
||||
SConscript('docdump/SCsub');
|
||||
SConscript('freetype/SCsub');
|
||||
SConscript('doc/SCsub')
|
||||
SConscript('pck/SCsub')
|
||||
|
||||
|
||||
|
||||
lib = env.Library("tool",env.tool_sources)
|
||||
|
||||
|
|
|
@ -186,8 +186,10 @@ void DocData::generate(bool p_basic_types) {
|
|||
arginfo=E->get().return_val;
|
||||
if (arginfo.type==Variant::NIL)
|
||||
continue;
|
||||
|
||||
method.return_type=(arginfo.hint==PROPERTY_HINT_RESOURCE_TYPE)?arginfo.hint_string:Variant::get_type_name(arginfo.type);
|
||||
if (m && m->get_return_type()!=StringName())
|
||||
method.return_type=m->get_return_type();
|
||||
else
|
||||
method.return_type=(arginfo.hint==PROPERTY_HINT_RESOURCE_TYPE)?arginfo.hint_string:Variant::get_type_name(arginfo.type);
|
||||
|
||||
} else {
|
||||
|
||||
|
|
|
@ -75,6 +75,7 @@
|
|||
#include "plugins/tile_map_editor_plugin.h"
|
||||
#include "plugins/cube_grid_theme_editor_plugin.h"
|
||||
#include "plugins/shader_editor_plugin.h"
|
||||
#include "plugins/shader_graph_editor_plugin.h"
|
||||
#include "plugins/path_editor_plugin.h"
|
||||
#include "plugins/rich_text_editor_plugin.h"
|
||||
#include "plugins/collision_polygon_editor_plugin.h"
|
||||
|
@ -3245,7 +3246,7 @@ EditorNode::EditorNode() {
|
|||
gui_base->set_area_as_parent_rect();
|
||||
|
||||
|
||||
Ref<Theme> theme( memnew( Theme ) );
|
||||
theme = Ref<Theme>( memnew( Theme ) );
|
||||
gui_base->set_theme( theme );
|
||||
editor_register_icons(theme);
|
||||
editor_register_fonts(theme);
|
||||
|
@ -4016,6 +4017,7 @@ EditorNode::EditorNode() {
|
|||
add_editor_plugin( memnew( ScriptEditorPlugin(this) ) );
|
||||
add_editor_plugin( memnew( EditorHelpPlugin(this) ) );
|
||||
add_editor_plugin( memnew( AnimationPlayerEditorPlugin(this) ) );
|
||||
add_editor_plugin( memnew( ShaderGraphEditorPlugin(this) ) );
|
||||
add_editor_plugin( memnew( ShaderEditorPlugin(this) ) );
|
||||
add_editor_plugin( memnew( CameraEditorPlugin(this) ) );
|
||||
add_editor_plugin( memnew( SampleEditorPlugin(this) ) );
|
||||
|
|
|
@ -212,6 +212,7 @@ class EditorNode : public Node {
|
|||
AcceptDialog *load_error_dialog;
|
||||
|
||||
Control *scene_root_base;
|
||||
Ref<Theme> theme;
|
||||
|
||||
PopupMenu *recent_scenes;
|
||||
Button *property_back;
|
||||
|
@ -472,6 +473,9 @@ public:
|
|||
|
||||
void stop_child_process();
|
||||
|
||||
Ref<Theme> get_editor_theme() const { return theme; }
|
||||
|
||||
|
||||
Error export_platform(const String& p_platform, const String& p_path, bool p_debug,const String& p_password,bool p_quit_after=false);
|
||||
|
||||
static void register_editor_types();
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 568 B |
Binary file not shown.
After Width: | Height: | Size: 575 B |
Binary file not shown.
After Width: | Height: | Size: 844 B |
Binary file not shown.
After Width: | Height: | Size: 949 B |
|
@ -398,11 +398,13 @@ CollisionPolygon2DEditor::CollisionPolygon2DEditor(EditorNode *p_editor) {
|
|||
add_child(button_create);
|
||||
button_create->connect("pressed",this,"_menu_option",varray(MODE_CREATE));
|
||||
button_create->set_toggle_mode(true);
|
||||
button_create->set_tooltip("Create a new polygon from scratch");
|
||||
|
||||
button_edit = memnew( ToolButton );
|
||||
add_child(button_edit);
|
||||
button_edit->connect("pressed",this,"_menu_option",varray(MODE_EDIT));
|
||||
button_edit->set_toggle_mode(true);
|
||||
button_edit->set_tooltip("Edit existing polygon:\nLMB: Move Point.\nCtrl+LMB: Split Segment.\nRMB: Erase Point.");
|
||||
|
||||
//add_constant_override("separation",0);
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -29,122 +29,121 @@
|
|||
#ifndef SHADER_GRAPH_EDITOR_PLUGIN_H
|
||||
#define SHADER_GRAPH_EDITOR_PLUGIN_H
|
||||
|
||||
#if 0
|
||||
|
||||
#include "tools/editor/editor_plugin.h"
|
||||
#include "tools/editor/editor_node.h"
|
||||
#include "scene/resources/shader.h"
|
||||
#include "servers/visual/shader_graph.h"
|
||||
#include "scene/gui/tree.h"
|
||||
#include "scene/gui/button.h"
|
||||
#include "scene/gui/graph_edit.h"
|
||||
#include "scene/gui/popup.h"
|
||||
#include "tools/editor/property_editor.h"
|
||||
#include "scene/resources/shader_graph.h"
|
||||
/**
|
||||
@author Juan Linietsky <reduzio@gmail.com>
|
||||
*/
|
||||
|
||||
class ShaderEditor : public Control {
|
||||
|
||||
OBJ_TYPE(ShaderEditor, Control );
|
||||
class ShaderGraphView : public Node {
|
||||
|
||||
enum MenuAction {
|
||||
OBJ_TYPE(ShaderGraphView,Node);
|
||||
|
||||
GRAPH_ADD_NODE,
|
||||
GRAPH_CLEAR,
|
||||
NODE_DISCONNECT,
|
||||
NODE_ERASE,
|
||||
|
||||
};
|
||||
|
||||
enum ClickType {
|
||||
CLICK_NONE,
|
||||
CLICK_NODE,
|
||||
CLICK_INPUT_SLOT,
|
||||
CLICK_OUTPUT_SLOT,
|
||||
CLICK_PARAMETER
|
||||
};
|
||||
CustomPropertyEditor *ped_popup;
|
||||
bool block_update;
|
||||
|
||||
PopupMenu *node_popup;
|
||||
Popup *add_popup;
|
||||
PopupMenu *vertex_popup;
|
||||
PopupMenu *fragment_popup;
|
||||
PopupMenu *post_popup;
|
||||
Tree *add_types;
|
||||
Button *add_confirm;
|
||||
HScrollBar *h_scroll;
|
||||
VScrollBar *v_scroll;
|
||||
GraphEdit *graph_edit;
|
||||
Ref<ShaderGraph> graph;
|
||||
int edited_id;
|
||||
|
||||
Ref<Shader> shader;
|
||||
List<int> order;
|
||||
Set<int> active_nodes;
|
||||
ShaderGraph shader_graph;
|
||||
int last_x,last_y;
|
||||
uint32_t last_id;
|
||||
ShaderGraph::ShaderType type;
|
||||
|
||||
CustomPropertyEditor *property_editor;
|
||||
void _update_graph();
|
||||
void _create_node(int p_id);
|
||||
|
||||
Point2 offset;
|
||||
ClickType click_type;
|
||||
Point2 click_pos;
|
||||
int click_node;
|
||||
int click_slot;
|
||||
Point2 click_motion;
|
||||
ClickType rclick_type;
|
||||
int rclick_node;
|
||||
int rclick_slot;
|
||||
|
||||
Size2 _get_maximum_size();
|
||||
Size2 get_node_size(int p_node) const;
|
||||
void _draw_node(int p_node);
|
||||
|
||||
void _add_node_from_text(const String& p_text);
|
||||
void _update_scrollbars();
|
||||
void _scroll_moved();
|
||||
void _node_param_changed();
|
||||
void _node_add_callback();
|
||||
void _node_add(VisualServer::ShaderNodeType p_type);
|
||||
void _node_edit_property(int p_node);
|
||||
void _node_menu_item(int p_item);
|
||||
void _vertex_item(int p_item);
|
||||
void _fragment_item(int p_item);
|
||||
void _post_item(int p_item);
|
||||
void _connection_request(const String& p_from, int p_from_slot,const String& p_to,int p_to_slot);
|
||||
void _node_removed(int p_id);
|
||||
void _node_moved(const Vector2& p_from, const Vector2& p_to,int p_id);
|
||||
void _move_node(int p_id,const Vector2& p_to);
|
||||
|
||||
ClickType _locate_click(const Point2& p_click,int *p_node_id,int *p_slot_index) const;
|
||||
Point2 _get_slot_pos(int p_node_id,bool p_input,int p_slot);
|
||||
void _scalar_const_changed(double p_value,int p_id);
|
||||
void _vec_const_changed(double p_value, int p_id, Array p_arr);
|
||||
void _rgb_const_changed(const Color& p_color, int p_id);
|
||||
void _xform_const_changed(int p_id,Node* p_button);
|
||||
void _scalar_op_changed(int p_op, int p_id);
|
||||
void _vec_op_changed(int p_op, int p_id);
|
||||
void _vec_scalar_op_changed(int p_op, int p_id);
|
||||
void _rgb_op_changed(int p_op, int p_id);
|
||||
void _xform_inv_rev_changed(bool p_enabled, int p_id);
|
||||
void _scalar_func_changed(int p_func, int p_id);
|
||||
void _vec_func_changed(int p_func, int p_id);
|
||||
void _scalar_input_changed(double p_value,int p_id);
|
||||
void _vec_input_changed(double p_value, int p_id, Array p_arr);
|
||||
void _xform_input_changed(int p_id,Node* p_button);
|
||||
void _rgb_input_changed(const Color& p_color, int p_id);
|
||||
void _tex_input_change(int p_id,Node* p_button);
|
||||
void _cube_input_change(int p_id);
|
||||
void _input_name_changed(const String& p_name,int p_id,Node* p_line_edit);
|
||||
void _tex_edited(int p_id,Node* p_button);
|
||||
void _cube_edited(int p_id,Node* p_button);
|
||||
void _variant_edited();
|
||||
void _comment_edited(int p_id,Node* p_button);
|
||||
|
||||
Error validate_graph();
|
||||
|
||||
void _read_shader_graph();
|
||||
void _write_shader_graph();
|
||||
|
||||
virtual bool has_point(const Point2& p_point) const;
|
||||
Map<int,GraphNode*> node_map;
|
||||
protected:
|
||||
void _notification(int p_what);
|
||||
void _input_event(InputEvent p_event);
|
||||
static void _bind_methods();
|
||||
public:
|
||||
|
||||
void edit(Ref<Shader> p_shader);
|
||||
ShaderEditor();
|
||||
void add_node(int p_type);
|
||||
GraphEdit *get_graph_edit() { return graph_edit; }
|
||||
void set_graph(Ref<ShaderGraph> p_graph);
|
||||
|
||||
ShaderGraphView(ShaderGraph::ShaderType p_type=ShaderGraph::SHADER_TYPE_FRAGMENT);
|
||||
};
|
||||
|
||||
class ShaderEditorPlugin : public EditorPlugin {
|
||||
class ShaderGraphEditor : public VBoxContainer {
|
||||
|
||||
OBJ_TYPE( ShaderEditorPlugin, EditorPlugin );
|
||||
OBJ_TYPE(ShaderGraphEditor,VBoxContainer);
|
||||
|
||||
ShaderEditor *shader_editor;
|
||||
MenuButton *menu;
|
||||
TabContainer *tabs;
|
||||
ShaderGraphView *graph_edits[ShaderGraph::SHADER_TYPE_MAX];
|
||||
static const char* node_names[ShaderGraph::NODE_TYPE_MAX];
|
||||
|
||||
void _add_node(int p_type);
|
||||
protected:
|
||||
void _notification(int p_what);
|
||||
static void _bind_methods();
|
||||
public:
|
||||
|
||||
void edit(Ref<ShaderGraph> p_shader);
|
||||
ShaderGraphEditor();
|
||||
};
|
||||
|
||||
class ShaderGraphEditorPlugin : public EditorPlugin {
|
||||
|
||||
OBJ_TYPE( ShaderGraphEditorPlugin, EditorPlugin );
|
||||
|
||||
ShaderGraphEditor *shader_editor;
|
||||
EditorNode *editor;
|
||||
|
||||
public:
|
||||
|
||||
virtual String get_name() const { return "Shader"; }
|
||||
virtual String get_name() const { return "ShaderGraph"; }
|
||||
bool has_main_screen() const { return false; }
|
||||
virtual void edit(Object *p_node);
|
||||
virtual bool handles(Object *p_node) const;
|
||||
virtual void make_visible(bool p_visible);
|
||||
|
||||
ShaderEditorPlugin(EditorNode *p_node);
|
||||
~ShaderEditorPlugin();
|
||||
ShaderGraphEditorPlugin(EditorNode *p_node);
|
||||
~ShaderGraphEditorPlugin();
|
||||
|
||||
};
|
||||
#endif
|
||||
#endif // SHADER_GRAPH_EDITOR_PLUGIN_H
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ void CustomPropertyEditor::_menu_option(int p_which) {
|
|||
}
|
||||
|
||||
String orig_type = res_orig->get_type();
|
||||
print_line("orig type: "+orig_type);
|
||||
|
||||
Object *inst = ObjectTypeDB::instance( orig_type );
|
||||
|
||||
Ref<Resource> res = Ref<Resource>( inst->cast_to<Resource>() );
|
||||
|
@ -187,6 +187,7 @@ void CustomPropertyEditor::_menu_option(int p_which) {
|
|||
|
||||
ERR_FAIL_COND( inheritors_array.empty() );
|
||||
|
||||
|
||||
String intype=inheritors_array[p_which-TYPE_BASE_ID];
|
||||
|
||||
Object *obj = ObjectTypeDB::instance(intype);
|
||||
|
@ -603,6 +604,7 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty
|
|||
|
||||
|
||||
if (hint_text!="") {
|
||||
int idx=0;
|
||||
|
||||
for(int i=0;i<hint_text.get_slice_count(",");i++) {
|
||||
|
||||
|
@ -620,19 +622,19 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty
|
|||
E=E->next();
|
||||
}
|
||||
|
||||
int idx=0;
|
||||
for(Set<String>::Element *E=valid_inheritors.front();E;E=E->next()) {
|
||||
String t = E->get();
|
||||
if (!ObjectTypeDB::can_instance(t))
|
||||
continue;
|
||||
inheritors_array.push_back(t);
|
||||
|
||||
int id = TYPE_BASE_ID+idx;
|
||||
if (has_icon(t,"EditorIcons")) {
|
||||
|
||||
menu->add_icon_item(get_icon(t,"EditorIcons"),"New "+t,TYPE_BASE_ID+idx);
|
||||
menu->add_icon_item(get_icon(t,"EditorIcons"),"New "+t,id);
|
||||
} else {
|
||||
|
||||
menu->add_item("New "+t,TYPE_BASE_ID+idx);
|
||||
menu->add_item("New "+t,id);
|
||||
}
|
||||
|
||||
idx++;
|
||||
|
@ -970,9 +972,11 @@ void CustomPropertyEditor::_action_pressed(int p_which) {
|
|||
|
||||
if (p_which==0) {
|
||||
|
||||
|
||||
ERR_FAIL_COND( inheritors_array.empty() );
|
||||
|
||||
String intype=inheritors_array[0];
|
||||
|
||||
|
||||
if (hint==PROPERTY_HINT_RESOURCE_TYPE) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue