Material comment details

This commit is contained in:
barsdeveloper
2023-04-26 21:25:56 +02:00
parent b96746d1d9
commit 53c28e7049
6 changed files with 92 additions and 12 deletions

54
dist/ueblueprint.js vendored
View File

@@ -154,6 +154,7 @@ class Configuration {
makeSet: "/Script/BlueprintGraph.K2Node_MakeSet",
materialExpressionConstant2Vector: "/Script/Engine.MaterialExpressionConstant2Vector",
materialExpressionTextureCoordinate: "/Script/Engine.MaterialExpressionTextureCoordinate",
materialGraphNodeComment: "/Script/UnrealEd.MaterialGraphNode_Comment",
materialGraphNode: "/Script/UnrealEd.MaterialGraphNode",
multiGate: "/Script/BlueprintGraph.K2Node_MultiGate",
pawn: "/Script/Engine.Pawn",
@@ -2918,6 +2919,14 @@ class ObjectEntity extends IEntity {
type: GuidEntity,
showDefault: false,
},
SizeX: {
type: IntegerEntity,
showDefault: false,
},
SizeY: {
type: IntegerEntity,
showDefault: false,
},
NodePosX: {
type: IntegerEntity,
showDefault: false,
@@ -3085,9 +3094,12 @@ class ObjectEntity extends IEntity {
/** @type {Number?} */ this.R;
/** @type {Number?} */ this.G;
/** @type {ObjectReferenceEntity?} */ this.MaterialExpression;
/** @type {ObjectReferenceEntity?} */ this.MaterialExpressionComment;
/** @type {SymbolEntity?} */ this.MoveMode;
/** @type {String?} */ this.TimelineName;
/** @type {GuidEntity?} */ this.TimelineGuid;
/** @type {IntegerEntity?} */ this.SizeX;
/** @type {IntegerEntity?} */ this.SizeY;
/** @type {IntegerEntity} */ this.NodePosX;
/** @type {IntegerEntity} */ this.NodePosY;
/** @type {IntegerEntity?} */ this.NodeWidth;
@@ -3170,8 +3182,8 @@ class ObjectEntity extends IEntity {
}
getNodeWidth() {
return this.NodeWidth ??
this.getType() == Configuration.paths.comment ? Configuration.defaultCommentWidth : undefined
return this.NodeWidth
?? this.isComment() ? Configuration.defaultCommentWidth : undefined
}
/** @param {Number} value */
@@ -3180,11 +3192,18 @@ class ObjectEntity extends IEntity {
this.NodeWidth = new IntegerEntity();
}
this.NodeWidth.value = value;
const materialComment = this.getMaterialSubobject();
if (materialComment) {
if (!materialComment.SizeX) {
materialComment.SizeX = new IntegerEntity();
}
materialComment.SizeX.value = value;
}
}
getNodeHeight() {
return this.NodeHeight ??
this.getType() == Configuration.paths.comment ? Configuration.defaultCommentHeight : undefined
return this.NodeHeight
?? this.isComment() ? Configuration.defaultCommentHeight : undefined
}
/** @param {Number} value */
@@ -3193,6 +3212,13 @@ class ObjectEntity extends IEntity {
this.NodeHeight = new IntegerEntity();
}
this.NodeHeight.value = value;
const materialComment = this.getMaterialSubobject();
if (materialComment) {
if (!materialComment.SizeY) {
materialComment.SizeY = new IntegerEntity();
}
materialComment.SizeY.value = value;
}
}
getNodePosX() {
@@ -3249,10 +3275,27 @@ class ObjectEntity extends IEntity {
return false
}
isComment() {
switch (this.getClass()) {
case Configuration.paths.comment:
case Configuration.paths.materialGraphNodeComment:
return true
}
return false
}
isMaterial() {
return this.getClass() === Configuration.paths.materialGraphNode || this.MaterialExpression !== undefined
}
/** @return {ObjectEntity} */
getMaterialSubobject() {
const expression = this.MaterialExpression ?? this.MaterialExpressionComment;
return expression
? this[Configuration.subObjectAttributeNameFromReference(expression, true)]
: null
}
isDevelopmentOnly() {
const nodeClass = this.getClass();
return this.EnabledState?.toString() === "DevelopmentOnly"
@@ -5914,6 +5957,7 @@ class BlueprintTemplate extends ITemplate {
getCommentNodes(justSelected = false) {
return this.blueprint.querySelectorAll(
`ueb-node[data-type="${Configuration.paths.comment}"]${justSelected ? '[data-selected="true"]' : ''}`
+ `, ueb-node[data-type="${Configuration.paths.materialGraphNodeComment}"]${justSelected ? '[data-selected="true"]' : ''}`
)
}
@@ -8069,6 +8113,7 @@ class NodeElement extends ISelectableDraggableElement {
}
switch (nodeEntity.getClass()) {
case Configuration.paths.comment:
case Configuration.paths.materialGraphNodeComment:
return CommentNodeTemplate
case Configuration.paths.createDelegate:
return NodeTemplate
@@ -10099,7 +10144,6 @@ class PinElement extends IElement {
"MUTABLE_REFERENCE": ReferencePinTemplate,
"name": NamePinTemplate,
"real": RealPinTemplate,
"red": RealPinTemplate,
"string": StringPinTemplate,
[Configuration.paths.linearColor]: LinearColorPinTemplate,
[Configuration.paths.rotator]: RotatorPinTemplate,

File diff suppressed because one or more lines are too long

View File

@@ -130,6 +130,7 @@ export default class Configuration {
makeSet: "/Script/BlueprintGraph.K2Node_MakeSet",
materialExpressionConstant2Vector: "/Script/Engine.MaterialExpressionConstant2Vector",
materialExpressionTextureCoordinate: "/Script/Engine.MaterialExpressionTextureCoordinate",
materialGraphNodeComment: "/Script/UnrealEd.MaterialGraphNode_Comment",
materialGraphNode: "/Script/UnrealEd.MaterialGraphNode",
multiGate: "/Script/BlueprintGraph.K2Node_MultiGate",
pawn: "/Script/Engine.Pawn",

View File

@@ -142,6 +142,7 @@ export default class NodeElement extends ISelectableDraggableElement {
}
switch (nodeEntity.getClass()) {
case Configuration.paths.comment:
case Configuration.paths.materialGraphNodeComment:
return CommentNodeTemplate
case Configuration.paths.createDelegate:
return NodeTemplate

View File

@@ -173,6 +173,14 @@ export default class ObjectEntity extends IEntity {
type: GuidEntity,
showDefault: false,
},
SizeX: {
type: IntegerEntity,
showDefault: false,
},
SizeY: {
type: IntegerEntity,
showDefault: false,
},
NodePosX: {
type: IntegerEntity,
showDefault: false,
@@ -201,6 +209,10 @@ export default class ObjectEntity extends IEntity {
type: Boolean,
showDefault: false,
},
Text: {
type: String,
showDefault: false,
},
NodeComment: {
type: String,
showDefault: false,
@@ -340,9 +352,12 @@ export default class ObjectEntity extends IEntity {
/** @type {Number?} */ this.R
/** @type {Number?} */ this.G
/** @type {ObjectReferenceEntity?} */ this.MaterialExpression
/** @type {ObjectReferenceEntity?} */ this.MaterialExpressionComment
/** @type {SymbolEntity?} */ this.MoveMode
/** @type {String?} */ this.TimelineName
/** @type {GuidEntity?} */ this.TimelineGuid
/** @type {IntegerEntity?} */ this.SizeX
/** @type {IntegerEntity?} */ this.SizeY
/** @type {IntegerEntity} */ this.NodePosX
/** @type {IntegerEntity} */ this.NodePosY
/** @type {IntegerEntity?} */ this.NodeWidth
@@ -350,6 +365,7 @@ export default class ObjectEntity extends IEntity {
/** @type {Boolean?} */ this.bCanRenameNode
/** @type {Boolean?} */ this.bCommentBubblePinned
/** @type {Boolean?} */ this.bCommentBubbleVisible
/** @type {String?} */ this.Text
/** @type {String?} */ this.NodeComment
/** @type {IdentifierEntity?} */ this.AdvancedPinDisplay
/** @type {IdentifierEntity?} */ this.EnabledState
@@ -425,8 +441,8 @@ export default class ObjectEntity extends IEntity {
}
getNodeWidth() {
return this.NodeWidth ??
this.getType() == Configuration.paths.comment ? Configuration.defaultCommentWidth : undefined
return this.NodeWidth
?? this.isComment() ? Configuration.defaultCommentWidth : undefined
}
/** @param {Number} value */
@@ -438,8 +454,8 @@ export default class ObjectEntity extends IEntity {
}
getNodeHeight() {
return this.NodeHeight ??
this.getType() == Configuration.paths.comment ? Configuration.defaultCommentHeight : undefined
return this.NodeHeight
?? this.isComment() ? Configuration.defaultCommentHeight : undefined
}
/** @param {Number} value */
@@ -504,10 +520,27 @@ export default class ObjectEntity extends IEntity {
return false
}
isComment() {
switch (this.getClass()) {
case Configuration.paths.comment:
case Configuration.paths.materialGraphNodeComment:
return true
}
return false
}
isMaterial() {
return this.getClass() === Configuration.paths.materialGraphNode || this.MaterialExpression !== undefined
}
/** @return {ObjectEntity} */
getMaterialSubobject() {
const expression = this.MaterialExpression ?? this.MaterialExpressionComment
return expression
? this[Configuration.subObjectAttributeNameFromReference(expression, true)]
: null
}
isDevelopmentOnly() {
const nodeClass = this.getClass()
return this.EnabledState?.toString() === "DevelopmentOnly"

View File

@@ -189,6 +189,7 @@ export default class BlueprintTemplate extends ITemplate {
getCommentNodes(justSelected = false) {
return this.blueprint.querySelectorAll(
`ueb-node[data-type="${Configuration.paths.comment}"]${justSelected ? '[data-selected="true"]' : ''}`
+ `, ueb-node[data-type="${Configuration.paths.materialGraphNodeComment}"]${justSelected ? '[data-selected="true"]' : ''}`
)
}