mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 14:53:44 +08:00
feat(编辑渲染): 修复资源引用,完善注解读取
This commit is contained in:
1 parent
a5f51294eb
commit
52fc88f2b8
14 files changed
+198
-114
No files matched your search
@@ -98,12 +98,12 @@ func (e *Editor) DrawParam(id string, resolved bool) (*DrawParam, error) {
|
||||
return cloneEditorData(draw), nil
|
||||
}
|
||||
for _, resource := range e.resources {
|
||||
if resource.draw != nil && resource.draw.ID == id {
|
||||
if resource.draw != nil && sameResourceID(resource.draw.ID, id) {
|
||||
return cloneEditorData(resource.draw), nil
|
||||
}
|
||||
}
|
||||
if e.source != nil {
|
||||
if value := e.source.reader.drawParamCache[id]; value != nil {
|
||||
if value, _ := resourceValue(e.source.reader.drawParamCache, id); value != nil {
|
||||
return cloneEditorData(value), nil
|
||||
}
|
||||
}
|
||||
@@ -425,13 +425,16 @@ func (e *Editor) editorDrawParam(id string, visited map[string]bool) (*DrawParam
|
||||
}
|
||||
var dp *DrawParam
|
||||
for _, resource := range e.resources {
|
||||
if resource.draw != nil && resource.draw.ID == id {
|
||||
if resource.draw != nil && sameResourceID(resource.draw.ID, id) {
|
||||
dp = resource.draw
|
||||
break
|
||||
}
|
||||
}
|
||||
if dp == nil && e.source != nil {
|
||||
dp = e.source.reader.drawParamCache[id]
|
||||
dp, _ = resourceValue(e.source.reader.drawParamCache, id)
|
||||
}
|
||||
if key := editorResourceID(id); key != "" {
|
||||
id = key
|
||||
}
|
||||
if dp == nil || visited[id] {
|
||||
return nil, &EditError{Code: EditUnsupportedStyle, Err: fmt.Errorf("invalid draw parameter reference %q", id)}
|
||||
|
||||
Reference in new issue
Block a user