mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Compare commits
36 Commits
v5.5.221
...
integratio
Author | SHA1 | Date | |
---|---|---|---|
![]() |
153b2d5034 | ||
![]() |
fa86d81db7 | ||
![]() |
77a0c2e6ad | ||
![]() |
98152b191f | ||
![]() |
197440497d | ||
![]() |
892f5e6e86 | ||
![]() |
f92ab329e3 | ||
![]() |
728a82761a | ||
![]() |
2bb236d591 | ||
![]() |
45a53f614f | ||
![]() |
dee21a203e | ||
![]() |
3663eef67c | ||
![]() |
17d38a04e3 | ||
![]() |
23df4f2a92 | ||
![]() |
4858ccbbea | ||
![]() |
025516a95e | ||
![]() |
1d81ab954f | ||
![]() |
a11d08d36c | ||
![]() |
96ae5ec458 | ||
![]() |
4157b4fdba | ||
![]() |
124da1e850 | ||
![]() |
ccc9992a97 | ||
![]() |
0487fa8bb9 | ||
![]() |
8c811139fd | ||
![]() |
4a7f8de196 | ||
![]() |
a7f5ef1d28 | ||
![]() |
c6aca52b11 | ||
![]() |
2ec5f51576 | ||
![]() |
ae32021120 | ||
![]() |
37e43c5f33 | ||
![]() |
ba65a1bc56 | ||
![]() |
2500ac930f | ||
![]() |
18892f97f3 | ||
![]() |
0ec0654032 | ||
![]() |
8e29c723e8 | ||
![]() |
6acde2865a |
@@ -272,7 +272,7 @@ class GD_CORE_API BehaviorMetadata : public InstructionOrExpressionContainerMeta
|
||||
* Check if the behavior is private - it can't be used outside of its
|
||||
* extension.
|
||||
*/
|
||||
bool IsPrivate() const { return isPrivate; }
|
||||
bool IsPrivate() const override { return isPrivate; }
|
||||
|
||||
/**
|
||||
* Set that the behavior is private - it can't be used outside of its
|
||||
|
@@ -174,6 +174,7 @@ public:
|
||||
virtual const gd::String &GetFullName() const = 0;
|
||||
virtual const gd::String &GetDescription() const = 0;
|
||||
virtual const gd::String &GetIconFilename() const = 0;
|
||||
virtual bool IsPrivate() const = 0;
|
||||
|
||||
/**
|
||||
* \brief Return a reference to a map containing the names of the actions
|
||||
|
@@ -300,6 +300,22 @@ class GD_CORE_API ObjectMetadata : public InstructionOrExpressionContainerMetada
|
||||
*/
|
||||
std::map<gd::String, gd::ExpressionMetadata>& GetAllStrExpressions() override { return strExpressionsInfos; };
|
||||
|
||||
|
||||
/**
|
||||
* Check if the behavior is private - it can't be used outside of its
|
||||
* extension.
|
||||
*/
|
||||
bool IsPrivate() const override { return isPrivate; }
|
||||
|
||||
/**
|
||||
* Set that the behavior is private - it can't be used outside of its
|
||||
* extension.
|
||||
*/
|
||||
ObjectMetadata &SetPrivate() {
|
||||
isPrivate = true;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set the object to be hidden in the IDE.
|
||||
*
|
||||
@@ -356,6 +372,7 @@ class GD_CORE_API ObjectMetadata : public InstructionOrExpressionContainerMetada
|
||||
gd::String iconFilename;
|
||||
gd::String categoryFullName;
|
||||
std::set<gd::String> defaultBehaviorTypes;
|
||||
bool isPrivate = false;
|
||||
bool hidden = false;
|
||||
bool isRenderedIn3D = false;
|
||||
gd::String openFullEditorLabel;
|
||||
|
@@ -23,6 +23,9 @@ void AbstractEventsBasedEntity::SerializeTo(SerializerElement& element) const {
|
||||
element.SetAttribute("description", description);
|
||||
element.SetAttribute("name", name);
|
||||
element.SetAttribute("fullName", fullName);
|
||||
if (isPrivate) {
|
||||
element.SetBoolAttribute("private", isPrivate);
|
||||
}
|
||||
|
||||
gd::SerializerElement& eventsFunctionsElement =
|
||||
element.AddChild("eventsFunctions");
|
||||
@@ -36,6 +39,7 @@ void AbstractEventsBasedEntity::UnserializeFrom(
|
||||
description = element.GetStringAttribute("description");
|
||||
name = element.GetStringAttribute("name");
|
||||
fullName = element.GetStringAttribute("fullName");
|
||||
isPrivate = element.GetBoolAttribute("private");
|
||||
|
||||
const gd::SerializerElement& eventsFunctionsElement =
|
||||
element.GetChild("eventsFunctions");
|
||||
|
@@ -3,8 +3,7 @@
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#ifndef GDCORE_ABSTRACTEVENTSBASEDENTITY_H
|
||||
#define GDCORE_ABSTRACTEVENTSBASEDENTITY_H
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include "GDCore/Project/NamedPropertyDescriptor.h"
|
||||
@@ -40,6 +39,21 @@ class GD_CORE_API AbstractEventsBasedEntity {
|
||||
*/
|
||||
AbstractEventsBasedEntity* Clone() const { return new AbstractEventsBasedEntity(*this); };
|
||||
|
||||
/**
|
||||
* \brief Check if the behavior or object is private - it can't be used outside of its
|
||||
* extension.
|
||||
*/
|
||||
bool IsPrivate() const { return isPrivate; }
|
||||
|
||||
/**
|
||||
* \brief Set that the behavior or object is private - it can't be used outside of its
|
||||
* extension.
|
||||
*/
|
||||
AbstractEventsBasedEntity& SetPrivate(bool isPrivate_) {
|
||||
isPrivate = isPrivate_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Get the description of the behavior or object, that is displayed in the
|
||||
* editor.
|
||||
@@ -151,8 +165,7 @@ class GD_CORE_API AbstractEventsBasedEntity {
|
||||
gd::EventsFunctionsContainer eventsFunctionsContainer;
|
||||
gd::PropertiesContainer propertyDescriptors;
|
||||
gd::String extensionName;
|
||||
bool isPrivate = false;
|
||||
};
|
||||
|
||||
} // namespace gd
|
||||
|
||||
#endif // GDCORE_ABSTRACTEVENTSBASEDENTITY_H
|
||||
|
@@ -53,7 +53,8 @@ std::map<gd::String, gd::PropertyDescriptor> CustomConfigurationHelper::GetPrope
|
||||
if (configurationContent.HasChild(propertyName)) {
|
||||
if (propertyType == "String" || propertyType == "Choice" ||
|
||||
propertyType == "Color" || propertyType == "Behavior" ||
|
||||
propertyType == "Resource" || propertyType == "LeaderboardId") {
|
||||
propertyType == "Resource" || propertyType == "LeaderboardId" ||
|
||||
propertyType == "AnimationName") {
|
||||
newProperty.SetValue(
|
||||
configurationContent.GetChild(propertyName).GetStringValue());
|
||||
} else if (propertyType == "Number") {
|
||||
@@ -89,7 +90,8 @@ bool CustomConfigurationHelper::UpdateProperty(
|
||||
|
||||
if (propertyType == "String" || propertyType == "Choice" ||
|
||||
propertyType == "Color" || propertyType == "Behavior" ||
|
||||
propertyType == "Resource" || propertyType == "LeaderboardId") {
|
||||
propertyType == "Resource" || propertyType == "LeaderboardId" ||
|
||||
propertyType == "AnimationName") {
|
||||
element.SetStringValue(newValue);
|
||||
} else if (propertyType == "Number") {
|
||||
element.SetDoubleValue(newValue.To<double>());
|
||||
|
@@ -21,9 +21,6 @@ EventsBasedBehavior::EventsBasedBehavior()
|
||||
void EventsBasedBehavior::SerializeTo(SerializerElement& element) const {
|
||||
AbstractEventsBasedEntity::SerializeTo(element);
|
||||
element.SetAttribute("objectType", objectType);
|
||||
if (isPrivate) {
|
||||
element.SetBoolAttribute("private", isPrivate);
|
||||
}
|
||||
sharedPropertyDescriptors.SerializeElementsTo(
|
||||
"propertyDescriptor", element.AddChild("sharedPropertyDescriptors"));
|
||||
if (quickCustomizationVisibility != QuickCustomization::Visibility::Default) {
|
||||
@@ -39,7 +36,6 @@ void EventsBasedBehavior::UnserializeFrom(gd::Project& project,
|
||||
const SerializerElement& element) {
|
||||
AbstractEventsBasedEntity::UnserializeFrom(project, element);
|
||||
objectType = element.GetStringAttribute("objectType");
|
||||
isPrivate = element.GetBoolAttribute("private");
|
||||
sharedPropertyDescriptors.UnserializeElementsFrom(
|
||||
"propertyDescriptor", element.GetChild("sharedPropertyDescriptors"));
|
||||
if (element.HasChild("quickCustomizationVisibility")) {
|
||||
|
@@ -3,8 +3,7 @@
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#ifndef GDCORE_EVENTSBASEDBEHAVIOR_H
|
||||
#define GDCORE_EVENTSBASEDBEHAVIOR_H
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include "GDCore/Project/AbstractEventsBasedEntity.h"
|
||||
@@ -75,17 +74,11 @@ class GD_CORE_API EventsBasedBehavior: public AbstractEventsBasedEntity {
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Check if the behavior is private - it can't be used outside of its
|
||||
* \brief Set that the behavior or object is private - it can't be used outside of its
|
||||
* extension.
|
||||
*/
|
||||
bool IsPrivate() const { return isPrivate; }
|
||||
|
||||
/**
|
||||
* \brief Set that the behavior is private - it can't be used outside of its
|
||||
* extension.
|
||||
*/
|
||||
EventsBasedBehavior& SetPrivate(bool _isPrivate) {
|
||||
isPrivate = _isPrivate;
|
||||
EventsBasedBehavior& SetPrivate(bool isPrivate) {
|
||||
AbstractEventsBasedEntity::SetPrivate(isPrivate);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -149,11 +142,8 @@ class GD_CORE_API EventsBasedBehavior: public AbstractEventsBasedEntity {
|
||||
|
||||
private:
|
||||
gd::String objectType;
|
||||
bool isPrivate = false;
|
||||
gd::PropertiesContainer sharedPropertyDescriptors;
|
||||
QuickCustomization::Visibility quickCustomizationVisibility;
|
||||
};
|
||||
|
||||
} // namespace gd
|
||||
|
||||
#endif // GDCORE_EVENTSBASEDBEHAVIOR_H
|
||||
|
@@ -72,6 +72,15 @@ class GD_CORE_API EventsBasedObject: public AbstractEventsBasedEntity {
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set that the object is private - it can't be used outside of its
|
||||
* extension.
|
||||
*/
|
||||
EventsBasedObject& SetPrivate(bool isPrivate) {
|
||||
AbstractEventsBasedEntity::SetPrivate(isPrivate);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Declare a usage of the 3D renderer.
|
||||
*/
|
||||
|
97
Extensions/3D/BokehShader2.ts
Normal file
97
Extensions/3D/BokehShader2.ts
Normal file
@@ -0,0 +1,97 @@
|
||||
namespace gdjs {
|
||||
interface DepthOfFieldFilterNetworkSyncData {
|
||||
b: number;
|
||||
c: number;
|
||||
}
|
||||
gdjs.PixiFiltersTools.registerFilterCreator(
|
||||
'Scene3D::DepthOfField',
|
||||
new (class implements gdjs.PixiFiltersTools.FilterCreator {
|
||||
makeFilter(
|
||||
target: EffectsTarget,
|
||||
effectData: EffectData
|
||||
): gdjs.PixiFiltersTools.Filter {
|
||||
if (typeof THREE === 'undefined') {
|
||||
return new gdjs.PixiFiltersTools.EmptyFilter();
|
||||
}
|
||||
console.log("Donne moi une info !!");
|
||||
return new (class implements gdjs.PixiFiltersTools.Filter {
|
||||
shaderPass: THREE_ADDONS.ShaderPass;
|
||||
_isEnabled: boolean;
|
||||
|
||||
constructor() {
|
||||
this.shaderPass = new THREE_ADDONS.ShaderPass(
|
||||
THREE_ADDONS.BokehDepthShader
|
||||
);
|
||||
console.log(THREE_ADDONS);
|
||||
this._isEnabled = false;
|
||||
}
|
||||
|
||||
isEnabled(target: EffectsTarget): boolean {
|
||||
return this._isEnabled;
|
||||
}
|
||||
setEnabled(target: EffectsTarget, enabled: boolean): boolean {
|
||||
if (this._isEnabled === enabled) {
|
||||
return true;
|
||||
}
|
||||
if (enabled) {
|
||||
return this.applyEffect(target);
|
||||
} else {
|
||||
return this.removeEffect(target);
|
||||
}
|
||||
}
|
||||
applyEffect(target: EffectsTarget): boolean {
|
||||
if (!(target instanceof gdjs.Layer)) {
|
||||
return false;
|
||||
}
|
||||
target.getRenderer().addPostProcessingPass(this.shaderPass);
|
||||
this._isEnabled = true;
|
||||
return true;
|
||||
}
|
||||
removeEffect(target: EffectsTarget): boolean {
|
||||
if (!(target instanceof gdjs.Layer)) {
|
||||
return false;
|
||||
}
|
||||
target.getRenderer().removePostProcessingPass(this.shaderPass);
|
||||
this._isEnabled = false;
|
||||
return true;
|
||||
}
|
||||
updatePreRender(target: gdjs.EffectsTarget): any {}
|
||||
updateDoubleParameter(parameterName: string, value: number): void {
|
||||
if (parameterName === 'brightness') {
|
||||
this.shaderPass.uniforms[parameterName].value = value;
|
||||
}
|
||||
if (parameterName === 'contrast') {
|
||||
this.shaderPass.uniforms[parameterName].value = value;
|
||||
}
|
||||
}
|
||||
getDoubleParameter(parameterName: string): number {
|
||||
if (parameterName === 'brightness') {
|
||||
return this.shaderPass.uniforms[parameterName].value;
|
||||
}
|
||||
if (parameterName === 'contrast') {
|
||||
return this.shaderPass.uniforms[parameterName].value;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
updateStringParameter(parameterName: string, value: string): void {}
|
||||
updateColorParameter(parameterName: string, value: number): void {}
|
||||
getColorParameter(parameterName: string): number {
|
||||
return 0;
|
||||
}
|
||||
updateBooleanParameter(parameterName: string, value: boolean): void {}
|
||||
getNetworkSyncData(): DepthOfFieldFilterNetworkSyncData {
|
||||
return {
|
||||
b: this.shaderPass.uniforms.brightness.value,
|
||||
c: this.shaderPass.uniforms.contrast.value,
|
||||
};
|
||||
}
|
||||
updateFromNetworkSyncData(
|
||||
data: DepthOfFieldFilterNetworkSyncData
|
||||
) {
|
||||
}
|
||||
})();
|
||||
}
|
||||
})()
|
||||
);
|
||||
}
|
||||
|
@@ -1983,6 +1983,16 @@ module.exports = {
|
||||
.setLabel(_('Threshold (between 0 and 1)'))
|
||||
.setType('number');
|
||||
}
|
||||
{
|
||||
const effect = extension
|
||||
.addEffect('DepthOfField')
|
||||
.setFullName(_('DepthOfField'))
|
||||
.setDescription(_('Apply a depth-of-field effect.'))
|
||||
.markAsNotWorkingForObjects()
|
||||
.markAsOnlyWorkingFor3D()
|
||||
.addIncludeFile('Extensions/3D/BokehShader2.js');
|
||||
const properties = effect.getProperties();
|
||||
}
|
||||
{
|
||||
const effect = extension
|
||||
.addEffect('BrightnessAndContrast')
|
||||
|
@@ -1224,7 +1224,7 @@ namespace gdjs {
|
||||
* @returns Returns true if it is falling and false if not.
|
||||
*/
|
||||
isFallingWithoutJumping(): boolean {
|
||||
return !this.isOnFloor() && this._currentJumpSpeed === 0;
|
||||
return !this.isOnFloor() && !this.isJumping();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1241,7 +1241,8 @@ namespace gdjs {
|
||||
*/
|
||||
isFalling(): boolean {
|
||||
return (
|
||||
!this.isOnFloor() && this._currentJumpSpeed < this._currentFallSpeed
|
||||
!this.isOnFloor() ||
|
||||
(this.isJumping() && this._currentFallSpeed > this._currentJumpSpeed)
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -154,6 +154,9 @@ gd::ObjectMetadata &MetadataDeclarationHelper::DeclareObjectMetadata(
|
||||
.AddDefaultBehavior("TextContainerCapability::TextContainerBehavior");
|
||||
}
|
||||
|
||||
if (eventsBasedObject.IsPrivate())
|
||||
objectMetadata.SetPrivate();
|
||||
|
||||
// TODO EBO Use full type to identify object to avoid collision.
|
||||
// Objects are identified by their name alone.
|
||||
const gd::String &objectType = eventsBasedObject.GetName();
|
||||
|
File diff suppressed because one or more lines are too long
2
GDJS/Runtime/types/global-three-addons.d.ts
vendored
2
GDJS/Runtime/types/global-three-addons.d.ts
vendored
@@ -13,6 +13,7 @@ import { BrightnessContrastShader } from 'three/examples/jsm/shaders/BrightnessC
|
||||
import { ColorCorrectionShader } from 'three/examples/jsm/shaders/ColorCorrectionShader';
|
||||
import { HueSaturationShader } from 'three/examples/jsm/shaders/HueSaturationShader';
|
||||
import { ExposureShader } from 'three/examples/jsm/shaders/ExposureShader';
|
||||
import { BokehShader } from 'three/examples/jsm/shaders/BokehShader2';
|
||||
|
||||
declare global {
|
||||
namespace THREE_ADDONS {
|
||||
@@ -32,6 +33,7 @@ declare global {
|
||||
ColorCorrectionShader,
|
||||
HueSaturationShader,
|
||||
ExposureShader,
|
||||
BokehShader,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -833,6 +833,7 @@ interface ObjectConfiguration {
|
||||
void UnserializeFrom([Ref] Project project, [Const, Ref] SerializerElement element);
|
||||
|
||||
unsigned long GetAnimationsCount();
|
||||
[Const, Ref] DOMString GetAnimationName(unsigned long index);
|
||||
};
|
||||
|
||||
interface UniquePtrObjectConfiguration {
|
||||
@@ -1928,6 +1929,9 @@ interface ObjectMetadata {
|
||||
boolean HasDefaultBehavior([Const] DOMString behaviorType);
|
||||
[Ref] ObjectMetadata AddDefaultBehavior([Const] DOMString behaviorType);
|
||||
|
||||
boolean IsPrivate();
|
||||
[Ref] ObjectMetadata SetPrivate();
|
||||
|
||||
[Ref] ObjectMetadata SetHidden();
|
||||
boolean IsHidden();
|
||||
|
||||
@@ -3006,6 +3010,11 @@ interface AbstractEventsBasedEntity {
|
||||
[Ref] EventsFunctionsContainer GetEventsFunctions();
|
||||
[Ref] PropertiesContainer GetPropertyDescriptors();
|
||||
|
||||
[Const, Ref] DOMString GetName();
|
||||
[Const, Ref] DOMString GetFullName();
|
||||
[Const, Ref] DOMString GetDescription();
|
||||
boolean IsPrivate();
|
||||
|
||||
void SerializeTo([Ref] SerializerElement element);
|
||||
void UnserializeFrom([Ref] Project project, [Const, Ref] SerializerElement element);
|
||||
};
|
||||
@@ -3013,16 +3022,13 @@ interface AbstractEventsBasedEntity {
|
||||
interface EventsBasedBehavior {
|
||||
void EventsBasedBehavior();
|
||||
|
||||
[Ref] EventsBasedBehavior SetDescription([Const] DOMString description);
|
||||
[Const, Ref] DOMString GetDescription();
|
||||
[Ref] EventsBasedBehavior SetName([Const] DOMString name);
|
||||
[Const, Ref] DOMString GetName();
|
||||
[Ref] EventsBasedBehavior SetFullName([Const] DOMString fullName);
|
||||
[Const, Ref] DOMString GetFullName();
|
||||
[Ref] EventsBasedBehavior SetDescription([Const] DOMString description);
|
||||
[Ref] EventsBasedBehavior SetPrivate(boolean isPrivate);
|
||||
|
||||
[Ref] EventsBasedBehavior SetObjectType([Const] DOMString fullName);
|
||||
[Const, Ref] DOMString GetObjectType();
|
||||
[Ref] EventsBasedBehavior SetPrivate(boolean isPrivate);
|
||||
boolean IsPrivate();
|
||||
[Ref] EventsBasedBehavior SetQuickCustomizationVisibility(QuickCustomization_Visibility visibility);
|
||||
QuickCustomization_Visibility GetQuickCustomizationVisibility();
|
||||
|
||||
@@ -3057,15 +3063,13 @@ interface EventsBasedBehaviorsList {
|
||||
interface EventsBasedObject {
|
||||
void EventsBasedObject();
|
||||
|
||||
[Ref] EventsBasedObject SetDescription([Const] DOMString description);
|
||||
[Const, Ref] DOMString GetDescription();
|
||||
[Ref] EventsBasedObject SetName([Const] DOMString name);
|
||||
[Const, Ref] DOMString GetName();
|
||||
[Ref] EventsBasedObject SetFullName([Const] DOMString fullName);
|
||||
[Const, Ref] DOMString GetFullName();
|
||||
[Ref] EventsBasedObject SetDescription([Const] DOMString description);
|
||||
[Ref] EventsBasedObject SetPrivate(boolean isPrivate);
|
||||
|
||||
[Ref] EventsBasedObject SetDefaultName([Const] DOMString defaultName);
|
||||
[Const, Ref] DOMString GetDefaultName();
|
||||
|
||||
[Ref] EventsBasedObject MarkAsRenderedIn3D(boolean isRenderedIn3D);
|
||||
boolean IsRenderedIn3D();
|
||||
[Ref] EventsBasedObject MarkAsAnimatable(boolean isAnimatable);
|
||||
|
20
GDevelop.js/types.d.ts
vendored
20
GDevelop.js/types.d.ts
vendored
@@ -1543,6 +1543,8 @@ export class ObjectMetadata extends EmscriptenObject {
|
||||
getDefaultBehaviors(): SetString;
|
||||
hasDefaultBehavior(behaviorType: string): boolean;
|
||||
addDefaultBehavior(behaviorType: string): ObjectMetadata;
|
||||
isPrivate(): boolean;
|
||||
setPrivate(): ObjectMetadata;
|
||||
setHidden(): ObjectMetadata;
|
||||
isHidden(): boolean;
|
||||
markAsRenderedIn3D(): ObjectMetadata;
|
||||
@@ -2172,22 +2174,22 @@ export class EventsFunctionsContainer extends EmscriptenObject {
|
||||
export class AbstractEventsBasedEntity extends EmscriptenObject {
|
||||
getEventsFunctions(): EventsFunctionsContainer;
|
||||
getPropertyDescriptors(): PropertiesContainer;
|
||||
getName(): string;
|
||||
getFullName(): string;
|
||||
getDescription(): string;
|
||||
isPrivate(): boolean;
|
||||
serializeTo(element: SerializerElement): void;
|
||||
unserializeFrom(project: Project, element: SerializerElement): void;
|
||||
}
|
||||
|
||||
export class EventsBasedBehavior extends AbstractEventsBasedEntity {
|
||||
constructor();
|
||||
setDescription(description: string): EventsBasedBehavior;
|
||||
getDescription(): string;
|
||||
setName(name: string): EventsBasedBehavior;
|
||||
getName(): string;
|
||||
setFullName(fullName: string): EventsBasedBehavior;
|
||||
getFullName(): string;
|
||||
setDescription(description: string): EventsBasedBehavior;
|
||||
setPrivate(isPrivate: boolean): EventsBasedBehavior;
|
||||
setObjectType(fullName: string): EventsBasedBehavior;
|
||||
getObjectType(): string;
|
||||
setPrivate(isPrivate: boolean): EventsBasedBehavior;
|
||||
isPrivate(): boolean;
|
||||
setQuickCustomizationVisibility(visibility: QuickCustomization_Visibility): EventsBasedBehavior;
|
||||
getQuickCustomizationVisibility(): QuickCustomization_Visibility;
|
||||
getSharedPropertyDescriptors(): PropertiesContainer;
|
||||
@@ -2217,12 +2219,10 @@ export class EventsBasedBehaviorsList extends EmscriptenObject {
|
||||
|
||||
export class EventsBasedObject extends AbstractEventsBasedEntity {
|
||||
constructor();
|
||||
setDescription(description: string): EventsBasedObject;
|
||||
getDescription(): string;
|
||||
setName(name: string): EventsBasedObject;
|
||||
getName(): string;
|
||||
setFullName(fullName: string): EventsBasedObject;
|
||||
getFullName(): string;
|
||||
setDescription(description: string): EventsBasedObject;
|
||||
setPrivate(isPrivate: boolean): EventsBasedObject;
|
||||
setDefaultName(defaultName: string): EventsBasedObject;
|
||||
getDefaultName(): string;
|
||||
markAsRenderedIn3D(isRenderedIn3D: boolean): EventsBasedObject;
|
||||
|
@@ -2,6 +2,10 @@
|
||||
declare class gdAbstractEventsBasedEntity {
|
||||
getEventsFunctions(): gdEventsFunctionsContainer;
|
||||
getPropertyDescriptors(): gdPropertiesContainer;
|
||||
getName(): string;
|
||||
getFullName(): string;
|
||||
getDescription(): string;
|
||||
isPrivate(): boolean;
|
||||
serializeTo(element: gdSerializerElement): void;
|
||||
unserializeFrom(project: gdProject, element: gdSerializerElement): void;
|
||||
delete(): void;
|
||||
|
@@ -1,16 +1,12 @@
|
||||
// Automatically generated by GDevelop.js/scripts/generate-types.js
|
||||
declare class gdEventsBasedBehavior extends gdAbstractEventsBasedEntity {
|
||||
constructor(): void;
|
||||
setDescription(description: string): gdEventsBasedBehavior;
|
||||
getDescription(): string;
|
||||
setName(name: string): gdEventsBasedBehavior;
|
||||
getName(): string;
|
||||
setFullName(fullName: string): gdEventsBasedBehavior;
|
||||
getFullName(): string;
|
||||
setDescription(description: string): gdEventsBasedBehavior;
|
||||
setPrivate(isPrivate: boolean): gdEventsBasedBehavior;
|
||||
setObjectType(fullName: string): gdEventsBasedBehavior;
|
||||
getObjectType(): string;
|
||||
setPrivate(isPrivate: boolean): gdEventsBasedBehavior;
|
||||
isPrivate(): boolean;
|
||||
setQuickCustomizationVisibility(visibility: QuickCustomization_Visibility): gdEventsBasedBehavior;
|
||||
getQuickCustomizationVisibility(): QuickCustomization_Visibility;
|
||||
getSharedPropertyDescriptors(): gdPropertiesContainer;
|
||||
|
@@ -1,12 +1,10 @@
|
||||
// Automatically generated by GDevelop.js/scripts/generate-types.js
|
||||
declare class gdEventsBasedObject extends gdAbstractEventsBasedEntity {
|
||||
constructor(): void;
|
||||
setDescription(description: string): gdEventsBasedObject;
|
||||
getDescription(): string;
|
||||
setName(name: string): gdEventsBasedObject;
|
||||
getName(): string;
|
||||
setFullName(fullName: string): gdEventsBasedObject;
|
||||
getFullName(): string;
|
||||
setDescription(description: string): gdEventsBasedObject;
|
||||
setPrivate(isPrivate: boolean): gdEventsBasedObject;
|
||||
setDefaultName(defaultName: string): gdEventsBasedObject;
|
||||
getDefaultName(): string;
|
||||
markAsRenderedIn3D(isRenderedIn3D: boolean): gdEventsBasedObject;
|
||||
|
@@ -12,6 +12,7 @@ declare class gdObjectConfiguration {
|
||||
serializeTo(element: gdSerializerElement): void;
|
||||
unserializeFrom(project: gdProject, element: gdSerializerElement): void;
|
||||
getAnimationsCount(): number;
|
||||
getAnimationName(index: number): string;
|
||||
delete(): void;
|
||||
ptr: number;
|
||||
};
|
@@ -24,6 +24,8 @@ declare class gdObjectMetadata {
|
||||
getDefaultBehaviors(): gdSetString;
|
||||
hasDefaultBehavior(behaviorType: string): boolean;
|
||||
addDefaultBehavior(behaviorType: string): gdObjectMetadata;
|
||||
isPrivate(): boolean;
|
||||
setPrivate(): gdObjectMetadata;
|
||||
setHidden(): gdObjectMetadata;
|
||||
isHidden(): boolean;
|
||||
markAsRenderedIn3D(): gdObjectMetadata;
|
||||
|
397
SharedLibs/ThreeAddons/src/examples/jsm/shaders/BokehShader2.js
Normal file
397
SharedLibs/ThreeAddons/src/examples/jsm/shaders/BokehShader2.js
Normal file
@@ -0,0 +1,397 @@
|
||||
import {
|
||||
Vector2
|
||||
} from 'three';
|
||||
|
||||
/**
|
||||
* Depth-of-field shader with bokeh
|
||||
* ported from GLSL shader by Martins Upitis
|
||||
* http://blenderartists.org/forum/showthread.php?237488-GLSL-depth-of-field-with-bokeh-v2-4-(update)
|
||||
*
|
||||
* Requires #define RINGS and SAMPLES integers
|
||||
*/
|
||||
const BokehShader = {
|
||||
|
||||
name: 'BokehShader',
|
||||
|
||||
uniforms: {
|
||||
|
||||
'textureWidth': { value: 1.0 },
|
||||
'textureHeight': { value: 1.0 },
|
||||
|
||||
'focalDepth': { value: 1.0 },
|
||||
'focalLength': { value: 24.0 },
|
||||
'fstop': { value: 0.9 },
|
||||
|
||||
'tColor': { value: null },
|
||||
'tDepth': { value: null },
|
||||
|
||||
'maxblur': { value: 1.0 },
|
||||
|
||||
'showFocus': { value: 0 },
|
||||
'manualdof': { value: 0 },
|
||||
'vignetting': { value: 0 },
|
||||
'depthblur': { value: 0 },
|
||||
|
||||
'threshold': { value: 0.5 },
|
||||
'gain': { value: 0.0 },
|
||||
'bias': { value: 0.5 },
|
||||
'fringe': { value: 0.7 },
|
||||
|
||||
'znear': { value: 0.1 },
|
||||
'zfar': { value: 100 },
|
||||
|
||||
'noise': { value: 1 },
|
||||
'dithering': { value: 0.0001 },
|
||||
'pentagon': { value: 0 },
|
||||
|
||||
'shaderFocus': { value: 1 },
|
||||
'focusCoords': { value: new Vector2() }
|
||||
|
||||
|
||||
},
|
||||
|
||||
vertexShader: /* glsl */`
|
||||
|
||||
varying vec2 vUv;
|
||||
|
||||
void main() {
|
||||
|
||||
vUv = uv;
|
||||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||||
|
||||
}`,
|
||||
|
||||
fragmentShader: /* glsl */`
|
||||
|
||||
#include <common>
|
||||
|
||||
varying vec2 vUv;
|
||||
|
||||
uniform sampler2D tColor;
|
||||
uniform sampler2D tDepth;
|
||||
uniform float textureWidth;
|
||||
uniform float textureHeight;
|
||||
|
||||
uniform float focalDepth; //focal distance value in meters, but you may use autofocus option below
|
||||
uniform float focalLength; //focal length in mm
|
||||
uniform float fstop; //f-stop value
|
||||
uniform bool showFocus; //show debug focus point and focal range (red = focal point, green = focal range)
|
||||
|
||||
/*
|
||||
make sure that these two values are the same for your camera, otherwise distances will be wrong.
|
||||
*/
|
||||
|
||||
uniform float znear; // camera clipping start
|
||||
uniform float zfar; // camera clipping end
|
||||
|
||||
//------------------------------------------
|
||||
//user variables
|
||||
|
||||
const int samples = SAMPLES; //samples on the first ring
|
||||
const int rings = RINGS; //ring count
|
||||
|
||||
const int maxringsamples = rings * samples;
|
||||
|
||||
uniform bool manualdof; // manual dof calculation
|
||||
float ndofstart = 1.0; // near dof blur start
|
||||
float ndofdist = 2.0; // near dof blur falloff distance
|
||||
float fdofstart = 1.0; // far dof blur start
|
||||
float fdofdist = 3.0; // far dof blur falloff distance
|
||||
|
||||
float CoC = 0.03; //circle of confusion size in mm (35mm film = 0.03mm)
|
||||
|
||||
uniform bool vignetting; // use optical lens vignetting
|
||||
|
||||
float vignout = 1.3; // vignetting outer border
|
||||
float vignin = 0.0; // vignetting inner border
|
||||
float vignfade = 22.0; // f-stops till vignete fades
|
||||
|
||||
uniform bool shaderFocus;
|
||||
// disable if you use external focalDepth value
|
||||
|
||||
uniform vec2 focusCoords;
|
||||
// autofocus point on screen (0.0,0.0 - left lower corner, 1.0,1.0 - upper right)
|
||||
// if center of screen use vec2(0.5, 0.5);
|
||||
|
||||
uniform float maxblur;
|
||||
//clamp value of max blur (0.0 = no blur, 1.0 default)
|
||||
|
||||
uniform float threshold; // highlight threshold;
|
||||
uniform float gain; // highlight gain;
|
||||
|
||||
uniform float bias; // bokeh edge bias
|
||||
uniform float fringe; // bokeh chromatic aberration / fringing
|
||||
|
||||
uniform bool noise; //use noise instead of pattern for sample dithering
|
||||
|
||||
uniform float dithering;
|
||||
|
||||
uniform bool depthblur; // blur the depth buffer
|
||||
float dbsize = 1.25; // depth blur size
|
||||
|
||||
/*
|
||||
next part is experimental
|
||||
not looking good with small sample and ring count
|
||||
looks okay starting from samples = 4, rings = 4
|
||||
*/
|
||||
|
||||
uniform bool pentagon; //use pentagon as bokeh shape?
|
||||
float feather = 0.4; //pentagon shape feather
|
||||
|
||||
//------------------------------------------
|
||||
|
||||
float penta(vec2 coords) {
|
||||
//pentagonal shape
|
||||
float scale = float(rings) - 1.3;
|
||||
vec4 HS0 = vec4( 1.0, 0.0, 0.0, 1.0);
|
||||
vec4 HS1 = vec4( 0.309016994, 0.951056516, 0.0, 1.0);
|
||||
vec4 HS2 = vec4(-0.809016994, 0.587785252, 0.0, 1.0);
|
||||
vec4 HS3 = vec4(-0.809016994,-0.587785252, 0.0, 1.0);
|
||||
vec4 HS4 = vec4( 0.309016994,-0.951056516, 0.0, 1.0);
|
||||
vec4 HS5 = vec4( 0.0 ,0.0 , 1.0, 1.0);
|
||||
|
||||
vec4 one = vec4( 1.0 );
|
||||
|
||||
vec4 P = vec4((coords),vec2(scale, scale));
|
||||
|
||||
vec4 dist = vec4(0.0);
|
||||
float inorout = -4.0;
|
||||
|
||||
dist.x = dot( P, HS0 );
|
||||
dist.y = dot( P, HS1 );
|
||||
dist.z = dot( P, HS2 );
|
||||
dist.w = dot( P, HS3 );
|
||||
|
||||
dist = smoothstep( -feather, feather, dist );
|
||||
|
||||
inorout += dot( dist, one );
|
||||
|
||||
dist.x = dot( P, HS4 );
|
||||
dist.y = HS5.w - abs( P.z );
|
||||
|
||||
dist = smoothstep( -feather, feather, dist );
|
||||
inorout += dist.x;
|
||||
|
||||
return clamp( inorout, 0.0, 1.0 );
|
||||
}
|
||||
|
||||
float bdepth(vec2 coords) {
|
||||
// Depth buffer blur
|
||||
float d = 0.0;
|
||||
float kernel[9];
|
||||
vec2 offset[9];
|
||||
|
||||
vec2 wh = vec2(1.0/textureWidth,1.0/textureHeight) * dbsize;
|
||||
|
||||
offset[0] = vec2(-wh.x,-wh.y);
|
||||
offset[1] = vec2( 0.0, -wh.y);
|
||||
offset[2] = vec2( wh.x -wh.y);
|
||||
|
||||
offset[3] = vec2(-wh.x, 0.0);
|
||||
offset[4] = vec2( 0.0, 0.0);
|
||||
offset[5] = vec2( wh.x, 0.0);
|
||||
|
||||
offset[6] = vec2(-wh.x, wh.y);
|
||||
offset[7] = vec2( 0.0, wh.y);
|
||||
offset[8] = vec2( wh.x, wh.y);
|
||||
|
||||
kernel[0] = 1.0/16.0; kernel[1] = 2.0/16.0; kernel[2] = 1.0/16.0;
|
||||
kernel[3] = 2.0/16.0; kernel[4] = 4.0/16.0; kernel[5] = 2.0/16.0;
|
||||
kernel[6] = 1.0/16.0; kernel[7] = 2.0/16.0; kernel[8] = 1.0/16.0;
|
||||
|
||||
|
||||
for( int i=0; i<9; i++ ) {
|
||||
float tmp = texture2D(tDepth, coords + offset[i]).r;
|
||||
d += tmp * kernel[i];
|
||||
}
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
|
||||
vec3 color(vec2 coords,float blur) {
|
||||
//processing the sample
|
||||
|
||||
vec3 col = vec3(0.0);
|
||||
vec2 texel = vec2(1.0/textureWidth,1.0/textureHeight);
|
||||
|
||||
col.r = texture2D(tColor,coords + vec2(0.0,1.0)*texel*fringe*blur).r;
|
||||
col.g = texture2D(tColor,coords + vec2(-0.866,-0.5)*texel*fringe*blur).g;
|
||||
col.b = texture2D(tColor,coords + vec2(0.866,-0.5)*texel*fringe*blur).b;
|
||||
|
||||
vec3 lumcoeff = vec3(0.299,0.587,0.114);
|
||||
float lum = dot(col.rgb, lumcoeff);
|
||||
float thresh = max((lum-threshold)*gain, 0.0);
|
||||
return col+mix(vec3(0.0),col,thresh*blur);
|
||||
}
|
||||
|
||||
vec3 debugFocus(vec3 col, float blur, float depth) {
|
||||
float edge = 0.002*depth; //distance based edge smoothing
|
||||
float m = clamp(smoothstep(0.0,edge,blur),0.0,1.0);
|
||||
float e = clamp(smoothstep(1.0-edge,1.0,blur),0.0,1.0);
|
||||
|
||||
col = mix(col,vec3(1.0,0.5,0.0),(1.0-m)*0.6);
|
||||
col = mix(col,vec3(0.0,0.5,1.0),((1.0-e)-(1.0-m))*0.2);
|
||||
|
||||
return col;
|
||||
}
|
||||
|
||||
float linearize(float depth) {
|
||||
return -zfar * znear / (depth * (zfar - znear) - zfar);
|
||||
}
|
||||
|
||||
float vignette() {
|
||||
float dist = distance(vUv.xy, vec2(0.5,0.5));
|
||||
dist = smoothstep(vignout+(fstop/vignfade), vignin+(fstop/vignfade), dist);
|
||||
return clamp(dist,0.0,1.0);
|
||||
}
|
||||
|
||||
float gather(float i, float j, int ringsamples, inout vec3 col, float w, float h, float blur) {
|
||||
float rings2 = float(rings);
|
||||
float step = PI*2.0 / float(ringsamples);
|
||||
float pw = cos(j*step)*i;
|
||||
float ph = sin(j*step)*i;
|
||||
float p = 1.0;
|
||||
if (pentagon) {
|
||||
p = penta(vec2(pw,ph));
|
||||
}
|
||||
col += color(vUv.xy + vec2(pw*w,ph*h), blur) * mix(1.0, i/rings2, bias) * p;
|
||||
return 1.0 * mix(1.0, i /rings2, bias) * p;
|
||||
}
|
||||
|
||||
void main() {
|
||||
//scene depth calculation
|
||||
|
||||
float depth = linearize(texture2D(tDepth,vUv.xy).x);
|
||||
|
||||
// Blur depth?
|
||||
if ( depthblur ) {
|
||||
depth = linearize(bdepth(vUv.xy));
|
||||
}
|
||||
|
||||
//focal plane calculation
|
||||
|
||||
float fDepth = focalDepth;
|
||||
|
||||
if (shaderFocus) {
|
||||
|
||||
fDepth = linearize(texture2D(tDepth,focusCoords).x);
|
||||
|
||||
}
|
||||
|
||||
// dof blur factor calculation
|
||||
|
||||
float blur = 0.0;
|
||||
|
||||
if (manualdof) {
|
||||
float a = depth-fDepth; // Focal plane
|
||||
float b = (a-fdofstart)/fdofdist; // Far DoF
|
||||
float c = (-a-ndofstart)/ndofdist; // Near Dof
|
||||
blur = (a>0.0) ? b : c;
|
||||
} else {
|
||||
float f = focalLength; // focal length in mm
|
||||
float d = fDepth*1000.0; // focal plane in mm
|
||||
float o = depth*1000.0; // depth in mm
|
||||
|
||||
float a = (o*f)/(o-f);
|
||||
float b = (d*f)/(d-f);
|
||||
float c = (d-f)/(d*fstop*CoC);
|
||||
|
||||
blur = abs(a-b)*c;
|
||||
}
|
||||
|
||||
blur = clamp(blur,0.0,1.0);
|
||||
|
||||
// calculation of pattern for dithering
|
||||
|
||||
vec2 noise = vec2(rand(vUv.xy), rand( vUv.xy + vec2( 0.4, 0.6 ) ) )*dithering*blur;
|
||||
|
||||
// getting blur x and y step factor
|
||||
|
||||
float w = (1.0/textureWidth)*blur*maxblur+noise.x;
|
||||
float h = (1.0/textureHeight)*blur*maxblur+noise.y;
|
||||
|
||||
// calculation of final color
|
||||
|
||||
vec3 col = vec3(0.0);
|
||||
|
||||
if(blur < 0.05) {
|
||||
//some optimization thingy
|
||||
col = texture2D(tColor, vUv.xy).rgb;
|
||||
} else {
|
||||
col = texture2D(tColor, vUv.xy).rgb;
|
||||
float s = 1.0;
|
||||
int ringsamples;
|
||||
|
||||
for (int i = 1; i <= rings; i++) {
|
||||
/*unboxstart*/
|
||||
ringsamples = i * samples;
|
||||
|
||||
for (int j = 0 ; j < maxringsamples ; j++) {
|
||||
if (j >= ringsamples) break;
|
||||
s += gather(float(i), float(j), ringsamples, col, w, h, blur);
|
||||
}
|
||||
/*unboxend*/
|
||||
}
|
||||
|
||||
col /= s; //divide by sample count
|
||||
}
|
||||
|
||||
if (showFocus) {
|
||||
col = debugFocus(col, blur, depth);
|
||||
}
|
||||
|
||||
if (vignetting) {
|
||||
col *= vignette();
|
||||
}
|
||||
|
||||
gl_FragColor.rgb = col;
|
||||
gl_FragColor.a = 1.0;
|
||||
|
||||
#include <tonemapping_fragment>
|
||||
#include <colorspace_fragment>
|
||||
}`
|
||||
|
||||
};
|
||||
|
||||
const BokehDepthShader = {
|
||||
|
||||
name: 'BokehDepthShader',
|
||||
|
||||
uniforms: {
|
||||
|
||||
'mNear': { value: 1.0 },
|
||||
'mFar': { value: 1000.0 },
|
||||
|
||||
},
|
||||
|
||||
vertexShader: /* glsl */`
|
||||
|
||||
varying float vViewZDepth;
|
||||
|
||||
void main() {
|
||||
|
||||
#include <begin_vertex>
|
||||
#include <project_vertex>
|
||||
|
||||
vViewZDepth = - mvPosition.z;
|
||||
|
||||
}`,
|
||||
|
||||
fragmentShader: /* glsl */`
|
||||
|
||||
uniform float mNear;
|
||||
uniform float mFar;
|
||||
|
||||
varying float vViewZDepth;
|
||||
|
||||
void main() {
|
||||
|
||||
float color = 1.0 - smoothstep( mNear, mFar, vViewZDepth );
|
||||
gl_FragColor = vec4( vec3( color ), 1.0 );
|
||||
|
||||
}`
|
||||
|
||||
};
|
||||
|
||||
export { BokehShader, BokehDepthShader };
|
@@ -16,3 +16,4 @@ export { UnrealBloomPass } from "./examples/jsm/postprocessing/UnrealBloomPass";
|
||||
export { BrightnessContrastShader } from "./examples/jsm/shaders/BrightnessContrastShader";
|
||||
export { HueSaturationShader } from "./examples/jsm/shaders/HueSaturationShader";
|
||||
export { ExposureShader } from "./examples/jsm/shaders/ExposureShader";
|
||||
export { BokehShader, BokehDepthShader } from "./examples/jsm/shaders/BokehShader2";
|
@@ -403,6 +403,9 @@ const generateExtensionReference = extension => {
|
||||
/** @type {Array<ObjectReference>} */
|
||||
let objectReferences = objectTypes.map(objectType => {
|
||||
const objectMetadata = extension.getObjectMetadata(objectType);
|
||||
if (objectMetadata.isPrivate()) {
|
||||
return null;
|
||||
}
|
||||
const actionsReferenceTexts = generateInstructionsReferenceRowsTexts({
|
||||
areConditions: false,
|
||||
instructionsMetadata: extension.getAllActionsForObject(objectType),
|
||||
@@ -433,7 +436,7 @@ const generateExtensionReference = extension => {
|
||||
conditionsReferenceTexts,
|
||||
expressionsReferenceTexts,
|
||||
};
|
||||
});
|
||||
}).filter(Boolean);
|
||||
|
||||
// Behavior expressions
|
||||
/** @type {Array<BehaviorReference>} */
|
||||
|
@@ -234,6 +234,42 @@ const createField = (
|
||||
getDescription,
|
||||
hasImpactOnAllOtherFields: property.hasImpactOnOtherProperties(),
|
||||
};
|
||||
} else if (valueType === 'animationname') {
|
||||
return {
|
||||
getChoices: () => {
|
||||
if (!object) {
|
||||
return [];
|
||||
}
|
||||
const animationArray = mapFor(
|
||||
0,
|
||||
object.getConfiguration().getAnimationsCount(),
|
||||
i => {
|
||||
const animationName = object.getConfiguration().getAnimationName(i);
|
||||
if (animationName === '') {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
value: animationName,
|
||||
label: animationName,
|
||||
};
|
||||
}
|
||||
).filter(Boolean);
|
||||
animationArray.push({ value: '', label: '(no animation)' });
|
||||
return animationArray;
|
||||
},
|
||||
name,
|
||||
valueType: 'string',
|
||||
getValue: (instance: Instance): string => {
|
||||
return getProperties(instance)
|
||||
.get(name)
|
||||
.getValue();
|
||||
},
|
||||
setValue: (instance: Instance, newValue: string) => {
|
||||
onUpdateProperty(instance, name, newValue);
|
||||
},
|
||||
getLabel,
|
||||
getDescription,
|
||||
};
|
||||
} else {
|
||||
console.error(
|
||||
`A property with type=${valueType} could not be mapped to a field. Ensure that this type is correct and understood by the IDE.`
|
||||
|
@@ -729,6 +729,11 @@ export default function EventsBasedBehaviorPropertiesEditor({
|
||||
value="Boolean"
|
||||
label={t`Boolean (checkbox)`}
|
||||
/>
|
||||
<SelectOption
|
||||
key="property-type-animationname"
|
||||
value="AnimationName"
|
||||
label={t`Animation name (text)`}
|
||||
/>
|
||||
<SelectOption
|
||||
key="property-type-choice"
|
||||
value="Choice"
|
||||
@@ -802,7 +807,9 @@ export default function EventsBasedBehaviorPropertiesEditor({
|
||||
</SelectField>
|
||||
)}
|
||||
{(property.getType() === 'String' ||
|
||||
property.getType() === 'Number') && (
|
||||
property.getType() === 'Number' ||
|
||||
property.getType() ===
|
||||
'AnimationName') && (
|
||||
<SemiControlledTextField
|
||||
commitOnBlur
|
||||
floatingLabelText={
|
||||
|
@@ -178,6 +178,18 @@ export default function EventsBasedBehaviorEditor({
|
||||
if (onConfigurationUpdated) onConfigurationUpdated('isPrivate');
|
||||
onChange();
|
||||
}}
|
||||
tooltipOrHelperText={
|
||||
eventsBasedBehavior.isPrivate() ? (
|
||||
<Trans>
|
||||
This behavior won't be visible in the scene and events
|
||||
editors.
|
||||
</Trans>
|
||||
) : (
|
||||
<Trans>
|
||||
This behavior will be visible in the scene and events editors.
|
||||
</Trans>
|
||||
)
|
||||
}
|
||||
/>
|
||||
{eventsBasedBehavior
|
||||
.getEventsFunctions()
|
||||
|
@@ -141,6 +141,26 @@ export default function EventsBasedObjectEditor({
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
<Checkbox
|
||||
label={<Trans>Private</Trans>}
|
||||
checked={eventsBasedObject.isPrivate()}
|
||||
onCheck={(e, checked) => {
|
||||
eventsBasedObject.setPrivate(checked);
|
||||
onChange();
|
||||
onEventsBasedObjectChildrenEdited();
|
||||
}}
|
||||
tooltipOrHelperText={
|
||||
eventsBasedObject.isPrivate() ? (
|
||||
<Trans>
|
||||
This object won't be visible in the scene and events editors.
|
||||
</Trans>
|
||||
) : (
|
||||
<Trans>
|
||||
This object will be visible in the scene and events editors.
|
||||
</Trans>
|
||||
)
|
||||
}
|
||||
/>
|
||||
<Line noMargin justifyContent="center">
|
||||
<RaisedButton
|
||||
label={<Trans>Open visual editor for the object</Trans>}
|
||||
|
@@ -529,6 +529,17 @@ export const EventsFunctionPropertiesEditor = ({
|
||||
onConfigurationUpdated('isPrivate');
|
||||
forceUpdate();
|
||||
}}
|
||||
tooltipOrHelperText={
|
||||
eventsFunction.isPrivate() ? (
|
||||
<Trans>
|
||||
This function won't be visible in the events editor.
|
||||
</Trans>
|
||||
) : (
|
||||
<Trans>
|
||||
This function will be visible in the events editor.
|
||||
</Trans>
|
||||
)
|
||||
}
|
||||
/>
|
||||
<Checkbox
|
||||
label={<Trans>Asynchronous</Trans>}
|
||||
|
@@ -198,7 +198,9 @@ export class EventsBasedBehaviorTreeViewItemContent
|
||||
return this.eventsBasedBehavior.isPrivate() ? (
|
||||
<Tooltip
|
||||
title={
|
||||
<Trans>This behavior won't be visible in the events editor.</Trans>
|
||||
<Trans>
|
||||
This behavior won't be visible in the scene and events editors.
|
||||
</Trans>
|
||||
}
|
||||
>
|
||||
<VisibilityOff
|
||||
|
@@ -1,6 +1,7 @@
|
||||
// @flow
|
||||
import { type I18n as I18nType } from '@lingui/core';
|
||||
import { t } from '@lingui/macro';
|
||||
import { Trans } from '@lingui/macro';
|
||||
|
||||
import * as React from 'react';
|
||||
import newNameGenerator from '../Utils/NewNameGenerator';
|
||||
@@ -15,10 +16,16 @@ import {
|
||||
type TreeItemProps,
|
||||
extensionObjectsRootFolderId,
|
||||
} from '.';
|
||||
import Tooltip from '@material-ui/core/Tooltip';
|
||||
import VisibilityOff from '../UI/CustomSvgIcons/VisibilityOff';
|
||||
import Add from '../UI/CustomSvgIcons/Add';
|
||||
|
||||
const EVENTS_BASED_OBJECT_CLIPBOARD_KIND = 'Events Based Object';
|
||||
|
||||
const styles = {
|
||||
tooltip: { marginRight: 5, verticalAlign: 'bottom' },
|
||||
};
|
||||
|
||||
export type EventsBasedObjectCreationParameters = {|
|
||||
isRenderedIn3D: boolean,
|
||||
|};
|
||||
@@ -170,6 +177,12 @@ export class EventsBasedObjectTreeViewItemContent
|
||||
click: () => this.delete(),
|
||||
accelerator: 'Backspace',
|
||||
},
|
||||
{
|
||||
label: this.eventsBasedObject.isPrivate()
|
||||
? i18n._(t`Make public`)
|
||||
: i18n._(t`Make private`),
|
||||
click: () => this._togglePrivate(),
|
||||
},
|
||||
{
|
||||
type: 'separator',
|
||||
},
|
||||
@@ -193,7 +206,23 @@ export class EventsBasedObjectTreeViewItemContent
|
||||
}
|
||||
|
||||
renderRightComponent(i18n: I18nType): ?React.Node {
|
||||
return null;
|
||||
return this.eventsBasedObject.isPrivate() ? (
|
||||
<Tooltip
|
||||
title={
|
||||
<Trans>
|
||||
This object won't be visible in the scene and events editors.
|
||||
</Trans>
|
||||
}
|
||||
>
|
||||
<VisibilityOff
|
||||
fontSize="small"
|
||||
style={{
|
||||
...styles.tooltip,
|
||||
color: this.props.gdevelopTheme.text.color.disabled,
|
||||
}}
|
||||
/>
|
||||
</Tooltip>
|
||||
) : null;
|
||||
}
|
||||
|
||||
delete(): void {
|
||||
@@ -225,6 +254,11 @@ export class EventsBasedObjectTreeViewItemContent
|
||||
});
|
||||
}
|
||||
|
||||
_togglePrivate(): void {
|
||||
this.eventsBasedObject.setPrivate(!this.eventsBasedObject.isPrivate());
|
||||
this.props.forceUpdateEditor();
|
||||
}
|
||||
|
||||
getIndex(): number {
|
||||
return this.props.eventsBasedObjectsList.getPosition(
|
||||
this.eventsBasedObject
|
||||
|
@@ -20,8 +20,11 @@ import {
|
||||
ExportFlow,
|
||||
} from '../GenericExporters/CordovaExport';
|
||||
import { downloadUrlsToLocalFiles } from '../../Utils/LocalFileDownloader';
|
||||
const electron = optionalRequire('electron');
|
||||
const shell = electron ? electron.shell : null;
|
||||
// It's important to use remote and not electron for folder actions,
|
||||
// otherwise they will be opened in the background.
|
||||
// See https://github.com/electron/electron/issues/4349#issuecomment-777475765
|
||||
const remote = optionalRequire('@electron/remote');
|
||||
const shell = remote ? remote.shell : null;
|
||||
|
||||
const gd: libGDevelop = global.gd;
|
||||
|
||||
|
@@ -20,8 +20,11 @@ import {
|
||||
ExportFlow,
|
||||
} from '../GenericExporters/ElectronExport';
|
||||
import { downloadUrlsToLocalFiles } from '../../Utils/LocalFileDownloader';
|
||||
const electron = optionalRequire('electron');
|
||||
const shell = electron ? electron.shell : null;
|
||||
// It's important to use remote and not electron for folder actions,
|
||||
// otherwise they will be opened in the background.
|
||||
// See https://github.com/electron/electron/issues/4349#issuecomment-777475765
|
||||
const remote = optionalRequire('@electron/remote');
|
||||
const shell = remote ? remote.shell : null;
|
||||
|
||||
const gd: libGDevelop = global.gd;
|
||||
|
||||
|
@@ -23,10 +23,12 @@ import {
|
||||
import { downloadUrlsToLocalFiles } from '../../Utils/LocalFileDownloader';
|
||||
|
||||
const path = optionalRequire('path');
|
||||
const electron = optionalRequire('electron');
|
||||
// It's important to use remote and not electron for folder actions,
|
||||
// otherwise they will be opened in the background.
|
||||
// See https://github.com/electron/electron/issues/4349#issuecomment-777475765
|
||||
const remote = optionalRequire('@electron/remote');
|
||||
const app = remote ? remote.app : null;
|
||||
const shell = electron ? electron.shell : null;
|
||||
const shell = remote ? remote.shell : null;
|
||||
|
||||
const gd: libGDevelop = global.gd;
|
||||
|
||||
|
@@ -22,8 +22,11 @@ import {
|
||||
import { downloadUrlsToLocalFiles } from '../../Utils/LocalFileDownloader';
|
||||
import DismissableTutorialMessage from '../../Hints/DismissableTutorialMessage';
|
||||
|
||||
const electron = optionalRequire('electron');
|
||||
const shell = electron ? electron.shell : null;
|
||||
// It's important to use remote and not electron for folder actions,
|
||||
// otherwise they will be opened in the background.
|
||||
// See https://github.com/electron/electron/issues/4349#issuecomment-777475765
|
||||
const remote = optionalRequire('@electron/remote');
|
||||
const shell = remote ? remote.shell : null;
|
||||
|
||||
const gd: libGDevelop = global.gd;
|
||||
|
||||
|
@@ -52,7 +52,11 @@ import { textEllipsisStyle } from '../UI/TextEllipsis';
|
||||
import FileWithLines from '../UI/CustomSvgIcons/FileWithLines';
|
||||
import TextButton from '../UI/TextButton';
|
||||
import { getRelativeOrAbsoluteDisplayDate } from '../Utils/DateDisplay';
|
||||
const electron = optionalRequire('electron');
|
||||
// It's important to use remote and not electron for folder actions,
|
||||
// otherwise they will be opened in the background.
|
||||
// See https://github.com/electron/electron/issues/4349#issuecomment-777475765
|
||||
const remote = optionalRequire('@electron/remote');
|
||||
const shell = remote ? remote.shell : null;
|
||||
const path = optionalRequire('path');
|
||||
|
||||
export const getThumbnailWidth = ({ isMobile }: {| isMobile: boolean |}) =>
|
||||
@@ -74,7 +78,7 @@ export const getDetailedProjectDisplayDate = (i18n: I18nType, date: number) =>
|
||||
});
|
||||
|
||||
const getNoProjectAlertMessage = () => {
|
||||
if (!electron) {
|
||||
if (!remote) {
|
||||
// Trying to open a local project from the web app of the mobile app.
|
||||
return t`Looks like your project isn't there!${'\n\n'}Your project must be stored on your computer.`;
|
||||
} else {
|
||||
@@ -107,10 +111,8 @@ const styles = {
|
||||
};
|
||||
|
||||
const locateProjectFile = (file: FileMetadataAndStorageProviderName) => {
|
||||
if (!electron) return;
|
||||
electron.shell.showItemInFolder(
|
||||
path.resolve(file.fileMetadata.fileIdentifier)
|
||||
);
|
||||
if (!shell) return;
|
||||
shell.showItemInFolder(path.resolve(file.fileMetadata.fileIdentifier));
|
||||
};
|
||||
|
||||
const getFileNameWithoutExtensionFromPath = (path: string) => {
|
||||
|
@@ -72,9 +72,14 @@ const isFunctionVisibleInGivenScope = (
|
||||
): boolean => {
|
||||
const {
|
||||
behaviorMetadata,
|
||||
objectMetadata,
|
||||
extension,
|
||||
} = enumeratedInstructionOrExpressionMetadata.scope;
|
||||
const { eventsBasedBehavior, eventsFunctionsExtension } = scope;
|
||||
const {
|
||||
eventsBasedBehavior,
|
||||
eventsBasedObject,
|
||||
eventsFunctionsExtension,
|
||||
} = scope;
|
||||
|
||||
return !!(
|
||||
((enumeratedInstructionOrExpressionMetadata.isRelevantForLayoutEvents &&
|
||||
@@ -85,10 +90,11 @@ const isFunctionVisibleInGivenScope = (
|
||||
scope.eventsFunction &&
|
||||
scope.eventsFunction.isAsync()) ||
|
||||
(enumeratedInstructionOrExpressionMetadata.isRelevantForCustomObjectEvents &&
|
||||
scope.eventsBasedObject)) &&
|
||||
eventsBasedObject)) &&
|
||||
// Check visibility.
|
||||
((!enumeratedInstructionOrExpressionMetadata.isPrivate &&
|
||||
(!behaviorMetadata || !behaviorMetadata.isPrivate())) ||
|
||||
(!behaviorMetadata || !behaviorMetadata.isPrivate()) &&
|
||||
(!objectMetadata || !objectMetadata.isPrivate())) ||
|
||||
// The instruction or expression is marked as "private":
|
||||
// we now compare its scope (where it was declared) and the current scope
|
||||
// (where we are) to see if we should filter it or not.
|
||||
@@ -101,12 +107,19 @@ const isFunctionVisibleInGivenScope = (
|
||||
eventsFunctionsExtension.getName(),
|
||||
eventsBasedBehavior.getName()
|
||||
) === behaviorMetadata.getName()) ||
|
||||
(objectMetadata &&
|
||||
eventsBasedObject &&
|
||||
eventsFunctionsExtension &&
|
||||
gd.PlatformExtension.getObjectFullType(
|
||||
eventsFunctionsExtension.getName(),
|
||||
eventsBasedObject.getName()
|
||||
) === objectMetadata.getName()) ||
|
||||
// When editing the extension...
|
||||
(eventsFunctionsExtension &&
|
||||
eventsFunctionsExtension.getName() === extension.getName() &&
|
||||
// ...show public functions of a private behavior
|
||||
(!enumeratedInstructionOrExpressionMetadata.isPrivate ||
|
||||
// ...show private non-behavior functions
|
||||
!behaviorMetadata)))
|
||||
(!behaviorMetadata && !objectMetadata))))
|
||||
);
|
||||
};
|
||||
|
@@ -35,7 +35,11 @@ import ContextMenu, {
|
||||
import type { ClientCoordinates } from '../../../../Utils/UseLongTouch';
|
||||
import PreferencesContext from '../../../Preferences/PreferencesContext';
|
||||
import useAlertDialog from '../../../../UI/Alert/useAlertDialog';
|
||||
const electron = optionalRequire('electron');
|
||||
// It's important to use remote and not electron for folder actions,
|
||||
// otherwise they will be opened in the background.
|
||||
// See https://github.com/electron/electron/issues/4349#issuecomment-777475765
|
||||
const remote = optionalRequire('@electron/remote');
|
||||
const shell = remote ? remote.shell : null;
|
||||
const path = optionalRequire('path');
|
||||
|
||||
const styles = {
|
||||
@@ -72,10 +76,8 @@ type Props = {|
|
||||
|};
|
||||
|
||||
const locateProjectFile = (file: FileMetadataAndStorageProviderName) => {
|
||||
if (!electron) return;
|
||||
electron.shell.showItemInFolder(
|
||||
path.resolve(file.fileMetadata.fileIdentifier)
|
||||
);
|
||||
if (!shell) return;
|
||||
shell.showItemInFolder(path.resolve(file.fileMetadata.fileIdentifier));
|
||||
};
|
||||
|
||||
const ProjectFileList = ({
|
||||
|
@@ -144,7 +144,10 @@ export const enumerateObjectTypes = (
|
||||
.getExtensionObjectsTypes()
|
||||
.toJSArray()
|
||||
.map(objectType => extension.getObjectMetadata(objectType))
|
||||
.filter(objectMetadata => !objectMetadata.isHidden())
|
||||
.filter(
|
||||
objectMetadata =>
|
||||
!objectMetadata.isHidden() && !objectMetadata.isPrivate()
|
||||
)
|
||||
.map(objectMetadata => ({
|
||||
extension,
|
||||
objectMetadata,
|
||||
|
@@ -10,8 +10,11 @@ import Window from '../../Utils/Window';
|
||||
import ResourcesLoader from '../../ResourcesLoader';
|
||||
|
||||
const path = optionalRequire('path');
|
||||
const electron = optionalRequire('electron');
|
||||
// It's important to use remote and not electron for folder actions,
|
||||
// otherwise they will be opened in the background.
|
||||
// See https://github.com/electron/electron/issues/4349#issuecomment-777475765
|
||||
const remote = optionalRequire('@electron/remote');
|
||||
const shell = remote ? remote.shell : null;
|
||||
const app = remote ? remote.app : null;
|
||||
|
||||
export const generateGetResourceActions = ({
|
||||
@@ -40,7 +43,7 @@ export const generateGetResourceActions = ({
|
||||
resource.getName(),
|
||||
{}
|
||||
);
|
||||
if (app && path && electron) {
|
||||
if (app && path && shell) {
|
||||
const defaultPath = path.join(
|
||||
app.getPath('downloads'),
|
||||
resource.getName()
|
||||
@@ -68,8 +71,7 @@ export const generateGetResourceActions = ({
|
||||
informUser({
|
||||
actionLabel: <Trans>Open folder</Trans>,
|
||||
message: <Trans>The resource has been downloaded</Trans>,
|
||||
onActionClick: () =>
|
||||
electron.shell.showItemInFolder(path.resolve(targetPath)),
|
||||
onActionClick: () => shell.showItemInFolder(path.resolve(targetPath)),
|
||||
});
|
||||
} else {
|
||||
Window.openExternalURL(resourceUrl);
|
||||
|
@@ -19,6 +19,7 @@ const path = optionalRequire('path');
|
||||
// otherwise they will be opened in the background.
|
||||
// See https://github.com/electron/electron/issues/4349#issuecomment-777475765
|
||||
const remote = optionalRequire('@electron/remote');
|
||||
const shell = remote ? remote.shell : null;
|
||||
|
||||
export const locateResourceFile = ({
|
||||
project,
|
||||
@@ -32,7 +33,7 @@ export const locateResourceFile = ({
|
||||
resource.getName()
|
||||
);
|
||||
|
||||
remote.shell.showItemInFolder(path.resolve(resourceFilePath));
|
||||
if (shell) shell.showItemInFolder(path.resolve(resourceFilePath));
|
||||
};
|
||||
|
||||
export const openResourceFile = ({
|
||||
@@ -46,7 +47,7 @@ export const openResourceFile = ({
|
||||
project,
|
||||
resource.getName()
|
||||
);
|
||||
remote.shell.openPath(path.resolve(resourceFilePath));
|
||||
if (shell) shell.openPath(path.resolve(resourceFilePath));
|
||||
};
|
||||
|
||||
export const copyResourceFilePath = ({
|
||||
|
@@ -220,6 +220,41 @@ const createField = (
|
||||
getLabel,
|
||||
getDescription,
|
||||
};
|
||||
} else if (valueType === 'animationname') {
|
||||
return {
|
||||
getChoices: () => {
|
||||
if (!object) {
|
||||
return [];
|
||||
}
|
||||
const animationArray = mapFor(
|
||||
0,
|
||||
object.getConfiguration().getAnimationsCount(),
|
||||
i => {
|
||||
const animationName = object.getConfiguration().getAnimationName(i);
|
||||
if (animationName === '') {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
value: animationName,
|
||||
label: animationName,
|
||||
};
|
||||
}
|
||||
).filter(Boolean);
|
||||
animationArray.push({ value: '', label: '(no animation)' });
|
||||
return animationArray;
|
||||
},
|
||||
name,
|
||||
valueType: 'string',
|
||||
getValue: (instance: Instance): string => {
|
||||
return getProperties(instance)
|
||||
.get(name)
|
||||
.getValue();
|
||||
},
|
||||
setValue: (instance: Instance, newValue: string) => {
|
||||
onUpdateProperty(instance, name, newValue);
|
||||
},
|
||||
getLabel,
|
||||
};
|
||||
} else {
|
||||
console.error(
|
||||
`A property with type=${valueType} could not be mapped to a field. Ensure that this type is correct and understood by the IDE.`
|
||||
|
@@ -30,6 +30,7 @@ const gd: libGDevelop = global.gd;
|
||||
// otherwise they will be opened in the background.
|
||||
// See https://github.com/electron/electron/issues/4349#issuecomment-777475765
|
||||
const remote = optionalRequire('@electron/remote');
|
||||
const shell = remote ? remote.shell : null;
|
||||
const path = optionalRequire('path');
|
||||
const styles = {
|
||||
container: {
|
||||
@@ -208,8 +209,8 @@ export default class ResourcesEditor extends React.Component<Props, State> {
|
||||
};
|
||||
|
||||
openProjectFolder = () => {
|
||||
if (remote)
|
||||
remote.shell.openPath(path.dirname(this.props.project.getProjectFile()));
|
||||
if (shell)
|
||||
shell.openPath(path.dirname(this.props.project.getProjectFile()));
|
||||
};
|
||||
|
||||
toggleProperties = () => {
|
||||
|
Reference in New Issue
Block a user