Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
mika-f committed May 1, 2023
2 parents 84b81a2 + 2a02924 commit 52bd17f
Show file tree
Hide file tree
Showing 13 changed files with 347 additions and 194 deletions.
64 changes: 64 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Bug Report
description: File a bug report
title: "[Bug]: "
labels: ["bug"]
assignees:
- mika-f
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
- type: textarea
id: what-happened
attributes:
label: What happened?
description: Also tell us, what did you expect to happen?
placeholder: Tell us what you see!
value: "A bug happened!"
validations:
required: true
- type: dropdown
id: add-on-version
attributes:
label: Add-on Version
description: What version of Add-on are you running?
options:
- 2.0.0
- 2.1.0
- 2.2.0
- 2.3.0
- 2.4.0
- 2.5.0
- 2.6.0
validations:
required: true
- type: dropdown
id: blender-version
attributes:
label: Blender versions
description: What version of Blender are you running?
multiple: true
options:
- 3.1.0
- 3.1.1
- 3.1.2
- 3.2.0
- 3.2.1
- 3.2.2
- 3.3.0
- 3.3.1
- 3.3.2
- 3.3.3
- 3.3.4
- 3.4.0
- 3.4.1
- 3.5.0
- 3.5.1
- edge
- type: textarea
id: logs
attributes:
label: Relevant log output
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: Shell
43 changes: 43 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Feature Request
description: File a feature request
title: "[Feature Request]: "
labels: ["enhancement"]
assignees:
- mika-f
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this feature request!
- type: textarea
id: what-do-you-want
attributes:
label: What do you want?
description: Also tell us, what features you would like.
placeholder: Tell us what you see!
value: "A new great feature!"
validations:
required: true
- type: dropdown
id: blender-version
attributes:
label: Blender versions
description: What version of Blender are you running?
multiple: true
options:
- 3.1.0
- 3.1.1
- 3.1.2
- 3.2.0
- 3.2.1
- 3.2.2
- 3.3.0
- 3.3.1
- 3.3.2
- 3.3.3
- 3.3.4
- 3.4.0
- 3.4.1
- 3.5.0
- 3.5.1
- edge
15 changes: 15 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## Prepare for release the new version

### QA CHECKS

- [ ] Is is possible to import files such as FBX files via D&D from Explorer?
- [ ] Is is possible to import files such as Material files via D&D from Asset Explorer in Blender?
- [ ] Is it possible to import files such as Image files via D&D from Explorer and create a new plane?

### RELEASE CHECKS

- [ ] Is the version number bumped / updated?
- [ ] `.github/ISSUE_TEMPLATE/bug-report.yml`
- [ ] `src/blender-extension/__init__.py`
- [ ] `Makefile`
- [ ] `README.md`
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARCH = x64
REVISION = 2.4.0
REVISION = 2.6.0

ALL_TASKS = Release

Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ v2.0.0 supports the following versions of Blender:
- Blender 3.3.4 (x64 - Windows)
- Blender 3.4.0 (x64 - Windows)
- Blender 3.4.1 (x64 - Windows)
- Blender 3.5.0 (x64 - Windows)
- Blender 3.5.1 (x64 - Windows)

## Installation

Expand All @@ -43,6 +45,10 @@ v2.0.0 supports the following versions of Blender:
- If you enable this addon, load DLL and replace it function.
- And you disable this addon, unload DLL and restore it function.

## Release

Create a new pull request from GitHub to bump versions with pr template.

## License

MIT by [@6jz](https://twitter.com/6jz)
2 changes: 1 addition & 1 deletion src/blender-extension/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"author": "Natsuneko",
"description": "Blender add-on for import some files from drag-and-drop",
"blender": (3, 1, 0),
"version": (2, 4, 0),
"version": (2, 6, 0),
"location": "Drag and Drop Support",
"warning": "",
"category": "Import-Export"
Expand Down
201 changes: 87 additions & 114 deletions src/blender-extension/properties.py

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/blender-extension/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fake-bpy-module-3.1==20230117
75 changes: 46 additions & 29 deletions src/blender-injection/BlenderObj.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// define memory layouts of Blender

struct Context
struct bContext
{
int thread;

Expand All @@ -22,8 +22,8 @@ struct Context

struct PollMsgDyn_Params
{
char* (*get_fn)(Context*, void*);
char* (*free_fn)(Context*, void*);
char* (*get_fn)(bContext*, void*);
char* (*free_fn)(bContext*, void*);
void* user_data;
} operator_poll_msg_dyn_params;
} wm;
Expand Down Expand Up @@ -52,51 +52,68 @@ using ListBase = struct ListBase

using wmDragActiveDropState = struct wmDragActiveDropState
{
/** Informs which dropbox is activated with the drag item.
* When this value changes, the #draw_activate and #draw_deactivate dropbox callbacks are
* triggered.
*/
struct wmDropBox* active_dropbox;

/** If `active_dropbox` is set, the area it successfully polled in. To restore the context of it
* as needed. */
struct ScrArea* area_from;
/** If `active_dropbox` is set, the region it successfully polled in. To restore the context of
* it as needed. */
struct ARegion* region_from;

/** If `active_dropbox` is set, additional context provided by the active (i.e. hovered) button.
* Activated before context sensitive operations (polling, drawing, dropping). */
struct bContextStore* ui_context;

/** Text to show when a dropbox poll succeeds (so the dropbox itself is available) but the
* operator poll fails. Typically the message the operator set with
* CTX_wm_operator_poll_msg_set(). */
const char* disabled_info;
bool free_disabled_info;
};

using wmDrag = struct wmDrag
{
struct wmDrag *next, *prev;

int icon;
/** See 'WM_DRAG_' defines above. */
int type;
void* poin;
char path[1024]; /* FILE_MAX */
char path[1024];
double value;

/** If no icon but imbuf should be drawn around cursor. */
struct ImBuf* imb;
float imbuf_scale;

wmDragActiveDropState drop_state;

eWM_DragFlags flags;

/** List of wmDragIDs, all are guaranteed to have the same ID type. */
ListBase ids;
/** List of `wmDragAssetListItem`s. */
ListBase asset_items;
};

using wmTabletData = struct wmTabletData
{
int active;
float pressure;
float x_tilt;
float y_tilt;
char is_motion_absolute;
};

using eWM_EventFlag = enum eWM_EventFlag
{
WM_EVENT_SCROLL_INVERT = (1 << 0),
WM_EVENT_IS_REPEAT = (1 << 1),
WM_EVENT_FORCE_DRAG_THRESHOLD = (1 << 2),
};

using wmEvent = struct wmEvent
{
struct wmEvent *next, *prev;
short type;
short val;
int xy[2];
int mval[2];
char utf8_buf[6];
uint8_t modifier;
int8_t direction;
short keymodifier;
wmTabletData tablet;
eWM_EventFlag flag;
short custom;
short customdata_free;
void* customdata;
short prev_type;
short prev_val;
int prev_xy[2];
short prev_press_type;
int prev_press_xy[2];
uint8_t prev_press_modifier;
short prev_press_keymodifier;
double prev_press_time;
};
17 changes: 17 additions & 0 deletions src/blender-injection/BlenderPatchPatterns.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,5 +196,22 @@ static std::unordered_map<std::string, BlenderPatchPattern> Patchers{
"E8 7B FF FF FF 84 C0",
"E8 FB B6 00 00 48 85 C0"
}
},
{
"3.5.0",
{
"E8 C8 AD 3F 00",
"4C 8D 05 09 08 00 00",
"E8 7B FF FF FF 84 C0",
"E8 0B BC 00 00 48 85 C0"
}
},
{
"3.5.1", {
"E8 AE 4D 3F 00 84 DB",
"4C 8D 05 09 08 00 00",
"E8 7B FF FF FF 84 C0",
"E8 0B BC 00 00 48 85 C0"
}
}
};
63 changes: 40 additions & 23 deletions src/blender-injection/Injections.asm
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

EXTERN DropEventHookCallback : PROC
EXTERN View3DImaEmptyDropPollHookCallback : PROC
EXTERN view3d_ima_drop_poll : PROC
EXTERN ED_view3d_give_object_under_cursor : PROC

PUBLIC DropEventHook
PUBLIC View3DImaEmptyDropPollHook
Expand Down Expand Up @@ -47,38 +45,57 @@ DropEventHook ENDP
;
; Args : (RCX, RDX, R8)
; Restore : if dropped file is supported, returns true, otherwise; returns false.

; Original Assembly
;
; STATEMENT:
; MOV QWORD PTR [RSP+08h], RBX
; PUSH RDI
; SUB RSP, 20h
; MOV RBX, R8
; MOV RDI, RCX
;
; CALL view3d_ima_drop_poll
; TEST AL, AL
; JZ RET_FALSE
;
; LEA RDX, QWORD PTR [RBX+1Ch]
; MOV RCX, RDI
;
; CALL ED_view3d_give_object_under_cursor
; TEST RAX, RAX
; JZ RET_TRUE
;
; CMP WORD PTR [RAX+000000E0h], 0000h
; JNZ RET_FALSE
;
; CMP WORD PTR [RAX+000003FFh], 00000008h
; JNZ RET_FALSE
;
; RET_TRUE:
; MOV AL, 01h
; MOV RBX, QWIRD PTR [RSP+30h]
; ADD RSP, 20h
; POP RDI
; RET
;
; RET_FALSE:
; MOV RBX, QWORD PTR [RSP+30h]
; XOR AL, AL
; ADD RSP, 20h
; POP RDI
; RET
View3DImaEmptyDropPollHook PROC
MOV QWORD PTR [RSP+08h], RBX
PUSH RDI
SUB RSP, 20h
MOV RBX, R8
MOV RDI, RCX
MOV R12, RDX

CALL View3DImaEmptyDropPollHookCallback
TEST AL, AL
JNZ RET_FALSE

MOV RCX, RDI
MOV RDX, R12
MOV R8, RBX

CALL view3d_ima_drop_poll
TEST AL, AL
JZ RET_FALSE

LEA RDX, QWORD PTR [RBX+1Ch]
MOV RCX, RDI
CALL ED_view3d_give_object_under_cursor
TEST RAX, RAX
JZ RET_TRUE

CMP WORD PTR [RAX+000000E0h], 0000h
JNZ RET_FALSE

CMP BYTE PTR [RAX+000003FFh], 00000008h
JNZ RET_FALSE

; Return When True
RET_TRUE:
MOV AL, 01h
Expand Down
Loading

0 comments on commit 52bd17f

Please sign in to comment.