@@ -33,6 +33,10 @@ namespace FlaxEditor.Surface.Elements
|
||||
Archetype = archetype;
|
||||
|
||||
ParentNode.ValuesChanged += OnNodeValuesChanged;
|
||||
|
||||
// Disable slider if surface doesn't allow it
|
||||
if (!ParentNode.Surface.CanLivePreviewValueChanges)
|
||||
_slideSpeed = 0.0f;
|
||||
}
|
||||
|
||||
private void OnNodeValuesChanged()
|
||||
|
||||
@@ -22,6 +22,9 @@ namespace FlaxEditor.Surface
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool CanLivePreviewValueChanges => false;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string GetTypeName(ScriptType type)
|
||||
{
|
||||
|
||||
@@ -534,6 +534,11 @@ namespace FlaxEditor.Surface
|
||||
/// </summary>
|
||||
public virtual bool CanSetParameters => false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether surface supports/allows live previewing graph modifications due to value sliders and color pickers. True by default but disabled for shader surfaces that generate and compile shader source at flight.
|
||||
/// </summary>
|
||||
public virtual bool CanLivePreviewValueChanges => true;
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified node archetype can be used in the surface.
|
||||
/// </summary>
|
||||
|
||||
@@ -1112,9 +1112,11 @@ namespace FlaxEngine.Interop
|
||||
|
||||
internal static void ToManagedPointer(ref IntPtr managedValue, IntPtr nativePtr, bool byRef)
|
||||
{
|
||||
if (byRef)
|
||||
nativePtr = Unsafe.Read<IntPtr>(nativePtr.ToPointer());
|
||||
managedValue = nativePtr;
|
||||
Type type = typeof(T);
|
||||
byRef |= type.IsByRef; // Is this needed?
|
||||
if (type.IsByRef)
|
||||
Assert.IsTrue(type.GetElementType().IsValueType);
|
||||
managedValue = byRef ? nativePtr : Unsafe.Read<IntPtr>(nativePtr.ToPointer());
|
||||
}
|
||||
|
||||
internal static void ToManagedHandle(ref ManagedHandle managedValue, IntPtr nativePtr, bool byRef)
|
||||
|
||||
@@ -166,7 +166,6 @@ SceneObject* SceneObjectsFactory::Spawn(Context& context, const ISerializable::D
|
||||
return nullptr;
|
||||
}
|
||||
const StringAnsiView typeName(typeNameMember->value.GetStringAnsiView());
|
||||
|
||||
const ScriptingTypeHandle type = Scripting::FindScriptingType(typeName);
|
||||
if (type)
|
||||
{
|
||||
|
||||
@@ -1209,9 +1209,20 @@ void* MUtils::VariantToManagedArgPtr(Variant& value, MType* type, bool& failed)
|
||||
return object;
|
||||
}
|
||||
case MTypes::Ptr:
|
||||
if (value.Type.Type == VariantType::Null)
|
||||
switch (value.Type.Type)
|
||||
{
|
||||
case VariantType::Pointer:
|
||||
return &value.AsPointer;
|
||||
case VariantType::Object:
|
||||
return &value.AsObject;
|
||||
case VariantType::Asset:
|
||||
return &value.AsAsset;
|
||||
case VariantType::Structure:
|
||||
case VariantType::Blob:
|
||||
return &value.AsBlob.Data;
|
||||
default:
|
||||
return nullptr;
|
||||
return (void*)value;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace FlaxEngine.Json
|
||||
{
|
||||
internal class SerializerCache
|
||||
{
|
||||
public readonly JsonSerializerSettings JsonSettings;
|
||||
public bool IsManagedOnly;
|
||||
public Newtonsoft.Json.JsonSerializer JsonSerializer;
|
||||
public StringBuilder StringBuilder;
|
||||
public StringWriter StringWriter;
|
||||
@@ -33,9 +33,9 @@ namespace FlaxEngine.Json
|
||||
public uint CacheVersion;
|
||||
#endif
|
||||
|
||||
public unsafe SerializerCache(JsonSerializerSettings settings)
|
||||
public unsafe SerializerCache(bool isManagedOnly)
|
||||
{
|
||||
JsonSettings = settings;
|
||||
IsManagedOnly = isManagedOnly;
|
||||
StringBuilder = new StringBuilder(256);
|
||||
StringWriter = new StringWriter(StringBuilder, CultureInfo.InvariantCulture);
|
||||
MemoryStream = new UnmanagedMemoryStream((byte*)0, 0);
|
||||
@@ -114,7 +114,7 @@ namespace FlaxEngine.Json
|
||||
/// <summary>Builds the serializer</summary>
|
||||
private void BuildSerializer()
|
||||
{
|
||||
JsonSerializer = Newtonsoft.Json.JsonSerializer.CreateDefault(Settings);
|
||||
JsonSerializer = Newtonsoft.Json.JsonSerializer.CreateDefault(IsManagedOnly ? SettingsManagedOnly : Settings);
|
||||
JsonSerializer.Formatting = Formatting.Indented;
|
||||
JsonSerializer.ReferenceLoopHandling = ReferenceLoopHandling.Serialize;
|
||||
}
|
||||
@@ -149,8 +149,8 @@ namespace FlaxEngine.Json
|
||||
internal static ExtendedSerializationBinder SerializationBinder;
|
||||
internal static FlaxObjectConverter ObjectConverter;
|
||||
internal static ThreadLocal<SerializerCache> Current = new ThreadLocal<SerializerCache>();
|
||||
internal static ThreadLocal<SerializerCache> Cache = new ThreadLocal<SerializerCache>(() => new SerializerCache(Settings));
|
||||
internal static ThreadLocal<SerializerCache> CacheManagedOnly = new ThreadLocal<SerializerCache>(() => new SerializerCache(SettingsManagedOnly));
|
||||
internal static ThreadLocal<SerializerCache> Cache = new ThreadLocal<SerializerCache>(() => new SerializerCache(false));
|
||||
internal static ThreadLocal<SerializerCache> CacheManagedOnly = new ThreadLocal<SerializerCache>(() => new SerializerCache(true));
|
||||
internal static ThreadLocal<IntPtr> CachedGuidBuffer = new ThreadLocal<IntPtr>(() => Marshal.AllocHGlobal(32 * sizeof(char)), true);
|
||||
internal static string CachedGuidDigits = "0123456789abcdef";
|
||||
#if FLAX_EDITOR
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace
|
||||
CriticalSection WaitMutex;
|
||||
CriticalSection JobsLocker;
|
||||
#if JOB_SYSTEM_USE_MUTEX
|
||||
RingBuffer<JobData, InlinedAllocation<256>> Jobs;
|
||||
RingBuffer<JobData> Jobs;
|
||||
#else
|
||||
ConcurrentQueue<JobData> Jobs;
|
||||
#endif
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user